Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#prepare
L = []
Q = []

#input
W, H, N, = map(int,raw_input().split())
for i in range(N):
    L.append(map(int,raw_input().split()))
x1=0
x2=W
y1=0
y2=H

#calculate
Q = [row[2] for row in L]


for k in range(N):
    if Q[k] == 1:
        x1 = max(x1,L[k][0])
    elif Q[k] == 2:
        x2 = min(x2,L[k][0])
    elif Q[k] == 3:
        y1 = max(y1,L[k][1])
    elif Q[k] == 4:
        y2 = min(y2,L[k][1])

print(max(0,x2-x1) * max(0,y2-y1))

Fixed submission:
W, H, N = map(int, input().split())
array = [list(map(int, input().split())) for i in range(N)]

xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):

    if array[i][2] == 1:
        xmin = max(xmin, array[i][0])
    elif array[i][2] == 2:
        xmax = min(xmax, array[i][0])
    elif array[i][2] == 3:
        ymin = max(ymin, array[i][1])
    elif array[i][2] == 4:
        ymax = min(ymax, array[i][1])
area = (xmax-xmin)*(ymax-ymin)
if area <= 0 or xmax < xmin or ymax < ymin:
    print(0)
else:
    print(area)

Buggy python submission (verdict: Runtime Error):
#prepare
L = []
Q = []

#input
W, H, N, = map(int,raw_input().split())
for i in range(N):
    L.append(map(int,raw_input().split()))
x1=0
x2=W
y1=0
y2=H

#calculate
Q = [row[2] for row in L]


for k in range(N):
    if Q[k] == 1:
        x1 = max(x1,L[k][0])
    elif Q[k] == 2:
        x2 = min(x2,L[k][0])
    elif Q[k] == 3:
        y1 = max(y1,L[k][1])
    elif Q[k] == 4:
        y2 = min(y2,L[k][1])

print max(0,x2-x1) * max(0,y2-y1)

Fixed submission:
W, H, N = map(int, input().split())
array = [list(map(int, input().split())) for i in range(N)]

xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):

    if array[i][2] == 1:
        xmin = max(xmin, array[i][0])
    elif array[i][2] == 2:
        xmax = min(xmax, array[i][0])
    elif array[i][2] == 3:
        ymin = max(ymin, array[i][1])
    elif array[i][2] == 4:
        ymax = min(ymax, array[i][1])
area = (xmax-xmin)*(ymax-ymin)
if area <= 0 or xmax < xmin or ymax < ymin:
    print(0)
else:
    print(area)
Buggy python submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    result = 0
    if W < x_min or H < y_min:
        W - x_min == 0
        break

    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
print((W - x_min)*(H - y_min))

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

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    result = 0
    if W < x_min or H < y_min:
        W - x_min == 0
        continue

    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
print((W - x_min)*(H - y_min))

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

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N, T= list(map(int, input().split()))
A = [int(x) for x in input().strip().split()]

result = 0
diff = 0
for i in range(N - 1):
    counter = 0
    if max(A[i+1:]) - A[i] < 0:
        continue
    elif max(A[i+1:]) - A[i] > diff:
        diff = max(A[i+1:]) - A[i]
        result += 1
    counter += 1

print(result)

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

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > w or y_min > H:
    print('0')
else:
    print('(W - x_min)*(H - y_min)')

Fixed submission:
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > W or y_min > H:
    print('0')
else:
    print((W - x_min)*(H - y_min))

Buggy python submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > w or y_min > H:
    print('0')
else:
    print((W - x_min)*(H - y_min))

Fixed submission:
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > W or y_min > H:
    print('0')
else:
    print((W - x_min)*(H - y_min))
Buggy python submission (verdict: Runtime Error):
s = map(int, list(raw_input()))
sum = 0
for i in xrange(0, int(1 << len(s)-1)):
    temp_num = 0
    for j in xrange(0, len(s)):
        cur_num = s[j]
        if i % 2 == 1:
            temp_num += cur_num
            if j != len(s) - 1:
                sum += temp_num
                temp_num = 0
        else:
            temp_num += cur_num
        i /= 2
        if j == len(s) - 1:
            sum += temp_num
            temp_num = 0
        temp_num *= 10
print sum

# renketsu wo riyou sita kaihou ga kirei datta node
def sum(total, s):
    r = 0
    for i in range(len(s)):
        if i == 0:
            r = total + int(s)
        else:
            r += sum(total + int(s[:i]), s[i:])
    return r


s = raw_input()
total = 0

print sum(total, s)

