Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#0が1をスペース区切りで3つ入力
a, b, c = map(int, input().split())

#aからcそれぞれが1と等しいかどうかを判断し、等しいのであれば順次iに1を足していく
i = 0

#aについて
if a==1:
    i += 1
    
#bについて
if b==1:
    i += 1    

#cについて
if c==1:
    i += 1
    
#出力
print(i)

Fixed submission:
#0が1を3つ入力
a, b, c = map(int, input())

#aからcそれぞれが1と等しいかどうかを判断し、等しいのであれば順次iに1を足していく
i = 0

#aについて
if a==1:
    i += 1
    
#bについて
if b==1:
    i += 1    

#cについて
if c==1:
    i += 1
    
#出力
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
#入力
K, S = map(int, input().split())

#問題文よりX, Y, Zの最大値はKである
X = range(K+1)
Y = range(K+1)
Z = range(K+1)

#フラグ設定
flag = 0

#全探索
for x in X:
    for y in Y:
        for z in Z:
            
            #条件
            if x+y+z==S:
                flag += 1

#出力
print(flag)

Fixed submission:
#入力
K, S = map(int, input().split())

#問題文よりX, Y, Zの最大値はKであるため、各値の最大値はKである
X = range(K+1)
Y = range(K+1)

#フラグ設定
flag = 0

#全探索
for x in X:
    for y in Y:
        #条件に合うzの値を算出
        z = S - x - y
        if z<=K and z>=0:  #上で求めたzの値に問題文からFilterを掛ける
            flag += 1

#出力
print(flag)
Buggy python submission (verdict: Runtime Error):
math_line = list(map(int,input().split()))
input_line = list(map(int,input().split()))

area = math_line[0]*math_line[1]　

black_cell = math_line[0]*input_line[1] + math_line[1]*input_line[0] 
duplicate =  black_cell - input_line[0]*input_line[1]

white_cell = area - duplicate

print(white_cell)

Fixed submission:
math_line = list(map(int,input().split()))
input_line = list(map(int,input().split()))

area = math_line[0]*math_line[1]
black_cell = math_line[0]*input_line[1] + math_line[1]*input_line[0]
duplicate =  black_cell - input_line[0]*input_line[1]
white_cell = area - duplicate

print(white_cell)
Buggy python submission (verdict: Time Limit Exceeded):

n, m = map(int, input().split())
sumans = 0
ans = 0

list = [[0 for i in range(2)] for j in range(n)]
#print(list)

for i in range(n):
	list[i][0], list[i][1]= map(int, input().split())

#print(sorted(list))
	
list = sorted(list)

for i in range(n):
	for j in range(int(list[i][1])):
		sumans += list[i][0]
		ans += 1
		if ans == m:
			print(sumans)

Fixed submission:
import sys
n, m = map(int, input().split())
sumans = 0
ans = 0

list = [[0 for i in range(2)] for j in range(n)]

for i in range(n):
	list[i][0], list[i][1]= map(int, input().split())
	
list = sorted(list)

for i in range(n):
	for j in range(int(list[i][1])):
		sumans += list[i][0]
		ans += 1
		if ans == m:
			print(sumans)
			sys.exit()
Buggy python submission (verdict: Runtime Error):
return math.min(math.floor(A/B), C)

Fixed submission:
A,B,C = input().split()
result = min(int(int(B)/int(A)), int(C))
print(result)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split("/"))

if a[0]== 2019 and a[1]<=430 or a[0]<2019 :
    print('Heisei')
else:
   print('TBD')

Fixed submission:
a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")

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

if a[0]>= 2019:
    print("Heisei")
else:
    print("TBD")



Fixed submission:
a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")

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

if  a[0]>= 2019
    print("Heisei")
else:
    print("TBD")


Fixed submission:
a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")

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

del a[4]
del a[7]

b =sum(a)
q = 19
if q <=a:
    print("Heisei")
