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:
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
if n % 1000 == 0:
    print(n//1000)
    exit()
tmp = (n//1000)+1
# print(tmp)
print(tmp*1000-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
value = int(input().strip())

exc = value % 1000

print(exc)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(chn)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
n = int(input())
amari = (n%1000)

print (min(amari , 1000 - amari))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if(N%1000 == 0):
  print("0")
elif(N<=1000):
  print(1000-N)
elif(N%1000>500):
  print(1000-N%1000)
else:
  print(N%1000)

Submission status: Wrong Answer

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = N % 1000

print(mod)

Submission status: Wrong Answer

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

ans = 1000 - x

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
count = int((N+500)/1000)
print(1000*count-N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
def Main(N):
    return N % 1000

print(Main(N))

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = N
for i in range(1,10):
    ans -= 1000
    if ans >= 1000:
        continue
    elif 1000 > ans >= 0:
        print(ans)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
import math

# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A = list(map(int, input().split()))
s = int(input())
print(((s//1000)+1)*1000-s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())

mod = a % 1000

b = mod - 1000

c = abs(b)

print(c)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): 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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()

print(1000-N%1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N =  int(input())

i = 1
while(True):
  change =  N - 1000*i
  if change >= 1000:
    i+=1
  else:
    break

print(change)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
#DEBUG = True
DEBUG = False
if DEBUG:
    f=open("202007_1st/A_input.txt")
else:
    f=sys.stdin
N=int(f.readline())
print(int(N%1000))
f.close()

Submission status: Wrong Answer

Solution code:
n=int(input())

while n>=0:
    n-=1000
    if 0<=n<1000:
        print(n)

Submission status: Wrong Answer

Solution code:
N = int(input())
while(1):
    if N < 1000: break
    N -= 1000
print(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(0,10000,1000):
  if (i-N) > 0:
    print(i-N)
    break
  elif i == N:
    print(0)
    break
  else:
    pass

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
k = 1000
p = n/k
if p - int(p) == 0:
  print(0)
  
else:
  x = math.ceil(p)*1000
  y = math.ceil(p-1)*1000
  print(min(x-n,n-y))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#A - Payment
N = int(input())
a = N % 1000
if N <1000 :
    ans = 1000- a
elif a >=500:
    ans = 1000 - a
else:
    ans = a

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
print(round(n,-3) - n)

Submission status: Wrong Answer

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

print((int(n/1000)+1)*1000-n)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): 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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()

print(min(N%1000, 1000-N%1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 1000:
    print(n)

elif n % 1000 == 0:
    print(0)

else:

    x = n // 1000

    y = (x+1)*1000

    print(y-n)

Submission status: Wrong Answer

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

A = N % 1000

print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

count = n // 1000
total = n - count * 1000
print(total)

Submission status: Wrong Answer

Solution code:
N=int(input())
otsuri=10000
for i in range(10) :
    if 1000*i-N>=0 :
        coin=1000*i-N
        otsuri=min(otsuri,coin)
print(otsuri)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if(N%1000 == 0):
  print("0")
elif(N<=1000):
  print(N)
elif(N%1000>500):
  print(1000-N%1000)
else:
  print(N%1000)

Submission status: Wrong Answer

Solution code:
a = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
num = int(n[-3:])
print(1000-num)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import os
from sys import stdin, stdout


def solve(tc):
  n = int(stdin.readline().strip())
  print(1000 - (n%1000))


tcs = 1
tc = 1
while tc <= tcs:
  solve(tc)
  tc += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

print(n/1000 + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
yen = N // 100 +1
shoki = yen * 1000
oturi = shoki - N
if oturi == 1000:
  print(int(oturi - 1000))
else:
  print(int(oturi))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

n = int(input())

if n >= 1000:
    print(n%1000)
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
for i in range(10000):
    n+=1
    ans+=1
    if n%1000==0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

print(1000 - (n % 1000))

Submission status: Wrong Answer

Solution code:
N = int(input())

v = (N % 1000)
print(v)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input()) #ここで標準入力

while True:
    ans = num - 1000
    num -= 1000
    if ans < 1000:
        break

print(ans)

Submission status: Wrong Answer

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

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

elif mod > 500:
    mod = 1000-mod
print(mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
i=1000
while(n>i):
  i+=1000
print(i%n)

Submission status: Wrong Answer

Solution code:
N = int(input())
pay = (N // 1000 + 1)*1000
answer = pay - N
print(int(answer))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
m = math.ceil(N/1000)
n_coin = 0
change = 1000*m - N
if change >= 500:
    n_coin += 1
    change -= 500
while change >= 100:
    n_coin += 1
    change -= 100
if change >= 50:
    n_coin += 1
    change -= 50
while change >= 10:
    n_coin += 1
    change -= 10
if change >= 5:
    n_coin += 1
    change -= 5
while change >= 1:
    n_coin += 1
    change -= 1
print(n_coin)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

while N >= 1000:
  N = N - 1000

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

Submission status: Wrong Answer

Solution code:
N = int(input())
count = int((N+500)/ 1000)
print(1000*count-N)

Submission status: Wrong Answer

Solution code:
N = int(input())

i = 1
while True:
    if N < i*1000:
        print(i*1000 - N)
        break
    else:
        i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
import sys
if n<1000:
    print(1000-n)
    sys.exit()
a=n//1000
print(min(n-a*1000,1000-(n-a*1000)))

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 1000
for i in range(1, 100000):
    if ans > n:
        print(ans - n)
        exit()
    ans += 1000

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

 
N = int(input())



print(1000 - (N%1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
s = N // 1000
print(abs(N - (s + 1) * 1000))

Submission status: Wrong Answer

Solution code:
N = int(input())

lst = [0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]
if N in lst:
  thousands = int(N)
else:
  thousands = int(N / 1000) + 1
 
print((1000 * thousands) - N)

Submission status: Wrong Answer

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






abc173_a()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = n % 1000
print(min(x, ((n // 1000) * 1000) - x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = []
for i in range(1,12):
    ans.append(abs((i*1000)-N))
print(min(ans))

Submission status: Wrong Answer

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

import sys

def main():
    n = int(input())
    for i in range(10):
        if i*1000 >= n:
            print(i*1000-n)
            break

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
x=n//1000

m=n-(1000*x)
y=1000-m
print(y)

Submission status: Wrong Answer

Solution code:
n = int(input())

print(1000-(n%1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if N < 1000:
    print(N)
    exit()

elif mod > 500:
    mod = 1000-mod
print(mod)

Submission status: Wrong Answer

Solution code:
N = int(input())

cost = 0
while(cost<N):
    cost += 1000

print(min(cost-N, N%1000))

Submission status: Wrong Answer

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=input()


print(1000-int(x[-3:]))

Submission status: Wrong Answer

Solution code:
N = int(input())

n = N/1000

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
otsuri=10000
for i in range(10) :
    if N-1000*i>=0 :
        coin=N-1000*i
        otsuri=min(otsuri,coin)
print(otsuri)

Submission status: Wrong Answer

Solution code:
N = int(input()) 
tmp = N % 1000
answer = (tmp+1)*1000 -N
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = int(input())

for i in range(1, 10):
    tmp = 1000 * i
    if A <= tmp:
        print(tmp-A)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
d,q = divmod(n,1000)
if q > 500:
    q = 1000 - q

print(d,q)

Submission status: Wrong Answer

Solution code:
#A
n=int(input())
for i in range(100):
    if n<1000:
        break
    else:
        n=n-1000
ans=1000-n
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = []
for i in range(1, 10):
    ans.append(abs(n - 1000*i))

print(min(ans))

Submission status: Wrong Answer

Solution code:
a=int(input(""))
b=1000-a%1000
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

while N > 1000:
  N = N - 1000

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    print(min([i*1000 - n if i*1000 - n > 0 else float("inf")
               for i in range(1, 100)]))
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000-(N-round(N,-3)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#x, y = map(int, input().split())
n = int(input())
a = 0
while(a < n):
  a += 1000
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

ans=n%1000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N < 1000:
    print(1000 - N)
else:
    print(round(N, -3) - N)

Submission status: Wrong Answer

Solution code:
def main():
  N = input()
  if len(N)<4:
    print(int(N))
  else:
    print(int(N[len(N)-2:]))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

A = 1000 - N

print(A)

Submission status: Wrong Answer

Solution code:
x=input()


print(int(x[-3:]))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 1000:
    print(n)
else:

    x = n // 1000

    y = (x+1)*1000

    print(y-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
print(min(N % 1000, abs(N - (N // 1000 + 1) * 1000)))

Submission status: Wrong Answer

Solution code:
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

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

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
ans = 1000 - N % 1000
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ans = 0

    while True:
        if N >= 1000:
            N -= 1000
        else:
            ans = 1000-N
            break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

while 1:
    x = x - 1000
    if x < 0:
        break

print(abs(x))

Submission status: Wrong Answer

Solution code:
p = int(input())

count = 0
while p >= count:
    count += 1000
print(count - p)

Submission status: Wrong Answer

Solution code:

def main():
    n = int(input())
    if n < 1000:
        print(n)
    else: 
        print(int(str(n)[1:]))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
n=N%1000
if n<=500:
    print(n)
else:
    print(1000-n)

Submission status: Wrong Answer

Solution code:
import sys
#DEBUG = True
DEBUG = False
if DEBUG:
    f=open("202007_1st/A_input.txt")
else:
    f=sys.stdin
N=int(f.readline())
print(N%1000)
f.close()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print( 1000 - n % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(0, 10000, 1000):
    if N <= i:
        break

print( i-N )

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = input()
print(1000 - int(N[-3:-1] + N[-1]))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 1000:
  print(1000-n)
else:
  amari = n%1000
  print(1000-amari)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = N // 1000
print(min(abs(N - s * 1000), abs(N - (s + 1) * 1000)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1000
while n > ans:
    ans = ans * 2

print(ans - n)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
m = math.ceil(N//1000)
n_coin = 0
change = 1000*m-N
if change >= 500:
    n_coin +=1
    change -= 500
while change >= 100:
    n_coin += 1
    change -= 100
if change >= 50:
    n_coin +=1
    change -= 50
while change >= 10:
    n_coin += 1
    change -= 10
if change >= 5:
    n_coin +=1
    change -= 5
while change >= 1:
    n_coin += 1
    change -= 1
print(n_coin)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
import sys
n = int((input()))
if n%1000 == 0:
    print(0)
else:
    for i in range(10):
        if n < 1000:
            print(n)
            sys.exit()
        else:
            n -= 1000

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import os
from sys import stdin, stdout


def solve(tc):
    n = int(stdin.readline().strip())
    print(1000 - (n%1000))


tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

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

Submission status: Wrong Answer

Solution code:
n=int(input())
money=1000
while(1):
    if n<=money:
        break
    money+=1000
print(money%n)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = []
for i in range(1,11):
    ans.append(abs((i*1000)-N))
print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
if len(n) >= 4:
  print(int(n[-3:]))
else:
  print(n)

Submission status: Wrong Answer

Solution code:
num = int(input()) #ここで標準入力

while True:
    ans = num - 1000
    if ans < 1000:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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