Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#! coding: UTF-8
num = int(input())
#桁数
def digit(x):
    point = 0
    while int(x) > 0:
        x /= 10
        point += 1
    return point
#num=A*Bの時の最小桁数
def Multi(num):
    y = digit(num)
    for A in range(1,num):
        if A*A <= num:
            if num%A == 0:
                B = num/A
                C = max(digit(A),digit(B))
                if y > C:
                    y = C
    print(y)
Multi(num)


Fixed submission:
#! coding: UTF-8
num = int(input())
#桁数
def digit(x):
    point = 0
    while int(x) > 0:
        x /= 10
        point += 1
    return point
#num=A*Bの時の最小桁数
def Multi(num):
    y = digit(num)
    A = 1
    while A*A <= num:
        if num%A == 0:
            B = num/A
            C = max(digit(A),digit(B))
            if y > C:
                y = C
        A += 1
    print(y)
Multi(num)
Buggy python submission (verdict: Runtime Error):
n = input()
data = list(map(int,input().split()))
h = 0
ans = 0
for i in range(0,n):
	if data[i]>h:
		ans++
print(ans);

Fixed submission:
n = int(input())
data = list(map(int,input().split()))
h = 0
ans = 0
for i in range(n):
	if data[i]>=h:
		ans+=1
		h = data[i]
print(ans);
Buggy python submission (verdict: Runtime Error):
data = [int(input()) for i in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )

Fixed submission:
data = [int(input()) for i in range(5)]
K = int(input())
print(":(" if data[4]-data[0]>K else "Yay!" )

Buggy python submission (verdict: Runtime Error):
data = [input() in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )

Fixed submission:
data = [int(input()) for i in range(5)]
K = int(input())
print(":(" if data[4]-data[0]>K else "Yay!" )
Buggy python submission (verdict: Runtime Error):
ACGT = ['A','C','G','T']
l,count = 0,0
for i in range(len(s)):
	if ACGT.find(s[i]) >= 0:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)

Fixed submission:
ACGT = ['A','C','G','T']
s = input() + 'X'
l,count = 0,0
for i in range(len(s)):
	if s[i] in ACGT:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = list(map(int,input().split()))
S = input()
for i in range(Q):
	f,t = list(map(int,input().split()))
	print(S[f-1:t].count('AC'))


Fixed submission:
N,Q = list(map(int,input().split()))
S = input()
sums = [0]
for i in range(len(S)):
	if i == 0:
		continue
	sums.append(sums[i-1])
	if S[i-1]+S[i] == 'AC':
		sums[i] += 1

for i in range(Q):
	f,t = list(map(int,input().split()))
	print(sums[t-1]-sums[f-1])
Buggy python submission (verdict: Runtime Error):
N, MOD = int(input()), 10**9+7
count = 0
def dfs(index,last3):
	if index == N:
		return 1
	c_next = 'AT'
	if 'AC' in last3[1:]:
		c_next + 'G'
	if 'AG' in last3 == False:
		if  last3[1:] != 'GA':
			if last3[0]+last3[2] != 'AG':
				c_next + 'C'

	for c in c_next:
		count += dfs(index+1,last3[1:]+c)

print(dfs(0,'TTT'))

Fixed submission:
N, MOD = int(input()), 10**9+7
memo = [{} for i in range(N+1)]
# Keyが直前の三文字、Valueが作れる文字列の数
# ↑これを文字列の今の長さごとにメモする
# memo[6]['TTT']には直前の三文字がTTTで、
# 6文字目以降の条件に合う文字列の総数が入ってる


# めも化再帰
def dfs(index,last3):
	if last3 in memo[index]:
		return memo[index][last3]
	if index == N:
		return 1
	c_next = 'AT'
	if last3[1:] != 'AC':
		c_next += 'G'
	if ('AG' in last3) == False:
		if  last3[1:] != 'GA':
			if last3[0]+last3[2] != 'AG':
				c_next += 'C'
	count = 0
	for c in c_next:
		count += dfs(index+1,last3[1:]+c)
		count %= MOD

	memo[index][last3] = count
	return count

print(dfs(0,'TTT'))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,inputr().split()))
b = list(map(int,inputr().split()))
print((a[0]-b[0])*(a[1]-b[1]))

Fixed submission:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
print((a[0]-b[0])*(a[1]-b[1]))
Buggy python submission (verdict: Runtime Error):
N,M,C = list(map(int,input().split()))
b = input()
count = 0
for i in  range(N):
	a = input()
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)

