Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
read = input
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
    
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
def dfs(f, s, fa=-1):
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        dfs(t, w + s, f)
dfs(1,0)
for i in used[1:]:
    print(used[i])

Fixed submission:
read = input
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
# def dfs(f, s, fa=-1):
#     if s % 2 == 0: 
#         used[f] = 1
#     for t, w in v[f]:
# #         print('%d->%d->%d'%(fa, f, t,), s, w)
#         if t == fa:continue
#         dfs(t, w + s, f)
from queue import Queue
q = Queue()
#def dfs(f, s, fa=-1):
#    if s % 2 == 0: 
#        used[f] = 1
#    for t, w in v[f]:
##         print('%d->%d->%d'%(fa, f, t,), s, w)
#        if t == fa:continue
#        dfs(t, w + s, f)
#
#
#dfs(1,0)
q.put_nowait((1, 0, -1))
while not q.empty():
    f, s, fa = q.get_nowait()
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        q.put_nowait(
            (t, w + s, f)
        )
    
for i in used[1:]:
    print(used[i])

Buggy python submission (verdict: Runtime Error):
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
    
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
def dfs(f, s, fa=-1):
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        dfs(t, w + s, f)
dfs(1,0)
for i in used[1:]:
    print(used[i])

Fixed submission:
read = input
n = int(read())
v = [[] for i in range(n+1)] # 邻接
used = [0 for i in range(n+1)] # 节点 1~n
def add(f,t,w):
    v[f].append((t, w))
for i in range(n-1):
    f,t,w = map(int, read().split())
    add(f,t,w)
    add(t,f,w)
# 从1出发，贪心即可，1画1，理论不会有回环
# def dfs(f, s, fa=-1):
#     if s % 2 == 0: 
#         used[f] = 1
#     for t, w in v[f]:
# #         print('%d->%d->%d'%(fa, f, t,), s, w)
#         if t == fa:continue
#         dfs(t, w + s, f)
from queue import Queue
q = Queue()
#def dfs(f, s, fa=-1):
#    if s % 2 == 0: 
#        used[f] = 1
#    for t, w in v[f]:
##         print('%d->%d->%d'%(fa, f, t,), s, w)
#        if t == fa:continue
#        dfs(t, w + s, f)
#
#
#dfs(1,0)
q.put_nowait((1, 0, -1))
while not q.empty():
    f, s, fa = q.get_nowait()
    if s % 2 == 0: 
        used[f] = 1
    for t, w in v[f]:
#         print('%d->%d->%d'%(fa, f, t,), s, w)
        if t == fa:continue
        q.put_nowait(
            (t, w + s, f)
        )
    
for i in used[1:]:
    print(used[i])
Buggy python submission (verdict: Runtime Error):
input = read
rn = lambda :map(int, read().split())
m,k = rn()
import math
N = 2**(m) - 1 # 0~N
r = [i for i in range(N+1)] # 0~N
if k > N:
    print(-1)
# elif N == 1 and k == 0:
#     print(0, 0)
elif k ==  0:
    for i in r:
        print(i, end=' ')
    r.reverse()
    for i in r:
        print(i, end=' ')
elif N == 2 and k == 1:
    print(-1)
else:
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
    r.reverse()
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
    

Fixed submission:
read = input 
rn = lambda :map(int, read().split())
m,k = rn()
import math
N = 2**(m) - 1 # 0~N
r = [i for i in range(N+1)] # 0~N
if k > N:
    print(-1)
# elif N == 1 and k == 0:
#     print(0, 0)
elif N == 1 and k == 1:
    print('-1')
elif k ==  0:
    for i in r:
        print(i, end=' ')
    r.reverse()
    for i in r:
        print(i, end=' ')
elif N == 2 and k == 1:
    print(-1)
else:
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
    r.reverse()
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')

Buggy python submission (verdict: Runtime Error):
input 
rn = lambda :map(int, read().split())
m,k = rn()
import math
N = 2**(m) - 1
r = [i for i in range(N+1)]
if k >= N:
    print(-1)
