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:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)

    print((1000 - n) % 1000)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(input())
if not n%1000:
    print(0)
else:
    print(1000-n%1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

k = N % 1000

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(100):
    if 1000*i<N<=1000*(i+1):
        a=i+1
        break

print(1000*(i+1)-N)

Submission status: Accepted

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


def solve(N: int):
    k = N % 1000
    if k != 0:
        print(1000-k)
    else:
        print(0)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
N = int(input())
M = N // 1000
if N % 1000 != 0:
    M += 1
print(1000 * M - N)

Submission status: Accepted

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

import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

a=ii()
b=math.ceil(a/1000)
print(b*1000-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n>1000:
    n-=1000
print(1000-n)

Submission status: Accepted

Solution code:
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 05/07/2020

from sys import stdin,stdout
from math import gcd, ceil, sqrt
from collections import Counter
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n = ii1()
count = ceil(n / 1000)
print(count * 1000 - n)

Submission status: Accepted

Solution code:
def main():
    a = int(input())
    ans = a%1000
    if ans == 0:
        print(0)
    else:
        print(1000-ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

for i in range(20):
  if n<=i*1000:
    print(i*1000-n)
    exit()

Submission status: Accepted

Solution code:
N=int(input())
i=0
while 1000*i<N:
    i+=1
print(1000*i-N)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

def resolve():

    # inp = sys.stdin.readlines()
    inp = int(input())
    print(-inp % 1000)

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

num=1000-n

while num<0:
    num+=1000

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    n = ii()
    if n%1000 == 0:
        print(0)
    else:
        print(1000 - n%1000)
    return

main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
n=int(input())
b=math.ceil(n/1000)
print(b*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:
import sys
import os
import itertools
import numpy as np
from collections import deque

def main():
    if os.getenv("ENV")=='LOCAL':
        sys.stdin = open(os.path.dirname(__file__)+'/input.txt', 'r')

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

    print(abs(N))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import ceil
from collections import defaultdict as dd
import sys
input=sys.stdin.readline
#t=int(input())
#while t:
n=int(input())
#l=list(map(int,input().split()))
#n,m=map(int,input().split())
print(ceil(n/1000)*1000-n)

Submission status: Accepted

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

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())

ans = (n + 1000 - 1) // 1000 * 1000 - n
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = 0
while i < n:
    i += 1000

print(i-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

ans = -N
while ans < 0:
    ans += 1000

print(ans)

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())

x = 0
while x < N:
  x += 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 = N % 1000
if n == 0:
    print(0)
else:
    print(1000-n)

Submission status: Accepted

Solution code:
import math


def _run(n):
    print((math.ceil(n / 1000) * 1000) - n)


def _main():
    N = int(input())
    _run(N)


if __name__ == "__main__":
    _main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import itertools
import collections
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
MOD = 10**9 + 7

n = IN()
a = 0

for i in range(1,100):
  a += 1
  if n <= 1000*a:
    print(1000*a - n)
    exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#K = input()
#X = list(map(int, input().split()))
#s = input().split()
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(100):
    n -= 1000
    if n <= 0:
        break
print(abs(n))

Submission status: Accepted

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

print(1000 - n if n else 0)

Submission status: Accepted

Solution code:
import math

n=int(input())
i=1000
while i<n:
        i+=1000
print(i-n)

Submission status: Accepted

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

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())
for i in range(11):
    if 1000 * i >= N:
        print(1000 * i - N)
        exit()

Submission status: Accepted

Solution code:
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, m, k = map(int, sys.stdin.readline().split())
#s = input()
#A = list(map(int, sys.stdin.readline().split()))

a = 1000 - (n % 1000)
if a == 1000:
    a = 0

print(a)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(input())

a = n // 1000
if (n % 1000 == 0):
    print((a)*1000 - n)

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    while n > 0:
        n -= 1000
    return -n


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(1000 - (N % 1000))

Submission status: Accepted

Solution code:
import sys
import math
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
n = II()
print((1000-(n%1000))%1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(100):
    if 1000 * i >= n:
        print(1000 * i - n)
        exit()

Submission status: Accepted

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


def solve(a: int):
    print(0 if a % 1000 == 0 else 1000-a%1000)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from math import ceil
N = int(input())
print(ceil(N/1000)*1000-N)

Submission status: Accepted

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

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())

print((N+1000-1)//1000*1000-N)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def LI():return list(map(int,input().split()))
def I(): return int(input())

n=I()
print((n+1000-1)//1000*1000-n)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
while cnt * 1000 < N:
    cnt += 1

print(cnt * 1000 - N)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()

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

Submission status: Accepted

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

        
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:
N = int(input())
x = N - (N//1000)*1000

print((1000-x)%1000)

Submission status: Accepted

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]

A = N%1000
if A ==0:
    print(0)
    sys.exit()
ans = 1000-A

#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	for i in range(100000):
		tmp = i * 1000
		#print(tmp)
		ans = tmp-N
		if ans >= 0:
			print(ans)
			sys.exit()

	print(N)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    n = int(input())
    return (1000 - n % 1000) % 1000


print(main())

Submission status: Accepted

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


def solve(N: int):
    if N % 1000 != 0:
        print(1000 - N % 1000)
    else:
        print(0)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n = int(input())
def ceil(a,b):
	return -(-a//b)
print(ceil(n, 1000)*1000-n)

Submission status: Accepted

Solution code:
import sys

import math
import itertools
import random
d = int(input())
#a, b, n = map(int, input().split())
if (d % 1000 == 0):
    print(0)
else:
    print(1000-d%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

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())

for i in range(1,10001):
    if i*1000>=N:
        ans=i*1000-N
        break
print(int(ans))

Submission status: Accepted

Solution code:
X = int(input())
X %= 1000
print((1000-X)%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:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1,100):
    if n <= i*1000:
        k = i*1000
        break

print(k-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
while n > 1000:
    n -= 1000
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())
k = 1000 - N % 1000
print(k % 1000)

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
time = (N + 1000 - 1) // 1000
ans = time * 1000 - N
print(ans)

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    res = N % 1000
    res = 1000 - res
    res %= 1000

    print(res)



main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    print((10000 - N) % 1000)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N=int(input())

while(1):
    N=N-1000
    if(N<=0):
        print(-N)
        break

Submission status: Accepted

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

    print((1000 - n % 1000)%1000)


main()

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:
    print(ans)
else:
    print(1000 - ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(1,11):
    ans = i * 1000 - n
    if ans >= 0:
        print(ans)
        break

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
import math
setrecursionlimit(10 ** 7)

n = int(input())

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

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
for i in range(1,11):
    if i*1000 >= N:
        print(i*1000-N)
        break

Submission status: Accepted

Solution code:
n=int(input())

ans=(10000-n)%1000
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
m = 0
while N > m:
    m += 1000
print(m - 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:
i=int(input())
d=i%1000
if d==0:
    print(0)
else:
    print((i//1000+1)*1000-i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import heapq
from collections import defaultdict, deque
from decimal import *
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

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

Submission status: Accepted

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

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())
ans=-n
while ans<0:
    ans+=1000
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

s = 10000 - N
print(s%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:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
x=1000
while x<n:
  x+=1000
print(x-n)

Submission status: Accepted

Solution code:
n=int(input())



print((1000-n%1000)%1000)

Submission status: Accepted

Solution code:
n = int(input())

a = 0
while a < n:
    a += 1000
print(a-n)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

if N % 1000 == 0:
    print(0)
else:
    print(1000 - N % 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())

total = 0
for i in range(100000):
    if total >= n:
        print(total - n)
        break
    total += 1000

Submission status: Accepted

Solution code:
# A - Payment

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())

    print((10000 - x) % 1000)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

ans = 1000 - N%1000

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from decimal import *
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor, trunc, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

print((1000-n%1000)%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

money=N%1000

ans=1000-money

if ans==1000:
    ans=0

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
i=0
while i*1000<n:
  i+=1
print(i*1000-n)

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
from numba import jit

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

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




if __name__ == '__main__':
    main()


"""
	n, m = LI()
	dist = np.full((n,n), INF)
	bridges = []
	for i in range(n):
		dist[i, i] = 0
	for i in range(m):
		a, b, c = LI()
		dist[a-1][b-1] = c
		dist[b-1][a-1] = c
		bridges.append((a,b,c))
	for i in range(n):
		for j in range(n):
			for k in range(n):
				dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
	for a, b, c in 

"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

N=int(sys.stdin.readline())

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    ans = 10000 - N
    ans = ans%1000
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print((10000-(int)(input())) % 1000)

Submission status: Accepted

Solution code:
N = int(input())

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