Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02658 (python)

Fixed submission:
num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

ans = 1

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)

Buggy submission (verdict: Runtime Error):
while available > 1:
    for i in range(available / 2):
    nums[i] = nums[2 * i] * nums[2 * i + 1]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
    if isOdd:
        nums[available / 2 + 1] = nums[-1]
        available //= 2
    if isOdd:
        available += 1
    if a == 0:
        print(0)
        quit()
print(ans)
quit()

Buggy submission (verdict: Runtime Error):
num = int(input())

str2 = input().split(" ")
nums = [int(s) for s in str2]

isOdd = num%2 == 1
available = range(len(nums))

while available > 1:
    for i in range(available / 2)
    nums[i] = nums[2 * i] * nums[2 * i + 1]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
    if isOdd:
        nums[available / 2 + 1] = nums[-1]
        available //= 2
    if isOdd:
        available += 1
    if a == 0:
        print(0)
        quit()
print(ans)
quit()

Buggy submission (verdict: Runtime Error):
num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)
quit()
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mul=1
if a.count(0)>=1:
    print(0)
if a.count(0)==0:
    for i in range(len(a)):
        mul=mul*a[i]
        if mul>10**18:
            break
    
    if mul>10**18:
        print(-1)
    if mul<=10**18:
        print(mul)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split())
mul=1
flag=0
for i in range(len(a)):
       mul=mul*a[i]
       if mul>10**18:
       		flag=1
			break
if flag==1:
	print(-1)
    continue
print(mul)
Problem p03160 (python)

Fixed submission:

n=int(input())
h=list(map(int,input().split()))
li=[0]*n
li[1]=abs(h[1]-h[0])
for i in range(2,n):
    li[i]=min(li[i-1]+abs(h[i]-h[i-1]),li[i-2]+abs(h[i]-h[i-2]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

def maxim(i,char):
    if i<0:
        return 0

    if li[i][char]!=-1:
            ##print('hi')
            ##print(i,char)
            return li[i][char]
    if char==2:
        li[i][2]= max(c[i]+maxim(i-1,1),c[i]+maxim(i-1,0))
        return li[i][2]
    if char==1:
        li[i][1]= max(b[i] + maxim(i - 1, 0), b[i] + maxim(i - 1, 2))
        return li[i][1]
    if char==0:
        li[i][0]= max(a[i] + maxim(i - 1, 1), a[i] + maxim(i - 1, 2))
        return li[i][0]
    if char==3:
        li[i][3]= (max(maxim(i - 1, 2), maxim(i - 1, 1), maxim(i - 1, 0)))
        return li[i][3]
n=int(input())
a, b, c = [], [], []
for _ in range(n):
    x,y,z=get_ints()
    li=[[-1 for i in range(4)]for j in range(n)]
    a.append(x)
    b.append(y)
    c.append(z)
print(maxim(n-1,3))

Buggy submission (verdict: Runtime Error):
inf=(10**7)+1

n,k=get_ints()
h=get_array()
li=[inf]*n
li[0]=0
 
for i in range(1,n):
    
    for j in range(i-1,i-k-1,-1):
      if j<0:
        break
 
 
 
 
      li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):

import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[99999]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-1,(i-k)-1,-1):
        if j<0:
            break

            #3print(i,j)
        li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):
from math import inf
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[99999]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-1,(i-k)-1,-1):
        if j<0:
            break

            #3print(i,j)
        li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):

import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[999999999999]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-1,(i-k)-1,-1):
        if j<0:
            break

            #3print(i,j)
        li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])
Problem p03161 (python)

Fixed submission:
import numpy as np
inf=10000007

n,k=map(int,input().split())
h=np.array(list(map(int,input().split())))
dp = np.zeros(n,dtype=int)
dp[0]=0

for i in range(1,n):
    l=max(0,i-k)

    dp[i] = np.min(dp[l:i] + abs(h[l:i] - h[i]))




##print(li)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
from math import inf
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[inf]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    l=max(0,i-k)
    for j in range(l,i):
     



            li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):
from math import inf
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[inf]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-1,(i-k)-1,-1):
        if j<0:
            break

            #3print(i,j)
        li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])

Buggy submission (verdict: Runtime Error):
from math import inf
n,k=map(int,input().split())
h=list(map(int,input().split()))
li=[inf]*n
li[0]=0
li[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-1,(i-k)-1,-1):
        if j>=0:
            #3print(i,j)
            li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])
Problem p03162 (python)

Fixed submission:
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()


n=int(input())
a, b, c = [], [], []
for _ in range(n):
    x,y,z=get_ints()
    
    a.append(x)
    b.append(y)
    c.append(z)
