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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
while n > 1000:
    n -= 1000
if n == 0:
    print("0")
else:
    print(1000 - n)

Submission status: Accepted

Solution code:
n = int(input())
ans = 10000-n
print(int(str(ans)[-3:]))

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,11):
    oturi = N-i*1000

    if oturi <= 0:
        print(abs(oturi))
        exit()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1,11):
    if i*1000 >= n:
        print(i*1000-n)
        break

Submission status: Accepted

Solution code:
n = int(input())

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

md = (n+1000) // (1000)

print((md)*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:
x=int(input())
if x%1000==0:
    print(0)
else:
    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:
n = int(input())

n %= 1000

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

Submission status: Accepted

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

if __name__ == "__main__":
  resolve()

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 sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
from operator import mul

INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 組合せnCr
def combinations_count(n, r):
    if n < r:
        return 0
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

# ここから書き始める
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    print(1000 - n % 1000)

Submission status: Accepted

Solution code:
n = int(input())

ans = 1000 - (n % 1000)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

change = n % 1000

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

Submission status: Accepted

Solution code:
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
if n%1000==0:
    print(0)
else:
    print(1000-n%1000)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
x = int(input())

x=x%1000
ans=1000-x
if x==0:
    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:
import math
a = int(input())
b = a
a = math.ceil(a/1000)
a = a * 1000
print(a-b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

money = 1000

while money < N:
  money += 1000

print(money-N)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
y = 1000
while y < x:
  y+=1000
print(y-x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math as mt
input=sys.stdin.buffer.readline  
t=1
#t=int(input())
for _ in range(t):
    y=1000
    n=int(input())
    while y+1000<=n:
        y+=1000
    if y<n:
        y+=1000
    print(y-n)    
    #x,y,n=map(int,input().split())
    #l=list(map(int,input().split()))

Submission status: Accepted

Solution code:
n = int(input())
l = 1
while True:
	if l*1000>=n:
		ans = l*1000-n
		break
	l+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

while n > 0:
    n -= 1000

print(-n)

Submission status: Accepted

Solution code:
N = int(input())

under1000 = N % 1000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math 

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    q = n // 1000

    if n % 1000 > 0:
        q += 1

    res = q * 1000 - n
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n%1000 ==0:
    a = n//1000
else:
    a = n//1000+1

print(1000*a-n)

Submission status: Accepted

Solution code:
# template by 3xC and starkizard.
# contributors: 

#####################################################################################
from __future__ import division, print_function 

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io


"""Uncomment modules according to your need"""


# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

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

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000)

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact,MOD=mod):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t


def get_n(Sum):    
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till n """
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r



def divs(n, start=1):
    """ returns a list of all divisors till n """
    divisors = []
    #rdivisors=[]
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors



def divn(n, primes):
    """ returns the number of divisors, two arguments n and the sieve till n """
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
    return divs_number


def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True

def print_arr2d(a):
    for i in a:
        prr(i)
    
def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)












###################################################################
# code goes here
def main(): 
    n=ii()
    print( (1000-(n%1000))%1000 )

                

                    




        
    
        
        
    


            


            
                
            

            



                






        
        


    
    
                

    

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    #threading.Thread(target=main).start()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(11):
    if(1000 * i >= N):
        print(1000 * i - N)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file = 0

def solve():
    



    # for _ in range(ii()):

    n=ii()
    n%=1000
    if n!=0:
        n=1000-n
    print(n)









  
















if __name__ =="__main__":

    if(file):

        if path.exists('input1.txt'):
            sys.stdin=open('input1.txt', 'r')
            sys.stdout=open('output1.txt','w')
        else:
            input=sys.stdin.readline
    solve()

Submission status: Accepted

Solution code:
n = int(input())
# a, b = map(int, input().split())
# l = list(map(int, input().split()))
if n%1000 == 0:
    print(0)
    exit()
n %= 1000
print(1000 - 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())

pagamento = 0
while pagamento < n:
    pagamento += 1000

print(pagamento - n)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    for i in range(1, 11):
        ans = i*1000 - n
        if ans >= 0:
            print(ans)
            break

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:
n = int(input())
print(1000 * ((n + 1000 - 1) // 1000) - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n > 0:
    n = n - 1000

print(abs(n))

Submission status: Accepted

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

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

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    #ss=readline().rstrip()
    #yn(1)
    x=n%1000
    if x>0:
        print(1000-x)
    else:
        print(0)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count =0
while True:
    tmp = 1000*count
    if tmp>=n:
        break
    count+=1

print(1000*count-n)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    ans = 1000-N%1000
    if ans ==1000:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())

tmp = 0
while True:
    if N <= tmp:
        print(tmp - N)
        break
    else:
        tmp += 1000

Submission status: Accepted

Solution code:
# coding: utf-8
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:
  print(1000-n%1000)
else:
  print(0)

Submission status: Accepted

Solution code:

def main():
    N = int(input())
    i = 1
    while 1000 * i < N:
        i += 1
    
    print(1000*i - N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())
    N = N % 1000

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
if N % 1000 == 0:
  ans = 0
else:
  ans = 1000*(N//1000+1)-N
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())
t = n%1000
if t == 0:
  print(t)
else:
  print(1000-t)

Submission status: Accepted

Solution code:
#!python3.8
# -*- coding: utf-8 -*-
# abc173/abc173_a
import sys
import math

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    a = math.ceil(N / 1000)
    ans = a * 1000 - N
    print(ans)
    return

main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
L = [int(i) for i in input().split()]
for i in range(1000):
    if L[0]<=i*1000:
        print(i*1000-L[0])
        break

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

if __name__ == '__main__':
    main()