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: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 16:22:00 2020

@author: neb0123
"""

def maxProductSubarrayOfSizeK(A, n, k): 
  
    # sorting given input array 
    A.sort() 
  
    # variable to store final product of  
    # all element of sub-sequence of size k 
    product = 1
  
    # CASE I 
    # If max element is 0 and 
    # k is odd then max product will be 0 
    if (A[n - 1] == 0 and (k & 1)): 
        return 0
  
    # CASE II 
    # If all elements are negative and 
    # k is odd then max product will be 
    # product of rightmost-subarray of size k 
    if (A[n - 1] <= 0 and (k & 1)) : 
        for i in range(n - 1, n - k - 1, -1): 
            product *= A[i] 
        return product 
  
    # else 
    # i is current left pointer index 
    i = 0
  
    # j is current right pointer index 
    j = n - 1
  
    # CASE III 
    # if k is odd and rightmost element in 
    # sorted array is positive then it 
    # must come in subsequence 
    # Multiplying A[j] with product and 
    # correspondingly changing j 
    if (k & 1): 
        product *= A[j] 
        j-= 1
        k-=1
  
    # CASE IV 
    # Now k is even. So, Now we deal with pairs 
    # Each time a pair is multiplied to product 
    # ie.. two elements are added to subsequence  
    # each time. Effectively k becomes half 
    # Hence, k >>= 1 means k /= 2 
    k >>= 1
  
    # Now finding k corresponding pairs to get 
    # maximum possible value of product 
    for itr in range( k) : 
  
        # product from left pointers 
        left_product = A[i] * A[i + 1] 
  
        # product from right pointers 
        right_product = A[j] * A[j - 1] 
  
        # Taking the max product from two  
        # choices. Correspondingly changing 
        # the pointer's position 
        if (left_product > right_product) : 
            product *= left_product 
            i += 2
          
        else : 
            product *= right_product 
            j -= 2
  
    # Finally return product 
    return product

if __name__ == "__main__":
    N,K = map(int, input().split(' '))
    A = list(map(int,input().split(' ')))
    print(maxProductSubarrayOfSizeK(A,N,K) % (10**9 + 7))

Submission status: Runtime Error

Solution code:
import sys
import numpy as np

length = int(sys.stdin.readline())

array = np.array([int(i) for i in sys.stdin.readline().split()], dtype=np.int32)

array[::-1].sort()

array = list(array)

added = array[0:1]
to_add = array[1:]

score = 0
while to_add:
  inst = to_add.pop(0)
  scores = [min(added[i-1], added[i]) for i in range(len(added))]
  index = np.argmax(scores)
  max_score = scores[index]
  score += max_score
  added.insert(index, inst)

print(score)

Submission status: Runtime Error

Solution code:
from collections import Counter
li=[]
d={}
for i in range(int(input()):
    p=input()
    if(p in d):
        d[p]+=1
    else:
    	d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

Submission status: Runtime Error

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


MOD = 10**9 + 7


def solve(n, k, a):
    a = sorted(a, reverse=True, key=lambda x: (abs(x), 1 if x >= 0 else -1))
    sign = 1
    for i in range(k):
        if a[i] < 0:
            sign = -sign
        if a[i] == 0:
            sign = 0

    if sign == 0:
        return 0

    if sign == 1:
        ans = 1
        for i in range(k):
            ans = (ans * abs(a[i])) % MOD
        return ans

    if sign == -1:
        cc = []

        more_neg = -1
        for i in range(k, n):
            if a[i] < 0:
                more_neg = i
                break

        more_pos = -1
        for i in range(k, n):
            if a[i] > 0:
                more_pos = i
                break

        taken_neg = -1
        for i in range(k-1, -1, -1):
            if a[i] < 0:
                taken_neg = i
                break

        taken_pos = -1
        for i in range(k - 1, -1, -1):
            if a[i] > 0:
                taken_pos = i
                break

        if more_neg >= 0 and taken_pos >= 0:
            cc.append((taken_pos, more_neg))
        if more_pos >= 0 and taken_neg >= 0:
            cc.append((taken_neg, more_pos))
        if len(cc) == 2 and cc[0][1] * cc[1][0] < cc[1][1] * cc[0][0]:
            cc[0], cc[1] = cc[1], cc[0]

        # cc = sorted(cc, key=lambda x: abs(a[x[1]] / a[x[0]]), reverse=True)

        if len(cc) > 0:
            ans = 1
            for i in range(k):
                if i != cc[0][0]:
                    ans = (ans * a[i]) % MOD
            ans = (ans * a[cc[0][1]]) % MOD
            return ans
        else:
            # product is negative, taking smallest
            ans = 1
            for i in range(k):
                ans = (ans * a[n-i-1]) % MOD
            return ans


import random


def gen():
    for n in range(2, 100):
        for k in range(2, n):
            for t in range(100):
                a = [random.randrange(100) - 100 for _ in range(n)]
                solve(n, k, a)
        wi(n)


def main():
    # gen()
    # return
    n, k = ria()
    a = ria()
    wi(solve(n, k, a))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9+7

ps = []
ns = []
zs = []
for i in range(n):
  if a[i] > 0:
    ps.append(a[i])
  elif a[i] < 0:
    ns.append(a[i])
  else:
    zs.append(a[i])
  
if k == 1:
  print(max(a))
elif len(ps) + len(ns) < k:
  print(0)
elif len(ps) == 0:
  ans = 1
  if k % 2 == 0:
    ns = sorted(ns)
    for i in range(k):
      ans = ans * ns[i] % mod
  elif len(zs) > 0:
    print(0)
  else:
    ns = sorted(ns, reverse=True)
    for i in range(k):
      ans = ans * ns[i] % mod
  print(ans)
else:
  ans = 1
  ps = sorted(ps, reverse=True)
  ns = sorted(ns)
  if k % 2 == 0:
    pp = []
    for i in range(0,min(k, len(ps)), 2):
      try:
        pp.append(ps[i] * ps[i+1])
      except:
        pass
  else:
    pp = []
    ans = ps[0]
    for i in range(1,len(ps), 2):
      try:
        pp.append(ps[i] * ps[i+1])
      except:
        pass
  np = []
  for i in range(0, len(ns), 2):
    try:
      np.append(ns[i] * ns[i+1])
    except:
      pass
  pnp = sorted(pp + np, reverse=True)
  if len(pnp) >= k//2:
    for i in range(k//2):
      ans = ans * pnp[i] % mod
    print(ans)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort(reverse = True)
indx_list = []
for i in range(1,100000,2):
    indx_list.append(i)
insx_list = []
for j in range(0,20):
    insx_list.extend(indx_list[:2 ** j])
mx_cmfrt = 0
reached_list = [A_list[0],A_list[0]]
for j in range(1, len(A_list)):
    cmfrt = min(reached_list[insx_list[j-1]-1],reached_list[insx_list[j-1]])
    reached_list.insert(insx_list[j-1], A_list[j])
    mx_cmfrt += cmfrt
print(mx_cmfrt)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(2000)

n, k = map(int, input().split())
an = list(map(int, input().split()))

mod = 10**9 + 7

als = []
test = True
for i in an:
    if i > 0:
        test = False
    als.append([abs(i), i])
if test and k % 2 == 1:
    an.sort(reverse=True)
    ans = 1
    for i in range(k):
        ans = ans * an[i] % mod
    print(ans)
    exit()

als.sort(reverse=True)

ans = 1
min_p = 10**9 + 1
min_m = - 10**9 + 1
cnt = 0
for i in range(k):
    x, y = als[i]
    ans = ans * x % mod
    if y > 0:
        min_p = x
    if y < 0:
        min_m = x
        cnt += 1

if cnt % 2 == 0:
    print(ans)
    exit()

max_p = 0
max_m = 0
for j in range(k, n):
    if als[j][1] > 0:
        max_p = max(max_p, als[j][0])
    if als[j][1] < 0:
        max_m = max(max_m, als[j][0])
    if max_p != 0 and max_m != 0:
        break

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y/2)**2 * x % mod

if max_m == 0 or max_p / min_m >= max_m / min_p:
    print(ans * max_p * power(min_m, mod-2) % mod)
else:
    print(ans * max_m * power(min_p, mod-2) % mod)

Submission status: Runtime Error

Solution code:
from collections import Counter
li=[]
for i in range(int(input()):
	li.append(input())  
d=Counter(li)
print('AC','x',d['AC'] if 'AC' in d else 0)
print('WA','x',d['WA'] if 'WA' in d else 0)
print('TLE','x',d['TLE'] if 'TLE' in d else 0)
print('RE','x',d['RE'] if 'RE' in d else 0)

Submission status: Runtime Error

Solution code:
N=input()
if len(N) >3:
  i=(int(N[:-3])+1)*1000
else:
  i=N
 
j=i-int(N)
 
elif j>999:
  print(0)
else:
  print(j)

Submission status: Runtime Error

Solution code:
import numpy as np
h, w, k = map(int, input().split())
c = []
blacks = []
all_b = 0
ans = 0

for i in range(h):
    temp = input()
    temp_list = []
    for t in temp:
        temp_list.append(t)

    c.append(temp_list)
    blacks.append(c[i].count('#'))
    all_b += blacks[i]

c_t = np.array(c).T.tolist()

if all_b == k:
    ans += 1

for i in range(h):
    if k == all_b - blacks[i]:
        ans += 1

for i in range(w):
    if k == all_b - c_t[i].count('#'):
        ans += 1


for i in range(h):
    s = blacks[i]
    for j in range(i+1, h):
        if i != j:
            if k == all_b - s - blacks[j]:
                ans += 1


for i in range(w):
    temp = c_t[i].count('#')
    for j in range(i+1, w):
        if i != j:
            temp_2 = c_t[j].count('#')
            if k == all_b - temp - temp_2:
                ans += 1


for i in range(h):
    s = blacks[i]
    for j in range(w):
        counter_t = c_t[j].count('#')
        if k == all_b - counter_t - s + c[i][j].count('#'):
            ans += 1


print(ans)

Submission status: Runtime Error

Solution code:
lis = []
a = []
n = int(input())
a = input().split()
a_  = sorted(a,reverse=True)
a_ = list(a_)
for i in a_:
    if len(lis)==0:
        lis.append(int(i))
    elif len(lis)==1:
        lis.append(lis[0])
    else:
        lis_ = sorted(lis,reverse=True)
        lis.append(lis_[1])
lis_.append(lis[1])
print(sum(int(j) for j in lis_))

Submission status: Runtime Error

Solution code:
def solmax(a,i,j):
    if j==0:
        return 1
    if i==j:
        return p[i]
    u=solmax(a,i-1,j)
    if a[i-1]>0:
        u=max(u,solmax(a,i-1,j-1)*a[i-1])
    elif a[i-1]<0:
        u=max(u,solmin(a,i-1,j-1)*a[i-1])
    else:
        u=max(u,0)
    return u
def solmin(a,i,j):
    if j==0:
        return 1
    if i==j:
        return p[i]    
    u=solmin(a,i-1,j)
    if a[i-1]>0:
        u=min(u,solmin(a,i-1,j-1)*a[i-1])
    elif a[i-1]<0:
        u=min(u,solmax(a,i-1,j-1)*a[i-1])
    else:
        u=min(u,0)
    return u
if __name__ == '__main__':
  n=int(input())
  k=int(input())
  a=[]
  p=[1]
  for i in range(n):
      t=int(input())
      a.append(t)
      p.append(p[-1]*t)
  print(solmax(a,n,k)%1000000007)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for i in range(n)]

status = ["AC","WA","TLE","RE"]
ans  = [0]*n

for i in range(len(status)):
    ans[i] = len([j for j in s if status[i] in s])

print("AC x {}".format(ans[0]))
print("WA x {}".format(ans[1]))
print("TLE x {}".format(ans[2]))
print("RE x {}".format(ans[3]))

Submission status: Runtime Error

Solution code:

a  = money % 1000
if a > 0:
    change = 1000 - a
else:
    change = 0
print(change)

Submission status: Runtime Error

Solution code:
def main():
	N=input()
	if N[1] != '0':
		print(100)
	else:
		print(0)
main()

Submission status: Runtime Error

Solution code:
n = int(input())  # nは入力回数
str_list = [input() for _ in range(n)]


a=0
b=0
c=0                
d=0                
                
for num in range(1, n):
    if str_list[num] == 'AC':
    	a += 1
    elif str_list[num] == 'WA':
    	b += 1
    elif str_list[num] == 'TLE':
    	c +=1
    else str_list[num] == 'RE':
    	d +=1
    		continue;

print('AC x'+ a)
print('WA x'+ b)
print('TLE x'+ c)
print('RE x'+ d)

Submission status: Runtime Error

Solution code:
n = int(input())  # nは入力回数
str_list = [input() for _ in range(n)]


a=0
b=0
c=0                
d=0                
                
for num in range(1, n)
    if str_list[num] == 'AC':
    	a += 1
    elif str_list[num] == 'WA':
    	b += 1
    elif str_list[num] == 'TLE':
    	c +=1
    else str_list[num] == 'RE':
    	d +=1
    		continue;

print('AC x'+ a)
print('WA x'+ b)
print('TLE x'+ c)
print('RE x'+ d)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for i in range(n)]

status = ["AC","WA","TLE","RE"]

for i in range(len(status)):
    status[i] = len([j for j in s if status[i] in s])

print("AC x {}".format(status[0]))
print("WA x {}".format(status[1]))
print("TLE x {}".format(status[2]))
print("RE x {}".format(status[3]))

Submission status: Runtime Error

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

if a<1000:
  print(1000-a)
for i in 10:
  if 1000*i>a:
     print(1000*i-a)

Submission status: Runtime Error

Solution code:
n = int(input())
if n%10**3 != 0:
  return 1000 - n%10**3
else:
  return 0

Submission status: Runtime Error

Solution code:
import math
a = input()
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])
c = 1000
print(c-b)

Submission status: Runtime Error

Solution code:

N = 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: Runtime Error

Solution code:
n=int(input())
if n[1]!='0':
  print(100)
else:
  print(0)

Submission status: Runtime Error

Solution code:
input()=N
if N %1000<1000:
  print(N%1000)
if N %2000 <1000:
  print(N%2000)
if N %3000<1000:
  print(N%3000)
if N %4000<1000:
  print(N%4000)
if N %5000<1000:
  print(N%5000)
if N %6000<1000:
  print(N%6000)
if N %7000<1000:
  print(N%7000)
if N %8000<1000:
  print(N%8000)
if N %9000<1000:
  print(N%9000)
else N %10000<1000:
  print(N%10000)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
print(0 if n[-3]=='0' else (1000-int(n[-3])*100))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=str(input())
if n[-1]=='0' and n[-2]=='0' and n[-3]=='0':
	print(0)
else:
	print(1000-int(n[-3]+n[-2]+n[-1]))

Submission status: Runtime Error

Solution code:
print(input()　% 1000)

Submission status: Runtime Error

Solution code:
#! /usr/bin/python3

N = [int(input()) for N in range(10000)]
#N = 5300
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: Runtime Error

Solution code:
money=int(input())
if(ceil(money/1000.0)==floor(money/1000.0)):
  print("0")
elif(ceil(money/1000.0)>floor(money/1000.0)):
  print(money%1000)
else:
  print(1000-(money%1000))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
x=[int(input()) for i in range(11)]
print(1000*x-n)

Submission status: Runtime Error

Solution code:
#! /usr/bin/python3

N = [int(input()) for N in range(10000)]

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

Submission status: Runtime Error

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


j=i-int(N)

if j>999:
  print(0)
else:
  print(j)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
i = int(input())
j = list(map(int, input().split()))
j.sort()
j = j[1:]
print(sum(j))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:



din=input()
if din[1] != '0':
	print(100)
else:
	print(0)

Submission status: Runtime Error

Solution code:
N = input()
S = (N[-3])
A = int(S) - 10
print (abs(A) * 100)

Submission status: Runtime Error

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

print(1000 - amari)

Submission status: Runtime Error

Solution code:
N=int(input())
##一万円まで
for N in 10000:
  ##1000円で割り切れたらお釣りなし
  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: Runtime Error

Solution code:
N = int(input())
minn=1000
if N <1 or N>10000
	print(' ')
elif N%1000==0:
	print(0)
else:
	for i in range(1000,10001,1000):
		if N<i:
			print(i-N)
			break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(money):
  a  = money % 1000
  if a > 0:
    change = 1000 - a
 
  elif a = 0:
    change = 0
 
  print(int(change))

Submission status: Runtime Error

Solution code:
n = []
while True:
    try:
        n=int(input())
        while n-a<1000:
          print(n-a)
          a+=1000
    except EOFError:
        break

Submission status: Runtime Error

Solution code:
n=int(input())
x=int(input())
if x = 0:
    break
elif 1 <= x <= 10:
    print(1000*x-n)
elif 11 < x:
    break

Submission status: Runtime Error

Solution code:
money = input()
def main(money):
  a  = money % 1000
  if a > 0:
    change = 1000 - a
 
  elif a = 0:
    change = 0
 
  print(change)

Submission status: Runtime Error

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

  elif a = 0:
    change = 0

  print(change)

Submission status: Runtime Error

Solution code:
n = list(int(input))

ans = 0

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(money):
  a  = money % 1000
  if a != 0:
    change = 1000 - a
  elif a = 0:
    change = 0
  print(change)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(money):
  a  = money % 1000
  if a != 0:
    change = 1000 - a
    return change
  elif a = 0:
    change = 0
    return change
  print(change)

Submission status: Runtime Error

Solution code:
N = int(input())

a = N//1000

if 1000*a != N:
print(1000*(a+1)-N)

else:
print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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=input()
	if din[1] != '0':
		print('100')
	else:
		print('0')
main()

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

Submission status: Runtime Error

Solution code:
N=int(input())

x %= 1000

Otsuri = 1000-x

print(Otsuri)

Submission status: Runtime Error

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=input()
	idx=[]
	if din[1] == '9':
		print(100)
	else:
		print(0)
main()

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

Submission status: Runtime Error

Solution code:
n = [i for i in range(1000,10001,1000)]
m = int(input())
for i in n:
    if i > m:
        a = i - m
        break
    # break
print(a)

Submission status: Runtime Error

Solution code:
n = int(input())
dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
    s = input()
    if s in dict:
        dict[s] = dict[s] + 1
for k, l  in dict.items():
    print(k + ' x ' + str(l))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
 sen = N//1000:
 sen2 = sen*1000
 atai = N-sen2
 
for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  print(atai)

Submission status: Runtime Error

Solution code:
n = []
while True:
    try:
        n=(input())
    except EOFError:
        break
print(1000-int(n[1:4]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from copy import deepcopy
def resolve():
    H,W,K=pin()
    maze=[list(input()) for a in range(H)]
#    print(maze)

    #double bit full search
    ans=0
    for i in range(2**H):
        for j in range(2**W):
            #i,j is a set such that not colored red
            notred=[]
            numh=[0]*W
            #Height
            for ci in range(H):
                check=1<<ci
                if i & check:
                    #nukiidasi
                    for k in range(W):
                        if maze[ci][k]=="#":
                            numh[k]+=1

            cal=0
            for cj in range(W):
                check=1<<cj
                if j & check:
                    cal+=numh[cj]
            if cal==K:ans+=1
    print(ans)

#%%submit!
resolve()

Submission status: Runtime Error

Solution code:
N=int(input())

##一万円まで
for N in 10000:
  if N % 1000 == 0：
  print(0)

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000:
  print(0)
elif 1000 < N:
  m = n * (-1)
  print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

Submission status: Runtime Error

Solution code:
import math
N = input()
S = 0
S = int(N[-3]) * 100
if S == 0:
    print(S)
else:
    print(1000 - S)

Submission status: Runtime Error

Solution code:
N=int(input())
 
for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  sen = N//1000:
  sen2 = sen*1000
  atai = N-sen2
  print(atai)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
    s = input()
    if s in dict:
        dict[s] = dict[s] + 1
for k, l  in dict.items():
    print(k + ' x ' + str(l))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
 
for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  sen = N/1000:
  sen2 = sen*1000
  atai = N-sen2
  print(atai)

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
  print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for i in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for t in s:
    if (t == 'AC'):
        AC += 1
    elif (t == 'WA'):
        WA += 1
    elif (t == 'TLE'):
        TLE += 1
    else:
        RE += 1

print('AC x ', AC)
print('WA x ', WA)
print('TLE x ', TLE)
print('RE x ', RE)

Submission status: Runtime Error

Solution code:
N = input()
A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
print(1000 - A)

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main(){
    long int n;
    cin>>n;
    long int a=0,w=0,r=0,t=0;
    while(n--){
        string s;
        cin>>s;
        if(s=="AC")
        a+=1;
        else if(s=="WA")
        w+=1;
        else if(s=="TLE")
        t+=1;
        else
        r+=1;
    }
    cout<<"AC "<<"* "<<a<<endl;
    cout<<"WA "<<"* "<<w<<endl;
    cout<<"TLE "<<"* "<<t<<endl;
    cout<<"RA "<<"* "<<r<<endl;
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
else:
  m = n

print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))

Submission status: Runtime Error

Solution code:
N=int(input())
lst=[]
for i in range(N):
    lst.append(str(input()))

acn = 0
wan = 0
tlen = 0
ren = 0

for a in lst:
    if a == 'AC':
        acn += 1
    elif a == 'WA':
        wan += 1
    elif a == 'TLE':
        tlen += 1
    elif a == 'RE':
        ren += 1
    else:
        continue

print('AC x ' + str(acn))
print('WA x ' + str(wan))
print('TLE x ' + str(tlen))
print('RE x ' + str(ren))

Submission status: Runtime Error

Solution code:
N=int(input())

for N in 10000:
  if 1000 % N == 0：
  print(0)
else:
  sen = 1000/N:
  atai = N-sen
  print(sen + atai )

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
else:
  m = n

print((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1])))

Submission status: Runtime Error

Solution code:
N = int(input())
if N >= 1000:
    a = N - 1000
else:
    a = a
while a >= 1000:
    a = a - 1000
if a != 0:
    a = 1000 - a
print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = 10000 - N
a = str(A)
if int(a[-3]) > 0:
 print(a[-3]+a[-2]+a[-1])
else:
 if int(a[-2]) > 0:
     print(a[-1])

Submission status: Runtime Error

Solution code:
n = int(input())
test = []
for i in range(n):
    test.append(input())
print('AC x ' + str(test.count('AC')))
print('NA x ' + str(test.count('NA')))
print('TLE x ' + str(test.count('TLE')))
print('RE x ' + str(test.count('RE')))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if N % 1000 == 0：
  print(0)
else:
  atai = N - sen
  print(sen + atai )

Submission status: Runtime Error

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

yen = 1000

if N % 1000 == 0:
    ans = 0
else:
    n = str(N)
    a = int(n[1:])
    ans = yen - a

print(ans)

Submission status: Runtime Error

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

for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  atai = N - sen
  print(sen + atai )

Submission status: Runtime Error

Solution code:
N=int(input)
quotient=N//1000
for i in range(quotient+1):
    N=N-1000
    if N<=0:
        break
print(abs(N))

Submission status: Runtime Error

Solution code:
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
else:
  m = n

print(int(str(m)[-3])*100)

Submission status: Runtime Error

Solution code:
n = int(input())

if n % 1000 == 0:
    print("0")
else:
    s = str(n)
    N = (10 - int(s[-3]))*100
    print(N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
test = []
for i in range(n):
    test.append(input())
print('AC x ' + str(test.count('AC')))
print('NA x ' + test.count('NA'))
print('TLE x ' + test.count('TLE'))
print('RE x ' + test.count('RE'))

Submission status: Runtime Error

Solution code:
N = int(open(0).read())
m = N % 1000
if m == 0:
    print(0)
else:
    print(1000 - m)
|

Submission status: Runtime Error

Solution code:
n=str(int(input()))
print(1000-int(n[1:4]))