message
stringlengths
2
23.4k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
129
108k
cluster
float64
6
6
__index_level_0__
int64
258
216k
Provide tags and a correct Python 3 solution for this coding contest problem. A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a...
instruction
0
97,263
6
194,526
Tags: bitmasks, brute force, dp Correct Solution: ``` import itertools def count_inversions(enumerate_seq): tmp = list(enumerate_seq[:]) result = 0 for i in range(len(tmp)): for j in range(len(tmp) - 1): if tmp[j][0] > tmp[j + 1][0]: result += 1 tmp[j], ...
output
1
97,263
6
194,527
Provide tags and a correct Python 3 solution for this coding contest problem. A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a...
instruction
0
97,264
6
194,528
Tags: bitmasks, brute force, dp Correct Solution: ``` import itertools def check(curr_words, line): if curr_words == []: return True for i in range(len(line)): if line[i] == curr_words[0]: return check(curr_words[1:], line[i+1:]) return False n = int(input()) words = input().s...
output
1
97,264
6
194,529
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,546
6
195,092
Tags: brute force, implementation Correct Solution: ``` cards = input() flips = 0 for i in range(0, len(cards)): if(cards[i] in '0123456789'): if(int(cards[i])%2 != 0): flips +=1 else: if(cards[i] in 'aeiou'): flips +=1 print(flips) ```
output
1
97,546
6
195,093
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,547
6
195,094
Tags: brute force, implementation Correct Solution: ``` test_string = input() turns = 0 for char in test_string: if char in ['1', '3', '5', '7', '9', 'a', 'e', 'i', 'o', 'u']: turns += 1 print(turns) ```
output
1
97,547
6
195,095
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,548
6
195,096
Tags: brute force, implementation Correct Solution: ``` s = input("") count = 0 for i in s: if i in "aeiou13579": count +=1 print (count) ```
output
1
97,548
6
195,097
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,549
6
195,098
Tags: brute force, implementation Correct Solution: ``` s = input() cnt = 0 for c in s: if c in '13579': cnt += 1 elif c in 'aeiou': cnt += 1 print(cnt) ```
output
1
97,549
6
195,099
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,550
6
195,100
Tags: brute force, implementation Correct Solution: ``` s = input() c=0 for i in range(len(s)): if s[i] == 'a' or \ s[i] == 'e' or \ s[i] == 'i' or \ s[i] == 'o' or \ s[i] == 'u' or \ s[i] == '1' or \ s[i] == '3' or \ s[i] == '5' or \ s[i] == '7' or \ s[i] == '9': c = c + 1 pr...
output
1
97,550
6
195,101
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,551
6
195,102
Tags: brute force, implementation Correct Solution: ``` print(sum(x in 'aeiou13579' for x in input())) ```
output
1
97,551
6
195,103
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,552
6
195,104
Tags: brute force, implementation Correct Solution: ``` s = input() result = 0 for c in s: if c in ['a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9']: result += 1 print(result) ```
output
1
97,552
6
195,105
Provide tags and a correct Python 3 solution for this coding contest problem. Your friend has n cards. You know that each card has a lowercase English letter on one side and a digit on the other. Currently, your friend has laid out the cards on a table so only one side of each card is visible. You would like to kno...
instruction
0
97,553
6
195,106
Tags: brute force, implementation Correct Solution: ``` s = input() l = len(s) match = ['a','e','i','u','o'] match_num = ['0','2','4','6','8'] count = 0 for i in range(l): if s[i].isdigit(): if not (s[i] in match_num): count += 1 else: if s[i] in match: count += 1 print(count) ```
output
1
97,553
6
195,107
Provide tags and a correct Python 3 solution for this coding contest problem. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requir...
instruction
0
97,562
6
195,124
Tags: *special, strings, trees Correct Solution: ``` # python3 # utf-8 class Trie: def __init__(self): self.letter___node = {} self.words_nr = 0 def add_word(self, word): word = word + '$' curr_node = self for letter in word: if letter not in curr_node.lette...
output
1
97,562
6
195,125
Provide tags and a correct Python 3 solution for this coding contest problem. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requir...
instruction
0
97,563
6
195,126
Tags: *special, strings, trees Correct Solution: ``` class Ddict: def __init__(self): self.dicts={} def add(self,key): d=self.dicts for i in key: if i not in d: d[i]={} d=d[i] d[' ']='' def find(self,key): if key=='': ...
output
1
97,563
6
195,127
Provide tags and a correct Python 3 solution for this coding contest problem. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requir...
instruction
0
97,564
6
195,128
Tags: *special, strings, trees Correct Solution: ``` # ------------------- fast io -------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() sel...
output
1
97,564
6
195,129
Provide tags and a correct Python 3 solution for this coding contest problem. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requir...
instruction
0
97,565
6
195,130
Tags: *special, strings, trees Correct Solution: ``` import sys import re SEPARATORS = "[.,? !'-]" class TrieNode(object): def __init__(self): self.terminal = False self.go = {} self.count = 0 def insert(node, s): nodes = [node] unique, auto = 0, 0 for c in s: if c not...
output
1
97,565
6
195,131
Provide tags and a correct Python 3 solution for this coding contest problem. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requir...
instruction
0
97,566
6
195,132
Tags: *special, strings, trees Correct Solution: ``` import sys def read_text(): text = '' for line in sys.stdin: text += line return text # def read_text(): # text = '' # next_line = input() # while len(next_line) > 0: # text += next_line + '\n' # next_line = input() ...
output
1
97,566
6
195,133
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each le...
instruction
0
97,567
6
195,134
No
output
1
97,567
6
195,135
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each le...
instruction
0
97,568
6
195,136
No
output
1
97,568
6
195,137
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each le...
instruction
0
97,569
6
195,138
No
output
1
97,569
6
195,139
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each le...
instruction
0
97,570
6
195,140
No
output
1
97,570
6
195,141
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,821
6
195,642
Tags: dp, hashing, strings Correct Solution: ``` import math from collections import defaultdict def main(): p = 31 m = 1e9 + 9 def string_hash(s): hash_value = 0 p_pow = 1 for c in s: hash_value = (hash_value + (ord(c)-ord('a')+1) * p_pow) % m p_pow = (p_po...
output
1
97,821
6
195,643
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,822
6
195,644
Tags: dp, hashing, strings Correct Solution: ``` n = int(input()) arr = input() final = len(arr) arr = arr.split() lens = [0 for x in range(n)] visit = [0 for x in range(n)] cnt = 0 ans = 0 for i in range(n): if visit[i]: continue lens[cnt] = len(arr[i]) for j in range(i+1,n): if arr[j]==arr[i]: arr...
output
1
97,822
6
195,645
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,823
6
195,646
Tags: dp, hashing, strings Correct Solution: ``` n = int(input()) s = input() a = list(s.split()) eq = [[0 for i in range(n)] for j in range(n)] dp = [[0 for i in range(n)] for j in range(n)] for i in range(n): eq[i][i] = 1 for j in range(0, i): if a[i] == a[j]: eq[i][j] += 1 eq[...
output
1
97,823
6
195,647
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,824
6
195,648
Tags: dp, hashing, strings Correct Solution: ``` # import time N = 303 eq = [] dp = [] for i in range(N): eq.append([False] * N) for i in range(N): dp.append([0] * N) n = int(input()) s = input() # t = time.time() allsum = len(s) s = s.split() for i in range(n): eq[i][i] = True for j in range(i): ...
output
1
97,824
6
195,649
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,825
6
195,650
Tags: dp, hashing, strings Correct Solution: ``` # import time N = 303 eq = [] dp = [] for i in range(N): eq.append([False] * N) for i in range(N): dp.append([0] * N) n = int(input()) s = input() # t = time.time() allsum = len(s) s = s.split() for i in range(n): eq[i][i] = True for j in range(i): ...
output
1
97,825
6
195,651
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,826
6
195,652
Tags: dp, hashing, strings Correct Solution: ``` from sys import stdin def kmp(pat, txt): leng = 0;i = 1 ans=0 M = len(pat) ;N = len(txt) ;lps = [0]*M ;j = 0 #Calculo de lps, prefifo propio mas largo que tambien es sufijo de pat[0:i] while i < M: if pat[i]== pat[leng]: leng += 1 ...
output
1
97,826
6
195,653
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length of text is the numbe...
instruction
0
97,827
6
195,654
Tags: dp, hashing, strings Correct Solution: ``` import sys input = sys.stdin.readline n = int(input()) s = input() a = list(s.split()) eq = [[0 for i in range(n)] for j in range(n)] dp = [[0 for i in range(n)] for j in range(n)] for i in range(n): eq[i][i] = 1 for j in range(0, i): if a[i] == a[j]: ...
output
1
97,827
6
195,655
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after...
instruction
0
97,828
6
195,656
No
output
1
97,828
6
195,657
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after...
instruction
0
97,829
6
195,658
No
output
1
97,829
6
195,659
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after...
instruction
0
97,830
6
195,660
No
output
1
97,830
6
195,661
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after...
instruction
0
97,831
6
195,662
No
output
1
97,831
6
195,663
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,970
6
195,940
Tags: implementation Correct Solution: ``` spacecnt = 0; for tag in (input().split('>'))[:-1]: if tag.find('/') != -1: spacecnt -= 2 print(' '*spacecnt+tag+'>') else: print(' '*spacecnt+tag+'>') spacecnt += 2 ```
output
1
97,970
6
195,941
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,971
6
195,942
Tags: implementation Correct Solution: ``` from string import ascii_lowercase def print_end_tag(level, character): print(" " * level + f"</{character}>" if level else f"</{character}>") def print_start_tag(level, character): print(" " * level + f"<{character}>" if level else f"<{character}>") def main()...
output
1
97,971
6
195,943
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,972
6
195,944
Tags: implementation Correct Solution: ``` xml = input() tags = xml.split('>')[:-1] for i in range(len(tags)): tags[i] += '>' h = 0 for tag in tags: if '</' not in tag: print(' ' * 2 * h + tag) h += 1 else: h -= 1 print(' ' * 2 * h + tag) ```
output
1
97,972
6
195,945
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,973
6
195,946
Tags: implementation Correct Solution: ``` str_input = input() queue = [] indentation = 0 while(str_input != ""): if(str_input[1] == '/'): print("%s%s"%(indentation * " ", str_input[0:4])) queue.pop() str_input = str_input[4:] if(str_input != "" and str_input[1] == "/"): indentation -= 2 else: print("%s%...
output
1
97,973
6
195,947
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,974
6
195,948
Tags: implementation Correct Solution: ``` s = input().split(">") del s[-1] s = [i+">" for i in s] h = 0 for i in s: if "/" in i: h-=1 print(h*2*" "+i) else: print(h*2*" "+i) h+=1 ```
output
1
97,974
6
195,949
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,975
6
195,950
Tags: implementation Correct Solution: ``` h = 0 for tag in input().replace('><', '> <').split(): if '/' in tag: h -= 2 print(h*' ' + tag) if '/' not in tag: h += 2 ```
output
1
97,975
6
195,951
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,976
6
195,952
Tags: implementation Correct Solution: ``` a = input().split('>') #print(*a) bal = 0 for s in a: if len(s) == 0: continue if (s[1] == '/' ): bal -= 1 print(bal * " " + s+ ">") else: print(bal * " " + s + ">") bal +=1 ```
output
1
97,976
6
195,953
Provide tags and a correct Python 3 solution for this coding contest problem. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be nested into each other: in this case one openin...
instruction
0
97,977
6
195,954
Tags: implementation Correct Solution: ``` s=input() s1=s.split('<') del s1[0] c=0 for i in s1: if '/' in i: print(' '*(c-1),'<',i,sep='') c-=1 else: print(' '*c,'<',i,sep='') c+=1 ```
output
1
97,977
6
195,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,978
6
195,956
Yes
output
1
97,978
6
195,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,979
6
195,958
Yes
output
1
97,979
6
195,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,980
6
195,960
Yes
output
1
97,980
6
195,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,981
6
195,962
Yes
output
1
97,981
6
195,963
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,982
6
195,964
No
output
1
97,982
6
195,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,983
6
195,966
No
output
1
97,983
6
195,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,984
6
195,968
No
output
1
97,984
6
195,969
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter. Tegs can be ...
instruction
0
97,985
6
195,970
No
output
1
97,985
6
195,971
Provide tags and a correct Python 3 solution for this coding contest problem. A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. <image> You can remove a link or a pearl and insert it between two other existing links or pearls (or between ...
instruction
0
99,223
6
198,446
Tags: implementation, math Correct Solution: ``` # coding=utf-8 s = str(input()) links = 0 for i in range(len(s)): if s[i] == '-': links += 1 pearls = len(s) - links if pearls == 0: print('YES') elif links%pearls == 0: print('YES') else: print('NO') ```
output
1
99,223
6
198,447
Provide tags and a correct Python 3 solution for this coding contest problem. A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. <image> You can remove a link or a pearl and insert it between two other existing links or pearls (or between ...
instruction
0
99,224
6
198,448
Tags: implementation, math Correct Solution: ``` s = input() ls = len(s) ac = 0 bc = 0 for i in range(ls): if s[i] == 'o': ac += 1 elif s[i] == '-': bc += 1 if ac == 0: print('YES') elif bc % ac == 0: print('YES') else: print('NO') ```
output
1
99,224
6
198,449
Provide tags and a correct Python 3 solution for this coding contest problem. A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. <image> You can remove a link or a pearl and insert it between two other existing links or pearls (or between ...
instruction
0
99,225
6
198,450
Tags: implementation, math Correct Solution: ``` a = input() t = a.count("o") r = len(a) - t if t == 0: print("YES") elif r%(t) == 0: print("YES") else: print("NO") ```
output
1
99,225
6
198,451
Provide tags and a correct Python 3 solution for this coding contest problem. A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. <image> You can remove a link or a pearl and insert it between two other existing links or pearls (or between ...
instruction
0
99,226
6
198,452
Tags: implementation, math Correct Solution: ``` x=input() # print(x.count('-')%x.count('o')) if 'o' not in x: print('YES') elif '-' not in x: print('YES') elif x.count('o')==1: print('YES') elif x.count('-')%x.count('o')==0: print('YES') else: print('NO') ```
output
1
99,226
6
198,453