Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                ans += 1
print(ans)


Fixed submission:
k,s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def fits(N):
    if N < 4:
        return 'no'
    else:
        for cake in range(0,100,4):
            for donut in range(0,100,7):
                if cake + donut is N:
                    return 'yes'

if __name__ == '__main__':
    print(fits(int(N)))

Fixed submission:
def fits(N):
    answer = 'No'
    for cake in range(0,100,4):
        for donut in range(0,100,7):
            if cake + donut is N:
                answer = 'Yes'
    return answer
if __name__ == '__main__':
    N = int(input())
    print(fits(N))
Buggy python submission (verdict: Runtime Error):
for i in S:
    s = ''
    x = i
    s += S[1::1]
    s += x
    S = S[1::1] + S[0]
    
    if s == T:
        print('Yes')
        break
else:
    print('No')

Fixed submission:
S = str(input())
T = str(input())

for i in S:
    s = ''
    x = i
    s += S[1::1]
    s += x
    S = S[1::1] + S[0]
    
    if s == T:
        print('Yes')
        break
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import functools
import fractions

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

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
answer = sum([max_under_lcm % n for n in numbers])

print(answer)

Fixed submission:
# -*- coding: utf-8 -*-

tasks = list(map(int, input().split()))
answer = max(tasks) - min(tasks)
print(answer)

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

import functools

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a if a > 0 else 1

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / gcd(x,y)), numbers) - 1
answer = sum([ max_under_lcm % n for n in numbers])

print(answer)

Fixed submission:
# -*- coding: utf-8 -*-

tasks = list(map(int, input().split()))
answer = max(tasks) - min(tasks)
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

answer = 65535
max_A = max(A)
for x in range(-max_A-1, max_A+1):
    answer = min(answer, sum([abs(num - (i+1) - x) for i, num in enumerate(A)]))

print(answer)

Fixed submission:
import statistics

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

tmp = [num - (i+1) for i, num in enumerate(A)]
med = int(statistics.median(tmp))
answer = sum([abs(num - med) for num in tmp])

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

N = int(input())
sys.setrecursionlimit(N+1)

memo = dict()
INF = N 

def withdraw(ammount):
    if ammount == 0:
        return 0
    if ammount in memo:
        return memo[ammount]

    answer = INF 
    answer = ammount

    unit = 6 
    while unit < ammount:
        answer = min(answer, withdraw(ammount-unit)+1)
        unit *= 6

    unit = 9 
    while unit < ammount:
        answer = min(answer, withdraw(ammount-unit)+1)
        unit *= 9

    memo[ammount] = answer
    return answer

print(withdraw(N))

Fixed submission:
import sys

N = int(input())
sys.setrecursionlimit(N*10)

memo = dict()
INF = N

def withdraw(amount):
    if amount == 0:
        return 0
    if amount in memo:
        return memo[amount]

    answer = amount
    
    unit = 6
    while unit <= amount:
        answer = min(answer, withdraw(amount-unit)+1)
        unit *= 6

    unit = 9
    while unit <= amount:
        answer = min(answer, withdraw(amount-unit)+1)
        unit *= 9

    memo[amount] = answer
    return answer

print(withdraw(N))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

answer = float('inf')
for i in range(N):
    lcount = 0 if i == 0 else S[:i].count('W')
    rcount = 0 if i == N-1 else S[i:].count('E')
    answer = min(answer, lcount+rcount)

print(answer)

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

answer = prev = S[1:].count('E')
for i in range(1, N):
    _answer = prev if S[i-1] == 'E' else prev+1
    if S[i] == 'E':
        _answer -= 1
    answer = min(answer, _answer)
    prev = _answer

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H, W = list(map(int, input().split()))
c = [input() for _ in range(H)]

moves = [(-1, 0), (1, 0), (0, -1), (0, 1)] 

def bfs():
    dist = [[0 for _ in range(W)] for _ in range(H)]
    routes = deque()
    routes.append((0, 0)) 

    while len(routes) > 0:
        x, y = routes.popleft()
        for move in moves:
            cx, cy = x + move[0], y + move[1]
            if cx < 0 or cy < 0 or cx >= W or cy >= H or c[cy][cx] == '#':
                continue
            if cx == W-1 and cy == H-1: 
                return sum([line.count('.')for line in c]) - dist[y][x] - 2 
            routes.append((cx, cy))
            dist[cy][cx] = dist[y][x] + 1 
    return -1

print(bfs())

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

