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

Fixed submission:
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
#
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Buggy submission (verdict: Runtime Error):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
#
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")
Problem p02573 (python)

Fixed submission:
class UnionFindTree():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 常にxの要素数＞yの要素数とする
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        # self.parents[x] に　yの要素数を追加してから併合
        self.parents[x] += self.parents[y]
        self.parents[y] = x
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
print(-min(uft.parents))

Buggy submission (verdict: Runtime Error):
class UnionFindTree():
    def __init__(self, num_leaves):
        #self.num_leaves = num_leaves
        self.root = [i for i in range(num_leaves+1)]
        
    def find(self, leaf):
        if self.root[leaf] == leaf:
            return self.root[leaf]
        else:
            self.root[leaf] = self.find(self.root[leaf])
            return self.root[leaf]
        
    def union(self, leaf_a, leaf_b):
      	# find roots
        root_a = self.find(leaf_a)
        root_b = self.find(leaf_b)
        if root_a != root_b:
            # then union roots
            self.root[leaf_b] = root_a
            
        
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(int, input().split())
  uft.union(a, b)
  
# 経路圧縮
for n in range(N):
  uft.find(n)
  
max_size = [uft.root.count(n) for n in range(N)].max()
print(num_group)
Problem p02613 (python)

Fixed submission:
N = int(input())
S = [0]*N
AC = 0
WA = 0
TLE = 0
RE = 0

for n in range(N):
  S[n] = str(input())
  if S[n] == "AC":
    AC = AC + 1
  elif S[n] == "WA":
    WA = WA + 1
  elif S[n] == "TLE":
    TLE = TLE + 1
  elif S[n] == "RE":
    RE = RE + 1
    
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(AC,WA,TLE,RE))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []*N
AC = 0
WA = 0
TLE = 0
RE = 0

for n in range(N):
  S[n] = input()
  if S[n] == "AC":
    AC += AC
  elif S[n] == "WA":
    WA += WA
  elif S[n] == "TLE":
    TLE += TLE
  elif S[n] == "RE":
    RE += RE
    
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(AC,WA,TLE,RE))
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
 
power = []
_min = min(X)
_max = max(X)

if _min != _max:
  for p in range(_min, _max):
    power.append(calc_power(p))
  print(min(power))
  
else:
  power = calc_power(_min)
  print(power)

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

def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)

power = []
for p in range(min(X), max(X)):
  power.append(calc_power(p))
  
print(min(power))
Problem p02842 (python)

Fixed submission:
N = int(input())
 
ans = ":("
 
for X in range(N+1):
  if int(X * 1.08) == N:
    ans = X
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
ans = ":("
 
for X in range(N-1):
  if int(X * 1.08) = N:
    ans = X
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
x = N // 1.08
 
if x*1.08 < N or x*1.08 > N+1:
  print(":(")
else:
  for y in range(x-1, x+1):
    if N+!> y*1.08 > N:
      print(y)
      break
    else:
      print(":(")
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [0]*N
count = 0

def a_x_b(ab):
  a, b = ab
  return a*b

for n in range(N):
  A[n] = list(map(int, input().split()))
  AB = [(A[n][i], B[i]) for i in range(M)]
  if sum(list(map(a_x_b, AB)))+C > 0:
    count += 1
  else:
    continue
    
print(count)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [0]*N
count = 0

for n in range(N):
  A[n] = list(map(int, input().split()))
  
  for i in range(M):
    _sum += A[n][i] * B[i]
    
  if _sum + C > 0:
    count += 1
  else:
    continue
    
print(count)
Problem p03680 (python)

Fixed submission:
n = int(input())
al = []
for i in range(n):
    a = int(input())
    al.append(a)
 
al.insert(0, 0)
ans = -1
push = 1
for i in range(1, n+2):
    light = al[push]
    push = light
    if light == 2:
        ans = i
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(N):
  A.append(int(input())-1)
    
ans = -1
push = 0
count = []
 
for i in range(N+1):
 
    if A[push] == 1:
        ans = i+1
        break
        
    elif A[push] in count:
      break
      
    else:
      　count.append(push)
        push = A[push]
        
print(ans)

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

A = []
for _ in range(N):
  A.append(int(input())-1)

count = []
n = 0
for k in range(N+1):
  if A[n] == 1:
    break
 
  elif A[n] in count:
    ans = -1
    break
  
  else:
    count.append(A[n])
    ans = k+1
    n = A[n]
 
print(ans)
Problem p03695 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
color = set()
rainbow = 0

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if len(color) == 0:
	color_min = 1 
	color_max = rainbow
else:
  color_min = len(color)
  color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
color = set()
rainbow = 0

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if color_min > rainbow:
  color_min = len(color)
else:
  color_min = rainbow
  
color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')
Problem p02687 (python)

Fixed submission:
# A - A?C
S = input()
if S=='ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
# A - A?C
S = int(input())
if S=='ABC':
    print('ARC')
else:
    print('ABC')
Problem p02713 (python)

