Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#coding=utf-8

def solve(A, B):
    count = 0
    for b in range(B + 1, A + 1):
        for a in range(1, A + 1):
            if a % b >= B:
                count += 1
    return count

def main():
    A, B = input().split(' ')
    print(solve(int(A), int(B)))


if __name__ == '__main__':
    main()



Fixed submission:
#coding=utf-8

def solve(N, K):
    count = 0
    if K == 0:
        return N * N
    for b in range(K + 1, N + 1):
        p = N // b
        r = N % b
        count += p * (b - K)
        if r >= K:
            count += r - K + 1
    return count

def main():
    A, B = input().split(' ')
    print(solve(int(A), int(B)))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    k = len(n)
    c = str(n)[k - 1]
    if str(n)[1..k] = '9' * k:
        return c + 9 * (k - 1)
    return c + 9 * (k - 1)  - 1

if __name__ == "__main__":
    n = int(input())
    print(solve(n))


Fixed submission:
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    if n <= 0:
        return 0
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))

Buggy python submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    k = len(n)
    c = str(n)[k - 1]
    if str(n)[1..k] = '9' * k:
        return c + 9 * (k - 1)
    return c + 9 * (k - 1)  - 1

if __name__ == "__main__":
    n = int(input())
    print(solve(n))


Fixed submission:
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    if n <= 0:
        return 0
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))

Buggy python submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))


Fixed submission:
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    if n <= 0:
        return 0
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))
Buggy python submission (verdict: Runtime Error):
x = int(iput())
ans = 'ABC' if x<1300 else 'ARC'
print(ans)


Fixed submission:
x = int(input())
ans = 'ABC' if x<1200 else 'ARC'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
tmp = 0
for idx, n in enumerate(s):
	if n=='A': 
		for idxx, nn in enumerate(s[-1:idx:-1]):
			if nn=='Z':
				tmp = max((len(s)-idxx)-idx, tmp)
		
print(tmp)

Fixed submission:
"""
一番左のaの位置と一番右のzの位置だけわかればよい
"""
s = input()
a = s.index('A')
z = len(s)-s[::-1].index('Z')
print(z-a)

Buggy python submission (verdict: Runtime Error):
s = int(input())
tmp = 0
for idx, n in enumerate(s):
	if n=='A': 
		for idxx, nn in enumerate(s[-1:idx:-1]):
			if nn=='Z':
				tmp = max((len(s)-idxx)-idx, tmp)
		
print(tmp)


Fixed submission:
"""
一番左のaの位置と一番右のzの位置だけわかればよい
"""
s = input()
a = s.index('A')
z = len(s)-s[::-1].index('Z')
print(z-a)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
townpos = map(int, input().split())
step = townpos[0]
tsukare = 0
for x in townpos[1:]:
    tsukare += min((x-step)*a, b)
    step=x
print(tsukare)

Fixed submission:
#listつけわすれ
n, a, b = map(int, input().split())
townpos = list(map(int, input().split()))
step = townpos[0]
tsukare = 0
for x in townpos[1:]:
    tsukare += min((x-step)*a, b)
    step=x
print(tsukare)
Buggy python submission (verdict: Runtime Error):
f = map(int, input().split())
f = sorted(f)
if f==[5, 5, 7]:


Fixed submission:
f = map(int, input().split())
f = sorted(f)
if f==[5, 5, 7]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
#pythonだとsortでそのまま何文字でもソートしてくれる
n, l = map(int, input().split())
s = [input()  for _ in range(n)]]
print(''.join(sorted(s)))

Fixed submission:
n, l = map(int, input().split())
s = [input()  for _ in range(n)]
print(''.join(sorted(s)))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
dislikes = list(map(int, input().split())
m = n
while True:
    m = list(str(m))
    l = []
    for p in m:
        if int(p) not in dislikes:
            l.append(p)
            continue
        else:
            m = int(''.join(m))+1
            break
    if len(l) >= len(str(n)):
        if int(''.join(l))>=n:
            break
print(''.join(m))

Fixed submission:
n, k = map(int, input().split())
dislikes = list(map(int, input().split()))
m = n
while True:
    m = list(str(m))
    l = []
    for p in m:
        if int(p) not in dislikes:
            l.append(p)
            continue
        else:
            m = int(''.join(m))+1
            break
    if len(l) >= len(str(n)):
        if int(''.join(l))>=n:
            break
print(''.join(m))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split()) 
c=
 
