Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split())


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    if  Y - 10000 * i  == 0:
        a = i
        b = 0
        c = 0
    if  Y - 10000 * i - 5000 * (N - i)>= 0:
        for j in range(N + 1 - i):
            if flag == 1:
                break
                if  Y - 10000 * i - 5000 * j - 1000 *(N - i - j) > =0:
                    for k in range(N + 1 -  i - j):
                        if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                            a = i
                            b = j
                            c = k
                            flag = 1
                            break


print(str(a) +' '+ str(b) +' ' + str(c))


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


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    if  Y - 10000 * i  ==0 and i==N:
        a = i
        b = 0
        c = 0
        flag = 1

    if Y - 10000 * i > 0:
        for j  in range(N+1- i):
                k = N - i -j
                if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                    a = i
                    b = j
                    c   = k
                    flag = 1
                    break


print(str(a) +' '+ str(b) +' '+ str(c))

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


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    if  Y - 10000 * i  == 0:
        a = i
        b = 0
        c = 0
    if  Y - 10000 * i - 5000 * N  >= 0:        
        for j in range(N + 1 - i):
            if flag == 1:
                break
                if  Y - 10000 * i - 5000 * j - 1000 * N > =0:
                    for k in range(N + 1 -  i - j):
                        if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                            a = i
                            b = j
                            c = k
                            flag = 1
                            break


print(str(a) +' '+ str(b) +' ' + str(c))


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


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    if  Y - 10000 * i  ==0 and i==N:
        a = i
        b = 0
        c = 0
        flag = 1

    if Y - 10000 * i > 0:
        for j  in range(N+1- i):
                k = N - i -j
                if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                    a = i
                    b = j
                    c   = k
                    flag = 1
                    break


print(str(a) +' '+ str(b) +' '+ str(c))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

for i in range(n - 1):
    
    if s[i] == 'W':
        w_e[i + 1] = w_e[i] + 1
    else:
        w_e[i + 1] = w_e[i] + 0

for i in range(n - 2, -1, -1):
    if s[i + 1] == 'E':
        e_w[i] = e_w[i + 1] + 1
    else:
        e_w[i] = e_w[i + 1] + 0

for i in range(n):
    ans.append(w_e[i] + e_w[i])

print(min(ans))

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

w_e = [0] * n
e_w = [0] * n
ans = []

for i in range(n - 1):
    if s[i] == 'W':
        w_e[i + 1] = w_e[i] + 1
    else:
        w_e[i + 1] = w_e[i] + 0

for i in range(n - 2, -1, -1): 
    if s[i + 1] == 'E':
        e_w[i] = e_w[i + 1] + 1
    else:
        e_w[i] = e_w[i + 1] + 0

for i in range(n):
    ans.append(w_e[i] + e_w[i])

print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = n
for i in range(n):
    cnt = 0
    for j in range(i):
        if s[j] == "W":
            cnt += 1
    for k in range(i + 1, n):
        if s[k] == "E":
            cnt += 1
    
    ans = min(cnt, ans)

print(ans)

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

w_e = [0] * n
e_w = [0] * n
ans = []

for i in range(n - 1):
    if s[i] == 'W':
        w_e[i + 1] = w_e[i] + 1
    else:
        w_e[i + 1] = w_e[i] + 0

for i in range(n - 2, -1, -1): 
    if s[i + 1] == 'E':
        e_w[i] = e_w[i + 1] + 1
    else:
        e_w[i] = e_w[i + 1] + 0

for i in range(n):
    ans.append(w_e[i] + e_w[i])

print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cntList = []
for i in range(n):
    cnt = 0
    for j in range(i):
        if s[j] == "W":
            cnt += 1
    for k in range(i + 1, n):
        if s[k] == "E":
            cnt += 1

    cntList.append(cnt)

print(min(cntList))

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

w_e = [0] * n
e_w = [0] * n
ans = []

for i in range(n - 1):
    if s[i] == 'W':
        w_e[i + 1] = w_e[i] + 1
    else:
        w_e[i + 1] = w_e[i] + 0

for i in range(n - 2, -1, -1): 
    if s[i + 1] == 'E':
        e_w[i] = e_w[i + 1] + 1
    else:
        e_w[i] = e_w[i + 1] + 0

for i in range(n):
    ans.append(w_e[i] + e_w[i])

print(min(ans))
Buggy python submission (verdict: Runtime Error):
a, b, c, x, y = map(int, input().split())

price = a * x + b * y

if (a + b) // 2 > c:
    if x >= y:
        price = min(2 * x * c, 2 * y * c + (x - y) * a)

    else:
        price = min(2 * x * c + (y - x) * b,  2 * y * c)

