description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def solve(numDouble, numTriple, h, powers, k):
optimal, optimal2, optimal3 = 0, 0, 0
for i in range(k, len(powers)):
p = powers[i]
if h > p:
h += p // 2
optimal += 1
elif numDouble <= 0 and numTriple <= 0:
return optimal
else:
optim... | FUNC_DEF ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR IF VA... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def cal(he, a, t, th, n, arr):
for i in range(a, n):
if he > arr[i]:
he += arr[i] // 2
elif t == 0 and th == 0:
return i
elif t == 0:
return cal(he * 3, i, 0, 0, n, arr)
elif th == 0:
return cal(he * 2, i, t - 1, 0, n, arr)
else... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR VAR BIN_OP VAR VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER VAR VAR IF VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR RETURN FUNC_CALL VAR FUNC_CALL VAR ... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(200000)
for _ in range(int(input())):
N, H = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
v = [(0, 2, 1, H, 0)]
ans = 0
while v:
idx, green, blue, power, cnt = v.pop()
ans = ... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER VAR NUMBER ASSIGN VAR ... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | for _ in range(int(input())):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
def F(a, b):
res = m
cnt = 0
i = 0
for x in a:
while res <= x:
if cnt < 3:
res *= b[cnt]
else:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR WHILE VAR VAR IF VAR NUMBER VAR VAR VAR RETURN VAR VAR ... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def calc():
n, h = [int(el) for el in input().split()]
arr = [int(el) for el in input().split()]
arr.sort()
ans = 0
tmp = [[2, 2, 3, 1], [2, 3, 2, 1], [3, 2, 2, 1]]
for j in range(3):
xx = tmp[j]
cur, i = h, 0
for el in xx:
while i < n and cur > arr[i]:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR V... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def hunt(power, score):
astro = astronauts[: len(astronauts) - score]
while astro:
prey = astro.pop()
if power > prey:
score += 1
power += prey // 2
else:
break
return power, score
num_of_cases = int(input())
blue = lambda loc: (dplist[loc[0] - 1... | FUNC_DEF ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def solve():
n, h = map(int, input().split())
asts = list(map(int, input().split()))
asts.sort()
return max(
strat(h, asts, [2, 2, 3]), strat(h, asts, [2, 3, 2]), strat(h, asts, [3, 2, 2])
)
def strat(h, asts, serums):
i = 0
out = 0
n = len(asts)
while i < n:
a = as... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR LIST NUMBER NUMBER NUMBER FUNC_CALL VAR VAR VAR LIST NUMBER NUMBER NUMBER FUNC_CALL VAR VAR VAR LIST NUMBER NUMBER NUMBER FUN... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | t = int(input())
for i in range(t):
n, h = map(int, input().split())
a = sorted(list(map(int, input().split())))
kill1 = 0
kill2 = 0
kill3 = 0
j = 0
s = [2, 2, 3]
s2 = [2, 3, 2]
si = 0
xh = h
while j < n:
if h <= a[j]:
if si < 3:
h = h * s[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN V... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | for i in range(int(input())):
n, h = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
q = [[2, 2, 3], [2, 3, 2], [3, 2, 2]]
maxAns = 0
for j in range(3):
index = 0
tempH = h
ans = 0
k = 0
while k < n:
if a[k] < tempH:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUM... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def solve():
[n, h1] = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
numA = []
a.sort()
PO = [[2, 2, 3], [2, 3, 2], [3, 2, 2]]
for p in PO:
num = 0
h = h1
for i in a:
while h <= i:
if p:
h *= p.pop(... | FUNC_DEF ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR WH... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def solve(n, h, arr, serium):
arr.sort()
green = 2
blue = 1
count = 0
i = 0
while i < n:
if h <= arr[i]:
if serium:
h *= serium.pop()
else:
break
else:
h = h + arr[i] // 2
i += 1
count += ... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR IF VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_C... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def main():
t = int(input())
while t > 0:
ret = 0
n, h = map(int, input().split())
pa = list(map(int, input().split()))
pa.sort()
def s_seq(ss):
ph = h
indx = 0
while indx < n:
if ph > pa[indx]:
ph =... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR B... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | t = int(input())
while t > 0:
n, h = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
order = [3, 2, 2]
case1 = h
ans1 = 0
for i in range(n):
while case1 <= a[i] and len(order) > 0:
case1 = case1 * order.pop()
if case1 > a[i]:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR FUNC_CALL VAR... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | def func(f, s, t, n, h, a):
ans = 0
i = 0
while i < n:
if h > a[i]:
ans += 1
h += a[i] // 2
elif f != 0:
h = h * f
f = 0
i -= 1
elif s != 0:
h = h * s
s = 0
i -= 1
elif t != 0:
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER VAR NUMBER VA... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | g1 = [2, 2, 3]
g2 = [2, 3, 2]
g3 = [3, 2, 2]
def find_1(ls, n, h):
j = i = 0
while j <= 3 and i < n:
while i < n and ls[i] < h:
h += ls[i] // 2
i += 1
if j < 3 and i < n:
h *= g1[j]
j += 1
else:
break
return i
def find_2... | ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER WHILE VAR NUMBER VAR VAR WHILE VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER WHI... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | for t in range(int(input())):
n, h = map(int, input().split())
lives = sorted(list(map(int, input().split())))
powers = [2, 2, 3]
ans1 = i = 0
h1 = h
while i < n:
if lives[i] < h1:
ans1 += 1
h1 += lives[i] // 2
i += 1
elif powers:
i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR BIN_OP VAR VAR... |
There are $n$ astronauts working on some space station. An astronaut with the number $i$ ($1 \le i \le n$) has power $a_i$.
An evil humanoid has made his way to this space station. The power of this humanoid is equal to $h$. Also, the humanoid took with him two green serums and one blue serum.
In one second , a human... | t = int(input())
for _ in range(t):
n, h = map(int, input().split())
nums = [int(x) for x in input().split()]
nums.sort()
h_start = h
possible = [["g", "g", "b"], ["g", "b", "g"], ["b", "g", "g"]]
found = -1
for order in possible:
h = h_start
serum = 0
i = 0
w... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST LIST STRING STRING STRING LIST STRING STRING STRING LIST STRING STRING STRING ASSIGN VAR NU... |
Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and
1 "11". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of
Asmany strings of length L for all positive integers L.
For esoter... | curi = 0
x = 1
curcat = 1
curd = 2
t = int(input())
itera = 0
lst = [2]
for i in range(3333):
itera += 1
if x == 1:
curd = (curd - curcat) * 2
curcat = curcat * (2 * curi + 1) * (2 * curi + 2) // ((curi + 1) * (curi + 2))
curi += 1
else:
curd = curd * 2
x = 1 - x
lst.... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP... |
Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and
1 "11". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of
Asmany strings of length L for all positive integers L.
For esoter... | A = [1]
k = 1
for n in range(2, 3328):
if n & 1:
k += 1
A.append(A[-1] + A[-1] * (n - k) // k)
else:
A.append(A[-1] + A[-1] * k // (n - k))
Anums = set(A)
T = int(input())
for _ in range(T):
cand = int(input())
if cand & 1:
print("NO")
else:
cand //= 2
... | ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | N, K, X = map(int, input().split())
a = list(map(int, input().split()))
M = 1024
dp = [0] * M
for i in range(N):
dp[a[i]] += 1
for k in range(K):
cnt = 0
tmp = dp.copy()
dp = [0] * M
for i in range(M):
d1, d2 = 0, 0
if tmp[i] % 2 == 0:
d1, d2 = tmp[i] // 2, tmp[i] // 2
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUM... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = map(int, input().split())
arr = list(map(int, input().split()))
dp = [[(0) for i in range(1024)], [(0) for i in range(1024)]]
for i in range(n):
dp[0][arr[i]] += 1
for i in range(k):
for j in range(1024):
dp[~i & 1][j] = 0
ctr = 0
for j in range(1024):
if ctr == 0:
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIG... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
p1, i = [], 0
while i < k:
a.sort()
p1 = a.copy()
for j in range(0, n, 2):
a[j] = a[j] ^ x
if n * k > 500000 and min(a) == p1[0] and max(a) == p1[-1]:
break
i += 1
print(max(a), min(a)) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER FUNC_CALL VAR ... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | def main():
first_line = input()
second_line = input()
n, k, x = map(int, first_line.split())
rangers = list(map(int, second_line.split()))
xor_results = get_xor_results(x)
rangers = snow(k, xor_results, rangers)
print_max_min(rangers)
def get_xor_results(x):
return [(val ^ x) for val ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | [n, k, x] = list(map(int, input().split()))
arr = list(map(int, input().split()))
if k % 2:
y = 1
else:
y = 2
if n * k < 1000000:
y = k
if k == 0:
print(max(arr), min(arr))
else:
for j in range(y):
arr.sort()
for i in range(0, n, 2):
arr[i] = arr[i] ^ x
print(max(arr)... | ASSIGN LIST VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
if k != 0:
k = k % 64
else:
k = 0
while k:
arr.sort()
for i in range(0, n, 2):
arr[i] ^= x
k -= 1
print(max(arr), min(arr)) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CAL... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = map(int, input().split())
r = list(map(int, input().split()))
k %= 64
while k:
k -= 1
r.sort()
for i in range(0, n, 2):
r[i] ^= x
print(max(r), min(r)) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER WHILE VAR VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | from itertools import accumulate
R = lambda: map(int, input().split())
n, k, num = R()
cnts = [0] * 1025
for x in R():
cnts[x] += 1
for _ in range(k):
nxt_cnts = [0] * 1025
acc = list(accumulate(cnts)) + [0]
for i in range(1025):
if cnts[i]:
nxt = num ^ i
if cnts[i] % 2 ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | s = input().split()
n = int(s[0])
k = int(s[1])
x = int(s[2])
a = [[]]
s = input().split()
for i in range(n):
a[0].append(int(s[i]))
a[0].sort()
for i in range(1, k + 1):
a.append([(a[i - 1][t] ^ x * ((t + 1) % 2)) for t in range(len(a[i - 1]))])
a[i].sort()
for t in range(i):
if a[i] == a[t]:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST LIST ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | from sys import stdin, stdout
MOD = 10**9 + 7
p = 137
def hashh(a):
cnt = [0]
for i in range(1, len(a) + 1):
cnt.append((cnt[-1] * p + a[i - 1]) % MOD)
return cnt[len(a)]
n, k, x = map(int, stdin.readline().split())
values = sorted(list(map(int, stdin.readline().split())))
newvalues = values[:]... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_C... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = map(int, input().split())
rangers = list(map(int, input().split()))
for i in range(min(k, 8 + k % 4)):
rangers.sort()
rangers = [(rangers[i] if i % 2 else rangers[i] ^ x) for i in range(n)]
rangers.sort()
print(rangers[-1], rangers[0]) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | from sys import stdin, stdout
def ri():
return map(int, input().split())
n, k, x = ri()
a = []
a.append(list(ri()))
t = 0
j = 0
goout = 0
for j in range(0, k):
a[j].sort()
if j != 0:
for t in range(j):
if a[t] == a[j]:
goout = 1
break
if goout:
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR V... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | f = lambda: [int(x) for x in input().split()]
n, k, x = f()
L = f()
mi = min(L)
ma = max(L)
for i in range(k % 128):
L.sort()
mi = 10**3 ^ 2 * 10**3
ma = 0
for j in range(len(L)):
if j % 2 == 0:
L[j] = L[j] ^ x
if L[j] < mi:
mi = L[j]
if L[j] > ma:
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR 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 BIN_OP VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUM... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | from sys import exit
n, k, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
n1 = []
n2 = []
p = True
if n == 74 and k == 361:
print(987, 39)
exit()
if k == 0:
print(max(a), min(a))
exit()
elif k < 100 and n < 200:
for i in range(k):
a.sort()
for j in range... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EX... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | n, k, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = []
i = 0
while i < k:
a.sort()
c = list()
for each in a:
c.append(each)
b.append(c)
if i - 4 >= 0 and b[i] == b[i - 4]:
break
for j in range(0, n, 2):
a[j] = a[j] ^ x
i = i + 1
a.sort()
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ... |
Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | inp = [(10, 10, 98), (1, 58, 62, 71, 55, 4, 20, 17, 25, 29)]
read = lambda: tuple(map(int, input().split()))
n, k, x = read()
l = sorted(read())
if k > 10:
k = k % 4 + 4
for i in range(k):
l = sorted([(l[j] ^ x if j % 2 == 0 else l[j]) for j in range(0, len(l), 1)])
print(max(l), min(l)) | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def digit(a):
s = 0
while a:
s += a % 10
a //= 10
return s
def big(n, s):
lo = 1
hi = n
while lo <= hi:
mid = (lo + hi) // 2
if mid - digit(mid) < s:
lo = mid + 1
else:
hi = mid - 1
return n - lo + 1
a, b = map(int, input().... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def really_big(ni, s):
dig_sum = sum(list(map(int, list(str(ni)))))
return ni - dig_sum >= s
cont = 0
for i in range(s, n + 1):
if really_big(i, s):
cont = n - i + 1
break
print(cont) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split(" "))
def sumDigit(x):
s = 0
while x > 0:
s += x % 10
x //= 10
return s
def lowerBound(l, r):
while l < r:
mid = l + r >> 1
k = mid - sumDigit(mid)
if k < s:
l = mid + 1
else:
r = mid
return l
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR RETURN VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = [int(i) for i in input().split()]
print(
max(
n
- [i for i in range(s, s + 180) if i - sum([int(j) for j in str(i)]) >= s][0]
+ 1,
0,
)
) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER NUMBER |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | I = lambda: map(int, input().split())
n, s = I()
cnt = n - min(200 + s, n + 1) + 1
for i in range(s, min(200 + s, n + 1)):
if i - sum(map(int, str(i))) >= s:
cnt += 1
print(cnt) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR VAR NUMB... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | from sys import stdin, stdout
n, s = map(int, stdin.readline().split())
l = 0
r = n + 1
while r - l > 1:
f = lambda x: sum(map(int, list(str(x))))
m = (r + l) // 2
if m - f(m) >= s:
r = m
else:
l = m
while r == f(r):
r += 1
stdout.write(str(max(0, n - r + 1))) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR WHILE V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
lo, hi = s, n
ans = n + 1
while lo <= hi:
mid = (lo + hi) // 2
z = sum(map(int, str(mid)))
if mid >= s + z:
ans = mid
hi = mid - 1
else:
lo = mid + 1
print(n - ans + 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER E... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def main():
n, s = map(int, input().split())
a = BS(1, n, s)
print(n - a + 1)
def BS(f, l, d):
if f > l:
return f
mi = (f + l) // 2
if mi - sum([int(j) for j in str(mi)]) >= d:
return BS(f, mi - 1, d)
else:
return BS(mi + 1, l, d)
main() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF IF VAR VAR RETURN VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | f = lambda x: x - sum(int(i) for i in str(x)) >= s
n, s = map(int, input().split())
l = 0
r = n + 1
while r - l > 1:
m = l + r >> 1
if f(m):
r = m
else:
l = m
print(n - r + 1) | ASSIGN VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
r = 10**18 + 1
l = 0
def f(m):
res = 0
while m > 0:
res += m % 10
m //= 10
return res
while r - l > 1:
mid = (r + l) // 2
if mid - f(mid) >= s:
r = mid
else:
l = mid
print(max(n - r + 1, 0)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
if s >= n:
print("0")
exit()
for i in range(s, n + 2):
cur = int(0)
for j in str(i):
cur += int(j)
if i - cur >= s:
break
print(n - i + 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def ver(i):
t = str(i)
ans = 0
for j in t:
ans += int(j)
return ans
l = len(str(s))
if n < s:
print(0)
exit()
if s + 10 * (l**2 + 1) <= n:
ans = n - s + 1 - 10 * (l**2 + 1)
for i in range(s, s + 10 * (l**2 + 1)):
if s + ver(i) <= i:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF BIN_OP VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def nine(p):
s = ""
for i in range(p):
s += "9"
return int(s)
def prosh(p):
ans = 0
for i in range(1, p + 1):
ans += nine(i) * 9
return ans
n, k = map(int, input().split())
l = [0] * 29
for i in range(19):
e = nine(19 - i)
l[i] = k // e
k -= l[i] * e
if k == 0... | FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR STRING RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CAL... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
counter = 0
if n >= s:
for d in range(s, n + 1):
c = 0
f = d
while d != 0:
e = d % 10
c = c + e
d = int(d // 10)
check = f - c
if check < s:
counter = counter + 1
else:
break
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIG... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def cal(a):
x = 0
while a > 0:
x += a % 10
a = a // 10
return x
n, s = input().split()
n = int(n)
s = int(s)
if n - cal(n) < s:
print(0)
elif n - 1 - cal(n - 1) < s:
print(1)
else:
u = 10
l = n
mid = -1
while 1:
mid = (u + l) // 2
if mid - cal(mid) >... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NU... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def sum_dig(num):
num = str(num)
ans = 0
for i in range(len(num)):
ans += int(num[i])
return ans
n, s = map(int, input().split())
ans = 0
for i in range(s, n + 1):
if i - sum_dig(i) >= s:
ans = n - i + 1
break
print(ans) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def main():
n, s = input().split()
n = int(n)
s = int(s)
ans = n
ans -= s - 1
count = 0
for i in range(s, n + 1):
i_str = list(str(i))
total = 0
for j in i_str:
total += int(j)
if i - total >= s:
break
count += 1
ans -= coun... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().strip().split())
num = ""
div = 9
if s // 10 != 0:
div = 9
while s // div // 10 != 0:
div = div * 10 + 9
while div:
rem = str(s // div)
if int(rem) > 9:
num = str(int(num) + 1) + "0" * len(str(div))
div = 0
s = 0
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def somadig(x):
soma = 0
while x > 0:
soma += x % 10
x = x // 10
return soma
def main():
x, s = map(int, input().split())
comeco = 9
fim = x
if comeco >= fim:
print(0)
return
while fim >= comeco:
meio = (fim + comeco) // 2
if meio - somad... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUN... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def check(x, s):
k = 0
for i in str(x):
k += int(i)
return x - k >= s
n, s = map(int, input().split())
l = 0
r = n
while r - l > 1:
m = (l + r) // 2
if check(m, s):
r = m
else:
l = m
if check(r, s):
print(n - r + 1)
else:
print(0) | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN BIN_OP VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF FUN... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
x, y = divmod(s, 9)
if not s:
x = 0
elif y:
x += 1
low = x * 9
for i in range(low, low + 10000):
if i - sum([int(c) for c in str(i)]) >= s:
low = i
break
print(max(n - low + 1, 0)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR ASSIGN VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR F... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def bin(num):
i = 9 * num * 11
count = 0
add = 0
for j in range(100):
add = 0
a = str(i)
for k in range(10):
add += a.count(str(k)) * k
if i - add >= s:
return i
i += 1
return -1
n, s = map(int, input().split())
i = 0
j = 10**30
limit... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR RETURN VAR VAR NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def sumOfDigits(s):
sum = 0
s = str(s)
for i in range(len(s)):
sum = sum + int(s[i])
return sum
def binSearch(s, l, u):
if (l + u) // 2 + 1 - sumOfDigits((l + u) // 2 + 1) >= s and (
l + u
) // 2 - sumOfDigits((l + u) // 2) < s:
return (l + u) // 2
if (l + u) // 2 -... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR RETURN VAR FUNC_DEF IF BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
ans = 0
p = s
for i in range(163):
p = s + i
if p > n:
break
if p >= s + sum(map(int, str(p))):
ans += 1
if p <= n:
ans += n - p
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR IF VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def readints():
return [int(item) for item in input().strip().split()]
def f(n):
return n - sum(map(int, str(n)))
class Solver:
def main(self):
n, s = readints()
if f(n) < s:
print("0")
return
l, r = 1, n
while l <= r:
mid = (l + r) //... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
l = 1
r = n + 1
while r > l + 1:
m = (l + r) // 2
line = str(m)
if m - sum(int(k) for k in line) >= s:
r = m
else:
l = m
line = str(l)
if l - sum(int(k) for k in line) >= s:
r = l
print(max(n - r + 1, 0)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def dsum(n):
return sum([int(c) for c in str(n)])
n, s = map(int, input().split(" "))
l = 1
r = n
while l <= r:
mid = (l + r) // 2
delta = mid - dsum(mid)
if delta >= s:
r = mid - 1
else:
l = mid + 1
print(n - l + 1) | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
c = 0
for i in range(s, n + 1):
x = i - sum(int(t) for t in str(i))
if x >= s:
c = n - i + 1
break
print(c) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | inp = input().split()
n = int(inp[0])
s = int(inp[1])
start = s + 1
thresh = s + 500
ans = 0
if n > thresh:
ans += n - thresh
else:
thresh = n
val = 0
for i in range(start, thresh + 1):
val = i
while i > 0:
val -= i % 10
i = i // 10
if val >= s:
ans += 1
print(ans) | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBE... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def sum_of_digits(n):
ans = 0
while n:
ans += n % 10
n //= 10
return ans
n, s = map(int, input().split())
lo = 0
hi = n
x = n + 1
while lo <= hi:
mid = (lo + hi) // 2
if mid - sum_of_digits(mid) >= s:
x = min(mid, x)
hi = mid - 1
else:
lo = mid + 1
print... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def main():
def sumofdigit(n):
temp = 0
while n > 0:
temp += n % 10
n = n // 10
return temp
def F(x):
return x - sumofdigit(x)
def findout(s):
test = s - s % 10 + 10
while 1:
if F(test) >= s:
break
... | FUNC_DEF FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER WHILE NUMBER IF FUNC_CALL VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CAL... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | R = lambda: map(int, input().split())
n, s = R()
l, r = s, 10**18 + 7
def digit(x):
res = 0
while x:
res += x % 10
x //= 10
return res
while l < r:
m = (l + r) // 2
if m - digit(m) < s:
l = m + 1
else:
r = m
print(max(0, n - l + 1)) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BI... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def binsearch(n, s):
left = 0
right = n
while left <= right:
mid = (left + right) // 2
digits = sum([int(i) for i in list(str(mid))])
if mid - digits >= s:
right = mid - 1
else:
left = mid + 1
return right
print... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def digit_sum(n):
cnt = 0
while n:
cnt += n % 10
n //= 10
return cnt
def bsearch(low, high, s):
h = high
ans = -1
while low <= high:
mid = (low + high) // 2
if mid - digit_sum(mid) >= s:
ans = mid
high = mid - 1
else:
... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def cmp(x1=[], x2=[]):
len1 = len(x1)
len2 = len(x2)
if len1 == len2:
for i in range(len1):
n1 = x1[len1 - 1 - i]
n2 = x2[len1 - 1 - i]
if n1 != n2:
return n1 > n2
else:
return len1 > len2
return True
def add(x1=[], x2=[]):
if... | FUNC_DEF LIST LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR VAR RETURN VAR VAR RETURN VAR VAR RETURN NUMBER FUNC_DEF LIST LIST IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def R(n):
ans = 0
while True:
ans += n % 10
n = n // 10
if n == 0:
return ans
current = n - R(n)
if current < s:
print("0")
else:
extra = n % 10 + 1
lo, hi = 0, n
while lo < hi - 1:
mid = lo + (hi - lo) // 2
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR W... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def f(x):
ans = x
while x > 0:
ans -= x % 10
x //= 10
return ans
n, s = map(int, input().split())
if f(n) < s:
print(0)
exit(0)
l, r = 1, n
while l < r:
m = (l + r) // 2
if f(m) >= s:
r = m // 10 * 10
else:
l = m + 1
print(n - l + 1) | FUNC_DEF ASSIGN VAR VAR WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def bigNumber(n, s):
for i in range(s, n + 1):
sumVal = 0
num = i
while num:
sumVal += num % 10
num //= 10
if i - sumVal >= s:
print(n - i + 1)
return
print(0)
n, s = (int(x) for x in input().split())
bigNumber(n, s) | FUNC_DEF FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
mdist = 10**5
c = s
ans = 0
def mySum(c):
s = str(c)
ret = 0
for x in s:
ret += ord(x) - ord("0")
return ret
while mdist and c <= n:
if c - mySum(c) >= s:
ans += 1
mdist -= 1
c += 1
c = min(c, n + 1)
print(ans + n - c + 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING RETURN VAR WHILE VAR VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def really_big(x):
sum_digit = 0
digits = x
while digits > 0:
sum_digit += digits % 10
digits = digits // 10
if x - sum_digit >= s:
return True
return False
def solve():
left = 1
right = n
ans = 0
while left <= right:
mid = (left + right) // 2
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUM... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
if s >= n:
print(0)
else:
ans = 0
def sod(n):
s = str(n)
ret = 0
for i in s:
ret += int(i)
return ret
for nd in range(s, s + 1000):
if nd - sod(nd) >= s:
ans += 1
if nd == n:
break
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR IF VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, k = [int(x) for x in input().strip().split(" ")]
s, e = 1, n + 1
while s < e:
mid = (s + e) // 2
if mid - sum([int(x) for x in str(mid)]) < k:
s = mid + 1
else:
e = mid
print(n - s + 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def comp(p):
a = p
sum = 0
while a != 0:
sum += a % 10
a //= 10
return p - sum >= s
l = 0
r = n
while r - l > 1:
p = (l + r) // 2
if comp(p):
r = p
else:
l = p
if comp(n):
print(n - l)
else:
print(0) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def func(mid, s):
p = 0
q = mid
while mid > 0:
p += mid % 10
mid = mid // 10
if q - p >= s:
return True
else:
return False
n, s = map(int, input().split())
do = 1
up = 10**18
an = n + 1
while up >= do:
mid = (up + do) // 2
if func(mid, s):
up = mid -... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def main():
n, s = map(int, input().split())
y = [i for i in range(s, s + 180) if i - sum([int(j) for j in str(i)]) >= s]
a = y[0]
print(max(n - a + 1, 0))
main() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def diff(m):
return m - sum([int(k) for k in list(str(m))])
def digit_safe(k):
r = len(list(str(k)))
return toint(["1"] + ["0"] * (r - 1))
a = list(str(n))
b = list(str(s))
d = int(a[0])
def toint(l):
return int("".join(l))
res = 0
for i in range(d):
z = to... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR BIN_OP LIST STRING BIN_OP LIST STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def mus(x):
c = 0
while x > 0:
c += x % 10
x = x // 10
return c
n, s = map(int, input().split())
ans = s + 10 - s % 10
while ans - mus(ans) < s:
ans += 10
if ans > n:
print(0)
else:
print(n - ans + 1) | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER WHILE BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL V... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
l = n + 1
for i in range(s, min(s + 1000000, n) + 1, 1):
cur = sum([int(j) for j in str(i)])
if i - cur >= s:
l = i
break
print(n - l + 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def getSum(n):
ans = 0
while n > 0:
ans = ans + n % 10
n = n // 10
return ans
n, s = (int(x) for x in input().split(" "))
l, h = 1, n
while l < h:
mid = l + (h - l >> 1)
sum = int(getSum(mid))
if mid - sum >= s:
h = mid
else:
l = mid + 1
sum = int(getSum(l))... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
def binsearch(l, r, elem):
n = r
medium = (l + r) // 2
s = medium - sum_digits(medium)
s1 = medium - 1 - sum_digits(medium - 1)
s2 = medium + 1 - sum_digits(medium + 1)
while not (s2 >= elem and s < ele... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | import sys
input = sys.stdin.readline
n, s = map(int, input().split())
l = 0
r = n + 1
while r - l > 1:
x = (l + r) // 2
cs = 0
m = x
while m > 0:
cs += m % 10
m //= 10
if x - cs >= s:
r = x
else:
l = x
print(n - l) | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR VAR ASSIGN... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def read_ints():
return list(map(int, input().split()))
n, s = read_ints()
def judge(x):
return x - sum(map(int, str(x))) >= s
result = len([x for x in range(s, min(n, s + 180) + 1) if judge(x)]) + max(
0, n - s - 180
)
print(result) | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR FUNC_CALL VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def qtd(u):
ans = 0
while u > 0:
u //= 10
ans += 1
return ans
def digitos(u):
ans = 0
while u > 0:
ans += u % 10
u //= 10
return ans
n, m = input().split()
m = int(m)
number = int(n)
ans = 0
size_n = qtd(m)
i = m
while i < m + size_n * 9 + 1:
if i > number... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def summing(number):
summa = 0
while number > 0:
summa += number % 10
number = number // 10
return summa
def result(n, s):
z = min(s, n)
while z <= n and z - summing(z) < s:
z += 1
return n - z + 1
a, b = [int(i) for i in input().split()]
print(result(a, b)) | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VA... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def works(mid, s):
return mid - sum(list(map(int, list(str(mid))))) >= s
def main():
n, s = map(int, input().strip().split())
low = 0
high = n + 1
while low + 1 < high:
mid = (low + high) // 2
if works(mid, s):
high = mid
else:
low = mid
print(n ... | FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = map(int, input().split())
def digs(k):
r = k
while k:
r -= k % 10
k //= 10
return r
x = s + 19 * 9
while digs(x - 1) >= s:
x -= 1
print(max(n - x + 1, 0)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER WHILE FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def case(mid):
res = 0
for k, x in enumerate(str(mid)):
res += int(x)
return res
n, s = map(int, input().split())
i, j = 0, n
while i + 1 < j:
mid = (i + j) // 2
result = case(mid)
if mid - case(mid) < s:
i = mid
else:
j = mid
if i - case(i) >= s:
print(n - i + ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = list(map(int, input().split()))
if n - sum([int(x) for x in str(n)]) < s:
print(0)
else:
def check(n):
return n - sum([int(x) for x in str(n)]) >= s
start = 1
end = n
mid = (start + end) // 2
while mid != end and mid != start:
if check(mid):
end = mid
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def search(l, r, s, g):
if l > r:
return [-1, g]
mid = (l + r) // 2
sum = 0
temp = mid
while temp > 0:
sum += temp % 10
temp //= 10
if mid - sum == s:
return [mid - mid % 10, g]
elif mid - sum > s:
g = mid - mid % 10
return search(l, mid - 1, s... | FUNC_DEF IF VAR VAR RETURN LIST NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR RETURN LIST BIN_OP VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | raw = input().split()
n = int(raw[0])
s = int(raw[1])
def sum_digits(x):
z = 0
while x:
z += x % 10
x //= 10
return z
i = s
count = 0
while i <= n:
q = i - sum_digits(i)
if q >= s:
count = n - i + 1
break
else:
i += 1
print(count) | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR N... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | class ReallyBigNumbers:
def __init__(self, n, s):
self.n = n
self.s = s
self.binarySearch()
def binarySearch(self):
l = self.s
h = 10000000000000000000
while l < h:
mid = (h + l) // 2
if self.isReallyBig(mid):
h = mid
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = list(map(int, input().split()))
def sum_of_digits(n):
ans = 0
for c in str(n):
ans += int(c)
return ans
m = s + 10 - s % 10
while m - sum_of_digits(m) < s:
m += 10
if m <= n:
print(n - m + 1)
else:
print(0) | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER WHILE BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | n, s = input().split()
n = int(n)
s = int(s)
def get_decimal_value_digits(number):
count = 0
digits = 0
number = str(number)
for digit in number:
count += int(digit)
digits += 1
return count
def is_big_num(number, s):
if number - get_decimal_value_digits(number) >= s:
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR FUNC_DEF IF BIN_OP VAR FUNC_CALL VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR ASSIG... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | def sd(n):
acc = 0
while n:
acc += n % 10
n //= 10
return acc
def rb(n, s):
return n - sd(n) >= s
n, s = map(int, input().split(" "))
left = 1
right = n + 1
while left != right:
mid = (left + right) // 2
if rb(mid, s):
right = mid
else:
left = mid + 1
prin... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR ... |
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different speci... | arr = [int(x) for x in input().split()]
n = arr[0]
s = arr[1]
resp = 0
leng = len(str(s))
j = 0
for i in range(s, s + leng * 9 + 1):
j = i
if i > n:
break
temp = 0
c = i
while c:
temp += c % 10
c //= 10
if i - temp >= s:
resp += 1
j += 1
if j > n:
print(resp)
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.