Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03071 (python)

Fixed submission:
A, B = (int(i) for i in input().split())  
coin = 0

if A >= B + 2:
    coin = A + (A-1)
elif A + 2 <= B:
    coin = B + (B-1)
else:
    coin = A + B
    
print(coin)

Buggy submission (verdict: Runtime Error):

N, K = (int(i) for i in input().split())
S = list(str(input()))

L0 = []
L1 = []

pre = -1
now = -1
count = 1

for i in range(1,len(S)):
    pre = int(S[i-1])
    now = int(S[i])
    
    if pre != now:
        if pre == 1:
            L1.append(count)
        else:
            L0.append(count)
        count = 1
        continue
    
    count += 1
        
    
if now  == 1:
    L1.append(count)
else:
    L0.append(count)


if int(S[0]) == 0 and int(S[-1]) == 0:
    L1.append(0)
    L1.insert(0,0)

if int(S[0]) == 1 and int(S[-1]) == 0:
    L1.append(0)

if int(S[0]) == 0 and int(S[-1]) == 1:
    L1.insert(0,0)        

maxi = 0


for i in range(len(L1)-1):
    sum1 = sum(L1[i:i+K+1])
    sum0 = sum(L0[i:i+K])
    sum_ = sum0 + sum1
    if maxi < sum_ :
        maxi = sum_
        
if maxi == 0:
    maxi = 1
    
print(maxi)
Problem p03125 (python)

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

if b%a == 0:
	c = a + b
else:
	c = b - a
    
print(c)

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())  
  
if b/a % 0:
	c = a + b
else:
	c = b - a
    
print(c)

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())  
  
if a/b % 0:
	c = a + b
else:
	c = b - a
    
print(c)
Problem p03455 (python)

