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 get(*arg):
if arg[0] == 0:
cnt = int(input())
flag = 1
else:
cnt = 1
flag = 0
lst = list()
for i in range(cnt):
lst2 = list()
for ii in range(len(arg) - flag):
if arg[ii + flag] == 1:
t = input().split()
tmp ... | FUNC_DEF IF VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR IF VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR 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... | test = False
test_cases = [[10, 4], [13, 9], [100, 13], [123, 456], [92, 46]]
def solve(input_data):
a, b = input_data
print(0 if a % b == 0 else b - a % b)
if test:
n = len(test_cases)
while n > 0:
solve(test_cases[-n])
n -= 1
else:
n = int(input())
while n > 0:
solv... | ASSIGN VAR NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER FUNC_DEF ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR BIN_OP VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR 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... | t = int(input())
for i in range(t):
a, b = map(int, input().split(" "))
if a % b == 0:
print(0)
continue
if a > b:
num = a
num = num // b + 1
print(b * num - a)
else:
print(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 STRING IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR 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... | for i in range(int(input())):
a, b = map(int, input().split())
if b > a:
print(b - a)
elif b == a or a % b == 0:
print(0)
else:
y = a % b
print(b - y) | 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 VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER 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 go():
a, b = map(int, input().split())
if a % b == 0:
return 0
else:
return b - a % b
t = int(input())
ans = []
for _ in range(t):
ans.append(str(go()))
print("\n".join(ans)) | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN BIN_OP VAR BIN_OP 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 FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL 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 res(n, s):
a = str(n)
b = str(s)
n_len = len(a)
s_len = len(b)
san = n
sandar = []
for i in range(n_len):
sandar.append(san % 10)
san = san // 10
sum_n = sum(sandar)
if sum_n <= s:
return 0
else:
k = s
total = 0
for i in range(n... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR RETURN NUMBER ASSIGN VAR VAR 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 i in range(x):
maxi = [int(x) for x in input().split()]
if maxi[0] <= maxi[1]:
print(maxi[1] - maxi[0])
elif maxi[0] % maxi[1] == 0:
print(0)
else:
print(maxi[1] - maxi[0] % maxi[1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER 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 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... | t = int(input())
def f(temp_n):
total = 0
while temp_n > 0:
total += temp_n % 10
temp_n = temp_n // 10
return total
for _ in range(t):
n, target = map(int, input().split())
pw = 1
res = 0
while f(n) > target:
digit = n // pw % 10
add = pw * ((10 - digit) %... | 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP 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... | def integer(array):
for i in range(len(array)):
array[i] = int(array[i])
return array
N = int(input())
inputs = []
for i in range(N):
inputs.append(integer(str(input()).split(" ")))
def div(a, b):
if a % b == 0:
return 0
else:
return b - a % b
for i in inputs:
print... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR RETURN 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 FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN 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 _ in range(int(input())):
n, s = map(str, input().split())
s = int(s)
n = list(n)
q = 0
for i in range(len(n)):
q += int(n[i])
if q <= s:
print(0)
elif int(n[0]) < s:
a = [n[0]]
r = int(n[0])
m = 0
for i in range(1, len(n)):
r +... | 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 NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER 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... | t = int(input())
while t > 0:
val = list(map(int, input().split(" ")))
a = val[0]
b = val[1]
counter = 0
if a % b != 0:
quotient = a // b
pro = b * (quotient + 1)
counter = pro - a
print(counter)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR 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_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... | for _ in range(int(input())):
a, b = map(int, input().split())
if b > a:
print(b - a)
elif a % b == 0:
print(0)
else:
i = a // b + 1
num_up = b * i - a
print(num_up) | 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 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(""))
i = 0
while i < t:
x, y = [int(x) for x in input().split()]
if x % y != 0:
print((x // y + 1) * y - x)
else:
print(0)
i += 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE 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 BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL 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 sums(n):
res = 0
while n > 0:
res += n % 10
n = n // 10
return res
t = int(input())
while t:
t -= 1
n, s = map(int, input().split())
if sums(n) <= s:
print(0)
continue
pw = 1
ans = 0
for i in range(18):
dig = n // pw % 10
add = pw... | 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 VAR NUMBER 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 FOR 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... | n = int(input())
for k in range(n):
entrada = list(map(int, input().split(" ")))
a = entrada[0]
b = entrada[1]
if a % b == 0:
print(0)
elif a < b:
print(b - a)
else:
d = a // b
d += 1
print(d * b - a) | 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 STRING 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 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... | T = int(input())
ret = []
for t in range(T):
n, s = input().split()
s = int(s)
raw = int(n)
n = list(n)
n = list(map(int, n))
score = sum(n)
ans = 0
keta = 0
while score > s:
if n[len(n) - 1 - keta] == 0:
keta += 1
continue
if n[len(n) - 1 - ke... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST 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 FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER W... |
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())
ls = []
for i in range(t):
a, b = map(int, input().split())
if a >= b and a % b == 0:
rs = 0
else:
c = a // b
c = (c + 1) * b
rs = c - a
ls.append(rs)
for o in ls:
print(o) | 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 VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR 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 solve(a, b):
val = a % b
if val == 0:
return 0
else:
return b - val
t = int(input())
for ti in range(t):
a, b = map(int, input().split())
res = solve(a, b)
print(res) | FUNC_DEF ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER RETURN NUMBER 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 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... | n = int(input())
while n > 0:
n = n - 1
a, b = map(int, input().split())
if a < b:
print(b - a)
elif a % b == 0:
print("0")
else:
s = int(a / b)
x = (s + 1) * b - a
print(x) | 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 VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP 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... | t = int(input())
for _ in range(t):
n, s = input().split()
(*n,) = map(int, n)
n = [0] + n
s = int(s)
n_sum = sum(n)
ans = []
ind = 0
while n_sum > s:
if n[-1 - ind] > 0:
ans.append(10 - n[-1 - ind])
n[-1 - ind] = 0
for i in range(len(n)):
... | 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 VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF VAR BIN_OP NUMBER 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())
for _ in range(t):
n, s = map(int, input().split())
arr = list(map(int, str(n)))
currSum = sum(arr)
i = len(arr) - 1
while currSum > s:
while arr[i] == 0:
i -= 1
currSum -= arr[i]
arr[i] = 0
i -= 1
while i >= 0 and arr[i] == 9:
... | 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 VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR WHILE VAR VAR NUMBER VAR NUMBER VAR VAR VAR 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... | from sys import stdin
def steps(a, b):
if a < b:
return b - a
remainder = a % b
if remainder == 0:
return 0
return b - remainder
def main():
data = stdin.readline().strip()
n = int(data)
for i in range(n):
a, b = map(int, stdin.readline().strip().split())
... | FUNC_DEF IF VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER RETURN NUMBER RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR 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... | def main():
n = int(input())
for i in range(n):
a, b = tuple(map(int, input().split()))
if a % b == 0:
print(0)
else:
print(b - a if b > a else b * (a // b + 1) - a)
main() | 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 IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER 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... | test = int(input())
my_list = []
while test != 0:
a, b = [int(a) for a in input().split()]
moves = 1
if a % b == 0:
moves = 0
else:
rem = a % b
moves = b - rem
value = str(moves)
my_list.append(value)
test -= 1
for i in my_list:
print(i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER 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... | import sys
def read_line():
return sys.stdin.readline()[:-1]
def read_int():
return int(sys.stdin.readline())
def read_int_line():
return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
a, b = read_int_line()
if a % b == 0:
print(0)
else:
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP 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())):
n, m = map(int, input().split())
if n < m:
print(m - n)
else:
print(((n // m + 1) * m - n) % m) | 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 EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER 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 = list(map(int, input().split()))
c = 0
if a % b == 0:
print(0)
continue
elif a < b:
print(b - a)
continue
else:
print(b - a % b)
continue | 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 NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR 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())
for x in range(n):
a, b = map(int, input().split(" "))
r = a % b
if r == 0:
print(0)
elif a < b:
print(b - a)
elif a > b:
print(b - r) | 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 STRING ASSIGN VAR BIN_OP VAR VAR IF 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 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(0, int(input())):
p, z = input().split()
if int(p) % int(z) == 0:
print(0)
else:
print(int(z) - int(p) % int(z)) | FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR BIN_OP FUNC_CALL 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... | N = int(input())
for _ in range(0, N):
a, b = list(map(int, input().split(" ")))
if a < b:
print(b - a)
elif a % b == 0:
print(0)
else:
tmp = int(a / b) + 1
print(tmp * b - a) | 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 STRING IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR B... |
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 = []
x = int(input())
for _ in range(x):
a, b = list(map(int, input().split()))
c = a % b
if c != 0:
d = b - c
l.append(d)
elif c == 0:
d = 0
l.append(d)
for k in l:
print(k) | ASSIGN VAR LIST 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 BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FOR 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 kek():
string = input()
n, s = list(map(int, string.split()))
k = 0
summa = sum(map(int, list(str(n))))
delitel = 10
while summa > s:
shagi = delitel - n % delitel
k += shagi
delitel *= 10
n += shagi
summa = sum(map(int, list(str(n))))
print(k)
t... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL 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... | import sys
input = sys.stdin.read()
data = list(map(int, input.split()))
T = int(data[0])
it = 1
while T > 0:
a = data[it]
b = data[it + 1]
if a % b == 0:
print(0)
else:
next_num = b * (a // b + 1)
print(next_num - a)
it += 2
T -= 1 | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP 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... | q = int(input())
for i in range(q):
a, b = map(int, input().split())
s = 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 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... | for i in range(int(input())):
a, b = map(int, input().split())
c = a % b
if c > 0:
print(b - c)
continue
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 EXPR FUNC_CALL VAR BIN_OP 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... | def check(n, b):
s, x = str(n), 0
for i in s:
x += int(i)
if x <= b:
return 1
else:
return 0
for p in range(int(input())):
a, b = map(int, input().split())
if check(a, b):
print(0)
elif int(str(a)[0]) < b:
s = int(str(a)[0])
for i in range(le... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR 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 FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF 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... | num_tests = input()
num_tests = int(num_tests)
def divisible_move(var1, var2):
cnt = 1
mod = var1 % var2
if mod == 0:
return 0
else:
return var2 - mod
for i in range(num_tests):
var1, var2 = input().split(" ")
var1 = int(var1)
var2 = int(var2)
answer = divisible_move(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER RETURN NUMBER RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL 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... | from sys import stdin
def func():
return
for _ in range(int(stdin.readline())):
a, b = map(int, stdin.readline().split())
if a % b == 0:
print(0)
else:
print(b - a % b) | FUNC_DEF RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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... | a = int(input())
for j in range(a):
n, x = [int(i) for i in input().split()]
if n % x:
print((int(n / x) + 1) * x - n)
else:
print(0) | 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 BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER 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())
bl = []
for i in range(t):
tempo = input()
bl.append(tempo)
def sdigits(n):
sum = 0
for i in n:
sum += int(i)
return sum
for i in range(t):
s1 = bl[i]
s1 = s1.split()
n = s1[0]
s = int(s1[1])
if sdigits(n) <= s:
print(0)
else:
temp... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER 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... | def iin():
return int(input())
def lin():
return list(map(int, input().split()))
def main():
t = iin()
while t:
t -= 1
n, s = input().split()
s = int(s)
n = list(map(int, n))
sm = sum(n)
ans = 0
n = n[::-1]
ch = 0
pv = 0
... | 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 WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR 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... | n = int(input())
x = []
y = []
for i in range(n):
a, b = map(int, input().split())
x.append(a)
y.append(b)
for j in range(len(x)):
if x[j] % y[j] != 0:
print(y[j] - x[j] % y[j])
else:
print("0") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR 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... | import sys
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 map(int, input().split())
def solve(a, b):
r = a % b
if r == 0:
return 0
else... | 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 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... | import sys
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 map(int, input().split())
t = inp()
for idx in range(0, t):
[a, b] = invr()
if a % b == 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 ASSIGN VAR FUNC_CALL VAR FOR 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())
i = 0
x = []
while i < n:
p = input()
x.append(p)
i = i + 1
for er in x:
we = er.split()
if int(we[0]) < int(we[1]):
print(int(we[1]) - int(we[0]))
elif int(we[0]) % int(we[1]) == 0:
print(0)
elif int(we[0]) > int(we[1]):
print((int(we[0]) // int(we[1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER 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 make_div(a, b):
if a % b == 0:
return 0
return b * (a // b + 1) - a
for i in range(int(input())):
a, b = map(int, input().split())
print(make_div(a, b)) | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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... | def aa(a, b, count):
if a % b == 0 or a == b:
count = 0
elif a < b:
count = b - a
else:
count = b - a % b
print(count)
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
count = 0
aa(a, b, count) | FUNC_DEF IF BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR 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 VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 get_result(a, b):
print((b - a % b) % b)
t = int(input())
for i in range(t):
a, b = input().split()
a, b = int(a), int(b)
get_result(a, b) | FUNC_DEF EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP 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 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 sol(x, y):
c = 0
if x % y == 0:
return c
elif x > y:
c = y * (x // y + 1) - x
return c
else:
c = y - x
return c
for i in range(int(input())):
a, b = [int(x) for x in input().split(" ")]
print(sol(a, b)) | FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER RETURN VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN VAR ASSIGN VAR BIN_OP 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 STRING 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... | n = int(input())
while n:
n -= 1
a, b = input().split()
a, b = int(a), int(b)
k = a // b
if a % b == 0:
print(0)
else:
print(b * (k + 1) - a) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR BIN_OP VAR NUMBER 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 == 0:
print(0)
else:
e = a // b
f = b * e
d = f + b
res = d - a
print(res) | 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 BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP 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... | for _ in range(int(input())):
n, x = map(int, input().split())
s = list(str(n))
c = 0
ss = len(s)
for i in s:
c += int(i)
if c <= x:
print(0)
else:
for i in range(len(s) - 1, 0, -1):
if s[i] == "0":
continue
if c <= x:
... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP 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... | test = int(input())
moves = list()
a = list()
b = list()
for i in range(test):
x, y = map(int, input().split(" "))
a.append(x)
b.append(y)
if a[i] % b[i] != 0:
add = (int(a[i] / b[i]) + 1) * b[i] - a[i]
moves.append(add)
else:
moves.append("0")
print(*moves, sep="\n") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP 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())
p = []
for i in range(t):
h = list(map(int, input().split()))
p.append(h)
for i in range(t):
if p[i][0] % p[i][1] != 0:
print(p[i][1] - p[i][0] % p[i][1])
else:
print(p[i][0] % p[i][1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER 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... | j = int(input())
ar = []
for i in range(0, j):
y = input().split(" ")
a = int(y[0])
b = int(y[1])
if a % b == 0:
ar.append(0)
else:
if a < b:
ar.append(b - a)
continue
tjk = int(a / b)
tjk += 1
ar.append(b * tjk - a)
for i in ar:
pr... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR 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 IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN 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... | def main():
test = int(input())
for t in range(test):
l = [int(i) for i in input().split(" ")]
a = l[0]
b = l[1]
if a % b == 0:
print(0)
else:
temp = (a // b + 1) * b - a
print(temp)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR EX... |
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 = list()
for i in range(n):
l.append(list(map(int, input().split(" "))))
len = len(l)
for i in range(len):
c = l[i][0] % l[i][1]
if c == 0:
print(0)
continue
c = l[i][1] - c
print(c) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING 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 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... | for _ in range(int(input())):
n, s = map(int, input().split())
new = list(str(n))
sm = 0
ans = 0
for i in new:
sm += int(i)
if sm > s:
step = 0
for i in range(len(new) - 1, -1, -1):
if sm > s:
step += (10 - int(new[i])) * pow(10, len(new) - 1 -... | 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 NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER 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... | n = int(input())
list = []
for i in range(n):
x, y = [int(j) for j in input().split()]
if x % y == 0:
k = 0
elif x % y != 0:
k = y - x % y
list.append(k)
for i in list:
print(i, end="\n") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER 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 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... | val = int(input())
liste = []
for _ in range(val):
a, b = [int(x) for x in input().split()]
liste.append((b - a % b) % b)
for x in liste:
print(x) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST 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 VAR BIN_OP VAR 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... | _1 = "236a"
_2 = "339a"
_3 = "266a"
_4 = "96a"
_5 = "236a"
_6 = "281a"
_7 = "546a"
_8 = "116a"
_9 = "977a"
_10 = "266b"
_11 = "110a"
_12 = "41a"
_13 = "734a"
_14 = "133a"
_15 = "467a"
_16 = "158a"
_17 = "677a"
_18 = "580a"
_19 = "344a"
_20 = "1030a"
_21 = "705a"
_22 = "318a"
_23 = "479a"
_24 = "486a"
_25 = "61a"
_26 = ... | ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STR... |
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())
cases = []
def func(n, s):
for i in range(len(n)):
digit = int(n[i])
if s > digit:
s -= digit
elif digit == s:
if i == len(n) - 1:
return 0
elif all([(v == "0") for v in n[i + 1 :]]):
return 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR VAR IF VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR STRING VAR VAR BIN_OP VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP 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... | from sys import gettrace, stdin
if gettrace():
inputi = input
else:
def input():
return next(stdin)[:-1]
def inputi():
return stdin.buffer.readline()
def solve():
n, s = input().split()
s = int(s)
nn = [0] + list(map(int, n))
if sum(nn) < s:
print(0)
retu... | IF FUNC_CALL VAR ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN 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... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, s = map(int, input().split())
N = []
for i in str(n):
N.append(int(i))
N.reverse()
N.append(0)
ans = 0
for i in range(len(str(n))):
if sum(N) <= s:
break
if N[i] == 0:
... | 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 LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR 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... | for t in range(int(input())):
a, b = map(int, input().split())
if a % b == 0:
print(0)
else:
q = a // b + 1
n = q * b
print(n - 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 BIN_OP VAR VAR NUMBER EXPR FUNC_CALL 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 |
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 = [int(x) for x in input().split()]
if a <= b:
print(b - a)
else:
lower = int(a / b)
if a % b == 0:
print("0")
else:
goal = b * (lower + 1)
print(goal - a)
t = t - 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL 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... | t = int(input())
for _ in range(t):
a, b = input().strip().split()
a, b = int(a), int(b)
remain = a % b
if remain == 0:
print(remain)
else:
print(b - remain) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR 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... | def do2(n, s):
pass
def do():
q = int(input())
for _ in range(q):
a = [0] * 30
res = [0] * 30
n, s = input().split()
n = n[::-1]
for i in range(len(n)):
a[i] = int(n[i])
s = int(s)
i = 0
while sum(a) > s:
if a[i] > 9:
... | FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR 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... | N = int(input())
for _ in range(N):
data = input()
split = data.split()
a = int(split[0])
b = int(split[1])
if a % b == 0:
print(0)
else:
print(b - a % b) | 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 FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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... | k = int(input())
def sum_digits(n):
s = 0
while n > 0:
s += n % 10
n //= 10
return s
for _ in range(k):
n, s = map(int, input().strip().split(" "))
m = 0
r = 1
while sum_digits(n) > s:
d = 10 - n % 10
n += d
m += d * r
r *= 10
n //=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP 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 divisibility(a, b):
if a < b:
return b - a
elif a % b == 0:
return 0
else:
return b - a % b
t = int(input())
for t_itr in range(t):
arr = list(map(int, input().rstrip().split()))
a = int(arr[0])
b = int(arr[1])
result = divisibility(a, b)
print(result) | FUNC_DEF IF VAR VAR RETURN BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN 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 solver(n, x):
m = list(map(lambda x: int(x), str(n)))
res = 0
pw = 1
if sum(m) <= x:
return res
for i in range(18):
dig = n // pw % 10
add = (10 - dig) % 10 * pw
n += add
res += add
m = list(map(lambda x: int(x), str(n)))
if sum(m) <= x:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR VAR VAR VAR 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... | t = int(input())
for i in range(0, t):
array = input().split()
n = int(array[0])
m = int(array[1])
ans = n / m
div = n % m
print((m - div) % m) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER 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 EXPR FUNC_CALL VAR BIN_OP 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... | t = int(input())
data = [0] * t
ans = 0
for i in range(t):
data = list(map(int, input().split()))
if data[0] % data[1] != 0:
ans = data[1] - data[0] % data[1]
print(ans)
ans = 0 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER 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 VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR 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... | t = int(input())
powers_of_ten = [(10**i) for i in range(163)]
for i in range(t):
string = input()
n, s = string.split()[0], int(string.split()[1])
n_int = int(n)
start = n_int
index = len(n) - 1
while True:
sum = 0
for j in n:
sum += int(j)
if sum <= s:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE 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... | n = int(input())
for a in range(n):
x = [int(i) for i in input().split()]
if x[0] % x[1] == 0:
print(0)
continue
res = int(x[0] / x[1])
print((res + 1) * x[1] - x[0]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP 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 solve():
s, n = [i for i in input().split()]
n = int(n)
i = 0
ok = True
while i < len(s):
if n > int(s[i]):
n -= int(s[i])
else:
ok = False
break
i += 1
if ok:
print(0)
return
if int(s[i]) == n:
tmp = 0
... | FUNC_DEF ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER IF VAR EXPR FUNC_CALL VAR NUMBER RETURN IF FUNC_CALL VAR VAR VAR VAR ASSIGN 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())
ans = []
for Num in range(t):
ab = input()
a = int(ab.split(" ")[0])
b = int(ab.split(" ")[1])
if a % b == 0:
ans.append(0)
else:
ans.append(b - a % b)
for Num in range(t):
print(ans[Num]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP 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... | try:
t = int(input())
while t:
a, b = [int(x) for x in input().split()]
if a % b == 0:
print("0")
else:
r = a % b
print(b - r)
t -= 1
except:
pass | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP 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... | def main():
for _ in range(int(input())):
ans = 0
a, b = map(int, input().split())
if a % b == 0:
print("0")
continue
else:
x = a // b
print(b * (x + 1) - a)
main() | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 STRING ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER 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())
for tt in range(t):
ab = input().split(" ")
a = int(ab[0])
b = int(ab[1])
if a == b:
print(0)
elif a < b:
print(b - a)
elif a % b == 0:
print(0)
else:
t = (int(a / b) + 1) * b
print(t - a) | 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 IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER 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())
while t:
li = [int(i) for i in input().split()]
a = li[0]
b = li[1]
rem = a % b
if rem == 0:
print(rem)
else:
k = b - rem
print(k)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR 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 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 = eval(input())
for case in range(t):
n, s = input().split(" ")
s = int(s)
sumx = 0
sum1 = 0
ans = [0]
flag = 0
for i in n:
sum1 += int(i)
if sum1 <= s:
print(0)
continue
for i in n:
sumx += int(i)
if sumx >= s and flag == 0:
ans[... | 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 ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR 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... | def main():
answers = []
for i in range(int(input())):
a, b = map(int, input().split())
c = a % b
if c != 0:
c = abs(c - b)
answers.append(c)
for i in range(len(answers)):
print(answers[i])
main() | FUNC_DEF 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 ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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... | n = int(input())
def solve(a, b):
if a % b == 0:
return 0
count = b - a % b
return count
for i in range(n):
data = list(map(int, input().split()))
a = data[0]
b = data[1]
print(solve(a, b)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR RETURN 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 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())
ans = []
for _ in range(t):
n, s = map(int, input().split())
n = str(n)[::-1]
temp = 0
if sum([int(c) for c in n]) <= s:
ans.append(temp)
else:
num_lis = [0] * 19
for i, c in enumerate(n):
num_lis[i] = int(c)
digit = 1
for i in ran... | 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 NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR 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())
while t > 0:
a, b = [int(ele) for ele in input().split()]
div = int(a / b)
rem = a % b
if rem == 0:
print(0)
else:
print(b * (div + 1) - (b * div + rem))
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP BIN_OP 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... | import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
n, s = list(map(int, input().split(" ")))
su = s
z = str(n)
z = "0" + z
o = n
ans = 0
for i in z:
ans += int(i)
w = 0
if ans <= s:
print(0)
else:
count = 0
for i in range(l... | IMPORT ASSIGN VAR 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 STRING ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN 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... | t = int(input())
while t > 0:
t = t - 1
a, b = input().split()
c = 0
a = int(a)
b = int(b)
if a % b == 0:
c = 0
else:
d = int(a / b)
c = b * (d + 1) - a
print(c) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP 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... | for i in range(int(input())):
a, b = map(int, input().split())
if a % b == 0:
print(0)
else:
print((divmod(a, b)[0] + 1) * 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 BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER 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 = map(int, input().split())
a = list(map(int, list(str(n))))
temp = 0
ans = 0
x = len(a)
for i in range(x):
if a[i] + temp > s:
for j in range(i, x):
a[j] = 0
c = i - 1
while c >= 0 and temp + 1 > 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR 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... | while True:
t = int(input())
if t >= 1 and t <= 10**4:
break
for i in range(t):
a, b = map(int, input().split(" "))
if a % b == 0:
print(0)
else:
print(b - a % b) | WHILE NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR 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... | def divisible(a, b):
x = a
y = b
if x % y == 0:
return 0
if x < y:
return y - x
else:
return y - x % y
n = int(input())
for i in range(n):
a, b = input().split()
a = int(a)
b = int(b)
result = divisible(a, b)
print(result) | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER IF VAR VAR RETURN BIN_OP VAR VAR RETURN BIN_OP VAR BIN_OP 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 FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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... | for _ in range(int(input())):
n, s = input().split()
su, la = 0, len(n)
n = n.rstrip()
s = int(s)
for i in n:
su += int(i)
n = int(n)
if su <= s:
print(0)
else:
ans = 0
flag = 0
for i in range(la):
if n % 10 != 0:
z = po... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER 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())
while t:
c = 0
s = input()
li = s.split(" ")
lis = [0, 0]
for i in range(2):
lis[i] = int(li[i])
a = lis[0]
b = lis[1]
if a % b == 0:
print(c)
elif a < b:
print(b - a)
else:
print(b - a % b)
t = t - 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF 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... | q = int(input())
while q:
n, s = map(int, input().split())
tmp = str(n)
res, ans = [], 0
for i in reversed(tmp):
res.append(int(i))
carry = 1
idx = 0
while sum(res) > s:
if res[idx] == 0:
carry *= 10
idx += 1
continue
d = 10 - res[i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER VAR NUMBER 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... | casos = int(input())
for i in range(casos):
a, b = input().split(" ")
a = int(a)
b = int(b)
if a % b == 0:
print(0)
continue
elif a < b:
print(b - a)
else:
print(b * (a // b + 1) - a) | 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 FUNC_CALL VAR 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_CALL VAR BIN_OP BIN_OP VAR BIN_OP 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... | def divisor(a, b):
c = 0
while b < 0:
if a % b == 0:
print(0)
b -= 1
else:
print((b - a) % b)
b = b - 11
for i in range(int(input())):
a, b = map(int, input().split())
divisor(a, b) | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP 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 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 solve(a, b):
return (b - a % b) % b
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
print(solve(a, b))
assert solve(10, 4) == 2
assert solve(13, 9) == 5
assert solve(100, 13) == 4
assert solve(123, 456) == 333
assert solve(92, 46) == 0 | FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP 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 EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER FUNC_CALL VAR NUMBER NUMBER NUMBER FUNC_CALL VAR NUMBER NUMBER 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
def get_div(a, b):
if a % b == 0:
return 0
else:
y = 0
x = a % b
y = x - b
return abs(y)
def main():
n = int(sys.stdin.readline())
for i in range(n):
a, b = map(int, sys.stdin.readline().split())
sys.stdout.write(f"{get_div(a, b)}\n"... | IMPORT FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR 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 EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.