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


if(__name__ == "__main__"):

    payment = int( input().strip() )
    payment%= 1000
    if(payment==0):
        print("0")
    else:
        remainder = 1000-payment
        print(remainder)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = 0
while 1000*a < n:
    a += 1

print(1000*a - n)

Submission status: Accepted

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

n = int(readline())

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

Submission status: Accepted

Solution code:
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())

while n > 0 :
    n = n - 1000
    if n <= 0 :
        break

print(abs(n))

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)
else:
    print((N//1000+1)*1000-N)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mon = n
while mon > 0:
    mon-=1000

print(abs(mon))

Submission status: Accepted

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

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

Submission status: Accepted

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

N = int(readline())

p = 1000 - N%1000

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

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
from math import *

N = int(input())
nextt = ceil(N/1000)*1000
print(nextt-N)

Submission status: Accepted

Solution code:

def main():

    N = int(input())
    money = 0

    while N > money:
        money += 1000

    print(money - N)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
for i in range(1,100):
    x = i * 1000 - n
    if x >= 0:
        print(x)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = N % 1000

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import random
from functools import lru_cache
import math

def solve():
    n = int(input())
    if n < 1000:
        print(1000 - n)
    else:
        paid = math.ceil(n / 1000) * 1000
        print(paid-n)

t = 1
for _ in range(t):
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import bisect
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
d=read()
d%=1000
if d==0:
  print(0)
else:
  print(1000-d)

Submission status: Accepted

Solution code:

#n,m=map(int,input().split())
a=int(input())
if a%1000==0:
    print(0)
    exit()
print(1000-(a%1000))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])

    return str(-(-n//1000)*1000-n)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%1000==0: exit(print(0))
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:
# ABC173a


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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())
if N%1000 == 0:
  print(0)
else:
  
  a = N//1000 + 1
  print(a*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())

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

Submission status: Accepted

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


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


if(__name__ == '__main__'):
  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())


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

n %= 1000
n = 1000 -n

if n % 1000 == 0:
    n = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

i = 0
while i*1000<n:
    i += 1

print((i)*1000-n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
a = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""AtCoder Beginner Contest 173: A - Payment
https://atcoder.jp/contests/abc173/tasks/abc173_a
"""

import math


def main():
    N = int(input())
    print(math.ceil(N / 1000) * 1000 - N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

while N > 1000:
    N -= 1000

print(1000-N)

Submission status: Accepted

Solution code:

n = int(input())

ans = 1000 - (n % 1000)

if ans == 1000 :
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
money = 1000
while True:
    if money >= n:
        print(money-n)
        exit()
    else:
        money += 1000

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

a = 1000
while a < n:
    a  += 1000


print(a -n)

Submission status: Accepted

Solution code:
n = int(input())

a = n % 1000

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

Submission status: Accepted

Solution code:
n=int(input())

if n % 1000 !=0:
    ans = ((n // 1000) + 1) * 1000 - n
else:
    ans = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
for i in range(20):
    if N > 1000:
        N-=1000
    else:
        break
print(1000-N)

Submission status: Accepted

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

while a*1000<N:
    a += 1

print(a*1000-N)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  5 21:00:39 2020

@author: NEC-PCuser
"""

N = int(input())

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

Submission status: Accepted

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

  b = (N // 1000) + 1

  print((b * 1000 - N) % 1000)

if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N = int(input())

    answer = 0
    if N%1000 >= 1:
        answer = 1000 - N%1000
    print(answer)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    r, m = divmod(N, 1000)

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N):
    while N > 0:
        N -= 1000
    print(-N)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input())

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

Submission status: Accepted

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


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
#####################################

n=int(input())
print(1000*int(M.ceil(n/1000))-n)

Submission status: Accepted

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


    print(n)

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    if n%1000 == 0:
        print(0)
    else:
        print(1000-n%1000)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#A
N = input()

result = 1000 - int(N[-3:])

