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

Fixed submission:
N = int(input())
nodes = {}
for _ in range(N-1):
    l, r, d = map(int, input().split())
    if nodes.get(str(l)) is None:
        nodes[str(l)] = {'to': [], 'color': -1}
    if nodes.get(str(r)) is None:
        nodes[str(r)] = {'to': [], 'color': -1}

    nodes[str(l)]['to'].append((str(r), d))
    nodes[str(r)]['to'].append((str(l), d))

q = [('1', 0)]
while q:
    node, color = q.pop()

    nodes[node]['color'] = color
    for n, d in nodes[node]['to']:
        if nodes[n]['color'] != -1:
            continue

        if d % 2 == 0:
            q.append((n, color))
        else:
            q.append((n, (color+1) % 2))


for i in range(1, N+1):
    print(nodes[str(i)]['color'])

Buggy submission (verdict: Runtime Error):
N = int(input())
nodes = {}
for _ in range(N-1):
    l, r, d = map(int, input().split())
    if nodes.get(str(l)) is None:
        nodes[str(l)] = {'to': [], 'color': -1}
    if nodes.get(str(r)) is None:
        nodes[str(r)] = {'to': [], 'color': -1}

    nodes[str(l)]['to'].append((str(r), d))
    nodes[str(r)]['to'].append((str(l), d))


def dfs(node, color):
    nodes[node]['color'] = color
    for n, d in nodes[node]['to']:
        if nodes[n]['color'] != -1:
            continue

        if d % 2 == 0:
            dfs(n, color)
        else:
            dfs(n, (color+1) % 2)


dfs('1', 0)
for i in range(1, N+1):
    print(nodes[str(i)]['color'])

Buggy submission (verdict: Runtime Error):
N = int(input())
nodes = {}
for _ in range(N-1):
    l, r, d = map(int, input().split())
    if nodes.get(str(l)) is None:
        nodes[str(l)] = {'to': [], 'color': -1}
    if nodes.get(str(r)) is None:
        nodes[str(r)] = {'to': [], 'color': -1}

    nodes[str(l)]['to'].append((str(r), d))
    nodes[str(r)]['to'].append((str(l), d))


def dfs(node, color):
    nodes[node]['color'] = color
    for n, d in nodes[node]['to']:
        if nodes[n]['color'] != -1:
            continue

        if d % 2 == 0:
            dfs(n, color)
        else:
            dfs(n, (color+1) % 2)


dfs('1', 0)
for i in range(1,N+1):
    print(nodes[str(i)]['color'])
Problem p03061 (python)

Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

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

_ = input()
A = list(map(int, input().split()))
#print("A", A)

result = 1
for i, a in enumerate(A):
    #print("ignore", a)
    A.pop(i)
    #print("current A", A)

    result = max(result, reduce(math.gcd, A))
    
    A.insert(i, a)
    #print("org A", A)
    #print("---")

print(result)
Problem p03068 (python)

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

target_char = s[k-1]

out = ""
for s_i in s:
	if s_i != target_char:
		out += "*"
	else:
		out += s_i

print(out)

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

target_char = s[k]

out = ""
for s_i in s:
	if s_i != target_char:
		out += "*"
	else:
		out += s_i

print(out)
Problem p03076 (python)

Fixed submission:
import math

cycles = []
for i in range(5):
    cycles.append(int(input()))

minimum_last_order_cycle = None
for cycle in cycles:
    if minimum_last_order_cycle is None and cycle % 10 > 0:
        minimum_last_order_cycle = cycle
    elif minimum_last_order_cycle is not None and cycle % 10 < minimum_last_order_cycle % 10 and cycle % 10 > 0:
        minimum_last_order_cycle = cycle

if minimum_last_order_cycle is None:
    minimum_last_order_cycle = cycles[0]

cycles.remove(minimum_last_order_cycle)

time = 0
for cycle in cycles:
    time += math.ceil(cycle / 10) * 10

time += minimum_last_order_cycle

print(time)

Buggy submission (verdict: Runtime Error):
import math