Fixed submission:
# C - Sum of gcd of Tuples (Easy)
from math import gcd
K = int(input())
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += gcd(gcd(a,b),c)
print(ans)

Buggy submission (verdict: Runtime Error):
# C - Sum of gcd of Tuples (Easy)
from math import gcd
K = int(input())
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += gcd(a,b,c)
print(ans)
Problem p02845 (python)

Fixed submission:
# E - Colorful Hats 2
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
count = [0]*N+[3]
used = [0]*(N+1)
ans = 1
for x in A:
    ans = (ans*(count[x-1]-used[x-1]))%MOD
    count[x] += 1
    used[x-1] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,A=ilint()
C=counter()
C.add(-1,3)
ans=1
for a in A:
    C.add(a,1)
    ans*=C[a-1]-C[a]+1
    ans%=MOD
print(ans)
Problem p02903 (python)

Fixed submission:
# A - 01 Matrix
H,W,A,B = map(int,input().split())
for i in range(H):
    for j in range(W):
        print((int(i<B)+int(j<A))%2,sep='',end='')
    print('')

Buggy submission (verdict: Runtime Error):
# A - 01 Matrix
H,W,A,B = map(int,input().split())
if H==1:
    for _ in range(A):
        print(1,end='')
    for _ in range(W-A):
        print(0,end='')
    print('')
elif W==1:
    for _ in range(B):
        print(1)
    for _ in range(H-B):
        print(0)
