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

Fixed submission:
from itertools import product, chain

x, y, z, k = list(map(int, input().split(" ")))
a = sorted(list(map(int, input().split(" "))))
b = sorted(list(map(int, input().split(" "))))
c = sorted(list(map(int, input().split(" "))))

apb_sorted = sorted([a + b for a, b in product(a, b)])[-k:]
ans_list = sorted(
    list(chain.from_iterable([[_c + ab for ab in apb_sorted] for _c in c[:k]]))
)
it = reversed(ans_list)
for _ in range(k):
    print(next(it))

Buggy submission (verdict: Runtime Error):

def solver2(a, b, c, k):
    d = deque()
    n = len(a)
    for p in range(n):
        for q in range(n):
            for r in range(n):
                if (p + 1) * (q + 1) * (r + 1) > k:
                    continue
                d.append(a[-p - 1] + b[-q - 1] + c[-r - 1])
    it = reversed(sorted(d))
    for _ in range(k):
        print(next(it))


if __name__ == "__main__":
    x, y, z, k = list(map(int, input().split(" ")))
    a = sorted(list(map(int, input().split(" "))))
    b = sorted(list(map(int, input().split(" "))))
    c = sorted(list(map(int, input().split(" "))))
    solver2(a, b, c, k)
Problem p03147 (python)

Fixed submission:
def count(h_list):
    if len(h_list) == 0:
        return 0
    if len(h_list) == 1:
        return h_list[0]
    if 0 not in h_list:
        return 1 + count([x-1 for x in h_list])
    elif all(x == 1 for x in h_list):
        return 1
    return sum([count(x) for x in divide_by_zero(h_list)])


def divide_by_zero(arr):
    non_zero = []
    for ar in arr:
        if ar == 0:
            if non_zero:
                yield non_zero
                non_zero = []
        else:
            non_zero.append(ar)
    yield non_zero


n = int(input())
h_list = [int(x) for x in input().split(" ")]
print(count(h_list))

Buggy submission (verdict: Runtime Error):

def count(h_list):
    if len(h_list) == 0:
        return 0
    if len(h_list) == 1:
        return h_list[0]
    if (h_list != 0).all():
        return 1 + count(h_list - 1)
    elif (h_list == 1).all():
        return 1
    return sum([count(x) for x in divide_by_zero(h_list)])


def divide_by_zero(arr):
    non_zero = []
    for ar in arr:
        if ar == 0:
            if non_zero:
                yield np.array(non_zero)
                non_zero = []
        else:
            non_zero.append(ar)
    yield np.array(non_zero)

n = int(input())
h_list = np.array([int(x) for x in input().split(" ")])
print(count(h_list))
Problem p03149 (python)

Fixed submission:
s = set(list(map(int, input().split(' '))))
if s == set([1,9,7,4]):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = set(list(map(int, input().split(' '))))
if s == set([1,9,7,4]):
    print(YES)
else:
    print(NO)
Problem p03229 (python)

Fixed submission:
from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2
    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))



def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)

Buggy submission (verdict: Runtime Error):
from collections import deque
from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2
        if self.p2 + self.p1 + self.m1 + self.m2 != n:
            raise ValueError(f"n = {n}, {str(self)}")

    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))

    def __str__(self):
        return (
            f"(p2, p1, m1, m2) = ({self.p2}, {self.p1}, {self.m1}, {self.m2})"
        )


def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)
Problem p02612 (python)

Fixed submission:
s = int(input())
change = s % 1000
if change == 0:
    print(0)
else:
    print(1000-change)

Buggy submission (verdict: Runtime Error):
s = int(input())
change = s % 1000
if change == 0:
    print(0):
else:
    print(1000-change)
Problem p02639 (python)

Fixed submission:
i = input().split()
print(i.index("0") + 1)

Buggy submission (verdict: Runtime Error):
import sys

x, n = map(int, input().split())
p = set(map(int, input().split()))

if n == 0:
    print(x)
    sys.exit()