Fixed submission:
s = map(int, list(raw_input()))
sum = 0
for i in xrange(0, int(1 << len(s) - 1)):
    temp_num = 0
    for j in xrange(0, len(s)):
        cur_num = s[j]
        if i % 2 == 1:
            temp_num += cur_num
            if j != len(s) - 1:
                sum += temp_num
                temp_num = 0
        else:
            temp_num += cur_num
        i /= 2
        if j == len(s) - 1:
            sum += temp_num
            temp_num = 0
        temp_num *= 10
print sum


def sum(total, s):
    r = 0
    for i in range(len(s)):
        if i == 0:
            r = total + int(s)
        else:
            r += sum(total + int(s[:i]), s[i:])
    return r
Buggy python submission (verdict: Runtime Error):
i = list(map(lambda x:int(x),list(input().split(' ')))).sort()
if i[0] is i[1]+i[2]:
  print('Yes')
else:
  print('No')

Fixed submission:
i = sorted(list(map(lambda x:int(x),list(input().split(' ')))))
if i[2] == i[1]+i[0]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
i = list(input().split(' ')).map(lambda x:int(x)
x,y,z = i
a =x+y+z
if a%3 is 0:


Fixed submission:
i = sorted(list(map(lambda x:int(x),list(input().split(' ')))))
if i[2] == i[1]+i[0]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
# coding: UTF8

#input = "10 49 30"
l = map(int, input().split())
# l = map(int, input.split())
l.sort()
a = l[0]
b = l[1]
c = l[2]

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

Fixed submission:
# coding: UTF8

#input = "10 40 30"
#l = map(int, input.split())
l = list(map(int, input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]

if a + b == c:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
S = list(raw_input())

if len(set(S)) == 1:
    print 0
else:
    count = 0
    while len(set(S)) > 1:
        if S[-1] == 'W':
            added = 'B'
        else:
            added = 'W'
        S += added
        count += 1

        i = -2
        while S[i] != added:
            if S[i] == 'W':
                S[i] = 'B'
            else:
                S[i] = 'W'
            i -= 1
        # break
    print count


Fixed submission:
S = list(raw_input())

if len(set(S)) == 1:
    print 0
else:
    while S[-1] == S[-2]:
        del S[-1]
    del S[-1]

    count = 1
    for i in xrange(len(S)-1):
        if S[i] != S[i+1]:
            count += 1
    print count
Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, raw_input().split())
A_n = map(int, raw_input().split())

max_profit = A_n[1] - A_n[0]
min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
    if A_n[i] < min_element:
        min_element = A_n[i]

count = 0
for j in xrange(0, len(A_n)):
    if (A_n[j] + max_profit) in A_n[j:]:
        count += 1

print count


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

count = 0
max_profit = A_n[1] - A_n[0]
min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
        count = 0

    if A_n[i] - min_element == max_profit:
        count += 1

    if A_n[i] < min_element:
        min_element = A_n[i]

print count

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

min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
    if A_n[i] < min_element:
        min_element = A_n[i]

count = 0
for j in xrange(0, len(A_n)):
    if (A_n[j] + max_profit) in A_n[j:]:
        count += 1

print count


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

count = 0
max_profit = A_n[1] - A_n[0]
min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
        count = 0

    if A_n[i] - min_element == max_profit:
        count += 1

    if A_n[i] < min_element:
        min_element = A_n[i]

print count

Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, raw_input().split())
A_n = map(int, raw_input().split())

max_profit = 0
cost = 0
for i in xrange(len(A_n)):
    for j in xrange(i, len(A_n)):
        if A_n[j]-A_n[i] > max_profit:
            max_profit = A_n[j]-A_n[i]

for i in xrange(len(A_n)):
    for j in xrange(i, len(A_n)):
        if A_n[j]-A_n[i] == max_profit:
            cost += 1

print cost

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

count = 0
max_profit = A_n[1] - A_n[0]
min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
        count = 0

    if A_n[i] - min_element == max_profit:
        count += 1

    if A_n[i] < min_element:
        min_element = A_n[i]

print count
Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

benefit = -1
cost = 1

for i in range(N - 1):
    for j in range(i + 1, N):
        if benefit == A[j] - A[i]:
            cost += 1
        if benefit < A[j] - A[i]:
            cost = 1
            benefit = A[j] - A[i]

print(cost)

Fixed submission:
L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

ans_W = max(0, (max_x - min_x))
ans_H = max(0, (max_y - min_y))

print(ans_W * ans_H)


Fixed submission:
L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

print(max(0, (max_x - min_x)) * max(0, (max_y - min_y)))

Fixed submission:
L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, min(max_x, x))
    if a == 2:
        max_x = min(max_x, max(min_x, x))
    if a == 3:
        min_y = max(min_y, min(max_y, y))
    if a == 4:
        max_y = min(max_y, max(min_y, y))

print((max_x - min_x) * (max_y - min_y))


Fixed submission:
L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