li=[[-1 for i in range(3)]for j in range(n)]
li[0][0],li[0][1],li[0][2]=a[0],b[0],c[0]
for i in range(1,n):


        li[i][0] = max(a[i] + li[i-1][1] ,a[i] + li[i - 1][2])

        li[i][1] = max(b[i] + li[i - 1][0], b[i] +li[i - 1][2])

        li[i][2] = max(c[i] + li[i - 1][1], c[i] + li[i - 1][0])
print(max(li[n-1]))

Buggy submission (verdict: Runtime Error):
def maxim(i,char):
    if i<0:
        return 0

    if char=='C':
        return max(c[i]+maxim(i-1,'B'),c[i]+maxim(i-1,'A'))
    if char=='B':
        return max(b[i] + maxim(i - 1, 'A'), b[i] + maxim(i - 1, 'C'))
    if char=='A':
        return max(a[i] + maxim(i - 1, 'B'), a[i] + maxim(i - 1, 'C'))
n=int(input())
a, b, c = [], [], []
for _ in range(n):
    ##a,b,c=[],[],[]
    x,y,z=map(int,input().split())
    a.append(x)
    b.append(y)
    c.append(z)
##print(a,b,c)
print(max(maxim(n-1,'C'),maxim(n-1,'B'),maxim(n-1,'A')))
Problem p02718 (python)

Fixed submission:
N,M=input().split()
N,M=[int(N),int(M)]
 
a = list(map(int,input().strip().split()))[:N]
  
number=0
total=0
for i in range(N):
  v=a[i]
  total=total+v
for i in range(N):
  v=a[i]
  if v < (1/(4*M))*total:
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N,M=int(input().split())

a = list(map(int,input().strip().split()))[:n] 
  
number=0
total=0
for i in range(N):
  v=a[i]
  total=total+v
for i in range(N):
  v=a[i]
  if v < (1/(4*M))*total:
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N,M=int(input().split())

number=0
for i in range(N):
  v=int(input())
  if v < 1/(4*M):
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
number=0
for i in range(N):
  v=int(input())
  if v < 1/(4*M):
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
M=input()
number=0
for i in range(N):
  v=input()
  if v < 1/(4*M):
    number=number
  else:
    number = number+1
if number >= M:
  print("Yes")
else:
  print("No")
Problem p02719 (python)

Fixed submission:
N,K=input().split()
N,K=[int(N),int(K)]

minimum=N%K
while N%K>K-N%K:
    minimum=K-N%K
    N=K-N%K
print(minimum)

Buggy submission (verdict: Runtime Error):
N,K=input().split()
N,K=[int(N),int(K)]
 
minimum=0
while True:
  minimum=N
  if minimum > = N:
    minimum=N
  else:
    minimum=minimum
    break
  
  
print(minimum)

Buggy submission (verdict: Runtime Error):
N,K=input().split()
N,K=[int(N),int(K)]
 
minimum=N
while N < =minimum:
  N=abs(N-K)
  minimum=N
  
  
print(minimum)
Problem p02585 (python)

Fixed submission:
import sys

sys.setrecursionlimit(50000)
N,K= [int(v) for v in input().split()]
P = [int(v) - 1 for v in input().split()]
C = [int(v) for v in input().split()]

visited = [True for _ in range(N)]
cycle = []


ans = -float('inf')
for sn in range (N):
    cost = []
    nn = sn
    while True:
        cost.append(C[nn])
        nn = P[nn]
        if sn == nn:
            break
    total = sum(cost)
    l = len(cost)

    t = 0
    for i in range(l):
        t += cost[i]
        if i+1 > K: break
        now = t
        if total > 0:
            e = (K-i-1)//l
            now += total * e
        ans = max(ans,now)


print(int(ans))

Buggy submission (verdict: Runtime Error):
N,K= [int(v) for v in input().split()]
P = [int(v) - 1 for v in input().split()]
C = [int(v) for v in input().split()]

visited = [True for _ in range(N)]

def dfs(node,total,state,m):
    if visited[node]:
        return total,state,m
    state.append(C[node])
    nextM = max(total,total+C[node])
    total += C[node]
    visited[node] = True
    return dfs(P[node],total,state,nextM)

ans = -float('inf')

def calc(node):
    global visited,ans
    visited = [False for _ in range(N)]
    total,state,ma = dfs(P[node],0,[],-float('inf'))
    ans = max(ma,ans)
    K_ = K
    count = K // len(state)

    tmp = total * count
    for v in state[:K%len(state)]:
        tmp += v
    ans = max(ans,tmp)

    if total > 0:
        tmp = total * (count-1)
        for v in state:
            tmp += v
            ans = max(ans,tmp)






for i in range (N):
    calc(i)

print(ans)
Problem p02684 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10000000)
N,K = [int(v) for v in input().split()]
A = [int(v) for v in input().split()]

loop = []
pre = []
visited = set()

