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

Fixed submission:
from functools import reduce
from operator import mul

s = reduce(mul, map(int, input().split(' ')))
print('YES' if s == 175 else 'NO')

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import mul

n = int(input())
s = reduce(mul, map(int, input().split(' ')))
print('YES' if s == 175 else 'NO')
Problem p03719 (python)

Fixed submission:
A,B,C = map(int,raw_input().split())

if C>=A and C<=B:
    print 'Yes'
else:
    print 'No'

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

W = [['inf' for j in range(N)] for i in range(N)]
y = ['inf' for i in range(N)]
y_t = ['inf' for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = 'inf'
        for k in range(N):
            yj_temp = 'inf'
            if y[k]!='inf' and W[k][j]!='inf':
                yj_temp=y[k]+W[k][j]
            if yj_temp!='inf':
                if yj_temp=='inf':
                    yj_max = yj_temp
                elif yj_max<yj_temp:
                    yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    

print y[N-1]

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

road_list = [[] for i in range(N)]

W = [[-2*(10**9)-1 for j in range(N)] for i in range(N)]
y = [-2*(10**9)-1 for i in range(N)]
y_t = [-2*(10**9)-1 for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = -2*(10**9)-1
        for k in range(N):
            yj_temp = -2*(10**9)-1
            if y[k]!=-2*(10**9)-1 and W[k][j]!=-2*(10**9)-1:
                yj_temp=y[k]+W[k][j]
            if yj_max<yj_temp:
                yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    

if flag:
    print y[N-1]
else:
    print 'infty'
Problem p03721 (python)

Fixed submission:
N,K = map(int,raw_input().split())

ab_list=[]

count = 0
for i in range(N):
    a,b = map(int,raw_input().split())
    ab_list.append([a,b])
    
ab_list = sorted(ab_list,key=lambda ab:ab[0])

for i in range(N):
    count+=ab_list[i][1]
    if count>=K:
        print ab_list[i][0]
        break

Buggy submission (verdict: Runtime Error):
N,K = map(int,raw_input().split())

a_list=[]
b_list=[]
count = 0
for i in range(N):
    a,b = map(int,raw_input().split())
    a_list.append(a)
    b_list.append(b)

for i in range(N):
    count+=b[i]
    if count>=K:
        print a[i]
        break
Problem p03722 (python)

Fixed submission:
N, M = map(int, raw_input().split())
D = [map(int, raw_input().split()) for _ in range(M)]
 
score = [None for _ in range(N+1)]
score[1] = 0
 
for _ in range(N):
    for a, b, c in D:
        if score[a] != None:
            score[b] = max(score[b], score[a] + c)
v1 = score[-1]
for _ in range(N):
    for a, b, c in D:
        if score[a] != None:
            score[b] = max(score[b], score[a] + c)
v2 = score[-1]
 
if v1 != v2:
    print "inf"
else:
    print v2

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

W = [['inf' for j in range(N)] for i in range(N)]
y = ['inf' for i in range(N)]
y_t = ['inf' for i in range(N)]
y[0] = 0
y_t[0] = 0

for i in range(N):
    W[i][i]=0

for i in range(M):
    a,b,c=map(int,raw_input().split())
    W[a-1][b-1] = c

flag = False

for i in range(N):
    for j in range(N):
        yj_max = 'inf'
        for k in range(N):
            yj_temp = 'inf'
            if y[k]!='inf' and W[k][j]!='inf':
                yj_temp=y[k]+W[k][j]

                    if yj_max=='inf':
                        yj_max = yj_temp
                    elif yj_max<yj_temp:
                        yj_max = yj_temp
        y_t[j]=yj_max
    if y==y_t:
        flag = True
        break
    y = y_t
    
if flag:
    print y[N-1]
else:
    print 'inf'
Problem p03675 (python)

Fixed submission:
n=int(input())
a=input().split()

for i in range(len(a)):
    a[i]=int(a[i])

b=[0 for i in range(len(a))]

if(n%2==0):
    for i in range(int(n/2)):
        b[i]=a[n-2*i-1]
    
    for i in range(int(n/2)):
        b[i+int(n/2)]=a[1+2*i-1]
else:
    for i in range(int((n+1)/2)):
        b[i]=a[n-2*i-1]
    for i in range(int((n-1)/2)):
        b[i+int((n+1)/2)]=a[2+2*i-1]
        
for i in range(n):
    print(b[i],end=" ")

Buggy submission (verdict: Runtime Error):
c=input().split()
for i in range(2):
    c[i]=int(c[i])
n=c[0]
m=c[1]
a=input().split()

for i in range(len(a)):
    a[i]=int(a[i])

b=[0 for i in range(m+1)]

for i in range(n-1):
    if(a[i]<a[i+1]):
        for j in range(a[i+1]-a[i]):
            b[a[i]+1+j]+=1
    else:
        for j in range(a[i+1]):
            b[j+1]+=1
        for j in range(m-a[i]):
            b[a[i]+1+j]+=1

max_value=0
max_num=0
for i in range(m):
    if(max_value<=b[i]):
        max_value=b[i]
        max_num=i

def move(x,y):
    result=0
    if(x<y):
        result=y-x
    else:
        result=(m-x)+y

    return result

sum_value=0
for i in range(n-1):
    sum_value+=min(move(max_num,a[i+1]),move(a[i],a[i+1]))
print(sum_value)

Buggy submission (verdict: Runtime Error):
c=input().split
for i in range(2):
    c[i]=int(c[i])
n=c[0]
m=c[1]
a=input().split()

for i in range(len(a)):
    a[i]=int(a[i])

b=[0 for i in range(m+1)]

for i in range(n-1):
    if(a[i]<a[i+1]):
        for j in range(a[i+1]-a[i]):
            b[a[i]+1+j]+=1
    else:
        for j in range(a[i+1]):
            b[j+1]+=1
        for j in range(m-a[i]):
            b[a[i]+1+j]+=1

max_value=0
max_num=0
for i in range(m):
    if(max_value<=b[i]):
        max_value=b[i]
        max_num=i

def move(x,y):
    result=0
    if(x<y):
        result=y-x
    else:
        result=(m-x)+y

    return result

sum_value=0
for i in range(n-1):
    sum_value+=min(move(max_num,a[i+1]),move(a[i],a[i+1]))
print(sum_value)
Problem p03693 (python)

Fixed submission:
a=input()
a=a.split()

r=int(a[0])
g=int(a[1])
b=int(a[2])

x=100*r+10*g+b

if(x%4==0):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r=int(input())
g=int(input())
b=int(input())
 
x=int(r*100+g*10+b)
if(x%4==0):
    print('YES')
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r=input()
g=input()
b=input()

x=int(r*100+g*10+b)
if(x%4==0):
    print('YES')
else:
    print("NO")
Problem p03681 (python)

Fixed submission:
import numpy as np
import scipy as sp
import math

def main():
    # parse
    N, M = parse(get_stdin())
    # compute
    result = compute(N, M)
    # show result
    print(result)

def compute(N, M):
    a = abs(N - M)
    if a >= 2:
        return 0
    elif a == 1:
        return (math.factorial(N) * math.factorial(M)) % (10**9+7)
    else:
        return 2*(math.factorial(N) * math.factorial(M)) % (10**9+7)

def get_stdin():
    return input()

def split_stdin(stdin_val, delimiter = ' '):
    return [x for x in stdin_val.split(delimiter) if x != '']

def parse(stdin_vars):
    vars = split_stdin(stdin_vars)
    return int(vars[0]), int(vars[1])

if __name__ == "__main__":
    main()

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

def main():
    # parse
    N, M = parse(get_stdin())
    # compute
    result = compute(N, M)
    # show result
    print(result)

def compute(N, M):
    a = abs(N - M)
    if a >= 2:
        return 0
    elif a == 1:
        return math.factorial(N) + math.factorial(M) / (10**9+7)
    else:
        return 2*math.factorial(N) + math.factorial(M) / (10**9+7)

def get_stdin():
    return input()

def split_stdin(stdin_val, delimiter = ' '):
    return [x for x in stdin_val.split(delimiter) if x != '']

def parse(stdin_vars):
    vars = split_stdin(stdin_vars)
    return int(vars[0]), int(vars[1])

if __name__ == "__main__":
    main()

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

def main():
    # parse
    N, M = parse(get_stdin())
    # compute
    result = compute(N, M)
    # show result
    print(result)

def compute(N, M):
    a = abs(N - M)
    if a >= 2:
        return 0
    elif a == 1:
        return math.factorial(N) + math.factorial(M) / (10**9+7)
    else:
        return 2*math.factorial(N) + math.factorial(M) / (10**9+7)

def get_stdin():
    return input()

def split_stdin(stdin_val, delimiter = ' '):
    return [x for x in stdin_val.split(delimiter) if x != '']

def parse(stdin_vars):
    vars = split_stdin(stdin_vars)
    return int(vars[0]), int(vars[1])

if __name__ == "__main__":
    main()

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

def main():
    # parse
    N, M = parse(get_stdin())
    # compute
    result = compute(N, M)
    # show result
    print(result)

def compute(N, M):
    a = abs(N - M)
    if a >= 2:
        return 0
    elif a == 1:
        return math.factorial(N) + math.factorial(M) / (10**9+7)
    else:
        return 2*math.factorial(N) + math.factorial(M) / (10**9+7)

def get_stdin():
    return input()

def split_stdin(stdin_val, delimiter = ' '):
    return [x for x in stdin_val.split(delimiter) if x != '']

def parse(stdin_vars):
    vars = split_stdin(stdin_vars)
    return int(vars[0]), int(vars[1])

if __name__ == "__main__":
    main()
Problem p03998 (python)

Fixed submission:
Sa = list(raw_input())
Sb = list(raw_input())
Sc = list(raw_input())

def choise(t):
    if t == "a":
        if Sa == []:
            print "A"
        else:
            choise(Sa.pop(0))
    elif t== "b":
        if Sb == []:
            print "B"
        else:
            choise(Sb.pop(0))
    else:
        if Sc == []:
            print "C"
        else:
            choise(Sc.pop(0))

choise(Sa.pop(0))

Buggy submission (verdict: Runtime Error):
Sa = list(raw_input())
Sb = list(raw_input())
Sc = list(raw_input())

ne = Sa.pop(0)
s = len(Sa)
while s!=0:
    if ne == "a":
        ne = Sa.pop(0)
        s = len(Sa)
    if ne == "b":
        ne = Sb.pop(0)
        s = len(Sb)
    if ne == "c":
        ne = Sc.pop(0)
        s = len(Sc)
print ne.upper()

Buggy submission (verdict: Runtime Error):
Sa = list(raw_input())
Sb = list(raw_input())
Sc = list(raw_input())

ne = Sa.pop(0)
s = len(Sa)
while s!=0:
    if ne == "a":
        ne = Sa.pop(0)
    if ne == "b":
        ne = Sb.pop(0)
    if ne == "c":
        ne = Sc.pop(0)
    s = len(Sa)
print ne.upper()

Buggy submission (verdict: Runtime Error):
Sa = list(raw_input())
Sb = list(raw_input())
Sc = list(raw_input())

ne = Sa.pop(0)
s = len(Sa)
while s!=0:
    if ne == "a":
        ne = Sa.pop(0)
    if ne == "b":
        ne = Sb.pop(0)
    if ne == "c":
        ne = Sc.pop(0)
    s = len(Sa)
print ne
Problem p04006 (python)

Fixed submission:
def solve(n, x, a):
	costs = []
	cost_min = 0
	for k in range(n):
		if k == 0:
			costs = a.copy()
		else:
			for i in range(n):
				costs[i] = min(costs[i], a[(i-k)%n])
		cost_k = sum(costs) + k*x
		if k == 0:
			cost_min = cost_k
		else:
			cost_min = min(cost_min, cost_k)
			if cost_min != cost_k:
				break
		if cost_min < (k+1) *x:
			break
 
	return cost_min
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print(solve(n,x,a))

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
b = []
for k in range(n):
    if k == 0:
        b = a[:]
    else:
        for i in range(n):
            b[i] = min(a[(i-k)%n],b[i])
    cost = k*x+sum(b)
    if k == 0:
        ans = cost
    else:
        ans = min(ans,cost)
        if ans != cost:
            break
    if ans < (k+1)*x:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
b = []
for k in range(n):
    if k == 0:
        b = a.copy()
    else:
        for i in range(n):
            b[i] = min(a[(i-k)%n],b[i])
    cost = k*x+sum(b)
    if k == 0:
        ans = cost
    else:
        ans = min(ans,cost)
        if ans != cost:
            break
    if ans < (k+1)*x:
        break
print ans

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
b = a[:]
for k in range(n):
    for i in range(n):
        b[i] = min(a[i-k],b[i])
    ans = min(ans,k*x+sum(b))
print ans
Problem p04045 (python)

Fixed submission:
import itertools,math,bisect,pprint,sys

n, k = map(int, raw_input().split())
d = map(int, raw_input().split())
def use_d(n):
    for i in list(str(n)):
        if int(i) in d:
            return True
    else:
        return False
while n < 100000:
    if use_d(n):
        n += 1
    else:
        print n
        sys.exit()

Buggy submission (verdict: Runtime Error):
n, k = map(int, raw_input().split())
d = map(int, raw_input().split())
def use_d(n):
    for i in list(str(n)):
        if int(i) in d:
            return True
    else:
        return False
while n < 100000:
    if use_d(n):
        n += 1
    else:
        print n
        sys.exit()
Problem p03679 (python)

Fixed submission:
first = input()
split_first = first.split()

d = int(split_first[0])
a = int(split_first[1])
b = int(split_first[2])

if a >= b:
   print ('delicious')
elif b - a <= d:
   print ('safe')
else:
   print ('dangerous')

Buggy submission (verdict: Runtime Error):
import sys

okDay = int(sys.argv[1])
buyDay = int(sys.argv[2])
eatDay = int(sys.argv[3])
overDay = eatDay - buyDay
if overDay <= 0 :
    print("delicious")
    sys.exit()
if overDay <= okDay :
    print("safe")
    sys.exit()
print("dangerous")
Problem p03679 (python)

Fixed submission:
# -*- coding: utf-8 -*-

x, a, b = (int(i) for i in input().split())
if a - b >= 0:
    print("delicious")
elif a + x - b >= 0:
    print("safe")
else:
    print("dangerous")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if 2 not in a:
    print(-1)
else:
    cnt = 0
    before_num = 1
    lighted_bottons = []
    while True:
        cnt += 1
        if a[before_num - 1] == 2:
            print(cnt)
            break
        else:
            if a[before_num - 1] in lighted_bottons:
                print(-1)
                break
            before_num = a[before_num - 1]
            lighted_bottons.append(before_num)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if 2 not in a:
    print(-1)
else:
    cnt = 0
    before_num = 1
    lighted_bottons = []
    while True:
        cnt += 1
        if a[before_num - 1] == 2:
            print(cnt)
            break
        else:
            if a[before_num - 1] in lighted_bottons:
                print(-1)
                break
            before_num = a[before_num - 1]
            lighted_bottons.append(before_num)
Problem p03680 (python)

Fixed submission:
# -*- coding: utf-8 -*-


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if 2 not in a:
    print(-1)
else:
    cnt = 0
    before_num = 1
    lighted_bottons = [0 for i in range(n + 1)]
    while True:
        cnt += 1
        if a[before_num - 1] == 2:
            print(cnt)
            break
        else:
            if lighted_bottons[a[before_num - 1]] == 1:
                print(-1)
                break
            before_num = a[before_num - 1]
            lighted_bottons[before_num] = 1

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if 2 not in a:
    print(-1)
else:
    cnt = 0
    before_num = 1
    lighted_bottons = [0 for i in range(n)]
    while True:
        cnt += 1
        if a[before_num - 1] == 2:
            print(cnt)
            break
        else:
            if lighted_bottons[a[before_num - 1]] == 1:
                print(-1)
                break
            before_num = a[before_num - 1]
            lighted_bottons[before_num] = 1
Problem p03679 (python)

Fixed submission:
stdin = input()

d = int(stdin.split(" ")[0])
a = int(stdin.split(" ")[1])
b = int(stdin.split(" ")[2])

if b <= a:
    print ("delicious")
elif b <= a + d:
    print ("safe")
elif b > a + d:
    print ("dangerous")

Buggy submission (verdict: Runtime Error):
first = input()
split_first = first.split()

d = int(split_first[0])
a = int(split_first[1])
b = int(split_first[2])

if a >= b:
   print ('delicious')
else if b - a <= d:
   print ('safe')
else:
   print ('dangerous')

Buggy submission (verdict: Runtime Error):
first = input()
split_first = first.split()

d = int(split_first[0])
a = int(split_first[1])
b = int(split_first[2])

if a >= b:
   print ('delicious')
else if b - a <= d:
   print ('safe')
else:
   print ('dangerous')
Problem p03679 (python)

Fixed submission:
x,a,b = map(int, input().split())
if b <=a:
    print("delicious")
elif b <= a+x:
    print("safe")
else:
    print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if b <=a:
    print("delicious")
elif b <= a+x:
    print("safe")
else:
    print("dangerous")
afaafafd
Problem p03679 (python)

Fixed submission:
num=raw_input('')
numberdays=num.split(' ')
if int(numberdays[2])-int(numberdays[1])>int(numberdays[0]):
    print 'dangerous'
if 0<int(numberdays[2])-int(numberdays[1])<=int(numberdays[0]):
    print 'safe'
if int(numberdays[2])-int(numberdays[1])<=0:
    print 'delicious'

Buggy submission (verdict: Runtime Error):
num=raw_input('the 3 number of days:')
numberdays=num.split(' ')
if int(numberdays[2])-int(numberdays[1])>int(numberdays[0]):
    print 'dangerous'
if 0<int(numberdays[2])-int(numberdays[1])<=int(numberdays[0]):
    print 'safe'
if if int(numberdays[2])-int(numberdays[1])<=0:
    print 'delicious'
Problem p03695 (python)

Fixed submission:
# coding: utf-8

N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>=8:
        flag[8]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if ans == 0:
    ans =1
    ans_sum = flag[8]
else: 
    ans_sum= ans+flag[8]
    
print(ans, ans_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>=8:
        flag[num]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if ans + flag[8]>=8:
    ans_sum = 8
else: 
    ans_sum= ans+flag[8]
    
print(ans, ans_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>8:
        flag[num]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if flag[8]>8:
    ans_sum = ans + 8
else:
    ans_sum = ans + flag[8]
    
print(ans, ans_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = int(a[i]/400)
    flag[num]+=1
for i in range(len(flag)-1):
    if flag[i]>=1:
        ans += 1
if flag[8]>8:
    ans_sum = ans + 8
else:
    ans_sum = ans + flag[8]
    
print(ans, ans_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = int(a[i]/400)
    flag[num]+=1
for i in range(len(flag)-1):
    if flag[i]>=1:
        ans += 1
if flag[8]>8:
    ans_sum = ans + 8
else:
    ans_sum = ans + flag[8]
    
print(ans, ans_sum)
Problem p03796 (python)

Fixed submission:
def solve(n):
    ans = 1 
    for i in range(n):
        ans = (i+1)*ans%(10**9+7)
        
            
    return ans

N = int(input())
print(solve(N))

Buggy submission (verdict: Runtime Error):
def solve(n):
    if n==0:
        return 1
    else:
        return n*solve(n-1)
    
N = int(input())
print(solve(N)%(10**9+7))

Buggy submission (verdict: Runtime Error):
def solve(n):
    if n==0:
        return 1
    else:
        return n*solve(n-1)
    
N = int(input())
print(solve(N)%(10**9+7))
Problem p03763 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())

ans = ""

INF = 1000

for c_i in range(ord('a'), ord('z')+1):
    small = INF
    c = chr(c_i)
    for i in range(n):
        cnt = s[i].count(c)
        small = min(small, cnt)
    ans += c * small

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
max_str = sorted(input())
for _ in range(n-1):
    s = sorted(input())
    new_max_str = []
    start_s = 0
    for i in range(len(max_str)):
        if max_str[i] > s[start_s]:
            start_s += 1
        if start_s >= len(s):
            break
        for j in range(start_s, len(s)):
            if max_str[i] <= s[j]:
                if max_str[i] == s[j]:
                    new_max_str.append(s[j])
                    start_s += 1
                break
    max_str = new_max_str.copy()

print("".join(max_str))

Buggy submission (verdict: Runtime Error):
n = int(input())
max_str = sorted(input())
for _ in range(n-1):
    s = sorted(input())
    new_max_str = []
    start_s = 0
    for i in range(len(max_str)):
        if max_str[i] > s[start_s]:
            start_s += 1
        for j in range(start_s, len(s)):
            if max_str[i] <= s[j]:
                if max_str[i] == s[j]:
                    new_max_str.append(s[j])
                    start_s += 1
                break
    max_str = new_max_str.copy()

print("".join(max_str))
Problem p03846 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
res = 1

for i in a:
    b[i] += 1

if n % 2 == 1:
    if b[0] != 1:
        print(0)
        exit(0)
    else:
        for i in range(2, n, 2):
            if b[i] != 2:
                print(0)
                exit(0)
            #print(res)
            res = res * 2 % (10**9 + 7)
else:
    for i in range(1, n, 2):
        if b[i] != 2:
            print(0)
            exit(0)
        res = res * 2 % (10 ** 9 + 7)
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
res = 1

for i in a:
    b[i] += 1

if n % 2 == 1:
    if b[0] != 1:
        print(0)
        exit(2)
    else:
        for i in range(2, n, 2):
            if b[i] != 2:
                print(0)
                exit(3)
            #print(res)
            res = res * 2 % (10**9 + 7)
else:
    for i in range(1, n, 2):
        if b[i] != 2:
            print(0)
            exit(4)
        res = res * 2 % (10 ** 9 + 7)
print(res)
Problem p03693 (python)

Fixed submission:
print('YES' if int(input().replace(' ','')[1:])%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
from collections import Counter
input()
c = Counter([min(int(i)//400,8) for i in input().split()])
lt3200 = [bool(c[i]) for i in range(8)].count(True)
print(max(1, lt3200), lt3200+c[8])
Problem p03695 (python)

Fixed submission:
N =int(input())
scores = [min(int(i)//400, 8) for i in input().split()]
d = [0]*9
for s in scores:
    d[s] = d[s] + 1
lt3200 = [bool(i) for i in d[:8]].count(True)
m = max(1, lt3200)
M = lt3200+d[8]
print('{} {}'.format(m, M))

Buggy submission (verdict: Runtime Error):
from collections import Counter
input()
c = Counter([min(int(i)//400,8) for i in input().split()])
lt3200 = [bool(c[i]) for i in range(8)].count(True)
print(max(1, lt3200), lt3200+d[8])

Buggy submission (verdict: Runtime Error):
from collections import Counter
input()
scores = [min(int(i)//400, 8) for i in input().split()]
c = Counter([min(int(i)//400,8) for i in input().split()])
lt3200 = [bool(i) for i in c[:8]].count(True)
print(max(1, lt3200), lt3200+d[8])