Problem:


Score : 100 points

Problem Statement

We will buy a product for N yen (the currency of Japan) at a shop.

If we use only 1000-yen bills to pay the price, how much change will we receive?

Assume we use the minimum number of bills required.

Constraints

1 \leq N \leq 10000

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the amount of change as an integer.

Sample Input 1

1900

Sample Output 1

100

We will use two 1000-yen bills to pay the price and receive 100 yen in change.

Sample Input 2

3000

Sample Output 2

0

We can pay the exact price.



Sample input:
1900


Sample output:
100

Submission status: Accepted

Solution code:
N=int(input())
an=N//1000
ans=(an+1)*1000-N
if N%1000==0:
  print(0)
else:
  print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
x = math.ceil(n/1000)
m = 1000*x

if n > m:
    result = n - m
else:
    result = m - n
    
print(result)

Submission status: Accepted

Solution code:
inp = input()
 
value = int(inp)
 
amari = value % 1000

if amari == 0:
  print (0)
else:
  result = 1000 - amari

  print(result)

Submission status: Accepted

Solution code:
N=int(input())
c=N%1000
if c==0:
    print(0)
else:
    print(1000-c)

Submission status: Accepted

Solution code:
n = (int)(input())

ret = 0
if n % 1000 != 0:
    ret = 1000 - (n % 1000)
print("{}".format(ret))

Submission status: Accepted

Solution code:
N = int(input())

b = N % 1000

if b == 0:
    print(0)
else:
    print(1000 - b)

Submission status: Accepted

Solution code:
ma = 1000
given = int(input())
c = given%ma
if(c == 0):
  print(0)
else:
  print(abs((c-1000)))

Submission status: Accepted

Solution code:
N = int(input())
S = divmod(N, 1000)
if S[1] == 0:
  print (S[1])