def dfs(index,now):
    global pre
    global loop
    loop.append(now)
    if now in visited:
        for left in range(len(loop)):
            if now == loop[left]:
                break
        pre = loop[:left]
        loop = loop[left:index]
        return
    else:
        visited.add(now)
        dfs(index+1,A[now-1])
dfs(0,1)

if len(pre) > K:
    print(pre[K])
else:
    K-=len(pre)
    print(loop[K%len(loop)])

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000000)
N,K = [int(v) for v in input().split()]
A = [int(v) for v in input().split()]
print(N,K)


loop = []

def dfs(now):
    loop.append(now)
    if A[now-1] == 1:
        return
    else:
        dfs(A[now-1])
dfs(1)

print(loop[K%len(loop)])
Problem p03160 (python)

Fixed submission:
n = int(input())
h = [int(v) for v in input().split()]
c = [0,abs(h[0]-h[1])]

for i in range(1,n-1):
  cost1 = c[i-1] + abs(h[i-1] - h[i+1])
  cost2 = c[i] + abs(h[i]-h[i+1])
  c.append(min(cost1,cost2))

print(c[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(v) for v in input().split()]

cost = [0 for _ in range(10001)]
for i in range(1,n):
  cost[i] = cost[i-1] + abs(h[i]-h[i-1])
  if i > 1:
    cost[i] = min(cost[i],cost[i-2]+abs(h[i] - h[i-2]))

print(cost[n-1])
Problem p03165 (python)

Fixed submission:
s = input()
t = input()
dp = [[0 for _ in range(len(s)+1)] for _ in range(len(t) + 1)]

for i,c1 in enumerate(s,1):
    for j,c2 in enumerate(t,1):
        if c1 == c2:
            dp[j][i] = dp[j-1][i-1] + 1
        else:
            dp[j][i] = max(dp[j-1][i],dp[j][i-1])

i1,i2 = len(s),len(t)
#  print(" " + s)
#  for i,row in enumerate(dp):
    #  if i == 0:
        #  print(" ",row)
    #  else:
        #  print(t[i-1],row)

rev_ans = ""
while i1 != 0:
    lru = dp[i2-1][i1-1]
    now = dp[i2][i1]
    dup = now - dp[i2-1][i1]
    dleft = now - dp[i2][i1-1]
    dupleft = now - lru
    #  print(i1,i2,dupleft,dup,dleft)
    if dupleft == 1 and dleft == 1 and dup == 1:
        rev_ans += t[i2-1]
        i2 -= 1
        i1 -= 1
    elif dleft == 1:
        i2 -= 1
    else:
        i1 -= 1

for c in reversed(rev_ans):
    print(c,end='')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
dp = [[0 for _ in range(len(s)+1)] for _ in range(len(t) + 1)]

for i,c1 in enumerate(s,1):
    for j,c2 in enumerate(t,1):
        if c1 == c2:
            dp[j][i] = dp[j-1][i-1] + 1
        else:
            dp[j][i] = max(dp[j-1][i],dp[j][i-1])

i1,i2 = len(s),len(t)

rev_ans = ""
while i1 != 0:
    lru = dp[i2-1][i1-1]
    now = dp[i2][i1]
    #  print(lru,now)
    if now - lru == 1:
        rev_ans += t[i2-1]
        i2 -= 1
        i1 -= 1
    elif now - dp[i2-1][i1] == 0:
        i2 -= 1
    else:
        i1 -= 1

for c in reversed(rev_ans):
    print(c,end='')
Problem p03262 (python)

Fixed submission:
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):
    # print(x,y)
    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        return gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):

    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:a-x,field))

ans = diff[0]

for i in diff[1:]:
    ans = math.gcd(ans,i)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:a-x,field))

ans = diff[0]

