description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def main():
s, t = [0] * 123, [0] * 123
for c in input():
s[ord(c)] += 1
for c in input():
t[ord(c)] += 1
yay = whoops = 0
for i, x, y in zip(range(123), s, t):
if x > y:
s[i] = x - y
t[i] = 0
yay += y
else:
s[i] = 0
... | FUNC_DEF ASSIGN VAR VAR BIN_OP LIST NUMBER NUMBER BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBE... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a = A.swapcase()
Al = A + a
numS = [(0) for i in Al]
numT = [(0) for i in Al]
numT_ = [(0) for i in Al]
s = input()
t = input()
t_ = t.swapcase()
yay = 0
whoops = 0
for i in range(len(Al)):
numS[i] = s.count(Al[i])
numT[i] = t.count(Al[i])
numT_[i] += t_.count(Al[i])
yay... | ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CA... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
d = dict()
t = input()
for x in t:
if x in d:
d[x] += 1
else:
d[x] = 1
yay = 0
whoops = 0
mark = [True] * len(s)
i = -1
for x in s:
i += 1
if x in d:
d[x] -= 1
yay += 1
if d[x] == 0:
d.pop(x)
mark[i] = False
i = -1
for x in s:
i... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER EXPR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def count_correct_case():
global dict_s, dict_t
correctCase = 0
for char in dict_s:
if char in dict_t:
yay = min(dict_s[char], dict_t[char])
correctCase += yay
dict_s[char] -= yay
dict_t[char] -= yay
return correctCase
def count_wrong_case():
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER IF VAR STRING FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = set()
sc = set()
t = set()
tc = set()
ms = []
mt = []
for letter in input():
if letter == letter.lower():
s.add(letter)
else:
sc.add(letter.lower())
if letter not in ms:
ms.append(letter)
ms.append(1)
else:
ms[ms.index(letter) + 1] += 1
for letter in input():
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR IF VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
ds = {}
for i in range(len(s)):
key = s[i]
if key in ds:
ds[key] += 1
else:
ds[key] = 1
dt = {}
for i in range(len(t)):
key = t[i]
if key in dt:
dt[key] += 1
else:
dt[key] = 1
y, w = 0, 0
for i in range(len(s)):
if s[i] in dt and dt[s[i... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NU... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
alf = "qwertyuiopasdfghjklzxcvbnm"
ALF = "QWERTYUIOPASDFGHJKLZXCVBNM"
d, di = {}, {}
for i, x in enumerate(alf):
d[x] = ALF[i]
di[ALF[i]] = x
T, res1, res2 = {}, 0, 0
for i, x in enumerate(t):
if T.get(x) == None:
T[x] = 0
T[x] += 1
new = ""
for i, x in enumerate(s):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR DICT DICT FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR DICT NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NONE ASSIGN VAR VAR NUMBER VAR VAR NUMBER AS... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
yay = 0
whoops = 0
message = {}
newspaper = {}
for i in s:
message[i] = message.get(i, 0) + 1
for j in t:
newspaper[j] = newspaper.get(j, 0) + 1
for i in message:
newspaper[i] = newspaper.get(i, 0)
used = min(newspaper[i], message[i])
yay += used
newspaper[i] -= used
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CA... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = list(input())
t = list(input())
cnt = dict()
for ch in t:
if not ch in cnt:
cnt[ch] = 1
else:
cnt[ch] = cnt[ch] + 1
yay = 0
check = [False] * len(s)
for i in range(len(s)):
ch = s[i]
if ch in cnt and cnt[ch] > 0:
cnt[ch] -= 1
check[i] = True
yay += 1
whoops = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def upc(c):
if c >= "a" and c <= "z":
c = chr(ord(c) - ord("a") + ord("A"))
return c
a1, a2 = {}, {}
for i in input():
if i in a1:
a1[i] += 1
else:
a1[i] = 1
for i in input():
if i in a2:
a2[i] += 1
else:
a2[i] = 1
r1, r2 = 0, 0
a3, a4 = {}, {}
for k in ... | FUNC_DEF IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING RETURN VAR ASSIGN VAR VAR DICT DICT FOR VAR FUNC_CALL VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s1 = list(input())
s2 = list(input())
n = len(s1)
d1 = dict()
for i in s1:
try:
d1[i] += 1
except:
d1[i] = 1
d2 = dict()
for i in s2:
try:
d2[i] += 1
except:
d2[i] = 1
for i in d1:
try:
m = min(d1[i], d2[i])
d1[i] -= m
d2[i] -= m
except:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def main():
s = input()
t = input()
arrS = [0] * 70
arrT = [0] * 70
count = 0
count2 = 0
n = len(s)
for x in s:
arrS[ord(x) - 65] += 1
for x in t:
arrT[ord(x) - 65] += 1
for i in range(60):
temp = min(arrS[i], arrT[i])
arrS[i] -= temp
arrT[... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
visit = list()
lis = list()
for i in range(60):
visit.append(0)
yay = 0
whoops = 0
for i in range(len(t)):
visit[ord(t[i]) - ord("a")] += 1
for i in range(len(s)):
if visit[ord(s[i]) - ord("a")] > 0:
yay += 1
visit[ord(s[i]) - ord("a")] -= 1
else:
lis.appe... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_C... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | cnt = [0] * 130
s = input()
t = input()
for x in t:
cnt[ord(x)] += 1
n = len(s)
mark = [True] * n
cnt_Yays = 0
cnt_Whoops = 0
for i in range(n):
x = s[i]
if cnt[ord(x)] > 0:
cnt_Yays += 1
cnt[ord(x)] -= 1
mark[i] = False
for i in range(n):
x = s[i]
if mark[i] == True:
... | ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR F... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | text = input()
letters = input()
d = {}
for ch in letters:
d[ch] = d.get(ch, 0) + 1
a = []
for ch in text:
a.append(False)
yaycount = 0
whoopscount = 0
for i in range(len(text)):
ch = text[i]
if ch in d and d[ch] > 0:
yaycount = yaycount + 1
d[ch] = d[ch] - 1
a[i] = True
for i in... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR BI... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | message = input()
newspaper = input()
a = dict([(i, 0) for i in range(52)])
b = dict([(i, 0) for i in range(52)])
for ch in message:
id = ord(ch) - 65
if ch > "Z":
id = ord(ch) - 97 + 26
if not id in a:
a[id] = 1
else:
a[id] += 1
for ch in newspaper:
id = ord(ch) - 65
if ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | x = input()
y = input()
g1 = {}
g2 = {}
g3 = {}
g4 = {}
for i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
g2[i] = 0
g4[i] = 0
for i in "abcdefghijklmnopqrstuvwxyz":
g1[i] = 0
g3[i] = 0
e = 0
f = 0
u = []
l = []
u2 = []
l2 = []
for i in x:
if i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
u.append(i)
g2[i] ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSI... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | msg = input()
letters = input()
yays = 0
whoops = 0
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
rest = []
leaks = []
i = 0
for l in alphabet:
original = msg.count(l)
journal = letters.count(l)
if journal >= original:
yays += original
journal -= original
if len(r... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | st = input()
d = {}
match = {}
for i in range(26):
d[chr(i + 65)] = 0
d[chr(i + 97)] = 0
match[chr(i + 65)] = chr(i + 97)
match[chr(i + 97)] = chr(i + 65)
for i in input():
d[i] += 1
ans1 = ans2 = 0
remain = ""
for i in st:
if d[i] > 0:
ans1 += 1
d[i] -= 1
else:
remai... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BI... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
a = [0] * 200
b = [0] * 200
for i in range(len(s)):
a[ord(s[i])] += 1
for i in range(len(t)):
b[ord(t[i])] += 1
ans1 = ans2 = 0
for i in range(ord("A"), ord("Z") + 1):
r = min(a[i], b[i]) + min(a[i + 32], b[i + 32])
ans1 += r
ans2 += min(a[i] + a[i + 32], b[i] + b[i + 32]) - ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_C... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | m = {a: (0) for a in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM"}
m1 = {a: (0) for a in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM"}
t, s = input(), input()
for i in range(len(t)):
m[t[i]] += 1
for i in range(len(s)):
m1[s[i]] += 1
ura = 0
opa = 0
for a in "qwertyuiopasdfghjklzxcvbnmQWERTY... | ASSIGN VAR VAR NUMBER VAR STRING ASSIGN VAR VAR NUMBER VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR STRING IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VA... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def process(str):
d = {}
for c in str:
d[c] = d.setdefault(c, 0) + 1
return d
def match(d1, d2, case):
ans = 0
for c in d1:
if case(c) not in d2:
continue
m = min(d1[c], d2[case(c)])
ans += m
d1[c] -= m
d2[case(c)] -= m
return ans
s... | FUNC_DEF ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
scount = []
tcount = []
yay = 0
whoop = 0
for i in range(130):
scount.append(0)
tcount.append(0)
for i in range(len(s)):
scount[ord(s[i])] += 1
for i in range(len(t)):
tcount[ord(t[i])] += 1
for i in range(ord("a"), ord("z") + 1):
lowmin = min(scount[i], tcount[i])
upmin ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s, t = input(), input()
yay, whoops = 0, 0
a, b = {}, {}
for i in s:
a[i] = a.get(i, 0) + 1
for i in t:
b[i] = b.get(i, 0) + 1
for i in a:
if i not in b:
continue
tmp = min(a[i], b[i])
yay += tmp
a[i] -= tmp
b[i] -= tmp
for i in a:
if i.swapcase() not in b:
continue
t... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR DICT DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s1 = input()
s2 = input()
a = [0] * 52
b = [0] * 52
for ch in s1:
if "a" <= ch <= "z":
index = ord(ch) - ord("a")
else:
index = ord(ch) - ord("A") + 26
a[index] += 1
for ch in s2:
if "a" <= ch <= "z":
index = ord(ch) - ord("a")
else:
index = ord(ch) - ord("A") + 26
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR IF STRING VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER VAR VAR NUMBER FOR VAR VAR IF STRIN... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | msg = input()
l = input()
msg = list(msg)
d = {}
y = 0
w = 0
for i in l:
if i not in d:
d[i] = 0
d[i] += 1
for j in range(len(msg)):
i = msg[j]
if i in d and d[i] > 0:
d[i] -= 1
y += 1
msg[j] = chr(30)
for i in msg:
if ord(i) >= 97:
if chr(ord(i) - 32) in d an... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUN... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = list(input())
t = list(input())
count = {}
ans1 = 0
ans2 = 0
for i in range(len(s)):
a = str.lower(s[i])
b = str.upper(s[i])
count[a] = count[b] = 0
for i in range(len(t)):
a = t[i]
count[a] = 0
for i in range(len(t)):
a = t[i]
count[a] += 1
l = []
for i in range(len(s)):
a = s[i]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
n = len(s)
made = [False] * n
d = dict()
for c in t:
if c in d:
d[c] += 1
else:
d[c] = 1
yays = whoops = 0
for i in range(n):
if s[i] in d and d[s[i]] > 0:
d[s[i]] -= 1
yays += 1
made[i] = True
for i in range(n):
if made[i] == False:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input().strip()
t = input().strip()
d = {}
for i in s:
if i in d:
d[i] += 1
else:
d[i] = 1
x1 = 0
x2 = 0
e = [(True) for i in range(len(t))]
for i in range(len(t)):
if t[i] in d and d[t[i]] > 0:
d[t[i]] -= 1
x1 += 1
e[i] = False
t = t.swapcase()
for i in range(len... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VA... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input().strip()
t = input().strip()
count_s = [0] * 100
count_t = [0] * 100
ans1, ans2 = [0, 0]
for i in range(len(t)):
count_t[ord(t[i]) - ord("A")] += 1
for i in range(len(s)):
count_s[ord(s[i]) - ord("A")] += 1
for i in range(58):
Min = min(count_s[i], count_t[i])
count_s[i] -= Min
count_t[i]... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR V... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
s_letters = {}
t_letters = {}
for i in s:
tt = tuple([i.lower()])
if tt not in t_letters:
t_letters[tt] = [0, 0]
if tt not in s_letters:
s_letters[tt] = [0, 0]
if i == i.lower():
s_letters[tt][0] += 1
else:
s_letters[tt][1] += 1
for i in t:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR FUNC_CALL VAR LIST FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER IF VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER IF VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | import sys
sys.setrecursionlimit(100000)
def reverseCase(a):
if ord(a) >= ord("A") and ord(a) <= ord("Z"):
return a.lower()
else:
return a.upper()
def main():
mes = input()
news = input()
M = dict()
n, m = len(mes), len(news)
yay = oops = 0
for i in range(n):
... | IMPORT EXPR FUNC_CALL VAR NUMBER FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBE... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = str(input())
t = str(input())
mapa = {}
yays = 0
whoops = 0
for i in t:
if i in mapa:
mapa[i] += 1
else:
mapa[i] = 1
other = ""
for i in s:
if i in mapa and mapa[i] > 0:
yays += 1
mapa[i] -= 1
else:
other += i
for i in other:
l = i.lower() if i.isupper() e... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUN... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | alth = "abcdefghijklmnopqrstuvwxyz"
alth2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s2 = [([0] * 26) for i in range(2)]
s3 = [([0] * 26) for i in range(2)]
s = input()
t = input()
num = 0
num2 = 0
for i in s:
temp = alth.find(i)
if temp != -1:
s2[0][temp] += 1
temp = alth2.find(i)
if temp != -1:
s2... | ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMB... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | sm = "abcdefghijklmnopqrstuvwxyz"
la = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s1 = input()
s2 = input()
d1 = {}
d2 = {}
ya = wh = 0
for i in s1:
if i in d1:
d1[i] += 1
else:
d1[i] = 1
for i in s2:
if i in d2:
d2[i] += 1
else:
d2[i] = 1
for i in d1:
if i in d2:
t = min(d... | ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | w = "abcdefghijklmnopqrstuvwxyz"
u = str.upper
s, t = {}, {}
a, b = 0, 0
q = input()
e = input()
for i in w + u(w):
s[i] = q.count(i)
t[i] = e.count(i)
p = min(s[i], t[i])
a += p
s[i] -= p
t[i] -= p
for i in w:
b += min(s[i] + s[u(i)], t[i] + t[u(i)])
print(a, b) | ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR DICT DICT ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR FOR VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def invert_case(c):
if c.isupper():
return c.lower()
return c.upper()
letters = {c: (0) for c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}
whoops = 0
yay = 0
message = list(input())
newspaper = list(input())
for c in newspaper:
letters[c] += 1
for i in range(len(message)):
if let... | FUNC_DEF IF FUNC_CALL VAR RETURN FUNC_CALL VAR RETURN FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR NUMB... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
oc = {}
yay = 0
whoops = 0
resto = ""
for l1 in t:
oc[l1] = oc.get(l1, 0) + 1
for l2 in s:
if oc.get(l2, 0) > 0:
oc[l2] -= 1
yay += 1
else:
resto += l2
for l3 in resto:
aux = l3.swapcase()
if oc.get(aux, 0) > 0:
oc[aux] -= 1
whoops += 1... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER NUMBER VAR VAR NUMBER VAR NUMBER VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | a = input()
mapa = {}
per = 0
imp = 0
for i in a:
if i in mapa:
mapa[i] += 1
else:
mapa[i] = 1
b = input()
c = []
for i in b:
if i in mapa:
if mapa[i] != 0:
mapa[i] -= 1
per += 1
c.append(True)
else:
c.append(False)
else:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMB... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s, t = input(), input()
a1, a2 = list(s), list(t)
r1, r2 = 0, 0
for i in range(ord("a"), ord("z") + 1, 1):
l1 = a1.count(chr(i))
l2 = a2.count(chr(i))
u1 = a1.count(chr(i + ord("A") - ord("a")))
u2 = a2.count(chr(i + ord("A") - ord("a")))
c = min(l1, l2) + min(u1, u2)
r1 += c
r2 += min(l2 + ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR F... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
c = -ord("A") + ord("a")
ura = 0
opa = 0
s2 = set()
ind = set()
s1 = dict()
for i in range(len(s)):
if ord(s[i]) not in s2:
s2.add(ord(s[i]))
s1[ord(s[i])] = 1
else:
s1[ord(s[i])] += 1
for i in range(len(t)):
if ord(t[i]) in s2 and s1[ord(t[i])] >= 1:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL V... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | __author__ = "PrimuS"
s = input()
t = input()
sd = {}
td = {}
for x in s:
sd[x] = sd.get(x, 0) + 1
for x in t:
td[x] = td.get(x, 0) + 1
res1 = 0
res2 = 0
for x in sd.keys():
if x not in td:
continue
k = min(sd[x], td[x])
res1 += k
sd[x] -= k
td[x] -= k
for x in sd.keys():
if x.is... | ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR FUNC_CAL... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def solve():
d1 = {}
d2 = {}
yay = 0
whoops = 0
s1 = input()
s2 = input()
for i in s2:
d2[i] = d2.get(i, 0) + 1
for i in s1:
d1[i] = d1.get(i, 0) + 1
for i in range(26):
k = chr(i + 97)
c1 = d1.get(k, 0)
c2 = d2.get(k, 0)
cnt = min(c1, ... | FUNC_DEF ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP ... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | def solve():
d = {}
s = input()
t = input()
n = len(s)
m = len(t)
for i in range(0, 26):
d[chr(ord("a") + i)] = 0
d[chr(ord("A") + i)] = 0
for i in range(0, m):
d[t[i]] += 1
y = 0
w = 0
x = [0] * n
for i in range(0, n):
if d[s[i]] > 0:
... | FUNC_DEF ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR NUMBER FOR VAR FUNC_CALL VAR N... |
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The... | s = input()
t = input()
a = [0] * 26
A = [0] * 26
b = [0] * 26
B = [0] * 26
for i in s:
o = ord(i)
if o >= 97:
a[o - 97] += 1
else:
A[o - 65] += 1
for i in t:
o = ord(i)
if o >= 97:
b[o - 97] += 1
else:
B[o - 65] += 1
ura = 0
opa = 0
for i in range(26):
u1 = 0... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VAR V... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | kk = lambda: map(int, input().split())
ll = lambda: list(kk())
n, k = kk()
su = (k + 1) * k // 2
start = (n - su) // k + 1
if n < su or n > start * (2**k - 1):
print("NO")
exit()
ls = [(start + i) for i in range(k)]
currsum = (start - 1) * k + su
delayed = 0
for i in range(1, k):
ls[i] += delayed
while ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
d = [0] * k
if k == 1:
print("YES")
print(n)
else:
for i in range(k):
d[i] = i + 1
if sum(d) > n:
print("NO")
else:
t = n - sum(d)
if t >= k:
a = t // k
t = t % k
for i in range(k):
d... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR ASSIG... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = [int(i) for i in input().split()]
s = int(k * (k + 1) / 2)
a = []
if k == 1:
print("YES")
print(n)
exit(0)
if n - s < 0:
print("NO")
exit(0)
c = (n - s) // k
r = (n - s) % k
if k == 2 and r == 1 and c == 0 or k == 3 and r == 2 and c == 0:
print("NO")
exit(0)
for i in range(k):
a.a... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VA... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def mp():
return map(int, input().split())
n, k = mp()
a = [i for i in range(1, k + 1)]
s = (1 + k) * k // 2
p = [0] * k
pp = 0
i = 0
while i < k and s < n:
q = (n - s) // (k - i)
if i == 0 or a[i] + q <= 2 * a[i - 1] + pp:
p[i] = q
pp += q
s += q * (k - i)
i += 1
if s == n:
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
y = pow(2, k)
y = y - 1
x = 0
if n % y == 0:
x = n // y
else:
x = n // y + 1
if (x + k) * (x + k - 1) / 2 - x * (x - 1) / 2 > n:
print("NO")
else:
a = x
n -= x
b = []
c = 0
b.insert(c, a)
c = c + 1
print("YES")
for i in range(1, k):
y ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER BIN_OP BIN_OP ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = list(map(int, input().split()))
if n < k * (k + 1) / 2:
print("NO")
exit(0)
dif = n - k * (k + 1) // 2
a = [(i + 1 + dif // k) for i in range(k)]
dif %= k
if dif == 0:
print("YES")
print(*a)
exit(0)
if a[-1] + dif > 2 * a[-2]:
if k == 2:
print("NO")
exit(0)
if a[-2] ==... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR VAR FUNC_CALL VAR VAR VAR VAR I... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def solve(n, k):
r = n - k * (k + 1) // 2
if r < 0:
return None
b0 = r // k
r -= b0 * k
seq = [None] * k
seq[0] = b0
b = b0
for i in range(1, k):
bn = b * 2 + i - 1
h = r // (k - i)
if h > 0:
if h + b > bn:
h = bn - b
... | FUNC_DEF ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER RETURN NONE ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP V... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
m = k * (k + 1) // 2
if n >= m:
a = []
a.append(0)
rem = n - m
t = rem // k
for i in range(1, k + 1):
a.append(i + t)
rem = rem % k
if t == 0:
if k == 1:
print("YES")
print(n)
elif k == 2:
if n % 2 !... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR V... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = [int(i) for i in input().split()]
def ok(a):
print("YES")
print(*a)
if k * (k + 1) // 2 > n:
print("NO")
else:
v = (n - k * (k + 1) // 2) // k
a = [(v + i) for i in range(1, k + 1)]
if v == 0:
if k == 2:
if sum(a) != n:
print("NO")
else:... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBE... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
max_x = (n - k * (k - 1) // 2) / k
if max_x < 1:
print("NO")
exit(0)
x = int(max_x)
r = n - (k * x + k * (k - 1) // 2)
A = [(x + i) for i in range(k)]
p = r + 1
while r > 0 and r != p:
p = r
for i in range(k - 1, 0, -1):
q = min(r, 2 * A[i - 1] - A[i])
r ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIG... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
mn = k * (k + 1) // 2
if n < mn:
print("NO")
elif k == 2 and n == 4 or k == 3 and n == 8:
print("NO")
else:
print("YES")
t = (n - mn) // k + 1
ans = [t]
tot = t
for i in range(k - 1):
ans.append(ans[-1] + 1)
tot += ans[-1]
rem = n - tot
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR LIST VAR AS... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | input_ = input().split(" ")
n = int(input_[0])
k = int(input_[1])
last = 0
output = ""
if n < (k + 1) * k / 2 or k == 3 and n == 8 or k == 2 and n == 4:
print("NO")
elif k == 2 and n == 3:
print("YES")
print("1 2")
elif k == 3 and n == 7:
print("YES")
print("1 2 4")
elif k <= 20001:
for i in ran... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING IF VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
n, k = map(int, input().split())
if k * (k + 1) > n * 2:
print("NO")
elif k * (k + 1) == n * 2:
print("YES")
for i in range(1, k + 1):
print(i, end=" ")
elif k == 1:
print("YES")
print(n)
else:
list1 = [n // k] * k
list1[k - 1] += n % k
if k == 2 and n % 2 != 0:
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR STRING IF VAR NUMBER EXPR FUNC_CAL... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | m, n = map(int, input().split())
a = [0] * n
d = 0
for i in range(n):
a[i] += i + 1
if sum(a) > m:
d = 1
for i in range(n):
a[i] += (m - (n + 1) * n // 2) // n
k = n - 1
if d == 0:
while sum(a) < m:
if m - sum(a) >= a[k - 1] * 2 - a[k]:
a[k] += a[k - 1] * 2 - a[k]
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR ASSIGN VAR BIN_OP... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def solve(n, k):
if (k + 1) * k // 2 > n:
return ""
if k == 1:
return str(n)
if k == 2:
if n % 2:
return "%d %d" % (n // 2, n // 2 + 1)
else:
if n <= 4:
return ""
return "%d %d" % (n // 2 - 2, n // 2 + 2)
s = (k + 1) * k... | FUNC_DEF IF BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR RETURN STRING IF VAR NUMBER RETURN FUNC_CALL VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER RETURN BIN_OP STRING BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR NUMBER RETURN STRING RETURN BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUM... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | rint = lambda: int(input())
rmint = lambda: map(int, input().split())
rlist = lambda: list(rmint())
n, k = rmint()
t = k
a = [0] * k
def no():
print("NO")
exit(0)
d = [-1] * (k + 1)
d[0] = 1
mx = 10**9
for i in range(1, k + 1):
if d[i - 1] * 2 > mx:
break
d[i] = d[i - 1] * 2
for i in range(k... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER AS... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
base = k * (k + 1) // 2
if n < base:
print("NO")
exit(0)
l = [(i + 1 + (n - base) // k) for i in range(k)]
rem = (n - base) % k
if (n - base) // k == 0 and rem != 0 and rem == k - 1:
if k in (2, 3):
print("NO")
exit(0)
else:
l[-1] += 2
for... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF BIN_OP BIN_OP VAR VAR ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def top(d, f, tot):
zero = f * (k - d) + (k - d) * (k - d - 1) // 2
return tot - zero
n, k = map(int, input().split())
a = []
if n < k * (k + 1) // 2:
print("NO")
elif k == 1:
print("YES")
print(n)
else:
const = 0
if n > 2**k - 1:
const = (n - k * (k + 1) // 2) // k
n -= co... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VA... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | _ = input().split()
n = int(_[0])
k = int(_[1])
def lower(k, i):
return k * i + int(k * (k - 1) / 2)
def _max(k, i):
return i * (pow(2, k) - 1)
if n < lower(k, 1):
print("NO")
else:
i = int((n - int(k * (k - 1) / 2)) / k) - 1
while lower(k, i) <= n:
i = i + 1
i = i - 1
if _max(... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF RETURN BIN_OP VAR BIN_OP FUNC_CALL VAR NUMBER VAR NUMBER IF VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR S... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | N, K = list(map(int, input().split()))
a = K * (K + 1) // 2
if a > N:
print("NO")
else:
b = (N - a) // K
c = N - a - b * K
r = []
for i in range(K):
r.append(i + 1 + b + (1 if i + c >= K else 0))
for i in range(K - 2):
if r[i] * 2 < r[i + 1]:
r[K - 1] += r[i + 1] - r[... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_O... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = [int(s) for s in input().split()]
if n < k * (k + 1) / 2:
print("NO")
exit()
if k == 3 and n == 8 or k == 2 and (n < 3 or n == 4):
print("NO")
exit()
print("YES")
if k == 1:
print(n)
elif k == 2:
print((n + 2) // 3, n - (n + 2) // 3)
else:
i = 1
while i * k + k * (k - 1) // 2 <= n... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VA... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
x = k * (k + 1) // 2
y, s = 0, 0
a = []
if n < x:
print("NO")
quit()
y = (n - x) // k
s = x + k * y
a = [(i + y) for i in range(1, k + 1)]
x = n - s
for i in range(k - 1, 0, -1):
if x <= a[i - 1] * 2 - a[i]:
a[i] += x
x = 0
break
else:
x -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR LIST IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
class Main:
def __init__(self):
self.buff = None
self.index = 0
def __next__(self):
if self.buff is None or self.index == len(self.buff):
self.buff = self.next_line()
self.index = 0
val = self.buff[self.index]
self.index += 1
... | IMPORT CLASS_DEF FUNC_DEF ASSIGN VAR NONE ASSIGN VAR NUMBER FUNC_DEF IF VAR NONE VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
input = sys.stdin.readline
def main():
n, k = map(int, input().split())
if n < k or k * (k + 1) // 2 > n:
print("NO")
return
if k == 1:
print("YES")
print(n)
return
d = n - k * (k + 1) // 2
ans = [(i + d // k) for i in range(1, k + 1)]
ans[-1... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR STRING RETURN IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
def check(s, st, n):
sum = (st * 2 + (n - 1)) * n // 2
return s >= sum
m, n = list(map(int, input().split()))
a = [0] * n
last = 0
for i in range(n):
le = last + 1
if i == 0:
ri = m + 1
else:
ri = last * 2 + 1
while ri - le > 1:
mid = (le + ri) // 2
... | IMPORT FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER RETURN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
if n < k * (k + 1) / 2:
print("NO")
else:
ar = [(i + 1) for i in range(k)]
n -= k * (k + 1) // 2
c = n // k
s = n % k
for i in range(k):
ar[i] += c
j = k - 1
while s > 0:
ar[j] += ar[j - 1] - 1
s -= ar[j - 1] - 1
if s < 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
n, k = tuple(map(int, input().split()))
if n == 1 == k:
print("YES")
print(1)
sys.exit(0)
sum_s = sum(i + 1 for i in range(k))
if sum_s > n:
print("NO")
sys.exit(0)
r = (n - sum_s) // k
ost = (n - sum_s) % k
if r == 0 and ost == k - 1:
if n == 4 or n == 8:
print("NO")
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
input = sys.stdin.readline
n, k = map(int, input().split())
s = k * (k + 1) // 2
if n < s:
ans = "NO"
else:
j = (n - s) // k
a = [(i + j) for i in range(1, k + 1)]
ans = "NO"
x = a[0]
c = 0
for _ in range(k):
c += x
x *= 2
if n <= c:
ans = "YES... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR N... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
input = sys.stdin.readline
n, k = map(int, input().split())
ANS = list(range(1, k + 1))
ANS.append(10**9)
SUM = k * (k + 1) // 2
PLUS = 0
for i in range(k):
if n < SUM:
print("NO")
sys.exit()
y = 2 * ANS[i - 1] - ANS[i]
x = min((n - SUM) // (k - i), y - PLUS)
SUM += x * (k - ... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EX... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
n, k = map(int, input().split())
min_cnt = k * (k + 1) // 2
if n < min_cnt:
print("NO")
sys.exit()
t = (n - min_cnt) // k
assert t >= 0
delta = n - (min_cnt + k * t)
a = [(i + t) for i in range(1, k + 1)]
pos = k - 1
while delta > 0:
if pos == 0:
print("NO")
sys.exit()
assert... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def get_tail(k):
return k * (k - 1) // 2
def find_starter(n, k):
f = get_tail(k)
starter = (n - f) // k
return starter
def answerYES(A):
return "YES\n" + " ".join(map(str, A))
def get_array(n, k):
starter = find_starter(n, k)
if starter < 1:
return "NO"
A = [0] * k
s = ... | FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FUNC_DEF RETURN BIN_OP STRING FUNC_CALL STRING FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER RETURN STRING ASSIGN VAR BIN_OP LIST NUMBER VAR AS... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | x, y = map(int, input().split())
if x == 8 and y == 3:
print("NO")
exit()
if x == 4 and y == 2:
print("NO")
exit()
z = []
leftover = 0
day = 0
mini = y * (y + 1) // 2
if mini > x:
print("NO")
exit()
elif mini == x:
for i in range(y):
z.append(i + 1)
else:
leftover = x - mini
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR F... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = [int(x) for x in input().split()]
a = [i for i in range(1, k + 1)]
s = k * (k + 1) // 2
p = 0
if n == s:
p = 0
elif n > s:
if n - s == k:
p = 0
for i in range(k):
a[i] += 1
elif n - s > k:
d = (n - s) // k
for i in range(k):
a[i] += d
p ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF BIN_O... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def solve():
n, k = map(int, input().split())
Ans = list(range(1, k + 1))
s = k * (k + 1) // 2
if n < s:
print("NO")
return
add = (n - s) // k
Ans = list(range(1 + add, k + 1 + add))
add = (n - s) % k
i = k - 1
while i and add:
x = min(2 * Ans[i - 1] - Ans[i],... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER VA... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | import sys
n, k = map(int, input().split())
a = [0] * (k + 2)
if k * (k + 1) > n * 2:
print("NO")
sys.exit()
for i in range(1, k + 1):
a[i] = i
n -= k * (k + 1) // 2
rest = n // k
n -= rest * k
a[1] += rest
for i in range(2, k + 1):
a[i] = a[i - 1] + 1
rest = n // (k - i + 1)
tmp = min(rest, a[... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def check(a):
for x, y in zip(a[:-1], a[1:]):
if x >= y or y > 2 * x:
return False
return True
def solve(n, k):
if n < k * (k + 1) // 2:
return "NO", None
ans = list(range(1, k + 1))
plus = n - sum(ans)
add = plus // k
r = plus % k
for i in range(k):
... | FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR BIN_OP NUMBER VAR RETURN NUMBER RETURN NUMBER FUNC_DEF IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER RETURN STRING NONE ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VA... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def check(n, k, fl, fr):
if n < k * (2 * fl + k - 1) // 2:
return 1
if k <= 32 and n > fr * (2**k - 1):
return -1
return 0
def main():
n, k = map(int, input().split(" "))
l, r = 1, n
ans = []
while k > 0:
ll, rr = l, r
cnt = -1
while rr >= ll:
... | FUNC_DEF IF VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER NUMBER RETURN NUMBER IF VAR NUMBER VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER VAR ASSIGN VAR LIST WHILE VAR NUMBER A... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = map(int, input().split())
s = k * (k + 1) // 2
a = []
if k == 1:
print("YES")
print(n)
exit()
if n - s < 0:
print("NO")
exit()
c = (n - s) // k
r = (n - s) % k
if k == 2 and r == 1 and c == 0 or k == 3 and r == 2 and c == 0:
print("NO")
exit(0)
for i in range(k):
if i < k - r:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSI... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | def main():
n, k = map(int, input().split())
if n < k * (k + 1) // 2:
print("NO")
else:
add = (n - k * (k + 1) // 2) // k
res = [(x + add) for x in range(1, k + 1)]
left = n - sum(res)
added = True
while left > 0 and added:
added = False
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL V... |
Polycarp has to solve exactly $n$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $k$ days. It means that Polycarp has exactly $k$ days for training!
Polycarp doesn't want to procrastinate, so he wants ... | n, k = list(map(int, input().split()))
mi = k * (k + 1) // 2
mx = 2 ** (k - 1)
if n < mi:
print("NO")
else:
ans = []
for i in range(1, k + 1):
ans.append(i)
remain = n - mi
add = remain // k
if add:
for i in range(k):
ans[i] += add
remain -= k * add
while ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASS... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | def main():
n = int(input())
out = ""
for t in range(n):
knights = [(0) for i in range(16)]
valid = [(False) for i in range(16)]
for i in range(8):
line = input()
for j in range(8):
if line[j] != "#":
valid[get(i, j)] = True... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER I... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | def check():
board = []
for cont in range(0, 8):
board.append(input())
l = True
for cont in range(0, 8):
for cont2 in range(0, 8):
if board[cont][cont2] == "K":
if l:
xk1 = cont2
yk1 = cont
l = False
... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR STRING IF VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER ... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | def solve(m, x, y, w, z):
for i in range(8):
for j in range(8):
if m[i][j]:
a, pa = movePossible(x, y, i, j)
b, pb = movePossible(w, z, i, j)
if a and b and pa == pb:
return True
return False
def movePossible(x, y, w, z):
... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR ... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | t = int(input())
for _ in range(t):
if _:
input()
knights = []
for i in range(8):
s = input().strip()
for j in range(8):
if s[j] == "K":
knights.append((i, j))
n1 = knights[0]
n2 = knights[1]
if n1[0] % 4 == n2[0] % 4 and n1[1] % 4 == n2[1] % 4... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER BIN... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | def f():
t = []
for i in range(8):
p = input()
for j in range(8):
if p[j] == "K":
t += [i, j]
if t[2] - t[0] in (0, 4) and t[1] - t[3] in (-4, 0, 4):
return "YES"
return "NO"
for i in range(int(input()) - 1):
print(f())
input()
print(f()) | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING VAR LIST VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER NUMBER RETURN STRING RETURN STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL ... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | t = int(input())
for _ in range(t):
s = [input() for i in range(8)]
oh = True
flag = True
for i in range(8):
for j in range(8):
if s[i][j] == "K":
if flag:
pos1x = i
pos1y = j
flag = False
els... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING IF VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF B... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | t = int(input())
el = [
[1, 2, 3, 4, 1, 2, 3, 4],
[5, 6, 7, 8, 5, 6, 7, 8],
[9, 10, 11, 12, 9, 10, 11, 12],
[13, 14, 15, 16, 13, 14, 15, 16],
[1, 2, 3, 4, 1, 2, 3, 4],
[5, 6, 7, 8, 5, 6, 7, 8],
[9, 10, 11, 12, 9, 10, 11, 12],
[13, 14, 15, 16, 13, 14, 15, 16],
]
for x in range(t):
arr... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NU... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | t = int(input())
while t:
t += -1
l = []
mp = []
for i in range(8):
tmp = list(input())
l.append(tmp)
mp.append([0] * 8)
i1, j1, i2, j2 = -1, -1, -1, -1
for i in range(8):
for j in range(8):
if l[i][j] == "K" and i1 == -1:
i1, j1 = i, j... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | a = []
def first(i, j):
nonlocal a
a[i][j] = 1
if i - 2 >= 0 and j + 2 < 8:
a[i - 2][j + 2] = 1
if i - 2 >= 0 and j - 2 >= 0:
a[i - 2][j - 2] = 1
if i + 2 < 8 and j + 2 < 8:
a[i + 2][j + 2] = 1
if i + 2 < 8 and j - 2 >= 0:
a[i + 2][j - 2] = 1
def second(i, j):... | ASSIGN VAR LIST FUNC_DEF ASSIGN VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER AS... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | def check(x, y):
return 0 <= x < 8 and 0 <= y < 8
def dfs1(x, y, T=0):
nonlocal first, used
if not check(x, y) or used[x][y]:
return
used[x][y] = True
first.add((x, y, T))
for pair in ((2, 2), (2, -2), (-2, 2), (-2, -2)):
dfs1(x + pair[0], y + pair[1], 1 - T)
def dfs2(x, y, T... | FUNC_DEF RETURN NUMBER VAR NUMBER NUMBER VAR NUMBER FUNC_DEF NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR VAR RETURN ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR FOR VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP NUMBER VAR FUNC_D... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | for i in range(int(input())):
if i:
input()
ans = []
for i in range(8):
s = input()
for j in range(8):
if s[j] == "K":
ans.append((i, j))
print(
["NO", "YES"][
abs(ans[0][0] - ans[1][0]) % 4 == 0 and abs(ans[0][1] - ans[1][1]) % 4 =... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR LIST STRING STRING BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBE... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | t = int(input())
for _ in range(t):
if _ != 0:
tmp = input()
pos = []
n = 8
g = []
for i in range(n):
g.append([i for i in input()])
for i in range(n):
for j in range(n):
if g[i][j] == "K":
pos.append((i, j))
ok = False
for i in range(n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR VA... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | n = int(input())
for t in range(n):
if t:
input()
board = [[c for c in input()] for i in range(8)]
k1, k2 = ((i, j) for i in range(8) for j in range(8) if board[i][j] == "K")
if (k1[0] - k2[0]) % 4 == 0 and (k1[1] - k2[1]) % 4 == 0:
print("YES")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR VAR VAR STRING IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER V... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | T = int(input())
for t in range(T):
L = []
for i in range(8):
L.append(input())
Moves1 = []
Moves2 = []
K = []
for i in range(8):
Moves1.append([-1] * 8)
Moves2.append([-1] * 8)
for j in range(8):
if L[i][j] == "K":
K.append((i, j))
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER FOR VAR FU... |
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | n = int(input())
for i in range(n):
if i:
input()
x1 = y1 = x2 = y2 = 0
s = [input() for i in range(8)]
for i in range(8):
for j in range(8):
if s[i][j] == "K":
x1, y1, x2, y2 = x2, y2, i, j
if abs(x1 - x2) % 4 == 0 and abs(y1 - y2) % 4 == 0:
print... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.