elif k ==  0:
    for i in r:
        print(i, end=' ')
    r.reverse()
    for i in r:
        print(i, end=' ')
elif N == 2 and k == 1:
    print(-1)
else:
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
    r.reverse()
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')

Fixed submission:
read = input 
rn = lambda :map(int, read().split())
m,k = rn()
import math
N = 2**(m) - 1 # 0~N
r = [i for i in range(N+1)] # 0~N
if k > N:
    print(-1)
# elif N == 1 and k == 0:
#     print(0, 0)
elif N == 1 and k == 1:
    print('-1')
elif k ==  0:
    for i in r:
        print(i, end=' ')
    r.reverse()
    for i in r:
        print(i, end=' ')
elif N == 2 and k == 1:
    print(-1)
else:
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
    r.reverse()
    for i in r:
        if i == k:continue
        print(i, end=' ')
    print(k, end=' ')
Buggy python submission (verdict: Runtime Error):
# read = input
n = int(read())
s = read()
SW = [0 for i in range(n)]
SB = [0 for i in range(n)]
for i,c in enumerate(s):
    if i == 0:
        SW[i] = 1 if c == '.' else 0
        SB[i] = 1 if c == '#' else 0
    else :
        SW[i] = SW[i-1] + 1 if c == '.' else SW[i-1]
        SB[i] = SB[i-1] + 1 if c == '#' else SB[i-1]
cost = n
for i in range(n):
    pass
#     print(i, SW[i], SB[i])
for i in range(n + 1):
    startW = 0
    endW = i # left W is [0,i)
    startB = i 
    endB = n # right B is [i, n)
#     print(i)
    if i == 0: # all B 
        cost = min(cost, n - SW[n-1])
    elif i == n: # all W
        cost = min(cost, n - SB[n-1])
    else:
        cost = min(cost, 
                   i - SB[i-1] + (n-i) - (SB[n-1] - SB[i-1])
                  )
print(cost)
    

Fixed submission:
read = input
n = int(read())
s = read()
SW = [0 for i in range(n)]
SB = [0 for i in range(n)]
for i,c in enumerate(s):
    if i == 0:
        SW[i] = 1 if c == '.' else 0
        SB[i] = 1 if c == '#' else 0
    else :
        SW[i] = SW[i-1] + 1 if c == '.' else SW[i-1]
        SB[i] = SB[i-1] + 1 if c == '#' else SB[i-1]
cost = n
for i in range(n):
    pass
#     print(i, SW[i], SB[i])
for i in range(n + 1):
    startW = 0
    endW = i # left W is [0,i)
    startB = i 
    endB = n # right B is [i, n)
#     print(i)
    if i == 0: # all B 
        cost = min(cost, SW[n-1])
    elif i == n: # all W
        cost = min(cost, SB[n-1])
    else:
        cost = min(cost, 
                   SB[i-1] + (SW[n-1] - SW[i-1])
                  )
#     print(i, cost)
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
read = input
n,k = map(int, read().split())
a = read()
a = '1' + a + '1'
# -1 if use 0, -1 if use len(a) -1
pstart = 0
pcnt = 0
ptype = '1'
b = []
# (start, end, cnt)
for tp in enumerate(a):
    i, c = tp
    if ptype == c:
        pcnt = pcnt + 1
    else :
        b.append((pstart, i-1, pcnt))
        pstart = i
        ptype = c
        pcnt = 1
b.append((pstart, i, pcnt))
# print(b)
if k >= len(b)//2:
    print(sum(map(lambda tp:tp[2], b)) - 2)
else :
    start = 0
    end = k * 2
    ans = 0
    while(end <= len(b) - 1):
        tmp = sum(map(lambda tp:tp[2], b[start:(end+1)]))
        if b[start][0] == 0:
            tmp = tmp - 1
        if b[end][1] == len(a)-1:
            tmp = tmp -1