cycles = []
for i in range(5):
    cycles.append(int(input()))


minimum_last_order_cycle = 9
for cycle in cycles:
    if cycle % 10 <= minimum_last_order_cycle % 10 and cycle % 10 > 0:
        minimum_last_order_cycle = cycle

cycles.remove(minimum_last_order_cycle)

time = 0
for cycle in cycles:
    time += math.ceil(cycle / 10) * 10

time += minimum_last_order_cycle

print(time)
Problem p03078 (python)

Fixed submission:
import itertools

X, Y, Z, K = 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())))

comb_ab = []
for a, b in itertools.product(A, B):
    comb_ab.append(sum([a, b]))

comb_ab_top = sorted(comb_ab, reverse=True)[:K]

comb_abc = []
for ab, c in itertools.product(comb_ab_top, C):
    comb_abc.append(sum([ab, c]))

ans = sorted(comb_abc, reverse=True)[:K]
print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
import heapq
x,y,z,k = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
 
al.sort(reverse=True)
bl.sort(reverse=True)
cl.sort(reverse=True)
regist = set()
regist.add((0,0,0))
q = [(-1*(al[0]+bl[0]+cl[0]),0,0,0)]
heapq.heapify(q)
for _ in range(k):
    s,ai,bi,ci = heapq.heappop(q)
    print(-s,flush=True)
 
    if ai+1<x and (ai+1,bi,ci) not in regist:
        heapq.heappush(q, (-1*(al[ai+1]+bl[bi]+cl[ci]), ai+1,bi,ci))
        regist.add((ai+1,bi,ci))
 
    if bi+1<y and (ai,bi+1,ci) not in regist:
        heapq.heappush(q, (-1*(al[ai]+bl[bi+1]+cl[ci]), ai,bi+1,ci))
        regist.add((ai,bi+1,ci))
 
    if ci+1<z and (ai,bi,ci+1) not in regist:
        heapq.heappush(q, (-1*(al[ai]+bl[bi]+cl[ci+1]), ai,bi,ci+1))
        regist.add((ai,bi,ci+1))

Buggy submission (verdict: Runtime Error):
import heapq

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

Q = []
heapq.heappush(Q, (-(A[0]+B[0]+C[0]), 0, 0, 0))
registered = set()
registered.add((0, 0, 0))
for t in range(K):
    s, ai, bi, ci = heapq.heappop(Q)
    print(-s, flush=True)

    if ai+1 < X and (ai+1, bi, ci) not in registered:
        heapq.heappush(Q, (-(A[ai+1]+B[bi]+C[ci]), ai+1, bi, ci))
        registered.add((ai+1, bi, ci))
    if bi+1 < Y and (ai, bi+1, ci) not in registered:
        heapq.heappush(Q, (-(A[ai]+B[bi+1]+C[ci]), ai, bi+1, ci))
        registered.add((ai, bi+1, ci))
    if ci+1 < Z and (ai, bi, ci+1) not in registered:
        heapq.heappush(Q, (-(A[ai]+B[bi]+C[ci+1]), ai, bi, ci+1))
        registered.add((ai, bi, ci+1))
Problem p03238 (python)

Fixed submission:
n  = input()

if n == "1":
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

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

if n == "1"
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
Problem p03244 (python)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))

evens = [(0, 0)]*(10**5+1)
odds = [(0, 0)]*(10**5+1)
for i in range(N):
    if (i+1) % 2 == 0:
        evens[V[i]] = (V[i], evens[V[i]][1] + 1)
    else:
        odds[V[i]] = (V[i], odds[V[i]][1] + 1)

evens.sort(key=lambda x: x[1], reverse=True)
odds.sort(key=lambda x: x[1], reverse=True)

if evens[0][0] != odds[0][0]:
    print(N - evens[0][1] - odds[0][1])
else:
    print(min(N - evens[0][1] - odds[1][1], N - evens[1][1] - odds[0][1]))

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