i = 1
while i < 103:
    left = x - i
    right = x + i
    if left not in p:
        print(left)
        sys.exit()
    elif right not in p:
        print(right)
        sys.exit()
    i += 1
Problem p02658 (python)

Fixed submission:
import sys

n = int(input())
a = list(map(int, input().split()))

if 0 in a:
    print(0)
    sys.exit()

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
a = list(map(int, input().split()))

if a.index(0):
    print(0)
    sys.exit()

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)
Problem p02612 (python)

Fixed submission:
import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)

Buggy submission (verdict: Runtime Error):
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    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'])

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

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

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

Fixed submission:
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    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'])

Buggy submission (verdict: Runtime Error):
from collections import Counter
li=[]
for i in range(int(input()):
	li.append(input())  
d=Counter(li)
print('AC','x',d['AC'])
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])
Problem p03161 (python)

Fixed submission:
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[0]*N

for i in range(N-1):
  A=[]
  for j in range(K):
    if i-j>=0:
      A.append(dp[i-j]+abs(H[i-j]-H[i+1]))
  dp[i+1]=min(A)

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[0]*N
for i in range(K):
  dp.append(10**9)
  H.append(10**9)

for i in range(N-1):
  dp[i+1]=min(*[dp[i-j]+abs(H[i-j]-H[i+1]) for j in range(K)])

print(str(dp[N-1]))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[10**9]*N
dp[0]=0
for i in range(K):
  H.append(10**9)

for i in range(N-1):
  A=[]
  for j in range(K):
    A.append(dp[i-j]+abs(H[i-j]-H[i+1]))
  dp[i+1]=min(A)

print(str(dp[N-1]))
Problem p02612 (python)

Fixed submission:
def solution(N):
    if N % 1000 == 0: return 0
    return 1000 - (N % 1000)

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

Buggy submission (verdict: Runtime Error):
#!/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))
Problem p02813 (python)

Fixed submission:
from itertools import permutations

n=int(input())
l=list(map(str,input().split()))
t=list(map(str,input().split()))
s="".join(l)
h="".join(t)

l1=list()

for i in permutations(s):
    k="".join(i)
    l1.append(k)
 
l1.sort()

print(abs(l1.index(s)-l1.index(h)))

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n=int(input())
l=list(map(int,input().split()))
t=list(map(int,input().split()))
s="".join(l)
h="".join(t)

l1=list()

for i in permutations(s):
  l1.append(i)
  
print(abs(l1.find(s)-l1.find(h)))
Problem p02630 (python)

Fixed submission:
import numpy as np
from collections import defaultdict

s = list(map(int, input().split()))
n=s[0]
a = np.array(list(map(int, input().split())))
s = list(map(int, input().split()))
q=s[0]
num=defaultdict(int)
ans=0

for i in a:
    num[i]+=1
    ans+=i

for i in range(q):
    s = list(map(int, input().split()))
    a=s[0]
    b=s[1]
    ans=ans-a*num[a]-b*num[b]
    num[b]=num[a]+num[b]
    ans = ans+b*num[b]
    num[a]=0
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
s = list(map(int, input().split()))
n=s[0]
a = np.array(list(map(int, input().split())))
s = list(map(int, input().split()))
q=s[0]
ans={}
for i in range(q):
    s = list(map(int, input().split()))
    if not (s[0],s[1]) in ans:
        a=np.where(a==s[0],s[1],a)
        ans[(s[0],s[1])]=np.sum(a)
        print(ans[(s[0],s[1])])
    else:
        print(ans[s])
Problem p02713 (python)

Fixed submission:
import math
s = input()
k = int(s)
n = 3
ans={}
for i in reversed(range(1, k+1)):
    ans[i]=math.floor(k/i)**n
    l=2
    j=i*l
    while j<=k:
        ans[i]=ans[i]-ans[j]
        l +=1
        j = i*l
res=0
for i in ans:
    res+=i*ans[i]
print(res)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(s)
n = 3
ans={}
for i in reversed(range(1, k+1)):
    ans[i]=math.floor(k/i)**n
    l=2
    j=i*l
    while j<=k:
        ans[i]=ans[i]-ans[j]
        l +=1
        j = i*l