if (a*b)%2==0:
  print("even")
else:
  print("odd")


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

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
 
c=a*b
 
if(c20==0) print("even")
else print("odd")


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

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

c=a*b

if(c%0==0) print("even")
else print("odd")

Fixed submission:
a, b = map(int, input().split())
 
if (a * b) % 2 == 0:
    print("Even")
elif (a * b) % 2 != 0:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
mi=[int(input()) for _ in range(N)]
  
print(N+(X-sum(mi))//min(mi))

Fixed submission:
inp = input()
print(inp.count("1"))

Buggy python submission (verdict: Runtime Error):
inp = map(str,input())

print(inp.count(1))



Fixed submission:
inp = input()
print(inp.count("1"))

Buggy python submission (verdict: Runtime Error):
% input ex."101"
masu = input()

i=0
out=0
while i< len(masu):
  out+=masu[i]
print(out)
      


Fixed submission:
inp = input()
print(inp.count("1"))
Buggy python submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy python submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy python submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy python submission (verdict: Runtime Error):
#3
#8
n=int(input())
ai=list(map(int(),input.split()))
        
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy python submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
        
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
    b.append(count)
print(min(b))


Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[]
for n in range(1,N,1):
  count=0
  while n%2 == 0:
    count+=1
    n/=2
  a.append(count)

Nmax=a.index(max(a))+1
Tmax=max(a)

Fixed submission:
N=int(input())
a=[]
for b in range(1,N+1,1):
  count=0
  while b%2 == 0:
    count+=1
    b/=2
  a.append(count)

print(a.index(max(a))+1)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=[int(i) for i in input().split()]
count=0
for i in range(0,K+1):
        for j in range(0,K+1):
            for k in range(0,K+1):
                 if i+j+k==S:
                    count+=1
print(count)

Fixed submission:
K,S=[int(i) for i in input().split()]
count=0
for i in range(0,K+1):
        for j in range(0,K+1):
            k=S-i-j
            if 0<=k<=K:
                count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=[int(i) for i in input().split()]
count=0
for i in range(0,K+1):
        for j in range(0,K+1):
            for k in range(0,K+1):
                 if i+j+k==S:
                    count+=1
print(count)

Fixed submission:
K,S=[int(i) for i in input().split()]
count=0
for i in range(0,K+1):
        for j in range(0,K+1):
            k=S-i-j
            if 0<=k<=K:
                count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
Ds=list(input().split())
Di=list(map(int,Ds))
nex=[1]*10
for i in reversed(Di):
    nex[i-1]=nex[i]+1

def check(n):
    ns = str(N)
    for nss in ns:
        if nss in Ds:
            return False
    return True

def next(i):
    global N
    ns='{0:0>4}'.format(N)
    t=nex[int(ns[i])]
    pp=int(ns[i])+t
    if pp >=10:
        t=t-10
        N+=t*(10**(3-i))
        next(i-1)
    else:
        N+=t*(10**(3-i))

while not check(N):
    next(3)
print(N)

Fixed submission:
N,K=map(int,input().split())
Ds=list(input().split())
Di=list(map(int,Ds))
nex=[1]*10
for i in reversed(Di):
    nex[i-1]=nex[i]+1

def check(n):
    ns = str(N)
    for nss in ns:
        if nss in Ds:
            return False
    return True

def next(i):
    global N
    ns='{0:0>5}'.format(N)
    t=nex[int(ns[i])]
    pp=int(ns[i])+t
    if pp >=10:
        t=t-10
        N+=t*(10**(4-i))
        next(i-1)
    else:
        N+=t*(10**(4-i))

while not check(N):
    next(4)
print(N)
Buggy python submission (verdict: Time Limit Exceeded):
#ABC 094 Many Medians

numbers=int(input())
list_num=[int(i) for i in input().split()]
sorted_list=sorted(list_num)

median1=sorted_list[int(numbers/2)-1]
median2=sorted_list[int(numbers/2)]

for i in list_num:
    if sorted_list.index(i) <= numbers/2-1:
        print(median2)
    else:
        print(median1)

Fixed submission:
numbers=int(input())
list_num=[int(i) for i in input().split()]
sorted_list=sorted(list_num)

median1=sorted_list[int(numbers/2)-1]
median2=sorted_list[int(numbers/2)]

for i in list_num:
    if i <= median1:
        print(median2)
    else:
        print(median1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import copy
# スペース区切りの整数の入力
N = int(input())
X = list(map(int, input().split()))
md = int(N/2)
d = {}
for x in X:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

for i in range(N):
    d_cp = copy.deepcopy(d)
    d_cp[X[i]] += -1
    sum_w = 0
    cum = []
    for i, key in enumerate(d_cp):
        sum_w += d_cp[key]
        cum.append([i,key,sum_w])
    for i,key,c in cum:
        if c >= md:
            print(key)
            break


Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A,B,X = map(int, input().split())

if A + B >= X and A <= X:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import copy
# スペース区切りの整数の入力
N = int(input())
X = list(map(int, input().split()))
md = int(N/2)
d = {}
for x in X:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

for i in range(N):
    d_cp = copy.deepcopy(d)
    d_cp[X[i]] += -1 
    sum_w = 0
    cum = []
    for i, key in enumerate(d_cp):
        sum_w += d_cp[key]
        cum.append([i,key,sum_w])
    for i,key,c in cum:
        if c >= md:
            print(key)
            break

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A,B,X = map(int, input().split())

if A + B >= X and A <= X:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import numpy as np

#### 入力フェーズ開始 ####
HWD = input().split()
H = int(HWD[0])
W = int(HWD[1])
D = int(HWD[2])

A = []
for i in range(H):
    Ai = []
    Ai_raw = input().split()
    for j in range(W):
        Ai.append(int(Ai_raw[j]))
    A.extend(Ai)

Q = int(input())
L = []
R = []
for i in range(Q):
    LRi_raw = input().split()
    L.append(int(LRi_raw[0]))
    R.append(int(LRi_raw[1]))

#### 入力フェーズここまで ####
#### 計算フェーズここから ####

# 各移動で踏むA_ijとそのx,yの値にindexベースで参照できるように
# A_ijの値でindexをソートしておく
x_ = np.arange(W)
x = np.tile(x_, H)
y_ = np.arange(H)
y = np.repeat(y_, W)
# A_ijの値でsortした時のindexの順番を取得
B = np.argsort(A)

for q in range(Q):
    # 各実技試験につき
    score = 0
    Li = L[q]
    Ri = R[q]
    M = int((Ri - Li) / D) # 何回移動が必要か
    m_vec = [Li + D * m for m in range(M+1)] # 通るA_ijの値

    for m in range(M):
        # 各移動につき
        id_from = B[m_vec[m] - 1]
        id_to = B[m_vec[m+1]- 1]
        score += np.abs(x[id_from] - x[id_to]) + np.abs(y[id_from] - y[id_to])

    print(score)


Fixed submission:
N = input()
m = int(int(N)/3)
print(m)

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

return int( N / 3 )


Fixed submission:
N = input()
m = int(int(N)/3)
print(m)

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

return int( N / 3 )


Fixed submission:
N = input()
m = int(int(N)/3)
print(m)

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

def groupMaker(N):
    if N < 0 or N > 100:
        print('invalid input')
        return -1
    m = N / 3
    return int(m)

return groupMaker(N)

Fixed submission:
N = input()
m = int(int(N)/3)
print(m)
Buggy python submission (verdict: Runtime Error):
a = [int(i) for i in list(input())]
enzan = ['+', '+', '+']
res = 0
for i in range(2):
	if i == 0:
		enzan[0] = '+'
		b = a[0] + a[1]
	else:
		enzan[0] = '-'
		b = a[0] - a[1]
	for j in range(2):
		if j == 0:
			enzan[1] = '+'
			c = b + a[2]
		else:
			enzan[1] = '-'
			c = b - a[2]
		for k in range(2):
			if k == 0:
				enzan[2] = '+'
				d = c + a[3]
			else:
				enzan[2] = '-'
				d = b - a[3]
			if d1 == 7:
				print(str(a[0])+enzan[0]+str(a[1])+enzan[1]+str(a[2])+enzan[2]+str(a[3])+'=7')

Fixed submission:
a = list(input())
if ((a[0] == a[1]) and (a[1] == a[2])) or ((a[1] == a[2]) and (a[2] == a[3])):
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
res = [0 for i in range(1000)]
res[1] = 2
res[2] = 1
def lucas(N):
	for i in range(3, N+1):
		res[i] = res[i - 1] + res[i - 2]
	return res[N]

print(lucas(N+1))

Fixed submission:
a = list(input())
if ((a[0] == a[1]) and (a[1] == a[2])) or ((a[1] == a[2]) and (a[2] == a[3])):
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
res = [0 for i in range(100000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))

Fixed submission:
a = list(input())
if ((a[0] == a[1]) and (a[1] == a[2])) or ((a[1] == a[2]) and (a[2] == a[3])):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = [0 for i in range(1000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))

Fixed submission:
N = int(input())
res = [0 for i in range(100)]
res[0] = 2
res[1] = 1
for i in range(2, N+1):
	res[i] = res[i - 1] + res[i - 2]
print(res[N])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = [0 for i in range(100000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))

Fixed submission:
N = int(input())
res = [0 for i in range(100)]
res[0] = 2
res[1] = 1
for i in range(2, N+1):
	res[i] = res[i - 1] + res[i - 2]
print(res[N])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = (int(i) for i in input().split())
#m = [[int(i) for i in input().split] for i in range(1)]
m = []
for i in range(10):
    m.append(list(map(int, input().split())))
wall = []
for i in range(H):
	wall.append(list(map(int, input().split())))
# wall = [[int(i) for i in input().split] for i in range(H)]
cost = 0

def search(i,current_cost,min_cost):
	for j in range(10):
		if i != j:
			if current_cost + m[i][j] < min_cost:
				if j == 1:
					min_cost = current_cost + m[i][j]
					# return current_cost + m[i][j]
				else:
					tmp = search(j, current_cost + m[i][j], min_cost)
					if tmp < min_cost:
						min_cost = tmp
	return min_cost
for i in range(H):
	for j in range(W):
		if wall[i][j] != 1 and wall[i][j] != -1:
			cost += search(wall[i][j], 0, m[wall[i][j]][1])

print(cost)

Fixed submission:
H, W = (int(i) for i in input().split())
#m = [[int(i) for i in input().split] for i in range(1)]
m = []
for i in range(10):
    m.append(list(map(int, input().split())))
wall = []
for i in range(H):
	wall.append(list(map(int, input().split())))
# wall = [[int(i) for i in input().split] for i in range(H)]
cost = 0

for k in range(10):
    for i in range(10):
        for j in range(10):
            if m[i][j] > m[i][k] + m[k][j]:
                m[i][j] = m[i][k] + m[k][j]

for i in range(H):
	for j in range(W):
		if wall[i][j] != 1 and wall[i][j] != -1:
			cost += m[wall[i][j]][1]

print(cost)
Buggy python submission (verdict: Runtime Error):
nyuu=input()
(a,b)=nyuu,split()
a=int(a)
b=int(b)
c=a*b
if c%2==0:
    print("Odd")
else :
    print("Even")


Fixed submission:
nyuu=input()
(a,b)=nyuu.split()
a=int(a)
b=int(b)
c=a*b
if c%2==1:
    print("Odd")
else :
    print("Even")
Buggy python submission (verdict: Time Limit Exceeded):
tuple=input()
list=tuple.split()
list=[int(i) for i in list]
N=list[0]
Y=list[1]
for i in range(int(Y/10000)+1):
    for j in range(int((Y-10000*i)/5000)+1):
        for k in range(int((Y-10000*i-5000*j)/1000)+1):
            if 10000*i+5000*j+1000*k==Y and i+j+k==N:
                print(i,j,k)
                exit()
print("-1 -1 -1")


Fixed submission:
tuple=input()
list=tuple.split()
list=[int(i) for i in list]
N=list[0]
Y=list[1]
for i in range(int(Y/10000)+1):
    for j in range(int((Y-10000*i)/5000)+1):
            if 10000*i+5000*j+1000*(N-i-j)==Y :
                print(i,j,N-i-j)
                exit()
print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for num in nums:
    if num % 2 == 0:
      continue
    else:
      b_flag = True
      break
  if b_flag:
    break
  ct += 1
print(ct)

Fixed submission:
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for i, num in enumerate(nums):
    if num % 2 == 0:
      nums[i] = num/2
      continue
    else:
      b_flag = True
      break  
  if b_flag:
    break
  ct += 1
print(ct)

Buggy python submission (verdict: Time Limit Exceeded):
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for num in nums:
    if num % 2 == 0:
      continue
    else:
      b_flag = True
      break
  if b_flag:
    break
  ct += 1
print(ct)
  

Fixed submission:
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for i, num in enumerate(nums):
    if num % 2 == 0:
      nums[i] = num/2
      continue
    else:
      b_flag = True
      break  
  if b_flag:
    break
  ct += 1
print(ct)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())

    Ai_to_num = {}
    for _ in range(N):
        Ai = input()
        if Ai in Ai_to_num.keys():
            Ai_to_num[Ai] += 1
        else:
            Ai_to_num[Ai] = 1
    ct = 0
    for num_i in Ai_to_num.values():
        if num_i % 2:
            ct += 1
    
    print(ct)

main()


Fixed submission:
def main():
    N = int(input())

    Ai_to_num = {}
    for _ in range(N):
        Ai = input()
        if Ai in Ai_to_num.keys():
            Ai_to_num[Ai] += 1
        else:
            Ai_to_num[Ai] = 1
    ct = 0
    for num_i in Ai_to_num.values():
        if num_i % 2:
            ct += 1
    
    print(ct)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = input()
    
    a_s =list(map(int, input().split()))

    ai_to_a_num = {}
    for ai in a_s:
        if ai in ai_to_a_num.keys():
            ai_to_a_num[ai] += 1
        else:
            ai_to_a_num[ai] = 1
    
    max_num = 0
    for ai in ai_to_a_num.keys():
        num = 0
        num += ai_to_a_num[ai]
        if ai-1 in ai_to_a_num.keys():
            num += ai_to_a_num[ai-1]
        if ai+1 in ai_to_a_num.keys():
            num += ai_to_a_num[ai+1]
        max_num = max(max_num, num)
    
    print(max_num)

main()


Fixed submission:
def main():
    N = input()
    
    a_s =list(map(int, input().split()))

    ai_to_a_num = {}
    for ai in a_s:
        if ai in ai_to_a_num.keys():
            ai_to_a_num[ai] += 1
        else:
            ai_to_a_num[ai] = 1
    
    max_num = 0
    for ai in ai_to_a_num.keys():
        num = 0
        num += ai_to_a_num[ai]
        if ai-1 in ai_to_a_num.keys():
            num += ai_to_a_num[ai-1]
        if ai+1 in ai_to_a_num.keys():
            num += ai_to_a_num[ai+1]
        max_num = max(max_num, num)
    
    print(max_num)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main(): 
    
    S = input()
    stack = []
    
    strs = S
    cmps = ["dream", "dreamer", "erase", "eraser"]

    while(1):
        if not cmps:
            if stack:
                strs, cmps = stack.pop()
            else:
                print("NO")
                return

        cmp_i = cmps.pop()
        if strs[:len(cmp_i)] == cmp_i:
            if cmps:
                stack.append((strs, cmps))

            strs = strs[len(cmp_i):]
            if strs == "":
                print("YES")
                return
            else:
                cmps = ["dream", "dreamer", "erase", "eraser"]

if __name__ == "__main__":
    main()
    


        


Fixed submission:
from collections import deque

def main():
    divide = ["dream", "dreamer", "erase", "eraser"]

    S = input()

    q = deque([0])

    while(q):
        beg_i = q.popleft()

        if beg_i == len(S):
            print("YES")
            return
        
        for div_i in divide:
            end_i = beg_i + len(div_i)
            if S[beg_i:end_i] == div_i:
                q.append(end_i)
    
    print("NO")
    return

main()