benefit = -1
cost = 1

for i in range(N - 1):
    for j in range(i + 1, N):
        if benefit == A[j] - A[i]:
            cost += 1
        if benefit < A[j] - A[i]:
            cost = 1
            benefit = A[j] - A[i]

print(cost)

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

minA = A[0]
benefit = 0
maxBenefit = 0
cost = 0

for i in range(N):
    if A[i] < minA:
        minA = A[i]
    else:
        benefit = A[i] - minA
        if benefit > maxBenefit:
            maxBenefit = benefit
            cost = 1
        elif benefit == maxBenefit:
            cost += 1

print(cost)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
cnt = 0
last
last = s[0]

for c in s[1:end]:
 if c ! last
  cnt = cnt+1
 last = c
print cnt

Fixed submission:

s = raw_input()
cnt = 0
last = s[0]
 
for c in s[1:]:
    if c != last:
        cnt = cnt+1
    last = c
print cnt
Buggy python submission (verdict: Runtime Error):
## this submission is just for checking pypy3 performance
## the code is borrowed from http://code-festival-2016-quala.contest.atcoder.jp/submissions/899133


from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]
 
setrecursionlimit(1000000)
 
(R, C) = reads()
N = read()
 
d = defaultdict(list)
V = set()
 
for _ in range(N):
  (r, c, a) = reads()
  (r, c) = (r-1, c-1)
  d["R", r].append((("C", c), a))
  d["C", c].append((("R", r), a))
  V.add(("R", r))
  V.add(("C", c))
 
def walk(v):
  V.discard(v)
  for (w, a) in d[v]:
    wcol = a - col[v]
    if w in col:
      if col[w] != wcol:
        print("No"); exit()
    else:
      col[w] = wcol
      walk(w)
 
while len(V) > 0:
  v = V.pop()
  col = dict()
  col[v] = 0
  walk(v)
  rcol = min(a for (v, a) in col.items() if v[0] == "R")
  ccol = min(a for (v, a) in col.items() if v[0] == "C")
  if rcol + ccol < 0:
    print("No"); exit()
 
print("Yes")


Fixed submission:
s = input()
answer = s[:4] + ' ' + s[4:]
print(answer)
Buggy python submission (verdict: Runtime Error):
print(s[:4],s[4:])

Fixed submission:
s = input()
print(s[:4],s[4:])
Buggy python submission (verdict: Time Limit Exceeded):
h,w,n=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split()) 
    for i in (-1,0,1):
        for j in (-1,0,1):
            if 2<=a+i<=h-1 and 2<=b+j<=w-1:
                d.setdefault((a+i,b+j),0)
                d[a+i,b+j]+=1
r=[0]*10
for i in d.values():
    r[i]+=1
r[0]=(h-2)*(w-2)-sum(r)
for i in r:
    print(i)

Fixed submission:
h,w,n=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split()) 
    for i in (-1,0,1):
        for j in (-1,0,1):
            if 2<=a+i<=h-1 and 2<=b+j<=w-1:
                d.setdefault((a+i,b+j),0)
                d[a+i,b+j]+=1
r=[0]*10
for i in d.values():
    r[i]+=1
r[0]=(h-2)*(w-2)-sum(r)
for i in r:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
h,w,n=map(int,input().split())
s={tuple(map(int,input().split())) for _ in range(n)}
p=[(i,j) for i in (-1,0,1) for j in (-1,0,1)]
t={(a+i,b+j) for a,b in s for i,j in p}
c=[0]*10
for a,b in t:
    if 2<=a<=h-1 and 2<=b<=w-1:
        c[sum((a+i,b+j) in s for i,j in p)]+=1
c[0]=(h-2)*(w-2)-sum(c)
for i in c:
    print(i)

Fixed submission:
h,w,n=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split()) 
    for i in (-1,0,1):
        for j in (-1,0,1):
            if 2<=a+i<=h-1 and 2<=b+j<=w-1:
                d.setdefault((a+i,b+j),0)
                d[a+i,b+j]+=1
r=[0]*10
for i in d.values():
    r[i]+=1
r[0]=(h-2)*(w-2)-sum(r)
for i in r:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
h,w,n=map(int,input().split())
s={tuple(map(int,input().split())) for _ in range(n)}
p=[(i,j) for i in (-1,0,1) for j in (-1,0,1)]
t={(a+i,b+j) for a,b in s for i,j in p}
c=[0]*10
for a,b in t:
    if 2<=a<=h-1 and 2<=b<=w-1:
        c[sum((a+i,b+j) in s for i,j in p)]+=1
c[0]=(h-2)*(w-2)-sum(c)
for i in c:
    print(i)