else :
    print("TBD")

Fixed submission:
a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int,input().split())
K = int(input())
L = [A, B, C]
S = sorted(L)

print(S[2] * 2 ** K + S[0] + S[1])


Fixed submission:
A, B = input().split()
A = int(A)
B = int(B)

if B >= A:
    print(A)
else:
    print(A-1)
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = [input() for i in range(l)]
s.sort()
mojiretu = ''

for x in s:
    mojiretu += x
print(mojiretu)

Fixed submission:
n, l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
mojiretsu = ''

for x in s:
    mojiretsu += x
print(mojiretsu)
Buggy python submission (verdict: Runtime Error):
cat, doccat, cat_much = input().split(" ")

If cat > cat_much:
    answer = "No"
elif cat == cat_much:
    answer = "no"
else cat < cat_much:
    elif cat + doccat >= cat_much:
        answer = "yes"
    else cat + doccat < cat_much

print(answer)

Fixed submission:
cat, doccat, cat_much = input().split(" ")

if int(cat) > int(cat_much):
    answer = "NO"
elif int(cat) == int(cat_much):
    answer = "YES"
else:
    if int(cat) + int(doccat) >= int(cat_much):
        answer = "YES"
    else:
        answer = "NO"

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

product = a*b

If product = 0;
    answer = "Even"
else;
    answer = "Odd"

print(answer)

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

product = a*b
surplus = product % 2

if surplus == 0:
    answer = "Even"
else:
    answer = "Odd"

print(answer)
Buggy python submission (verdict: Runtime Error):
H,W = list(map(int, input().split()))
h,w = list(map(int, input().split()))
print(W*H-(W-w)*(H-h)

Fixed submission:
H,W = list(map(int, input().split()))
h,w = list(map(int, input().split()))
print((W-w)*(H-h))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = list(map(int, input().split()))
l = s[0]

while True:
    tmp = s[0]
    s[0] = s[1]
    s[1] = tmp - s[1]
    s = np.sort(s)[::-1]
    
    if s[0] == s[1]:
        l += s[0]
        break
    else:
        l = l + s[1] * 2

print(l)

Fixed submission:
# %%time
import numpy as np
n, x = list(map(int, input().split()))
s = 0
a = [n-x, x]
s += n
# print(a,s)
while True:
#     if a[0] == a[1]:
#         s += a[0]
#         break
#     else:
    mi = np.min(a)
    ar = np.argmax(a)
    num = a[ar]//mi
    a[ar] -= mi * num
    s += 2 * mi * num
#     print(a, s)
    if np.min(a) == 0:
        s -= mi
        break
            
print(s)
Buggy python submission (verdict: Runtime Error):
input_lines = sys.stdin.read()

[H W] = input_lines[0].split()
[h w] = input_lines[1].split()

ans = H*W-h*W-H*w+h*w
print(ans)

Fixed submission:
H,W = map(int, input().split())
h,w = map(int, input().split())

ans = H*W-h*W-H*w+h*w
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = []

for i in range(20):
	A.append(map(int, input().split()))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)


Fixed submission:
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []

for i in range(N):
	A.append(list(map(int, input().split())))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = [[0 for i in range(M)] for j in range(N)]

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)


Fixed submission:
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []

for i in range(N):
	A.append(list(map(int, input().split())))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = [[0 for i in range(M)] for j in range(N)]

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for n in range(M):
		tmp += A[i][n]*B[n]
	if(tmp+C>0):
		ans += 1

print(ans)


Fixed submission:
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []

for i in range(N):
	A.append(list(map(int, input().split())))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = []

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for n in range(M):
		tmp += A[i][n]*B[n]
	if(tmp+C>0):
		ans += 1

print(ans)


Fixed submission:
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []

for i in range(N):
	A.append(list(map(int, input().split())))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0
