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

Fixed submission:
Imp = list(map(int, input().split()))
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Inp = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Blist.sort()

out = 0
for i in range(Imp[0,1]):
    out += Blist[-(i+1)]
    
print(out)

Buggy submission (verdict: Runtime Error):
Imp = input()
 
A = int(Imp[0])
B = int(Imp[2])
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = input()

A = int(Imp[0])
B = int(Imp[2])
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = int(raw_input())
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
import sys
Imp = [int(i) for i in sys.stdin]
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = raw_input().split()
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = input().split()
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = <STDIN>
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
Imp = input()
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:    
    re = 1
if B % 3 == 0:
    re = 1
if (A+B) % 3 == 0:
        re = 1
        
if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
re = 0
    if A % 3 == 0:    
        re = 1
    if B % 3 == 0:
        re = 1
    if (A+B) % 3 == 0:
        re = 1
        
 if re ==1:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
    re = 0
    if A % 3 == 0:    
        re = 1
    if B % 3 == 0:
        re = 1
    if (A+B) % 3 == 0:
        re = 1
        
    if re ==1:
        return "Possible"
    else:
        return "Impossible"
Problem p03658 (python)

Fixed submission:
Imp = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Blist.sort()

out = 0
for i in range(Imp[1]):
    out += Blist[-(i+1)]
    
print(out)

Buggy submission (verdict: Runtime Error):
Inp = input()
Blist = Inp[1]
Blist.sort()

out = 0
for i in range(Imp[0,1]):
    out += Blist[-(i+1)]
    
print(out)
Problem p02687 (python)

Fixed submission:
S = input("")
if S =="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
G = N
lists = np.zeros(N)
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] < H[B-1]:
        lists[A-1] = 1
    else:
        lists[B-1] = 1
for i in range(N):
    if lists[i] == 1:
        G -= 1
print(lists)
print(G)
Problem p02796 (python)

Fixed submission:
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n


for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]


c=[[0]*2  for i in range(n)]


for j in range(n):
    c[j][0]=b[j]
    c[j][1]=a[j]


c.sort()


ans=0
z=c[0][1]
for i in range(n):
    if c[i][1]>=z:
        ans+=1
        z=c[i][0]

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n

for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]
    
cnt=0    
while(b):
    bm=min(b)
    a.pop(b.index(min(b)))
    b.pop(b.index(min(b)))
    cnt+=1
    for j in range(len(a)):
        if a[j]<bm:
            a.pop(j)
            b.pop(j)

print(cnt)
Problem p03219 (python)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)

