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.
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,093 | 6 | 16,186 |
Tags: dp, greedy, implementation
Correct Solution:
```
s = input()
d = ['a', 'e', 'i', 'o', 'u']
st = []
for i in range(len(s)):
if s[i] in d:
st = []
print(s[i], end="")
continue
st.append(s[i])
if st == [s[i], s[i], s[i]]:
st = st[1:]
print(s[i], end='')
elif le... | output | 1 | 8,093 | 6 | 16,187 |
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,094 | 6 | 16,188 |
Tags: dp, greedy, implementation
Correct Solution:
```
s=input()
l='aeiou'
i=2
while(i<len(s)):
if(s[i]!=s[i-1] or s[i]!=s[i-2] or s[i-1]!=s[i-2]) and (s[i] not in l) and (s[i-1] not in l) and (s[i-2] not in l) :
s=s[:i]+" "+s[i:]
i+=2
i+=1
print(s)
``` | output | 1 | 8,094 | 6 | 16,189 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,095 | 6 | 16,190 |
Yes | output | 1 | 8,095 | 6 | 16,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,096 | 6 | 16,192 |
Yes | output | 1 | 8,096 | 6 | 16,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,097 | 6 | 16,194 |
Yes | output | 1 | 8,097 | 6 | 16,195 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,098 | 6 | 16,196 |
Yes | output | 1 | 8,098 | 6 | 16,197 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,099 | 6 | 16,198 |
No | output | 1 | 8,099 | 6 | 16,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,100 | 6 | 16,200 |
No | output | 1 | 8,100 | 6 | 16,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,101 | 6 | 16,202 |
No | output | 1 | 8,101 | 6 | 16,203 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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 wit... | instruction | 0 | 8,102 | 6 | 16,204 |
No | output | 1 | 8,102 | 6 | 16,205 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,120 | 6 | 16,240 |
Tags: *special, strings
Correct Solution:
```
s1 = input()
abc = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
for y in range(0, 26):
s1 = s1.replace(abc[y], abc[y + 26])
s1 = s1.replace("O", "0")
s1 = s1.replace("L", "1")
s1 = s1.replace("I", "1")
n=int(input())
d=[]
d.append(s1)
for i in range(0,n):
... | output | 1 | 8,120 | 6 | 16,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,121 | 6 | 16,242 |
Tags: *special, strings
Correct Solution:
```
def norm(s):
d = ord('A') - ord('a')
s11 = ''
for i in range(len(s)):
if ord('a') <= ord(s[i]) <= ord('z'):
s11 += chr(ord(s[i]) + d)
else:
s11 += s[i]
s = s11
s = s.replace('O', '0')
s = s.replace('L', '1')
... | output | 1 | 8,121 | 6 | 16,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,122 | 6 | 16,244 |
Tags: *special, strings
Correct Solution:
```
s,n=input(),int(input())
s=s.replace('O','0')
s=s.replace('o','0')
for _ in range(n):
stp=''
a=input()
if len(a)==len(s):
for i in range(len(a)):
if a[i] in '1lILi' and s[i] in '1lILi':
stp+=a[i]
else:
... | output | 1 | 8,122 | 6 | 16,245 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,123 | 6 | 16,246 |
Tags: *special, strings
Correct Solution:
```
def is_similar(one, two):
one = one.lower()
two = two.lower()
one = one.replace('o', '0')
one = one.replace('i', '1')
one = one.replace('l', '1')
two = two.replace('o', '0')
two = two.replace('i', '1')
two = two.replace('l', '1')
return o... | output | 1 | 8,123 | 6 | 16,247 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,124 | 6 | 16,248 |
Tags: *special, strings
Correct Solution:
```
def convert(s):
s = s.lower()
s = s.replace("0", "o")
s = s.replace("1", "l")
s = s.replace("i", "l")
return s
s = input()
s = convert(s)
n = int(input())
for i in range(n):
s1 = convert(input())
if s == s1:
print("No")
exit(0)
pr... | output | 1 | 8,124 | 6 | 16,249 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,125 | 6 | 16,250 |
Tags: *special, strings
Correct Solution:
```
def transf(s):
return s.lower().replace('o', '0').replace('l', '1').replace('i', '1')
def check():
s = input()
n = int(input())
for i in range(n):
l = input()
if len(s) != len(l):
continue
if transf(s) == transf(l):
... | output | 1 | 8,125 | 6 | 16,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,126 | 6 | 16,252 |
Tags: *special, strings
Correct Solution:
```
def normalize_login(login):
return login \
.lower() \
.replace("o", "0") \
.replace("i", "1") \
.replace("l", "1")
new_login = normalize_login(input())
n = int(input())
logins = []
for i in range(0, n):
login = normalize_login(input... | output | 1 | 8,126 | 6 | 16,253 |
Provide tags and a correct Python 3 solution for this coding contest problem.
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits a... | instruction | 0 | 8,127 | 6 | 16,254 |
Tags: *special, strings
Correct Solution:
```
def rep(data):
data = data.replace("0", "@@@")
data = data.replace("o", "@@@")
data = data.replace("1", "!!!")
data = data.replace("l", "!!!")
data = data.replace("i", "!!!")
return data
login_usr = rep(input().lower())
count_log = int(input())
dat... | output | 1 | 8,127 | 6 | 16,255 |
Provide tags and a correct Python 3 solution for this coding contest problem.
per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis
per nextum in unam tum XI conscribementis fac sic
seqis dec... | instruction | 0 | 8,495 | 6 | 16,990 |
Tags: *special
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
import os
self.os = os
self._fd = file... | output | 1 | 8,495 | 6 | 16,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis
per nextum in unam tum XI conscribementis fac sic
seqis dec... | instruction | 0 | 8,496 | 6 | 16,992 |
Tags: *special
Correct Solution:
```
stack = []
for _ in range(11):
stack += int(input()),
while stack:
v = stack.pop()
a = abs(v) ** (1/2)
b = v **3 * 5
r = a + b
if r > 400:
print('f({}) = MAGNA NIMIS!'.format(v))
else:
print('f({}) = {:.2f}'.format(v, r))
``` | output | 1 | 8,496 | 6 | 16,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis
per nextum in unam tum XI conscribementis fac sic
seqis dec... | instruction | 0 | 8,501 | 6 | 17,002 |
Tags: *special
Correct Solution:
```
lip = ['0.00', '6.00', '-3642.00', '-2557.17', '-1712.35', '-1077.55', '-622.76', '-318.00', '-133.27', '-38.59', 'MAGNA NIMIS!']
s = []
for i in range(11):
s.append(int(input()))
s.reverse()
#print(s)
for i in range(0, 11):
a = s[i]**3*5
b = abs(s[i])**0.5
ans = a +... | output | 1 | 8,501 | 6 | 17,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,642 | 6 | 17,284 |
Tags: implementation
Correct Solution:
```
symmetric = 'AHIMOTUVWXY'
s = input()
if s == s[::-1] and all([x in symmetric for x in s]):
print('YES')
else:
print('NO')
``` | output | 1 | 8,642 | 6 | 17,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,643 | 6 | 17,286 |
Tags: implementation
Correct Solution:
```
'''input
XO
'''
s = input()
if all(s[x] == s[~x] for x in range(len(s)//2)):
if any(y not in "AHIMOTUVWXY" for y in s[:len(s)//2+1]):
print("NO")
else:
print("YES")
else:
print("NO")
``` | output | 1 | 8,643 | 6 | 17,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,644 | 6 | 17,288 |
Tags: implementation
Correct Solution:
```
def palindrome(n):
for i in range(0,len(n)):
if n[i] != n[-(i+1)]:
return 0
return 1
lessgo = ['a','h','i','m','o','t','u','v','w','x','y']
i = list(input())
for j in range(len(i)):
i[j] = i[j].lower()
mir = 1
for j in range(len(i)):
if i[... | output | 1 | 8,644 | 6 | 17,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,645 | 6 | 17,290 |
Tags: implementation
Correct Solution:
```
s = input()
print('YES' if all(ch in 'AHIMOTUVWXY' for ch in s) and s==s[::-1] else 'NO')
``` | output | 1 | 8,645 | 6 | 17,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,646 | 6 | 17,292 |
Tags: implementation
Correct Solution:
```
n=input()
i=0
k=len(n)-1
_b=True
while i<=k and _b:
if n[i]==n[k] and n[i] in ['A','H','I','M','O','T','U','V','W','X','Y']:
_b=True
i+=1
k-=1
else:
_b=False
if _b: print('YES')
else: print('NO')
``` | output | 1 | 8,646 | 6 | 17,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,647 | 6 | 17,294 |
Tags: implementation
Correct Solution:
```
n=list(input())
m=n+[]
m.reverse()
l=['A','H','I','M','O','T','U','V','W','X','Y']
if(m==n ):
e=0
for i in range(len(n)):
if n[i] not in l:
print("NO")
e=1
break
if(e==0):
print("YES")
else:
print("NO")
``` | output | 1 | 8,647 | 6 | 17,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,648 | 6 | 17,296 |
Tags: implementation
Correct Solution:
```
s = input()
a = ['A','H','I','M','O','T','U','V','W','X','Y']
a = set(a)
count = 0
if len(s)%2 == 0:
for i in range(int(len(s)/2)):
if s[i] == s[len(s)-i-1] and s[i] in a:
count = count + 1
else :
if s[int(len(s)/2)] in a:
for i in range(int... | output | 1 | 8,648 | 6 | 17,297 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company sho... | instruction | 0 | 8,649 | 6 | 17,298 |
Tags: implementation
Correct Solution:
```
def ic(s):
ss=set('AHIMOTUVWXY')
m=len(s)//2+1
for c in range(m):
if s[c]!=s[-(c+1)] or s[c] not in ss:
return 0
return 1
s='YES' if ic(input()) else 'NO'
print(s)
``` | output | 1 | 8,649 | 6 | 17,299 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,687 | 6 | 17,374 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
#!/usr/bin/env python3
def cal_last(s):
n = len(s)
last = [-1]*(n+1)
i,j = 0,-1
while i<n:
while j!=-1 and s[i]!=s[j]:
j=last[j]
i,j = i+1,j+1
last[i] = j
... | output | 1 | 8,687 | 6 | 17,375 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,688 | 6 | 17,376 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
def ziped(a):
p = []
for i in a:
x = int(i.split('-')[0])
y = i.split('-')[1]
if len(p) > 0 and p[-1][1] == y:
p[-1][0] += x
else:
p.append([x, y])
return p
def solve(a, b , c):
ans = 0
if len(b) ... | output | 1 | 8,688 | 6 | 17,377 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,689 | 6 | 17,378 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
def main():
input()
ts = []
for _ in 0, 1:
tmp = input().split()
a, x, l = tmp[0][-1], 0, []
for st in tmp:
y = int(st[:-2])
b = st[-1]
if a != ... | output | 1 | 8,689 | 6 | 17,379 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,690 | 6 | 17,380 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
def ziped(a):
p = []
for i in a:
x = int(i.split('-')[0])
y = i.split('-')[1]
if len(p) > 0 and p[-1][1] == y:
p[-1][0] += x
else:
p.append([x, ... | output | 1 | 8,690 | 6 | 17,381 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,691 | 6 | 17,382 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
def compress(bstr):
pk, pc = None, None
for block in bstr:
if pc is None:
pk, pc = block
elif pc == block[1]:
pk += block[0]
else:
yield pk, pc
... | output | 1 | 8,691 | 6 | 17,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to sea... | instruction | 0 | 8,692 | 6 | 17,384 |
Tags: data structures, hashing, implementation, string suffix structures, strings
Correct Solution:
```
def compress(bstr):
pk, pc = None, None
for block in bstr:
if pc is None:
pk, pc = block
elif pc == block[1]:
pk += block[0]
else:
yield pk, pc
... | output | 1 | 8,692 | 6 | 17,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,204 | 6 | 18,408 |
Tags: strings
Correct Solution:
```
k = int(input())
for _ in range(k):
n = int(input())
s0 = input()
t0 = input()
s = [s0[i] for i in range(n)]
t = [t0[i] for i in range(n)]
ans = "Yes"
ansArr = []
for i in range(n):
if s[i] == t[i]:
continue
elif s[i] in s[i+1:]:
ind = s.index(s[i], i+1, n)
a... | output | 1 | 9,204 | 6 | 18,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,205 | 6 | 18,410 |
Tags: strings
Correct Solution:
```
Q = int(input())
Query = []
for _ in range(Q):
N = int(input())
S1 = list(input())
S2 = list(input())
Query.append((N, S1, S2))
for N, S1, S2 in Query:
C = []
for i in range(N):
s1, s2 = S1[i], S2[i]
if s1 != s2:
C.append((s1, s2))... | output | 1 | 9,205 | 6 | 18,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,206 | 6 | 18,412 |
Tags: strings
Correct Solution:
```
import sys
import itertools
import math
import collections
from collections import Counter
#########################
# imgur.com/Pkt7iIf.png #
#########################
def sieve(n):
prime = [True for i in range(n + 1)]
p = 2
while (p * p <= n):
if (prime[p] == ... | output | 1 | 9,206 | 6 | 18,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,207 | 6 | 18,414 |
Tags: strings
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().strip()
k = int(input())
for i in range(k):
n = int(input())
s = list(input())
t = list(input())
res = []
for i in range(n):
try:
found = s.index(s[i], i+1)
s[found], t[i] = t[i], s[f... | output | 1 | 9,207 | 6 | 18,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,208 | 6 | 18,416 |
Tags: strings
Correct Solution:
```
tc = int(input())
for t in range(tc) :
n = int(input())
s = [char for char in input()]
t = [char for char in input()]
freq = {}
for i in range(n) :
if s[i] in freq.keys() :
freq[s[i]] += 1
else :
freq[s[i]] = 1
i... | output | 1 | 9,208 | 6 | 18,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,209 | 6 | 18,418 |
Tags: strings
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
a=list(input())
b=list(input())
ans=[]
d1=dict()
d2=dict()
for i in range(n):
try:
d1[a[i]].add(i)
except:
d1[a[i]]=set([(i)])
try:
d2[b[i]].add(i)
... | output | 1 | 9,209 | 6 | 18,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,210 | 6 | 18,420 |
Tags: strings
Correct Solution:
```
k = int(input())
for _ in range(k):
n = int(input())
s = list(input().strip())
t = list(input().strip())
d = {}
for i in range(n):
if s[i]!=t[i]:
try:
d[(s[i],t[i])] += 1
except:
d[(s[i],t[i])] = 1
... | output | 1 | 9,210 | 6 | 18,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house ... | instruction | 0 | 9,211 | 6 | 18,422 |
Tags: strings
Correct Solution:
```
for i in range(int(input())):
n=int(input())
s1=list(input())
s2=list(input())
ans="No"
x=-1
for j in range(n):
if(s1[j]!=s2[j]):
x=j
break
if(x==-1):
a=[0]*26
b=[0]*26
for j in range(n):
a[ord(s1[j])-97]+=1
b[ord(s2[j])-97]+=1
for j in range(26):
if(a... | output | 1 | 9,211 | 6 | 18,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,265 | 6 | 18,530 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/python3
N,K = [int(x) for x in input().strip().split()]
#"aabb", "abab", "abba", "aaaa";
vowels = ['a','e','i','o','u']
schm = []
def check(val):
for x in schm:
if x == val or x == 4:continue
return False
return True
def parse(line):
k = K
for x in range(... | output | 1 | 9,265 | 6 | 18,531 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,266 | 6 | 18,532 |
Tags: implementation
Correct Solution:
```
from sys import stdin
read = stdin.readline
n,k = map(int,read().split())
r = 0
vowel = {'a','e','i','o','u'}
def cmp(a,b,k,vowel):
l = 0
for x,y in zip(reversed(a),reversed(b)):
if x != y:
return False
l += (x in vowel)
if l == k... | output | 1 | 9,266 | 6 | 18,533 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,267 | 6 | 18,534 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
def get_suffix(line):
position = 0
for _ in range(k):
position -= 1
while -position <= len(line) and line[position] not in 'aeiou':
position -= 1
if -position > len(line):
return ''
... | output | 1 | 9,267 | 6 | 18,535 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,268 | 6 | 18,536 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
ve = 'aeiou'
abba, aabb, abab = 1, 1, 1
for j in range(n):
a = ['']*4
for i in range(4):
a[i] = input()
l = len(a[i])
curr = 0
while l > 0 and curr < k:
l -= 1
if a[i][l... | output | 1 | 9,268 | 6 | 18,537 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,269 | 6 | 18,538 |
Tags: implementation
Correct Solution:
```
n,k=list(map(int,input().split()))
l=[]
for i in range(4*n):
l.append(input())
poss=0
lst=[]
for i in l:
c=0
n=len(i)
for j in range(n-1,-1,-1):
if(i[j]=='a' or i[j]=='e' or i[j]=='i' or i[j]=='o' or i[j]=='u'):
c+=1
else: continue
... | output | 1 | 9,269 | 6 | 18,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,270 | 6 | 18,540 |
Tags: implementation
Correct Solution:
```
def find(s,k):
ek=0
sw=""
vow=set()
vow.add('a')
vow.add('e')
vow.add('i')
vow.add('o')
vow.add('u')
for i in range(len(s)-1,-1,-1):
if s[i] in vow:
ek+=1
sw+=s[i]
if ek==k:
return sw
retur... | output | 1 | 9,270 | 6 | 18,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Le... | instruction | 0 | 9,271 | 6 | 18,542 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().split())
ve = 'aeiou'
abba, aabb, abab = 1, 1, 1
for j in range(n):
a = ['']*4
for i in range(4):
a[i] = input()
l = len(a[i])
curr = 0
while l > 0 and curr < k:
l -= 1
if a[i][l... | output | 1 | 9,271 | 6 | 18,543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.