for i in range(N):
	idx = A.index(min(A))
	
	if(sum+B[idx] >= M):
		for i in range(B[idx]):
			ans += A[idx]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx]*B[idx]
	sum += B[idx]
	A[idx] = 1000000000
print(ans)


Fixed submission:
import numpy as np

N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0

idx = np.argsort(A)

for i in range(N):
	if(sum+B[idx[i]] >= M):
		for j in range(B[idx[i]]):
			ans += A[idx[i]]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx[i]]*B[idx[i]]
	sum += B[idx[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0
for i in range(N):
	idx = A.index(min(A))
	
	if(sum+B[idx] >= M):
		for i in range(B[idx]):
			ans += A[idx]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx]*B[idx]
	sum += B[idx]
	A[idx] = 10000000
print(ans)


Fixed submission:
import numpy as np

N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0

idx = np.argsort(A)

for i in range(N):
	if(sum+B[idx[i]] >= M):
		for j in range(B[idx[i]]):
			ans += A[idx[i]]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx[i]]*B[idx[i]]
	sum += B[idx[i]]
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int, input().split()))
A = []
B = []

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0
for i in range(N):
	idx = num_list.index(min(A))
	sum += A[idx]*B[idx]
	A[idx] = 10000000
	ans += 1
	if(sum >= M):
		break

print(ans)


Fixed submission:
import numpy as np

N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0

idx = np.argsort(A)

for i in range(N):
	if(sum+B[idx[i]] >= M):
		for j in range(B[idx[i]]):
			ans += A[idx[i]]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx[i]]*B[idx[i]]
	sum += B[idx[i]]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = input().split()
h_list = [int(s) for s in h]
cost = [0 for i in range(n)]
for i in range(n):
    if i == 0:
        cost[i] = 0
        continue
    if i == 1:
        cost[i] = abs(h_list[i] - h_list[i - 1])
        continue
    k_list = []
    for j in range(k):
        if i - j - 1 < 0:
            break
        k_list.append(cost[i - j - 1] + abs(h_list[i] - h_list[i - j - 1]))
    cost[i] = min(k_list)
print(cost[n - 1])

Fixed submission:
n,k = map(int,input().split())
h = input().split()
h_list = [int(s) for s in h]
cost = [0 for i in range(n)]
for i in range(n):
    if i == 0:
        cost[i] = 0
        continue
    if i == 1:
        cost[i] = abs(h_list[i] - h_list[i - 1])
        continue
    k_list = []
    for j in range(k):
        if i - j - 1 < 0:
            break
        k_list.append(cost[i - j - 1] + abs(h_list[i] - h_list[i - j - 1]))
    cost[i] = min(k_list)
print(cost[n - 1])
Buggy python submission (verdict: Runtime Error):
D,G= map(int,input().split())
pc=[]
for i in range(D):
  p,c= map(int,input().split())
  pc.append([p,c])
i=D
minN=100000
while i>0:
  #t=pc[i][0]*100*(i+1)+pc[i][1]
  t=pc[i-1][0]*100*(i)+pc[i-1][1]
  if t>=G:
    
    n=pc[i-1][0]
    minN=min(n,minN)
    while n-1>0:
      t1=(n-1)*100*(i)
      if t1>G:
        n=n-1
        continue
      else:
        minN=minN(minN,n+1)
      n=n-1
    
  i=i-1
print(minN)

Fixed submission:
rate=int(input())
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)

Buggy python submission (verdict: Runtime Error):
s=input()
result=""
count=0
l=len(s)
for i in range(l):
  if i==0 and s[i]="A":
    result="WA"
    break
  elif i==1 and ord(s[1])<97 
    result="WA"
    break
  elif i==l-1 and ord(s[l-1])<97:
    result="WA"
    break
  else:
    if ord(s[i])<97:
      count+=1
    if count>1 or s[i]!="C":
      result="WA"
      break
if result!="WA"
  result="AC"
print(result)

Fixed submission:
rate=int(input())
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)

