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 a correct Python 3 solution for this coding contest problem.
Broken crypto generator
JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat... | instruction | 0 | 29,992 | 6 | 59,984 |
"Correct Solution:
```
while True:
s = input()
if s == '.':break
while True:
if s.find('+') == -1 and s.find('-') == -1:
index = s.rfind('[')
if index == -1:break
e = s.find(']', index)
s = s[:index] + s[index + 1:e][::-1] + s[e + 1:]
else:
... | output | 1 | 29,992 | 6 | 59,985 |
Provide a correct Python 3 solution for this coding contest problem.
Broken crypto generator
JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat... | instruction | 0 | 29,993 | 6 | 59,986 |
"Correct Solution:
```
import re
while 1:
s=input()
if s==".":break
while "+-" in s or "-+" in s:
s=s.replace("+-","").replace("-+","")
while "+" in s:
pos=s.rfind("+")
cha=s[pos]+s[pos+1]
if ord(s[pos+1])==90:cha_r="A"
elif ord(s[pos+1])==63:cha_r="?"
els... | output | 1 | 29,993 | 6 | 59,987 |
Provide a correct Python 3 solution for this coding contest problem.
Broken crypto generator
JAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary to solve the ciphertext generat... | instruction | 0 | 29,994 | 6 | 59,988 |
"Correct Solution:
```
import string
dic_str = {}
for i,item in enumerate(string.ascii_uppercase):
dic_str[item] = i
"""
def rev(lis,bl = False):
if not "[" in lis:
return "".join(lis)
else:
start = -1
end = -1
i = 0
while(i < len(lis)):
if (start == -1) and (lis[i] == "["):
star... | output | 1 | 29,994 | 6 | 59,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the study of the Martians Petya clearly understood that the Martians are absolutely lazy. They like to sleep and don't like to wake up.
Imagine a Martian who has exactly n eyes located ... | instruction | 0 | 31,229 | 6 | 62,458 |
No | output | 1 | 31,229 | 6 | 62,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the study of the Martians Petya clearly understood that the Martians are absolutely lazy. They like to sleep and don't like to wake up.
Imagine a Martian who has exactly n eyes located ... | instruction | 0 | 31,230 | 6 | 62,460 |
No | output | 1 | 31,230 | 6 | 62,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the study of the Martians Petya clearly understood that the Martians are absolutely lazy. They like to sleep and don't like to wake up.
Imagine a Martian who has exactly n eyes located ... | instruction | 0 | 31,231 | 6 | 62,462 |
No | output | 1 | 31,231 | 6 | 62,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During the study of the Martians Petya clearly understood that the Martians are absolutely lazy. They like to sleep and don't like to wake up.
Imagine a Martian who has exactly n eyes located ... | instruction | 0 | 31,232 | 6 | 62,464 |
No | output | 1 | 31,232 | 6 | 62,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly k months. He looked at the calendar and learned that at the moment is the month number s. Vasya immediatel... | instruction | 0 | 31,348 | 6 | 62,696 |
Tags: implementation
Correct Solution:
```
import re
import sys
exit=sys.exit
from bisect import bisect_left as bsl,bisect_right as bsr
from collections import Counter,defaultdict as ddict,deque
from functools import lru_cache
cache=lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from p... | output | 1 | 31,348 | 6 | 62,697 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,384 | 6 | 62,768 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
a = str(input())
b = str(input())
c=0
d=0
while(d<len(a)+1):
if(a[d:d+len(b)]==b):
c+=1
d+=len(b)
else:
d+=1
print(c)
``` | output | 1 | 31,384 | 6 | 62,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,385 | 6 | 62,770 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
s1 = input()
s1 = s1.lower()
s2 = input()
s2 = s2.lower()
count = 0
if (len(s1) <= 100000 and len(s2) <= 30) and (len(s1) and len(s2)) >= 1 :
count = s1.count(s2)
print(count)
``` | output | 1 | 31,385 | 6 | 62,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,386 | 6 | 62,772 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
import re
string = str(input())
string1 = str(input())
count = 0
print(len(re.findall(string1, string)))
``` | output | 1 | 31,386 | 6 | 62,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,387 | 6 | 62,774 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
a = input()
b = input()
blen = len(b)
amount = 0
i = 0
while i < len(a) - blen + 1:
if a[i:i+blen] == b:
amount += 1
i += blen
else:
i += 1
print(amount)
``` | output | 1 | 31,387 | 6 | 62,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,388 | 6 | 62,776 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
s=input()
s1=input()
count,i=0,0
while i<((len(s)-len(s1))+1):
if s[i:i+len(s1)]==s1:
count+=1
i+=len(s1)
else:
i+=1
print(count)
``` | output | 1 | 31,388 | 6 | 62,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,389 | 6 | 62,778 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
a = input();
b = input();
i = a.find(b);
ans = 0;
while i >= 0:
i = a.find(b, i + len(b))
ans+=1;
print(ans)
``` | output | 1 | 31,389 | 6 | 62,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,390 | 6 | 62,780 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
s = input()
sub = input()
n1, n2 = len(s), len(sub)
ans = 0
i1, i2 = 0, 0
while i1 < n1:
ist = i1 + 1
while i1 < n1 and i2 < n2 and sub[i2] == s[i1]:
if s[i1] == sub[0] and i1 > ist:
ist = i1
i1 += 1
i2 += 1
if i2 == n2:
ans += 1
else:
... | output | 1 | 31,390 | 6 | 62,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is e... | instruction | 0 | 31,391 | 6 | 62,782 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
google = input()
apple = input()
answer = 0
if (apple in google):
answer = google.count(apple)
print(answer)
``` | output | 1 | 31,391 | 6 | 62,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,416 | 6 | 62,832 |
Tags: strings
Correct Solution:
```
n = int(input())
for i in range(0, n):
aString = input()
aStringLength = len(aString)
outputString = ""
if aStringLength > 10:
outputString += aString[0]
outputString += str(aStringLength-2)
outputString += aString[aStringLength-1]
else:
... | output | 1 | 31,416 | 6 | 62,833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,417 | 6 | 62,834 |
Tags: strings
Correct Solution:
```
a = int(input())
list2 = []
for i in range(0,a,1):
list2.append(input())
for j in list2:
if len(j)>10:
lis = [c for c in j]
num = str(len(lis) - 2)
print(lis[0] + num + lis[-1])
else:
print(j)
``` | output | 1 | 31,417 | 6 | 62,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,418 | 6 | 62,836 |
Tags: strings
Correct Solution:
```
n=int(input())
words =[]
for i in range(n):
words.append(input())
for i in range(n):
if len(words[i])>10:
words[i]=words[i][0]+str(len(words[i])-2)+words[i][len(words[i])-1]
for i in words:
print(i+'\n');
``` | output | 1 | 31,418 | 6 | 62,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,419 | 6 | 62,838 |
Tags: strings
Correct Solution:
```
n = int(input())
for i in range(n):
word = input()
if len(word) <= 10:
print(word)
else:
first_letter = word[0]
last_let = word[len(word) - 1]
middle = str(len(word) - 2)
newWord = first_letter + middle + last_let
print(newW... | output | 1 | 31,419 | 6 | 62,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,420 | 6 | 62,840 |
Tags: strings
Correct Solution:
```
n=int(input())
for i in range(n):
s=str(input())
l=len(s)
if(l>10):
s=s[0]+str(l-2)+s[l-1]
print(s)
else:
print(s)
``` | output | 1 | 31,420 | 6 | 62,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,421 | 6 | 62,842 |
Tags: strings
Correct Solution:
```
n = int(input())
for i in range(1, n+1):
s = input()
if len(s) > 10:
print(s[0]+str(len(s)-2)+s[len(s)-1])
else:
print(s)
``` | output | 1 | 31,421 | 6 | 62,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,422 | 6 | 62,844 |
Tags: strings
Correct Solution:
```
a=int(input())
for i in range(a):
string=input()
if(len(string)>10):
st=""
st+=str(string[0])
st+=str(len(string)-2)
st+=str(string[len(string)-1])
print(st)
else:
print(string)
``` | output | 1 | 31,422 | 6 | 62,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words... | instruction | 0 | 31,423 | 6 | 62,846 |
Tags: strings
Correct Solution:
```
n=int(input())
for k in range(n):
word=input()
z=len(word)
if z>10:
print(word[0]+str(z-2)+word[-1])
else:
print(word)
``` | output | 1 | 31,423 | 6 | 62,847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is stric... | instruction | 0 | 31,424 | 6 | 62,848 |
Yes | output | 1 | 31,424 | 6 | 62,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,190 | 6 | 64,380 |
Tags: implementation
Correct Solution:
```
from collections import defaultdict
n, m, x = [int(y) for y in input().split()]
a=[]
for _ in range(n):
a.append(input())
l=int(input())
s=input()
d=defaultdict(int)
shift=[]
for i in range(n):
for j in range(m):
if a[i][j]=='S':
shift.append((i,j))... | output | 1 | 32,190 | 6 | 64,381 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,191 | 6 | 64,382 |
Tags: implementation
Correct Solution:
```
from collections import Counter as cnt
# Function to get the distance between two points
def dis(ls, shifts, z):
x, y = ls[0], ls[1]
ans = []
for shift in shifts:
x1, y1 = shift[0], shift[1]
a = (x - x1) ** 2
b = (y - y1) ** 2
d =... | output | 1 | 32,191 | 6 | 64,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,192 | 6 | 64,384 |
Tags: implementation
Correct Solution:
```
from collections import defaultdict
import math
def dist(x1, y1, x2, y2):
a1 = (x1 - x2) * (x1 - x2)
b1 = (y1 - y2) * (y1 - y2)
# print(math.sqrt(a1 + b1))
return math.sqrt(a1 + b1)
def dfs(r, c, mat, vis, r_m, c_m, r1, c1, x):
if 0 < dist(r, c, r1, c1)... | output | 1 | 32,192 | 6 | 64,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,193 | 6 | 64,386 |
Tags: implementation
Correct Solution:
```
from math import *
def euclidian(x1, x2, y1, y2):
return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
dic = dict()
n, m, x = map(int, input().split())
for i in range(n):
a = input()
for j in range(m):
if a[j] not in dic:
dic[a[j]] = []
dic[... | output | 1 | 32,193 | 6 | 64,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,194 | 6 | 64,388 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/env python3
(n,m,x) = map(int, input().split())
keyboard = []
for i in range(n):
keyboard.append(input().strip())
q = int(input())
text = input().strip()
shift_keys = []
cost = dict()
for i in range(n):
for j in range(m):
if (keyboard[i][j] == 'S'):
... | output | 1 | 32,194 | 6 | 64,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,195 | 6 | 64,390 |
Tags: implementation
Correct Solution:
```
from collections import Counter as cnt
def dis(ls, shifts, z):
x, y = ls[0], ls[1]
ans = []
for shift in shifts:
x1, y1 = shift[0], shift[1]
a = (x - x1) ** 2
b = (y - y1) ** 2
d = (a + b) ** 0.5
if d > z:
an... | output | 1 | 32,195 | 6 | 64,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,196 | 6 | 64,392 |
Tags: implementation
Correct Solution:
```
import math
n, m, x = map(int, input().split())
keys = dict()
posKeys = []
a = []
for i in range(n):
a.append(input())
for i in range(n):
for j in range(m):
if a[i][j] == 'S':
posKeys.append((i,j))
else:
keys[a[i][j]] = 0
if... | output | 1 | 32,196 | 6 | 64,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some o... | instruction | 0 | 32,197 | 6 | 64,394 |
Tags: implementation
Correct Solution:
```
from math import sqrt
n, m, x = list(map(int, input().split()))
keyboard = {}
for i in range(n):
line_raw=input()
for j in range(len(line_raw)):
if line_raw[j] in keyboard:
keyboard[line_raw[j]].append((i, j))
else:
keyboard[line... | output | 1 | 32,197 | 6 | 64,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,198 | 6 | 64,396 |
Yes | output | 1 | 32,198 | 6 | 64,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,199 | 6 | 64,398 |
Yes | output | 1 | 32,199 | 6 | 64,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,200 | 6 | 64,400 |
Yes | output | 1 | 32,200 | 6 | 64,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,201 | 6 | 64,402 |
Yes | output | 1 | 32,201 | 6 | 64,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,202 | 6 | 64,404 |
No | output | 1 | 32,202 | 6 | 64,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,203 | 6 | 64,406 |
No | output | 1 | 32,203 | 6 | 64,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,204 | 6 | 64,408 |
No | output | 1 | 32,204 | 6 | 64,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys ... | instruction | 0 | 32,205 | 6 | 64,410 |
No | output | 1 | 32,205 | 6 | 64,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). U... | instruction | 0 | 32,674 | 6 | 65,348 |
Tags: implementation
Correct Solution:
```
def language(string):
dct={
">" :1000,
"<" : 1001,
"+" :1010,
"-" :1011,
"." :1100,
"," :1101,
"[" :1110,
"]" :1111
}
ans=""
for i in string:
ans+=str(dct[i])
return int(ans,2)% 1000003
print(language(input()))
``` | output | 1 | 32,674 | 6 | 65,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). U... | instruction | 0 | 32,675 | 6 | 65,350 |
Tags: implementation
Correct Solution:
```
# B. Unary
# time limit per test2 seconds
# memory limit per test256 megabytes
# inputstandard input
# outputstandard output
# Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
#
# Brainfuck programs use 8 commands: "+", "-", "[", "... | output | 1 | 32,675 | 6 | 65,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,830 | 6 | 65,660 |
Tags: math
Correct Solution:
```
res = 1
started = False
seen = set()
codes = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'])
zeroes = 0
for ch in input():
if ch == '?':
if started:
zeroes += 1
else:
res *= 9
elif (ch in codes) and (ch not in seen):
if not started:
res *= len(codes) - len(seen)... | output | 1 | 32,830 | 6 | 65,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,831 | 6 | 65,662 |
Tags: math
Correct Solution:
```
input_str = input()
q=0
tmp = []
for c in input_str:
if c == '?':
q+=1
if 'A' <= c <= 'J' and tmp.count(c)==0:
tmp.append(c)
k=1
for i in range(len(tmp)):
k*=(10-i)
if input_str[0] == '?':
print(str(9 * k) + '0'*(q-1))
elif 'A' <= input_str[0] <= 'J':
... | output | 1 | 32,831 | 6 | 65,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,832 | 6 | 65,664 |
Tags: math
Correct Solution:
```
#!/usr/bin/env python3
def solve():
s = input()
x = set()
f = False
r = 1
rc = 0
letter = set([c for c in 'ABCDEFGHIJ'])
if s[0] == '?':
r *= 9
if s[0] in letter:
x.add(s[0])
f = True
for c in s[1:]:
if c == '?':
... | output | 1 | 32,832 | 6 | 65,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,833 | 6 | 65,666 |
Tags: math
Correct Solution:
```
s = input()
si = len(s)
res = 1
seen = {}
Len = 0
if '0'<= s[0] <='9':
pass
else:
if s[0] == '?':
res *= 9
else:
res*= 9
seen[s[0]] = 1
Len+= 1
tmp = ""
for i in range(1, si):
if '0'<=s[i] <='9':
pass
else:
if s[i] != '?':
if seen.get(s[i], 0) == 0:
res*= (10 - L... | output | 1 | 32,833 | 6 | 65,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,834 | 6 | 65,668 |
Tags: math
Correct Solution:
```
s = str(input())
result = 1
n = len(s)
rozne = set()
pytajniki = 0
mnoznik_z_pierwszego = 1
for i in range(0,n):
if ord(s[i]) >= ord('0') and ord(s[i]) <= ord('9'):
continue;
elif ord(s[i]) >= ord('A') and ord(s[i]) <= ord('Z'):
rozne.add(ord(s[i]))
continue
else:
... | output | 1 | 32,834 | 6 | 65,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,835 | 6 | 65,670 |
Tags: math
Correct Solution:
```
#316A2
hint = input()
possibilities = 1
zeroes = 0
letters = "ABCDEFGHIJ"
if hint[0] in letters:
possibilities *= 9
i = letters.index(hint[0])
letters = letters[:i] + letters[i+1:]
if hint[0] == "?":
possibilities *= 9
hint = hint[1:]
for char in hint:
if char == "?"... | output | 1 | 32,835 | 6 | 65,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,836 | 6 | 65,672 |
Tags: math
Correct Solution:
```
from sys import *
from math import *
s = stdin.readline().strip()
ans = 1
now = 10
was = {}
was['A'] = False
was['B'] = False
was['C'] = False
was['D'] = False
was['E'] = False
was['F'] = False
was['G'] = False
was['H'] = False
was['I'] = False
was['J'] = False
if s[0] == '?':
ans *... | output | 1 | 32,836 | 6 | 65,673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.