moves = [(-1, 0), (1, 0), (0, -1), (0, 1)]

def bfs():
    visited = [[False for _ in range(W)] for _ in range(H)]
    dist = [[[] for _ in range(W)] for _ in range(H)]
    routes = [(0, 0)]
    visited[0][0] = True

    hop_count = 0
    while len(routes) > 0:
        x, y = routes.pop(0)
        for move in moves:
            cx, cy = x + move[0], y + move[1]
            if cx < 0 or cy < 0 or cx >= W or cy >= H or c[cy][cx] == '#' or visited[cy][cx]:
                continue
            if cx == W-1 and cy == H-1:
                return sum([line.count('.')for line in c]) - len(dist[y][x]) - 2
            visited[cy][cx] = True
            routes.append((cx, cy))
            dist[cy][cx] += dist[y][x] + [(x, y)]
    return -1

print(bfs())
Buggy python submission (verdict: Runtime Error):
from itertools import product

A, B, C, D = list(map(int, input()))

for pattern in product('+-', repeat=3):
    f = '{}{}{}{}{}{}{}'.format(A, pattern[0], B, pattern[1], C, pattern[2], D)    if eval(f) == 7:
        print(f+'=7') 
        break

Fixed submission:
from itertools import product

A, B, C, D = list(map(int, input()))

for pattern in product('+-', '+-', '+-'):
    f = '{}{}{}{}{}{}{}'.format(A, pattern[0], B, pattern[1], C, pattern[2], D)

    if eval(f) == 7:
        print(f+'=7')
        break
Buggy python submission (verdict: Runtime Error):
def Product(a,b):
  if (a*b)%2 == 0:
    return 'even'
  else:
    return 'odd'

Product(a,b)

Fixed submission:
a, b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = [it - (idx + 1) for idx, it in enumerate(A)]
S = []

for b in B:
    C = [abs(i-b) for i in B]
    s = sum(C)
    S.append(s)
    
print(min(S))

Fixed submission:
N = int(input())