Fixed submission:
a,b=map(int, input().split())
print("Even" if a*b%2==0 else "Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
if print("Even" if a*b%2==0 else "Odd")
Problem p03139 (python)

Fixed submission:
N, A, B = map(int, input().split())
a = min(A, B)
b = max(0, A + B - N)
print(a, b)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
AB = []
D = defaultdict(lambda: [])
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB.append((a - 1, b - 1))
    D[a - 1].append(b - 1)

z = [0]*N
for a, b in AB:
    z[b] += 1

ans = [-1]*N
root = z.index(0)
ok = [False]*N
def rec(u, p):
    ans[u] = p
    ok[u] = True
    for v in D[u]:
        z[v] -= 1
    for v in D[u]:
        if z[v] == 0 and not ok[v]:
            rec(v, u)


rec(root, -1)

for i in range(N):
    print(ans[i] + 1)
Problem p03141 (python)

Fixed submission:
N = int(input())
A, B = [], []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

AB = sorted([i for i in range(N)], key=lambda x: A[x] + B[x], reverse=True)
x, y = 0, 0
for (cnt, i) in enumerate(AB):
    if cnt % 2 == 0: 
        x += A[i]
    else:
        y += B[i]
print(x - y)

Buggy submission (verdict: Runtime Error):
import heapq
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append((a, i))
    B.append((b, i))

OA = A[:]
OB = B[:]
A.sort(key=lambda x:x[0])
B.sort(key=lambda x:x[0])


used = [False]*N
x, y = 0, 0
for _ in range(N):
    if _ % 2 == 0:
        while A:
            a, i = A.pop()
            if used[i]:
                continue
            b, j = B[-1]
            if a > b:
                x += a
                used[i] = True
            else:
                x += OA[j][0]
                used[j] = True
            break
    else:
        while B:
            b, i = B.pop()
            if used[i]:
                continue
            a, j = A[-1]
            if b > a:
                y += b
                used[i] = True
            else:
                y += OB[j][0]
                used[j] = True
            break
print(x - y)
Problem p03142 (python)

Fixed submission:
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
AB = []
D = defaultdict(lambda: [])
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB.append((a - 1, b - 1))
    D[a - 1].append(b - 1)

z = [0]*N
for a, b in AB:
    z[b] += 1

ans = [-1]*N
root = z.index(0)
ok = [False]*N
def rec(u, p):
    ans[u] = p
    ok[u] = True
    for v in D[u]:
        z[v] -= 1
    for v in D[u]:
        if z[v] == 0 and not ok[v]:
            rec(v, u)


rec(root, -1)

for i in range(N):
    print(ans[i] + 1)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
AB = defaultdict(list)
gain = [0]*N
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB[a - 1].append(b - 1)
    gain[b - 1] += 1

ans = [None]*N
def rec(u, p):
    ans[u] = p
    for v in AB[u]:
        gain[v] -= 1
    for v in AB[u]:
        if gain[v] == 0 and ans[v] is None:
            rec(v, u)

root = gain.index(0)
rec(root, -1)

for i in range(N):
    print(ans[i] + 1)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
D = defaultdict(lambda: [])
gain = [0]*N
for i in range(N + M - 1):
    a, b = map(int, input().split())
    D[a - 1].append(b - 1)
    gain[b - 1] += 1

ans = [None]*N
def rec(u, p):
    ans[u] = p
    for v in D[u]:
        gain[v] -= 1
    for v in D[u]:
        if gain[v] == 0 and ans[v] is None:
            rec(v, u)

root = gain.index(0)
rec(root, -1)

for i in range(N):
    print(ans[i] + 1)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N, M = map(int, input().split())
AB = []
D = defaultdict(lambda: [])
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB.append((a - 1, b - 1))
    D[a - 1].append(b - 1)

z = [0]*N
for a, b in AB:
    z[b] += 1

ans = [-1]*N
root = z.index(0)
ok = [False]*N
def rec(u, p):
    ans[u] = p
    ok[u] = True
    for v in D[u]:
        z[v] -= 1
    for v in D[u]:
        if z[v] == 0 and not ok[v]:
            rec(v, u)


rec(root, -1)

for i in range(N):
    print(ans[i] + 1)
Problem p03302 (python)

Fixed submission:
a,b = map(int, raw_input().split())
print "+" if a + b == 15 else "*" if a*b == 15 else "x"

Buggy submission (verdict: Runtime Error):
S = raw_input()
w = int(raw_input())
print "".join(S[i] for i in xrange(0, len(S), w))
Problem p03533 (python)

Fixed submission:
S = raw_input()
if "HA" not in S and "H" in S:
    S = S.replace("H", "HA")
if "BA" not in S and "B" in S:
    S = S.replace("B", "BA")
if "RA" not in S and "R" in S:
    S = S.replace("R", "RA")
if S[0] != "A":
    S = "A" + S
if S == "AKIHABARA":
    print "YES"
else:
    print "NO"

Buggy submission (verdict: Runtime Error):
inf = 1e18

N = int(raw_input())
HP = sorted(sorted([map(int, raw_input().split()) for i in xrange(N)]), key = lambda x:x[1])
dp =[inf] * 5005

for i in xrange(N):
    H, P = HP[i]
    for j in xrange(N + 1, -1, -1):
        if dp[j] < inf and dp[j] <= H:
            dp[j + 1] = min(dp[j + 1], dp[j] + P)
    dp[1] = min(dp[1], P)

ans = max(i for i in xrange(N + 1) if dp[i] < inf)

print ans

Buggy submission (verdict: Runtime Error):
S = raw_input()
if S.index("HA") == -1 and S.index("H") > 0:
    S = S.replace("H", "HA")
if S.index("BA") == -1 and S.index("B") > 0:
    S = S.replace("B", "BA")
if S.index("RA") == -1 and S.index("R") > 0:
    S = S.replace("R", "HA")
if S[0] != "A":
    S = "A" + S
if S == "AKIHABARA":
    print "YES"
else:
    print "NO"
Problem p03607 (python)

Fixed submission:
from collections import defaultdict 

N = int(raw_input())
d = defaultdict(int)
for i in xrange(N):
    A = int(raw_input())
    d[A] = (d[A] + 1) % 2
ans = 0
for v in d.values():
    ans += v
print ans

Buggy submission (verdict: Runtime Error):
import defaultdict from collections
N = int(raw_input())
d = defaultdict(int)
for i in xrange(N):
    A = int(raw_input())
    d[A] = (d[A] + 1) % 2
ans = 0
for v in d.values():
    ans += v
print ans
Problem p03856 (python)

Fixed submission:
W = ["dream", "dreamer", "erase", "eraser"]
S = raw_input()

while S:
    for w in W:
	if S.endswith(w):
             S = S[:-len(w)]
             break
    else:
        print "NO"
        break
else:
    print "YES"

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
class UnionFind:
    def __init__(self, size):
        self.rank = [0] * size
        self.par = range(size)

    def find(self, x):
        if x == self.par[x]: return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return

        if (self.rank[x] > self.rank[y]):
            self.par[y] = x
        else:
            self.par[x] = y
            if (self.rank[x] == self.rank[y]): self.rank[y] += 1

N, K, L = map(int, raw_input().split())
pq = [map(int, raw_input().split()) for i in xrange(K)]
rs = [map(int, raw_input().split()) for i in xrange(L)]

road = UnionFind(N)
rail = UnionFind(N)
for p, q in pq:
    road.unite(p - 1, q - 1)
for r, s in rs:
    rail.unite(r - 1, s - 1)

for i in xrange(N):
    road.find(i)
    rail.find(i)

pair = defaultdict(int) 
for i, j in zip(road.par, rail.par):
    pair[i, j] += 1

print " ".join(map(str, [pair[road.par[i], rail.par[i]] for i in xrange(N)]))
Problem p03919 (python)

Fixed submission:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]