if result == 1000:
    print('0')
else:
    print(result)

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 main():
    N= int(input())
    price = 1000
    ans = price - N%price
    if ans == price:
        ans = 0
    print(ans)
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
n = int(input())
print(0 if n%1000==0 else 1000-(n%1000))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

money = 0

while N > money:
    money += 1000

print(money - N)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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 math
n = int(input())
m = math.ceil(n / 1000)
print(m * 1000-n)

Submission status: Accepted

Solution code:
N = int(input())
pay = 1000

while pay < N:
  pay += 1000
print(pay-N)

Submission status: Accepted

Solution code:
N = int(input())

i = 1

while True:
    s = 1000 * i - N
    if s >= 0:
        break
    
    i += 1
    
print(s)

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

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

Submission status: Accepted

Solution code:
import math

N = int(input())
tmp = math.ceil(N / 1000)

print(1000*tmp - N)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        lower, upper = [], []
        i = 1
        while i * i <= n:
            if n % i == 0:
                lower.append(i)
                if i != n // i:
                    upper.append(n // i)
            i += 1
        return lower + upper[::-1]

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


def solve():
    N = Scanner.int()
    if N % 1000 == 0:
        print(0)
    else:
        print(1000 - N % 1000)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

t = 1000-(n % 1000)

print(0 if t == 1000 else t)

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")
else:
    print(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:
a = int(input())
if a%1000 !=0:
  print(1000-a%1000)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

s = int(input()) % 1000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = n % 1000
if a == 0:
    print(0)
else:
    print(1000-a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
m = (n + 999) // 1000
print(m * 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:
N = int(input())

ans = N % 1000
ans = 1000 - ans
ans = 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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

a=1000

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
if n%1000==0:
  print(0)
  exit()
print((n//1000+1)*1000-n)

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

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():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect


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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import copy

# a = get_int()
def get_int():
    return int(input())

# a = get_string()
def get_string():
    return input()

# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]

# a_list = get_string_list():
def get_string_list():
    return input().split()

# a, b = get_int_multi()
def get_int_multi():  # a, b = get_int_multi()
    return map(int, input().split())

# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))

# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

def main():

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





if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
M = math.ceil(N/1000)

print(M*1000-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
# sys.stdin=open('input.txt','r')
# sys.stdout=open('output2.txt','w')
from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
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()
ans=1000*(1+ n//1000)
if n%1000==0:
    print(0)
else:
    print(ans-n)

Submission status: Accepted

Solution code:
# coding: utf-8

import math
import re
import numpy as np
import copy

#読み込む
S = input()
N = int(S)

res = N%1000

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    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!=0:
    print(-(N-(N//1000)*1000-1000))
else:
    print(0)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(input())
    print(((N+1000-1)//1000)*1000-N)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
if n%1000 == 0:
  print(0)
else:
  n1=n//1000
  n2 = (n1+1)*1000
  print(n2-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:
n = int(input())
a = n//1000
if n%1000 != 0:
    print(1000*(a+1) - n)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline
    # 整数 1 つ
    n = int(input())
    # 整数複数個
    # a, b = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

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


resolve()

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

n = n%1000
print(abs(n-1000)%1000)

Submission status: Accepted

Solution code:
n = int(input())
while True:
    if n <= 1000:
        print(1000-n)
        break
    else:
        n-=1000

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = n % 1000
ans = 1000 - ans

if ans == 1000:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
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())

kirisute=((-1*n)//1000)*(-1)

print(abs(n-kirisute*1000))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

aaa = N % 1000

if aaa==0:
    print(0)
else:
    bbb = 1000 - aaa
    print(bbb)

Submission status: Accepted

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

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:
X=int(input())
while X>1000:
  X-=1000
print(1000-X)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
def adj(n): return [[] for _ in range(n)]

n = iinput()
div,mod = divmod(n,1000)
ans = 1000*(div+1) - n if mod else 0
print(ans)