#         print(start, end ,tmp)
        ans = max(ans, tmp)
        start = start + 2
        end = end + 2
    print(ans)

Fixed submission:
read = input
n,k = map(int, read().split())
a = read()
a = '1' + a + '1'
# -1 if use 0, -1 if use len(a) -1
pstart = 0
pcnt = 0
ptype = '1'
b = []
# (start, end, cnt)
for tp in enumerate(a):
    i, c = tp
    if ptype == c:
        pcnt = pcnt + 1
    else :
        b.append((pstart, i-1, pcnt))
        pstart = i
        ptype = c
        pcnt = 1
b.append((pstart, i, pcnt))
# print(b)
if k >= len(b)//2:
    print(sum(map(lambda tp:tp[2], b)) - 2)
else :
    start = 0
    end = k * 2
    ans = 0
    S = [0 for i in range(len(b)+10)]
    S[0] = b[0][2]
    for i in range(1, len(b)):
        S[i] = S[i-1] + b[i][2]
    while(end <= len(b) - 1):
        tmp = S[end] - (S[start - 1] if start - 1>=0 else 0)
        if b[start][0] == 0:
            tmp = tmp - 1
        if b[end][1] == len(a)-1:
            tmp = tmp -1
#         print(start, end ,tmp)
        ans = max(ans, tmp)
        start = start + 2
        end = end + 2
    print(ans)
Buggy python submission (verdict: Runtime Error):
read = input
a = [read() for i in range(5)]
a = list(map(int, a))
if all(map(lambda x: x%10 == 0, a)):
    print(sum(a))