else:
  print (1000 - S[1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = 1000-n%1000
if a != 1000:
    print(a)
else:
    print(0)

Submission status: Accepted

Solution code:
#print("Hello")
N = int(input())
N = N % 1000

if N == 0:
  print(0)
  
else:
  print(1000 - N)

Submission status: Accepted

Solution code:
n=input()
n=int(n)
if n>1000:
  count=0
  while n>1000:
    n=n-1000
    count=count+1
  print(count*1000-(n+(count-1)*1000))

else:
  print(1000-n)

Submission status: Accepted

Solution code:
n=int(input())
if n%1000!=0:
    ans=1000-n%1000
else:
    ans=0
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
for i in range(11):
    if i*1000>=N:print((i*1000)-N);break

Submission status: Accepted

Solution code:
def II(): return int(input())
N=II()
for i in range(1,101):
  x=1000*i
  if x>=N:
    break
ans=x-N
print(ans)

Submission status: Accepted

Solution code:
import math as m
money=int(input())
if(m.ceil(money/1000.0)==m.floor(money/1000.0)):
  print("0")
elif(m.ceil(money/1000.0)<m.floor(money/1000.0)):
  print(money%1000)
else:
  print(1000-(money%1000))

Submission status: Accepted

Solution code:
N = int(input())
if N%1000==0:
  A = 0
else:
  A =1000-( N % 1000)
print(int(A))

Submission status: Accepted

Solution code:
N = int(input())


while N >= 0:
  N -= 1000
  if N == 0:
    break

print(abs(N))

Submission status: Accepted

Solution code:
n = int(input())
if n<=1000:
    print(1000-n)
elif n<=2000:
    print(2000-n)
elif n<=3000:
    print(3000-n)
elif n<=4000:
    print(4000-n)
elif n<=5000:
    print(5000-n)
elif n<=6000:
    print(6000-n)
elif n<=7000:
    print(7000-n)
elif n<=8000:
    print(8000-n)
elif n<=9000:
    print(9000-n)
elif n<=10000:
    print(10000-n)

Submission status: Accepted

Solution code:
N = int(input())
if N%1000 == 0:
  print('0')
else:
  print(-1*(N%1000-1000))

Submission status: Accepted

Solution code:
n=int(input())
a=n%1000
if a==0:
  print(0)
else:
  print(1000-a)

Submission status: Accepted

Solution code:
ans = int(input())

while ans > 0:
  ans  = ans - 1000
   
print(-(ans))

Submission status: Accepted

Solution code:
n=int(input())
while(n>0): n-=1000
print(abs(n))

Submission status: Accepted

Solution code:
x=int(input())

while x>=1000:
  x=x-1000
  
if x>0:
    print(1000-x)
else:
    print(0)

Submission status: Accepted

Solution code:
import math
n = int(input())
mod = n/1000
res = (math.ceil(mod)*1000) - n
print(res)

Submission status: Accepted

Solution code:
N = int(input())
if not N%1000:
  print(0)
else:
  print(1000-(N%1000))

Submission status: Accepted

Solution code:
import math
N = int(input())
x = math.ceil(N/1000) * 1000
print(x-N)

Submission status: Accepted

Solution code:
n = int(input())

if n % 1000 == 0:
    print(0)
else:
    print(1000 - (n % 1000))

Submission status: Accepted

Solution code:
N = int(input())
n = 1000
while N > n:
    n += 1000
print(n - N)

Submission status: Accepted

Solution code:
import math
x = int(input())


print(math.ceil(x/1000)*1000-x)

Submission status: Accepted

Solution code:
n = int(input())
mod = n % 1000
print(0 if mod == 0 else 1000 - (n % 1000))

Submission status: Accepted

Solution code:
N = int(input())
print(0 if N%1000==0 else 1000-(N%1000))

Submission status: Accepted

Solution code:
price = int(input())

thousand = int(price/1000)

if price % 1000 == 0:
    print("0")
else:
    oturi = 1000 - (price - (1000 * thousand))
    print(oturi)
    pass

Submission status: Accepted

Solution code:
N = int(input())
if N%1000 == 0:
    print(0)
else:
    Str = str(N)
    if len(Str) > 3:
        K = (int(Str[0]) + 1) * 1000
        print(K - N)
    else:
        print(1000 - N)

Submission status: Accepted

Solution code:
n = int(input())
while 1000 < n:
  n = n - 1000
print(1000 - n)

Submission status: Accepted

Solution code:
n = int(input())

if n % 1000 == 0:
  print(0)
else:
  bill = n % 1000
  print(1000 - bill)

Submission status: Accepted

Solution code:
cost = input()
amari = int(cost[-3:])
if amari == 0:
  amari = 1000
print(1000 - amari)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

if n == 10000:
	ans = 0
else:
	for i in range(1000,11000,1000):
		if 0 < (i - n) < 1000:
			ans = (i - n)
			break
		elif i == n:
			ans == 0

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    ans = (n//1000+1)*1000 - n
    print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
thousand = math.ceil(n / 1000)
change = thousand*1000 - n
print(change)

Submission status: Accepted

Solution code:
n = int(input())
n = n%1000

if n%1000==0:
    print(0)
else:
    print(1000-n)

Submission status: Accepted

Solution code:
N = int(input())


while N >= 0:
  N -= 1000
  if N == 0:
    break

print(abs(N))

Submission status: Accepted

Solution code:
N = int(input())
temp = N%1000
if(N > 1000 and temp != 0):
    res = 1000 - temp
    print(res)
elif (N>1000 and temp == 0):
    print(temp)
else:
    res = 1000 - N
    print(res)

Submission status: Accepted

Solution code:
N = input()
if len(N) >= 3:
    A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
    if A == 0:
        print(0)
    else:
        print(1000 - A)
elif len(N) == 2:
    A = int(N[-2])*10 + int(N[-1])
    print(1000 - A)
elif len(N) == 1:
    A = int(N[-1])
    print(1000 - A)

Submission status: Accepted

Solution code:
n = int(input())

change = 1000 - n % 1000
if n % 1000 == 0:
    change = 0
print(change)

Submission status: Accepted

Solution code:
N = int(input())
minn=1000
if N <1 or N>10000:
	print(' ')
elif N%1000==0:
	print(0)
else:
	for i in range(1000,10001,1000):
		if N<i:
			print(i-N)
			break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    print(-n % 1000)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N, = map(int, input().split())
if N%1000:
    print(1000-(N%1000))
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

n = -(-N//1000)
print(n*1000 - N)

Submission status: Accepted

Solution code:
N = int(input())
if N %1000 == 0:
    print(0)
else:
    print(1000-N%1000)

Submission status: Accepted

Solution code:
N = int(input())
temp = N%1000
if(N > 1000 and temp != 0):
    res = 1000 - temp
    print(res)

elif (N>1000 and temp == 0):
    print(temp)
else:
    res = 1000 - N
    print(res)

Submission status: Accepted

Solution code:
N = int(input())

N = N % 1000

if N == 0:
  print(0)
else:
  print(1000 - N)

Submission status: Accepted

Solution code:
def resolve():
    N = input()

    if N == '10000':
        print(0)
        return

    if int(N) <= 1000:
        print(1000 - int(N))
        return

    if (N[1] == '0' and N[2] == '0' and N[3] == '0'):
        print(0)
        return

    ans = 1000 * (int(N[0]) + 1) - int(N)
    print(ans)



resolve()

Submission status: Accepted

Solution code:
n = int(input())

if n %1000 ==0:
  print(0)
else:
  print(1000 - n%1000)

Submission status: Accepted

Solution code:
        
try:
    N = int(input())
    
    if N>=1 and N<=10000:
        if N % 1000 == 0:
            print(0)
        else:
            integer = N//1000
            integer +=1 
            print((integer*1000) - N)
   
            
        
        
except Exception as e:
    print(e)

Submission status: Accepted

Solution code:
N = int(raw_input())
N %= 1000
if N == 0:
  print 0
else:
  print 1000 - N

Submission status: Accepted

Solution code:
N = int(input())
n = N%1000

if n==0:
    print(0)
else:
    print(1000-n)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    while True:
        if (n >= 1000):
            n -= 1000
            if n==0:
                print(n)
                return
        else:
            print(1000-n)
            return


if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

for i in range (11):

    if(N<=1000*(i+1)):
        pre = i+1
        break

ans = pre*1000 - N

print(ans)

Submission status: Accepted

Solution code:
import math

A = int(input())

print(math.ceil(A/1000)*1000-A)

Submission status: Accepted

Solution code:
N = int(input())
if N%1000==0:
  print(0)
else:
  print(1000-(N%1000))

Submission status: Accepted

Solution code:
n=int(input())
ans=n%1000
if (ans!=0):
    balance=1000-ans
    print(balance)
else:
    print(0)

Submission status: Accepted

Solution code:
N = input()
if int(N) < 1001:
    x = N
elif int(N[-3]+N[-2]+N[-1]) == 0:
    x = 1000
else:
    x = N[-3]+N[-2]+N[-1]
print (1000 - int(x))

Submission status: Accepted

Solution code:
N=int(input())

if N%1000==0:
  print(0)
  exit()

elif N>=1000:
  print(1000-N%1000)
 
elif N<1000:
  print(1000-N)

Submission status: Accepted

Solution code:
N = int(input())

a = N//1000

if 1000*a != N:
  print(1000*(a+1)-N)

else:
  print(0)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(1, 100):
    if ((i * 1000) > x):
        print((i * 1000) - x)
        break
    elif(x==(i*1000)):
        print("0")
        break

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 == 0:
    change = 0
else:
    change = 1000 - (n % 1000)
print(change)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    mod = N % 1000
    if mod == 0:
        print(0)
    else:
        print(1000 - mod)    

resolve()

Submission status: Accepted

Solution code:
N = int(input())
A = N%1000
if A == 0:
  print(0)
else:
  print(1000-A)

Submission status: Accepted

Solution code:
N=int(input())

x = N % 1000

Otsuri = 1000-x

if Otsuri == 1000:
  print(0)
else:
  print(Otsuri)

Submission status: Accepted

Solution code:
N = int(input())
N = 1000 - (N%1000)
print(N % 1000)

Submission status: Accepted

Solution code:
import math
N = int(input())
S = 0
ans = 0
for i in range(1000, 10001, 1000):
    if i - N == 0:
        ans = 0
        break
    if i - N > 0:
        ans = i - N
        break
        # ans = min(ans, i - N)
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

num_1000yen = 0
temp = N

while(temp > 0):
  temp -= 1000
  num_1000yen += 1
otsuri = 1000*num_1000yen - N

print(otsuri)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
# import bisect
# import numpy as np
# from collections import deque
from collections import deque
# map(int, sys.stdin.read().split())
import itertools


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    print((-N)%1000)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

n_r = n % 1000

if n_r == 0:
    print(0)
else:
    print(1000 - n_r)

Submission status: Accepted

Solution code:
n=int(input())
s=n%1000
if s!=0:
  print(1000-s)
else:
  print(s)

Submission status: Accepted

Solution code:
a = int(input())
k = 0
while k < a:
	k += 1000
print(k - a)

Submission status: Accepted

Solution code:
n = 1000 - (int(input()) % 1000)
if n == 1000:
  print (0)
else:
  print(n)

Submission status: Accepted

Solution code:
N = int(input())
 
print((1000 - (N%1000))%1000)

Submission status: Accepted

Solution code:
n = int(input())
s = 0
while s < n:
    s += 1000
print(s-n)

Submission status: Accepted

Solution code:
N = int(input())
n = N % 1000

if n == 0:
    print(n)
else:
    print(1000-n)

Submission status: Accepted

Solution code:
A=int(input())


if A%1000==0:
    print(0)
else:
    print(1000-A%1000)

Submission status: Accepted

Solution code:
n = int(input())

a = 10000 - n
if n == 0:
    print(0)

for i in range(10):
    if a >= 1000:
        a = a - 1000
    else:
        print(a)
        break

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 != 0:
    print(1000-n%1000)
else:
    print(0)

Submission status: Accepted

Solution code:
def solution():
    n=int(input())
    print((n+1)//2)
def sol():
    n=int(input())
    print(((n//1000)+1)*1000-n if(n%1000!=0) else 0)
if(__name__=='__main__'):
    sol()

Submission status: Accepted

Solution code:
N = int(input())
ans = N % 1000
if ans == 0:
  print(0)
else:
  print(1000-ans)

Submission status: Accepted

Solution code:
n=int(input())
s=n//1000+1
if n%1000==0:
    print(0)
else:
    print(1000*s-n)

Submission status: Accepted

Solution code:
N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  if m < 10:
    print(1000-m)
  elif m < 100:
    print(1000-(int(str(m)[-2])*10) + (int(str(m)[-1])))
  else:
    print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = 0 if not n % 1000 else 1000 - n % 1000
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n = int(input())
    if n % 1000 == 0:
        print(0)
    else:
        print(1000 - n % 1000)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

if N <= 1000:
    print(1000-N)
else:
    t = N % 1000
    if t == 0:
        print(0)
    else:
        print(1000-t)

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 == 0: print(0)
else: print(1000 - n % 1000)

Submission status: Accepted

Solution code:
n=int(input())
print((n*1000-n)%1000)

Submission status: Accepted

Solution code:
n = int(input())
a = 0

while True:
    a += 1000
    if a >= n:
        print(a - n)
        break

Submission status: Accepted

Solution code:
n = int(input()) 
c = [ i*1000 - n for i in range(1,20)]
ans = float('inf')
for i in c:
    if i >= 0:
        ans = min(i,ans)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
while N > 1000:
    N = N - 1000
else:
    print(1000-N)

Submission status: Accepted

Solution code:
import math

N = int(input())

div = math.ceil(N / 1000)

turi = div * 1000 - N

print(turi)

Submission status: Accepted

Solution code:
n = int(input())

if n % 1000 == 0:
    print(0)
else:
    print(1000-n % 1000)

Submission status: Accepted

Solution code:
a = input()

b = 1000 - int(a[-3:])

if b == 1000:
	print(0)
else :
	print(b)

Submission status: Accepted

Solution code:
in_value = int(input())

while(1):
    in_value %= 1000
    if in_value == 0:
        break
    elif in_value < 1000:
        in_value = 1000 - in_value
        break
print(in_value)

Submission status: Accepted

Solution code:
n = int(input())

if n % 1000 != 0:
  ans = 1000 - n % 1000
else:
  ans = 0

print(ans)

Submission status: Accepted

Solution code:
n = int(input()) % 1000
if n == 0: print(0)
else: print(1000-n)

Submission status: Accepted

Solution code:
n = int(input())
if n%1000:
  print(1000-n%1000)
else:
  print(0)

Submission status: Accepted

Solution code:
n = int(input())
n = n % 1000 if n % 1000 != 0 else 1000
print(1000 - n)

Submission status: Accepted

Solution code:
n = int(input())
if 1000 > n:
  print(1000 - n)
else:
  p = 1000 - int(str(n)[1::])
  print(p if p != 1000 else 0)

Submission status: Accepted

Solution code:
n = int(input())
if n%1000 !=0:
    print(1000-(n%1000))
else:
    print(0)

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=int(input())

print(1000-(N%1000) if N%1000>0 else 0)

Submission status: Accepted

Solution code:
a = int(input())

print((1000-a%1000)%1000)

Submission status: Accepted

Solution code:
n = [i for i in range(1000,10001,1000)]
m = int(input())
for i in n:
    if i > m or i == m:
        a = i - m
        break
print(a)

Submission status: Accepted

Solution code:
n=int(input())
print(((n//1000+1)*1000-n)%1000)

Submission status: Accepted

Solution code:
import math
n = int(input())
if n % 1000 == 0:
  print(0)
else:
  print(math.ceil(n / 1000) * 1000 - n)

Submission status: Accepted

Solution code:
n = int(input())
change = n % 1000
if change != 0:
  print(1000 - change)
else:
  print(0)

Submission status: Accepted

Solution code:
n=int(input())
m=n%1000

if m==0:print(0)
else:print(1000-m)

Submission status: Accepted

Solution code:
import math
n=int(input())
if(n<1000):
    print(1000-n)
elif(n%1000!=0):
    a=int(math.floor(n//1000))
    print(((a+1)*1000)-n)
else:
    print("0")

Submission status: Accepted

Solution code:
n = int(input())

if n% 1000 is 0:
    print(0)
elif n<1000:
    print(1000-n)
else:
    e = n % 1000
    print(1000-e)

Submission status: Accepted

Solution code:
import math
N = int(input())

print(math.ceil(N/1000)*1000-N)

Submission status: Accepted

Solution code:
N = int(input())
R = N % 1000
if R == 0:
    print(0)
else:
    print(abs(R-1000))

Submission status: Accepted

Solution code:
n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000 - n%1000)

Submission status: Accepted

Solution code:
n = int(input())
o = (1000 - (n % 1000)) % 1000
print(f"{o}")

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()

print(1000*math.ceil(N/1000)-N)

Submission status: Accepted

Solution code:
N = int(input())

if N < 1000:
    print(1000-N)

elif N == 1000:
    print(0)

elif 1000<N<2000:
    print(2000-N)

elif N == 2000:
    print(0)


elif 2000<N<3000:
    print(3000-N)

elif N == 3000:
    print(0)

elif 3000<N<4000:
    print(4000-N)

elif N == 4000:
    print(0)

elif 4000<N<5000:
    print(5000-N)

elif N == 5000:
    print(0)

elif 5000<N<6000:
    print(6000-N)

elif N == 6000:
    print(0)

elif 6000<N<7000:
    print(7000-N)

elif N == 7000:
    print(0)

elif 7000<N<8000:
    print(8000-N)

elif N == 8000:
    print(0)

elif 8000 < N < 9000:
    print(9000-N)

elif N == 9000:
    print(0)

elif 9000<N<10000:
    print(10000-N)

elif N == 10000:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())
while( N > 0 ):
    N -= 1000
print(-N)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    ans = 0
    if N % 1000 == 0:
        ans = 0
    else:
        ans = 1000 - (N+1000) % 1000
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
cost = input()
cost = int(cost)
div, mod = divmod(cost, 1000)
if mod == 0:
    bills = div
    change = 0
else:
    bills = div + 1
    change = 1000 - mod
print(change)

Submission status: Accepted

Solution code:
N = int(input())
d = N % 1000


if 1000 - d == 0 or d == 0:
    print(0)
else:
    print(1000 - d)

Submission status: Accepted

Solution code:
a = int(input()) 

count = 0

while a%1000 != 0 :
    a +=1
    count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
ans = N%1000
if ans == 0:
    ans = 1000
print(1000-ans)

Submission status: Accepted

Solution code:
a=int(input())

b=int(a/1000)

if 1000>a:
  print(1000-a)

elif 1000*b-a==0:
  print(0)

else:
  print(1000*(b+1)-a)

Submission status: Accepted

Solution code:
import math

N = int(input())

answer = math.ceil(N / 1000)
answer = answer * 1000 - N
print(answer)

Submission status: Accepted

Solution code:
a = int(input())
count = 0
for i in range(1,1000000000):
  if 1000 * i - a < 0:
   count += 1
  else:
    1000 *i - a >= 0
    print(int(1000 * i - a))
    break

Submission status: Accepted

Solution code:
n = int(input())
if n > 9000:
  print(10000 - n)
  quit()
  
kazu = list(str(10000 - n))[0]
print((10 - int(kazu)) * 1000 - n)

Submission status: Accepted

Solution code:
N = int(input())

print( (1000 - (N % 1000))%1000)

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    x = int(abs((n % 1000) - 1000))
    print(x)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,=pin()
    print ((-N)%1000)
#%%submit!
resolve()

Submission status: Accepted

Solution code:
pay = int(input())%1000
if pay == 0:
  print(0)
else:
  print(1000- pay)

Submission status: Accepted

Solution code:
N = int(input())

if N%1000 == 0:
    print(N%1000)
else:
    print(1000 - N%1000)

Submission status: Accepted

Solution code:
N = int(input())
if N <= 1000:
  print(1000-N)
elif N <= 2000:
  print(2000-N)
elif N <= 3000:
  print(3000-N)
elif N <= 4000:
  print(4000-N)
elif N <= 5000:
  print(5000-N)
elif N <= 6000:
  print(6000-N)
elif N <= 7000:
  print(7000-N)
elif N <= 8000:
  print(8000-N)
elif N <= 9000:
  print(9000-N)
elif N <= 10000:
  print(10000-N)

Submission status: Accepted

Solution code:
n = int(input())
if n <= 1000:
    print(1000 - n)
else:
    if n % 1000 == 0:
        print(0)
    else:
        m = n // 1000 + 1
        print(m * 1000 - n)

Submission status: Accepted

Solution code:
N = int(input())

res = N // 1000
if N % 1000 != 0 :
    res += 1

con = res * 1000
oturi = con - N

print(oturi)

Submission status: Accepted

Solution code:
import  math
a = int(input())

c = math.ceil(a / 1000)

print(c * 1000 - a)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
while N>0:
  count += 1
  N = N-1000

print(abs(N))

Submission status: Accepted

Solution code:
a = int(input())
if a%1000 == 0:
    print(0)
else:
    print(1000-(a%1000))

Submission status: Accepted

Solution code:
N=int(input())
A=0
for i in range(0,N):
    i=i+1
    A=str(i)+"000"
    A=int(A)
    if N<=A:
        print(A-N)
        break

Submission status: Accepted

Solution code:
n = int(input())
a = n % 1000
if a == 0:
    print(0)
    exit()
else:
    print(1000-a)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
m, d = divmod(N, 1000)
if d == 0:
    print(0)
else:
    print(1000 - d)

Submission status: Accepted

Solution code:
n = int(input())
m = (n//1000) + 1
if n%1000 == 0:
    print(0)
else:
    print(m*1000 - n)

Submission status: Accepted

Solution code:
N = input()
L=list(N)
ans =0
if int(N)<1000:
    ans = 1000-int(N)
elif int(N)%1000==0:
    ans = 0   
elif int(N)>1000:
    N2 = L[1]+L[2]+L[3]
    ans = 1000-int(N2)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    div = int(N / 1000)
    a = (div+1)*1000
    out = a - N
    print(out)

Submission status: Accepted

Solution code:
N = int(input())
if N%1000 == 0:
    print(0)
    exit()
print(1000-N%1000)

Submission status: Accepted

Solution code:
n = int(input())%1000
print(abs(n-1000)) if n != 0 else print(0)

Submission status: Accepted

Solution code:
N=1000-int(input())%1000
print(N*(N<1000))

Submission status: Accepted

Solution code:
import math
n=int(input())
nn=n/1000

nn=math.ceil(nn)*1000

print(nn-n)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(0,11):
  if i*1000 < N and N <= (i+1)*1000:
    break
print(1000*(i+1) - N)

Submission status: Accepted

Solution code:
N = int(input())

print((1000 - N % 1000) % 1000)

Submission status: Accepted

Solution code:
n = int(input())
n = n % 1000
if n == 0:
    print(0)
else: print(1000-n)

Submission status: Accepted

Solution code:
n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000 - n%1000)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(10):
    N -= 1000
    if N < 0:
        N += 1000
        print(1000-N)
        break
    elif N == 0:
        print(N)
        break

Submission status: Accepted

Solution code:
a = int(input())

if a%1000 == 0:
    print(0)
else:
    print(1000-a%1000)

Submission status: Accepted

Solution code:
N = int(input())

if N%1000==0:
    ans = 0
else:
    ans = (N//1000 + 1) * 1000 - N
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = (1000 - (N % 1000)) % 1000
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
if N % 1000:
    mai = N // 1000 + 1
else:
    mai = N // 1000
print(1000 * mai - N)

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    print(1000 + n//1000 * 1000 - n )

Submission status: Accepted

Solution code:
import math
n=int(input())
d=n/1000
x=math.ceil(d)
c=int((x*1000)-n)
print(c)

Submission status: Accepted

Solution code:
N = int(input())
B = N//1000
if N <= 1000:
    print(1000-N)
elif N%1000 == 0:
    print(0)    
elif N > 1000:
    print(((B+1)*1000)-N)

Submission status: Accepted

Solution code:
import sys
si = sys.stdin.readline


def main():
    n = int(si())
    while n > 1000:
        n -= 1000
    print(1000-n)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,11):
    x = 1000 * i - N
    if x < 0:
        continue
    else:
        print(x)
        exit()

Submission status: Accepted

Solution code:
N = int(input())
if (N%1000==0):
  print(0)
else:
  print(1000 - (N%1000))

Submission status: Accepted

Solution code:
a = int(input())
b = a % 1000
if b == 0:
  print(0)
else:
  print(1000 - b)

Submission status: Accepted

Solution code:
import math
a = int(input())
print(math.ceil(a/1000)*1000 - a)

Submission status: Accepted

Solution code:
x = int(input())

if x % 1000 == 0:
    print(0)
else:
    x = str(x)
    y = x[-3:]
    y = int(y)
    print(1000 - int(y))

Submission status: Accepted

Solution code:
import sys

n = int(input())
if n==10000 or n==1000 or n==2000 or n==3000 or n==4000 or n==5000 or n==6000 or n==7000 or n==8000 or n==9000:
  change = 0
  
elif 10000 > n >= 1000:
    hyaku=(n%1000)
    change = 1000 - hyaku
else:
  change = 1000-n

print(change)

Submission status: Accepted

Solution code:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  R = 1000 - (N % 1000)
  print(R)

Submission status: Accepted

Solution code:
N = int(input())

while N > 1000:
    N = N - 1000

print(1000-N)

Submission status: Accepted

Solution code:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

N=int(input())

ans = (1000 - (N%1000)) % 1000
print(ans)

Submission status: Accepted

Solution code:
"""
https://atcoder.jp/contests/intro-heuristics/tasks/intro_heuristics_a
"""

import numpy as np


def load_input_as_int_array() -> np.ndarray:
    return np.array([int(v) for v in input().split(" ")])


def main() -> None:
    N, = load_input_as_int_array()
    focus = N % 1000
    result = 1000 - focus if focus != 0 else 0
    print(result)


main()

Submission status: Accepted

Solution code:
a=int(input())
r=a%1000
if r==0:
  print(r)
else:
  print(1000-r)

Submission status: Accepted

Solution code:
n = input()
if int(n)%1000==0:
    print(0)
else:
    n_ = 1000-(int(n)%1000)
    print(n_)

Submission status: Accepted

Solution code:
n = input()
a = int(n[:1])+1
ans = a*1000-int(n)
if(ans == 1000):
    print(0)
elif ans>1000:
    print(1000-int(n))
elif ans<0:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import sys
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n=II()
	if n%1000==0:
		print(0)
	else:
		print((n//1000)*1000+1000-n)


if __name__ == "__main__":
	main()