Buggy submission (verdict: Runtime Error):
print(int(input())+int(input())//2)
Problem p03434 (python)

Fixed submission:
input()
card=sorted(map(int,input().split()))[::-1]
print(sum(card[::2])-sum(card[1::2]))

Buggy submission (verdict: Runtime Error):
n = int( input())
a = sorted(  list(map(int, input().split())) , reverse)
print((sum(a[::2])-sum(a[1::2]))
Problem p03486 (python)

Fixed submission:
print("Yes" if sorted(input()) < sorted(input())[::-1] else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if print(sorted(input())) < print(sorted(input())[::-1]) else "No")
Problem p03544 (python)

Fixed submission:
n=int(input())
a,b=2,1
for i in range(n):
    a,b=b,a+b
print(a)

Buggy submission (verdict: Runtime Error):
a,b=2,1
for i in range(n):
    a,b=b,a+b
print(a)
Problem p03673 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
if n%2==1:
    print(*(a[::-2]+a[1::2]))
if n%2==0:
    print(*(a[::-2]+a[0::2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n%2==1:
    print(*a[::-2],*a[1::2])
if n%2==0:
    print(*a[::-2],*a[0::2])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n%2==1:
    print(*a[::-2],*a[1::2])
if n%2==0:
    print(*a[::-2],*a[0::2])
Problem p02934 (python)

Fixed submission:
from functools import reduce


n = int(input())
A = list(map(int, input().split()))
if n == 1:
    print(A[0])
else:
    numerator = reduce(lambda a, b: a * b, A)
    denominator = 0
    for i in range(n):
        denominator += reduce(lambda a, b: a * b, A[:i] + A[i+1:])
    print(1.0 * numerator / denominator)

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


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

numerator = reduce(lambda a, b: a * b, A)
denominator = 0
for i in range(n):
    denominator += reduce(lambda a, b: a * b, A[:i] + A[i+1:])
print(1.0)

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


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

numerator = reduce(lambda a, b: a * b, A)
denominator = 0
for i in range(n):
    denominator += reduce(lambda a, b: a * b, A[:i] + A[i+1:])
print(1.0 * numerator / denominator)

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


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

a = reduce(lambda a, b: a * b, A)
total = 0
for i in range(n):
    total += reduce(lambda a, b: a * b, A[:i] + A[i+1:])
print(1.0 * a / total)
Problem p02952 (python)

Fixed submission:
n = int(input())
cnt = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = 0
for i in range(1, n + 1):
    if str(i) % 2 == 1:
        cnt += 1
print(cnt)
Problem p02958 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
sorted_p = sorted(p)
cnt = 0
for a, b in zip(p, sorted_p):
    if a != b:
        cnt += 1
if cnt > 2:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
sorted_p = sorted(p)
cnt = 0
for a, b in p, sorted_p:
    if a != b:
        cnt += 1
if cnt > 2:
    print("NO")
else:
    print("YES")
Problem p02995 (python)

Fixed submission:
from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def counter(n, a):
    return n // a


a, b, c, d = map(int, input().split())
l = lcm(c, d)
print(b - a + 1 - (counter(b, c) - counter(a - 1, c) +
                   counter(b, d) - counter(a - 1, d) -
                   (counter(b, l) - counter(a - 1, l))))

Buggy submission (verdict: Runtime Error):
from math import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def counter(n, a):
    return n // a


a, b, c, d = map(int, input().split())
l = lcm(c, d)
print(b - a + 1 - (counter(b, c) - counter(a - 1, c) +
                   counter(b, d) - counter(a - 1, d) -
                   (counter(b, l) - counter(a - 1, l))))
Problem p03079 (python)

Fixed submission:
a, b, c = input().split()
if a == b == c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = input()
if a == b == c:
    print("Yes")
else:
    print("No")
Problem p03085 (python)

Fixed submission:
b = input()
a = ''
for i in range(len(b)):
    if b[i] == 'A':
        a += 'T'
    elif b[i] == 'T':
        a += 'A'
    elif b[i] == 'C':
        a += 'G'
    elif b[i] == 'G':
        a += 'C'
print(a)

Buggy submission (verdict: Runtime Error):
b = input()
a = ''
for i in range(4):
    if b[i] == 'A':
        a += 'T'
    elif b[i] == 'T':
        a += 'A'
    elif b[i] == 'C':
        a += 'G'
    elif b[i] == 'G':
        a += 'C'
print(a)
Problem p03089 (python)

Fixed submission:
import sys

N = int(input())
b = list(map(int, input().split()))
# 1 1 1 2 2 1 2 3 2


# b = map(int, '1 1 1 2 2 1 2 3 2'.split())
# N = len(b)

steps = []
for i in range(N):
    cands = []
    for j in range(N - i):
        if (j + 1) == b[j]:
            cands.append(j)
    if len(cands) == 0:
        print(-1)
        sys.exit()
    else:
        j = cands[-1]
        steps.append(j + 1)
        b = b[:j] + b[j+1:]
for s in steps[::-1]:
    print(s)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
b = map(int, input().split())
# 1 1 1 2 2 1 2 3 2


# b = map(int, '1 1 1 2 2 1 2 3 2'.split())
# N = len(b)

steps = []
for i in range(N):
    cands = []
    for j in range(N - i):
        if (j + 1) == b[j]:
            cands.append(j)
    if len(cands) == 0:
        print(-1)
        sys.exit()
    else:
        j = cands[-1]
        steps.append(j + 1)
        b = b[:j] + b[j+1:]
for s in steps[::-1]:
    print(s)
Problem p03111 (python)

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]


def dfs(cur, a, b, c):
    if cur == N:
        if min(a, b, c) > 0:
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
        else:
            return float('inf')
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)


print(dfs(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]


def dfs(cur, a, b, c):
    if cur == N:
        if min(a, b, c) > 0:
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
        else:
            return float('inf')
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + [cur]) + 10
    return min(ret0, ret1, ret2, ret3)


print(dfs(0, 0, 0, 0))
Problem p03126 (python)

Fixed submission:
from collections import defaultdict


n, m = map(int, input().split())
d = defaultdict(int)
for i in range(n):
    tmp = list(map(int, input().split()))
    for a in tmp[1:]:
        d[a] += 1
cnt = 0
for value in d.values():
    if value == n:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


n, m = map(int, input().split())
d = defaultdict(int)
for i in range(n):
    tmp = list(map(int, input().split()))
    for a in tmp[1:]:
        d[a] += 1
cnt = 0
for value in range(d.values()):
    if value == n:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


n, m = map(int, input().split())
d = defaultdict(int)
for i in range(n):
    tmp = map(int, input().split())
    for a in tmp[1:]:
        d[a] += 1
cnt = 0
for value in range(d.values()):
    if value == n:
        cnt += 1
print(cnt)
Problem p03220 (python)

Fixed submission:
# https://atcoder.jp/contests/abc113/tasks/abc113_b


def temp(T, x, A):
    return abs(A - (T - 0.006 * x))

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

min_diff = temp(T, H[0], A)
answer = 0
for i in range(1, N):
    diff = temp(T, H[i], A)
    if diff < min_diff:
        answer = i
        min_diff = diff
print(answer + 1)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc113/tasks/abc113_b


def temp(T, x, A):
    return abs(A - (T - 0.006 * x))

N = int(input())
T, A = map(int, input().split())
H = map(int, input().split())

min_diff = temp(T, H[0], A)
answer = 0
for i in range(1, N):
    diff = temp(T, H[i], A)
    if diff < min_diff:
        answer = i
        min_diff = diff
print(answer)
Problem p03244 (python)

Fixed submission:
from collections import Counter


n = int(input())
vs = list(map(int, input().split()))
a = vs[::2]
b = vs[1::2]

ca = Counter(a)
cb = Counter(b)
ca[0] = 0
cb[0] = 0
if ca.most_common(1)[0][0] != cb.most_common(1)[0][0]:
    print(n - ca.most_common(1)[0][1] - cb.most_common(1)[0][1])
else:
    print(min(
        n - ca.most_common(1)[0][1] - cb.most_common(2)[1][1],
        n - ca.most_common(2)[1][1] - cb.most_common(1)[0][1]
    ))
    # if len(set(vs)) == 1:
    #     print(n // 2)
    # else:
    #     print(min(
    #         n - ca.most_common(1)[0][1] - cb.most_common(2)[1][1],
    #         n - ca.most_common(2)[1][1] - cb.most_common(1)[0][1]
    #     ))

Buggy submission (verdict: Runtime Error):
from collections import Counter


n = int(input())
vs = list(map(int, input().split()))
a = vs[::2]
b = vs[1::2]

ca = Counter(a)
cb = Counter(b)
if ca.most_common(1)[0][0] != cb.most_common(1)[0][0]:
    print(n - ca.most_common(1)[0][1] - cb.most_common(1)[0][1])
else:
    print(min(
        n - ca.most_common(1)[0][1] - cb.most_common(2)[1][1],
        n - ca.most_common(2)[1][1] - cb.most_common(1)[0][1]
    ))
Problem p03254 (python)

Fixed submission:
n, x = map(int, input().split())
a = list(sorted(map(int, input().split())))
if x == sum(a):
    print(n)
else:
    acc = 0
    for i in range(n):
        acc += a[i]
        if acc > x:
            break
    if i == n:
        print(n - 1)
    else:
        print(i)

Buggy submission (verdict: Runtime Error):

import bisect


n, x = map(int, input().split())
a = list(sorted(map(int, input().split())))
if x == sum(x):
    print(n)
else:
    acc = [0 for i in range(n)]
    acc[0] = a[0]
    for i in range(1, n):
        acc[i] += a[i - 1] + a[i]
    index = bisect.bisect_right(acc, x)
    if index == n:
        print(index - 1)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
if len(set(s)) == 1 and s[0] == '1':
    print(1)
else:
    i = 0
    while i < len(s) and s[i] == '1':
        i += 1
    if k <= i:
        print(1)
    else:
        print(s[i])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while i < len(s) and s[i] == '1':
    i += 1
if k < i:
    print(1)
else:
    print(s[i])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == '1':
    i += 1
if k < i:
    print(1)
else:
    print(s[i])
Problem p03308 (python)

Fixed submission:
N = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
As = map(int, input().split())
max_diff = - float('inf')
for i in range(N):
    for j in range(i + 1, N):
        max_diff = max(max_diff, abs(As[i] - As[j]))
print(max_diff)
Problem p03381 (python)

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

if sorted_x[n // 2] == sorted_x[n // 2 - 1]:
    ret = [sorted_x[n // 2]] * n
else:
    ret = []
    for i in range(n):
        if x[i] >= sorted_x[n // 2]:
            ret.append(sorted_x[n // 2 - 1])
        else:
            ret.append(sorted_x[n // 2])
for i in ret:
    print(i)

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

if sorted_x[n // 2] == sorted_x[n // 2 - 1]:
    print(' '.join([sorted_x[n // 2] * n]))
else:
    ret = []
    for i in range(n):
        if x[i] >= sorted_x[n // 2]:
            ret.append(sorted_x[n // 2])
        else:
            ret.append(sorted_x[n // 2 - 1])
    print(' '.join(ret))
Problem p03387 (python)

Fixed submission:
a = list(sorted(map(int, input().split())))
if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)
else:
    if (a[2] - a[0]) % 2 == 1:
        a[0] += 2
        a[1] += 1
        a[2] += 1
    else:
        a[0] += 1
        a[1] += 2
        a[2] += 1
    a = sorted(a)
    if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 2)
    elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1 + 2)
    else:
        raise

Buggy submission (verdict: Runtime Error):
a = list(sorted(map(int, input().split())))
if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)
else:
    if (a[2] - a[0]) % 2 == 1:
        a[0] += 3
        a[1] += 2
        a[2] += 1
    else:
        a[1] += 3
        a[0] += 2
        a[2] += 1
    a = sorted(a)
    if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 3)
    elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1 + 3)
    else:
        raise
Problem p03399 (python)

Fixed submission:
a, b, c, d = [int(input()) for _ in range(4)]
print(min(a + c,
          a + d,
          b + c,
          b + d))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
print(min(a + c,
          a + d,
          b + c,
          b + d))
Problem p03408 (python)

Fixed submission:
from collections import defaultdict

n = int(input())
d = defaultdict(int)
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

answer = sorted([d[k] for k in d.keys()])[-1]
if answer < 0:
    answer = 0
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
d = defaultdict()
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

answer = sorted([d[k] for k in d.keys()])[-1]
if answer < 0:
    answer = 0
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
d = defaultdict()
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

print(sorted([d[k] for k in d.keys()])[-1])
Problem p03427 (python)

Fixed submission:
n = input()
k = len(n)
c = n[0]
if n == c + '9' * (k - 1):
    print(int(n[0]) + 9 * (k - 1))
else:
    print(int(n[0]) + 9 * (k - 1) - 1)

Buggy submission (verdict: Runtime Error):
n = input()
k = len(n)
c = int(n[0])
if n == c + '9' * (k - 1):
    print(int(n[0]) + 9 * (k - 1))
else:
    print(int(n[0]) + 9 * (k - 1) - 1)
Problem p03435 (python)

Fixed submission:
# https://atcoder.jp/contests/abc088/tasks/abc088_c

import sys

m = [list(map(int, input().split())) for _ in range(3)]

for a in range(-1000, 1001):
    b_1 = m[0][0] - a
    b_2 = m[0][1] - a
    b_3 = m[0][2] - a
    if (m[1][0] - b_1 ==
        m[1][1] - b_2 ==
        m[1][2] - b_3) and \
        (m[2][0] - b_1 ==
         m[2][1] - b_2 ==
         m[2][2] - b_3):
        print('Yes')
        sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys

m = [map(int, input().split()) for _ in range(3)]

for a in range(-1000, 1001):
    b_1 = m[0][0] - a
    b_2 = m[0][1] - a
    b_3 = m[0][2] - a
    if (m[1][0] - b_1 ==
        m[1][1] - b_2 ==
        m[1][2] - b_3) and \
        (m[2][0] - b_1 ==
         m[2][1] - b_2 ==
         m[2][2] - b_3):
        print('Yes')
        sys.exit()
print('No')
Problem p03470 (python)

Fixed submission:
N = int(input())
d = set([int(input()) for _ in range(N)])
print(len(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = sorted([int(input()) for _ in range(n)])
cnt = 1
for a, b in zip(cnt[1:], cnt):
    if a > b:
        cnt += 1
print(cnt)
Problem p03495 (python)

Fixed submission:
# https://atcoder.jp/contests/abc081/tasks/arc086_a

from collections import Counter

n, k = map(int, input().split())
a = list(sorted(map(int, input().split())))
c = Counter(a)
current_k = len(c)
xlst = c.most_common(current_k)[k:]

answer = 0
for x in xlst:
    answer += x[1]

print(answer)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(set([int(input) for _ in range(n)]))
if k >= len(a):
    print(0)
else:
    print(k - len(a))
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input())
print(min(b, a * n))
Problem p03644 (python)

Fixed submission:
# https://atcoder.jp/contests/abc068/tasks/abc068_b


def two_factor(x):
    cnt = 0
    while x % 2 == 0:
        cnt += 1
        x //= 2
    return cnt


N = int(input())
a = list(map(two_factor, range(1, N + 1)))
max_cnt = max(a)
print(a.index(max_cnt) + 1)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc068/tasks/abc068_b


def two_factor(x):
    cnt = 0
    while x % 2 == 0:
        cnt += 1
        x //= 2
    return cnt


N = int(input())
a = map(two_factor, range(1, N + 1))
max_cnt = max(a)
print(a.index(max_cnt) + 1)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc068/tasks/abc068_b


def two_factor(x):
    cnt = 0
    while x % 2 == 0:
        cnt += 1
        x //= 2
    return cnt


N = int(input())
a = map(two_factor, range(1, N + 1))
max_cnt = max(a)
print(list(range(1, N + 1)).index(max_cnt) + 1)
Problem p03661 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
sum_num = sum(a)
current_sum = 0
min_diff = float('inf')
for i in range(0, N - 1):
    current_sum += a[i]
    min_diff = min(min_diff, abs(current_sum - (sum_num - current_sum)))
print(min_diff)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

# http://arc078.contest.atcoder.jp/tasks/arc078_a

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

sum_num = sum(a)
current_sum = 0
min_diff = float('inf')
for i in range(0, N - 1):
    current_sum += a[i]
    min_diff = min(min_diff, abs(current_sum - (sum_num - current_sum)))
print(min_diff)
Problem p03665 (python)

Fixed submission:
N, P = map(int, input().split())
A = map(int, input().split())

n_even = len(list(filter(lambda x: x % 2 == 0, A)))
n_odd = N - n_even
ans = (2 ** max(0, n_odd - 1)) * (2 ** n_even)
if P == 1 and n_odd == 0:
    print(0)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):

N, P = map(int, input().split())
A = map(int, input().split())

n_even = len(filter(lambda x: x % 2 == 0, A))
n_odd = N - n_even
ans = 2 ** max(0, n_odd - 1) * 2 ** n_even
if P == 0 and n_odd == 0:
    print(0)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):

N, P = map(int, input().split())
A = map(int, input().split())

n_even = len(filter(lambda x: x % 2 == 0, A))
n_odd = N - n_even
ans = 2 ** max(0, n_odd - 1) * 2 ** n_even
if P == 0 and n_odd == 0:
    print(0)
else:
    print(ans)