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:
import sys
n = int(input())
for i in range(100):
  if 1000*i >= n:
    print(1000*i - n)

Submission status: Wrong Answer

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

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

print(1000-p)

Submission status: Wrong Answer

Solution code:
N = int(input())

hoge = N // 1000 + 1

oturi = 1000 * hoge - N

print(oturi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
res =N
while res>= 1000 :
  res = res -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())
if N%1000 == 0:
    print(0)
else:
    if N > 1000:
        N -= (N // 1000) * 1000
        print(1000 - N)
    else:
        print(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()

_, c = divmod(N, 1000)
print(1000 - c)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = n % 1000

ans = 1000 - ans

print(ans)

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

Submission status: Wrong Answer

Solution code:
n=int(input())
print(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())
r = n % 1000
print(1000 - r)

Submission status: Wrong Answer

Solution code:
num = int(input())

if num % 3000 == 0:
    print(0)
else:
    print(1000 - (num % 1000))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ans = n % 1000
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N =int(input())

K = N % 1000

print(K)

Submission status: Wrong Answer

Solution code:
N = int(input())

x = N % 1000
print(x)

Submission status: Wrong Answer

Solution code:
def task():
    n=int(input())
    if(n>=1000):
        n=n%1000
    else:
        n=1000-n
    print(n)
def default():
    t=1
    while(t):
        t-=1
        task()
if(__name__=="__main__"):
    default()

Submission status: Wrong Answer

Solution code:
n = int(input())

a = n%1000

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

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().strip())
print( 1000 - (N % 1000) )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 1000 - (n%1000)

print(ans)

Submission status: Wrong Answer

Solution code:

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



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    N = int(input())
    print(1000 - N % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

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

N = INT()

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

Submission status: Wrong Answer

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


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readint()
    print((N // 1000 + 1) * 1000 - N)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a = int(input())
x = 0
for i in range(a):
    if a >= x:
        x = x + 1000
    else:
        break
print(abs(x - a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

m = n % 1000

if m < 501:
    print(m)
else:
    print(1000-m)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N=int(input().rstrip('\n'))
n = N%1000
print(1000-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000-N % 1000)

Submission status: Wrong Answer

Solution code:

def abc173_a():
    N = int(input())

    #N = 1900
    print(1000-N%1000)






abc173_a()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 1000 == 0:
    print(0)
else:
    a = round(n / 1000)
    print(a*1000 - n)

Submission status: Wrong Answer

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
print(1000-int(stdin.readline().rstrip()) % 1000)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
for i in range(10) :
    if 1000*i>=n and x == 0:
        x = i

print(1000*x-n)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1000, 10000, 1000):
    if n < i:
        print(i-n)
        break

Submission status: Wrong Answer

Solution code:
N = int(input())


pre = N // 1000

ans = N - 1000*pre

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

x = N // 1000
x = 2 * x
print(x - N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000 - N%1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

x = n // 1000

y = (x+1)*1000

print(y-n)

Submission status: Wrong Answer

Solution code:
a = int(input())

b = int(a // 1000)

print(1000*(b + 1) - a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
print(math.ceil(int(input())/1000))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


n = int(input())

print(n%1000)

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

num1 = N % 1000

print(1000 - num1)

Submission status: Wrong Answer

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

a=one_int()

print(a%1000)

Submission status: Wrong Answer

Solution code:

n=int(input())

print(n%1000)

Submission status: Wrong Answer

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

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)

Submission status: Wrong Answer

Solution code:
a = int(input())

a %= 1000
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = int(input())

result = A%1000
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

a=n%1000
print(1000-a)

Submission status: Wrong Answer

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

    return N % 1000

print(main())

Submission status: Wrong Answer

Solution code:

n = int(input())
mai = n//1000
mai += 1
print(mai*1000-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理
ans = N % 1000

# 結果出力
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    print(int(input()) - 1000)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
for i in range(10) :
    if 1000*i>n and x == 0:
        x = i

print(1000*x-n)

Submission status: Wrong Answer

Solution code:
N = int(input())

thousands = int(N / 1000) + 1

print((1000 * thousands) - N)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 1000
i = 1
while ans < N:
    i += 1
    ans *= i
print(ans % N)

Submission status: Wrong Answer

Solution code:
#1問目
N = int(input())
while N / 1000 >= 1:
    N = N - 1000
print(N)

Submission status: Wrong Answer

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

@author: NEC-PCuser
"""

N = int(input())

print(1000 - (N % 1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(1000, 10000, 1000):
    if i >= n:
        print(i-n)
        exit()

Submission status: Wrong Answer

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

print(n % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

p = N%1000
print(1000-p)

Submission status: Wrong Answer

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

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

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

print(n-(i-1)*1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N=int(input())

ans=N%1000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(N - (a*1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

print(1000-N%1000)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

print(min(abs(n-kiriage*1000),abs(n-kirisute*1000)))

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    print(int(input()) - 1000)
    return 0

if __name__ == "__main__":
    solve()
1900

Submission status: Wrong Answer

Solution code:
import sys

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

N = I()

ans = N // 1000
ans2 = N - ans*1000
print(ans2)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

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

Submission status: Wrong Answer

Solution code:
a = int(input())
#a = list(map(int, input().split()))
#x,y = map(int, input().split())

#x,n = map(int, input().split())
#p = input().split()
#for i in range(len(p)):
#    p[i] = int(p[i])
money = 0
while True:
    if money > a:
        print(money-a)
        break
    else :
        money += 1000

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input()) 

ans = a % 1000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(N)

Submission status: Wrong Answer

Solution code:
from typing import List
N = int(input())

print(N-N%1000)

Submission status: Wrong Answer

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

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

i = N // 1000
ans = N - i * 1000
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(1, 10):
    money = i * 1000
    if money - N >= 0:
        print(money - N)
        exit()

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

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

remind = N % 1000
res = 1000 - remind
print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/7/5 19:54
# @Version : 1.1
# @Author  : Jade
# @File    : a.py
# @Software: PyCharm
#

def main():
    n = int(input())
    print(1000 - n%1000)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/local/bin/python3
# coding: utf-8
import numpy as np
hairu = int(input())

turi = hairu%1000

print(1000 - turi)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solution(N):
    return 1000 - (N % 1000)

if __name__ == "__main__":
    N = int(input())
    print(solution(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()

    
    print(1000-N%1000)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

q, mod = divmod(N, 1000)

print(1000-mod)

Submission status: Wrong Answer

Solution code:
N =int(input())

K = N % 1000

print(str(K))

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())
x = n % 1000
print(min(x, 1000 - x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
m=n%1000
l=1000-m
print(min(l,m))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

p = N%1000+1
print(p*1000-N)

Submission status: Wrong Answer

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

a = int(input())
b = a % 1000

print(b)

Submission status: Wrong Answer

Solution code:
n = int(input())

amari = n%1000

print(1000-amari)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=a%1000
print(min(1000-b,0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""while True:
        break"""
    

N=int(input())

print(N%1000)

Submission status: Wrong Answer

Solution code:
import sys, math,os
from io import BytesIO, IOBase
#data = BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from bisect import bisect_left as bl, bisect_right as br, insort
# from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
# from itertools import permutations,combinations
# from decimal import Decimal
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var): sys.stdout.write(' '.join(map(str, var)) + '\n')
def out(var): sys.stdout.write(str(var) + '\n')
#sys.setrecursionlimit(100000 + 1)
INF = 10**9
mod = 998244353

N=int(data())
out(1000-N%1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

n = N % 1000

print(1000-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

print(N%1000)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(mod)

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-(s//1000)*1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    for i in range(1000,10000,1000):
        if i - n >= 0:
            print(i-n)
            return
            
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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