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:
n = int(input())
 
if n % 1000 == 0 :
    a = n / 1000
else :
    a = n / 1000 + 1
 
b = a * 1000
answer = int(b - n)
 
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 1000 == 0 :
    a = n / 1000
else :
    a = n / 1000 + 1

b = a * 1000
answer = b - n

print(answer)

Submission status: Wrong Answer

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n = int(input())

    #output
    while n >= 0:
        n -= 1000

    print(n + 1000)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(1000 - divmod(int(input()), 1000)[1])

Submission status: Wrong Answer

Solution code:

import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
n=int(input())

print(1000-(n%1000))

Submission status: Wrong Answer

Solution code:
N = int(input())

N = N % 1000
Ans = 1000 - N

print(Ans)

Submission status: Wrong Answer

Solution code:
money = int(input())

print(1000 - money % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
M = int(N)
def cal(a):
  return a%1000

print(1000-cal(M))

Submission status: Wrong Answer

Solution code:
N = input()
M = int(N)
def cal(a):
  return a%1000

print(cal(M))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a, b = divmod(N, 1000)
mod = 1000*(a + 1) - N
print(mod)

Submission status: Wrong Answer

Solution code:
N = int(input())
mod = N % 1000
if mod > 500:
    mod = 1000 - mod
print(mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())

while num >= 1000:
	num = num % 1000
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())

while num < 1000:
		num = num % 1000