Fixed submission:
N,M,C = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in  range(N):
	a = list(map(int,input().split()))
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
N,M,C = list(map(int,input().split()))
b = input()
count = 0
for i in  range(N):
	a = input()
	s = 0
	for j in range(M)
		s += a[j]*b[j]
	if s>C:
		count+=1
print(count)


Fixed submission:
N,M,C = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in  range(N):
	a = list(map(int,input().split()))
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	prices = sortedData[i][0]
	nums = sortedData[i][1]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Fixed submission:
N,m = list(map(int,input().split()))
data = [[0,0] for i in range(N)]
for i in range(N):
	data[i] = list(map(int,input().split()))
data.sort()
cost = 0
for i in range(N):
	prices,nums = data[i]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Buggy python submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	prices = sortedData[i][0]
	nums = sortedData[i][1]
	if m > nums:
		cost += price * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Fixed submission:
N,m = list(map(int,input().split()))
data = [[0,0] for i in range(N)]
for i in range(N):
	data[i] = list(map(int,input().split()))
data.sort()
cost = 0
for i in range(N):
	prices,nums = data[i]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Buggy python submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	v = sortedData[i][1]
	if m > v:
		cost += sortedData[i][0] * v
		m -= v
	else:
		cost += sortedData[i][0] * m
		print(cost)
		break

Fixed submission:
N,m = list(map(int,input().split()))
data = [[0,0] for i in range(N)]
for i in range(N):
	data[i] = list(map(int,input().split()))
data.sort()
cost = 0
for i in range(N):
	prices,nums = data[i]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break
Buggy python submission (verdict: Runtime Error):
# F(a,b) = F(0,a-1) xor F(0,b)
# 偶数nについて、 n xor (n+1) = 1
a,b = list(map(int,input().split()))
a = (((a+1)/2)%2)^(a-1)	# F(0,a-1)
b = (((b+1)/2)%2)^b		# F(0,b)
print(a^b)

Fixed submission:
# F(a,b) = a xor (a+1) ,,, (b-1) xor b
# F(a,b) = F(0,a-1) xor F(0,b)
# 偶数nについて、 n xor (n+1) = 1

# f(n) == F(0,n)
def f(n):
	num = (n+1)//2	# n xor (n+1) の個数
	if num%2==0:
		if n%2==1:
			return 0
		else:
			return n
	else:
		if n%2==1:
			return 1
		else:
			return 1^n

a,b= list(map(int,input().split()))
print(f(a-1)^f(b))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q  = map(int, input().split())
win_list = [int(input()) for i in range(Q)]
score = [K for i in range(N)]

for x in win_list:
    for a, b in enumerate(score):
        if not a == x-1:
            score[a] = b-1

for s in score:
    if s > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = list(int(input()) for _ in range(Q))

correct = [K-Q] * N

for i in range(Q):
    correct[A[i]-1] += 1

for i in correct:
    if i > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q  = map(int, input().split())
win_list = [int(input()) for i in range(Q)]
first_score = [K for i in range(N)]

score = [0] * N
for x in win_list:
    for a, b in enumerate(score):
        if not a == x-1:
            score[a] = b-1

final_score = [a+b for a, b in zip(first_score, score)]

for s in final_score:
    if s > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = list(int(input()) for _ in range(Q))

correct = [K-Q] * N

for i in range(Q):
    correct[A[i]-1] += 1

for i in correct:
    if i > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
from collections import*
n,m,*t=map(int,open(0).read().split())
i,o,r=[0]*n,[[]for _ in'_'*n],[]
for a,b in zip(*[iter(t)]*2):
  o[a-1]+=b-1,
  i[b-1]+=1
q=deque(v for v in range(n)if i[v]<1)
while q:
  v=q.popleft()
  r+=v,
  for w in o[v]:
    i[w]-=1
    if i[w]==0:q+=w,
print(-(len(r)==n))
for j,k in enumerate(i):
  if i[j]>0: print(j+1)

