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.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase L... | instruction | 0 | 45,642 | 6 | 91,284 |
Tags: greedy
Correct Solution:
```
def f(a,bad):
i=0
retain=0
while i<len(a):
c={}
while i<len(a)-1 and (a[i+1]==a[i]or a[i+1]==bad.get(a[i],None)):
c[a[i]]=c.get(a[i],0)+1
i+=1
c[a[i]] = c.get(a[i], 0) + 1
retain+=max(c.items(),key=lambda s:s[1])[1]
i+=1
return len(a)-retain
a=list(input())
n=in... | output | 1 | 45,642 | 6 | 91,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase L... | instruction | 0 | 45,643 | 6 | 91,286 |
Tags: greedy
Correct Solution:
```
#input=__import__('sys').stdin.readline
s = list(input())
k = int(input())
li=[]
for i in range(k):
a = input()
li.append(a)
li.append(a[::-1])
lis=[]
lis.append([s[0],1])
for i in range(1,len(s)):
if s[i]==lis[-1][0]:
lis[-1][1]+=1
else:
lis.ap... | output | 1 | 45,643 | 6 | 91,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase L... | instruction | 0 | 45,644 | 6 | 91,288 |
Tags: greedy
Correct Solution:
```
s = input()
l = []
n = int(input())
for i in range(n):
m = input()
l.append((m[0], m[1]))
# print(l[i/ ])
ans = 0
for i in range(n):
a, b = l[i][0], l[i][1]
# b = m[i][1]
streak = 0
c = 0
d = 0
for j in range(len(s)):
if(s[j] == a or s[j]... | output | 1 | 45,644 | 6 | 91,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase L... | instruction | 0 | 45,645 | 6 | 91,290 |
Tags: greedy
Correct Solution:
```
s = input()
k = int(input())
h = 1
d = {}
for i in range(k):
a, b = input()
d[a] = d[b] = h
h += 1
for c in s:
if c not in d:
d[c] = h
h += 1
count = 0
i = 0
ch = ''
c_ch, c_e = 0, 0
val = 0
while True:
if d[s[i]] != val:
count += min(c_ch,... | output | 1 | 45,645 | 6 | 91,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase L... | instruction | 0 | 45,646 | 6 | 91,292 |
Tags: greedy
Correct Solution:
```
import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65
def getInt():
return int(sys.stdin.readline().rstrip())
def getInts():
return map(int, sys.stdin.readline().rstrip().split(" "))
def getString():
return sys.stdin.readlin... | output | 1 | 45,646 | 6 | 91,293 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be r... | instruction | 0 | 45,647 | 6 | 91,294 |
Yes | output | 1 | 45,647 | 6 | 91,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be r... | instruction | 0 | 45,648 | 6 | 91,296 |
No | output | 1 | 45,648 | 6 | 91,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be r... | instruction | 0 | 45,649 | 6 | 91,298 |
No | output | 1 | 45,649 | 6 | 91,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be r... | instruction | 0 | 45,650 | 6 | 91,300 |
No | output | 1 | 45,650 | 6 | 91,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be r... | instruction | 0 | 45,651 | 6 | 91,302 |
No | output | 1 | 45,651 | 6 | 91,303 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,726 | 6 | 91,452 |
Tags: *special
Correct Solution:
```
c = list(map(int, input().split()))
print(min(c[0], c[1], c[2] // 2, c[3] // 7, c[4] // 4))
``` | output | 1 | 45,726 | 6 | 91,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,727 | 6 | 91,454 |
Tags: *special
Correct Solution:
```
s = input().split()
print(min(int(s[0])//1,int(s[1])//1,int(s[2])//2,int(s[3])//7,int(s[4])//4))
``` | output | 1 | 45,727 | 6 | 91,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,728 | 6 | 91,456 |
Tags: *special
Correct Solution:
```
a = [1,1,2,7,4]
b = list(map(int, input().split()))
m = 1000
for i in range(5):
m = min(b[i]//a[i],m)
print(m)
``` | output | 1 | 45,728 | 6 | 91,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,729 | 6 | 91,458 |
Tags: *special
Correct Solution:
```
a, b, c, d, e = map(int, input().split(' ')); print(min(a, b, c//2, d//7, e//4))
``` | output | 1 | 45,729 | 6 | 91,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,730 | 6 | 91,460 |
Tags: *special
Correct Solution:
```
a=list(map(int,input().split()))
ans=100
ans=min(ans,a[0])
ans=min(ans,a[1])
ans=min(ans,a[2]//2)
ans=min(ans,a[3]//7)
ans=min(ans,a[4]//4)
print(ans)
``` | output | 1 | 45,730 | 6 | 91,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,731 | 6 | 91,462 |
Tags: *special
Correct Solution:
```
import sys
a = list(map(int, sys.stdin.readline().split()))
d = [1, 1, 2, 7, 4]
ans = a[0]
for i in range(5):
ans = min(ans, a[i] // d[i])
print(ans)
``` | output | 1 | 45,731 | 6 | 91,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,732 | 6 | 91,464 |
Tags: *special
Correct Solution:
```
s = list(map(int, input().split()))
rp = [1, 1, 2, 7, 4]
print(min([s[i] // rp[i] for i in range(5)]))
``` | output | 1 | 45,732 | 6 | 91,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitr... | instruction | 0 | 45,733 | 6 | 91,466 |
Tags: *special
Correct Solution:
```
a , b , c , d , e = map( int , input().split())
print( min( a , b , c // 2 , d // 7 , e // 4 ) )
``` | output | 1 | 45,733 | 6 | 91,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out... | instruction | 0 | 45,837 | 6 | 91,674 |
Tags: dp, strings
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def calculatePiArray(s):
n = len(s)
pi = [0]*n
for i in range(1,n):
j = pi[i-1]
while j and s[i] != s[j]:
j = pi[j-1]
if s[i... | output | 1 | 45,837 | 6 | 91,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out... | instruction | 0 | 45,838 | 6 | 91,676 |
Tags: dp, strings
Correct Solution:
```
def prefix(st):
t = 0
p = [0] * (len(st) + 1)
o = [0] * (len(st) + 1)
for i in range(2, len(st)):
while t > 0 and st[i] != st[t + 1]:
t = p[t]
if st[i] == st[t + 1]:
t += 1
p[i] = t
while t > 0:
o[t] = 1
... | output | 1 | 45,838 | 6 | 91,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out... | instruction | 0 | 45,839 | 6 | 91,678 |
Tags: dp, strings
Correct Solution:
```
t=input()
s=input()
n=len(s)
h=[0]*(n+1)
h[0]=0
j=0
fa=[0]*(n+1)
for i in range(2,n+1) :
while j and s[i-1]!=s[j]:
#j=fa[j-1];
j=fa[j];
if s[i-1]==s[j]:
j+=1
fa[i]=j;
#print(fa)
l=list()
j=fa[n]
while(j>0):
l.append(j)
j=fa[j]
tmp=t
... | output | 1 | 45,839 | 6 | 91,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in hist... | instruction | 0 | 45,840 | 6 | 91,680 |
No | output | 1 | 45,840 | 6 | 91,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in hist... | instruction | 0 | 45,841 | 6 | 91,682 |
No | output | 1 | 45,841 | 6 | 91,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in hist... | instruction | 0 | 45,842 | 6 | 91,684 |
No | output | 1 | 45,842 | 6 | 91,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in hist... | instruction | 0 | 45,843 | 6 | 91,686 |
No | output | 1 | 45,843 | 6 | 91,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,641 | 6 | 93,282 |
Tags: implementation
Correct Solution:
```
s = str(input())
n = int(input())
l = 'z'
c = 0
for i in range(n):
s1 = str(input())
if(s1 == s):
print(s)
exit()
if(s1[:len(s):] == s):
c+=1
if s1 < l:
l = s1
if(c == 0):
l = s
print(l)
``` | output | 1 | 46,641 | 6 | 93,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,642 | 6 | 93,284 |
Tags: implementation
Correct Solution:
```
current_input = input()
num_history = int(input())
history_arr = [input() for _ in range(num_history)]
relevant_arr = [history_element for history_element in history_arr if (history_element[:len(current_input)] == current_input)]
relevant_arr.sort()
print(relevant_arr[0] if le... | output | 1 | 46,642 | 6 | 93,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,643 | 6 | 93,286 |
Tags: implementation
Correct Solution:
```
palavra = input()
qtd = int(input())
history = [input() for i in range(qtd)]
history.sort()
new = []
for p in history:
if p >= palavra:
new.append(p)
if len(new) == 0:
print(palavra)
else:
first = new[0]
if first == palavra:
print(palavra)
else:
if len(first) >= ... | output | 1 | 46,643 | 6 | 93,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,644 | 6 | 93,288 |
Tags: implementation
Correct Solution:
```
a=input()
b=int(input())
c=[]
d=0
f=[]
for i in range(b):
e=input()
c.append(e)
for i in c:
if(a in i[0:len(a)]):
d+=1
f.append(i)
else:
pass
if(d>=1):
print(min(f))
else:
print(a)
``` | output | 1 | 46,644 | 6 | 93,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,645 | 6 | 93,290 |
Tags: implementation
Correct Solution:
```
n=input()
k=len(n)
ta=[]
p=int(input())
for x in range(p):
ol=input()
if ol[0:k]==n:
ta.append(ol[k:])
else:
pass
if ta==list():
print(n)
else:
ta.sort()
print(n+ta[0])
``` | output | 1 | 46,645 | 6 | 93,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,646 | 6 | 93,292 |
Tags: implementation
Correct Solution:
```
import math
def ans(l,s,x):
f=l
y=l[0:x]
if(s==y):
return True
else:
return False
s=str(input())
x=len(s)
t=int(input())
m=100000
f=0
k=''
l=[]
while(t>0):
a=str(input())
l.append(a)
t-=1
l.sort()
for i in l:
if(ans(i,... | output | 1 | 46,646 | 6 | 93,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,647 | 6 | 93,294 |
Tags: implementation
Correct Solution:
```
s = input()
i = int(input())
c = []
for x in range(i):
t = input()
if len(t) < len(s):
pass
else:
if t[:len(s)] == s:
c.append(t)
if len(c) == 0:
print(s)
else:
res = min(sub for sub in c if isinstance(sub, str))
print(res)
... | output | 1 | 46,647 | 6 | 93,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working ... | instruction | 0 | 46,648 | 6 | 93,296 |
Tags: implementation
Correct Solution:
```
#l,r = map(int, input().strip().split(' '))
#lst = list(map(int, input().strip().split(' ')))
s=input()
n=int(input())
p='z'*100
f=0
#should be a prefix
for i in range(n):
t=input()
if s == t[:len(s)] and t<p:
p=t
f=1
if f==0:
print(s)
else:
pri... | output | 1 | 46,648 | 6 | 93,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,649 | 6 | 93,298 |
Yes | output | 1 | 46,649 | 6 | 93,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,650 | 6 | 93,300 |
Yes | output | 1 | 46,650 | 6 | 93,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,651 | 6 | 93,302 |
Yes | output | 1 | 46,651 | 6 | 93,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,652 | 6 | 93,304 |
Yes | output | 1 | 46,652 | 6 | 93,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,653 | 6 | 93,306 |
No | output | 1 | 46,653 | 6 | 93,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,654 | 6 | 93,308 |
No | output | 1 | 46,654 | 6 | 93,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,655 | 6 | 93,310 |
No | output | 1 | 46,655 | 6 | 93,311 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new brows... | instruction | 0 | 46,656 | 6 | 93,312 |
No | output | 1 | 46,656 | 6 | 93,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai... | instruction | 0 | 46,741 | 6 | 93,482 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
n, k = map(int, input().split())
p = {}
np = {}
pair = []
used = {}
rev_d = {}
def push(d, s, v):
if s not in d:
d[s] = []
d[s].append(v)
def is_pal(s):
n = len(s)
flg=True
for i in range(n//2):
i... | output | 1 | 46,741 | 6 | 93,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai... | instruction | 0 | 46,742 | 6 | 93,484 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import sys
import math
def solve():
k, n = map(int, input().split())
D = {}
for line in sys.stdin:
s, a = line.split()
if s in D:
D[s].append(int(a))
else:
D[s] = [int(a)]
res =... | output | 1 | 46,742 | 6 | 93,485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai... | instruction | 0 | 46,743 | 6 | 93,486 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
#import... | output | 1 | 46,743 | 6 | 93,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n... | instruction | 0 | 46,746 | 6 | 93,492 |
No | output | 1 | 46,746 | 6 | 93,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin... | instruction | 0 | 46,808 | 6 | 93,616 |
Tags: implementation, strings
Correct Solution:
```
n=int(input())
a=[input() for i in range(n)]
w=input()
b=[False for i in range(len(w))]
c=input()
for i in range(len(w)):
z=0
for s in a:
if w[i:].lower().startswith(s.lower()):
z=max(z,len(s))
for j in range(i,i+z): b[j]=True
s=''
for ... | output | 1 | 46,808 | 6 | 93,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin... | instruction | 0 | 46,809 | 6 | 93,618 |
Tags: implementation, strings
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt... | output | 1 | 46,809 | 6 | 93,619 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin... | instruction | 0 | 46,810 | 6 | 93,620 |
Tags: implementation, strings
Correct Solution:
```
n=int(input())
a=[input().lower() for i in range(n)]
b=input()
c=input()
b1=b.lower()
d=[0]*len(b)
e=''
b2=len(b)
for i in range(n):
for j in range(b2-len(a[i])+1):
for k in range(len(a[i])):
if a[i][k]!=b1[j+k]:
break
e... | output | 1 | 46,810 | 6 | 93,621 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin... | instruction | 0 | 46,811 | 6 | 93,622 |
Tags: implementation, strings
Correct Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(input().rstrip())
w = list(input().rstrip())
c = input().rstrip()
m = len(w)
z = []
i = 0
while i < m:
for j in range(n):
if w[i].lower() == a[j][0].lower():
if i + len(a[j]) <= m:
... | output | 1 | 46,811 | 6 | 93,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrin... | instruction | 0 | 46,812 | 6 | 93,624 |
Tags: implementation, strings
Correct Solution:
```
n= int(input())#how many word
b = []
for i in range(n):
b.append(input())# put the word in a list
w = input()#what we whant to change
let = input()#which we change in to
bad=[]
for i in range(len(w)):
bad.append(True)
for i in range(len(w)):
mx = 0
f... | output | 1 | 46,812 | 6 | 93,625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.