res=0
for i in ans:
    res+=i*ans[i]
print(res)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(s)
n = 3
ans={}
for i in reversed(range(1, k+1)):
    ans[i]=math.floor(k/i)**n
    l=2
    j=i*l
    while j<=k:
        ans[i]=ans[i]-ans[j]
        l +=1
        j = i*l
res=0
for i in ans:
    res+=i*ans[i]
print(res)

Buggy submission (verdict: Runtime Error):
s = input().split()
k = int(s[0])
n = 3
ans={}
for i in reversed(range(1, k+1)):
    ans[i]=math.floor(k/i)**n
    l=2
    j=i*l
    while j<=k:
        ans[i]=ans[i]-ans[j]
        l +=1
        j = i*l
res=0
for i in ans:
    res+=i*ans[i]
print(res)

Buggy submission (verdict: Runtime Error):
s = input().split()
k = int(s[0])
n = 3
ans={}
for i in reversed(range(1, k+1)):
    # print(i*(math.floor(k/i))**n)
    ans[i]=math.floor(k/i)**n
    l=2
    j=i*l
    while j<=k:
        ans[i]=ans[i]-ans[j]
        l +=1
        j = i*l
res=0
for i in ans:
    res+=i*ans[i]
print(res)
Problem p02732 (python)

Fixed submission:
s = input()
n=int(s[0])
s = input().split()
d={}
dc={}
summ=0
for i in s:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d:
    n = d[i]
    if n>1:
        e=n*(n-1)/2
        summ+=e
        dc[i]=e
    else:
        dc[i]=0
for i in s:
    n = d[i]-1
    e = n*(n-1)/2
    print(int(summ-dc[i]+e))

Buggy submission (verdict: Runtime Error):
import math
s = input()
n=int(s[0])
s = input().split()
d={}
dc={}
summ=0
for i in s:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d:
    n = d[i]
    if n>1:
        a = math.factorial(n)
        b = math.factorial(2)
        c = math.factorial(n-2)
        e=a/b/c
        summ+=e
        dc[i]=e
    else:
        dc[i]=0
for i in s:
    print(int(summ-dc[i]+(dc[i]/d[i]*(d[i]-2))))
Problem p02761 (python)

Fixed submission:
s = list(map(int, input().split()))
n = s[0]
m = s[1]
ans = [0]*n
flag = 0
for i in range(m):
    s = list(map(int, input().split()))
    if ans[s[0]-1] != 0 and ans[s[0]-1] != s[1]:
        flag = 1
        break
    elif s[0] == 1 and s[1] == 0 and n>=2:
        flag = 1
        break
    else:
        ans[s[0]-1] = s[1]

if flag == 0:
    if ans[0]==0 and n>=2:
        ans[0]=1
    print(''.join(map(str, ans)))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
n = s[0]
m = s[1]
ans = [0]*n
flag = 0
for i in range(m):
    s = list(map(int, input().split()))
    if ans[s[0]-1] != 0 and ans[s[0]-1] != s[1]:
        flag = 1
        break
    elif s[0] == 1 and s[1] == 0:
        flag = 1
        break
    else:
        ans[s[0]-1] = s[1]

if flag == 0:
    if ans[3-n]==0:
        ans[3-n]=1
    print(''.join(map(str, ans)))
else:
    print(-1)
Problem p03000 (python)

Fixed submission:
s = input().split()
s = list(s)
s2 = input().split()
s2 = list(s2)
count=1
X = int(s[1])
count = 1
for i in s2:
    if i == ' ':
        continue
    X = X-int(i)
    if X < 0:
        break
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
s = list(s)
s2 = input()
s2 = list(s2)
count=1
X = int(s[2])
count = 1
for i in s2:
    if i == ' ':
        continue
    X = X-int(i)
    if X < 0:
        break
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
s = list(s)
s2 = input()
s2 = list(s2)
D=0
count=1
for i in s2:
    if i==' ':continue
    D=D+int(i)
    if D<=int(s[2]):
        count+=1
