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: Wrong Answer

Solution code:
# Contest No.: ABC173
# Problem No.: A
# Solver:      JEMINI
# Date:        20200705

import sys
import heapq

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
import itertools
def main():
    n = int(input())
    print(1000-n%1000)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    print(N % 1000)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
l = input()
print(int(l[-3:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())
print(num % 1000)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
print(min(-N % 1000, N % 1000))

Submission status: Wrong Answer

Solution code:
"""    Arnab Chanda    """

from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq

int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input=lambda : list(map(int,stdin.readline().split()))
string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7

n = int_input()

print(n%1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

i = int(input())

print(1000 - (i % 1000))

Submission status: Wrong Answer

Solution code:

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

  print(1000 - n % 1000)


main()

Submission status: Wrong Answer

Solution code:
N = int(input())

a = N % 1000
ans = 1000 -a

print(ans)

Submission status: Wrong Answer

Solution code:
A =int(input())
print(1000-A)

Submission status: Wrong Answer

Solution code:
N = int(input())

res = N // 1000

print(res)

Submission status: Wrong Answer

Solution code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

N = int(input())

print(N%1000)

Submission status: Wrong Answer

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(n-n%1000)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

n=I()
print(n%1000)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
print(int(input())%1000)

Submission status: Wrong Answer

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

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
print(n%1000)

Submission status: Wrong Answer

Solution code:
s = int(input())
print(s % 1000)

Submission status: Wrong Answer

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()
    print(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: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

N=int(input())

print(N%1000)

Submission status: Wrong Answer

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
print(N % 1000)

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000-N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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(n%1000)

Submission status: Wrong Answer

Solution code:
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
print(n%1000)

Submission status: Time Limit Exceeded

Solution code:
cash = int(input())

n=0
paid =0
while paid < cash:
  paid = 1000 * n 

print(paid - cash)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
oturi = 0
while N%1000 != 0:
  oturi += 1

print(oturi)

Submission status: Time Limit Exceeded

Solution code:
i = int(input())

while True:
    i = i-1000
    if 0 < i < 1000:
        print(1000 - i)
        break
    elif i == 0:
        print(0)
        break

Submission status: Time Limit Exceeded

Solution code:
i = int(input())

while True:
    i = i-1000
    if len(str(i)) == 3:
        print(1000 -  i )
        break
    elif i == 0:
        print(0)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
pay = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
pay = int(input())

while(pay >0):
    pay -= 1000
otu = abs(pay)
print(otu)

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(1000-n%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

X = (N - 1)// 1000 + 1

print(1000 * X - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())
sen = math.ceil(N/1000) * 1000
print(sen - 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:
N = input()
N = int(N)

for X in range(0,11):
    a = N-1000*X
    
    if a <= 0:
        break;
C=1000*(X)-N
print(C)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

input = stdin.readline


def solve():
    n = int(input())
    r = n % 1000
    res = 0 if r == 0 else 1000 - r
    print(res)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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())
import math as m
a = m.ceil(N / 1000)
ans = int(a*1000 - N)
print(ans)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    if N%1000 == 0:
        print(0)
    else:
        print(1000 - (N%1000))
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())
ans = N // 1000

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

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

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

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

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

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

if d % 1000 == 0:
    print(0)
else:
    print(1000 - d % 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())
for i in range(11):
    b = i * 1000
    c = b - N
    if c >= 0:
        break
print(c)

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(11):
  ans = i*1000
  judge = ans-n
  if judge>=0:
    break
print(judge)

Submission status: Accepted

Solution code:
A = int(input())
for i in range(11):
  a = i*1000
  t = a-A
  if t>=0:
    break
print(t)

Submission status: Accepted

Solution code:
ip = int(input())

for i in range(1,11):
    pr = 1000 * i
    if int(pr) - ip >= 0:
        print(pr - ip)
        break

Submission status: Accepted

Solution code:
def calc_change(price: int) -> int:
    return 1000 - price % 1000 if price % 1000 != 0 else 0


if __name__ == '__main__':
    print(calc_change(int(input())))

Submission status: Accepted

Solution code:
def calc_change(price: int) -> int:
    while price >= 1000:
        price = price - 1000
    return 1000 - price if not price == 0 else 0

if __name__=='__main__':
    print(calc_change(int(input())))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

s = N / 1000

if s == 0 :
    print(0)
else :
    a = math.ceil(s) * 1000 - N
    print(int(a))

Submission status: Accepted

Solution code:
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())

n=int(input())
print(((1000-(n%1000))%1000 + 1000)%1000)

Submission status: Accepted

Solution code:
import sys

n = int(input())

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

while n > 1000:
    n -= 1000

print(1000 - n)

Submission status: Accepted

Solution code:
N = int(input())

A = N % 1000

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
#A問題

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    print((1000 - n % 1000) % 1000)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n = int(input())

while True:
    if n <= 1000:
        ans = 1000 - n
        break
    n -= 1000
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a,b = divmod(N,1000)
print((b,1000-b)[b != 0])

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

Submission status: Accepted

Solution code:
N = int(input())

while True:
    N -= 1000
    if N <= 0:
        break

print(abs(N))

Submission status: Accepted

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

print((1000 * x) - 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())
for i in range(10):
    ans = (i+1)*1000-N
    if ans >= 0:
        print(ans)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

if amari == 0:
    change = 0
else:
    change = 1000 - amari

print(change)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(x)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(N):
    surplus = N%1000
    if surplus == 0:
        return 0
    else:
        ans = 1000 - surplus
        return ans

if __name__ == '__main__':
    N = int(input())
    ans = main(N)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
k = (N+999) // 1000
print(k*1000-N)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import ceil
#import numpy as np
def main():
    n = int(input())
    r = ceil(n / 1000) * 1000 - n
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
money=int(input())
yen_bills=1000
if yen_bills>=money:
    print(yen_bills-money)
else:
    while yen_bills<money:
        yen_bills+=1000
    print(yen_bills-money)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input())
k = 1000
while k < i:
    k += 1000
    
if k > i:
    print(k - i)
elif k == i:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())
d = (n + 999) // 1000
ans = (d * 1000) - n
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
oturi = math.ceil(N/1000)*1000-N
print(oturi)

Submission status: Accepted

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

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())
print((1000 - n % 1000) % 1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

m = n % 1000

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
for i in range(1000,10001,1000):
    if(i>=n):
        print(i-n)
        break

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:
import math

N = int(input())
A = math.ceil(N/1000)
B = A * 1000

print(B-N)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin

    readline = stdin.readline

    N = int(readline().rstrip())
    
    result = ( 10000 - N )%1000

    print(result)

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

bill = 1000

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

Submission status: Accepted

Solution code:
n = int(input())

b = (n+(1000-1))//1000

print(b*1000-n)

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

Submission status: Accepted

Solution code:
N = int(input())
tmp = 1000
while N > tmp:
    tmp += 1000

print(tmp - N)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
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:
def resolve():
    N = int(input())
    ans = N % 1000
    if ans == 0:
        print(0)
    else:
        print(1000 - ans)
resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(10):
  pay = (i + 1) * 1000
  if(pay >= N):
    break

if(pay < N):
  print("たりません")
else:
	print(pay - 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:
payment = int(input())

count = 1
while True:
    if count * 1000 >= payment:
        print(count * 1000 - payment)
        break
    count += 1

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())

num = (N + 1000 - 1 )// 1000

print(num * 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)*1000-N)

Submission status: Accepted

Solution code:
a=input()

if len(a)==4 or len(a)==5:
  b=a[1:]
  c=1000-int(b)
  if c==1000 :
    print('0')
  else:
    print(c)
  
else:
  print(1000-int(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

n = int(input())

for i in itertools.count():
    if (i * 1000) >= n:
        break

print(i * 1000 - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
n = 10000 - n
n %= 1000
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:
num = int(input())
a = num%1000
if(a != 0):
    print(1000-a)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#l = list(map(int, input().split()))
if n%1000 == 0:
  print(0)
else:
  print(1000-n%1000)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    print(1000 * ((1000 + (N-1)) // 1000) - N)
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:
def main():
    n = int(input())

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


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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    if n%1000>0:
        print(1000-n%1000)
    else:
        print(0)

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

s = N // 1000
t = N % 1000

pay = 0
dif = 0

if t != 0:
  pay = 1000 * (s + 1)
  dif = pay - N
  print(dif)
  
else:
  print(0)