print(price)

Fixed submission:
c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = c_1 + c_2 + c_3
if sum(c) == 3 * (c_1[0] + c_2[1] + c_3[2]):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
from collections import deque


def bfs(sy, sx, gy, gx):
    # yが下方向，xが右方向
    d = [[float("inf")] * w for _ in range(h)]

    dy = [0, 1, 0, -1]
    dx = [1, 0, -1, 0]

    que = deque([])
    que.append((sy, sx))
    d[sy][sx] = 0

    while que:

        p = que.popleft()

        if p[0] == gy and p[1] == gx:
            break

        for i in range(4):
            ny = p[0] + dy[i]
            nx = p[1] + dx[i]

            if 0 <= ny < h and 0 <= nx < w and maze[ny][nx] != "#" and d[ny][nx] == float("inf"):
                que.append((ny, nx))
                d[ny][nx] = d[p[0]][p[1]] + 1
 
    if d[gy][gx] == float("inf"):
        return -1
    else:
        return [gy][gx]


h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]

res = 0
for y in range(h):
    for x in range(w):
        if maze[y][x] == '#':
            res += 1

dis = bfs(0, 0, h - 1, w - 1)

if dis == -1:
    print(-1)
else:
    print(h * w - res - dis - 1)


Fixed submission:
from collections import deque


def bfs(sy, sx, gy, gx):
    # yが下方向，xが右方向
    d = [[float("inf")] * w for _ in range(h)]

    dy = [0, 1, 0, -1]
    dx = [1, 0, -1, 0]

    que = deque([])
    que.append((sy, sx))
    d[sy][sx] = 0

    while que:

        p = que.popleft()

        if p[0] == gy and p[1] == gx:
            break

        for i in range(4):
            ny = p[0] + dy[i]
            nx = p[1] + dx[i]

            if 0 <= ny < h and 0 <= nx < w and maze[ny][nx] != "#" and d[ny][nx] == float("inf"):
                que.append((ny, nx))
                d[ny][nx] = d[p[0]][p[1]] + 1

    if d[gy][gx] == float("inf"):
        return -1
    else:
        return d[gy][gx]


h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]

res = 0
for y in range(h):
    for x in range(w):
        if maze[y][x] == '#':
            res += 1

dis = bfs(0, 0, h - 1, w - 1)

if dis == -1:
    print(-1)
else:
    print(h * w - res - dis - 1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1

for i in range(N):
    p = p * (i + 1)

print(p % (10 ** 9 + 7))  # べき乗の書き方

Fixed submission:
N = int(input())
p = 1

for i in range(N):
    p = p * (i + 1)
    p = p % (10 ** 9 + 7)

print(p)  # べき乗の書き方
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 出力
if a * b % 2 = 0:
  print('even')
else:
  print('odd')

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

if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
s = sorted(input())
t = sorted(input())
t_reverse = t[::-1]
if s < t_reverse:
  print('Yes')
else:
  print('No')

Fixed submission:
a, b = map(int, input().split())
c = (a + b) % 2
d = (a + b) // 2

if c == 0:
  print(d)
else:
  print(d+1)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A==B==5 and C==7;
    print("YES")
elif A==C==5 and B==7;
    print("YES")
elif B==C==5 and A==7;
    print("YES")
else;
    print("NO")

Fixed submission:
A,B,C=map(int,input().split())
if A==B==5 and C==7:
    print("YES")
elif A==C==5 and B==7:
    print("YES")
elif B==C==5 and A==7:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A==B==5 and C==7;
    print("YES")
elif A==C==5 and B==7;
    print("YES")
elif B==C==5 and A==7;
    print("YES")
else;
    print("NO")

Fixed submission:
A,B,C=map(int,input().split())
if A==B==5 and C==7:
    print("YES")
elif A==C==5 and B==7:
    print("YES")
elif B==C==5 and A==7:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a = map(int, input())
b = map(int, input())
c = map(int, input())
x = map(int, input())

num = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if 500 * i + 100 * j + 50 * k == x
        num += 1

print(num)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
num = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500 * i + 100 * j + 50 * k == x:
        num += 1
 
print(num)
Buggy python submission (verdict: Runtime Error):
option = int(input())
ref_t, tmp_id = int(input().split())
height = list((int(n) for n in input().split()))

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.06)))

print(ave_t.index(min(ave_t)) + 1)

Fixed submission:
option = int(input())
ref_t, tmp_id = (int(n) for n in input().split())
height = list((int(n) for n in input().split()))

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.006)))