elif H*A!=W*B:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (-A*(i//B)+j)%W<A:
                print(1,end='')
            else:
                print(0,end='')
        print('')
Problem p02975 (python)

Fixed submission:
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0:
    ans = 'Yes'
elif N%3!=0:
    ans = 'No'
elif a[0]==a[N//3-1] and a[N//3]==a[2*N//3-1] and a[2*N//3]==a[N-1] and a[0]^a[N//3]^a[2*N//3]==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0:
    ans = 'Yes'
elif N%3!=0:
    ans = 'No'
elif a[0]==a[N//3-1] and a[N//3]==a[2*N//3-1] and a[2*N//3]==a[N-1] and x^y^z==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0:
    ans = 'Yes'
elif n%3!=0:
    ans = 'No'
elif a[0]==a[N//3-1] and a[N//3]==a[2*N//3-1] and a[2*N//3]==a[N-1] and x^y^z==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0 and a[N]==a[3*N-1]:
    ans = 'Yes'
elif a[0]==a[N-1] and a[N]==a[2*N-1] and a[2*N]==a[3*N-1] and x^y^z==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
# A - XOR Circle

N = int(input())
a = list(map(int,input().split()))
a.sort()

if a[N-1]==0 and a[N]==a[3*N-1]:
    ans = 'Yes'
elif a[0]==a[N-1] and a[N]==a[2*N-1] and a[2*N]==a[3*N-1] and x|y|z==0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)
Problem p03086 (python)

Fixed submission:
# B - ATCoder
S = input()
ans = 0
tmp = 0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
ans = max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
# B - ATCoder
S = int(input())
ans = 0
tmp = 0
for i in range(len(S)):
    if S[i] in ['A','C','G','T']:
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
ans = max(ans,tmp)
print(ans)
Problem p03095 (python)

Fixed submission:
# A - Colorful Subsequence
import numpy as np

N,S = int(input()),input()
count = np.zeros(26)

for i in range(N):
    count[ord(S[i])-ord('a')] += 1

ans = 1
D =10**9+7

for i in range(26):
    ans = int((ans*(count[i]+1))%D)

print(ans-1)

Buggy submission (verdict: Runtime Error):
# A - Colorful Subsequence
import numpy as np

N,S = int(input()),input()
count = np.zeros(26)

for i in range(N):
    count[ord(S[i])-ord('a')] += 1

ans = 1
for i in range(N):
    ans *= (count[i]+1)

print((ans-1)%(10**9+7))
Problem p03612 (python)

Fixed submission:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N,P = ilint()
ans = 0

def swap(i):
    global ans
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1

for i in range(N-1):
    if P[i]==i+1:
        swap(i)
if P[-1]==N:
    swap(N-2)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N,P = ilint()
ans = 0

def swap(i):
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1

for i in range(N-1):
    if P[i]==i+1:
        swap(i)
if P[-1]==N:
    swap(N-1)
print(ans)
Problem p03651 (python)

Fixed submission:
# A - Getting Difference
import fractions
from functools import reduce

N, K = map(int, input().split())
A = list(map(int, input().split()))

gcd = reduce(fractions.gcd, A) 

if max(A)>=K and K%gcd==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
# A - Getting Difference
import math
from functools import reduce

N, K = map(int, input().split())
A = list(map(int, input().split()))

gcd = reduce(math.gcd, A) 

if max(A)>=K and K%gcd==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Problem p03807 (python)

Fixed submission:
# A - Addition

N = int(input())
A = list(map(int, input().split()))
k = 0
for i in range(N):
    k = (A[i] + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])

Buggy submission (verdict: Runtime Error):
# A - Addition
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    k = (A[i] + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])

Buggy submission (verdict: Runtime Error):
# A - Addition
N = int(input())
k = 0
for i in range(N):
    k = (int(input()) + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])
Problem p03952 (python)

Fixed submission:
# B - Median Pyramid Easy
from collections import deque
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in range(1,4):
        print(x)
else:
    print('Yes')
    if x==2:
        num = deque(list(range(5,2*N)))
        que = deque([3,2,1,4])
    else:
        num = deque(list(range(1,x-2))+list(range(x+2,2*N)))
        que = deque([x-1,x,x+1,x-2])
    for i in range(2*N-1):
        if N-2<=i<=N+1:
            print(que.popleft())
        else:
            print(num.popleft())

Buggy submission (verdict: Runtime Error):
# B - Median Pyramid Easy
from collections import deque
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in range(1,4):
        print(x)
else:
    print('Yes')
    if x==2:
        num = deque(list(range(5,2*N)))
        que = deque([3,2,1,4])
    else:
        num = deque(list(range(1,x-2))+list(range(x+2,2*N)))
        que = deque([x-1,x,x+1,x-2])
    for i in range(2*N-1):
        if N-1<=i<=N+2:
            print(que.popleft())
        else:
            print(num.popleft())

Buggy submission (verdict: Runtime Error):
# B - Median Pyramid Easy
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in range(1,4):
        print(x)
else:
    print('Yes')
    if x==2:
        num = num[4:]
        que = [3,2,1,4]
    else:
        num = list(range(1,2*N))
        que = []
        for _ in range(3):
            que.append(num.pop(x-2))
        que.append(num.pop(x-3))
    for i in range(2*N-1):
        if N-1<=i<=N+2:
            print(que.pop(0))
        else:
            print(num.pop(0))

Buggy submission (verdict: Runtime Error):
# B - Median Pyramid Easy
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in num:
        print(x)
else:
    print('Yes')
    if x==2:
        num = num[4:]
        que = [3,2,1,4]
    else:
        num = list(range(1,2*N))
        que = []
        for _ in range(3):
            que.append(num.pop(x-2))
        que.append(num.pop(x-3))
    for i in range(2*N-1):
        if N-1<=i<=N+2:
            print(que.pop(0))
        else:
            print(num.pop(0))

Buggy submission (verdict: Runtime Error):
# B - Median Pyramid Easy
N,x = map(int,input().split())
if N==x:
    for i in range(i,N+1):
        print(i)
else:
    print('No')
Problem p04033 (python)

Fixed submission:
# A - Range Product
import numpy as np

ans = ['Positive', 'Negative']

a, b = map(int, input().split())
if a<=0 & 0<=b:
    print('Zero')
else:
    sgn = max(-b,0) - max(-a-1,0)
    print(ans[sgn%2])

Buggy submission (verdict: Runtime Error):
# C - Exception Handling
N = int(input())
A = [int(input()) for i in range(N)]
m1 = max(A)
i = 0
while A[i]<m1:
    i += 1
m2 = max(A[:i]+A[i+1:])
for j in range(N):
    print(m1 if i!=j else m2)
Problem p02576 (python)

Fixed submission:
N,X,T = map(int,input().split())
S = N//X
A = N%X
if A == 0:
    print(S*T)
else:
    K = S+1
    print(K*T)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N%9 == 0:
    print("yes")
else:
    print("no")
Problem p02612 (python)

Fixed submission:
N = input()
if len(N) >= 3:
    A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
    if A == 0:
        print(0)
    else:
        print(1000 - A)
elif len(N) == 2:
    A = int(N[-2])*10 + int(N[-1])
    print(1000 - A)
elif len(N) == 1:
    A = int(N[-1])
    print(1000 - A)

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

Buggy submission (verdict: Runtime Error):
N = input()
A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
if A == 0:
    print("0")
else:
 print(1000 - A)

Buggy submission (verdict: Runtime Error):
N = input()
A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
if A == 0:
    print("0")
else:
 print(1000 - A)

Buggy submission (verdict: Runtime Error):
N = input()
A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
print(1000 - A)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = 10000 - N
a = str(A)
print(a[-3]+a[-2]+a[-1])
Problem p02608 (python)

Fixed submission:
def calc(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

n = int(input())
ans = [0]*n

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = calc(x, y, z)
            if a <= n:
                ans[a-1] += 1

b = [str(i) for i in ans]
print('\n'.join(b))

Buggy submission (verdict: Runtime Error):
import numpy as np

def calc(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

n = int(input())
ans = [0]*n

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = calc(x, y, z)
            if a <= n:
                ans[a-1] += 1

b = [str(i) for i in ans]
print('\n'.join(b))
Problem p02642 (python)

Fixed submission:
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]

m = np.zeros(max(a)+1, dtype=int)
cnt = 0

for i in a:
    m[::i] += 1
for i in a:
    if m[i] == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
m = np.zeros(10**6+1, dtype=int)
cnt = 0

for i in a:
    m[::i] += 1
for i in a:
    if m[i] == 1:
        cnt += 1
print(cnt)