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.
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of tw... | instruction | 0 | 86,218 | 6 | 172,436 |
Tags: brute force, implementation, strings
Correct Solution:
```
passwd = input()
words = []
for _ in range(int(input())):
word = input()
for i in word:
if i in passwd:
words.append(word)
break
for i in words:
for j in words:
if passwd in i + j:
print('... | output | 1 | 86,218 | 6 | 172,437 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of tw... | instruction | 0 | 86,219 | 6 | 172,438 |
Tags: brute force, implementation, strings
Correct Solution:
```
s = input()
n = int(input())
a = [input() for i in range(n)]
for i in range(n):
for j in range(n):
if a[i] == s or a[i][1] + a[j][0] == s:
print("YES")
exit(0)
print("NO")
``` | output | 1 | 86,219 | 6 | 172,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of tw... | instruction | 0 | 86,220 | 6 | 172,440 |
Tags: brute force, implementation, strings
Correct Solution:
```
password =input()
n = int(input())
n1 = n
li = []
i = 1
check = False
while n != 0:
temp = input()
li.append(temp)
n -= 1
for i in range(0,n1):
for j in range(0,n1):
a = li[i] + li[j]
b = li[j] + li[i]
if password i... | output | 1 | 86,220 | 6 | 172,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of tw... | instruction | 0 | 86,221 | 6 | 172,442 |
Tags: brute force, implementation, strings
Correct Solution:
```
password = input()
n = int(input())
firstLetter = 0
secondLetter = 0
found = 0
for i in range(n):
inputStr = input()
if inputStr == password:
found = 1
if inputStr[1] == password[0]:
firstLetter = 1
if inputStr[0] == ... | output | 1 | 86,221 | 6 | 172,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of tw... | instruction | 0 | 86,222 | 6 | 172,444 |
Tags: brute force, implementation, strings
Correct Solution:
```
s=input();n=int(input());x=0;y=0;k='';pd=0
for i in range(0,n):
k=input()
if k==s:
print('YES')
pd=1
break
else:
if k[0]==s[1]:
x=1
if k[1]==s[0]:
y=1
if x==1 and y==1:
... | output | 1 | 86,222 | 6 | 172,445 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,492 | 6 | 172,984 |
"Correct Solution:
```
class CheckError(Exception):
pass
def check(wclist, count):
c = 0
while True:
c += wclist.pop(0)
if c == count:
return wclist
elif c > count:
raise CheckError
def tanku_check(wclist):
for i in range(len(wclist)):
try:
... | output | 1 | 86,492 | 6 | 172,985 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,493 | 6 | 172,986 |
"Correct Solution:
```
while True:
n = int(input())
if n==0:
break
w = [len(input()) for i in range(n)]
a = [5,7,5,7,7]
ans = n+1
for i in range(n):
k,s = 0,0
for j in range(i,n):
s += w[j]
if s==a[k]:
s,k=0,k+1
elif s>a... | output | 1 | 86,493 | 6 | 172,987 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,494 | 6 | 172,988 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
else:
phlist=[]
phflag=0
for i in range(n):
phlist.append(input())
for i in range(len(phlist)-4):
cur=0
state=0
for j in range(i, len(phlist)):
... | output | 1 | 86,494 | 6 | 172,989 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,495 | 6 | 172,990 |
"Correct Solution:
```
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())
while True:
n = in... | output | 1 | 86,495 | 6 | 172,991 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,496 | 6 | 172,992 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
count = [0] * n
for i in range(n):
count[i] = len(input())
for i in range(n-4):
ind = i
fin = True
for tmp in [5, 7, 5, 7, 7]:
while tmp > 0 and ind < n:
tmp -= co... | output | 1 | 86,496 | 6 | 172,993 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,497 | 6 | 172,994 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
a = []
for i in range(n):
p = list(input())
a.append(len(p))
def solve(a):
N = len(a)
for i in range(N):
judge = 0
rest = 5
for j in range(i,N):
... | output | 1 | 86,497 | 6 | 172,995 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,498 | 6 | 172,996 |
"Correct Solution:
```
# AOJ 1601: Short Phrase
# Python3 2018.7.13 bal4u
a = [5,7,5,7,7]
while True:
n = int(input())
if n == 0: break
ans = 0
w = [len(input()) for i in range(n)]
for i in range(n):
k = s = 0
for j in range(i, n):
s += w[j]
if s == a[k]:
s, k = 0, k+1
if k == 5: ans = i+1; bre... | output | 1 | 86,498 | 6 | 172,997 |
Provide a correct Python 3 solution for this coding contest problem.
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Condition for a Sho... | instruction | 0 | 86,499 | 6 | 172,998 |
"Correct Solution:
```
def solve():
n = int(input())
if n == 0: return False
ok = [5, 7, 5, 7, 7]
inputs = [input() for x in range(n)]
for i in range(n):
target = 0
cnt = i
for v in ok:
while target < v:
s = inputs[cnt]
target +=... | output | 1 | 86,499 | 6 | 172,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he coul... | instruction | 0 | 86,901 | 6 | 173,802 |
Tags: combinatorics, dp
Correct Solution:
```
S, N = 2505, 105
m = 1000000007
k = 26
p = [[0] * (S + k) for i in range(N)]
p[0][0] = 1
for n in range(1, N):
for s in range(S):
p[n][s] = (p[n][s - 1] + p[n - 1][s] - p[n - 1][s - k]) % m
r = []
for j in range(int(input())):
t = input()
s = sum(ord(q) ... | output | 1 | 86,901 | 6 | 173,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he coul... | instruction | 0 | 86,902 | 6 | 173,804 |
Tags: combinatorics, dp
Correct Solution:
```
S, N = 2501, 101
m = 1000000007
k = 26
p = [[0] * (S + k) for i in range(N)]
p[0][0] = 1
for n in range(1, N):
for s in range(S):
p[n][s] = (p[n][s - 1] + p[n - 1][s] - p[n - 1][s - k]) % m
r = []
for j in range(int(input())):
t = input()
s = sum(ord(q) ... | output | 1 | 86,902 | 6 | 173,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he coul... | instruction | 0 | 86,903 | 6 | 173,806 |
Tags: combinatorics, dp
Correct Solution:
```
p = [[0] * 2527 for i in range(101)]
p[0][0] = 1
for n in range(100):
for s in range(2501):
p[n + 1][s] = (p[n + 1][s - 1] + p[n][s] - p[n][s - 26]) % 1000000007
for j in range(int(input())):
t = input()
s = sum(ord(q) - 97 for q in t)
print(p[len(t)... | output | 1 | 86,903 | 6 | 173,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya is a born Berland film director, he is currently working on a new blockbuster, "The Unexpected". Vasya knows from his own experience how important it is to choose the main characters' name... | instruction | 0 | 87,032 | 6 | 174,064 |
No | output | 1 | 87,032 | 6 | 174,065 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,206 | 6 | 174,412 |
Tags: brute force, implementation, strings
Correct Solution:
```
import sys
names = sys.stdin.readlines()[1:]
for n, name in enumerate(names):
if name in names[:n]:
print('YES')
else:
print('NO')
``` | output | 1 | 87,206 | 6 | 174,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,209 | 6 | 174,418 |
Tags: brute force, implementation, strings
Correct Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(input())
for i in range(n):
f = 0
for j in range(i):
if a[i] == a[j]:
print("YES")
f = 1
break
if f == 0:
print("NO")
``` | output | 1 | 87,209 | 6 | 174,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,210 | 6 | 174,420 |
Tags: brute force, implementation, strings
Correct Solution:
```
n=int(input())
l=[]
for i in range(n):
a=input()
if a not in l:
print('NO')
l.append(a)
else:
print('YES')
``` | output | 1 | 87,210 | 6 | 174,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,211 | 6 | 174,422 |
Tags: brute force, implementation, strings
Correct Solution:
```
# import sys
# sys.stdin=open('input.in','r')
# sys.stdout=open('output.out','w')
n=int(input())
p=[]
for x in range(n):
k=input()
if k not in p:
print('NO')
p.append(k)
else:
print('YES')
``` | output | 1 | 87,211 | 6 | 174,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,212 | 6 | 174,424 |
Tags: brute force, implementation, strings
Correct Solution:
```
# import sys
# sys.stdin=open("input.in","r")
# sys.stdout=open("output.out","w")
x=int(input())
L=[]
X={}
FLAG=0
for i in range(x):
FLAG=0
L.append(input())
for j in range(i):
if L[i]==L[j]:
print("YES")
FLAG=1
break
if FLAG==0:
print("N... | output | 1 | 87,212 | 6 | 174,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants t... | instruction | 0 | 87,213 | 6 | 174,426 |
Tags: brute force, implementation, strings
Correct Solution:
```
number=int(input())
lst=[]
for i in range(number):
x=input()
lst.append(x)
for i in range (number):
for j in range(0,i):
if lst[i]==lst[j]:
print ("Yes")
break;
else:
print ( "NO")
``` | output | 1 | 87,213 | 6 | 174,427 |
Provide a correct Python 3 solution for this coding contest problem.
Emacs is a text editor which is widely used by many programmers.
The advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pushing f, b, n, p with the Contr... | instruction | 0 | 87,448 | 6 | 174,896 |
"Correct Solution:
```
import sys
class Cursor:
BOL = (0,1)
def __init__(self, text):
assert isinstance(text, list)
self.text = text
for i in range(len(self.text)):
self.text[i] = list(self.text[i])
self.buffer = ""
self.line = 1
self.pos = self.B... | output | 1 | 87,448 | 6 | 174,897 |
Provide a correct Python 3 solution for this coding contest problem.
Emacs is a text editor which is widely used by many programmers.
The advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pushing f, b, n, p with the Contr... | instruction | 0 | 87,449 | 6 | 174,898 |
"Correct Solution:
```
text = []
while True:
s = input()
if s == "END_OF_TEXT":
break
text.append(s)
x, y = 0, 0
buff = ""
while True:
c = input()
if c == "-":
break
elif c == "a":
x = 0
elif c == "e":
x = len(text[y])
elif c == "p":
if y == 0:
x = 0
else:
x = 0
... | output | 1 | 87,449 | 6 | 174,899 |
Provide a correct Python 3 solution for this coding contest problem.
Emacs is a text editor which is widely used by many programmers.
The advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pushing f, b, n, p with the Contr... | instruction | 0 | 87,450 | 6 | 174,900 |
"Correct Solution:
```
class Editer:
def __init__(self, text):
# カーソルの位置
self.row = 0 #行
self.col = 0 #列
# 編集中のテキスト
self.text = [list(t) + ['\n'] for t in text]
# バッファー
self.buffer = []
def row_head(self):
return 0
def row_tail(self):
... | output | 1 | 87,450 | 6 | 174,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sonya had a birthday recently. She was presented with the matrix of size n× m and consist of lowercase Latin letters. We assume that the rows are numbered by integers from 1 to n from bottom to ... | instruction | 0 | 87,573 | 6 | 175,146 |
No | output | 1 | 87,573 | 6 | 175,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sonya had a birthday recently. She was presented with the matrix of size n× m and consist of lowercase Latin letters. We assume that the rows are numbered by integers from 1 to n from bottom to ... | instruction | 0 | 87,574 | 6 | 175,148 |
No | output | 1 | 87,574 | 6 | 175,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sonya had a birthday recently. She was presented with the matrix of size n× m and consist of lowercase Latin letters. We assume that the rows are numbered by integers from 1 to n from bottom to ... | instruction | 0 | 87,575 | 6 | 175,150 |
No | output | 1 | 87,575 | 6 | 175,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sonya had a birthday recently. She was presented with the matrix of size n× m and consist of lowercase Latin letters. We assume that the rows are numbered by integers from 1 to n from bottom to ... | instruction | 0 | 87,576 | 6 | 175,152 |
No | output | 1 | 87,576 | 6 | 175,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sent... | instruction | 0 | 87,991 | 6 | 175,982 |
Tags: data structures, dp, hashing, implementation, sortings, string suffix structures, strings
Correct Solution:
```
#!/usr/bin/env python3
# http://codeforces.com/contest/633/problem/C
from collections import deque
# import sys
# sys.setrecursionlimit(10001)
n = int(input())
s = input()
m = int(input())
words = [... | output | 1 | 87,991 | 6 | 175,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sent... | instruction | 0 | 87,992 | 6 | 175,984 |
Tags: data structures, dp, hashing, implementation, sortings, string suffix structures, strings
Correct Solution:
```
def main():
stop, s, words, stack = int(input()), input()[::-1], {}, []
for _ in range(int(input())):
w = input()
words[w.lower()] = w
lel = tuple(sorted(set(map(len, words.k... | output | 1 | 87,992 | 6 | 175,985 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sent... | instruction | 0 | 87,993 | 6 | 175,986 |
Tags: data structures, dp, hashing, implementation, sortings, string suffix structures, strings
Correct Solution:
```
def main():
stop, s, words, stack = int(input()), input()[::-1], {}, []
for _ in range(int(input())):
w = input()
words[w.lower()] = w
lel = tuple(sorted(set(map(len, words.k... | output | 1 | 87,993 | 6 | 175,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sent... | instruction | 0 | 87,994 | 6 | 175,988 |
Tags: data structures, dp, hashing, implementation, sortings, string suffix structures, strings
Correct Solution:
```
# [https://codeforces.com/contest/633/submission/33363209]
n = int(input())
t = input()[::-1]
m = int(input())
d = {q.lower(): q for q in [input() for i in range(m)]}
k = 0
s = []
l = sorted(set(map(le... | output | 1 | 87,994 | 6 | 175,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sent... | instruction | 0 | 87,995 | 6 | 175,990 |
Tags: data structures, dp, hashing, implementation, sortings, string suffix structures, strings
Correct Solution:
```
import sys
p = sys.stdin.read().split()
n, t = int(p[0]), p[1][::-1]
d = {q.lower(): q for q in p[3:]}
k, s = 0, []
l = sorted(set(map(len, d)))
while n:
k -= 1
if len(l) + k < 0: k, n = s.pop()... | output | 1 | 87,995 | 6 | 175,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,035 | 6 | 176,070 |
Tags: implementation
Correct Solution:
```
string = input()
stack = [len(string)]
for letter in string:
if letter == stack[-1]:
stack.pop()
else:
stack.append(letter)
print(''.join(stack[1:]))
``` | output | 1 | 88,035 | 6 | 176,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,036 | 6 | 176,072 |
Tags: implementation
Correct Solution:
```
##############--->>>>> Deepcoder Amit Kumar Bhuyan <<<<<---##############
"""
Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.
"""
from __future__ import division, print_function
import os,sys
from io import ... | output | 1 | 88,036 | 6 | 176,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,037 | 6 | 176,074 |
Tags: implementation
Correct Solution:
```
s = input()
stack = []
for char in s:
# print("Comparing", char, "&", stack)
if len(stack)==0:
stack.append(char)
else:
if(char == stack[-1]):
stack.pop()
else:
stack.append(char)
print("".join(stack))
``` | output | 1 | 88,037 | 6 | 176,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,038 | 6 | 176,076 |
Tags: implementation
Correct Solution:
```
s = []
for i in input():
if s and s[-1] == i:
s.pop()
else:
s.append(i)
print("".join(s))
``` | output | 1 | 88,038 | 6 | 176,077 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,039 | 6 | 176,078 |
Tags: implementation
Correct Solution:
```
s = input()
l = [""]*200000
li = 0
for c in s:
li += 1
if len(l) > 0 and l[li-1] == c:
l[li-1] = ""
li -= 2
else:
l[li] = c
print(*l[:li+1], sep="")
``` | output | 1 | 88,039 | 6 | 176,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,040 | 6 | 176,080 |
Tags: implementation
Correct Solution:
```
p=list(input())
a=[ ] #Creacion d euna lista vacia
a.append(p[0]) #incluir el primer elemnto de p a la lista a
m=len(p) #tamaño de p
i=1
while i<m:
if (len(a)==0):
a.append(p[i])
else:
if(a[-1]==p[i]):
a.pop()
... | output | 1 | 88,040 | 6 | 176,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,041 | 6 | 176,082 |
Tags: implementation
Correct Solution:
```
s=input()
ans=[s[0]]
for i in range(1,len(s)):
if len(ans) and ans[-1]==s[i]:
ans.pop()
else:
ans.append(s[i])
print("".join(ans))
``` | output | 1 | 88,041 | 6 | 176,083 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once... | instruction | 0 | 88,042 | 6 | 176,084 |
Tags: implementation
Correct Solution:
```
string = input()
def plugInX(string):
stringNew = []
for i in string:
if i not in stringNew:
stringNew.append(i)
elif i == stringNew[-1]:
stringNew.pop()
else:
stringNew.append(i)
if len(stringNew) > 0:
... | output | 1 | 88,042 | 6 | 176,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly pre... | instruction | 0 | 88,045 | 6 | 176,090 |
Yes | output | 1 | 88,045 | 6 | 176,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly pre... | instruction | 0 | 88,047 | 6 | 176,094 |
No | output | 1 | 88,047 | 6 | 176,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly pre... | instruction | 0 | 88,050 | 6 | 176,100 |
No | output | 1 | 88,050 | 6 | 176,101 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete... | instruction | 0 | 88,099 | 6 | 176,198 |
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n, s, t = int(input()), input(), input()
#print n, s, t
if sorted(s)!=sorted(t):
print(-1)
else:
ans = []
def shift(k, cur):
if k == 0:
return cur
return cur[:-k-1:-1] + cur [:-k]
def DO_SWA... | output | 1 | 88,099 | 6 | 176,199 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete... | instruction | 0 | 88,100 | 6 | 176,200 |
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
def reverse(s,k):
if not k:
return s
return s[-1:-k-1:-1]+s[:-k]
n=int(input())
s=input()
t=input()
cnt=[0]*26
for i in s:
cnt[ord(i)-ord('a')]+=1
for i in t:
cnt[ord(i)-ord('a')]-=1
for i in cnt:
if i!=0:
print(-1)
exit(0)
print... | output | 1 | 88,100 | 6 | 176,201 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete... | instruction | 0 | 88,101 | 6 | 176,202 |
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
import math
import sys
input = sys.stdin.readline
result = []
def move(s, x):
result.append(x)
# print(s[-1:-1-x:-1] + s[:len(s) - x])
return s[-1:-1-x:-1] + s[:len(s) - x]
def getFirst(s, need, size):
piv = -1
for i in ran... | output | 1 | 88,101 | 6 | 176,203 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete... | instruction | 0 | 88,102 | 6 | 176,204 |
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
res = []
for i in range(n):
k = 0;
while(s[k] != t[i]):
k += 1
res += [n-k-1, 1, n]
s = "".join(revers... | output | 1 | 88,102 | 6 | 176,205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.