Fixed submission:
n = int(input())
print('{:.10f}'.format((n//2 + n%2)/n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]]
print(s)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]-1]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
A =[]
c = 0
for i in range(int(input())):
    a=sorted(input())
    c += A.count(a)
    A.append(a)
print(c)

Fixed submission:
A ={}
c = 0
for i in range(int(input())):
    a = str(sorted(input()))
    if a in A:
        A[a] += 1
        c += A[a]
    else:
        A[a] = 0
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
A =[]
c = 0
for i in range(int(input())):
    A.append(sorted(list(input())))
    c += A.count(A[i])-1
print(c)

Fixed submission:
A ={}
c = 0
for i in range(int(input())):
    a = str(sorted(input()))
    if a in A:
        A[a] += 1
        c += A[a]
    else:
        A[a] = 0
print(c)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
dic = {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"A":10,"B":11,"C":12,"D":14,"E":15,"F":16}
if dic[a[0]]==dic[a[1]]:
  print("=")
elif dic[a[0]]>dic[a[1]]:
  print(">")
else:
  print("<")

Fixed submission:
a = list(map(str,input().split()))
dic = {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"A":10,"B":11,"C":12,"D":14,"E":15,"F":16}
if dic[a[0]]==dic[a[1]]:
  print("=")
elif dic[a[0]]>dic[a[1]]:
  print(">")
else:
  print("<")
Buggy python submission (verdict: Runtime Error):
#1行目を読み取る
line1 = input()
#スペースで区切る
splitLine1 = line1.split()

#それぞれをintに変換してn, kに代入する
#n, k = map(int, splitLine1)を分解
n = int(splitLine1[0])
k = int(splitLine1[1])

#2行目を読み取る
line2 = input()
#スペースで区切る
splitLine2 = line2.split()

#それぞれをintに変換してリストとして持つ
lengthList = []
for i in range(n):
  eachLengthNum = int(splitLine2[i])
  lengthList.append(eachLengthNum)

#lengthListを数字の小さい順にソートする
lengthList.sort()
#順番に取り出すために、大きい順に並べ替える
#reverseを使うと、listの順番をひっくり返す
lengthList.reverse()

#頭からkまでの数字を合計していく
resultLengthSum = 0
for i in range(k):
  resultLengthSum += l[i]

#答えを出力
print(resultLengthSum)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
len = 0
l.sort()
l.reverse()

for i in range(k):
  len += l[i]

print(len)
Buggy python submission (verdict: Runtime Error):
S = input().strip()
while len(S) > 0:
  S = S[:-1]
  mid = len(S)//2
  if S[:mid] == S[mid:]:
    print(len(S))
  	break
  

Fixed submission:
S = input().strip()
while len(S) > 0:
  S = S[:-1]
  mid = len(S)//2
  if S[:mid] == S[mid:]:
    print(len(S))
    break
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

# A.sort(reverse=True)
# B.sort(reverse=True)

rowrange = 0
colrange = 0
ans = 1
for i in reversed(range(1, N * M + 1)):
    r = i in A
    c = i in B
    if r is True and c is True:
        rowrange += 1
        colrange += 1
    elif r is True and c is False:
        rowrange += 1
        ans = (colrange * ans) % (10 ** 9 + 7)
    elif r is False and c is True:
        colrange += 1
        ans = (rowrange * ans) % (10 ** 9 + 7)
    else:
        ans = ((rowrange * colrange - (N * M - i)) * ans) % (10 ** 9 + 7)
print(ans)


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

# A.sort(reverse=True)
# B.sort(reverse=True)

rowrange = 0
colrange = 0
ans = 1
for i in reversed(range(1, N * M + 1)):
    r = i in A
    c = i in B
    if r is True and c is True:
        rowrange += 1
        colrange += 1
        A.remove(i)
        B.remove(i)
    elif r is True and c is False:
        rowrange += 1
        ans = (colrange * ans) % (10 ** 9 + 7)
        A.remove(i)
    elif r is False and c is True:
        colrange += 1
        ans = (rowrange * ans) % (10 ** 9 + 7)
        B.remove(i)
    else:
        ans = ((rowrange * colrange - (N * M - i)) * ans) % (10 ** 9 + 7)
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

ans = (a - 1) * (b - 1)
print(ans)


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

ans = (a - 1) * (b - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

print((A - 1) * (B - 1))


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

ans = (a - 1) * (b - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print((A - 1) * (B - 1))


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

ans = (a - 1) * (b - 1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())

LR = [[0 for i in range(2)] for j in range(M)]
pq = [[0 for i in range(2)] for j in range(Q)]

for i in range(M):
    LR[i] = list(map(int, input().split()))

for i in range(Q):
    pq[i] = list(map(int, input().split()))

x = [[0 for i in range(N)] for j in range(N)]

# print(LR[0][0])

for i in range(M):
    # x[LR[i][1] - 1][LR[i][0] - 1] = x[LR[i][1] - 1][LR[i][0] - 1] + 1
    x[LR[i][1] - 1][LR[i][0] - 1] += 1

xacu = [[0 for i in range(N)] for j in range(N)]

for i in range(N):
    for j in range(N):
        if j == 0:
            xacu[i][j] = x[i][j]
        else:
            xacu[i][j] = xacu[i][j - 1] + x[i][j]

# print(xacu)

for i in range(Q):
    count = 0
    p = pq[i][0]
    for j in range(pq[i][1]):
        if p == 1:
            count = count + xacu[j][N - 1]
        else:
            count = count + xacu[j][N - 1] - xacu[j][p - 2]

    print(count)


Fixed submission:
N, M, Q = map(int, input().split())

x = [[0 for i in range(N + 1)] for j in range(N + 1)]

for i in range(M):
    l, r = map(int, input().split())
    x[l][r] += 1

for i in range(1, N + 1):
    for j in range(1, N + 1):
        x[i][j] += x[i - 1][j] + x[i][j - 1] - x[i - 1][j - 1]

for i in range(Q):
    p, q = map(int, input().split())

    ans = x[N][q] - x[p - 1][q]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())

LR = [[0 for i in range(2)] for j in range(M)]
pq = [[0 for i in range(2)] for j in range(Q)]

for i in range(M):
    LR[i] = list(map(int, input().split()))

for i in range(Q):
    pq[i] = list(map(int, input().split()))

x = [[0 for i in range(N)] for j in range(N)]

# print(LR[0][0])

for i in range(M):
    x[LR[i][1] - 1][LR[i][0] - 1] = x[LR[i][1] - 1][LR[i][0] - 1] + 1

xacu = [[0 for i in range(N)] for j in range(N)]

for i in range(N):
    for j in range(N):
        if j == 0:
            xacu[i][j] = x[i][j]
        else:
            xacu[i][j] = xacu[i][j - 1] + x[i][j]

# print(xacu)

for i in range(Q):
    count = 0
    p = pq[i][0]
    for j in range(pq[i][1]):
        if p == 1:
            count = count + xacu[j][N - 1]
        else:
            count = count + xacu[j][N - 1] - xacu[j][p - 2]

    print(count)


Fixed submission:
N, M, Q = map(int, input().split())

x = [[0 for i in range(N + 1)] for j in range(N + 1)]

for i in range(M):
    l, r = map(int, input().split())
    x[l][r] += 1

for i in range(1, N + 1):
    for j in range(1, N + 1):
        x[i][j] += x[i - 1][j] + x[i][j - 1] - x[i - 1][j - 1]

for i in range(Q):
    p, q = map(int, input().split())

    ans = x[N][q] - x[p - 1][q]
    print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')

Fixed submission:
import re

S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')
Buggy python submission (verdict: Runtime Error):
# import time
N, C = map(int, input().split())              # 同上。map関数を使うとこのように書ける

D = [[0 for i in range(C)] for j in range(C)]
c = [[0 for i in range(N)] for j in range(N)]
# iwakan = [[[0 for i in range(N)] for j in range(N)] for k in range(C)]

for i in range(C):
    D[i] = list(map(int, input().split()))

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

# まず違和感リストを作る。
# for i in range(C):
#     for j in range(N):
#         for k in range(N):
#             iwakan[i][j][k] = D[c[j][k] - 1][i]

'''
Gij0 : (i + j) % 3 == 0 となる場所
Gij1 : (i + j) % 3 == 1 となる場所
Gij2 : (i + j) % 3 == 2 となる場所
とした時に、
Gijnに属する場所全ての色をaに塗り替える場合の違和感の合計を
iwakan[n][a]とする。
iwakan[n][a]を全て求めるための計算量は、30*500*500 = 7500000
iwakan を用いて全ての色の塗り替えの組み合わせを求めるための計算量は
30 * 29 * 28 = 24360
'''

# t1 = time.time()

# Gijnに属する色の数を合計したリストを作る。
numOfColors = [[0 for i in range(C)] for j in range(3)]
for i in range(N):
    for j in range(N):
        if (i + j) % 3 == 0:
            numOfColors[0][c[i][j] - 1] = numOfColors[0][c[i][j] - 1] + 1
        if (i + j) % 3 == 1:
            numOfColors[1][c[i][j] - 1] = numOfColors[1][c[i][j] - 1] + 1
        if (i + j) % 3 == 2:
            numOfColors[2][c[i][j] - 1] = numOfColors[2][c[i][j] - 1] + 1

iwakan = [[0 for i in range(C)] for j in range(3)]
for i in range(3):
    for j in range(C):
        for a in range(C):
            iwakan[i][j] = iwakan[i][j] + numOfColors[i][a] * D[a][j]

# t2 = time.time()

sum_min = float("inf")
for i in range(C):
    for j in range(C):
        for k in range(C):
            if (i == j) or (j == k) or (k == i):
                pass
            else:
                sum_tmp = iwakan[0][i] + iwakan[1][j] + iwakan[2][k]
                if sum_min > sum_tmp:
                    sum_min = sum_tmp

# t3 = time.time()

print(sum_min)

# elapsed_time1 = t2 - t1
# elapsed_time2 = t3 - t2
# print(f'time1: {elapsed_time1}')
# print(f'time2: {elapsed_time2}')


Fixed submission:
n = int(input())

if n <= 999:
    print("ABC")
else:
    print("ABD")
Buggy python submission (verdict: Runtime Error):
N, X = [int(i) for i in input().split()]
m = [0 for i in range(N)]

for i in range(N):
  m(i) = int(input())

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)


Fixed submission:
N, X = [int(i) for i in input().split()]
m = [0 for i in range(N)]

for i in range(N):
  m[i] = int(input())

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)

