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. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,572
6
13,144
Tags: greedy, implementation Correct Solution: ``` n = int(input()) a = [] b = [] for i in range(n): a.append(input()) for i in range(n): k = input() if k in a: a.remove(k) else: b.append(k) c = [0,0,0,0] for i in range(len(a)): c[len(a[i])-1] += 1 print(sum(c)) ```
output
1
6,572
6
13,145
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,573
6
13,146
Tags: greedy, implementation Correct Solution: ``` n = int(input()) a , b = [] , [] for i in range(n): x = input() a.append(x) for i in range(n): x = input() if x in a : a.remove(x) print(len(a)) ```
output
1
6,573
6
13,147
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,574
6
13,148
Tags: greedy, implementation Correct Solution: ``` #!/usr/bin/env python3 A = [] B = [] N = int(input()) for i in range(N): A.append(input()) for i in range(N): B.append(input()) ans = 0 for i in B: if i in A: x = A.index(i) A = A[:x] + A[x + 1:] else: ans += 1 print(ans) ```
output
1
6,574
6
13,149
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,575
6
13,150
Tags: greedy, implementation Correct Solution: ``` n = int(input()) a = [] for i in range(n): a.append(input()) b = [] for i in range(n): cur = input() if cur in a: a.remove(cur) else: b.append(cur) print(len(b)) ```
output
1
6,575
6
13,151
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,576
6
13,152
Tags: greedy, implementation Correct Solution: ``` n = int(input()) a, b = [], [] for i in range(n): a.append( input() ) for i in range(n): b.append( input() ) for i in a: try: b.pop(b.index(i)) except Exception as e: pass print(len(b)) ```
output
1
6,576
6
13,153
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,577
6
13,154
Tags: greedy, implementation Correct Solution: ``` n = int(input()) L1 = [ [] for i in range(5) ] L2 = [ [] for i in range(5) ] ans = 0 for i in range(n): a = input() L1[len(a)].append(a) for j in range(n): b = input() L2[len(b)].append(b) s = 0 m = 0 l = 0 for i in L1[1]: if i == 'S': s +...
output
1
6,577
6
13,155
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,578
6
13,156
Tags: greedy, implementation Correct Solution: ``` n=int(input()) d=dict() d1=dict() for i in range(n): l=input() if l not in d: d[l]=1 else: d[l]+=1 x=0 for i in range(n): l=input() if l in d1: d1[l]+=1 else: d1[l]=1 for i in d1: if i in d: x+=max(d1[...
output
1
6,578
6
13,157
Provide tags and a correct Python 3 solution for this coding contest problem. Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For example...
instruction
0
6,579
6
13,158
Tags: greedy, implementation Correct Solution: ``` def check(a,b): if a==None or b==None: return 0 count=0 if len(a)==len(b): count+=1 elif len(b)>len(a): if b[len(b)-1]!=a[len(a)-1]: count+=1 count=count+len(b)-len(a) else: check(b,a) return c...
output
1
6,579
6
13,159
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a matrix of size n × n filled with lowercase English letters. You can change no more than k letters in this matrix. Consider all paths from the upper left corner to the lower right corner that move from a cell to its neighbori...
instruction
0
7,581
6
15,162
Tags: greedy Correct Solution: ``` def solve(m, matrix, good, n): c = 'z' for x in range(n): y = m - x if y < 0 or y >= n: continue if not good[x][y]: continue if x < n - 1: c = min(c, matrix[x + 1][y]) if y < n - 1: c = min(c, matrix[x][y + 1]) for x in range(n): ...
output
1
7,581
6
15,163
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,598
6
15,196
Tags: constructive algorithms, hashing, strings Correct Solution: ``` s = input() n = len(s) // 2 k = len(s) allsame = True for i in range(n): if s[i] != s[0]: allsame = False if allsame: print("Impossible") else: ans = False for i in range(1, n + 1): str = s[i:] + s[:i] if str[:...
output
1
7,598
6
15,197
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,599
6
15,198
Tags: constructive algorithms, hashing, strings Correct Solution: ``` def isPalindrome( word ) : return True if word == word[::-1] else False word = input() n = len( word ) possible = False for i in range( n//2 + 1 ) : new = word[i:] + word[:i] if isPalindrome( new ) and new != word : possible = T...
output
1
7,599
6
15,199
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,600
6
15,200
Tags: constructive algorithms, hashing, strings Correct Solution: ``` import sys from collections import Counter S = input() N = len(S) C = Counter(S) if len(C) == 1: print('Impossible') sys.exit() if len(C) == 2: if min(list(C.values())) == 1: print('Impossible') sys.exit() for i in rang...
output
1
7,600
6
15,201
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,601
6
15,202
Tags: constructive algorithms, hashing, strings Correct Solution: ``` def main(): s = input() n = len(s) for part in range(n - 1): newstr = s[part + 1:] + s[:part + 1] if newstr != s and newstr == newstr[::-1]: print(1) return left = s[:n // 2] right = s[(n + ...
output
1
7,601
6
15,203
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,602
6
15,204
Tags: constructive algorithms, hashing, strings Correct Solution: ``` from sys import * s = input(); def check(t): return (t == t[::-1]) and (t != s) for i in range(1, len(s)): t = s[i:] + s[:i] if check(t): print("1") exit() for i in range(1, len(s)//2 + (len(s)%2)): t = s[-i:] + s[i:-i] + s[:i] if c...
output
1
7,602
6
15,205
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,603
6
15,206
Tags: constructive algorithms, hashing, strings Correct Solution: ``` s = input() l = len(s) c = s[0] diff = False for i in range(0,int(l/2)): if s[i] != c: diff = True if not diff: print('Impossible') exit() s_2 = s + s for i in range(1,l): is_palendrome = True for j in range(int(l/2)...
output
1
7,603
6
15,207
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,604
6
15,208
Tags: constructive algorithms, hashing, strings Correct Solution: ``` def pallin(s): n= len(s) for i in range(0,n//2): if s[i]!=s[n-i-1]: return False return True if __name__ == '__main__': s= input() #print(s) #print(pallin(s)) n= len(s) for i in range(n-1,0,-...
output
1
7,604
6
15,209
Provide tags and a correct Python 3 solution for this coding contest problem. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Thark...
instruction
0
7,605
6
15,210
Tags: constructive algorithms, hashing, strings Correct Solution: ``` from collections import Counter import sys S=input() L=len(S) def pand(x): if x==x[::-1]: return True else: return False for i in range(1,len(S)): if S[i:]+S[:i]!=S and pand(S[i:]+S[:i])==True: print(1) ...
output
1
7,605
6
15,211
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,606
6
15,212
Yes
output
1
7,606
6
15,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,607
6
15,214
Yes
output
1
7,607
6
15,215
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,608
6
15,216
Yes
output
1
7,608
6
15,217
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,609
6
15,218
Yes
output
1
7,609
6
15,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,610
6
15,220
No
output
1
7,610
6
15,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,611
6
15,222
No
output
1
7,611
6
15,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,612
6
15,224
No
output
1
7,612
6
15,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in ma...
instruction
0
7,613
6
15,226
No
output
1
7,613
6
15,227
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,816
6
15,632
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` # cook your dish here n=int(input()) s=list(input())*n d={} for i in range(len(s)): if s[i] not in d: d[s[i]]=[i] else: d[s[i]].append(i) m=int(input()) for i in range(m): o,c=input().split() s[d[c...
output
1
7,816
6
15,633
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,817
6
15,634
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` k = int(input()) string = list(input()) * k d = {} for i, letter in enumerate(string): if letter not in d: d[letter] = [i] else: d[letter].append(i) n = int(input()) for i in range(n): inp = input()...
output
1
7,817
6
15,635
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,818
6
15,636
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` n = int(input()) t = input() l = len(t) m = int(input()) q = {c: [] for c in 'abcdefghijklmnopqrstuvwxyz'} for j, c in enumerate(t): q[c].append(j) q = {c: [i + j for i in range(0, n * l, l) for j in q[c]] for c in q...
output
1
7,818
6
15,637
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,819
6
15,638
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` from collections import defaultdict k = int(input()) s = list(input() * k) p = defaultdict(list) for i in range(len(s)): p[(s[i])].append(i) for _ in range(int(input())): x, c = input().split() x = int(x) s[p[(...
output
1
7,819
6
15,639
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,820
6
15,640
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` k=int(input()) e={} s=input() t=list(s*k) for i in range(len(t)): if t[i] in e:e[t[i]]+=[i] else:e[t[i]]=[i] for i in range(int(input())): q,w=input().split() q=int(q)-1 t[e[w][q]]="" e[w].pop(q) print(""....
output
1
7,820
6
15,641
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,821
6
15,642
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` 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() self.writable = ...
output
1
7,821
6
15,643
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,822
6
15,644
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` n = int(input()) t = input() l = len(t) m = int(input()) q = {c: [] for c in 'abcdefghijklmnopqrstuvwxyz'} for j, c in enumerate(t): q[c].append(j) q = {c: [i + j for i in range(0, n * l, l) for j in q[c]] for c in q} t = n ...
output
1
7,822
6
15,645
Provide tags and a correct Python 3 solution for this coding contest problem. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence ...
instruction
0
7,823
6
15,646
Tags: *special, binary search, brute force, data structures, strings Correct Solution: ``` #copied... idea def main(): mode="filee" if mode=="file":f=open("test.txt","r") get = lambda :[int(x) for x in (f.readline() if mode=="file" else input()).split()] gets = lambda :[str(x) for x in (f.readline() if...
output
1
7,823
6
15,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p ...
instruction
0
7,824
6
15,648
No
output
1
7,824
6
15,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p ...
instruction
0
7,825
6
15,650
No
output
1
7,825
6
15,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p ...
instruction
0
7,826
6
15,652
No
output
1
7,826
6
15,653
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,977
6
15,954
Tags: greedy, strings Correct Solution: ``` s, k = map(int, input().split()) strin = list(input()) newStr = strin d = 0 m = ord("m") a = ord("a") z = ord("z") i = 0 while i < s and d < k: diff = 0 c = ord(strin[i]) if c <= m: diff = z - c else: diff = a - c if (abs(diff) + d) <= k: d += abs(diff) ...
output
1
7,977
6
15,955
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,978
6
15,956
Tags: greedy, strings Correct Solution: ``` n, k = map(int, input().split()) b = list(input()) for i in range(n): x = ord('z') - ord(b[i]) y = ord(b[i]) - ord('a') if x > y: if k < x: x = k b[i] = chr(ord(b[i]) + x) k -= x else: if k < y: y = k b[i] = chr(ord(b[i]) - y) k -= y if k==0: break ...
output
1
7,978
6
15,957
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,979
6
15,958
Tags: greedy, strings Correct Solution: ``` n,k = map(int,input().split()) s = input() s = list(s) for i in range(n): if ord(s[i])>=110: m = min(ord(s[i])-97,k) k-=m s[i]=chr(ord(s[i])-m) else: m = min(122-ord(s[i]),k) k-=m s[i]=chr(ord(s[i])+m) if k>0: print(-1) else: print(''.join(s)) ```
output
1
7,979
6
15,959
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,980
6
15,960
Tags: greedy, strings Correct Solution: ``` import collections import math n, k = map(int, input().split()) s = input() ss = [] t = 0 for i in range(len(s)): t += max(abs(ord('a') - ord(s[i])), abs(ord('z') - ord(s[i]))) if k > t: print(-1) exit(0) else: for i in range(len(s)): if k == 0: ...
output
1
7,980
6
15,961
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,981
6
15,962
Tags: greedy, strings Correct Solution: ``` n, k = map(int, input().split()) st = input() ans = '' i = 0 while i < n and k > 0: if abs(ord(st[i]) - 97) > abs(ord(st[i]) - 122): ans += chr(max(97, ord(st[i]) - k)) k -= ord(st[i]) - ord(ans[-1]) else: ans += chr(min(122, ord(st[i]) + k)) k -= ord(ans[-1]) - ...
output
1
7,981
6
15,963
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,982
6
15,964
Tags: greedy, strings Correct Solution: ``` [n,k] = input().split(" ") s = input() ss = '' n = int(n) k = int(k) MaxD = [[0,0]]*n SumMaxD = 0 for i in list(range(0,n)): xl = -97 + ord(s[i]) xh = 122 - ord(s[i]) if(xl > xh): MaxD[i] = [xl,-1] SumMaxD = SumMaxD + xl else: ...
output
1
7,982
6
15,965
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,983
6
15,966
Tags: greedy, strings Correct Solution: ``` def check(s, k): ans = 0 for i in range(len(s)): ans += abs(ord(s[i]) - ord(k[i])) return ans n, k = map(int, input().split()) s = input() cnt = 0 for i in s: cnt += max(ord('z') - ord(i), ord(i) - ord('a')) if k > cnt: print(-1) exit() else: ...
output
1
7,983
6
15,967
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions in the alphabet. For example, <im...
instruction
0
7,984
6
15,968
Tags: greedy, strings Correct Solution: ``` a, b = map(int, input().split()) s = input() if b / a > 25: print(-1) else: ans = "" c = 0 for i in s: if b == 0: ans += s[c:] break idx = ord(i) - 97 if idx >= 13: if b > idx: ans += ...
output
1
7,984
6
15,969
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,087
6
16,174
Tags: dp, greedy, implementation Correct Solution: ``` def main(): s = input() a = [] g = [elem for elem in "aeiou"] p = [] for i in range(len(s)): if (s[i] not in g): a.append(s[i]) else: a = [] if len(a) == 3: ...
output
1
8,087
6
16,175
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,088
6
16,176
Tags: dp, greedy, implementation Correct Solution: ``` s = input() vowels = ('a', 'e', 'u', 'o', 'i') res = '' i = 0 while i < len(s) - 2: if s[i] not in vowels and s[i + 1] not in vowels and s[i + 2] not in vowels and s[i: i + 3] != s[i] * 3: res += s[i: i + 2] + ' ' i += 2 else: res +...
output
1
8,088
6
16,177
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,089
6
16,178
Tags: dp, greedy, implementation Correct Solution: ``` class Solver: def main(self): s = input() ls = len(s) vowels = 'aeiou' cnt = 0 breaks = [] same = 0 for i in range(0, ls): if s[i] in vowels: cnt = 0 same = 0 ...
output
1
8,089
6
16,179
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,090
6
16,180
Tags: dp, greedy, implementation Correct Solution: ``` word = list(input()) ns = 0 onesymbol = '' onesymbolcount = 0 for i in range(len(word)): if onesymbol == word[i] and ns == 0: onesymbolcount += 1 continue if word[i] in ['a', 'e', 'i', 'o', 'u']: ns = 0 onesymbolcount = 0...
output
1
8,090
6
16,181
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,091
6
16,182
Tags: dp, greedy, implementation Correct Solution: ``` k = 0 t = y = z = '' for x in input(): k = 0 if x in 'aeiou' else k + 1 if k > 2 and not (x == y == z): t += ' ' k = 1 y, z = x, y t += x print(t) ```
output
1
8,091
6
16,183
Provide tags and a correct Python 3 solution for this coding contest problem. Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them. Beroffice works only with small English letters (i.e. with 26 letters f...
instruction
0
8,092
6
16,184
Tags: dp, greedy, implementation Correct Solution: ``` n = input() l = 0 q = len(n) sogl = ['q', 'w', 'r', 't', 'y', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'] for i in range(1, len(n) - 1): if (((n[i - 1] != n[i + 1]) or ((n[i] != n[i - 1]) and (n[i-1] == n[i + 1]))) and (n[i - 1]...
output
1
8,092
6
16,185