for h in xrange(H):
	for w in xrange(W):
		if S[h][w] == "snuke":
			print alpha[w] + str(h + 1)
			exit()

Buggy submission (verdict: Runtime Error):
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]

for h in xrange(H):
	for w in xrange(W):
		if S[h][w] == "snuke":
			print alpha[w] + str(h + 1)
			exit()
torii@xps45:~/roiti46/procon/Contest/2
Problem p03922 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, M = map(int, raw_input().split())
X = map(int, raw_input().split())

cnt = [0]*100005
for x in X:
    cnt[x] += 1

pair = [0]*M
for i in xrange(100005):
    pair[i%M] += cnt[i]/2
    cnt[i] %= 2

mod = [0]*M
for i in xrange(100005):
    mod[i%M] += cnt[i]

ans = sum(pair)
for i in xrange(M):
    if i == 0 or i == M - i:
        ans += mod[i]/2 
        mod[i] %= 2
    else:
        m = min(mod[i], mod[M - i])
        ans += m
        mod[i] -= m
        mod[M - i] -= m

for i in xrange(1, M):
    while pair[i] >= 1 and mod[M - i] >= 2:
        ans += 1
        pair[i] -= 1
        mod[M - i] -= 2


print ans

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, M = map(int, raw_input().split())
X = map(int, raw_input().split())

cnt = [0]*100005
for x in X:
    cnt[x%M] += 1

ans = 0
for i in xrange(M):
    if i == M - i:
        ans += cnt[i]/2
        print "=", cnt[i]
        cnt[i] %= 2
    else:
        m = min(cnt[i], cnt[M - i])
        print min(cnt[i], cnt[M - i])
        ans += m
        cnt[i] -= m
        cnt[M - i] -= m
for i in xrange(M):
    ans += cnt
print ans
Problem p03970 (python)

Fixed submission:
S = raw_input()
T = "CODEFESTIVAL2016"
ans = 0
for i in xrange(len(S)):
    if S[i] != T[i]: ans += 1
print ans

Buggy submission (verdict: Runtime Error):
S = raw_input()
T = "CODEFESTIVAL2016"
ans = 0
for i in xrange(S):
    if S[i] != T[i]: ans += 1
print ans
Problem p03994 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

alpha = "abcdefghijklmnopqrstuvwxyz"

s = raw_input()
K = int(raw_input())
dic = dict([alpha[i], i] for i in xrange(len(alpha)))

ans = [] 
for si in s:
    d = 26 - dic[si] if si != "a" else 0
    if d <= K:
        ans.append("a")
        K -= d
    else:
        ans.append(si)

if K > 0:
    ans[-1] = alpha[(dic[ans[-1]] + K) % 26]

