Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
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:
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))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
line = input().split(' ')
t_list =[]
for i in range(0,n):
   t = i + int(line[i])
   t_list.append(t)
a = 0
for i in range(n *2 -1):
    if t_list.count(i) == 2:
        a += 1
print(a)

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
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
    else:
        answer += 0
print(answer)

Fixed submission:
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))
Buggy python submission (verdict: Runtime Error):
import math
from decimal import Decimal

N = int(input())
T, A = [Decimal(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [Decimal(x) for x in input().split()]
        n = max(math.ceil(T/T2),math.ceil(A/A2)
        T = T2*n
        A = A2*n

print(T + A)

Fixed submission:
import math
from decimal import Decimal

N = int(input())
T, A = [Decimal(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [Decimal(x) for x in input().split()]
        n = Decimal(max(math.ceil(T/T2),math.ceil(A/A2)))
        T = T2 * n
        A = A2 * n

print(T+A)

Buggy python submission (verdict: Runtime Error):
import math
from decimal import Decimal

N = int(input())
T, A = [int(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [int(x) for x in input().split()]
        n = max(math.ceil(Decimal(T)/Decimal(T2)),math.ceil(Decimal(A)/Decimal(A2))
        T = T2*n
        A = A2*n

print(T + A)

Fixed submission:
import math
from decimal import Decimal

N = int(input())
T, A = [Decimal(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [Decimal(x) for x in input().split()]
        n = Decimal(max(math.ceil(T/T2),math.ceil(A/A2)))
        T = T2 * n
        A = A2 * n

print(T+A)

Buggy python submission (verdict: Runtime Error):
import math
from decimal import Decimal

N = int(input())
T, A = [int(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [int(x) for x in input().split()]
        print('i= ',i)
        n = max(math.ceil(Decimal(T)/Decimal(T2)),math.ceil(Decimal(A)/Decimal(A2))
        print('n= ',n)
        T = T2*n
        A = A2*n
        print('T= ',T)
        print('A= ',A)

print(T + A)

Fixed submission:
import math
from decimal import Decimal

N = int(input())
T, A = [Decimal(x) for x in input().split()]

for i in range(1,N):
        T2, A2 = [Decimal(x) for x in input().split()]
        n = Decimal(max(math.ceil(T/T2),math.ceil(A/A2)))
        T = T2 * n
        A = A2 * n

print(T+A)
Buggy python submission (verdict: Runtime Error):
s = input().split()

size = []
for n in s:
    size.append(int(n))

s2 = input().split()

ss = []
for n in s2:
    ss.append(int(n))

if size[0] % 2 == 0:
    k = size[0]/2
else:
    k = (size[0] + 1) /2

l = 0
m = 3

for i in ss:
    if i > k:
        l+=1
        while i > int((m-1) * size[0] / m) and m <= size[0]:
            m+=1
         
            l+=1

print (l)



Fixed submission:
import re

m = input()

m2 = re.search('C[A-Z]*F', m)

if m2:
    
    print ("Yes")

else:
    print ("No")

#print (m2)
Buggy python submission (verdict: Time Limit Exceeded):
size = int(input())

r_str = input().split()

rabs = []
for r in r_str:
    rabs.append(int(r) - 1)

visited = []
t = 0

for i in range(0, size):
    if rabs[rabs[i]] == i and (i not in visited):
        visited.append(i)
        visited.append(rabs[i])
        t += 1

print(t)


Fixed submission:
size = int(input())

r_str = input().split()

rabs = []
for r in r_str:
    rabs.append(int(r) - 1)

#visited = []
t = 0

for i in range(0, size):
    if rabs[rabs[i]] == i and (not rabs[i] < i):
        #visited.append(i)
        #visited.append(rabs[i])
        t += 1

print(t)

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

r_str = input().split()

rabs = []
for r in r_str:
    rabs.append(int(r) - 1)

visited = []
t = 0

for i in range(0, size):
    if rabs[rabs[i]] == i and (i not in visited):
        visited.append(i)
        visited.append(rabs[i])
        t += 1

print(t)


Fixed submission:
size = int(input())

r_str = input().split()

rabs = []
for r in r_str:
    rabs.append(int(r) - 1)

#visited = []
t = 0

for i in range(0, size):
    if rabs[rabs[i]] == i and (not rabs[i] < i):
        #visited.append(i)
        #visited.append(rabs[i])
        t += 1

print(t)
Buggy python submission (verdict: Runtime Error):
s = input()
if "C" in s and "F" in s:
  a = s.lindex("C")
  b = s.rindex("F")
  if a < b:
    print("Yes")
  else:
    print("No")
else:
  print("No")


Fixed submission:
s = input()
if "C" in s and "F" in s:
  a = s.index("C")
  b = s.rindex("F")
  if a < b:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        print a
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = a[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = a[1:]
        if len(c) == 0:
            print 'C'
            break


Fixed submission:
a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = b[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = c[1:]
        if len(c) == 0:
            print 'C'
            break

Buggy python submission (verdict: Time Limit Exceeded):
a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        print a
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = a[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = a[1:]
        if len(c) == 0:
            print 'C'
            break


Fixed submission:
a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = b[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = c[1:]
        if len(c) == 0:
            print 'C'
            break
Buggy python submission (verdict: Runtime Error):
from random import random
import math
import re
import fractions

S = raw_input()
pc = S.index("C")
pf = S.rindex("F")
if pc > -1 and pf > -1 and pc < pf:
    print "Yes"
else:
    print "No"


Fixed submission:
S = raw_input()

pc = S.index("C") if "C" in S else -1
pf = S.rindex("F") if "F" in S else -1
if pc > -1 and pf > -1 and pc < pf:
    print "Yes"
else:
    print "No"

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

cl = []
fl = []

for i, c_test in zip(range(len(s)), s):
    if c_test == 'C':
        cl.append(i)

for i, f_test in zip(range(len(s)), s):
    if f_test == 'F':
        fl.append(i)    
if max(fl) > min(cl):
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()

cl = []
fl = []

for i, c_test in zip(range(len(s)), s):
    if c_test == 'C':
        cl.append(i)

for i, f_test in zip(range(len(s)), s):
    if f_test == 'F':
        fl.append(i)
if len(cl) == 0 or len(fl) == 0:
    print("No")    
elif max(fl) > min(cl):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
# get a string
s = raw_input()

n = 0
for i, c in enumerate('CODEFESTIVAL2016'):
    if s[i] != c:
        n++
print n

Fixed submission:
# get a string
s = raw_input()

n = 0
for i, c in enumerate('CODEFESTIVAL2016'):
    if s[i] != c:
        n+=1
print n
Buggy python submission (verdict: Runtime Error):
n, k = map(int, raw_input().split())
ans =  k * ((k-1)**(n-1))
print(ans)

Fixed submission:
paints = raw_input().split()
paints_uniq = list(set(paints))
print(len(paints_uniq))
Buggy python submission (verdict: Runtime Error):
s = raw_input()
flag = 0
for i in s:
    if flag == 0 and i == 'C': flag = 1
    elif: flag == 1 and i == 'F': flag = 2

print 'Yes' if flag == 2 else 'No'

Fixed submission:
s = raw_input()
flag = 0
for i in s:
    if flag == 0 and i == 'C': flag = 1
    elif flag == 1 and i == 'F': flag = 2
    else: continue
print 'Yes' if flag == 2 else 'No'
Buggy python submission (verdict: Runtime Error):
neighbor = lambda c, w, h: filter(
    lambda b: 0 <= b[0] <= w and 0 <= b[1] <= h,
    [
        (c[0]-1, c[1]),
        (c[0]+1, c[1]),
        (c[0], c[1]-1),
        (c[0], c[1]+1)
    ]
)

t = raw_input()
W, H = map(int, t.split(' '))
p, q = [], []
for i in xrange(W):
    p.append(int(raw_input()))
for j in xrange(H):
    q.append(int(raw_input()))

has = [[False for i in xrange(H+1)] for j in xrange(W+1)]
has[0][0] = True
Next = [(1, 0), (0, 1)]

cost = 0
for i in xrange(W*H+W+H):
    Min = 100000005
    choose = None
    Next.sort(key=lambda a: min(p[a[0]-1] if a[0] > 0 else 100000005, q[a[1]-1] if a[1] > 0 else 100000005))
    choose = Next[-1]
    Min = min(p[choose[0]-1] if choose[0] > 0 else 100000005, q[choose[1]-1] if choose[1] > 0 else 100000005)
    # for each in Next:
    #     if each[0] > 0:
    #         if p[each[0]-1] < Min:
    #             choose = each
    #             Min = p[each[0]-1]
    #     if each[1] > 0:
    #         if q[each[1]-1] < Min:
    #             choose = each
    #             Min = q[each[1]-1]
    has[choose[0]][choose[1]] = True
    Next = Next[:-1]
    cost += Min
    for every in neighbor(choose, W, H):
        # print every
        if not has[every[0]][every[1]] and every not in Next:
            Next.append(every)
print cost

Fixed submission:
s = raw_input()
r = 'CODEFESTIVAL2016'
cnt = 0
for i in xrange(len(s)):
    cnt += 1 if s[i] != r[i] else 0
print cnt
Buggy python submission (verdict: Runtime Error):
from collections import deque

def next_char_ascii_num(c, k):
    n = ord(c) + (k % 26)
    if n <= 122:
        return n
    else:
        return n % 123 + 97

s = input()
k = int(input())
d = deque()
l = len(s)

for i, x in enumerate(s):

    if k <= 0:
        l = i
        break

    else:
        if k >= 25 and l != 1:
            d.append(97)
            k -= (26 - (ord(x) - 97))
        else:
            v =[next_char_ascii_num(x, y) for y in range(k + 1)]
            min_index = v.index(min(v))
            d.append(v[min_index])
            k -= min_index


if k > 0:
    d[-1] = next_char_ascii_num(chr(d[-1]), k)
else:
    d += s[l:]

print("".join([chr(x) for x in d]))


Fixed submission:
s = input()
print(s[:4] + " " + s[4:])

Buggy python submission (verdict: Runtime Error):
from collections import deque

def next_char_ascii_num(c, k):
    n = ord(c) + (k % 26)
    if n <= 122:
        return n
    else:
        return n % 123 + 97

s = input()
k = int(input())
d = deque()
l = len(s)

for x in s:

    if k == 0:
        d.append(ord(x))

    else:
        if k >= 25 and l != 1:
            d.append(97)
            k -= (26 - (ord(x) - 97))
        else:
            v =[next_char_ascii_num(x, y) for y in range(k + 1)]
            min_index = v.index(min(v))
            d.append(v[min_index])
            k -= min_index

if k > 0:
    d[-1] = next_char_ascii_num(chr(d[-1]), k)

print("".join([chr(x) for x in d]))


Fixed submission:
s = input()
print(s[:4] + " " + s[4:])
Buggy python submission (verdict: Time Limit Exceeded):
k, t = map(int, raw_input().split())
a = map(int, raw_input().split())

while len(a) > 1:
    a[-2] = abs(a[-1] - a[-2])
    while not a[-1]:
        a.pop()

if not a:
    print 0
else:
    print a[0] - 1

Fixed submission:
k, t = map(int, raw_input().split())
a = map(int, raw_input().split())

while len(a) > 1:
    a.sort()
    tmp = abs(a.pop() - a.pop())
    if tmp:
        a.append(tmp)

if not a:
    print 0
else:
    print a[0] - 1
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
p=k
for i in range(n-1):
  p *= k-1
print(p)
  

Fixed submission:
paint = map(int,input().split())
print(len(set(paint)))
Buggy python submission (verdict: Runtime Error):
def fib(n):
  if n <= 1:
    return 1
  return fib(n-1)*n

n,k = map(int, input().split())
print(int(fib(k)/fib(k-n)))

Fixed submission:
n,k = map(int, input().split())
p=k
for i in range(n-1):
  p *= k-1
print(p)

Buggy python submission (verdict: Runtime Error):
def fib(n):
  if n == 1:
    return 1
  else:
    return fib(n-1)*n

n,k = map(int, input().split())
print(int(fib(k)/fib(k-n)))

Fixed submission:
n,k = map(int, input().split())
p=k
for i in range(n-1):
  p *= k-1
print(p)
Buggy python submission (verdict: Runtime Error):
def test(): 
  arr = input()
  arr = [int(i) for i in arr]
  arr = sorted(arr)
  if arr==[5, 5, 7]:
    print("YES")
  else:
    print("NO")  
test()
  	

Fixed submission:
def test(): 
  arr = input()
  arr = arr.split()
  arr = sorted(arr)
  if arr==['5', '5', '7']:
    print("YES")
  else:
    print("NO")  
test()
Buggy python submission (verdict: Runtime Error):
a, b, c = getNM()
print(len({a, b, c}))

Fixed submission:
import sys
import math
from functools import reduce
import bisect


def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))


def input():
    return sys.stdin.readline().rstrip()


# input = sys.stdin.buffer.readline

def index(a, x):
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return False


#############
# MAIN CODE #
#############

a, b, c = getNM()
print(len({a, b, c}))
Buggy python submission (verdict: Runtime Error):
arr = input()
arr = ''.join(reversed(arr))
print(arr[:arr.index('B')])


Fixed submission:
arr = input()
new = ""
for x in arr:
    if x == "B":
        if new:
            new = new[:-1]
    else:
        new += x
print(new)
Buggy python submission (verdict: Runtime Error):
import sys

while True:
    w = input()

    if not w.islower():
        continue

    if len(w) >= 100:
        continue

    for n_alpha in "abcdefghijklmnopqrstuvwxyz":
        count_alpha = w.count(n_alpha)
        if count_alpha % 2 == 1:
            print('No')
        else:
            print('Yes')
        break
    break

sys.exit()

Fixed submission:
import string
w = input()
if all([w.count(low_alpha) % 2 == 0 for low_alpha in string.ascii_lowercase ]):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import sys

def input_w():
    w = input()

    while w.islower():

        length = len(w)
        if length >= 100:
            return input_w()

        for n_alpha in "abcdefghijklmnopqrstuvwxyz":
            count_alpha = w.count(n_alpha)
            if count_alpha % 2 == 1:
                print('No')
                return input_w()

        print('Yes')
        sys.exit()

    return input_w()

w=input_w()

Fixed submission:
import string
w = input()
if all([w.count(low_alpha) % 2 == 0 for low_alpha in string.ascii_lowercase ]):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys, math

n = int(input())
s = int(input())

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b

if s == n:
    print(n + 1)
    sys.exit()
elif s > n:
    print('-1')
    sys.exit()

sqrt_n = math.floor(math.sqrt(n))

for b in range(2, sqrt_n + 1):
    if f(b, n) == s:
        print(b)
        sys.exit()

for p in range(1, sqrt_n + 1):
    P = sqrt_n + 1 - p
    b = int( (n -s)/P ) + 1
    if f(b, n) == s and b >= 2:
        print(b)
        sys.exit()

print('-1')

Fixed submission:
import sys, math
n = int(input())
s = int(input())

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b

if s == n:
    print(n + 1)
    sys.exit()

sqrt_n = math.floor(math.sqrt(n))
for b in range(2, sqrt_n + 1):
    if f(b, n) == s:
        print(b)
        sys.exit()
for p in range(1, sqrt_n + 1):
    p_sum= sqrt_n + 1 - p
    b = int( (n -s)/p_sum ) + 1
    if b >= 2 and f(b, n) == s:
        print(b)
        sys.exit()
print('-1')

Buggy python submission (verdict: Runtime Error):
import sys, math

n = int(input())
s = int(input())

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, math.floor(n/b)) + n % b

if s == n:
    print(n + 1)
    sys.exit()
elif s > n:
    print('-1')
    sys.exit()

for b in range(2, math.floor(math.sqrt(n))+1):
    if f(b, n) == s:
        print(b)
        sys.exit()

for p in range(math.floor(math.sqrt(n)+1)):
    P = math.floor(math.sqrt(n)) + 1 - p
    b = int( (n -s)/P ) + 1
    if f(b, n) == s and b >= 2:
        print(b)
        sys.exit()

print('-1')

Fixed submission:
import sys, math
n = int(input())
s = int(input())

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b

if s == n:
    print(n + 1)
    sys.exit()

sqrt_n = math.floor(math.sqrt(n))
for b in range(2, sqrt_n + 1):
    if f(b, n) == s:
        print(b)
        sys.exit()
for p in range(1, sqrt_n + 1):
    p_sum= sqrt_n + 1 - p
    b = int( (n -s)/p_sum ) + 1
    if b >= 2 and f(b, n) == s:
        print(b)
        sys.exit()
print('-1')
Buggy python submission (verdict: Runtime Error):
N = input()
a = list(map(int,input().split()))
cost_sum = 0
print_cost = 20000

for a_i in range(min(a), max(a)+1):
    for a_j in a:
        cost_sum += ((a_j - a_i) ** 2)
    if print_cost > cost_sum:
        print_cost = cost_sum

print(print_cost)


Fixed submission:
N = int(input())
list_N = [ x for x in range(1, N+1) ]
print( sum(list_N) )
Buggy python submission (verdict: Runtime Error):
import sys

while True:
    s = input()

    if s == '':
        continue
    elif len(str(s)) >= 10:
        continue
    else:
        s_input = [x for x in s]

    s_output = []

    for n in s_input:
        if n == '1' or n == '0':
            s_output.append(n)
        elif n == 'B':
            backspace = len(s_output)-1
            s_output = s_output[:backspace]

    if '0'  or '1' in s_output:
        print(''.join(s_output))
        break

sys.exit()


Fixed submission:
s = input()
output = []

for n in range(len(s)):
    if s[n] == '1' or s[n] == '0':
        output.append(s[n])
    elif s[n] == 'B' and output != []:
        backspace = len(output)-1
        output = output[:backspace]
print(''.join(output))
Buggy python submission (verdict: Runtime Error):
dk = {}
dk["a"] = input()
dk["b"] = input()
dk["c"] = input()

n = "a"
while True:
    if len(dk[n]) == 0:
        print(n.upper())
        break
    nn = dk[n][0]
    dk[n] = dk[n][1:]
    n = nn



Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print("%d" % ((a+b)*h/2))

Buggy python submission (verdict: Runtime Error):
dk = {}
dk["a"] = input()
dk["b"] = input()
dk["c"] = input()

n = "a"
while true:
    if len(dk[n]) == 0:
        return print(n.upper())
        break
    nn = dk[n][0]
    dk[n] = dk[n][1:]
    n = nn


Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print("%d" % ((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
N=input()
T=[]
A=[]
for i in range(N):
    Ti,Ai=map(int,raw_input().split())
    T.append(Ti)
    A.append(Ai)
 
Tn=1
An=1
dp = np.zeros(N)
dp[0] = 1
 
for i in range(1,N):
    dp[i] = math.ceil(max(A[i]/A[i-1],T[i]/T[i-1])*dp[i-1])
 
print (T[-1]+A[-1])*dp[-1]

Fixed submission:
M = map(int, raw_input().split())
# M = [1,2,2]
print len(set(M))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, raw_input().split())
# N, K = 10, 8

print (K * (K-1) ** (N-1))

Fixed submission:
N, K = map(int, raw_input().split())
# N, K = 10, 8
 
print K * (K-1) ** (N-1)
Buggy python submission (verdict: Runtime Error):
s=raw_input()

p=0

for i in range(len(s)):
    if s[i] == 'p':
        p += 1

print (len(s)//2 - p)

Fixed submission:
s=raw_input()

p=0

for i in range(len(s)):
    if s[i] == 'p':
        p += 1

print (len(s)//2 - p)
Buggy python submission (verdict: Runtime Error):
from sys import setrecursionlimit
from numpy import ceil


def _main():
    setrecursionlimit(1100)
    print int(sum(election(1.0, 1.0, input())))


def election(t_prev, a_prev, n):
    if n == 0:
        return t_prev, a_prev
    t, a = map(int, raw_input().split())

    mlt = max(ceil(t_prev / t), ceil(a_prev / a), 1)
    return election(t * mlt, a * mlt, n - 1)


if __name__ == '__main__':
    _main()

Fixed submission:
inp = raw_input()
print len(set(inp.strip().split(' ')))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n, k = map(int, raw_input().split())

print k * (k-1) ** (n-1)


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

colour_list = [a, b, c]
bought = []
count = 0
for x in colour_list:
    if x not in bought:
        bought.append(x)
        count += 1

print count
Buggy python submission (verdict: Runtime Error):
player_list = ['a', 'b', 'c']
s = {player_list[n]: list(raw_input()) for n in player_list}

current_turn = player_list[0]

get_winner = lambda x, s: not s[x] and x.upper() or get_winner(s[x].pop(0), s)

print get_winner(current_turn, s)

Fixed submission:
# -*- coding: utf-8 -*-
s_a = [s for s in raw_input() if s != 'a']
s_b = [s for s in raw_input() if s != 'b']
s_c = [s for s in raw_input() if s != 'c']

x = 0
y = 0
z = 0
next_turn = 'A'

while x <= len(s_a) and y <= len(s_b) and z <= len(s_c):
    try:
        if next_turn == 'A':
            next_turn = s_a[x].upper()
            x += 1
        elif next_turn == 'B':
            next_turn = s_b[y].upper()
            y += 1
        else:
            next_turn = s_c[z].upper()
            z += 1
    except IndexError:
        print next_turn
        break
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
c_t = 0
c_a = 0
for i in range(n):
    t, a = [int(x) for x in input().split(" ")]
    #print(min(c_t / t, c_a / a))
    init = int(math.floor(max(c_t / t, c_a / a, 1)))
    for j in range(init,10**18):
        if t*j >= c_t and a*j >= c_a:
            c_t = t*j
            c_a = a*j
            #print("->" + str(j))
            break
print(c_t + c_a)


Fixed submission:
lst = [x for x in input().split(" ")]
s = set(lst)
print(len(s))
Buggy python submission (verdict: Runtime Error):
cans = set(map(int, raw_input().split()))
return len(cans)


Fixed submission:
cans = set(map(int, raw_input().split()))
print len(cans)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
orig = 'CODEFESTIVAL2016'

result = 0
for i in len(s):
  if orig[i] != s:
    result += 1

print result

Fixed submission:
s = raw_input()
orig = 'CODEFESTIVAL2016'

result = 0
for i in range(len(s)):
  if orig[i] != s[i]:
    result += 1

print result