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.
IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the girl is quickly b... | instruction | 0 | 58,847 | 6 | 117,694 |
No | output | 1 | 58,847 | 6 | 117,695 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,111 | 6 | 118,222 |
Tags: expression parsing, implementation
Correct Solution:
```
import re
n = int(input())
message = "Unhandled Exception"
S = []
throw_ind = -1
throw_symb = None
found = False
for i in range(n):
line = input().strip()
if len(line) > 0:
if line[:2] == 'tr':
S.append(i)
elif lin... | output | 1 | 59,111 | 6 | 118,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,112 | 6 | 118,224 |
Tags: expression parsing, implementation
Correct Solution:
```
opened, catched, typ = 0, -1, ''
n = int(input())
arr = list(input().strip() for _ in range(n))
for s in arr:
if s == '':
continue
if s.startswith('try'):
opened += 1
elif s.startswith('throw'):
catched = opened
... | output | 1 | 59,112 | 6 | 118,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,113 | 6 | 118,226 |
Tags: expression parsing, implementation
Correct Solution:
```
'''input
3
try
throw ( try )
catch ( try, "try again")
'''
# A coding delight
from sys import stdin
def get_ans(org):
temp = org.split('"')
return temp[1]
def get_sign(arr):
arr = arr.split()
arr = ''.join(arr)
arr = arr.split('(')
first = arr[1].s... | output | 1 | 59,113 | 6 | 118,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,114 | 6 | 118,228 |
Tags: expression parsing, implementation
Correct Solution:
```
import re
s = []
tid = 0
gl = ""
reg1 = 'throw\s*\(\s*(.*?)\s*\)'
reg2 = 'catch\s*\(\s*(.*?)\s*,\s*"(.*?)"\s*\)'
# print(re.match(reg2, 'catch ( AE ,"asda")'))
def solve():
n = int(input())
gl = ""
for i in range(n):
st = input().strip(... | output | 1 | 59,114 | 6 | 118,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,115 | 6 | 118,230 |
Tags: expression parsing, implementation
Correct Solution:
```
from sys import stdin, stdout
n = int(stdin.readline())
label = ''
cnt = 0
def first(s):
f = ''
for a in s:
if 'z' >= a >= 'a':
f += a
else:
break
return f
for i in range(n):
s = stdin.re... | output | 1 | 59,115 | 6 | 118,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,116 | 6 | 118,232 |
Tags: expression parsing, implementation
Correct Solution:
```
import sys
n = int(input())
flag = False
an = ""
queue = []
exc = ""
for x in range(n):
strr = input().split('(');
if strr[0].strip() == 'try':
queue.append(x)
elif strr[0].strip() == 'throw':
exc = strr[1].split(")")[0].strip... | output | 1 | 59,116 | 6 | 118,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,117 | 6 | 118,234 |
Tags: expression parsing, implementation
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... | output | 1 | 59,117 | 6 | 118,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.
The exceptions are processed by try-ca... | instruction | 0 | 59,118 | 6 | 118,236 |
Tags: expression parsing, implementation
Correct Solution:
```
import io, os
# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
ii=lambda:int(input())
kk=lambda:map(int,input().split())
ll=lambda:list(kk())
opened=0
catchd = -1
typ = ""
... | output | 1 | 59,118 | 6 | 118,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,818 | 6 | 119,636 |
Tags: greedy
Correct Solution:
```
def swap(lst, i, j):
lst[i], lst[j] = lst[j], lst[i]
def comp(l1, l2):
for i in range(min(len(l1), len(l2))):
if l1[i] < l2[i]:
return True
if l1[i] == l2[i]:
continue
return False
return len(l1) < len(l2)
def logic(s, c):
... | output | 1 | 59,818 | 6 | 119,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,819 | 6 | 119,638 |
Tags: greedy
Correct Solution:
```
import collections
T = int(input())
for _ in range(T):
s1, s2 = input().split()
if len(set(s1)) > 1:
arr = list(s1)
cnt = collections.Counter(arr)
i = 0
while i < len(arr) and arr[i] == min(cnt.keys()):
cnt[arr[i]] -= 1
if cnt[arr[i]] == 0:
de... | output | 1 | 59,819 | 6 | 119,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,820 | 6 | 119,640 |
Tags: greedy
Correct Solution:
```
from sys import stdin,stdout
def main():
T = int(stdin.readline())
for i in range (T):
a = list(map(str,stdin.readline().split()))
newstr = str(a[0])
already = False
possible = False
for j,(x,y) in enumerate(zip(a[0],a[1])):
... | output | 1 | 59,820 | 6 | 119,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,821 | 6 | 119,642 |
Tags: greedy
Correct Solution:
```
# def compare(a, b):
# if b.startswith(a) and a != b:
# return True
# else:
# for x, y in zip(a, b):
# if x == y:
# continue
# elif x < y:
# return True
# else:
# return False
... | output | 1 | 59,821 | 6 | 119,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,822 | 6 | 119,644 |
Tags: greedy
Correct Solution:
```
import sys
p = int(sys.stdin.readline().strip())
ans = []
def findMinimum(lst):
lo = 'a'
for k in range(len(lst)):
if lst[k] <= lo:
lo = lst[k]
idx = k
return lo, idx
for i in range(p):
m, n = sys.stdin.readline().strip().split(' ')
... | output | 1 | 59,822 | 6 | 119,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,823 | 6 | 119,646 |
Tags: greedy
Correct Solution:
```
def swap(s):
l = len(s)
index = list(range(l))
index.sort(key=lambda i:s[i])
low = None
for i in range(l):
ind = index[i]
if s[i] != s[ind]:
left = i
low = s[ind]
break
if low is None:
return
right... | output | 1 | 59,823 | 6 | 119,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,824 | 6 | 119,648 |
Tags: greedy
Correct Solution:
```
import sys, queue, copy
sys.setrecursionlimit(10 ** 8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')
def solve():
S, c = inpl_str()
s_sort = sorted(S)
for i in range(len(S)):
... | output | 1 | 59,824 | 6 | 119,649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high eno... | instruction | 0 | 59,825 | 6 | 119,650 |
Tags: greedy
Correct Solution:
```
from sys import stdin
from string import ascii_uppercase as y
for _ in range(int(stdin.readline())):
s,c = stdin.readline().split()
dct = {q:set() for q in y}
fl = 0
for i in range(len(s)):
dct[s[i]].add(i)
dct1 = {'A':set()}
for r in range(1,26):
... | output | 1 | 59,825 | 6 | 119,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,826 | 6 | 119,652 |
Yes | output | 1 | 59,826 | 6 | 119,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,827 | 6 | 119,654 |
Yes | output | 1 | 59,827 | 6 | 119,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,828 | 6 | 119,656 |
Yes | output | 1 | 59,828 | 6 | 119,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,829 | 6 | 119,658 |
Yes | output | 1 | 59,829 | 6 | 119,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,830 | 6 | 119,660 |
No | output | 1 | 59,830 | 6 | 119,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,831 | 6 | 119,662 |
No | output | 1 | 59,831 | 6 | 119,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,832 | 6 | 119,664 |
No | output | 1 | 59,832 | 6 | 119,665 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big proble... | instruction | 0 | 59,833 | 6 | 119,666 |
No | output | 1 | 59,833 | 6 | 119,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,336 | 6 | 120,672 |
Tags: implementation, strings
Correct Solution:
```
class CodeforcesTask87BSolution:
def __init__(self):
self.result = ''
self.n = 0
self.expressions = []
def read_input(self):
self.n = int(input())
for x in range(self.n):
self.expressions.append(input().spli... | output | 1 | 60,336 | 6 | 120,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,337 | 6 | 120,674 |
Tags: implementation, strings
Correct Solution:
```
#!/usr/bin/env python3
n = int(input())
data = dict()
data['void'] = 0
def parse(definition):
ampersands = definition.count('&')
asterisks = definition.count('*')
name = definition[ampersands:len(definition)-asterisks]
return (name, asterisks - amp... | output | 1 | 60,337 | 6 | 120,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,338 | 6 | 120,676 |
Tags: implementation, strings
Correct Solution:
```
from collections import *
import sys,re
lines = [i[:-1] for i in sys.stdin.readlines()]
n = int(lines[0])
lines = lines[1:]
typeof = defaultdict(lambda:'errtype')
typeof['void'] = 'void'
def simplify(s):
global typeof
l,r = s.count('&'),s.count('*')
result = typeof... | output | 1 | 60,338 | 6 | 120,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,339 | 6 | 120,678 |
Tags: implementation, strings
Correct Solution:
```
types = {'void':'void', 'errtype':'errtype'}
def getRealType(type_expr):
expr_type = type_expr.strip('&*')
full_type_name = type_expr.replace(expr_type, types.get(expr_type, "errtype"))
base_type = full_type_name.strip('&*')
if base_type == "void":
... | output | 1 | 60,339 | 6 | 120,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,340 | 6 | 120,680 |
Tags: implementation, strings
Correct Solution:
```
types = {'void':'void', 'errtype':'errtype'}
def getRealType(type_expr):
expr_type = type_expr.strip('&*')
full_type_name = type_expr.replace(expr_type, types.get(expr_type, "errtype"))
base_type = full_type_name.strip('&*')
if base_type == "void":
addr_c... | output | 1 | 60,340 | 6 | 120,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,341 | 6 | 120,682 |
Tags: implementation, strings
Correct Solution:
```
n=int(input())
def Ref(v):
stars=0
ands=0
nam=""
for item in v:
if(item=='*'):
stars+=1
elif(item=='&'):
ands+=1
else:
nam+=item
if(nam not in T):
return "errtype"
x=T[nam]
... | output | 1 | 60,341 | 6 | 120,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,342 | 6 | 120,684 |
Tags: implementation, strings
Correct Solution:
```
def tr(v):
a = v.count('&')
b = v.count('*')
v = v.replace('&', '').replace('*', '')
if a > b:
a -= b
b = 0
else:
b -= a
a = 0
return '&' * a + v + '*' * b
def go(v):
i = v.replace('&', '').replace('*', '')
... | output | 1 | 60,342 | 6 | 120,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. ... | instruction | 0 | 60,343 | 6 | 120,686 |
Tags: implementation, strings
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
# from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('inp... | output | 1 | 60,343 | 6 | 120,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the a... | instruction | 0 | 60,344 | 6 | 120,688 |
Yes | output | 1 | 60,344 | 6 | 120,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the a... | instruction | 0 | 60,345 | 6 | 120,690 |
Yes | output | 1 | 60,345 | 6 | 120,691 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the a... | instruction | 0 | 60,346 | 6 | 120,692 |
No | output | 1 | 60,346 | 6 | 120,693 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the a... | instruction | 0 | 60,347 | 6 | 120,694 |
No | output | 1 | 60,347 | 6 | 120,695 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,067 | 6 | 122,134 |
Tags: data structures, hashing, implementation
Correct Solution:
```
a = int(input())
b = []
for i in range(a):
b.append(input())
s = {}
for i in b:
s[i] = 0
for i in b:
if s[i] > 0:
print(i + str(s[i]))
else:
print("OK")
s[i] += 1
``` | output | 1 | 61,067 | 6 | 122,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,068 | 6 | 122,136 |
Tags: data structures, hashing, implementation
Correct Solution:
```
db = dict()
ls = []
for i in range(int(input())):
user = input()
if not db.get(user):
db[user] = 1
ls.append("OK")
else:
ls.append(user+str(db[user]))
db[user] += 1
print(*ls,sep="\n")
``` | output | 1 | 61,068 | 6 | 122,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,069 | 6 | 122,138 |
Tags: data structures, hashing, implementation
Correct Solution:
```
compare = {}
for i in range(int(input())):
string = input()
if string not in compare:
print("OK")
compare[string]=1
else:
print(string+str(compare[string]))
compare[string] += 1
``` | output | 1 | 61,069 | 6 | 122,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,070 | 6 | 122,140 |
Tags: data structures, hashing, implementation
Correct Solution:
```
n=int(input())
d={}
for i1 in range(n):
s=input()
s=s.replace('\r','')
if s not in d:
d[s]=1
print('OK')
else:
print('{}{}'.format(s,d[s]))
d[s]=d[s]+1
``` | output | 1 | 61,070 | 6 | 122,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,071 | 6 | 122,142 |
Tags: data structures, hashing, implementation
Correct Solution:
```
import sys
n = int(sys.stdin.readline().strip())
lines = []
for i in range(0, n):
lines.append(sys.stdin.readline().strip())
database = {}
for line in lines:
if line in database:
name = database[line]
length = len(line)
... | output | 1 | 61,071 | 6 | 122,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,072 | 6 | 122,144 |
Tags: data structures, hashing, implementation
Correct Solution:
```
n = int(input())
dp = {}
for i in range(n):
a = input()
if a in dp:
dp[a] += 1
print(a + str(dp[a]))
else:
dp[a] = 0
print('OK')
``` | output | 1 | 61,072 | 6 | 122,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,073 | 6 | 122,146 |
Tags: data structures, hashing, implementation
Correct Solution:
```
n = int(input())
usernames_map = {}
responses = []
for i in range(n):
username = input()
if username not in usernames_map:
usernames_map[username] = 1
responses.append('OK')
else:
responses.append(username + str(usernames_map[username]))
... | output | 1 | 61,073 | 6 | 122,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of... | instruction | 0 | 61,074 | 6 | 122,148 |
Tags: data structures, hashing, implementation
Correct Solution:
```
d={}
for _ in range(int(input())):
k=input()
if k not in d.keys():
d[k]=[k,0]
print('OK')
else:
print(d[k][0]+str(d[k][1]+1))
d[k]=[k,d[k][1]+1]
``` | output | 1 | 61,074 | 6 | 122,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.
Pasha didn't like hi... | instruction | 0 | 61,077 | 6 | 122,154 |
Tags: constructive algorithms, greedy, math, strings
Correct Solution:
```
s=list(input())
m=int(input())
n=len(s)
l=[0]*n
a=list(map(int,input().split()))
a.sort()
x=0
j=0
i=0
while i<n and j<m:
if i==a[j]-1:
if x==0:
l[i]=1
x=1
else:
l[i]=0
x=0
j+=1
else:
if x==1:
l[i]=1
i+=1
if x==1:
k=i... | output | 1 | 61,077 | 6 | 122,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.
Pasha didn't like hi... | instruction | 0 | 61,081 | 6 | 122,162 |
Tags: constructive algorithms, greedy, math, strings
Correct Solution:
```
import math
def main():
S = input()
S = list(S)
L = len(S)
troca = [False for i in range(math.ceil(L/2))]
M = int(input())
linha = [int(i) for i in input().split()]
for i in range(M):
troca[linha[i] - 1] = not troca[linha[i] - 1]
temp ... | output | 1 | 61,081 | 6 | 122,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, on a programming lesson little Petya showed how quickly he can create files and folders on the computer. But he got soon fed up with this activity, and he decided to do a much more useful thing. He decided to calculate what folder ... | instruction | 0 | 61,130 | 6 | 122,260 |
Tags: data structures, implementation
Correct Solution:
```
from collections import *
from sys import *
txt = stdin.readlines()
for i in range(len(txt)):
txt[i] = txt[i][:-1].replace(':\\', ':').split('\\')
file = Counter([s[0] for s in txt])
folder = defaultdict(set)
for i in txt:
for j in range(2, len(i)):
... | output | 1 | 61,130 | 6 | 122,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, on a programming lesson little Petya showed how quickly he can create files and folders on the computer. But he got soon fed up with this activity, and he decided to do a much more useful thing. He decided to calculate what folder ... | instruction | 0 | 61,131 | 6 | 122,262 |
Tags: data structures, implementation
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('i... | output | 1 | 61,131 | 6 | 122,263 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, on a programming lesson little Petya showed how quickly he can create files and folders on the computer. But he got soon fed up with this activity, and he decided to do a much more useful thing. He decided to calculate what folder ... | instruction | 0 | 61,132 | 6 | 122,264 |
Tags: data structures, implementation
Correct Solution:
```
s = []
files = {}
folders = {}
for _ in range(101):
try: a = input()
except EOFError : break
s.append(a)
b = a.split("\\")
for i in range(2 ,len(b)):
path = tuple(b[:i])
if(path not in files):
files[path] = 0
... | output | 1 | 61,132 | 6 | 122,265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.