Fixed submission:
h,w,n=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split()) 
    for i in (-1,0,1):
        for j in (-1,0,1):
            if 2<=a+i<=h-1 and 2<=b+j<=w-1:
                d.setdefault((a+i,b+j),0)
                d[a+i,b+j]+=1
r=[0]*10
for i in d.values():
    r[i]+=1
r[0]=(h-2)*(w-2)-sum(r)
for i in r:
    print(i)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=[0]+[i-a for i in map(int,input().split())]
d={}
def f(i):
    if i==n+1:
        return c([0])
    if i in d:
        return d[i]
    d[i]={}
    for j in range(i+1,n+2):
        for k,v in f(j).items():
            d[i].setdefault(x[i]+k,0)
            d[i][x[i]+k]+=v
    return d[i]
print(f(0)[0]-1)

Fixed submission:
n,a=map(int,input().split())
x=[0]+[i-a for i in map(int,input().split())]
d={}
def f(i):
    if i==n+1:
        return {0:1}
    if i in d:
        return d[i]
    d[i]={}
    for j in range(i+1,n+2):
        for k,v in f(j).items():
            d[i].setdefault(x[i]+k,0)
            d[i][x[i]+k]+=v
    return d[i]
print(f(0)[0]-1)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes'
	for i in range(1, 2 * n):
		print i
else:
	print 'No'

Fixed submission:
n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z

Buggy python submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in xrange(1, 2 * n):
		print i
else:
	print 'No'

Fixed submission:
n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z

Buggy python submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in range(1, 2 * n):
		print i
else:
	print 'No'

Fixed submission:
n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z

Buggy python submission (verdict: Runtime Error):
import sys; sys.stdin = open('input.txt')

n = int(raw_input())

a = raw_input()
b = raw_input()

res = n

for i in xrange(n):
    if a.endswith(b[:n-i]):
        break
    res += 1

print res

Fixed submission:
# import sys; sys.stdin = open('input.txt')

n = int(raw_input())

a = raw_input()
b = raw_input()

res = n

for i in xrange(n):
    if a.endswith(b[:n-i]):
        break
    res += 1

print res
Buggy python submission (verdict: Runtime Error):
k_t = input().split()
k = int(k_t[0])
t = int(k_t [1])
t_amount = input().split(' ')
 
while True:
    if t == 1:
        max = k
        break
    max = 0
    for i in range(t-1):
        if t_amount[i+1] >= t_amount [i]:
            max = t_amount[i+1]
        elif max == 0:
            max = t_amount[0]
    t_amount.remove(max)
 
    max2 = 0
    for i in range(t-2):
        if t_amount[i+1] >= t_amount [i]:
            max2 = t_amount[i+1]
        elif max2 == 0 :
            max2 = t_amount[0]
    t_amount.remove(max2)
    if max2 == "0":
        break
    else:
        max = int(max) -1
        max2 = int(max2) -1
        t_amount.append(str(max))
        t_amount.append(str(max2))
 
if max == "0":
    print(0)
else:
    print(int(max)-1)

Fixed submission:
line = input()
if "C" in line and "F" in line:
    if line.index("C") < line.index("F"):
        print('Yes')
    elif line.index("C") > line.index("F"):        
        line1 = line[line.index("C"):]
        
        if "F" in line1:
            print('Yes')
        else:
            print('No')
    else:
        print('No')    
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(' ')
t = 0
for o in range(n):
    i = o + 1
    b = int(a[o]) - i
    if i == int(a[o + b]):
      t += 1
print(int(t / 2))

Fixed submission:
line = list(input())
line.insert(4,' ')
final = ''.join(line)
print(final)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = input().split(' ')
t_l =[]
for i in range(0,n):
   t = i + int(l[i])
   t_l.append(t)
a = 0
for i in range(n *2 -1):
    if t_l.count(i) == 2:
        a += 1
print(a)

Fixed submission:
line = list(input())
line.insert(4,' ')
final = ''.join(line)
print(final)

Buggy python submission (verdict: Runtime Error):
n = int(input())
line = input().split(' ')
total_list =[]
for i in range(0,n):
   total = i + int(line[i])
   total_list.append(total)
a = 0
for i in range(n *2 -1):
    if total_list.count(i) == 2:
        a += 1
print(a)

Fixed submission:
line = list(input())
line.insert(4,' ')
final = ''.join(line)
print(final)

Buggy python submission (verdict: Runtime Error):
n = int(input())
line = input().split(' ')
total_list =[]
for i in range(0,n):
   total = i + int(line[i])
   total_list.append(total)
answer = 0
for i in range(n *2 -1):
    if total_list.count(i) == 2:
        answer += 1
print(answer)

Fixed submission:
line = list(input())
line.insert(4,' ')
final = ''.join(line)
print(final)