Buggy python submission (verdict: Runtime Error):
rate=input()
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)

Fixed submission:
rate=int(input())
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)
Buggy python submission (verdict: Runtime Error):
s=input()
result=""
count=0
l=len(s)
for i in range(l):
  if i==0 and s[i]="A":
    result="WA"
    break
  elif i==1 and ord(s[1])<97 
    result="WA"
    break
  elif i==l-1 and ord(s[l-1])<97:
    result="WA"
    break
  else:
    if ord(i)<97:
      count+=1
    if count>1:
      result="WA"
      break
if result!="WA"
  result="AC"
print(result)


Fixed submission:
s=input()
result=""
count=0
l=len(s)
if s[0]!="A":
  result="WA"
elif ord(s[1:2])<97 or ord(s[l-1])<97:
  result="WA"
for i in s[2:l-1]:
  if ord(i)<97:
    count+=1
  if ord(i)<97 and i!="C":
    result="WA"
    break
  if count>1:
    result="WA"
    break
if count==0:
  result="WA"
if result!="WA":
  result="AC"
print(result)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b=map(int,input().split())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
date=input()
#if date[0:4]=="2017":
date="2018"+[4:]
print(date)

Fixed submission:
date=input()
#if date[0:4]=="2017":
date="2018"+date[4:]
print(date)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = 1
i = 1
while i < n or i == n:
  p = p*i
  i +=1
x = 10**9
print(p%(x+7))

Fixed submission:
import math
n = int(input())
i = 1
j = math.factorial(n)
x = 10**9
print(j%(x+7))
Buggy python submission (verdict: Runtime Error):
s=input().split()
i=0
count=0
while i<n:
  if int(s[i])%2!=0:
    count+=1
  i+=1
if count%2==0:
  print("Yes")
else:
  print("No")

Fixed submission:
n=int(input())
s=input().split()
i=0
count=0
while i<n:
  if int(s[i])%2!=0:
    count+=1
  i+=1
if count%2==0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
ss = s[::-1]
for i,j in enumerate(ss):
    if j == "p":
      ss[i] = "q"
    elif j == "q":
      ss[i] = "p"
    elif j == "b":
      ss[i] = "d"
    else:
      ss[i] = "b"
if ss == s:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
ss = s[::-1]
s3 = ""
for i,j in enumerate(ss):
  if j == "p":
      s3 += "q"
  elif j == "q":
      s3 += "p"
  elif j == "b":
      s3 += "d"
  else:
      s3 += "b"
if s == s3:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
init = input().split(' ')
init = [int(i) for i in init]
n,m= init[0],init[1]

ab = []

try:
	while True:
		inp1 = input().split(' ')
		inp1 = [int(i) for i in inp1]
		ab.append([inp1[0],inp1[1]])
except:
	pass

ab.sort()
total = sum([ab[j][0]*ab[j][1] for j in range(n)])
deltarget = sum([ab[j][1] for j in range(n)]) - m

while deltarget > 0:
	if ab[len(ab)-1][1]>0:
		total -= ab[len(ab)-1][0]
		ab[len(ab)-1][1] -= 1
		deltarget -= 1
		
	else:
		ab.pop(len(ab)-1)

print(total)

Fixed submission:
init = input().split(' ')
init = [int(i) for i in init]
n,m= init[0],init[1]

ab = []

try:
	while True:
		inp1 = input().split(' ')
		inp1 = [int(i) for i in inp1]
		ab.append([inp1[0],inp1[1]])
except:
	pass

ab.sort()
total = sum([ab[j][0]*ab[j][1] for j in range(n)])
deltarget = sum([ab[j][1] for j in range(n)]) - m