if N%2 == 0:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = range(-N//2 + 1, max(A))
S = list()
s = 0

for b in B:
    for idx, it in enumerate(A):
        s += abs(it - (b+idx))
    S.append(s)
    s = 0
    
print(min(S))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [it - (idx + 1) for idx, it in enumerate(A)]
S = []

B.sort()
if N%2 == 1:
    b = B[(N-1)//2]
else:
    b = (B[(N-1)//2] + B[(N-1)//2 + 1]) // 2
    
S = sum([abs(i-b) for i in B])
    
print(S)
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def lcm(l):
    def aux(l, i):
        if i == len(l) - 1:
            return l[-1]
        rest = aux(l, i+1)
        return l[i] * rest // gcd(l[i], rest)
    return aux(l, 0)

def modsum(a):
    k = lcm(a) - 1
    return sum(map(lambda x: k % x, a))

if __name__ == '__main__':
    _ = input()
    a = list(map(int, input().split()))
    print(modsum(a))

Fixed submission:
import sys

sys.setrecursionlimit(3100)

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def lcm(l):
    def aux(l, i):
        if i == len(l) - 1:
            return l[-1]
        rest = aux(l, i+1)
        return l[i] * rest // gcd(l[i], rest)
    return aux(l, 0)

def modsum(a):
    k = lcm(a) - 1
    return sum(map(lambda x: k % x, a))

if __name__ == '__main__':
    _ = input()
    a = list(map(int, input().split()))
    print(modsum(a))

Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def lcm(l):
    def aux(l, i):
        if i == len(l) - 1:
            return l[-1]
        rest = aux(l, i+1)
        return int((l[i] * rest) / gcd(l[i], rest))
    return aux(l, 0)

def modsum(a):
    k = lcm(a) - 1
    return sum(map(lambda x: k % x, a))

if __name__ == '__main__':
    _ = input()
    a = list(map(int, input().split()))
    print(modsum(a))

Fixed submission:
import sys

sys.setrecursionlimit(3100)

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def lcm(l):
    def aux(l, i):
        if i == len(l) - 1:
            return l[-1]
        rest = aux(l, i+1)
        return l[i] * rest // gcd(l[i], rest)
    return aux(l, 0)

def modsum(a):
    k = lcm(a) - 1
    return sum(map(lambda x: k % x, a))

if __name__ == '__main__':
    _ = input()
    a = list(map(int, input().split()))
    print(modsum(a))
Buggy python submission (verdict: Time Limit Exceeded):
from math import log

def exp(n, base):
    e = int(log(n, base))
    if base ** (e + 1) <= n:
        return e + 1
    else:
        return e

def min_withdraw(n):
    if n < 6:
        return n
    else:
        exp_nine = exp(n, 9)
        exp_six = exp(n, 6)
        return 1 + min(min_withdraw(n - (6 ** exp_six)), min_withdraw(n - (9 ** exp_nine)))
    
    
if __name__ == '__main__':
    n = int(input())
    print(min_withdraw(n))

Fixed submission:
from math import log
 
def exp(n, base):
    e = int(log(n, base))
    if base ** (e + 1) <= n:
        return e + 1
    else:
        return e
 
def min_withdraw(n):
    if n < 6:
        return n
    else:
        exp_nine = exp(n, 9)
        exp_six = exp(n, 6)
        return 1 + min(min_withdraw(n - (6 ** exp_six)), min_withdraw(n - (9 ** exp_nine)))
    
    
if __name__ == '__main__':
    n = int(input())
    print(min_withdraw(n))
Buggy python submission (verdict: Runtime Error):
print(700 + 100 * input().count('o'))print(700 + 100 * input().count('o'))

Fixed submission:
print(700 + 100 * input().count('o'))
Buggy python submission (verdict: Runtime Error):
def ops_needed(x, target):
    if abs(target - x) < abs(x):
        return 0
    else:
        return target - x

def count_ops(a):
    total_ops = 0
    accum = a[0]
    for i in range(1, len(a)):
        new_accum = accum + a[i]
        if new_accum == 0:
            ops =  -1 * (accum / abs(accum))
        else:
            ops = ops_needed(new_accum, -1 * (accum / abs(accum)))
        total_ops += abs(ops)
        accum = new_accum + ops
    return int(total_ops)
        

if __name__ == '__main__':
    _ = int(input())
    a = list(map(int, input().split()))
    print(count_ops(a))


Fixed submission:
def ops_needed(x, target):
    if abs(target - x) < abs(x):
        return 0
    else:
        return target - x

def count_ops(a, first_target):
    total_ops = 0
    accum = 0
    for i, ai in enumerate(a):
        new_accum = accum + a[i]
        if i % 2 == 1:
            ops = ops_needed(new_accum, first_target)
        else:
            ops = ops_needed(new_accum, -1 * first_target)
        total_ops += abs(ops)
        accum = new_accum + ops
    return total_ops
        

if __name__ == '__main__':
    _ = int(input())
    a = list(map(int, input().split()))
    print(min(count_ops(a, 1), count_ops(a, -1)))

Buggy python submission (verdict: Runtime Error):
def count_ops(a):
    if a[0] == 0:
        total_ops = 1
        if a[1] < 0:
            accum = 1
        else:
            accum = -1
    else:
        total_ops = 0
        accum = a[0]
    for i in range(1, len(a)):
        new_accum = accum + a[i]
        if (accum > 0 and new_accum > 0):
            ops = ops_needed(new_accum, -1)
        elif (accum > 0 and new_accum == 0):
            ops = -1
        elif (accum < 0 and new_accum < 0):
            ops = ops_needed(new_accum, 1)
        elif (accum < 0 and new_accum == 0):
            ops = 1
        else:
            ops = 0
        total_ops += abs(ops)
        accum = new_accum + ops
    return total_ops
        

if __name__ == '__main__':
    _ = int(input())
    a = list(map(int, input().split()))
    print(count_ops(a))


Fixed submission:
def ops_needed(x, target):
    if abs(target - x) < abs(x):
        return 0
    else:
        return target - x

def count_ops(a, first_target):
    total_ops = 0
    accum = 0
    for i, ai in enumerate(a):
        new_accum = accum + a[i]
        if i % 2 == 1:
            ops = ops_needed(new_accum, first_target)
        else:
            ops = ops_needed(new_accum, -1 * first_target)
        total_ops += abs(ops)
        accum = new_accum + ops
    return total_ops
        

if __name__ == '__main__':
    _ = int(input())
    a = list(map(int, input().split()))
    print(min(count_ops(a, 1), count_ops(a, -1)))
Buggy python submission (verdict: Runtime Error):
rint('vowel') if input() in 'aeiouAEIOU' else print('consonant')

Fixed submission:
print('vowel') if input() in 'aeiou' else print('consonant')
Buggy python submission (verdict: Runtime Error):
from collections import Counter

word = input()
c = Counter(word)
counts = c.values()
if all(map(lambda x: x % 2 == 0, counts)) print('Yes') else print('No')

Fixed submission:
from collections import Counter

word = input()
c = Counter(word)
counts = c.values()
print('Yes') if all(map(lambda x: x % 2 == 0, counts)) else print('No')
Buggy python submission (verdict: Runtime Error):
n=eval(input())
if n<1200:
	print("ABC")
elif n>=1200 and n<2800:
	print("ARC")
else:
    peint("AGC")

Fixed submission:
n=eval(input())
if n<1200:
	print("ABC")
elif n>=1200 and n<2800:
	print("ARC")
else:
    print("AGC")

Buggy python submission (verdict: Runtime Error):
S = input()
n = len(S)
for m in range (3, n):
    if S[m-1] == C:
        Count_C = Count_C + 1
        S[m-1].lower()
if S[1] == A:
    Count_A = 1
    S[1].lower()
if(Count_C == 1 and Count_A == 1 and S.islower()):
    print('AC')
else:
    print('WA')



Fixed submission:
R = int(input())
if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')
Buggy python submission (verdict: Runtime Error):

N,X=map(int,input().split())
m=[]
for i in range(N):
    mix=int(input())
    m.append(mix)
lowest=sum(m)
X=X-lowest
def dp(rm,num):
    if rm<m[num]:return 0
    
    if num<N-1:
        return max(1+dp(rm-m[num],num),dp(rm,num+1))
    else :
        return 1+dp(rm-m[num],num)
print(dp(X,0)+N)

Fixed submission:

N,X=map(int,input().split())
m=[]
for i in range(N):
    mix=int(input())
    m.append(mix)
lowest=sum(m)
X=X-lowest
minimum=min(m)
ans=N
while X>=minimum:
    ans+=1
    X=X-minimum
print(ans)

Buggy python submission (verdict: Runtime Error):

N,X=map(int,input().split())
m=[]
for i in range(N):
    mix=int(input())
    m.append(mix)
lowest=sum(m)
X=X-lowest
def dp(rm,num):
    if rm<m[num]:return 0
    
    elif num<N-1:
        return max(1+dp(rm-m[num],num),dp(rm,num+1))
    else :return 1+dp(rm-m[num],num)
print(dp(X,0)+N)
    

Fixed submission:

N,X=map(int,input().split())
m=[]
for i in range(N):
    mix=int(input())
    m.append(mix)
lowest=sum(m)
X=X-lowest
minimum=min(m)
ans=N
while X>=minimum:
    ans+=1
    X=X-minimum
print(ans)
Buggy python submission (verdict: Runtime Error):

A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b):
    if num_a<=0 and num_b<=0:return 0
    elif num_b!=0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
print(dp(X,Y))

Fixed submission:
A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b):
    """
    if num_a<=0 and num_b<=0:return 0
    elif num_b>0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
    """
    if A+B>2*C:
        if min(num_a,num_b)>0:
            if num_a > num_b:
                return num_b*2*C+dp(num_a-num_b,0)
            else :
                return num_a*2*C+dp(0,num_b-num_a)
        elif num_a==0 and num_b>0:
            if B<2*C:
                return num_b*B
            else :
                return C*2*num_b
        elif num_a>0 and num_b==0:
            if A<2*C:
                return A*num_a
            else :
                return 2*C*num_a
        else :
            return 0
    else :
        return num_a*A+num_b*B
print(dp(X,Y))

Buggy python submission (verdict: Runtime Error):

A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b,num_ab_a,num_ab_b):
    if num_a<=0 and num_b<=0:return 0
    elif num_b!=0:
        return min(B+dp(num_a,num_b-1,num_ab_a,num_ab_b),C*2+dp(num_a-1,num_b-1,num_ab_a,num_ab_b))
    else:
        return min(A+dp(num_a-1,num_b,num_ab_a,num_ab_b),C*2+dp(num_a-1,num_b-1,num_ab_a,num_ab_b))
print(dp(X,Y,0,0))

Fixed submission:
A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b):
    """
    if num_a<=0 and num_b<=0:return 0
    elif num_b>0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
    """
    if A+B>2*C:
        if min(num_a,num_b)>0:
            if num_a > num_b:
                return num_b*2*C+dp(num_a-num_b,0)
            else :
                return num_a*2*C+dp(0,num_b-num_a)
        elif num_a==0 and num_b>0:
            if B<2*C:
                return num_b*B
            else :
                return C*2*num_b
        elif num_a>0 and num_b==0:
            if A<2*C:
                return A*num_a
            else :
                return 2*C*num_a
        else :
            return 0
    else :
        return num_a*A+num_b*B