print(ave_t.index(min(ave_t)) + 1)

Buggy python submission (verdict: Runtime Error):
option = int(input())
ref_t, tmp_id = int(input().split())
height = (int(n) for n in input().split())

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.06)))

print(ave_t.index(min(ave_t)) + 1)

Fixed submission:
option = int(input())
ref_t, tmp_id = (int(n) for n in input().split())
height = list((int(n) for n in input().split()))

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.006)))

print(ave_t.index(min(ave_t)) + 1)

Buggy python submission (verdict: Runtime Error):
option = int(input())
ref_t, tmp_id = int(input().split())
height = (int(n) for n in input().split())

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.06)))

print(ave_t.index(min(ave_t)) + 1)

Fixed submission:
option = int(input())
ref_t, tmp_id = (int(n) for n in input().split())
height = list((int(n) for n in input().split()))

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.006)))

print(ave_t.index(min(ave_t)) + 1)
Buggy python submission (verdict: Runtime Error):
price = int(input())

top = price//4
for n in range(top+1):
  for m in range(top+1):
    if 4*n + 7*m == price:
      flag = 1
      break

if flag == 1:
  print('Yes')
else:
  print('No')


Fixed submission:
price = int(input())

flag = 0
top = price//4 + 1
for n in range(top+1):
  for m in range(top+1):
    if 4*n + 7*m == price:
      flag = 1
      break

if flag == 1:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
price = int(input())

top = price//4
for n in range(top):
  for m in range(top):
    if 4*n + 7*m == price:
      flag = 1
      break

if flag == 1:
  print('Yes')
else:
  print('No')


Fixed submission:
price = int(input())

flag = 0
top = price//4 + 1
for n in range(top+1):
  for m in range(top+1):
    if 4*n + 7*m == price:
      flag = 1
      break

if flag == 1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  elif item > num_max:
    num_max = item
  else:
    
print(num_max - num_min)

Fixed submission:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  if item > num_max:
    num_max = item

print(num_max - num_min)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  elif item > num_max:
    num_max = item
  else:

print(num_max - num_min)

Fixed submission:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  if item > num_max:
    num_max = item

print(num_max - num_min)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  else item > num_max:
    num_max = item

print(num_max - num_min)

Fixed submission:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  if item > num_max:
    num_max = item

print(num_max - num_min)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())

m = []
for i in range(N):
  m.append(int(input()))
  
m.sort()
i = 0
total = 0
while total<=X:
  total += m[i]
  i += 1
  
print(i)

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

m = []
for i in range(N):
  m.append(int(input()))

total = N
remain = X - sum(m)
total += remain//min(m)

print(total)

Buggy python submission (verdict: Runtime Error):
N, X = input().split()

m = []
for i in range(int(N)):
  m.append(input())
  
m.sort()
i = 0
while total<=int(X):
  total += m[i]
  i += 1
  
print(i)

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

m = []
for i in range(N):
  m.append(int(input()))

total = N
remain = X - sum(m)
total += remain//min(m)

print(total)

Buggy python submission (verdict: Runtime Error):
N, X = input().split()
m = []
for i in range(int(N)):
  m.append(int(input()))
  
m.sort()
i = 0
while total<int(X):
  total += m[0]
  i += 1
  
print(i)

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

m = []
for i in range(N):
  m.append(int(input()))

total = N
remain = X - sum(m)
total += remain//min(m)

print(total)
Buggy python submission (verdict: Runtime Error):
a, b = map(float, input().split())

ave = (a + b)/ 2

print(math.ceil(ave))

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

ave = (a + b) / 2  # float
if ave - int(ave) > 0:
  print(int(ave)+1)
else:
  print(int(ave))
Buggy python submission (verdict: Runtime Error):
letters = list(input().split())
new_letters = []

for i, item in enumerate(letters, 1)
  if i % 2 != 0:
    new_letters.append(item)
print(''.join(new_letters))

Fixed submission:
letters = list(input())
new_letters = []

for i, ltr in enumerate(letters, 1):
  if i % 2 == 1:
    new_letters.append(ltr)

print(''.join(new_letters))

Buggy python submission (verdict: Runtime Error):
letters = list(input().split())
new_letters = []

for i, item in enumerate(letters, 1)
  if i % 2 != 0
    new_letters.append(item)
print(''.join(new_letters))

Fixed submission:
letters = list(input())
new_letters = []

for i, ltr in enumerate(letters, 1):
  if i % 2 == 1:
    new_letters.append(ltr)

print(''.join(new_letters))
Buggy python submission (verdict: Runtime Error):
num = int(input())

