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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The country of Reberland is the archenemy of Berland. Recently the authorities of Berland arrested a Reberlandian spy who tried to bring the leaflets intended for agitational propaganda to Berla... | instruction | 0 | 21,637 | 6 | 43,274 |
No | output | 1 | 21,637 | 6 | 43,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The country of Reberland is the archenemy of Berland. Recently the authorities of Berland arrested a Reberlandian spy who tried to bring the leaflets intended for agitational propaganda to Berla... | instruction | 0 | 21,638 | 6 | 43,276 |
No | output | 1 | 21,638 | 6 | 43,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,661 | 6 | 43,322 |
Tags: binary search, greedy, strings
Correct Solution:
```
a=input()
b=input()
c=[int(i)-1 for i in input().split()]
l=0;r=len(a)
while r-l>1:
m=l+(r-l)//2
d=list(a)
j=0
for i in range(m):
d[c[i]]=''
# print(d,i)
for i in range(len(a)):
if d[i]==b[j]:
# print(d)
... | output | 1 | 21,661 | 6 | 43,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,662 | 6 | 43,324 |
Tags: binary search, greedy, strings
Correct Solution:
```
import math as mt
import sys,string
input=sys.stdin.readline
import random
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
def isSu... | output | 1 | 21,662 | 6 | 43,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,663 | 6 | 43,326 |
Tags: binary search, greedy, strings
Correct Solution:
```
a = input()
b = input()
c = [i-1 for i in list(map(int,input().split()))]
l = 0
r = len(a)
while r-l>1:
m = l + (r-l) // 2
d = list(a)
j = 0
for i in range(m):d[c[i]] = ''
for i in range(len(a)):
if d[i]==b[j]:
j += 1
... | output | 1 | 21,663 | 6 | 43,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,664 | 6 | 43,328 |
Tags: binary search, greedy, strings
Correct Solution:
```
s = input()
t = input()
a = [int(x) - 1 for x in input().split()]
def ok(n):
bad = set(a[:n])
it = (a for i, a in enumerate(s) if i not in bad)
return all(c in it for c in t)
low = 0
high = len(s)
while low <= high:
mid = (high + low) // 2
... | output | 1 | 21,664 | 6 | 43,329 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,665 | 6 | 43,330 |
Tags: binary search, greedy, strings
Correct Solution:
```
def subset(S,s):
i = 0
j = 0
while i<len(S) and j<len(s):
if S[i]==s[j]:
i+=1
j+=1
else: i+=1
if j==len(s):
return True
return False
n = input()
a = input()
arr = [int(x)-1 for x in input().split()]
new = []
l = 0
r = len(n)
while l<r:
mid =... | output | 1 | 21,665 | 6 | 43,331 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,666 | 6 | 43,332 |
Tags: binary search, greedy, strings
Correct Solution:
```
s = (input())
p = (input())
a = [i-1 for i in list(map(int,input().split()))]
left = 0
right = len(s)
while right - left > 1:
d = list(s)
mid = int((left + right)/2)
for i in range(mid):
d[a[i]] = ''
j = 0
for i in range(len(s)):
... | output | 1 | 21,666 | 6 | 43,333 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,667 | 6 | 43,334 |
Tags: binary search, greedy, strings
Correct Solution:
```
"""
NTC here
"""
import sys
inp = sys.stdin.readline
def input(): return inp().strip()
# flush= sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**26)
def iin(): return int(input())
def lin(): return list(map(int,... | output | 1 | 21,667 | 6 | 43,335 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the wor... | instruction | 0 | 21,668 | 6 | 43,336 |
Tags: binary search, greedy, strings
Correct Solution:
```
from sys import stdin
t = input().strip()
p = input().strip()
def possible(pos):
it = 0
ip = 0
while it < len(t) and ip < len(p):
if it in d:
it += 1
continue
if t[it] == p[ip]:
it += 1
... | output | 1 | 21,668 | 6 | 43,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,669 | 6 | 43,338 |
Yes | output | 1 | 21,669 | 6 | 43,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,670 | 6 | 43,340 |
Yes | output | 1 | 21,670 | 6 | 43,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,671 | 6 | 43,342 |
Yes | output | 1 | 21,671 | 6 | 43,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,672 | 6 | 43,344 |
Yes | output | 1 | 21,672 | 6 | 43,345 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,673 | 6 | 43,346 |
No | output | 1 | 21,673 | 6 | 43,347 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,674 | 6 | 43,348 |
No | output | 1 | 21,674 | 6 | 43,349 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,675 | 6 | 43,350 |
No | output | 1 | 21,675 | 6 | 43,351 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey... | instruction | 0 | 21,676 | 6 | 43,352 |
No | output | 1 | 21,676 | 6 | 43,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,705 | 6 | 43,410 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
f1 = "What are you doing while sending \"{0}\"? Are you busy? Will you send \"{0}\"?"
a = list(f1.split("{0}"))
b = list(map(len, a))
q = int(input())
f = lambda n: 143 * 2**min(... | output | 1 | 21,705 | 6 | 43,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,706 | 6 | 43,412 |
Tags: binary search, dfs and similar
Correct Solution:
```
s0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
s1 = 'What are you doing while sending "'
s2 = '"? Are you busy? Will you send "'
l0 = len(s0)
l1 = len(s1)
l2 = len(s2)
def get(h):
if h > 55: return 10**20
return (l0 ... | output | 1 | 21,706 | 6 | 43,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,707 | 6 | 43,414 |
Tags: binary search, dfs and similar
Correct Solution:
```
import sys
sys.setrecursionlimit(1500)
s1 = "What are you doing at the end of the world? Are you busy? Will you save us?"
a = "What are you doing while sending \""
b = "\"? Are you busy? Will you send \""
c = "\"?"
ans = ""
def solve(n, k):
if n == 0:
... | output | 1 | 21,707 | 6 | 43,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,708 | 6 | 43,416 |
Tags: binary search, dfs and similar
Correct Solution:
```
def get_len(ind):
if ind > 63:
ind = 63
k = (1 << ind) - 1
return k * (len1 + len2 + len3) + (k + 1) * len_f0
f0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'
s1 = 'What are you doing while sending "'
s2 = '... | output | 1 | 21,708 | 6 | 43,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,709 | 6 | 43,418 |
Tags: binary search, dfs and similar
Correct Solution:
```
f0 = "What are you doing at the end of the world? Are you busy? Will you save us?"
p1 = "What are you doing while sending \""
p2 = "\"? Are you busy? Will you send \""
p3 = "\"?"
f = []
def dfs(n, k):
if k > f[n]: return '.'
if n == 0: return f0[k-1]
... | output | 1 | 21,709 | 6 | 43,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,710 | 6 | 43,420 |
Tags: binary search, dfs and similar
Correct Solution:
```
import sys
sys.setrecursionlimit(1001000)
ants = "What are you doing while sending \""
ant = len(ants)
meios = "\"? Are you busy? Will you send \""
meio = len(meios)
fims = "\"?"
fim = len(fims)
base = "What are you doing at the end of the world? Are you busy?... | output | 1 | 21,710 | 6 | 43,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,711 | 6 | 43,422 |
Tags: binary search, dfs and similar
Correct Solution:
```
tmp = [""] * 3
tmp[0] = "What are you doing while sending \""
tmp[1] = "\"? Are you busy? Will you send \""
tmp[2] = "\"?"
def fun(s):
return tmp[0] + s + tmp[1] + s + tmp[2]
MAX = 60
f = [""] * 3
f[0] = "What are you doing at the end of the world? Are ... | output | 1 | 21,711 | 6 | 43,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
What are you doing at the end of the world? Are you busy? Will you save us?
<image>
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, f0... ∞.
f0 is "What are you doing at the end of the worl... | instruction | 0 | 21,712 | 6 | 43,424 |
Tags: binary search, dfs and similar
Correct Solution:
```
s = [
"What are you doing at the end of the world? Are you busy? Will you save us?",
"What are you doing while sending \"",
"\"? Are you busy? Will you send \"",
"\"?"
]
l = list(map(len, s))
ls = [l[0]]
while ls[-1] <= int(1e18):
ls.append... | output | 1 | 21,712 | 6 | 43,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corre... | instruction | 0 | 21,742 | 6 | 43,484 |
Tags: implementation, strings
Correct Solution:
```
position=input()
if len(position) <=7:
print("NO")
else:
flag=False
for i in range(len(position)):
if position[i:i+7]=="0000000" or position[i:i+7]=="1111111":
flag=True
break
elif i > len(position)-7:
br... | output | 1 | 21,742 | 6 | 43,485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corre... | instruction | 0 | 21,744 | 6 | 43,488 |
Tags: implementation, strings
Correct Solution:
```
s=input()
pres,prev,c=0,0,0
for i in s:
pres=int(i)
if pres==prev:
c+=1
prev=pres
if c==7:
print("YES")
break
else:
c=1
prev=pres
if c<7:
print("NO")
``` | output | 1 | 21,744 | 6 | 43,489 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corre... | instruction | 0 | 21,746 | 6 | 43,492 |
Tags: implementation, strings
Correct Solution:
```
if __name__ == "__main__":
s = list(char for char in input())
l_old=s[0]
count_one=0
count_zero=0
yes=False
for l in s:
if l == l_old:
if l=="0":
count_zero+=1
count_one=1
#pri... | output | 1 | 21,746 | 6 | 43,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corre... | instruction | 0 | 21,747 | 6 | 43,494 |
Tags: implementation, strings
Correct Solution:
```
pat1 = '0000000'
pat2 = '1111111'
string = str(input())
if((pat1 in string) or (pat2 in string)):
print("YES")
else:
print("NO")
``` | output | 1 | 21,747 | 6 | 43,495 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,487 | 6 | 44,974 |
Tags: implementation, strings
Correct Solution:
```
from sys import *
from collections import *
def inp(n):
if n == 1:
return map(int, stdin.readline().split())
elif n == 2:
return map(float, stdin.readline().split())
else:
return map(str, stdin.readline().split())
def main():
... | output | 1 | 22,487 | 6 | 44,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,488 | 6 | 44,976 |
Tags: implementation, strings
Correct Solution:
```
n, m = [int(i) for i in input().split()]
s = input()
st = [chr(ord('a')+i) for i in range(26)]
for i in range (m) :
a, b = input().split()
for i in range(26):
if st[i] == a:
st[i] = b
elif st[i] == b:
st[i] = a
print... | output | 1 | 22,488 | 6 | 44,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,489 | 6 | 44,978 |
Tags: implementation, strings
Correct Solution:
```
alf = list('abcdefghijklmnopqrstuvwxyz')
n, m = map(int, input().split())
s = input()
for i in range(m):
x, y = input().split()
index1 = alf.index(x)
index2 = alf.index(y)
alf[index1], alf[index2] = alf[index2], alf[index1]
for i in s:
print(alf[ord(i) - ord('a')... | output | 1 | 22,489 | 6 | 44,979 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,490 | 6 | 44,980 |
Tags: implementation, strings
Correct Solution:
```
import string
def mp():
return map(int,input().split())
def lt():
return list(map(int,input().split()))
def pt(x):
print(x)
n,m = mp()
s = input()
s1 = string.ascii_lowercase
for i in range(m):
L = input().split()
a,b = L[0],L[1]
s1 = s1.trans... | output | 1 | 22,490 | 6 | 44,981 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,491 | 6 | 44,982 |
Tags: implementation, strings
Correct Solution:
```
import sys
size,swaps=map(int,sys.stdin.readline().split())
word=sys.stdin.readline()
alp='abcdefghijklmnopqrstuvwxyz'
alp2='abcdefghijklmnopqrstuvwxyz'
for i in range(swaps):
a,b=map(str,sys.stdin.readline().split())
alp2=alp2.replace(a,b.upper())
alp2=al... | output | 1 | 22,491 | 6 | 44,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,492 | 6 | 44,984 |
Tags: implementation, strings
Correct Solution:
```
n,m=map(int,input().split())
x=list(input())
d={}
y=list(set(x))
z=list(set(x))
for i in x:
d[i]=i
for t in range(m):
a,b=map(str,input().split())
for i in range(len(y)):
if y[i]==a:
y[i]=b
elif y[i]==b:
y[i]=a
for i... | output | 1 | 22,492 | 6 | 44,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,493 | 6 | 44,986 |
Tags: implementation, strings
Correct Solution:
```
import math
from decimal import Decimal
def na():
n = int(input())
b = [int(x) for x in input().split()]
return n,b
def nab():
n = int(input())
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
return n,b,c
def dv():
n, m = ma... | output | 1 | 22,493 | 6 | 44,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the compa... | instruction | 0 | 22,494 | 6 | 44,988 |
Tags: implementation, strings
Correct Solution:
```
n,m=map(int,input().split())
st=input()
dic={}
xr="abcdefghijklmnopqrstuvwxyz"
for x in xr:
dic[x]=x
for x in range(m):
g,h=input().split()
dic[g],dic[h]=dic[h],dic[g]
#print(dic)
t={}
for k in dic:
t[dic[k]]=k
#print(t)
ls=[ t[x] for x in st]
print(... | output | 1 | 22,494 | 6 | 44,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,198 | 6 | 46,396 |
Tags: data structures, greedy, trees
Correct Solution:
```
# https://codeforces.com/contest/37/problem/C
import sys
sys.setrecursionlimit(100000)
class Node:
def __init__(self):
self.child = dict()
self.isEnd = 0
def DFS(stack, level, mark, arr, m, pos):
if len(mark) == level:
arr.app... | output | 1 | 23,198 | 6 | 46,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,199 | 6 | 46,398 |
Tags: data structures, greedy, trees
Correct Solution:
```
class Node():
def __init__(self):
self.child = dict()
self.count = 0
self.weight = 0
def addWord(root, s):
s = ""
tmp = root
length = 0
flag = False
for i in range(s):
if len(tmp.child) == 0:
tmp.child[0] = Node()
tmp = ... | output | 1 | 23,199 | 6 | 46,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,200 | 6 | 46,400 |
Tags: data structures, greedy, trees
Correct Solution:
```
import itertools
t = int
e = input
I = list
r = sorted
A = enumerate
X = bin
m = len
u = print
o = range
p = itertools.groupby
n = t(e())
L = [t(_)for _ in e().split()]
M = I(r(A(L), key=lambda x: x[1]))
N = [0 for x in L]
l = 0
b = 0
for k, U in p(M, key=lambd... | output | 1 | 23,200 | 6 | 46,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,201 | 6 | 46,402 |
Tags: data structures, greedy, trees
Correct Solution:
```
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
l[i] = (l[i], i)
l.sort(key=lambda x : x[0])
currentWord = ""
firstL = l[0][0]
for i in range(firstL):
currentWord += '0'
ans = ['' for _ in range(n)]
ans[l[0][1]] = currentWord
for... | output | 1 | 23,201 | 6 | 46,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,202 | 6 | 46,404 |
Tags: data structures, greedy, trees
Correct Solution:
```
import sys
class input_tokenizer:
tokens = None
def __init__(self):
self.tokens = sys.stdin.read().split()[::-1]
def has_next(self):
return self.tokens != [] and self.tokens != None
def next(self):
token = self.token... | output | 1 | 23,202 | 6 | 46,405 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,203 | 6 | 46,406 |
Tags: data structures, greedy, trees
Correct Solution:
```
import sys
sys.setrecursionlimit(1000000)
class Node():
def __init__(self, val):
self.child = dict()
self.blocked = False
self.val = val
class Trie():
def __init__(self):
self.root = Node("")
def addLength(self... | output | 1 | 23,203 | 6 | 46,407 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,204 | 6 | 46,408 |
Tags: data structures, greedy, trees
Correct Solution:
```
n, ls = int(input()), list(map(int, input().split()))
l = [(ls[i], i) for i in range(n)]
l.sort(key = lambda x: x[0])
c, a = 0, ['0'*l[0][0]]
for i in range(1, n):
if c == 2**l[i-1][0]-1:
break
c = (c+1) * 2**(l[i][0] - l[i-1][0])
... | output | 1 | 23,204 | 6 | 46,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t make pauses between ... | instruction | 0 | 23,205 | 6 | 46,410 |
Tags: data structures, greedy, trees
Correct Solution:
```
"""
https://codeforces.com/contest/37/problem/C
"""
curr, n = 0, 0
a = []
word = []
def dfs(string, depth):
global curr, n, a, word
if curr >= n:
return
if a[curr][0] == depth:
word[a[curr][1]] = string
curr += 1
... | output | 1 | 23,205 | 6 | 46,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland peopl... | instruction | 0 | 23,206 | 6 | 46,412 |
Yes | output | 1 | 23,206 | 6 | 46,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland peopl... | instruction | 0 | 23,207 | 6 | 46,414 |
Yes | output | 1 | 23,207 | 6 | 46,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland peopl... | instruction | 0 | 23,208 | 6 | 46,416 |
Yes | output | 1 | 23,208 | 6 | 46,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland peopl... | instruction | 0 | 23,209 | 6 | 46,418 |
Yes | output | 1 | 23,209 | 6 | 46,419 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.