print(dp(X,Y))
Buggy python submission (verdict: Runtime Error):

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):#//は切り捨て除算
    #Aの何倍が最適かを網羅的に走査
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w)),sorted(list(s))
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

Fixed submission:
N=int(input())
A=int(input())
print(N*N-A)

Buggy python submission (verdict: Runtime Error):

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

Fixed submission:
N=int(input())
A=int(input())
print(N*N-A)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Data=list(map(int,input().split()))
mindata=min(Data)-1
maxdata=max(Data)+1
ans=0
for i in range(mindata,maxdata+1):
    cnt=0
    for j in range(N):
        if abs(Data[j]-i)<=1:cnt+=1
    if ans<cnt:
        ans=cnt
    if ans==N:break
print(ans)


Fixed submission:
from collections import Counter

N=int(input())

counter=Counter(list(map(int,input().split())))
res=0

for i in counter:
    cnt=counter[i-1]+counter[i]+counter[i+1]
    if res<cnt:res=cnt
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())
Data=list(map(int,input().split()))
mindata=min(Data)-1
maxdata=max(Data)+1
ans=0
for i in range(mindata,maxdata+1):
    cnt=0
    for j in range(N):
        if abs(Data[j]-i)<=1:cnt+=1
    if ans<cnt:
        ans=cnt