count_max = 0
for i in range(num):
  tmp = i + 1
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count > count_max:
    count_max = count
    num_max = i + 1

print(num_max)

Fixed submission:
num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)

Buggy python submission (verdict: Runtime Error):
num = int(input())

count_max = 0
for i in range(num):
  tmp = i + 1
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count > count_max:
    count_max = count
    num_max = i + 1

print(num_max)

Fixed submission:
num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

count_max = 0
for i in range(num):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if conut > count_max:
    count_max = count


Fixed submission:
num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)

Buggy python submission (verdict: Runtime Error):
num = int(input())

count_max = 0
for i in range(num)
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if conut > count_max:
    count_max = count


Fixed submission:
num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)
Buggy python submission (verdict: Runtime Error):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
      if pos_z - (pos_a -1) > length:
        length = pos_z - (pos_a -1)
      else:
        flag = 0

print(length)

Fixed submission:
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Buggy python submission (verdict: Runtime Error):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1)
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
      pos_z = i
      if pos_z - pos_a > length:
        length = pos_z - pos_a
      else:
        flag = 0

print(length)

Fixed submission:
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Buggy python submission (verdict: Runtime Error):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1)
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z':
    if flag == 1:
      pos_z = i
      if pos_z - pos_a > length:
        length = pos_z - pos_a
      else:
        flag = 0
        
print(length)

Fixed submission:
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Buggy python submission (verdict: Runtime Error):
s = list(input())

flag = 0
pos_a, pos_z = 1
length = 0

for i, ltr in enumerate(s, 1)
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z':
    if flag == 1:
      pos_z = i
      if pos_z - pos_a > length:
        length = pos_z - pos_a
      else:
        flag = 0
        
print(length)

Fixed submission:
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)
Buggy python submission (verdict: Runtime Error):
N=int(input())
tmp=input().split()
T=int(tmp[0])
A=int(tmp[1])
H=input().split()
H=[abs(A-(T-0.006*int(H[i]))) for i in range(0,N)]
min=H[0]
for i in range(1,N):
    if min>H[i]:
        min=H[i]
        index=i
print(index)

Fixed submission:
N=int(input())
tmp=input().split()
T=int(tmp[0])
A=int(tmp[1])
H=input().split()
H=[abs(A-(T-0.006*int(H[i]))) for i in range(0,N)]
min=H[0]
index=0
for i in range(1,N):
    if min>H[i]:
        min=H[i]
        index=i
print(index+1)
Buggy python submission (verdict: Runtime Error):
S=input().split()
cnt=0
for i in range(0,3):
	if S[i]=="o":
		cnt+=1
print(700+100*cnt)

Fixed submission:
S=input()
cnt=0
for i in range(0,3):
	if S[i]=="o":
		cnt+=1
print(700+100*cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
for i in range(0,N):
    t1=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t2=txy[i+1][0]-txy[i][0]
    if t1 <= t2 and (t2-t1)%2=0:
    else:
        print('NG')
        break
print('OK')

Fixed submission:
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t=txy[i+1][0]-txy[i][0]
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
  num = int(input())
  if num in A:
    A.remove(num)
  else:
    A.append(num)
print(len(A))

Fixed submission:
N = int(input())
A = [input() for i in range(N)]
dic={}
for a in A:
  if a not in dic:
    dic[a] = 1
  elif dic[a] != 1:
    dic[a] = 1
  else:
    dic[a] = 0
print(list(dic.values()).count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
  num = int(input())
  if num in A:
    A.remove(num)
  else:
    A.append(num)
print(len(A))

Fixed submission:
N = int(input())
A = [input() for i in range(N)]
dic={}
for a in A:
  if a not in dic:
    dic[a] = 1
  elif dic[a] != 1:
    dic[a] = 1
  else:
    dic[a] = 0
print(list(dic.values()).count(1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 1
i = -1
flg = True
while True:
  i += 1
  if i >= n-1:
    break
  if a[i] < a[i+1]:
    flg = True
  elif a[i] > a[i+1]:
    flg = False
  else:
    continue
  for k in range(i, n-1):
    if (flg and a[k] > a[k+1]) or ((not flg) and a[k] < a[k+1]):
      cnt += 1
      i = k
      break
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 1
b = [0] + a
c = [(i-j)//abs(i-j) for i, j in zip(a, b) if i != j]
del c[0]
if c:
  mae=c[0]
  d=iter(c)
  for x in d:
    if x != mae:
      cnt += 1
      try:
        mae = d.__next__()
      except StopIteration:
        break
print(cnt)