for i in diff[1:]:
    ans = math.gcd(i,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import Fraction
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in range(1,n):
    ans = min(ans,fractions.gcd(ans,tmp[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in range(1,n):
    ans = min(ans,math.gcd(ans,tmp[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in tmp:
    ans = math.gcd(ans,i)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in range(1,n):
    ans = math.gcd(ans,tmp[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n , x = map(int,input().split())

field = map(int,input().split())

tmp = []

for i in field:
    tmp.append(abs(i-x))


ans = tmp[0]

for i in range(1,n):
    ans = math.gcd(ans,tmp[i])

print(ans)
Problem p03263 (python)

Fixed submission:
h,w = map(int,input().split())

a = [[int(i) for i in input().split()] for _ in range(h)]

total = 0

ans = []

for i,row in enumerate(a):
    for j,cell in enumerate(row):
        if(cell % 2 == 0):
            continue
        
        if(i == h - 1 and j == w -1):
            break
        
        if(j != w - 1):
            a[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])
            total += 1
        elif(i != h - 1):
            a[i+1][j] += 1
            ans.append([i+1,j+1,i+2,j+1])
            total += 1

        
print(total)

for a in ans:
    print(*a)

Buggy submission (verdict: Runtime Error):
n , x = map(int,input().split())

field = [int(i) for i in input().split()]

diff = list(map(lambda a:abs(a-x),field))

def gcd(x,y):

    if x < y:
        x,y = y,x

    if x % y == 0:
        return y
    else:
        gcd(y,x%y)

ans = diff[0]


for i in diff[1:]:
    ans = gcd(i,ans)

print(ans)
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())

words = set()

l = k+1 if len(s) > k else len(s) + 1

for i in range(1,l):
    for j in range(len(s)):

        words.add(s[j:i+j])

sort_word = sorted(words)

print(sort_word[k-1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

words = set()

l = len(s)

for i in range(1,k+1):
    for j in range(l-k):
        words.add(s[j:i+j])

sort_word = sorted(words)
print(sort_word[k-1])
Problem p03369 (python)

Fixed submission:
s = input()
total = 700
for char in s:
    if char == "o":
        total += 100

print(total)

Buggy submission (verdict: Runtime Error):
import math
n,x = tuple(map(int,input().split()))

m = []

for i in range(n):
    cost = int(input())
    x -= cost
    m.append(cost)


print(math.floor(x/min(m))+n)
Problem p03488 (python)

Fixed submission:
# T(ターン)で区切る
s = input().split("T")
x, y = ([int(i) for i in input().split()])

# x方向の移動量とy方向の移動量をまとめる
movex = []
movey = []

for i, t in enumerate(s):
    if i % 2 == 0:
        movex.append(len(t))
    else:
        movey.append(len(t))

# 最終目標地へ到達可能か調べる


def t_dfs(move, target, is_x):
    if is_x:
        target -= move.pop(0)

    move.sort(reverse=True)

    for dx in move:
        if target > 0:
            target -= dx
        else:
            target += dx

    return target == 0


if t_dfs(movex, x, True) and t_dfs(movey, y, False):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
s = input().split("T")
x, y = ([int(i) for i in input().split()])

movex = []
movey = []

for i, t in enumerate(s):
    if i % 2 == 0:
        movex.append(len(t))
    else:
        movey.append(len(t))


def t_dfs(move, target, now):
    #print(move, target, now)
    if len(move) == 0:
        if target == now:
            return True
        else:
            return False

    return t_dfs(move[1:], target, now+move[0]) or t_dfs(move[1:], target, now-move[0])


if t_dfs(movex, x, 0) and t_dfs(movey, y, 0):
    print("YES")
else:
    print("No")
Problem p03495 (python)

Fixed submission:
from collections import Counter


n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.values())


total = 0
l = len(sort_count)

if len(sort_count) <= k:
    print(0)
else:
    print(sum(sort_count[:l-k]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.items(), key=lambda x: x[1])

total = 0
for i in range(k):
    total += sort_count[i][1]

print(n-total)
Problem p02612 (python)

Fixed submission:
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)
  if m < 10:
    print(1000-m)
  elif m < 100:
    print(1000-(int(str(m)[-2])*10) + (int(str(m)[-1])))
  else:
    print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

Buggy submission (verdict: Runtime Error):
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)

Buggy submission (verdict: Runtime Error):
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)

Buggy submission (verdict: Runtime Error):
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)

Buggy submission (verdict: Runtime Error):
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]))))

Buggy submission (verdict: Runtime Error):
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])))

Buggy submission (verdict: Runtime Error):
N = int(input())

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

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

Buggy submission (verdict: Runtime Error):
N = int(input())

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

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

Fixed submission:
from sys import stdin
A, B = list(map(float,input().split()))

result = int(A * B)

print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
result = 1

for i in range(n):
  result = a[i] * result
  
if result >= 10000000000000000000:
  result = -1

print(result)

Buggy submission (verdict: Runtime Error):
n = input()
t = n.split()

result = int(n[0]) * int(n[1])
Problem p02658 (python)

Fixed submission:
N     = int(input())
A     = list(map(int,input().split()))
A     = sorted(A)
count = 1
for i in A:
  count *= i
  if count > 10**18:
    print(-1)
    break
else:
  print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
result = 1
 
for i in a:
  result *= i
  
if result >= 10**18:
  print(-1)
  break
  
print(result)
Problem p02612 (python)

Fixed submission:
import math
n = int(input())
if n % 1000 == 0:
  print(0)
else:
  print(math.ceil(n / 1000) * 1000 - n)

Buggy submission (verdict: Runtime Error):
print(-int(input()%1000)
Problem p02657 (python)

Fixed submission:
a,b= input().split()
print(int(a)*int(b))

Buggy submission (verdict: Runtime Error):
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  if 0 in A:
    print(0)
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
main ()