print(ans)


Fixed submission:
from collections import Counter

N=int(input())

counter=Counter(list(map(int,input().split())))
res=0

for i in counter:
    cnt=counter[i-1]+counter[i]+counter[i+1]
    if res<cnt:res=cnt
print(res)
Buggy python submission (verdict: Runtime Error):
x = input()
if x % 2 == 0:
	print(x)
else:
	print(x*2)


Fixed submission:
x = int(input())
if x % 2 == 0:
	print(x)
else:
	print(x*2)
Buggy python submission (verdict: Runtime Error):

a = input()
b = input()

if a > 8:
	print ":("
elif b > 8:
	print ":("
else:
	print "Yay!"


Fixed submission:
l = map(int, raw_input().split())
a = l[0]
b = l[1]

if a > 8:
	print ":("
elif b > 8:
	print ":("
else:
	print "Yay!"
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = map(int, raw_input().split())

s = 1
count = 0

for i in xrange(0,n):
	if a[i]%2 == 0:
		s *= a[i]
		s = s >> 1
		count += 1

while(s%2 == 0):
	s = s >> 1
	count += 1

print count


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

l = []
s = 1
count = 0

while(len(a) != 0):

# for j in xrange(0,5):
	for i in xrange(0,len(a)):
		if a[i]%2 == 0 and a[i] != 0:
			l.append(a[i] >> 1)

	count += len(l)
	a = []
	a.extend(l)
	l = []

print count

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = map(int, raw_input().split())

s = 1
count = 0

for i in xrange(0,n):
	if a[i]%2 == 0:
		s *= a[i]

while(s%2 == 0):
	s = s >> 1
	count += 1

print count


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

l = []
s = 1
count = 0

while(len(a) != 0):

# for j in xrange(0,5):
	for i in xrange(0,len(a)):
		if a[i]%2 == 0 and a[i] != 0:
			l.append(a[i] >> 1)

	count += len(l)
	a = []
	a.extend(l)
	l = []

print count
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = list(raw_input())
ans = n

for i in range(0, n):
  tmp = l[:i].count("W") + l[i+1:].count("E")
  if tmp < ans:
    ans = tmp

print ans

Fixed submission:
n = input()
l = list(raw_input())
left = 0
right = l.count("E")
count = []

for i in range(0, n):
	if l[i] == "E":
		right -= 1

	count += [left + right]

	if l[i] == "W":
		left += 1

print min(count)

Buggy python submission (verdict: Runtime Error):
n = input()
l = list(raw_input(x))
ans = n

for i in range(0, n):
  tmp = l[:i].count("W") + l[i+1:].count("E")
  if tmp < ans:
    ans = tmp

print ans

Fixed submission:
n = input()
l = list(raw_input())
left = 0
right = l.count("E")
count = []

for i in range(0, n):
	if l[i] == "E":
		right -= 1

	count += [left + right]

	if l[i] == "W":
		left += 1

print min(count)