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... | def main():
a, b = [int(i) for i in input().split()]
ans = b - a % b
if ans == b:
ans = 0
return ans
for i in range(int(input())):
print(main()) | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL 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... | a = int(input())
L = []
for i in range(a):
b = input()
c = ""
for j in b:
if j == " ":
x = int(c)
c = ""
else:
c += j
L += [[x, int(c)]]
for k in range(a):
if L[k][0] % L[k][1] != 0:
print(L[k][1] - L[k][0] % L[k][1])
else:
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR VAR VAR LIST LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER 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... | def find(a, b):
count = 0 if a % b == 0 else b - a % b
print(count)
n = int(input())
for i in range(0, n):
a, b = list(map(int, input().split()))
find(a, b) | FUNC_DEF ASSIGN VAR BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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... | for s in [*open(0)][1:]:
n, s = s.split()
m = n
while sum(map(int, m)) > int(s):
i = len(m.strip("0"))
m = str(int(m) + (10 - int(m[i - 1])) * 10 ** (len(m) - i))
print(int(m) - int(n)) | FOR VAR LIST FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR WHILE FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP 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())
matrix = []
for i in range(n):
matrix.append([int(i) for i in input().split()])
for i in range(len(matrix)):
if int(matrix[i][0] % matrix[i][1]) == 0:
print(0)
else:
print((int(matrix[i][0] / matrix[i][1]) + 1) * matrix[i][1] - matrix[i][0]) | 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 VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP 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... | for _ in range(int(input())):
num, target = map(int, input().split())
res = 0
power = 1
while sum(int(x) for x in str(num)) > target:
d = num // power % 10
add = power * (10 - d)
num += add
res += add
power *= 10
print(res) | 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 ASSIGN VAR NUMBER WHILE FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR VAR VAR VAR 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... | t = int(input())
for i in range(t):
a = list(map(int, input().split()))
b = a[0]
c = a[1]
r = 0
if b < c:
print(c - b)
continue
if b == c:
print(0)
continue
if b % c == 0:
print(0)
continue
r = b % c
r = c - r
print(r) | 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 NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER 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 divisible(a, b):
if a % b == 0:
res = 0
else:
c = a // b
c += 1
res = b * c - a
return res
t = int(input())
while t > 0:
a, b = map(int, list(input().split()))
print(divisible(a, b))
t -= 1 | FUNC_DEF IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR 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... | for _ in range(int(input())):
n, s = map(int, input().split())
if s >= n:
print(0)
continue
stringno = str(n)
temp_sum = 0
cnt = 0
for q in stringno:
temp_sum += int(q)
if temp_sum >= s:
break
cnt += 1
ord_sum = 0
for q in stringno:
... | 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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR 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... | for _ in range(int(input())):
n, s = map(int, input().split())
dn = str(n)
len_ = len(dn)
i, sum_ = 0, 0
while i < len_ and sum_ < s:
sum_ += int(dn[i])
i += 1
if i == len_ and sum_ <= s:
print(0)
elif sum_ == s and int("".join(dn[i:])) == 0:
print(0)
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 VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR 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... | t = int(input())
while t:
t -= 1
a, b = list(map(int, input().split()))
res = 0
if int(a % b) != 0:
if a > b:
r = int(a / b)
res = b * (r + 1) - a
elif a < b:
res = b - a
else:
res = 0
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR IF VAR VAR ASSIGN VAR BIN_OP 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... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def inlt():
return list(map(int, input().split()))
t = inp()
for x in range(0, t):
l = inlt()
a = l[0]
b = l[1]
if a % b == 0:
print(0)
elif a > b:
print(b - (a - b) % b)
else:
y = b - a
... | IMPORT 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 ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF 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... | t = int(input())
for e in range(t):
a, b = input().split()
a, b = int(a), int(b)
if a < b:
print(b - a)
elif a % b == 0:
print(0)
elif a > b:
x = a / b
x = int(x)
x += 1
b = b * x
b = int(b)
ans = b - a
print(ans) | 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 VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN 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... | for i in range(int(input())):
a, b = list(map(int, input().split()))
if a % b == 0:
print(0)
else:
d = a // b
rem = (d + 1) * b - a
print(rem) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 |
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
def get_user_input(n):
input_list = []
for i in range(n):
input_list.append(tuple(map(int, stdin.readline().rstrip().split())))
return input_list
n = int(input())
input_list = get_user_input(n)
for i in range(n):
remainder = input_list[i][0] % input_list[i][1]
if re... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL 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())
while t > 0:
m, n = map(int, input().split())
if m < n:
print(n - m)
elif m == n:
print(0)
elif m % n == 0:
print(0)
else:
x = m // n
ans = n * (x + 1) - m
print(ans)
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 EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER 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 solve():
def digit_sum(x):
res = 0
while x > 0:
res += x % 10
x //= 10
return res
n, s = map(int, input().split())
if digit_sum(n) <= s:
print(0)
return
for i in range(1, 20):
q = 10**i
r = q - n % q
n += r
... | FUNC_DEF FUNC_DEF ASSIGN VAR NUMBER 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 RETURN FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP 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 to_int(digits):
return int("".join(map(str, digits)))
def solve(cur, target_sum):
cur = [(ord(ch) - ord("0")) for ch in str(cur)]
cur = [0] + cur
copied = cur.copy()
if sum(cur) <= target_sum:
return 0
for i in range(len(cur) - 1, -1, -1):
copied[i] = 0
if copied[i ... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMB... |
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):
g = 1
a, b = map(int, input().split())
a = str(a)
d = sum(list(map(int, a)))
a = int(a)
k = 0
while d > b:
g *= 10
f = g - a % g
a += f
k += f
a = str(a)
d = sum(list(map(int, a)))
a = int(a)
prin... | 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 FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER 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... | t = int(input())
for _ in range(t):
lst = input().split()
s = int(lst[1])
n = int(lst[0])
st = lst[0]
sum1 = 0
pos = -1
sum2 = 0
for i in st:
sum2 += int(i)
if sum2 <= s:
print(0)
continue
for i in range(len(st)):
sum1 += int(st[i])
if sum1... | 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 ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL 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... | from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + "\n")
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda: stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())
def main():
t = int(R())
for x in range(t):
... | ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_DEF 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... | def main():
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
r = a // b
ans = (r + 1) * b - a
if ans == b:
ans = 0
print(ans)
main() | FUNC_DEF 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 ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL 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())
list1 = []
out = []
for x in range(t):
list1.append(list(map(int, input().split())))
if list1[x][0] % list1[x][1] == 0:
out.append(0)
else:
n = list1[x][1] - list1[x][0] % list1[x][1]
out.append(n)
for x in range(t):
print(out[x]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER VAR VAR NUMBER EXPR ... |
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... | tc = int(input())
def func(s):
x = 0
while s > 0:
x += s % 10
s = s // 10
return x
while tc > 0:
tc -= 1
n, s = input().split(" ")
if func(int(n)) <= int(s):
print(0)
continue
for i in range(1, len(n) + 1):
nn = int(n)
ex = 10**i - int(n[le... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER 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... | def solve(a, b):
move = 0
if a <= b:
move = b - a
return print(move)
elif a % b == 0:
return print(move)
else:
yu = a % b
move = b - yu
return print(move)
t = int(input())
for _n in range(0, t):
a, b = map(int, input().split(" "))
solve(a, b) | FUNC_DEF ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER RETURN FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN 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... | def func(b, c):
if b >= c:
d = b // c
if b % c != 0:
e = c * (d + 1)
return e - b
else:
return 0
else:
return c - b
t = int(input())
while t > 0:
a = input().split()
print(func(int(a[0]), int(a[1])))
t = t - 1 | FUNC_DEF IF VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN BIN_OP VAR VAR RETURN NUMBER RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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... | from sys import stdin
for _ in range(int(stdin.readline())):
s_str, t = stdin.readline().split()
ogs = int(s_str)
s = list(map(int, list(s_str)))
t = int(t)
d = sum(s)
if d <= t:
print(0)
else:
diff = d - t + 1
i = len(s) - 1
while diff > 0:
diff ... | 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 VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP 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... | for i in range(int(input())):
n, s = map(int, input().split())
n = str(n)
sum = 0
for j in range(len(n)):
sum += int(n[j])
if sum <= s:
print(0)
continue
result = ""
for j in range(len(n))[::-1]:
sum -= int(n[j])
result += str(9 - int(n[j]))
if... | 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 ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL 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 sum(n):
res = 0
for c in n:
res += int(c)
return res
t = int(input())
for i in range(t):
q = input().split()
n = [int(x) for x in q[0]]
s = int(q[1])
res = 0
i = len(n) - 1
while sum(n) > s:
res += (10 - int(n[i])) * 10 ** (len(n) - i - 1)
n[i] = "0"
... | FUNC_DEF 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE 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... | def vang(n):
d = 0
s = 0
while n:
d += 1
s += n % 10
n = n // 10
return [d, s]
t = int(input(""))
dig = []
for i in range(t):
dig.append(list(map(int, input().split())))
for i in dig:
n = i[0]
s = i[1]
num = list(str(n))
for j in range(len(num)):
num... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN LIST VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ASSIGN 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... | t = int(input())
for x in range(t):
number, s = input().split(" ")
s = int(s)
sum = 0
for i in number:
sum += int(i)
diff = sum - s
answer = ""
number = number[::-1]
number = list(number)
for key, i in enumerate(number):
if diff > 0 and int(i) > 0:
diff -=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR 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... | from sys import stdin
def min_moves(n: int, s: int):
moves = 0
power = 1
while sum(map(int, str(n))) > s:
d = n // power % 10
toAdd = power * (10 - d)
moves += toAdd
n += toAdd
power *= 10
return moves
t = int(stdin.readline())
for _ in range(t):
n, s = ma... | FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN 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... | for _ in range(int(input())):
l = [int(x) for x in input().split()]
a, b = l[0], l[1]
if a < b:
print(b - a)
elif a % b == 0:
print("0")
else:
print((a // b + 1) * b - a) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER 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()
l = [int(c) for c in n]
s = int(s)
if sum(l) <= s:
print(0)
continue
index = -1
total = 0
while total < s and index < len(l):
total += l[index + 1]
index += 1
print(10 ** (len(l) - index) - int(n[index:]... | 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 VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR ... |
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 getSod(n):
s = 0
while n > 0:
s += n % 10
n = n // 10
return s
T = int(input())
while T > 0:
A = [int(x) for x in input().split()]
n, s = A[0], A[1]
org_num = n
ans = -1
num = 1
for dig in range(1, 20):
sod = getSod(n)
if sod <= s:
an... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR 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 _ in range(t):
n, s = list(map(int, input().split()))
nsplit = list(map(int, list(str(n))))
def listToStr(intList):
return "".join(map(str, intList))
diff = sum(nsplit) - s
while diff > 0:
for i in range(len(nsplit)):
ind = -(i + 1)
if n... | 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 FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR WHILE VAR NUMB... |
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 numAdd(x, y):
if x < y:
return y - x
elif x % y != 0:
m = x % y
return y - m
else:
return 0
n = int(input())
for i in range(n):
a = list(map(int, input().strip().split()))[:2]
leastNum = numAdd(a[0], a[1])
print(leastNum) | FUNC_DEF IF VAR VAR RETURN BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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... | for _ in range(int(input())):
i, j = map(int, input().split())
if i >= j:
if i % j == 0:
print(0)
else:
print(j - i % j)
else:
print(abs(i - j)) | 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 EXPR FUNC_CALL VAR BIN_OP 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... | def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
for _ in range(int(input())):
n, s = map(int, input().split())
d = sum_digits(n)
ans = 0
if d <= s:
print("0")
continue
pw = 1
for i in range(18):
d = n // pw % 10
inc = ... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP 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_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR 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... | t = int(input())
output = []
for i in range(0, t):
a, b = list(map(int, input().split()))
if a < b:
output.append(str(b - a))
elif a % b == 0:
output.append("0")
else:
output.append(str(b - a % b))
for i in output:
print(i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR 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 fun(tmp):
ret = 0
while tmp > 0:
ret += tmp % 10
tmp //= 10
return ret
def main():
T = eval(input())
for cas in range(T):
n, s = map(int, input().split())
tmp = 1
ans = 0
rdy = 0
while n > 0:
num = fun(n) + rdy
bit... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF 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 NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL 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... | from sys import stdin
for _ in range(int(input())):
n, s = map(str, stdin.readline().split())
s = int(s)
a = [0]
for i in n:
a.append(int(i))
b = [0] * len(a)
i = len(a) - 1
while sum(a) > s:
b[i] = 10 - a[i]
a[i] = 0
a[i - 1] += 1
i -= 1
for i in... | 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 ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE 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... | def to_digits(n):
return list(map(int, str(n)))
def digits_to_int(digits):
return int("".join(map(str, digits)))
t = int(input())
for _ in range(t):
n, s = map(int, input().split())
digits = [0] + to_digits(n)
if sum(digits) <= s:
print(0)
continue
i = 1
while sum(digits[... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR 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 LIST NUMBER FUNC_CALL VAR VAR IF FUNC_CALL 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())
def addn(N, k):
val = 0
j = 1
for i in N[::-1]:
val += i * j
j *= 10
val += k
val = list(str(val))
val = [int(i) for i in val]
return val
def sumd(N):
ans = 0
for i in N:
ans += i
return ans
while T > 0:
T -= 1
N = input()
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN VAR WHILE VAR NUMBER VAR NUMBER 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... | a = int(input().strip())
s = 0
d = 0
e = 0
for i in range(a):
n, m = map(int, input().split())
if n % m == 0:
print("0")
else:
print(m - n % m) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL 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 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... | q = int(input())
ans = []
for _ in range(q):
S, n = map(int, input().split())
st = str(S)
length = len(st)
trigger = 0
flg = True
for i, s in enumerate(st, 1):
n -= int(s)
if n > 0:
trigger = i
elif n < 0:
flg = False
if flg:
res = 0
... | 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 ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN 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 main():
t = int(input())
for i in range(t):
a, b = list(map(int, input().split()))
Divisible(a, b)
def Divisible(a, b):
count = 0
if a % b == 0:
print("0")
return
else:
div = a // b
num = b * (div + 1)
diff = num - a
print(diff)
... | FUNC_DEF 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 EXPR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMB... |
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):
if a % b == 0:
print(0)
else:
print(b - a % b)
test = int(input())
for t in range(test):
ss = input().split()
a = int(ss[0])
b = int(ss[1])
solve(a, b) | FUNC_DEF IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR 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 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... | def min_del(a, b):
if a % b == 0:
return 0
return b * (a // b + 1) - a
n = int(input())
for i in range(n):
a, b = [int(x) for x in input().split()]
answ = min_del(a, b)
print(answ) | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR 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 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())
while t > 0:
t -= 1
a, b = [int(i) for i in input().split(" ")]
print((b - (a - b) % b) % b) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP 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... | def digit_sum(n):
result = 0
while n > 0:
result += n % 10
n //= 10
return result
def moves(n, s):
if digit_sum(n) <= s:
return 0
m = n
i = 1
while digit_sum(m) > s:
m = (n // 10**i + 1) * 10**i
i += 1
return m - n
t = int(input())
for i in ran... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN NUMBER ASSIGN VAR VAR 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 VAR NUMBER RETURN BIN_OP VAR VAR ASSIGN 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
cnt = 1
num_inputs = 0
for line in sys.stdin:
if cnt == 1:
cnt += 1
continue
a, b = line.split(" ")
a, b = int(a), int(b)
print((b - a % b) % b) | IMPORT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP 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... | for _ in range(int(input())):
n, s = map(str, input().split())
s = int(s)
f = [int(i) for i in n]
r, j = "", -1
m, d, o = 0, "", 0
for i in range(len(n)):
if o == 0:
m += int(n[i])
if m >= s:
o = 1
j = i
break
if... | 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 ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR STRING NUMBER ASSIGN VAR VAR VAR NUMBER STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR FUNC_CALL 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... | t = int(input())
a = []
b = []
for i in range(t):
div = input().split()
div = [int(i) for i in div]
a.append(div[0])
b.append(div[1])
i = 0
while i < t:
print((b[i] - a[i] % b[i]) % b[i])
i += 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR 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... | from sys import gettrace, stdin
if not gettrace():
def input():
return next(stdin)[:-1]
def main():
def solve():
a, b = map(int, input().split())
rem = a % b
if rem == 0:
print(0)
else:
print(b - rem)
q = int(input())
for _ in range(q... | IF FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF FUNC_DEF 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 NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXP... |
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())):
l = list(map(int, input().split()))
a, b = l[0], l[1]
if a % b == 0:
print(0)
continue
print(b - a % b) | 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 VAR NUMBER VAR NUMBER 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... | def bfs(n, s):
for i in range(0, 10**18):
var = n + i
sum = 0
for i in str(var):
sum += int(i)
if sum <= s:
return var - n
t = int(input())
for _ in range(t):
n, s = map(int, input().split())
no = str(n)
sum = 0
for i in no:
sum += in... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL 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_CALL VAR 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... | lis = []
for i in range(int(input())):
num1, num2 = map(int, input().split())
if num2 > num1:
lis.append(num2 - num1)
elif num1 % num2 == 0:
lis.append(0)
else:
lis.append(num2 - num1 % num2)
for i in lis:
print(i) | ASSIGN VAR LIST 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 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 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())
if b == 0:
print(0)
elif a == 0:
print(b)
elif b > a:
print(b - a)
continue
elif a // b == a / b:
print("0")
else:
k = a // b + 1
print(k * b - a) | 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 NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING 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... | def solution():
n, s = map(int, input().split())
x = n
l = []
while x > 0:
l.append(x % 10)
x //= 10
l.reverse()
l = [0] + l
i = len(l) - 1
while sum(l) > s:
l[i] = 0
i -= 1
l[i] += 1
p = len(l) - 1
num = 0
for i in range(len(l)):
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER 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... | from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
n, s = map(int, stdin.readline().split())
n = [int(x) for x in list(str(n))]
n = n[::-1]
if sum(n) <= s:
print(0)
continue
ans = 0
sm = sum(n)
for i in range(len(n)):
if sm <= 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 VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR 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 digsum(nc, s):
sodfun = 0
while nc > 0:
sodfun += nc % 10
nc = nc // 10
if sodfun <= s:
return True
else:
return False
for t in range(int(input())):
n, s = [int(k) for k in input().split()]
sod = 0
dig = 0
nc = n
while nc > 0:
sod += nc %... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER 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 ASSIGN VAR VAR WHILE VAR NUMBER 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:
n, target_sum = map(int, input().split())
digits = [int(char) for char in str(n)]
digits.reverse()
cur_sum = sum(digits)
moves = 0
for index in range(0, len(digits)):
if cur_sum <= target_sum:
break
digit = digits[index]
cur_sum -... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR 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... | def digits(n):
r = []
while n > 0:
r.append(n % 10)
n = n // 10
return r
def sumArray(d):
r = 0
for i in range(len(d)):
r += d[i]
return r
T = int(input())
for t in range(T):
st = input().split()
n = int(st[0])
s = int(st[1])
d = digits(n)
i = 0
... | FUNC_DEF ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN 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... | a = int(input())
l = []
while a:
l.append([int(x) for x in input().split()])
a -= 1
for i in l:
if i[0] % i[1] == 0:
print(0)
else:
print((i[1] - i[0]) % i[1]) | 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 VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER 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... | def sum_digits(n):
n = str(n)
return sum(map(int, n))
testes = int(input())
for i in range(testes):
a, b = input().split()
a, b = int(a), int(b)
v = a
d = 1
while sum_digits(a) > b:
c = a // d % 10
a += -c % 10 * d
d *= 10
print(a - v) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR 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 ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_O... |
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):
f = 0
a, b = map(int, input().split())
if a % b == 0:
print(0)
f = 1
if not f:
c = a + (b - a % b)
print(c - a) | 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 IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP 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... | n = int(input())
for q in range(n):
b = []
for a in input().split():
b.append(int(a))
if b[0] % b[1] != 0:
print(b[1] - b[0] % b[1])
else:
print(0) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER 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... | def check_sum(x):
sum = 0
for i in str(x):
sum += int(i)
return sum
t = int(input())
for _ in range(t):
n, s = [int(i) for i in input().split()]
if check_sum(n) <= s:
print(0)
continue
old_n = n
digit = n % 10
pow = 1
ans = 0
for _ in range(18):
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL 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 VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN 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... | for _ in range(int(input())):
a, b = input().split()
b, s, tu, ts = int(b), 0, "", 0
same = False
for m in a:
ts += int(m)
if s < b:
s += int(m)
if s == b and m != "9":
same = True
if s >= b:
tu += m
else:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER STRING NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING ASSIGN VAR NUMBER IF VAR VAR VAR VAR VAR VAR IF VAR 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... | def sum_dig(n):
sm = 0
while n > 0:
sm += n % 10
n //= 10
return sm
for _ in range(int(input())):
n, s = map(int, input().split())
xs = sum_dig(n) - s
cnt, pv = 0, 1
while True:
m = (10 - n % 10) * pv
if sum_dig(n) <= s:
break
else:
... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP 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_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER WHILE NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP 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... | a = []
res = []
for i in range(int(input())):
a.append(list(map(int, input().split())))
for i in a:
if i[0] % i[1] == 0:
print(0)
else:
print(i[1] - i[0] % i[1]) | ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL 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... | T = int(input())
while T:
n, s = input().split()
n = int(n)
s = int(s)
tmp = n
sum = 0
while tmp:
sum += tmp % 10
tmp //= 10
x = 0
tmp = n
idx = 1
while sum > s:
i = idx
while tmp:
num10 = 10**i
if tmp % num10:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR WHILE VAR ASSIGN 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 sumdigits(x):
sumi = 0
while x > 0:
sumi += x % 10
x = x // 10
return sumi
def closest(x, s):
if sumdigits(x) <= s:
return x
if x % 10 == 0:
return closest(x // 10, s) * 10
else:
return closest(x // 10 + 1, s) * 10
t = int(input())
for you in range... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN VAR IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR 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 test in range(int(input())):
A = list(map(int, input().split()))
div = int(A[0] / A[1])
if A[0] % A[1] == 0:
print("0")
else:
print(A[1] * (div + 1) - A[0]) | 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 FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP 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... | t = int(input())
def sumfunc(n):
res = 0
while n > 0:
res += n % 10
n = n // 10
return res
for k in range(t):
n, s = map(int, input().split())
if sumfunc(n) <= s:
ans = 0
else:
n1 = n
ans = 0
p = 1
for i in range(18):
lastdi... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN 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... | for i in range(int(input())):
a = list(map(int, input().strip().split()))[:2]
if a[0] % a[1] == 0:
print(0)
else:
c = int(a[0] / a[1]) + 1
c = c * a[1]
d = c - a[0]
print(d) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_OP 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... | for i in range(int(input())):
x, y = input().split()
x = int(x)
y = int(y)
if x % y != 0:
z = x // y + 1
z = z * y
print(z - x)
else:
print(0) | 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 IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL 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... | from sys import *
t = int(stdin.readline())
for _ in range(t):
n, s = map(int, stdin.readline().split())
a = []
cnt = 0
i = n
while i > 0:
a.append(i % 10)
i = i // 10
cnt += 1
a = a[::-1]
sum = a[0]
cnt1 = 1
f = 0
f1 = 0
cnt2 = 0
for i in range(1... | 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 LIST ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN 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 solve(ar, s):
sumi = sum(ar)
ans = 0
for i in range(len(ar) - 1, 0, -1):
if sumi > s:
if ar[i] == 0:
continue
sumi -= ar[i]
ans += 10 ** (len(ar) - 1 - i) * (10 - ar[i])
ar[i] = 0
ptr = i - 1
while ar[ptr] ==... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR IF VAR VAR NUMBER VAR VAR VAR VAR BIN_OP BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP NUMBER VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER 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... | t = int(input())
while t > 0:
number = input()
numberlist = number.split(" ")
a = int(numberlist[0])
b = int(numberlist[1])
count = 0
if a % b == 0:
print(count)
elif a > b:
numberdivide = int(a / b)
count = (numberdivide + 1) * b - a
print(count)
elif a <... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR 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 IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR 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... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def inlst():
return list(map(int, input().split()))
def insr():
s = input()
return list(s[: len(s) - 1])
def invr():
return map(int, input().split())
def solve(n, s):
d = list(map(int, str(n)))
d.insert(0, 0)
... | IMPORT 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_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN 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... | def checkSum(num, s):
temp = str(num)
c = 0
for i in temp:
c += int(i)
if c <= s:
return True
return False
def solve(num, s):
temp = num
c = 0
while num != 0:
num = num // 10
c += 1
num += 1
if checkSum(num, s):
break
num ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_O... |
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
pprint = lambda s: print(" ".join(map(lambda x: str(x), s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
mod = 1000000007
for i in range(int(input())):
n, s = map(int, input().split())
ans = 0
step = 1
while sum(list(map(int, list(str(n))))) > s:
x = n % 10
if ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN 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 NUMBER ASSIGN VAR NUMBER WHILE 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):
ab = list(map(int, input().split()))
if ab[0] % ab[1] != 0:
count = (ab[0] // ab[1] + 1) * ab[1] - ab[0]
else:
count = 0
print(count) | 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 IF BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER VAR NUMBER VAR NUMBER 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... | t = int(input())
while t > 0:
t = t - 1
n, m = map(int, input().split())
if n % m == 0:
print(0)
else:
p = int(n / m)
p = p + 1
m = p * m
print(m - n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP 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 ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP 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... | tc = int(input())
for jk in range(tc):
a = input().split(" ")
for lm in range(len(a)):
a[lm] = int(a[lm])
if a[0] % a[1] == 0 and a[0] >= a[1]:
print(0)
else:
s = a[0] // a[1]
chai = s + 1
yv = chai * a[1]
print(yv - a[0]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR 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... | t = int(input())
for i in range(t):
n, s = map(int, input().split())
total = sum(list(map(int, str(n))))
c = 0
moves = 0
while total > s:
dec = 10 - n % 10
moves += 10**c * dec
n += dec
n //= 10
total = sum(list(map(int, str(n))))
c += 1
print(move... | 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 VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER 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... | def check(li, n):
for ele in li:
moves = 0
a, b = ele[0], ele[1]
if a % b == 0:
moves = 0
else:
c = a // b
c += 1
d = b * c
moves = d - a
print(moves)
return
n = int(input())
li = [[int(j) for j in input().spli... | FUNC_DEF FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR RETURN ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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... | def moves(n, k):
total = 0
for j in range(len(n)):
total += int(n[j])
if total <= k:
return 0
total = 0
n = "0" + n
i = 1
while total + int(n[i]) < k:
total += int(n[i])
i += 1
num = (int(n[:i]) + 1) * 10 ** (len(n) - i)
return num - int(n)
T = int(i... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER 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... | def ok(a, b):
cnt = 0
for x in str(a):
cnt += int(x)
return cnt <= b
t = int(input())
for i in range(t):
n, s = map(int, input().split())
if ok(n, s):
print(0)
else:
ans = 0
ten = 1
while not ok(n, s):
cur = n % 10**ten
ans += (10... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN 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 IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE 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... | s = int(input())
def fun(a, b):
if a % b == 0:
return a
else:
return b * (a // b + 1)
ans = [0] * s
for i in range(s):
string = input()
f = string.split(" ")
ans[i] = fun(int(f[0]), int(f[1])) - int(f[0])
for i in range(s):
print(ans[i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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... | for _ in range(int(input())):
n, s = map(int, input().split())
l = list(str(n))
p = len(l)
su = 0
for ele in l:
su += int(ele)
if su <= s:
print(0)
else:
i = 0
q = 0
while i < p and q < s:
q += int(l[i])
i += 1
ne = 10 *... | 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 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 WHILE 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... | t = int(input())
for i in range(t):
s = input().split()
a = int(s[0])
b = int(s[1])
x = a / b
y = a // b
if x == y:
print("0")
else:
r = a % b
print(b - r) | 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 ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP 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... | def sd(n):
sm = 0
while n > 0:
sm += n % 10
n = n // 10
return sm
def lis(n):
l = []
while n > 0:
l.append(n % 10)
n = n // 10
l.reverse()
return l
T = int(input())
for t in range(T):
n, s = map(int, input().split())
sm = sd(n)
n_s = lis(n)
... | 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 LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN 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
try:
sys.stdin = open("input.in", "r")
sys.stdout = open("output.out", "w")
except:
pass
finally:
for i in range(int(input())):
a, b = map(int, input().split(" "))
if a % b == 0:
print(0)
else:
print(b - a % b) | IMPORT ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING 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... | n = int(input())
lst = []
for i in range(n):
a, b = map(int, input().split())
d = a % b
if a < b:
lst.append(b - a)
elif d != 0:
r = (a // b + 1) * b - a
lst.append(r)
else:
lst.append(0)
for i in range(n):
print(lst[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 ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR 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... | def getSumOfDigits(num: int) -> int:
ans = 0
while num:
digit = num % 10
num //= 10
ans += digit
return ans
def decreaseTheSumOfDigits(n: int, s: int) -> int:
ans = 0
i = 1
while getSumOfDigits(n) > s:
summand = 10**i - n % 10**i
n += summand
ans... | FUNC_DEF VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR RETURN VAR VAR FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR BIN_OP VAR BIN_OP NUMBER VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR VAR ASSIGN 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... | q = int(input())
def fun(a, b):
s = a % b
if s == 0:
print(0)
else:
print(b - s)
while q:
q -= 1
a, b = map(int, input().split())
fun(a, b) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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... | def main():
t = int(input())
for test in range(t):
raw_in = input()
ab = raw_in.split(" ")
a = int(ab[0])
b = int(ab[1])
m = b - a % b
if a % b == 0:
m = 0
print(m)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.