print(count)
Problem p03163 (python)

Fixed submission:
import numpy as np

n,W=list(map(int,input().split()))

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i]=dp[i-1]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp))

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

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i][:w]=dp[i-1][:w]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp))

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

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i]=dp[i-1]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp))

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

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i]=dp[i-1]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp[n-1]))

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
n=s[0]
w=s[1]
dp=[[0]*(w+1) for i in range(n+1)]
weight=[]
value=[]
for i in range(n):
    s = list(map(int, input().split()))
    weight.append(s[0])
    value.append(s[1])

for i in range(n):
    for j in range(w+1):
        if weight[i]<=w and weight[i]<=j:
            dp[i+1][j]=max(dp[i][j-weight[i]]+value[i],dp[i][j])
        else:
            dp[i+1][j]=dp[i][j]
print(dp[3][8])
Problem p02646 (python)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
S=V-W
d=abs(A-B)
if S <=0:
   print("NO")
elif d<=T*S:
   print("YES")
else:
   print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
S=V-W
time=(A-B)/S
if S <=0:
   print("NO")
elif time<=T:
   print("YES")
else:
   print("NO")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
i=1
sum=A[0]
while A[0]<=10**18 and i<=N-1:
   sum*=A[i]
   i+=1
if sum>10**18:
   sum=-1
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
i=1
while A[0]<=10**18 and i<=N-1:
   A[0]*=A[i]
   i+=1
if A[0]>10**18:
   A[0]=-1
print(A[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
i=1
while A[0]<=10**18 and i<=N-1:
   A[0]*=A[i]
   i+=1
if A[0]>10**18:
   A[0]=-1
print(A[0])

import gc
gc.collect()
Problem p02675 (python)

Fixed submission:
N=int(input())
mod=N%10
if mod==3:
    print('bon')
elif mod== 0 or mod== 1 or mod== 6 or mod== 8:
    print("pon")
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
N=input()
mod=N%10
if mod=3:
  print('bon')
elif mod=0,1,6,8:
  print('pon')
else:
  print('hon')
Problem p02818 (python)

Fixed submission:
A, B, K = map(int, input().split())
if K <= A:
    print(A-K, B)
elif K <= A+B:
    print(0, B-(K-A))
else:
    print(0, 0)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
print(T+S)
Problem p03292 (python)

Fixed submission:
a, b, c = map(int, input().split())

m = min(abs(a - b) + abs(b - c), abs(a - c) + abs(c - b), abs(b - a) + abs(a - c))
print(m)

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]
a.sort()
b = [a[2]-a[1], a[1]-a[0], a[2]-[0]]
print(sum(b)-max(b))
Problem p02612 (python)

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

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

Fixed submission:
N = str(input())
b = int(N[-1])
if (b==2 or b==4 or b==5 or b==7 or b==9):
  print("hon")
elif (b==0 or b==1 or b==6 or b==8):
  print("pon")
elif (b==3):
  print("bon")
else:
  print("Error")

Buggy submission (verdict: Runtime Error):
a = int(input())
if (a[-1] == 2,4,5,7,9):
  print("hon")
if (a[-1] == 0,1,6,8):
  print("pon")
if (a[-1] == 3):
  print("bon")
Problem p02613 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
  a = input()
  l.append(a)
print(f"{'AC'} x {l.count('AC')}")
print(f"{'WA'} x {l.count('WA')}")
print(f"{'TLE'} x {l.count('TLE')}")
print(f"{'RE'} x {l.count('RE')}")

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
  a = input()
  l.append(a)
print(f"{'AC'} x {l.count('AC')"}
print(f"{'WA'} x {l.count('WA')"}
print(f"{'TLE'} x {l.count('TLE')"}
print(f"{'RE'} x {l.count('RE')"}

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
  a = input()
  l.append(a)
print(f"{'AC'} x {l.count('AC')}
print(f"{'WA'} x {l.count('WA')}
print(f"{'TLE'} x {l.count('TLE')}
print(f"{'RE'} x {l.count('RE')}