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.
Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow keys: left, right, up,... | instruction | 0 | 70,201 | 6 | 140,402 |
Tags: brute force, greedy, implementation
Correct Solution:
```
n , p = map(int,input().split())
string = input()
def palindrome_transformer(string,n,p):#1 base indexing is p
if n % 2 == 0:
s_1 = string[0:int(n/2)]
s_2 = string[int(n/2):len(string)]
s_1_reversed = ""
for numbers in r... | output | 1 | 70,201 | 6 | 140,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow keys: left, right, up,... | instruction | 0 | 70,202 | 6 | 140,404 |
Tags: brute force, greedy, implementation
Correct Solution:
```
n, p = map(int, input().split())
s = list(map(ord, input()))
if p > n//2:
p = n - p
else:
p -= 1
l = n // 2
r = -1
ans = 0
for i in range(n//2):
d = abs(s[i]-s[n-i-1])
d = min(d, 26 - d)
if d:
l = min(l, i)
r = max(r... | output | 1 | 70,202 | 6 | 140,405 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible.
In one second, Genos i... | instruction | 0 | 70,260 | 6 | 140,520 |
Tags: dp
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
... | output | 1 | 70,260 | 6 | 140,521 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,292 | 6 | 140,584 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
from itertools import product
#n = int(input().strip())
n, q = map(int, input().strip().split())
dic = {}
for i in range(q):
a, b = input().strip().split()
dic[a] = b
count = 0
for i in product('abcdef', repeat = n):
s = ''.join(i)
... | output | 1 | 70,292 | 6 | 140,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,293 | 6 | 140,586 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n, q = map(int, input().split())
fr = dict()
for i in range(q):
a, b = input().split()
if b in fr:
fr[b].append(a)
else:
fr[b] = [a]
def dfs(c, cnt):
global n
if cnt == n:
return 1
if cnt > n:
... | output | 1 | 70,293 | 6 | 140,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,294 | 6 | 140,588 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n, m = map(int, input().split())
d = {}
for i in range(m):
t, o = input().split()
if o in d:
d[o].append(t)
else:
d[o] = [t]
q = [('a', 0)]
cnt = 0
while q and q[0][1] < n :
st = q[0]
q.pop(0)
if st[1] == ... | output | 1 | 70,294 | 6 | 140,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,295 | 6 | 140,590 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n,q=map(int,input().split())
d={i:""for i in "abcdef"}
for i in range(q):
a,b=input().split()
d[b]+=a[0]
cur=d['a']
for i in range(n-2):
nwcur=""
for j in cur:nwcur+=d[j]
cur=nwcur
print(len(cur))
``` | output | 1 | 70,295 | 6 | 140,591 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,296 | 6 | 140,592 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from itertools import combinations_with_replacement,permutations
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fil... | output | 1 | 70,296 | 6 | 140,593 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,297 | 6 | 140,594 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n,k = map(int,input().split())
l = {}
cnt = 0
for i in range(k):
a,b = input().split()
l[a] = b;
if n==2:
print(list(l.values()).count('a'))
exit(0)
def allcombs(s,prefix,l):
global cnt
if l==0:
if (check(prefix)):
cnt+=1
return
for i ... | output | 1 | 70,297 | 6 | 140,595 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,298 | 6 | 140,596 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n,q=map(int,input().split())
d={}
ch=set()
ans=set()
for i in range(q):
a,b=input().split()
d.setdefault(b,set()).add(a)
ch={"a"}
while ch!=set():
b=ch.pop()
if len(b)==n: ans.add(b); continue
for a in d.setdefault(b[0],set()):
... | output | 1 | 70,298 | 6 | 140,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ... | instruction | 0 | 70,299 | 6 | 140,598 |
Tags: brute force, dfs and similar, dp, strings
Correct Solution:
```
n, m = map(int, input().split())
mp = dict()
for _ in range(m):
a, b = input().split()
mp[a] = b;
from itertools import product
count = 0
for t in product('abcdef', repeat=n) :
s = ''.join(t)
for _ in range(n - 1):
s = mp.get(... | output | 1 | 70,299 | 6 | 140,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,328 | 6 | 140,656 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
ib = 0; mx = 0; foo = 0
for i in range(n):
if s[i]=='(':
k = i
while s[k]!=')':
if (s[k]=='(' or s[k]=='_') and (s[k+1]!=')' and s[k+1]!='_'): ib += 1
k += 1
for i in range(n)... | output | 1 | 70,328 | 6 | 140,657 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,329 | 6 | 140,658 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
n = int(input())
len_out, count_in = 0, 0
balance, cur = 0, 0
for c in input():
if not (('a' <= c <= 'z') or ('A' <= c <= 'Z')) and cur:
if balance:
count_in += 1
else:
len_out = max(len_out, cur)
... | output | 1 | 70,329 | 6 | 140,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,330 | 6 | 140,660 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
n=int(input())
text= input()[:n]
# words_with_paren=input().split('_')
len_long_word_out=0
numb_words_in_paren=0
if '(' in text:
open_ind = [i for i, x in enumerate(text) if x == "("]
close_ind= [i for i, x in enumerate(text) if ... | output | 1 | 70,330 | 6 | 140,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,331 | 6 | 140,662 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
from string import ascii_lowercase
n = int(input())
s = input()
wordsLen = 0
wordsInside = 0
flagInside = False
currWord = ""
for i in range(n):
if(s[i]=='_'):
currWord = ""
continue
elif(s[i]=='('):
currWord = ""
flagInside ... | output | 1 | 70,331 | 6 | 140,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,332 | 6 | 140,664 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
import math,sys,re,itertools,pprint
ri,rai=lambda:int(input()),lambda:list(map(int, input().split()))
n = ri()
s = input()
out = True
w = 0
r1, r2 = 0, 0
for c in s:
if c in '_()':
if w > 0 and not out:
r2 += 1
w = ... | output | 1 | 70,332 | 6 | 140,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,333 | 6 | 140,666 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
s += '_'
skob = 0
cnt = 0
maxL = 0
word = ''
for i in range(len(s)):
cur = s[i]
if cur == '_':
if skob > 0 and len(word) != 0:
cnt += 1
else:
if len(word) != 0:
... | output | 1 | 70,333 | 6 | 140,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,334 | 6 | 140,668 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
n = int(input())
s = str(input())
s = s.replace("(", " ( ")
s = s.replace(")", " ) ")
s = s.replace("_", " ")
answer = s.split()
a = 0
b = 0
op = False
for element in answer:
if element == "(":
op = True
elif element == ")":
... | output | 1 | 70,334 | 6 | 140,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You ... | instruction | 0 | 70,335 | 6 | 140,670 |
Tags: expression parsing, implementation, strings
Correct Solution:
```
litter=input();inside=outside=0
s=input()
i=s.find('(')
while i != -1 :
last = s.find(')')
for j in s[i+1 : last].split('_') :
if j != '':
inside+=1
if i==0:
s=s[last+1:]
else:
s = s[:i]+'_'+s[l... | output | 1 | 70,335 | 6 | 140,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,344 | 6 | 140,688 |
Tags: implementation, strings
Correct Solution:
```
count={}
str=input()
count[str]=1
l=(len(str))
for i in range(l):
str=str[-1]+str[0:l-1]
count[str]=(count.get(str,0))
print(len(count))
``` | output | 1 | 70,344 | 6 | 140,689 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,345 | 6 | 140,690 |
Tags: implementation, strings
Correct Solution:
```
st = input()
arr = []
for i in range(len(st)):
arr.append(st[i:] + st[:i])
arr = sorted(arr)
cnt = 1
for i in range(1,len(st)):
if(arr[i] != arr[i-1]):
cnt = cnt + 1
print(cnt)
``` | output | 1 | 70,345 | 6 | 140,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,346 | 6 | 140,692 |
Tags: implementation, strings
Correct Solution:
```
lis = []
s = input()
for i in range(len(s)):
lis.append(s[i:] + s[:i])
print(len(set(lis)))
``` | output | 1 | 70,346 | 6 | 140,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,347 | 6 | 140,694 |
Tags: implementation, strings
Correct Solution:
```
n = input()
l = []
for i in range(len(n)):
l.append(n[i:]+n[:i])
print(len(list(dict.fromkeys(l))))
``` | output | 1 | 70,347 | 6 | 140,695 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,348 | 6 | 140,696 |
Tags: implementation, strings
Correct Solution:
```
s = input()
known = set()
for i in range(len(s)):
p = s[i:]+ s[:i]
known.add(p)
print(len(known))
``` | output | 1 | 70,348 | 6 | 140,697 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,349 | 6 | 140,698 |
Tags: implementation, strings
Correct Solution:
```
s = input()
ss = set()
for i in range(len(s)):
a = s[-1]+s[0:-1]
ss.add(a)
s = a
print(len(ss))
``` | output | 1 | 70,349 | 6 | 140,699 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,350 | 6 | 140,700 |
Tags: implementation, strings
Correct Solution:
```
a=input()
r=['']
for i in range(len(a)):
s=a[len(a)-1]+a[:len(a)-1]
a=s
if a not in r:
r.append(a)
print(len(r)-1)
``` | output | 1 | 70,350 | 6 | 140,701 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts... | instruction | 0 | 70,351 | 6 | 140,702 |
Tags: implementation, strings
Correct Solution:
```
a=input()
n=len(a)
lis=[]
lis.append(a)
for i in range(1,n):
newstr=a[i:n]+a[:i]
lis.append(newstr)
set_lis=set(lis)
print(len(set_lis))
``` | output | 1 | 70,351 | 6 | 140,703 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,352 | 6 | 140,704 |
Yes | output | 1 | 70,352 | 6 | 140,705 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,353 | 6 | 140,706 |
Yes | output | 1 | 70,353 | 6 | 140,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,354 | 6 | 140,708 |
Yes | output | 1 | 70,354 | 6 | 140,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,355 | 6 | 140,710 |
Yes | output | 1 | 70,355 | 6 | 140,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,356 | 6 | 140,712 |
No | output | 1 | 70,356 | 6 | 140,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,357 | 6 | 140,714 |
No | output | 1 | 70,357 | 6 | 140,715 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,358 | 6 | 140,716 |
No | output | 1 | 70,358 | 6 | 140,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to... | instruction | 0 | 70,359 | 6 | 140,718 |
No | output | 1 | 70,359 | 6 | 140,719 |
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 | 70,993 | 6 | 141,986 |
Tags: greedy
Correct Solution:
```
######################################################
############Created by Devesh Kumar###################
#############devesh1102@gmail.com####################
##########For CodeForces(Devesh1102)#################
#####################2020#############################
############... | output | 1 | 70,993 | 6 | 141,987 |
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 | 70,994 | 6 | 141,988 |
Tags: greedy
Correct Solution:
```
import sys
from math import gcd,sqrt,ceil,log2
from collections import defaultdict,Counter,deque
from bisect import bisect_left,bisect_right
import math
import heapq
from itertools import permutations
# input=sys.stdin.readline
# def print(x):
# sys.stdout.write(str(x)+"\n")
# s... | output | 1 | 70,994 | 6 | 141,989 |
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 | 70,995 | 6 | 141,990 |
Tags: greedy
Correct Solution:
```
S = input()
M = int( input() )
banned = set( input() for i in range( M ) )
buff = set()
for s in banned:
if not ( s[ : : -1 ] in banned ):
buff.add( s[ : : -1 ] )
banned.update( buff )
dp = [ [ 1e9 for i in range( 26 ) ] for j in range( len( S ) + 1 ) ]
for i in range( 26 ):
... | output | 1 | 70,995 | 6 | 141,991 |
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 | 70,996 | 6 | 141,992 |
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, c_e)
c_ch, c_e ... | output | 1 | 70,996 | 6 | 141,993 |
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 | 70,997 | 6 | 141,994 |
Tags: greedy
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', 'r')
sys.s... | output | 1 | 70,997 | 6 | 141,995 |
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 | 70,998 | 6 | 141,996 |
Tags: greedy
Correct Solution:
```
s=input()
ans=[]
count=1
for i in range(1,len(s)):
if(s[i]==s[i-1]):
count+=1
else:
ans.append([count,s[i-1]])
count=1
ans.append([count,s[-1]])
total=0
t=int(input())
for m in range(t):
r=input()
i=0
while(i<len(ans)):
if(an... | output | 1 | 70,998 | 6 | 141,997 |
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 | 70,999 | 6 | 141,998 |
Tags: greedy
Correct Solution:
```
import sys
input=sys.stdin.readline
s=input().rstrip()
k=int(input())
cannot=[input().rstrip() for i in range(k)]
ans=0
for t in cannot:
a,b=0,0
for i in range(len(s)):
if s[i]==t[0]:
a+=1
elif s[i]==t[1]:
b+=1
else:
ans+=min(a,b)
a=b=0
ans+=m... | output | 1 | 70,999 | 6 | 141,999 |
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 | 71,000 | 6 | 142,000 |
Tags: greedy
Correct Solution:
```
p, t = {}, input()
a, n = False, len(t)
x = y = s = 0
q = [input() for i in range(int(input()))]
for a, b in q: p[a], p[b] = b, a
for i in t:
if a:
if i == a: x += 1
elif i == b: y += 1
else:
s += min(x, y)
if i in p:
... | output | 1 | 71,000 | 6 | 142,001 |
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 | 71,001 | 6 | 142,002 |
Yes | output | 1 | 71,001 | 6 | 142,003 |
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 | 71,002 | 6 | 142,004 |
Yes | output | 1 | 71,002 | 6 | 142,005 |
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 | 71,003 | 6 | 142,006 |
Yes | output | 1 | 71,003 | 6 | 142,007 |
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 | 71,004 | 6 | 142,008 |
Yes | output | 1 | 71,004 | 6 | 142,009 |
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 | 71,005 | 6 | 142,010 |
No | output | 1 | 71,005 | 6 | 142,011 |
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 | 71,006 | 6 | 142,012 |
No | output | 1 | 71,006 | 6 | 142,013 |
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 | 71,007 | 6 | 142,014 |
No | output | 1 | 71,007 | 6 | 142,015 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.