else :
    g10 = list(filter(lambda x:x%10 > 0 , a))
    l10 = list(filter(lambda x:x%10 == 0 , a))
    m = min(g10, key=lambda x:x%10)
    g100= list(map(lambda x:x//10*10 + 10, g10))
    print(sum([*g100  ,*l10 ,- m//10*10 + m]))
    

Fixed submission:
read = input
a = [read() for i in range(5)]
a = list(map(int, a))
if all(map(lambda x: x%10 == 0, a)):
    print(sum(a))
else :
    g10 = list(filter(lambda x:x%10 > 0 , a))
    l10 = list(filter(lambda x:x%10 == 0 , a))
    m = min(g10, key=lambda x:x%10)
    g100= list(map(lambda x:x//10*10 + 10, g10))
    print(sum(g100)  +sum(l10)- m//10*10 - 10 + m)
Buggy python submission (verdict: Runtime Error):
read = input
read = Read(False, """


8 1000 800 100
300
333
400
444
500
555
600
666

""").read
tmp = read()
tmp = list(map(int, tmp.split(' ')))
N,A,B,C = tmp
opt = list(map(int, map(lambda x: read(), range(N))))
def dfs(n,a,b,c):
    ret = 10**7
    if(n == N):
        if(min(a,b,c) == 0):
            return ret
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    cur = opt[n]
    ret = min(ret, dfs(n+1, a + cur, b, c) + 10)
    ret = min(ret, dfs(n+1, a, b + cur, c) + 10)
    ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)
    ret = min(ret, dfs(n+1, a, b ,c ) + 0)
    return ret
print(dfs(0, 0, 0, 0))

Fixed submission:
read = input
# read = Read(False, """


# 8 1000 800 100
# 300
# 333
# 400
# 444
# 500
# 555
# 600
# 666

# """).read
tmp = read()
tmp = list(map(int, tmp.split(' ')))
N,A,B,C = tmp
opt = list(map(int, map(lambda x: read(), range(N))))
def dfs(n,a,b,c):
    ret = 10**7
    if(n == N):
        if(min(a,b,c) == 0):
            return ret
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    cur = opt[n]
    ret = min(ret, dfs(n+1, a + cur, b, c) + 10)
    ret = min(ret, dfs(n+1, a, b + cur, c) + 10)
    ret = min(ret, dfs(n+1, a, b ,c + cur) + 10)
    ret = min(ret, dfs(n+1, a, b ,c ) + 0)
    return ret
print(dfs(0, 0, 0, 0))
Buggy python submission (verdict: Runtime Error):
a, b, c =list(map(int, input().split()))

if a = b:
  if a = c:
    print("No")
  else:
    print("Yes")
else:
  if a = c:
    print("Yes")
  else:
    print("No")

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

if a == b:
  if a == c:
    print("No")
  else:
    print("Yes")
else:
  if a == c:
    print("Yes")
  else:
    if b == c:
      print("Yes")
    else:
      print("No")
Buggy python submission (verdict: Runtime Error):
cnt = int(input())
tar_list = list(map(int, input().split()))
flg = False
for i in range(cnt):

  if tar_list[i] % 2 == 0:
    if tar_list[i] % 3 == 0 or if tar_list[i] % 5 == 0:
    else:
      flg = True
      print("DENIED")
      break
      
if flg == False:
  print("APPROVED")

Fixed submission:
cnt = int(input())
tar_list = list(map(int, input().split()))
flg = False
for i in range(cnt):

  if tar_list[i] % 2 == 0:
    if tar_list[i] % 3 == 0 or tar_list[i] % 5 == 0:
      flg = False
    else:
      flg = True
      print("DENIED")
      break
      
if flg == False:
  print("APPROVED")
Buggy python submission (verdict: Runtime Error):
str1, str2 = input().split()
cnt1, cnt2 = list(map(int, input().split()))
tar = input()

if tar == str1:
  cnt1 -= 1
else
  cnt2 -= 1

print(str(cnt1) + " " + str(cnt2))

Fixed submission:
str1, str2 = input().split()
cnt1, cnt2 = list(map(int, input().split()))
tar = input()

if tar == str1:
  cnt1 -= 1
else:
  cnt2 -= 1

print(str(cnt1) + " " + str(cnt2))
Buggy python submission (verdict: Runtime Error):
a,b,c=(int(x) for x in input().split())
s = list(map(int, input().split()))
t = 0
for x in s:
  t += x
l = a + 1
chk = l * c
chk -= t
if chk > b:
  print(-1)
elseif chk < 0:
  print(0)
else:
  print(chk)

Fixed submission:
s = input()
print(chr(ord(s[0]) + 1))

Buggy python submission (verdict: Runtime Error):
s = input()
print chr(ord(s[0]) + 1)

Fixed submission:
s = input()
print(chr(ord(s[0]) + 1))

Buggy python submission (verdict: Runtime Error):
s = input()
print chr(ord(s) + 1)

Fixed submission:
s = input()
print(chr(ord(s[0]) + 1))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if list[c-1] == 0:
      list[c-1] = 1
      t_cnt += 1
  else:
    if list[c-1] == 0:
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))


Fixed submission:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(a):
  if list[i] ==0:
    f_cnt[i] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if list[c] == 0:
      list[c] = 1
      t_cnt += 1
  else:
    if list[c] == 0:
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Fixed submission:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(a):
  if list[i] ==0:
    f_cnt[i] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))

Buggy python submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
list = []
t_cnt = 0
f_cnt = 0
for i in range(b):
  s = input().split()
  if s[1] == 'AC':
    if not (s[0] in list):
    	list.append(s[0])
        t_cnt += 1
  else:
    if not (s[0] in list):
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Fixed submission:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(a):
  if list[i] ==0:
    f_cnt[i] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))
Buggy python submission (verdict: Runtime Error):
tar, max = map(int, input().sprit())
if max <= tar * 500:
  print('Yes')
else:
  print('No')


Fixed submission:
tar, max = map(int, input().split())
if max <= tar*500:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
tar, max = map(int, input(),sprit())
if max <= tar * 500:
  print('Yes')
else:
  print('No')

Fixed submission:
tar, max = map(int, input().split())
if max <= tar*500:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1_index > array2_index:
  print(array1_index-array2_index)
else:
  print(array2_index-array1_index)ar

Fixed submission:
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1_index > array2_index:
  print(array1_index-array2_index)
else:
  print(array2_index-array1_index)

Buggy python submission (verdict: Runtime Error):
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1 > array2:
  print(array1-array2)
else:
  print(array2-array1)


Fixed submission:
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1_index > array2_index:
  print(array1_index-array2_index)
else:
  print(array2_index-array1_index)

Buggy python submission (verdict: Runtime Error):
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(num)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1 > array2:
  print(array1-array2)
else:
  print(array2-array1)

Fixed submission:
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1_index > array2_index:
  print(array1_index-array2_index)
else:
  print(array2_index-array1_index)

Buggy python submission (verdict: Runtime Error):
import itertools
num = int(input())
array1 = list(map(int, input().split()))
array2 = list(map(int, input().split()))
all_list = list(itertools.permutations(range(num)))

array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1

if array1 > array2:
  print(array1-array2)
else:
  print(array2-array1)

Fixed submission:
import itertools
num = int(input())
array1 = tuple(map(int, input().split()))
array2 = tuple(map(int, input().split()))
all_list = list(itertools.permutations(range(1, num + 1)))
 
array1_index = all_list.index(array1) + 1
array2_index = all_list.index(array2) + 1
 
if array1_index > array2_index:
  print(array1_index-array2_index)
else:
  print(array2_index-array1_index)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools
import sys
input = sys.stdin.readline


def func(i):
    ans = list()
    for a in itertools.combinations(i, 2):
        ans.append(
            [(a[0] + a[1]) / 2] + [j for j in i if j not in [a[0], a[1]]])

    return ans


def judge(v):
    for i in v:
        if len(i) != 1:
            return False

    return True


def main():
    n = int(input())
    v = list()

    for i in map(int, input().split()):
        v.append(i)

    v = [v]

    while True:
        for i in v:
            if len(i) != 1:
                v.remove(i)
                new = func(i)
                # 新たにできた具材のセットを足す
                v += new

        if judge(v):
            break

    print(max(v)[0])


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    v = list()

    for i in map(int, input().split()):
        v.append(i)

    v.sort()

    ans = v[0]
    for i in range(1, n):
        ans = (ans + v[i]) / 2

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = str(input()).replace("\n", "")

    count = 0
    for i in range(len(n), 0, -1):
        if i % 2 != 0:
            if i == len(n):
                count += int(n[1:]) + 1
            else:
                s = str(i) + "0"
                count += int(s) - 1

    print(count)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = int(input())

    l = [str(i) for i in range(1, n + 1)]
    count = 0
    for i in l:
        if len(i) % 2 == 1:
            count += 1

    print(count)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = sys.maxint
    for i in range(1, n):
        ans = min(ans, abs(2 * sum(a[:i]) - SUM))

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = list()
    left = a[0]
    for i in range(1, n):
        ans.append(abs(2 * left - SUM))
        left += a[i]

    print(min(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = list()
    for i in range(1, n):
        ans.append(abs(2 * sum(a[:i]) - SUM))

    print(min(ans))


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = list()
    left = a[0]
    for i in range(1, n):
        ans.append(abs(2 * left - SUM))
        left += a[i]

    print(min(ans))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split(' '))
if x==w/2 and y==h/2:
    print(str(w*h/2)+" "+ 1)
else:
    print(str(w*h/2)+" "+ 0)

Fixed submission:
w,h,x,y=map(int,input().split(' '))
if x==w/2 and y==h/2:
    print(str(w*h/2)+" "+ "1")
else:
    print(str(w*h/2)+" "+ "0")
Buggy python submission (verdict: Runtime Error):
a,p=map(int,input().split(' '))
print(int((3*a+p)/2)

Fixed submission:
a,p=map(int,input().split(' '))
print(int((3*a+p)/2))