description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
n, s = map(int, sys.stdin.readline().strip().split())
orin = n
tot = 0
for x in str(n):
tot += int(x)
ans = 0
add = 1
ind = -1
while tot > s:
while str(n)[ind] != "0":
n += add
tot = ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE FUNC_CALL VAR VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for T in range(int(input())):
a, b = map(int, input().split())
ans = 0
if a <= b:
print(b - a)
elif a % b == 0:
print(0)
else:
print(b - a % b) | 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 NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
num = [list(map(int, input().split())) for _ in range(t)]
answer = []
for a, b in num:
k = 0
multi = b
if a % b != 0:
k = b - a % b
answer.append(k)
for i in answer:
print(i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(t):
at = 0
a, b = map(int, input().split())
k = a
if sum(map(int, list(str(a)))) <= b:
print(0)
continue
else:
for j in range(len(str(a)) - 1, -1, -1):
a += (10 - int(str(a)[j])) * 10 ** (len(str(a)) - j - 1)
if sum(map(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
a = input().split()
ans = int(a[0]) % int(a[1])
if ans != 0:
ans = int(a[1]) - ans
else:
ans = 0
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def find(n, s):
if sum(map(int, list(n))) <= s:
return 0
for i in range(len(n)):
try:
if 1 + sum(map(int, list(n[i + 1 :]))) <= s:
w = "0" * (i + 1) + str(1 + int("".join(n[i + 1 :][::-1])))[::-1]
return min(
int(w[::-1]) - int("".j... | FUNC_DEF IF FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR FUNC_CALL STRING VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def convert_array_to_int(arr):
for i in range(0, len(arr), 1):
arr[i] = int(arr[i])
return arr
testCases = int(input())
while testCases:
X = input().split()
X = convert_array_to_int(X)
a = X[0]
b = X[1]
remainder = a % b
if remainder:
print(b - remainder)
else:
... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR EXPR FUNC_CALL VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
def get_sum(n):
return sum([i for i in map(int, list(str(n)))])
def destroy_digit(n, digit):
if digit == 0:
return n
return int(str(n)[0 : -1 * digit] + "0" * digit) + 10**digit
for _ in range(t):
n, s = map(int, input().split())
n_digits = len(str(n))
for i in ran... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN BIN_OP FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP NUMBER VAR BIN_OP STRING VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def main():
d = int(input())
for i in range(d):
a, b = [int(v) for v in input().split()]
print((a // b + (0 if a % b == 0 else 1)) * b - a)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
while t:
x, y = map(int, input().split())
if x % y == 0:
print("0")
else:
print(y - x % y)
t = t - 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | n = int(input())
listA = []
listB = []
for i in range(0, n):
a = list(map(int, input().split()))
listA.append(a[0])
listB.append(a[1])
i = 0
while n:
if listA[i] % listB[i] == 0:
print("0")
i = i + 1
else:
num = int(listA[i] / listB[i])
exactNum = int(listB[i] * (num ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING AS... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def divisible(a, b):
if a % b != 0:
return b - a % b
return 0
a = int(input())
for i in range(a):
z = input()
z = z.split()
w = []
for i in z:
w.append(int(i))
ans = divisible(w[0], w[1])
print(ans) | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
while t > 0:
t -= 1
n, s = map(int, input().strip().split(" "))
def calcSum(num):
st = str(num)
st = list(st)
sm = 0
for i in range(len(st)):
sm += int(st[i])
return sm
diff = calcSum(n) - s
if diff < 1:
print(0)
else... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR 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 BIN_OP... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split())
l = list(map(int, str(n)))[::-1]
x = sum(l)
if x <= s:
print(0)
continue
for i in range(1, len(l)):
if l[i] == 9:
continue
t = l.copy()
t[:i] = [0] * i
t[i] += 1
if sum(... | 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 VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUN... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for i in range(int(input())):
a, b = map(int, input().split())
ans = 0
if a % b == 0:
print(0)
else:
q = a // b
g = b * (q + 1)
ans = g - a
print(ans) | 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 NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | C = int(input())
while True:
try:
A, B = input().split()
A = int(A)
B = int(B)
if A % B:
print(abs(B - A % B))
else:
print(A % B)
except EOFError:
break | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
def process(a, b):
m = a % b
if m == 0:
print(0)
else:
print(b - m)
input = sys.stdin.readline
def inp():
return int(input())
def inlt():
return list(map(int, input().split()))
def insr():
s = input()
return list(s[: len(s) - 1])
def invr():
return ... | IMPORT FUNC_DEF ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR BIN_OP FUNC_CA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | MOD = 1000000007
MOD2 = 998244353
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
let = "abcdefghijklmnopqrstuvwxyz"
for _ in range(ii()):
a, b = f()
x = (b - a % b)... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN 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 FUNC_CALL VAR FUNC_CALL VAR ASSI... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = input().split()
s = int(s)
n = "0" + n
c = d = 0
while c <= s:
c += int(n[d])
d += 1
if d == len(n):
if c <= s:
d = -1
break
if d < 0:
print(0)
continue
d -= 1
c -= int(n[... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR VAR NUMBER WHILE VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NU... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = input()
t = int(t)
for i in range(t):
n, k = input().split()
n = int(n)
k = int(k)
c = n % k
if n % k == 0:
print("0")
else:
print(k - c) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(t):
n, s = [int(k) for k in input().split()]
c = [int(k) for k in str(n)]
res = 0
while c and sum(c) > s:
c.pop()
res += 1
while c and c[-1] == 9:
c.pop()
res += 1
if c:
c[-1] += 1
if not c:
p... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER WHILE VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER IF VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(t):
a, b = list(map(int, input().split()))
if a % b != 0:
r = a // b
j = (r + 1) * b - a
print(j)
else:
print("0") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
result = []
for i in range(t):
def find(a, b):
x = a % b
result.append(b - x)
a, b = [int(j) for j in input().split()]
if a % b == 0:
result.append(0)
elif b > a:
result.append(b - a)
else:
find(a, b)
for i in range(t):
print(result[i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CAL... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
tab = []
for x in range(t):
moves = 0
a, b = map(int, input().split())
if a % b == 0:
tab.append(0)
elif a < b:
tab.append(b - a)
elif a > b:
tab.append(b - a % b)
for each in tab:
print(each) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR FOR VAR VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | l = []
n = int(input())
ct = 0
for i in range(n):
ct = 0
e = input().split(" ")
a = int(e[0])
b = int(e[-1])
if a % b == 0:
print(0)
else:
c = a // b
c += 1
print(b * c - a) | ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER E... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def minmove(n, s):
n1 = n
digits = list(map(int, str(n)))
move = 0
i = 1
while sum(digits) > s:
new = (n // 10**i + 1) * 10**i
digits = list(map(int, str(new)))
i += 1
move = new - n
return move
t = int(input())
for i in range(t):
n, s = map(int, input().spl... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def divisibility(a, b):
if a % b == 0:
return 0
else:
return b * (a // b + 1) - a
def test():
number_of_tests = int(input())
for i in range(number_of_tests):
ab = input().split(" ")
a = int(ab[0])
b = int(ab[1])
output = str(divisibility(a, b))
p... | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR F... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
a, b = map(int, input().split())
k = a % b
if k != 0:
ans = b - k
print(ans)
else:
print(0) | 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 BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(t):
a, b = input().split()
a = int(a)
b = int(b)
moves = (b - a % b) % b
print("%d" % moves) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def solution(str_n, s):
S = 0
for j in str_n:
S = S + int(j)
if S <= s:
print(0)
else:
S = 0
p = 0
while p < len(str_n) and S < s:
S = S + int(str_n[p])
p = p + 1
p = len(str_n) - p + 1
solution = 1
for i in range(p)... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIG... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def solve(n, s):
sums = []
all_sum = 0
nn = n
while nn > 0:
sums.append(all_sum)
all_sum += nn % 10
nn = nn // 10
if all_sum <= s:
return 0
m = 10 ** len(sums)
for i, d in enumerate(sums):
if all_sum - d < s:
m = 10**i
break
... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
li = list(map(int, input().split()))
a = li[0]
b = li[1]
if a % b == 0:
print(0)
elif b > a:
print(b - a)
else:
remainder = a % b
ans = b - remainder
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_C... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
a = []
for i in range(t):
x, y = map(int, input().split())
if x != 0 and x % y == 0:
x = y
else:
x = x % y
a.append(y - x)
for i in range(t):
print(a[i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for T in range(t):
a, b = [int(x) for x in input().split()]
rem = a % b
if rem > 0:
rem = b - rem
print(rem) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def calc(a, b):
if a % b == 0:
return 0
return (a // b + 1) * b - a
N = int(input())
cases = []
for _ in range(N):
cases.append(map(int, input().split()))
for a, b in cases:
print(calc(a, b)) | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
a, b = input().split()
a, b = int(a), int(b)
if a % b == 0:
minimum = 0
else:
minimum = (int(a / b) + 1) * b - a
print(minimum) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
n, s = [int(p) for p in input().split()]
li = [int(p) for p in list(str(n))]
if sum(li) <= s:
print(0)
continue
val = 0
i = 1
currSum = sum(li)
while currSum > s:
rem = n % 10**i
val += 10**i - rem
n += 10**i - rem
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | s = int(input())
for i in range(0, s):
a, b = map(int, input().split())
count = 0
flag = 0
d = a % b
if d == 0:
print(count)
else:
c = a // b
k = (c + 1) * b
count = k - a
print(count) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
n, max_sum = map(int, input().split())
s = str(n)
if sum(map(int, s)) <= max_sum:
print(0)
else:
sm = 0
i = 0
while i < len(s) and sm + int(s[i]) < max_sum:
sm += int(s[i])
i += 1
next = 0
for j i... | 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 IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR VAR VAR VAR... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
input = sys.stdin.readline
def getsum(n):
x = list(str(n))
sumi = 0
for i in range(len(x)):
sumi += int(x[i])
return sumi
for _ in range(int(input())):
n, s = [int(j) for j in input().split()]
ans = 0
i = 0
while getsum(n) > s:
temp = 10**i - n % 10**i
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHIL... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | PI = 3.141592653589793
INF = 999999999
MOD = 1000000007
def add(x, y):
return (x + y) % MOD
def sub(x, y):
return (x - y + MOD) % MOD
def mul(x, y):
return x * y % MOD
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def lcm(x, y):
return x * y // gcd(x, y)
def power(x... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
while t > 0:
a, b = input().split()
a = int(a)
b = int(b)
c = a % b
if c == 0:
print(f"{c}")
else:
ans = b - c
print(f"{ans}")
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(0, t):
a, b = input().split()
a = int(a)
b = int(b)
if a % b == 0:
print(0)
else:
r = a % b
print(abs(b - r)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER 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 VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = input().split()
s = int(s)
length = n.__len__()
summa = 0
for i in range(length):
summa += int(n[i])
if summa <= s:
print(0)
continue
summa = 0
cnt = 0
elem = 0
for i in range(length):
if summa + int(n[i]) >= s:... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CAL... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
inp = input().split(" ")
a = int(inp[0])
b = int(inp[1])
move = 0
if a % b == 0:
print(move)
else:
g = a % b
move = b - g
print(move) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
inputlist = sys.stdin.readlines()
number_of_testcases = int(inputlist[0].strip())
for i in range(number_of_testcases):
a, b = list(map(int, inputlist[i + 1].strip().split(" ")))
modresult = a % b
if modresult == 0:
print(modresult)
else:
print(b - modresult) | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | from sys import stdin, stdout
def rem(a, b):
if a < b:
return b - a
elif a % b != 0:
return b - a % b
else:
return 0
def main():
n = 0
for line in stdin:
x = [int(i) for i in line.split()]
if len(x) == 2:
stdout.write(str(rem(x[0], x[1])) + "\n... | FUNC_DEF IF VAR VAR RETURN BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR BIN_OP VAR VAR RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER STRING EXPR FUNC... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | n = int(input())
cases = [(0) for j in range(n)]
for i in range(n):
line = [int(k) for k in input().split()]
if line[0] % line[1] == 0:
cases[i] = 0
else:
cases[i] = line[1] - line[0] % line[1]
for j in cases:
print(str(j)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR FUNC... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for i in range(t):
n = input()
a, b = map(int, n.split())
count = 0
if a % b == 0:
print(count)
elif a < b:
count = b - a
print(count)
else:
count += b - a % b
print(count) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split(" "))
digits = [int(x) for x in str(n)]
if sum(digits) <= s:
print(0)
continue
i = 1
while i < len(digits) and sum(digits[:i]) < s:
i += 1
p = 10 ** (len(digits) - i + 1)
print(p - n % p) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP NUM... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for x in range(int(input())):
a, b = map(int, input().split())
c = a
a = list("0" + str(a))
arr = []
b = b - (ord(a[0]) - 48)
t = 1
f = 0
while b >= 0:
arr.append(b)
b = b - (ord(a[t]) - 48)
t += 1
if t == len(a):
f = 1
break
ar... | 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 VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER EXPR FUNC_C... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
outputList = []
i = 0
while i < t:
x = str(input()).split(" ")
a = int(x[0])
b = int(x[1])
steps = outputList.append((b - a % b) % b)
i += 1
for item in range(len(outputList)):
print(outputList[item]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | n = int(input())
a = []
b = []
c = 0
d = 0
for i in range(n):
a.append([int(j) for j in input().split()])
for i in range(0, n):
if a[i][0] % a[i][1] == 0:
b.append(0)
elif a[i][0] > a[i][1]:
b.append((a[i][0] // a[i][1] + 1) * a[i][1] - a[i][0])
else:
b.append(a[i][1] - a[i][0])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR NUMBE... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def solve():
a, b = map(int, input().split())
print(-a % b)
def main():
t = int(input())
for _ in range(t):
solve()
main() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def input_int():
return int(input())
def input_int_list():
return list(map(int, input().split()))
def input_input_map():
return map(int, input().split())
def run():
q_num = input_int()
for i in range(q_num):
base_num, target_sum = input_input_map()
base_num_sum = 0
for ... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
def id(x):
return x
for i in range(t):
n, s = map(int, input().split())
s = int(s)
ans = 0
cancer = sum([int(x) for x in list(str(n))])
i = 0
m = n
while cancer > s:
if int(str(n)[-1 - i]) == 0:
pass
elif cancer - s > int(str(n)[-1 - i]):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN 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 ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR IF FU... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for t in range(int(input())):
n, s = [int(i) for i in input().split()]
n = str(n)
n = [int(i) for i in n]
res = 0
if sum(n) <= s:
print(res)
else:
cnt = 1
while n and sum(n) > s:
q = n.pop()
res += (10 - q) * cnt
if n:
n... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
sol = []
while t:
t -= 1
a, b = input().split()
a = int(a)
b = int(b)
nr = 0
if a > b:
if a % b:
nr = b - a % b
else:
nr = b - a
sol.append(nr)
print(*sol, sep="\n") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR IF BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
input = sys.stdin.readline
sm = lambda x: sum(map(int, str(x)))
for _ in range(int(input())):
n, s = map(int, input().split())
res = 0
while sm(n) > s:
t = 0
while n % pow(10, t) == 0:
t += 1
d = -n % pow(10, t)
res += d
n += d
print(res) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR 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 NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = input().split()
s = int(s)
digits = [int(c) for c in n]
x = len(digits)
p = 0
while digits[x - 1] == 0:
x -= 1
p += 1
y, s_ = 0, 0
while s_ < s and y < x:
s_ += digits[y]
y += 1
if y == x and s_ <= s:
print(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR VAR VAR VAR VAR VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def getSum(n):
sum = 0
while n > 0:
sum += n % 10
n //= 10
return sum
tc = int(input())
while tc:
tc -= 1
n, s = map(int, input().split())
ans = 0
while getSum(n) > s:
p = 1
tmp = n
while tmp % 10 == 0:
tmp //= 10
p *= 10
... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR NUMBER NUMBER VAR N... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
def get_sum(a):
now_sum = 0
while a:
now_sum += a % 10
a //= 10
return now_sum
T = int(sys.stdin.readline())
for _ in range(T):
n, x = map(int, sys.stdin.readline().split())
res_n = n
digit = 0
while get_sum(res_n) > x:
res_n += (10 - res_n // 10**digit... | IMPORT FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR 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 VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP NUMBER BIN_OP BIN_OP VAR BIN_OP... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def solve(a, b):
check = b
if check == a:
return 0
if a > check:
div = int(a / b)
while a > check:
check = b * div
div += 1
return check - a
if a < check:
return check - a
Q = int(input())
for _ in range(Q):
a, b = map(int, input().sp... | FUNC_DEF ASSIGN VAR VAR IF VAR VAR RETURN NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER RETURN BIN_OP VAR VAR IF VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_C... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
a, b, *c = input().split()
a = int(a)
b = int(b)
j = 0
if a % b != 0:
print(b - a % b)
else:
print(0) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for j in range(int(input())):
a, b = map(int, input().split())
if a >= b:
if a % b == 0:
print(0)
else:
c = a // b
ans1 = (c + 1) * b - a
print(ans1)
elif a < b:
print(b - a) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = input()
t = int(t)
for tt in range(0, t):
a, b = input().split()
a, b = int(a), int(b)
if a % b == 0:
print(0)
else:
print(b - a % b) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for ii in range(t):
n, s = map(int, input().split())
num = [int(i) for i in str(n)]
if sum(num) <= s:
print(0)
else:
i, k = len(num) - 1, 0
while i > -1:
if num[i] != 0:
num[i] = 0
k = i
l = -2
f... | 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 VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER WHILE VAR NUMBER IF VAR VAR NUMBER ASSIGN ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | T = int(input())
for t in range(T):
n, s = map(int, input().split())
str_n = str(n)[::-1]
tot_sum = 0
for i in str_n:
tot_sum += int(i)
moves = 0
carry = 0
if tot_sum <= s:
print(moves)
else:
for i in range(len(str_n)):
moves += (10 - int(str_n[i]) - c... | 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 NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
a, b = map(int, input().split())
if a < b:
ans = b - a
else:
v = (10**9 + 1) * b
c = v - a
ans = int(c % b)
print(ans) | 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 IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
n, s = input().split()
cnt = 0
keta = len(n)
wa = 0
ans = ""
for i in n:
wa += int(i)
if wa <= int(s):
print(0)
continue
else:
wa = 0
for i, x in enumerate(n):
wa += int(x)
if wa >= int(s)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | T = int(input())
for i in range(T):
l = list(map(int, input().split()))
a = l[0]
b = l[1]
count = a % b
if count == 0:
print("0")
else:
check = (a // b + 1) * b - a
print(check) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL V... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def sumofdigits(n):
n = str(n)
sum1 = 0
for i in n:
sum1 += int(i)
return sum1
t = int(input())
for i in range(t):
n, s = list(map(int, input().split()))
value = sumofdigits(n)
if value <= s:
print(0)
elif s == 1:
tempn = n
solo = len(str(n))
d =... | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER ASS... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | x = int(input())
for _ in range(x):
w, y = map(int, input().split())
if w >= y:
thing = w // y
if w % y == 0:
print(0)
else:
print((thing + 1) * y - w)
else:
print(y - 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 IF VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
def rl():
return sys.stdin.readline().strip()
def ri():
return int(sys.stdin.readline().strip())
def rn():
return list(map(int, sys.stdin.readline().strip().split()))
def rnn():
return map(int, sys.stdin.readline().strip().split())
def rln(n):
l = [None] * n
for i in range(n... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR VAR AS... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split())
ans = ""
strn = str(n)
sumn = 0
for i in strn:
sumn += int(i)
if sumn <= s:
print(0)
else:
k = 0
tot = 0
for i in strn:
k += int(i)
if k + 1 > s:
bre... | 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 STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF BIN_... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split())
a = []
temp = n
while temp > 0:
a.append(temp % 10)
temp //= 10
if sum(a) <= s:
print(0)
continue
su = 0
x = len(a)
temp = -1
for i in range(x - 1, -1, -1):
if su + a[i] >= s:
... | 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 LIST ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER F... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
n, s = list(input().split())
s = int(s)
p = len(n)
ncopy = n[::-1]
ncopy = ncopy + "000000000000000000"
ncopy = list(ncopy)
summ = 0
for j in n:
summ += int(j)
if summ <= s:
print(0)
continue
diff = summ - s
for i in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR E... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for case in range(int(input())):
a, b = [int(a) for a in input().split()]
if a < b:
ans = b - a
elif a == b:
ans = 0
elif a % b == 0:
ans = 0
else:
mod = a // b + 1
ans = b * mod - a
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
def solve():
a, b = map(int, input().split())
steps = 0
r = a % b
if r == 0:
print(0)
else:
print(b - r)
while t > 0:
solve()
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for t in range(int(input())):
inp = list(map(int, input().split()))
if inp[0] % inp[1] == 0:
print(inp[0] % inp[1])
else:
print(inp[1] - inp[0] % inp[1]) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | num = int(input())
def increment(n1, n2):
n1 = int(n1)
n2 = int(n2)
if n1 % n2 == 0:
return 0
else:
t = n1 % n2
return n2 - t
for i in range(num):
temp = input()
temp = temp.split(" ")
print(increment(temp[0], temp[1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def r(t=int):
return list(map(t, input().split()))
def ri(t=int):
return t(input())
def cd(it):
ret_val = dict()
for v in it:
ret_val[v] = ret_val.get(v, 0) + 1
return ret_val
for _ in range(ri()):
a, b = r()
s = 0
if a % b:
s = b - a % b
else:
s = 0
... | FUNC_DEF VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF VAR RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def algo(n, s):
cur = -1
total = 0
sn = str(n)
for i in range(len(sn)):
total += int(sn[i])
if total < s:
cur = i
if total <= s:
return 0
res = 0
substr = sn[cur + 1 :]
return int("1" + "0" * len(substr)) - int(substr)
for _ in range(int(input())):
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR VAR IF VAR VAR RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP STRING BIN_OP STRING FUNC_CALL VAR VAR FUNC... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(rows_numb... | IMPORT ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
l = []
for i in range(t):
a, b = map(int, input().strip().split())
m = a % b
if m == 0:
l.append(m)
else:
l.append(b - m)
for i in l:
print(i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
for _ in range(t):
a, b = map(int, input().split())
ans = None
if a % b != 0:
ans = b - a % b
else:
ans = a % b
print(ans) | 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 NONE IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
a1 = [0] * t
b1 = [0] * t
for i in range(t):
a, b = input().split()
a1[i], b1[i] = int(a), int(b)
for i in range(t):
mod = a1[i] % b1[i]
if mod:
print(b1[i] - a1[i] % b1[i])
else:
print(0) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR EXPR FUNC_CALL VAR BIN... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
while t != 0:
a, b = map(int, input().split())
if a > b:
if a % b == 0:
count = 0
else:
c = a // b
d = b * (c + 1)
count = d - a
elif a < b:
count = b - a
else:
count = 0
print(count)
t = t - 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER EXPR F... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | n = int(input())
for i in range(n):
m = input().split()
a = int(m[0])
b = int(m[1])
if a % b != 0:
r = b - a % b
print(r)
else:
print(0) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
read = lambda: sys.stdin.readline().strip()
for _ in range(int(read())):
s, n = read().split()
n = int(n)
s = list(map(int, list(s)))[::-1]
s1 = s.copy()
total = sum(s)
if total <= n:
print(0)
continue
place = None
temp_sum = 0
for i, digit in enumerate(s)... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER A... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
input = sys.stdin.readline
def sol(n, s):
c = 0
i = 0
while True:
if digsum(n) <= s:
return c
else:
c += (10 - n % 10) * 10**i
n //= 10
n += 1
i += 1
def digsum(n):
r = 0
while n != 0:
r += n % 10
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF FUNC_CALL VAR VAR VAR RETURN VAR VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR ... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
input = sys.stdin.readline
cases = int(input())
for tt in range(cases):
n, need = map(int, input().split())
i = 9
ans = 0
was = n
i, j, temp = 9, 1, 0
while True:
k = str(n)
s = 0
for c in range(len(k)):
s += int(k[c])
if s <= need:
... | IMPORT ASSIGN VAR VAR 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUN... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, x = input().split()
x = int(x)
n = list(map(str, str(n)))
z = list(map(int, n))
if sum(z) <= x:
print(0)
else:
z = 0
for i in range(len(n)):
z += int(n[i])
if z >= x:
break
n = n[i:]
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUN... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | t = int(input())
j = 0
while j < t:
a, b = map(int, input().split())
if a % b == 0:
print("0")
elif a % b != 0:
if a < b:
print(b - a)
elif a > b:
c = int(a / b) + 1
print(c * b - a)
j = j + 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER EXPR F... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split())
l = [x for x in str(n)]
su = sum([int(x) for x in str(n)])
ans = 0
c = 0
for i in range(len(l)):
c += int(l[i])
if c >= s and su > s:
p = 10 ** (len(l) - i)
ans = p - int("".join(l[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 VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | import sys
def set_debug(debug_mode=False):
if debug_mode:
fin = open("input.txt", "r")
fout = open("output.txt", "w")
sys.stdin = fin
sys.stdout = fout
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
mod = a % b
if mod == 0:
print(mod)
... | IMPORT FUNC_DEF NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR ASSIGN VAR VAR 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 BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR V... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | n = int(input())
l = []
while n:
l.append([int(x) for x in input().split()])
n = n - 1
for i in l:
c = 0
t = 0
if i[1] > i[0]:
t = i[1] - i[0]
elif i[0] % i[1] != 0:
a = i[0] % i[1]
t = i[1] - a
print(t) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VA... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | for _ in range(int(input())):
n, s = map(int, input().split())
r = list(map(int, str(n)))[::-1]
d = sum(r)
if d <= s:
print(0)
continue
for i in range(1, len(r)):
x = r[: i + 1]
if x[-1] == 9:
continue
if d - sum(x) + x[-1] + 1 <= s:
nr... | 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 VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | def sum_s(s):
ans = 0
for i in s:
ans += i
return ans
t = int(input())
while t:
t -= 1
n, s = map(int, input().split())
l = []
s1 = str(n)
for i in s1:
l.append(int(i))
n = l
if sum_s(n) <= s:
print(0)
continue
steps = 0
n1 = len(n)
i... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_C... |
You are given a positive integer $n$. In one move, you can increase $n$ by one (i.e. make $n := n + 1$). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of $n$ be less than or equal to $s$.
You have to answer $t$ independent test cases.
-----Input-----
The fir... | f = int(input())
while f:
a, b = input().split(" ")
if int(a) % int(b):
print(int(b) - int(a) % int(b))
else:
print(0)
f -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.