print(num)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000 - int(N % 1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print("a")

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 1000 - (n % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
p=1000
i=1
while n>=p :
  p=p*i
  i=i+1
print(p-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:
N=int(input())

n=N%1000
print(1000-n)

Submission status: Wrong Answer

Solution code:
N = int(input())

X = N % 1000
print(1000-X)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

if N<10000:
  print(((N//1000)+1)*1000-N)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(N % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def my_input():
    i = list(map(int, input().split()))
    if len(i) == 1:
        return i[0]
    return i


n = my_input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

P=1000
for i in range(1,11):
    P=min(P,abs(N-i*1000),N)
print(P)

Submission status: Wrong Answer

Solution code:
N=int(input())

P=1000
for i in range(1,11):
    P=min(P,abs(N-i*1000))
print(P)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

w = n % 1000
print(1000 - w)

Submission status: Wrong Answer

Solution code:
n = int(input())
y = 1000
mini = 10000
for i in range(1, 10):
    if abs(n-(y*i)) < mini:
        mini = abs(n-(y*i))

print(mini)

Submission status: Wrong Answer

Solution code:
n = int(input())

mod = n % 1000

print(1000 - mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
r=1000
for i in range(10000000):
  if r>a:
    break
  r=1000*i
print(r-a)

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

Submission status: Wrong Answer

Solution code:
amount = int(input())

x = 1000



while True:
    if amount == 0:
        x = 0
        break
    if x < amount:
        x += 1000
    else:
        break
print(x)    
print(x - amount)

Submission status: Wrong Answer

Solution code:
amount = int(input())

x = 1000



while True:
    if x < amount:
        x += 1000
    else:
        break
print(x)    
print(x - amount)

Submission status: Wrong Answer

Solution code:
amount = int(input())

x = 1000

while True:
    if x < amount:
        x += x
    else:
        break
print(x - amount)

Submission status: Wrong Answer

Solution code:
amount = int(input())

x = 1000

while True:
    if x < amount:
        x += x
    else:
        break
print(x - amount)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    R, C, K = map(int, input().split())
    grid = []
    for r in range(R):
        grid.append([1 if c == '#' else 0 for c in input()])
                
    n_configs = 0

    for rm in range(2**R):
        for cm in range(2**C):
            nb = 0
            for r in range(R):
                for c in range(C):
                    if ((rm >> r) & 1) == 0 and ((cm >> c) & 1) == 0 and grid[r][c] == 1:
                        nb += 1
            if nb == K:
                n_configs += 1

    print(n_configs, flush=True)
    return

Submission status: Wrong Answer

Solution code:
N=int(input())
for i in range(0,11000,1000):
  if N<=i:
    print(int(i-N))

Submission status: Wrong Answer

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

# check
print(N % 1000)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
i = round(math.log10(n))
if i > 1:
    print(round(n, -i) - n)
else:
    print(1000 - n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

while n > 0:
  n -= 1000

print(min(-n, 1000+n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

i = n//1000

tmp1 = n - (i*1000)
tmp2 = ((i+1)*1000) - n
print(min(tmp1, tmp2))

Submission status: Wrong Answer

Solution code:
N=(input())
a=N[0]
if int(N)<=1000:
  print(1000-int(N))

else:
  print(1000-int(N)%1000)

Submission status: Wrong Answer

Solution code:
N=(input())
a=N[0]
if int(N)<=1000:
  print(1000-int(N))
elif int(N)//1000==0:
  print(0)
else:
  print(1000-int(N[1:]))

Submission status: Wrong Answer

Solution code:
N=(input())
a=N[0]
if int(N)<=1000:
  print(1000-int(N))
elif int(N)//1000==0:
  print(0)
else:
  print((int(a)+1)*1000-int(N))

Submission status: Wrong Answer

Solution code:
N=(input())
if int(N)//1000==0:
  print(0)
else:
  print(1000-int(N[1:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = N % 1000

print(1000-mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(str(n))
count = n%1000

if count == 0:
  ans = 0
else:
 ans = 1000*(int(l[0]) + 1) - n
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
# A - Payment
def main():
    N = int(input())
    print(min(N % 1000, 1000 - N % 1000))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(11):
  if n < 1000*i:
    print(1000*i-n)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
import math,sys
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
import heapq 
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def main():
    try:
        n=I()
        temp=math.ceil(n/1000)-n
        print(temp)
    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num=input()
if int(num)<=1000:
    change=1000-int(num)
else:
    array_1=list(num)
    array_1=array_1[-4:]
    a=''.join(array_1)
    b=int(array_1[-4])+1
    pay=b*1000
    change=pay-int(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n<=1000:
  print(1000-n)
else:
  a = int(round(n/1000,0))
  b = 1000*a
  print(abs(n-b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1000
if n<1000:
    print(n-ans)
    exit()
else:
    ans=1000
    while(n>ans):
        if ans==n:
            break
        elif ans>n:
            break
        else:
            ans+=1000
print(abs(n-ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
if n<=1000:
  print(1000-n)
else:
  a = int(round(n/1000,0))
  b = 1000*a
  print(n-b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print(abs(n%1000 - 1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	n=int(input())
	if n <= 2000:
	    print('100')
	else:
		print('0')
		
	
main()

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

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	n=int(input())
	if n <= 2000:
	    print(100)
	else:
		print(0)
		
	
main()

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print(abs(n%1000 - n))

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
a=int(s[0]/1000)+1
print(1000*a-s[0])

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

N = int(input())
N =1 <= N <= 10000

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	n=int(input())
	for i in range(n):
		if n == 3000:
			print(0)
			break
		else:
			print(100)
			break
main()

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

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
a=s[0]%1000
print(a) if a<=500 else print(1000-a)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

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

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	din=int(input())
	if din != 3000:
		print(100)
	else:
		print(0)
main()

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

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
print(s[0]%1000)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if  N % 1000 == 0:
 print(0)
else:
  #N=5300として考えてみる
  ##5300払ったとして5
  sen = N//1000
  ##5*1000=5000円
  sen2 = sen*1000
  ##N(5300)-sen2(5000)
  atai = N-sen2
  #お釣りが300円と出るはずでは？
  print(atai)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
t=int(input())
if t<=1000:
    print(1000-t)

else:
    x=t%1000
    if x>=500:
       print(1000-x)
    else:
       print(x)

Submission status: Wrong Answer

Solution code:
import math
a = input()
b = int(a)
c = 1000
if len(a) < 4:
  print(c-b)
else:
  if a[-4] != '0':
    b = int(a[-3:])
    print(c-b)
  elif a[-3] != '0':
    b = int(a[-2:])
    print(c-b)
  elif a[-2] != '0':
    b = int(a[-1:])
    print(c-b)
  else:
    print(int(0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input()) 

print(1000 - N%1000)

Submission status: Wrong Answer

Solution code:
N = int(input())
1<=N<=10000
for i in range(1,2):
  a = round(N,-3)
  if 5<=i<=10:
    print(a-N)
  if 1<=i<=4:
    print((a-N)+1000)
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

N = int(input())
if N % 1000 == 0:
 print(0)
else:
  #N=5300として考えてみる
  ##5300払ったとして5
  sen = N//1000
  ##5*1000=5000円
  sen2 = sen*1000
  ##N(5300)-sen2(5000)
  atai = N-sen2
  #お釣りが300円と出るはずでは？
  print(atai)

Submission status: Wrong Answer

Solution code:
t=int(input())
x=t%1000
if x>500:
    print(1000-x)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import math
a = input()
b = int(a)
c = 1000
if len(a) < 5:
  print(c-b)
else:
  if a[-4] != '0':
    b = int(a[-5:])
    print(c-b)
  elif a[-3] != '0':
    b = int(a[-4:])
    print(c-b)
  elif a[-2] != '0':
    b = int(a[-3:])
    print(c-b)
  else:
    print(int(0))

Submission status: Wrong Answer

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

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:
t=int(input())
m=0
while 1000*m<t:
    m=m+1
c=1000*m-t
print(t)

Submission status: Wrong Answer

Solution code:
import math
a = input()
b = int(a)
c = 1000
if len(a) < 5:
  print(c-b)
else:
  if a[-4] != '0':
    b = int(a[-5:])
  elif a[-3] != '0':
    b = int(a[-4:])
  elif a[-2] != '0':
    b = int(a[-3:])
  else:
    b = int(a[-0])
  print(c-b)

Submission status: Wrong Answer

Solution code:
t=int(input())
f=t%1000
if f>500:
  print(1000-f)
else:
  print(f)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

if 1< a < 1000:
    print(1000 - a)
if 1000 < a < 2000:
    print(2000 - a)
if 2000 < a < 3000:
    print(3000 - a)
if 3000 < a < 4000:
    print(4000 - a)
if 4000< a < 5000:
    print(5000 - a)
if 5000< a < 6000:
    print(6000 - a)
if 6000< a < 7000:
    print(7000 - a)
if 7000 < a < 8000:
    print(8000 - a)
if 8000 < a < 9000:
    print(9000 - a)
if 9000 < a <10000:
    print(10000 - a)
if a == 1000:
    print(0)
if a == 2000:
    print(0)
if a == 3000:
    print(0)
if a == 4000:
    print(0)
if a == 5000:
    print(0)
if a == 6000:
    print(0)
if a == 7000:
    print(0)
if a == 8000:
    print(0)
if a == 9000:
    print(0)
if a == 10000:
    print(0)

# (物の値段/入力)a + （おつり）N = 1000?
#Nは整数だから　print(おつり)
#　N　＝　1000? - a

#input 1900  print 100 (2000)
# input 1525 print 475 (2000)
# input 2500 print 500 (3000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
inp = input()

value = int(inp)

amari = value % 1000

result = 1000 - amari

print(result)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=N%1000
if N>1000 and a>500:
      print(1000-a)
elif N>1000 and a<500:
    print(a)
elif N<1000:
    print(1000-a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
o = n + 1000
o = o // 1000
o = o * 1000

print(o - n)

Submission status: Wrong Answer

Solution code:
print("{}".format(int(input()) % 1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
x = math.ceil(n/1000)
s = 1000*x

if n > s:
    result = n - s
else:
    result = s - n
    
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# 出力
print("{}".format(a % 1000))

Submission status: Wrong Answer

Solution code:
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
amari = a % 1000
# 出力
print("{}".format(amari))

Submission status: Wrong Answer

Solution code:
N = int(input())
S = divmod(N, 1000)
print (S[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
amari = a % 1000
# 出力
print("{}".format(amari))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ma = 1000
given = int(input())
c = given%ma
if(c == 0):
  print(0)
else:
  print(c-1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
n = str(n)
if len(n) >= 3:
    p = n[-3]+n[-2]+n[-1]
if len(n) == 2:
    p = n[-2]+n[-1]
if len(n) == 1:
    p = n[-1]
print(int(p))

Submission status: Wrong Answer

Solution code:
cost = input()
amari = cost[-3:]

print(1000 - int(amari))

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
x = math.ceil(1100/1000)
s = 1000*x

if n > s:
    result = n - s
else:
    result = s - n
    
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%1000 == 0:
    print(0)
else:
    Str = str(N)
    if len(Str) == 3:
        print(1000-N)
    else:
        K = (int(Str[0])+1)*1000
        print(K-N)

Submission status: Wrong Answer

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

if a == 1000:
    print(0)
if a == 2000:
    print(0)
if a == 3000:
    print(0)
if a == 4000:
    print(0)
if a == 5000:
    print(0)
if a == 6000:
    print(0)
if a == 7000:
    print(0)
if a == 8000:
    print(0)
if a == 9000:
    print(0)
if a == 10000:
    print(0)
    
# (物の値段/入力)a + （おつり）N = 1000?
#Nは整数だから　print(おつり)
#　N　＝　1000? - a

#input 1900  print 100 (2000)
# input 1525 print 475 (2000)
#input 3000  print 0 (3000)
# input 2500 print 500 (3000)

# 右の時は出力０　1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
# それ以外

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())


while N >= 0:
  N -= 1000

print(abs(N))

Submission status: Wrong Answer

Solution code:
def main(money):
    a  = money % 1000
    if a > 0:
        change = 1000 - a
    else:
        change = 0
    return change

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=input()
i=(int(N[0])+1)*1000
j=i-int(N)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
if len(N) > 3:
    A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
    if A == 0:
        print(0)
    else:
        print(1000 - A)
elif len(N) == 2:
    A = int(N[-2])*10 + int(N[-1])
    print(1000 - A)
elif len(N) == 1:
    A = int(N[-1])
    print(1000 - A)

Submission status: Wrong Answer

Solution code:
n = int(input())

change = 1000- n % 1000
print(change)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

if n == 10000:
	ans = 0
else:
	for i in range(1000,10000,1000):
		if 0 < (i - n) < 1000:
			ans = (i - n)
			break
		elif i == n:
			ans == 0

print(ans)