Buggy python submission (verdict: Runtime Error):
N, X = [int(i) for i in input().split()]
m = [input().split()]

for i in range(N):
  m(i) = int(m(i))

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)

Fixed submission:
N, X = [int(i) for i in input().split()]
m = [0 for i in range(N)]

for i in range(N):
  m[i] = int(input())

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, X, Y = [int(i) for i in input().split()]

mincost = 10000000000

for a in range(X + 1):
    for b in range(Y + 1):
        c = max([(X - a) * 2, (Y - b) * 2])
        cost = a * A + b * B + c * C
        if (cost < mincost):
            mincost = cost

print(mincost)

Fixed submission:
A, B, C, X, Y = [int(i) for i in input().split()]

cost1 = X * A + Y * B

c = X * 2
a = 0
b = max([0, Y - c / 2])
cost2 = a * A + b * B + c * C

c = Y * 2
a = max([0, X - c / 2])
b = 0
cost3 = a * A + b * B + c * C

print(int(min([cost1, cost2, cost3])))

Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = [int(i) for i in input().split()]

mincost = 10000000000

for a in range(X + 1):
    for b in range(Y + 1):
        c = max[(X - a) * 2, (Y - b) * 2]
        cost = a * A + b * B + c * C
        if (cost < mincost):
            mincost = cost