while deltarget > 0:
	if deltarget - ab[len(ab)-1][1] > 0:
		total -= ab[len(ab)-1][0]*ab[len(ab)-1][1]
		deltarget -= ab[len(ab)-1][1]
		ab.pop(len(ab)-1)
	else:
		total -= ab[len(ab)-1][0]*deltarget
		break

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
def findmax(ma, a,b):
	ma = a.index(max(a))
	if b[ma] > 0:
		b[ma] -= 1
		return ma,a,b
	else:
		a.pop(ma)
		b.pop(ma)
		return findmax(ma, a, b)

init = input().split(' ')
init = [int(i) for i in init]
n,m= init[0],init[1]

a = []
b = []

try:
	while True:
		inp1 = input().split(' ')
		inp1 = [int(i) for i in inp1]
		a.append(inp1[0])
		b.append(inp1[1])
except:
	pass

ma = a.index(max(a))
total = sum([a[j]*b[j] for j in range(n)])
deltarget = sum(b) - m

while deltarget > 0:
	ma, a, b = findmax(ma, a, b)
	total -= a[ma]
	deltarget -= 1
	
print(total)

Fixed submission:
init = input().split(' ')
init = [int(i) for i in init]
n,m= init[0],init[1]

ab = []

try:
	while True:
		inp1 = input().split(' ')
		inp1 = [int(i) for i in inp1]
		ab.append([inp1[0],inp1[1]])
except:
	pass

ab.sort()
total = sum([ab[j][0]*ab[j][1] for j in range(n)])
deltarget = sum([ab[j][1] for j in range(n)]) - m

while deltarget > 0:
	if deltarget - ab[len(ab)-1][1] > 0:
		total -= ab[len(ab)-1][0]*ab[len(ab)-1][1]
		deltarget -= ab[len(ab)-1][1]
		ab.pop(len(ab)-1)
	else:
		total -= ab[len(ab)-1][0]*deltarget
		break

print(total)
Buggy python submission (verdict: Runtime Error):
# atcoder abc112 A




age = int(input())
A = int(input())
B = int(input())


if age == 2:
	print(A+B)
else:
	print("Hello World")

Fixed submission:
# atcoder abc112 A

try:
	age = int(input())
	A = int(input())
	B = int(input())

except:
	pass

if age == 2:
	print(A+B)
else:
	print("Hello World")
Buggy python submission (verdict: Runtime Error):

def compression(init, matrix):
	
	mir = []
	
	for row in matrix:
		if "#"in row:
			mir.append(row)
	matrix = []
	
	mir = list(map(list, zip(*mir)))
	
	for row in mir:
		if "#"in row:
			matrix.append(row)
		
	matrix = list(map(list, zip(*matrix)))	
			
	
	return matrix


init = input().split(" ")
init = [int(c) for c in init]

matrix = [[] for j in range(init[0])]
j = 0

for j in range(init[1]+1):
	matrix[j] = input()

result = compression(init, matrix)
for row in result:
	print("".join(row))

Fixed submission:

def compression(init, matrix):
	
	mir = []
	
	for row in matrix:
		if "#"in row:
			mir.append(row)
	matrix = []
	
	mir = list(map(list, zip(*mir)))
	
	for row in mir:
		if "#"in row:
			matrix.append(row)
		
	matrix = list(map(list, zip(*matrix)))	
			
	
	return matrix


init = input().split(" ")
init = [int(c) for c in init]

matrix = [[] for j in range(init[0])]

for j in range(init[0]):
	matrix[j] = input()

result = compression(init, matrix)
for row in result:
	print("".join(row))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
con = 1
max = 0
while con != 0 :
    con = 0
    if (len(S) <= 1):
        break
    x = 0
    while True :
        if (x >= len(S)-1):
             break
        if(x <= len(S)-1 and 
            S[x] == '0' and S[x+1] == '1' or
            S[x] == '1' and S[x+1] == '0' ):
            max += 2
            del S[x:x+1+1]
            con = 1
        x += 1

print(max)

Fixed submission:
S = list(input())
R = S.count('0')
B = S.count('1')

if(len(S) <= 1):
    print(0)