evens = [(0, 0)]*(10**5)
odds = [(0, 0)]*(10**5)
for i in range(N):
    if (i+1) % 2 == 0:
        evens[V[i]] = (V[i], evens[V[i]][1] + 1)
    else:
        odds[V[i]] = (V[i], odds[V[i]][1] + 1)

evens.sort(key=lambda x: x[1], reverse=True)
odds.sort(key=lambda x: x[1], reverse=True)

if evens[0][0] != odds[0][0]:
    print(N - evens[0][1] - odds[0][1])
else:
    print(min(N - evens[0][1] - odds[1][1], N - evens[1][1] - odds[0][1]))
Problem p03353 (python)

Fixed submission:
S = input()
K = int(input())

substring_set = set()
for i in range(len(S)):
    substring = []
    for j in range(min([K, len(S)-i])):
        substring.append(S[i+j])
        substring_set.add(''.join(substring))

print(sorted(list(substring_set))[K-1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

substring_set = set()
for i in range(len(S)):
    for j in range(min([K, len(S)-i])):
        substring_set.add(S[i, i+j])

print(sorted(list(substring_set))[K-1])
Problem p03861 (python)

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

print(b // x - (a - 1) // x)

Buggy submission (verdict: Runtime Error):
import math

a, b, x = map(int, input().split())

print(b // x - (a - 1) // x))
Problem p03854 (python)

Fixed submission:
suf = ["dream", "dreamer", "erase", "eraser"]

s = input()
dp = [0] * (len(s) + 1)
dp[0] = 1
for i in range(len(s)):
    if not dp[i]:
        continue
    for it in suf:
        if s[i:i+len(it)] == it:
            dp[i + len(it)] = 1
print("YES") if dp[len(s)] else print("NO")

Buggy submission (verdict: Runtime Error):
suf = ["dream", "dreamer", "erase", "eraser"]

s = input()
i = 0
while i < len(s):
  nx = s[i:i+5]
  if nx != suf[0] and nx != suf[2]:
    print("NO")
    exit(0)
  i += 5
  if s[i] == 'r':
  	i += 1
print("YES")

Buggy submission (verdict: Runtime Error):
suf = ["dream", "dreamer", "erase", "eraser"]

s = input()
i = 0
while i < len(s):
	nx = s[i:i+5]
    if nx != suf[0] and nx != suf[2]:
      print("NO")
      exit(0)
    i += 5
    if s[i] == 'r':
      i += 1
print("YES")
Problem p03860 (python)

Fixed submission:
a, b, c = input().split()
a = a[0]
b = b[0]
c = c[0]
a = [a, b, c]
print(''.join(a))

Buggy submission (verdict: Runtime Error):
a, b, c = input.split()
print(a[0] + b[0] + c[0])
Problem p03943 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = sorted(map(int, input()))
if a + b == c:
  print("Yes")
else:
  print("No")
Problem p03964 (python)

Fixed submission:
a, b = 1, 1
for _ in range(int(input())):
  x, y = map(int, input().split())
  k = max((a + x - 1) // x, (b + y - 1) // y)
  a = x * k
  b = y * k
print(a + b)

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

a, b = 1, 1
for _ in range(int(input())):
  x, y = map(int, input().split())
  k = int(max((a + x - 1) // x, (b + y - 1) // y))
  a = x * k
  b = y * k
print(a + b)

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

a, b = 1, 1
for _ in range(int(input())):
  x, y = map(int, input().split())
  k = int(max((a + x - 1) // x, (b + y - 1) // y))
  a = x * k
  b = y * k
print(a + b)

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

a, b = 1, 1
for _ in range(int(input())):
  x, y = map(int, input().split())
  k = int(max(ceil(x / a), ceil(y / b)))
  a = x * k
  b = y * k
print(a + b)

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

a, b = 1, 1
for _ in range(int(input())):
  x, y = map(int, input().split())
  k = int(max(math.ceil(x / a), math.ceil(y / b)))
  a = x * k
  b = y * k
print(a + b)

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

rs = 1
for _ in range(int(input())):
  x = sum(map(int, input().split()))
  rs = x * rs / gcd(x, rs)
print(rs)
Problem p04013 (python)

Fixed submission:
n, avg = map(int, input().split())
a = list(map(int, input().split()))
mxsm = sum(a) + 5

dp = [[0] * mxsm for _ in range(n + 5)]

dp[0][0] = 1
rs = 0
for x in a:
    dp2 = [[it for it in lin] for lin in dp]
    for i in range(1, n + 1):
        for j in range(x, mxsm + 1):
            if dp[i - 1][j - x]:
                dp2[i][j] += dp[i - 1][j - x]
    dp = dp2

for i in range(1, n + 1):
    if len(dp[i]) > avg * i:
        rs += dp[i][avg * i]

print(rs)

Buggy submission (verdict: Runtime Error):
n, avg = map(int, input().split())
a = list(map(int, input().split()))
mxsm = sum(a) + 5

dp = [[0] * mxsm for _ in range(n + 5)]

dp[0][0] = 1
rs = 0
for x in a:
    dp2 = [[it1 for it1 in lin] for lin in dp]
    for i in range(1, n + 1):
        for j in range(x, mxsm + 1):
            if dp[i - 1][j - x]:
                dp2[i][j] += dp[i - 1][j - x]
    dp = dp2

for i in range(1, n + 1):
    rs += dp[i][avg * i]

print(rs)
Problem p04031 (python)

Fixed submission:
_ = input()
a = list(map(int, input().split()))
ans = 10 ** 18
for val in range(-200, 200):
    curr = 0
    for it in a:
        curr += (it - val) ** 2
    ans = min(ans, curr)
print(ans)

Buggy submission (verdict: Runtime Error):
input()
a = [*map(int, input().split())]
ans = 10 ** 18
for val in range(-200, 200):
  curr = 0
  for it in a:
    curr += (it - val) ** 2
  ans = min(ans, curr)
print(ans)
Problem p04032 (python)

Fixed submission:
s = input()
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        print(i + 1, i + 2)
        exit(0)
for sz in range(3, 4, 2):
    if sz > len(s):
        break
    for i in range(len(s) - sz + 1):
        curr = s[i:i + sz]
        for it in curr:
            if curr.count(it) > sz // 2:
                print(i + 1, i + sz)
                exit(0)
print("-1 -1")

Buggy submission (verdict: Runtime Error):
s = input()
for sz in [3, 5, 7, 9, 11, 13, 15, 17, 19, 21]
    if sz > len(s):
        break
    for i in range(len(s) - sz + 1):
        curr = s[i:i + sz]
        for it in curr:
            if curr.count(it) > sz // 2:
                print(i + 1, i + sz)
                exit(0)
print("-1 -1")

Buggy submission (verdict: Runtime Error):
s = input()
for sz in [3, 5, 7, 9, 11, 13, 15, 17, 19, 21]
    for i in range(len(s) - sz):
        curr = s[i:i + sz]
        if curr.count(curr[0]) > sz // 2 or curr.count(curr[1]) > sz // 2 or curr.count(curr[2]) > sz // 2:
            print(i + 1, i + sz)
            exit(0)
print("-1 -1")
Problem p03308 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = a[-1] - a[0]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
a.sort()
ans = a[-1] - a[0]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a = a.sort()
ans = a[-1] - a[0]
print(ans)
Problem p03369 (python)

Fixed submission:
S = input()
price = 700 + 100*S.count('o')
print(price)

Buggy submission (verdict: Runtime Error):
S = input()
price = 700 + 100*s.count('o')
print(price)
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())
num = 10*g + b
if num % 4 == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
r, g, b = map(int, input().split())
num = 10*y + z
if num % 4 == 0:
  print("YES")
else:
  print("NO")
Problem p03644 (python)

Fixed submission:
n = int(input())
s = [i for i in range(1,n+1)]
counter = 0
while(True):
    if len(s)==1:
        print(1)
        break
    if len([i for i in s if i % 2 == 0])==1:
        s = [i for i in s if i % 2 == 0]
        print(int(s[0]) * (2 ** counter))
        break
    else:
        s = [i/2 for i in s]
        counter += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [i for i in range(1,n+1)]
counter = 0
while(True):
    if len([i for i in s if i % 2 == 0])==1:
        s = [i for i in s if i % 2 == 0]
        print(int(s[-1] * (2 ** counter)))
        break
    else:
        s = [i/2 for i in s]
        counter += 1
Problem p02999 (python)

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

print('0') if x<a else print('10')

Buggy submission (verdict: Runtime Error):
x,a = map(int,input())

print('0') if x<a else print('10')
Problem p03076 (python)

Fixed submission:
A = [int(input()) for _ in[0]*5]
B = [-(-a//10)*10-a for a in A]

print(sum(A)+sum(B)-max(B))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

S = [a, b, c, d, e]
R = [a%10, b%10, c%10, d%10, e%10]
C = []
for i in R:
  if i > 0:
    C.append(i)
    
min = S[R.index(min(C))]

sum = 0
for i in S:
  sum += -(-i//10)*10
  
print(sum - (-(-min//10)*10) + min)
Problem p03238 (python)

Fixed submission:
N = int(input())

if N ==1:
  print('Hello World')
else:
  print(int(input())+int(input()))

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

if N ==1:
  print('Hello World')
else:
  print(int(input())+int(print()))
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
  print('ABC')
elif 1200 <= R and R < 2800:
  print('ARC')
else:
  print('AGC')

Buggy submission (verdict: Runtime Error):
R = input()
print(R)	

if R < 1200:
  print(ABC)
elif 1200 <= R and R < 2800:
  print(ARC)
else:
  print(AGC)
Problem p03292 (python)

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

print(c - a)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

print(max(abs(a-b), abs(b-c), abs(c-a))
Problem p03547 (python)

Fixed submission:
A,B=input().split()

mydict = {"A":10, "B":11, "C":12, "D":13, "E":14, "F":15}

print('>') if mydict[A] > mydict[B] else print('<') if mydict[A] < mydict[B] else print('=')

Buggy submission (verdict: Runtime Error):
A,B=input().split()

mydict = {"A":11, "B":12, "C":14, "D":13, "E":14, "F":15}

print('>') if mydict(A) > mydict(B) else print('<') if mydict(A) < mydict(B) else print('=')

Buggy submission (verdict: Runtime Error):
A,B=input().split()

mydict = {"A":11, "B":12, "C":14, , "D":13, "E":14, "F":15}

print('>') if mydict(A) > mydict(B) else print('<') if mydict(A) < mydict(B) else print('=')
Problem p03563 (python)

Fixed submission:
r = int(input())
g = int(input())

print(2*g-r)

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

print(2g-r)
Problem p03609 (python)

Fixed submission:
x, t = map(int, (input().split()))
print(x-t if x-t > 0 else 0)

Buggy submission (verdict: Runtime Error):
x,t = map(int,input())

print(x-t) if x > t else print('0')

Buggy submission (verdict: Runtime Error):
x,t = map(int,input())

print(x-t) if x > t else print(0)
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n-1)*(m-1))
Problem p03644 (python)

Fixed submission:
n = int(input())

for i in range(7):
  if n >= 2**i:
    ans = 2**i
print(ans)

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

for i in range(7):
  if n > 2**i:
    ans = 2**i
print(ans)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
r = 0
if s[0] == t[0]:
    r += 1
if s[1] == t[1]:
    r += 1
if s[2] == t[2]:
    r += 1
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n*(n-1)//2)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

a, b, c, d = map(int, input().split())
r = 0
bc = b // c
bd = b // d
bcd = b // lcm(c, d)
ac = -(-a // c)
ad = -(-a // d)
acd = -(-a // lcm(c, d))
print(b - a + 1 - bc + ac - 1 - bd + ad - 1 + bcd - acd + 1)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
r = 0
bc = b // c
bd = b // d
bcd = b // ((c * d) // math.gcd(c, d))
ac = -(-a // c)
ad = -(-a // d)
acd = -(-a // ((c * d) // math.gcd(c, d)))
print(b - a + 1 - bc + ac - 1 - bd + ad - 1 + bcd - acd + 1)
Problem p02760 (python)

Fixed submission:
dic = {}
for i in range(3):
  arr = input().split()
  for j in range(3):
    dic[arr[j]] = (i,j)
    
n = int(input())
appear=[[False for _ in range(3)] for __ in range(3)]

for _ in range(n):
  b = input()
  if b in dic:
    i, j = dic[b]
    appear[i][j] = True

ans = 'No'
for i in range(3):
  if appear[i][0] and appear[i][1] and appear[i][2]:
    ans = 'Yes'
    break
  if appear[0][i] and appear[1][i] and appear[2][i]:
    ans = 'Yes'
    break
if appear[0][0] and appear[1][1] and appear[2][2]:
  ans = 'Yes'
if appear[0][2] and appear[1][1] and appear[2][0]:
  ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):

A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[]
for i in range(N):
    b.append(int(input()))


for i in range(3):
    for j in range(3):
        for x in range(N):
            if A[i][j]==b[x]:
                A[i][j]=0

for i in range(3):
    if A[i][0]==0 and A[i][1]==0 and A[i][2]==0:
        print("Yes")
        break
for i in range(3):
    if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
        print("Yes")
        break
if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
    print("Yes")
    break
if A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0:
    print("Yes")
    break
print("No")
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = [(int(i)+1.0)/2.0 for i in input().split()]
ans = 0
for i in range(k):
    ans += p[i]
tmp1 = ans
for i in range(k, n):
    tmp2 = (tmp1 - p[i-k])+p[i]
    ans = max(ans, tmp2)
    tmp1 = tmp2
print('{:.12f}'.format(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = [(int(i)+1.0)/2.0 for i in input().split()]
ans = 0
tmp = p[:k]
for i in range(k,n):
    tmp += p[i]-p[i-k]
    ans = max(ans, tmp)
print('{:.12f}'.format(ans))
Problem p02802 (python)

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

ac = [0] * n
wa = [0] * n
wa_total = 0
for _ in range(m):
    tmp_i, s = input().split()
    i = int(tmp_i) - 1
    if ac[i] == 1:
        continue
    if s == 'AC':
        ac[i] = 1
        wa_total += wa[i]
    else:
        wa[i] += 1

print(sum(ac), wa_total)

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

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

for _ in range(m):
    tmp_i, s = input().split()
    i = int(tmp_i)
    if result[i][0] == 1:
        continue
    if s == 'AC':
        result[i][0] += 1
    else:
        result[i][1] += 1

print(sum([result[i][0] for i in range(n)]),
      sum([result[i][1] for i in range(n)]))
Problem p02996 (python)

Fixed submission:
n = int(input())
tasks = [list(map(int, input().split())) for i in range(n)]
tasks.sort(key=lambda x: x[1])

time = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
tasks = [list(map(int, input().split())) for i in range(N)]
tasks.sort(key=lambda x: x[1])

time = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print("No")
        exit()
print("Yes")

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

for i in range(n):
  suma=sum(a)
  maxb=max(b)
  if suma<=mxb:
    index=b.index(maxb)
    del a[index]
    del b[index]
  else:
    print('No')
    exit()
print('Yes')

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

for i in range(n):
  suma=sum(a)
  maxb=max(b)
  if suma<=mxb:
    index=b.index(maxb)
    del a[index]
    del b[index]
  else:
    print('No')
    exit()
print('Yes')
Problem p03210 (python)

Fixed submission:
age = int(input())
if age == 7 or age == 5 or age == 3:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
age = int(print())
if age==7 || age==5 || age==3:
  print('YES')
else:
  print('NO')
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
ans=0
min=1000000000
h=list(map(int, input().split()))
for i in range(n):
  b=t-h[i]*0.006
  if min>abs(a-b):
    ans=i+1
    min=abs(a-b)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(lambda x: abs(a-(t-int(x)*0.006)) ,input().split())
print(h.index(min(h))+1)