print(mincost)


Fixed submission:
A, B, C, X, Y = [int(i) for i in input().split()]

cost1 = X * A + Y * B

c = X * 2
a = 0
b = max([0, Y - c / 2])
cost2 = a * A + b * B + c * C

c = Y * 2
a = max([0, X - c / 2])
b = 0
cost3 = a * A + b * B + c * C

print(int(min([cost1, cost2, cost3])))
Buggy python submission (verdict: Runtime Error):
N = int(input())
Bs = list(map(int, input().split()))
 
As = [ None for _ in range(N) ]

As[0] = Bs[0]
for i in range(1, N):  
  As[i] = min(Bs[i-1], Bs[i])

print(sum(As))

Fixed submission:
N = int(input())
Bs = list(map(int, input().split()))
 
As = [ None for _ in range(N) ]

As[0] = Bs[0]
for i in range(1, N-1):  
  As[i] = min(Bs[i-1], Bs[i])

As[-1] = Bs[-1]

print(sum(As))
Buggy python submission (verdict: Runtime Error):
S = input()

max_length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    if i == len(S) - 1:
      length = 1
    else:
      for j in range(i+1, len(S)):
        if S[j] in "ACGT":
          length = j - i + 1
        else:
          break

    if length > max_length:
      max_length = length

print(max_length)

Fixed submission:
S = input()

max_length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    if i == len(S) - 1:
      length = 1
    else:
      for j in range(i+1, len(S)):
        if S[j] in "ACGT":
          length = j - i + 1
        else:
          length = j - i
          break

    if length > max_length:
      max_length = length

print(max_length)

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

length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    for j in range(i+1, len(S)):
      if S[j] in "ACGT":
        continue
      else:
        break
    if j - i > length:
      length = j - i

print(length)

Fixed submission:
S = input()

max_length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    if i == len(S) - 1:
      length = 1
    else:
      for j in range(i+1, len(S)):
        if S[j] in "ACGT":
          length = j - i + 1
        else:
          length = j - i
          break

    if length > max_length:
      max_length = length

print(max_length)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
nums = sorted(list(map(int, input().split())), reverse=True)

num_map = Counter(nums)

answer = 0
for num in nums:
    pair = (1 << (num.bit_length())) - num

    if num_map[num] > 0 and num_map[pair]:
        if num == pair and num_map[num] > 1:
            answer += 1
            num_map[num] -= 2
        else:
            answer += 1
            num_map[num] -= 1
            num_map[pair] -= 1

print(answer)

Fixed submission:
s = input()

answer = 0
black_count = 0
for i in range(len(s)):
    if s[i] == "B":
        black_count += 1
    else:
        answer += black_count

print(answer)