else:
    print(len(S) - abs(R-B))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
con = 1
max = 0
while con != 0 :
    con = 0
    if (len(S) <= 1):
        break
    for x in range(len(S)-1):
        # print(S[x]+":"+S[x+1])
        if(S[x] == '0' and S[x+1] == '1' or
           S[x] == '1' and S[x+1] == '0' ):
           max += 2
           del S[x:x+1+1]
        #    print(S)
           con = 1
           break
print(max)

Fixed submission:
S = list(input())
R = S.count('0')
B = S.count('1')

if(len(S) <= 1):
    print(0)
else:
    print(len(S) - abs(R-B))
Buggy python submission (verdict: Time Limit Exceeded):
K,A,B = input().split()
K = int(K)
A = int(A)
B = int(B)
bi = 1

step = K
for num in range(K):
    if(step >= 1):
        if(B-A>1):
            if(step>2):
                if(bi>=A):
                    bi += B-A
                    step -= 1
                else:
                    bi+=1
            else:
                bi+=1
        else:
            bi+=1
        
        step-=1
    else:
        break

print(bi)


Fixed submission:
K,A,B = input().split()
K = int(K)
A = int(A)
B = int(B)
bi = 1

if(B-A<=2):
    bi+=K
else:
    bi=A
    #print(bi)
    K1=K-(A-1)
    #print(K-(A-1))
    bi+=((K1)//2)*(B-A)
    #print(((K1)//2)*(B-A))
    bi+=((K1)%2)
    #print(((K1)%2))
print(bi)
Buggy python submission (verdict: Time Limit Exceeded):
base = int(input())

data = [[0 for i in range(2)] for j in range(base)]

for num in range(base):
    _num = input()
    _num = _num.split()
    data[num][0] = int(_num[0])
    data[num][1] = int(_num[1])


takahashi = 0
aoki = 0

data.sort()
data.reverse()
_num = 0
for num in range(base):
    if(_num == 0):
        takahashi += data[0][0]
        _num = 1
        data.pop(0)
        data.sort()
        data.reverse()

    elif(_num == 1):
        aoki += data[0][1]
        _num = 0
        data.pop(0)
        data.sort()
        data.reverse()

print(takahashi-aoki)

Fixed submission:
base = int(input())

data = [[0 for i in range(3)] for j in range(base)]

for num in range(base):
    _num = input()
    _num = _num.split()
    data[num][0] = int(_num[0])+int(_num[1])
    data[num][1] = int(_num[0])
    data[num][2] = int(_num[1])

takahashi = 0
aoki = 0
data.sort()
data.reverse()

_num = 0
for num in range(base):
    if(_num == 0):
        takahashi += data[num][1]
        _num = 1

    elif(_num == 1):
        aoki += data[num][2]
        _num = 0

print(takahashi-aoki)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input()split("/"))
print("Heisei" if b*10+c<=70 else "TBD")
  

Fixed submission:
a,b,c=map(int,input().split("/"))
print("Heisei" if b*100+c<=430 else "TBD")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input()split("/"))
print("Heisei" if b*10+c>=70 else "TBD")
  

Fixed submission:
a,b,c=map(int,input().split("/"))
print("Heisei" if b*100+c<=430 else "TBD")
Buggy python submission (verdict: Time Limit Exceeded):
num=int(input())
a=list (map(int,input().split()))
count=0
while  all(i%2==0 for i in a):
  for i in a:
    i/2
    count+=1
print(count)


Fixed submission:
num=int(input())
a=list (map(int,input().split()))
count=0
while  all(i%2==0 for i in a):
  a=[i/2 for i in a]
  count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n=input()
a=list(int,input().split())
count=0
while (i%==0):
  a=a/2
  count+=1
print(count)

Fixed submission:
num=int(input())
a=list (map(int,input().split()))
count=0
while  all(i%2==0 for i in a):
  a=[i/2 for i in a]
  count+=1
print(count)