Problem:


Score : 100 points

Problem Statement

We will buy a product for N yen (the currency of Japan) at a shop.

If we use only 1000-yen bills to pay the price, how much change will we receive?

Assume we use the minimum number of bills required.

Constraints

1 \leq N \leq 10000

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the amount of change as an integer.

Sample Input 1

1900

Sample Output 1

100

We will use two 1000-yen bills to pay the price and receive 100 yen in change.

Sample Input 2

3000

Sample Output 2

0

We can pay the exact price.



Sample input:
1900


Sample output:
100

Submission status: Accepted

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

N=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1]

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000-N%1000)

Submission status: Accepted

Solution code:

import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
from itertools import accumulate, permutations

import bisect
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------



N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# N, M = [int(_) for _ in input().split()]
N = int(input())
print((10000-N) % 1000)

Submission status: Accepted

Solution code:
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()

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

Submission status: Accepted

Solution code:
def main():
    N=int(input())
    s=10000-N
    print(s%1000)

    
main()

Submission status: Accepted

Solution code:
n = int(input())

num = -(-n // 1000)

print(1000 * num - n)

Submission status: Accepted

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n = I()
    a = math.ceil(n/1000)
    ans = 1000*a-n
    print(ans)
    return

if __name__=='__main__':
    Main()

Submission status: Accepted

Solution code:
# a,b=map(int,input().split())
n=int(input())
print((1000-n%1000)%1000)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

print(1000 - n)

Submission status: Accepted

Solution code:
n = int(input())
p = 1000
y = (p - n % p) % p
x = (n + y) // p

print(y)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

N = int(input())
#S = input()
#N, M = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    r = N % 1000
    if r == 0:
        ans = 0
    else:
        ans = 1000 - r

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#create date: 2020-07-05 21:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = (10000 - N) % 1000

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
print(1000-N%1000 if N%1000 else 0)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
if n%1000==0:
    print(0)
else:
    x=(n//1000+1)*1000
    print(x-n)

Submission status: Accepted

Solution code:
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#A,B= map(int,input().split())
#P = list(map(int,input().split()))
#S = str(input())
#T = str(input())
for i in range(1000):
    if 1000*i - N >= 0:
        print(1000*i - N)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

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

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

x = 0
while x < n:
   x += 1000
print(x - n)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

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

Submission status: Accepted

Solution code:

x = int(input())
print(0 if x % 1000 == 0 else 1000 - x % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    n = Z()
    x = (n + 1000 - 1)//1000
    print(1000*x - n)

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def solve():
    N = int(readline())
    a = N % 1000
    if a == 0:
        print(0)
    else:
        print(1000 - a)


solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(input())

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

Submission status: Accepted

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

def main():
    n = int(input())
    a = n % 1000
    if a > 0:
        print(1000 - a)
        exit()
    print(a)

def count_tento(l, cur):
    count = 0
    for v in l:
        if v > cur:
            count += 1
    return count

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#pyrival orz
import os
import sys
from io import BytesIO, IOBase

"""
    for _ in range(int(input())):
    n,m=map(int,input().split())
    n=int(input())
    a = [int(x) for x in input().split()]
"""

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

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())

tmp = -(-n//1000)

print(tmp*1000-n)

Submission status: Accepted

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

N = int(input())
a = (N+999)//1000*1000
print(a-N)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())
print((1000 - (N % 1000)) % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
from itertools import permutations
input = sys.stdin.readline

N=int(input())
print((1000-N%1000)%1000)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    if N % 1000 == 0: print(0)
    else: print(1000 - (N % 1000))

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

ans = M*1000-N
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    print((100000 - N) % 1000)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
mult = (N + 999) // 1000

print(mult * 1000 - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil


def main():
    n = int(input())
    print(1000 * ceil(n / 1000) - n)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


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

Submission status: Accepted

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

'''
Author: andyli
Time: 2020-07-05 19:56:16
'''

import os
from io import BytesIO, IOBase
import sys


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


# region fastio
BUFSIZE = 1048576


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda: self.buffer.read().decode('ascii')
        self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip('\r\n')

# endregion


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

print(1000*(-(-N//1000))-N)

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

i = 0
while 1000 * i < n:
    i += 1
print(1000 * i - n)

Submission status: Accepted

Solution code:
#                          JAI SHREE RAM

import math; from collections import *
import sys; from functools import reduce

# sys.setrecursionlimit(10**6)
def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def get_string(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())):
n = int(input())
print(math.ceil(n/1000)*1000-n)

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
print(((-1)*n)%1000)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
f = (n+999)//1000*1000
print(f-n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()
ans = -1 * N % 1000
print(ans)

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(500000)

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math  # noqa: F401
from collections import deque  # noqa: F401
from typing import Deque, Dict, List, Optional, Tuple, Union  # noqa: F401


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


if __name__ == "__main__":
    N = int(input())
    main(N)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
while(ans < N):
  ans += 1000
print(ans-N)