print "".join(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

alpha = "abcdefghijklmnopqrstuvwxyz"

s = raw_input()
K = int(raw_input())
dic = dict([alpha[i], i] for i in xrange(len(alpha)))

ans = [] 
for si in s:
    d = 26 - dic[si] if si != "a" else 0
    if d <= K:
        ans.append("a")
        K -= d
    else:
        ans.append(si)

if K > 0:
    ans[-1] = alpha[dic[ans[-1]] + K]

print "".join(ans)
Problem p03074 (python)

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

l, accum = len(s), []
i = 0
while i < l:
    ch = s[i]
    count = 0
    while i < l and s[i] == ch:
        count += 1
        i += 1
    accum.append(count)

l = len(accum)
for i in range(1, l): accum[i] += accum[i-1]

mx = accum[min(2*k - (1-int(s[0])), l-1)]
i = 1
while l > 1:
    idx = min(2*k - (1-int(s[0])) + 2*i, l-1)
    mx = max(accum[idx] - accum[2*(i-1)+int(s[0])], mx)
    if idx >= l-1: break
    i += 1
print(mx)

Buggy submission (verdict: Runtime Error):
l, accum = len(s), []
i = 0
while i < l:
    ch = s[i]
    count = 0
    while i < l and s[i] == ch:
        count += 1
        i += 1
    accum.append(count)

l = len(accum)
for i in range(1, l): accum[i] += accum[i-1]

mx = accum[min(2*k - (1-int(s[0])), l-1)]
i = 1
while l > 1:
    idx = min(2*k - (1-int(s[0])) + 2*i, l-1)
    mx = max(accum[idx] - accum[2*(i-1)+int(s[0])], mx)
    if idx >= l-1: break
    i += 1                                                                                                     
print(mx)

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

def count_consecutive(s):
    return max(list(map(lambda x: len(x), s.split('0'))))

def dfs(s, k, st):
    global mx
    if mx == N: return mx
    if k:
        for j in range(st, len(pos)):                                                                          
            i, count = pos[j]
            mx = max(dfs(s[:i] + '1'*count + s[i+count:], k-1, j+1), mx) 
    return max(count_consecutive(s), mx) 

l, mx, pos = len(s), 0, []
i = 0 
while i < l:
    if s[i] == '0':
        count = 0 
        while i+count < l and s[i+count] == '0':
            count += 1
        pos.append([i, count])
        i += count
    else:
        i += 1
print(dfs(s, k, 0))

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

l = len(s)
mx = 0 

def count_consecutive(s):
    return max(list(map(lambda x: len(x), s.split('0'))))

def dfs(s, k, st):
    global mx
    if k == 0: return count_consecutive(s)
    for i in range(st, l): 
        if s[i] == '0':
            count = 0 
            while i+count < l and s[i+count] == '0':
                count += 1
            mx = max(dfs(s[:i] + '1'*count + s[i+count:], k-1, i+count), mx) 
    return max(count_consecutive(s), mx)                                                                       

print(dfs(s, k, 0))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
lr = [0] * Q
for i in range(Q):
  lr[i] = list(map(lambda x: int(x) - 1, input().split()))
 
b, t = 0, [0]*N
for i in range(1, N):
  if S[i-1] == 'A' and S[i] == 'C':
    t[i] = t[i-1] + 1
  else: t[i] = t[i-1]
 
for i in range(Q):
  print(t[lr[i][1]] - t[lr[i][0]])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
lr = [0] * Q
for i in range(Q):
  lr[i] = list(map(int, input().split()))

b, t = 0, [0]*N
for i in range(1, N):
  if S[i-1:i+1] == 'AC':
    t[i] += 1
  else: t[i] = t[i-1]

for i in range(Q):
  print(t[lr[i][1]] - t[lr[i][0]])
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
b = [i for i in map(int, input().split())]
A = [0]*N
for i in range(N):
    A[i] = [i for i in map(int, input().split())]

count = 0 
for r in range(N):
    tmp = 0 
    for c in range(M):
        tmp += A[r][c] * b[c]
    tmp += C
    if tmp > 0: count += 1                                                                                     
    
print(count)

Buggy submission (verdict: Runtime Error):
import numpy
N, M, C = map(int, input().split())
b = numpy.array([i for i in map(int, input().split())])                                                        
A = numpy.array([[0]*M]*N)
for i in range(N):
    A[i] = [i for i in map(int, input().split())]

print(sum((numpy.matmul(A, b) + C) > 0))
Problem p03105 (python)

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

if b//a >= c: print(c)
else: print(b//a)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.__parent = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def union(self, x, y):
        pX, pY = self.find(x), self.find(y)
        if pX != pY:
            if pX < pY:
                self.__parent[pY] = pX
                self.size[pX] += self.size[pY]
            else:
                self.__parent[pX] = pY
                self.size[pY] += self.size[pX]                                                                 

    def find(self, x):
        if self.__parent[x] != x:
            self.__parent[x] = self.find(self.__parent[x])
        return self.__parent[x]

N, M = map(int, input().split())
bridge = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(M)]
uf = UnionFind(N)
num_disconnect = int(N*(N-1)/2)
ans = []
for a, b in reversed(bridge):
    ans.append(num_disconnect)
    pA, pB = uf.find(a), uf.find(b)
    if pA != pB:
        num_disconnect -= uf.size[pA] * uf.size[pB]
    uf.union(a, b)

for i in reversed(ans): print(i)
Problem p03071 (python)

Fixed submission:
a,b = map(int,(input().split()))
if a == b:
    ans = a*2
    print(ans)
else:
    big = max(a,b)
    ans = big + (big-1)
    print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
h = list(map(int,input().split()))
h1 = h[0]
hi = h[-1]
hi2 = h[-2]
count = 0
ans = [count + 1 for t in h if t >= h1]
if hi2 > hi and hi2 >= h1:
    ans -= 1
print(count)

Buggy submission (verdict: Runtime Error):
n=input()
h = list(map(int,input().split()))
h1 = h[0]
hi = h[-1]
hi2 = h[-2]
count = 0
for takasa in h:
    if takasa >= h1:
        count+= 1
if hi2 > hi and hi2 >= h1:
    count -= 1
print(count)

Buggy submission (verdict: Runtime Error):
n=input()
h = list(map(int,input().split()))
h1 = h[0]
hi = h[-1]
hi2 = h[-2]
count = 0
for takasa in h:
    if takasa >= h1:
        count+= 1
if hi2 > hi and hi2 >= h1:
    count -= 1
print(count)
Problem p03813 (python)

Fixed submission:
x = int(input())
if x < 1200:
    print("ABC")
else:
    print("ARC")

Buggy submission (verdict: Runtime Error):
x = input()
for ans in x:
    if ans < 1200:
        print("ABC")
    else:
        print("ARC")

Buggy submission (verdict: Runtime Error):
x = (input())
for ans in x:
    if ans < 1200:
        print("ABC")
    else:
        print("ARC")
Problem p03943 (python)

Fixed submission:
a,b,c = sorted(map(int, input().split()))
if a+b==c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a=b+c or b=a+c or c=a+b:
    print("Yes")
else:
    print("No")
Problem p03962 (python)

Fixed submission:
s = map(int,input().split())
ans = set(s)
print(len(ans))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
s = set{a,b,c}
print(len(s))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(len(set{a,b,c}))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
ans = len(set(a,b,c))
print(ans)
Problem p04029 (python)

Fixed submission:
x = int(input())
print(int(x*(x+1)/2))

Buggy submission (verdict: Runtime Error):
print(map(lambda x:x*(x+1)/2,input())
Problem p03260 (python)

Fixed submission:
if __name__ == '__main__':
  
	num = input().split()

	if int(num[0]) * int(num[1]) % 2 ==0:
		print("No")
	else:
  		print("Yes")

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
  
	num = input()

	if int(num[0]) * int(num[1]) % 2 ==0:
		print("No")
	else:
  		print("Yes")

Buggy submission (verdict: Runtime Error):
num = input().split()

if num[0] * num[1] % 2 == 0 :
  print("No")
else:
  print("Yes")
Problem p03238 (python)

Fixed submission:
N=int(input())
if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N==1:
    print("Hello World")
else:
    A,B=map(int,input().split())
    print(A+B)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N=1:
    print("Hello World")
else:
    A,B=map(int,input().split())
    print(A+B)
Problem p03644 (python)

Fixed submission:
import math
print(2**int(math.log2(int(input()))))

Buggy submission (verdict: Runtime Error):
import math
print(2**int(log2(int(input()))))

Buggy submission (verdict: Runtime Error):
print(2**int(log2(int(input()))))
Problem p03325 (python)

Fixed submission:
n = map(int, input())
alist = list(map(int, input().split(" ")))

def two_factor(n) :
    cnt = 0

    while n % 2 == 0:
        n /= 2
        cnt += 1

    return cnt 
    
fact_cnt = 0
for a in alist :
    fact_cnt += two_factor(a)
    
print(fact_cnt)

Buggy submission (verdict: Runtime Error):
n = map(int, input())
alist = list(map(int, input().split(" ")))

def do_sunuke(l, cnt) : 
    reslist = []
    flg_div2 = 0

    for a in l :
        if a % 2 == 0 and flg_div2 == 0 :
            reslist.append(int(a/2))
            flg_div2 = 1
        else :
            reslist.append(a)

    if flg_div2 == 0 :
        return cnt
    else : 
        return do_sunuke(reslist, cnt + 1)
    
print(do_sunuke(alist, 0))

Buggy submission (verdict: Runtime Error):
# input 
n = map(int, input())
a = map(int, input().split(" "))

# make list 
curlist = list(a)

# du recurse
def sunukeList(curlist, cnt) :
    print("DBG : ", curlist)
    reslist = []
    flg_div2 = 0
    flg_did3 = 0

    for i in curlist :    
        # if divisible by two then divide
        if i%2 == 0 and flg_div2 == 0: 
            reslist.append(int(i/2))
            flg_div2 = 1
        else :
            reslist.append(i*3)
            flg_did3 = 1

    if flg_div2 == 0 :
        print(cnt)
    else :
        sunukeList(reslist, cnt + 1)
        
# calc
sunukeList(curlist, 0)