Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
# print(A)
A = [[A[i],i] for i in range(N)]
A.sort(reverse=True)
# print("A :",A)
dp = [[0]*(N+1) for _ in range(N+1)]
# print(dp)

#dp[x][y] : x人は Ai*(i-pi),y人は Ai*(pi-i)
#           piは 0,1,2...   piはN-1,N-2,N-3,,
dp[0][0] = 0
# y = 0
for x in range(1,N+1):
    dp[x][0] = dp[x-1][0]+A[x-1][0]*(A[x-1][1]-x+1)
    # print(x,dp)
# x = 0
for y in range(1,N+1):
    dp[0][y] = dp[0][y-1]+A[y-1][0]*(N-y - A[y-1][1])
    # print(x,dp)
    
for x in range(1,N):
    for y in range(1,N+1-x):
        dp[x][y] = max(dp[x-1][y] + A[x+y-1][0]*(A[x+y-1][1]+1 - x), dp[x][y-1] + A[x+y-1][0]*(N-y - A[x+y-1][1]))
# print(dp)

c = 0
for i in range(N):
    if c < dp[i][N-i]:
        c = dp[i][N-i]
print(c)

Fixed submission:
# import time
# p0 = time.time()

N = int(input())
A = list(map(int,input().split()))
# print(A)
A = [[A[i],i] for i in range(N)]
A.sort(reverse=True)
# print("A :",A)
dp = [[0]*(N+1) for _ in range(N+1)]
# print(dp)

#dp[x][y] : x人は Ai*(i-pi),y人は Ai*(pi-i)
#           piは 0,1,2...   piはN-1,N-2,N-3,,
# p1 = time.time()-p0

dp[0][0] = 0
# y = 0
for x in range(1,N+1):
    dp[x][0] = dp[x-1][0]+A[x-1][0]*(A[x-1][1]-x+1)
    # print(x,dp)
# x = 0
for y in range(1,N+1):
    dp[0][y] = dp[0][y-1]+A[y-1][0]*(N-y - A[y-1][1])
    # print(x,dp)

# p2 = time.time()-p0
for x in range(1,N):
    for y in range(1,N+1-x):
        A0 = A[x+y-1][0]
        A1 = A[x+y-1][1]
        dp[x][y] = max(dp[x-1][y] + A0*(A1+1 - x), dp[x][y-1] + A0*(N-y - A1))
# print(dp)

# p3 = time.time()-p0

c = 0
for i in range(N):
    if c < dp[i][N-i]:
        c = dp[i][N-i]
print(c)

# print(p1,p2,p3)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,C = map(int,input().split())
S = list(input())
W = [i for i in range(N) if S[i]=="o" ]
# print(W)

for w in W:
    S[w] = "x"
    i = 0
    count = 0
    while i<N and count<K:
        if S[i] == "o":
            count += 1
            i += C
        i += 1
    
    # print("w,count",w,count)
    if count < K:
        print(w+1)
    
    S[w] = "o"

Fixed submission:
N,K,C = map(int,input().split())
S = list(input())
W = [i for i in range(N) if S[i]=="o" ]
# print(W)

def LR(S,f):
    D = {}
    i = 0
    count = 0
    while i<N and count<K:
        if S[i] == "o":
            count += 1
            if f:
                D[count] = i
            else:
                D[m+1-count] = N-1 - i
            i += C
        i += 1
    return D

L = LR(S,True)
m = max(L)
S.reverse()
R = LR(S,False)
# print(L,R)

for i in range(1,m+1):
    if L[i]==R[i]:
        print(L[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N,K,C = map(int,input().split())
S = list(input())
W = [i for i in range(N) if S[i]=="o" ]
# print(W)

for w in W:
    S[w] = "x"
    i = 0
    count = 0
    while i<N:
        if S[i] == "o":
            count += 1
            i += C
        i += 1
    
    # print("w,count",w,count)
    if count < K:
        print(w+1)
    
    S[w] = "o"

Fixed submission:
N,K,C = map(int,input().split())
S = list(input())
W = [i for i in range(N) if S[i]=="o" ]
# print(W)

def LR(S,f):
    D = {}
    i = 0
    count = 0
    while i<N and count<K:
        if S[i] == "o":
            count += 1
            if f:
                D[count] = i
            else:
                D[m+1-count] = N-1 - i
            i += C
        i += 1
    return D

L = LR(S,True)
m = max(L)
S.reverse()
R = LR(S,False)
# print(L,R)

for i in range(1,m+1):
    if L[i]==R[i]:
        print(L[i]+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y = map(int,input().split())

G = [[] for _ in range(N)]
# print(G)
# ぐらふの作成
for i in range(N-1):
    G[i].append(i+1)
    G[i+1].append(i)
G[X-1].append(Y-1)
G[Y-1].append(X-1)

# print(G)

from collections import deque
def bfs(G,v):
    que = deque([v])
    dist[v] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)

D = [0]*(N-1)
for i in range(N):
    dist = [-1]*N
    bfs(G,i)
    # print(dist)
    for d in dist:
        if d>0:
            D[d-1] += 1
# print(D)
for d in D:
    print(d//2)




Fixed submission:
N,X,Y = map(int,input().split())
D= [0]*(N-1)

# print(X,Y)
for i in range(1,N+1):
    for j in range(i+1,N+1): # i<j
        # print((i,j))
        # ver 1
        if j<=X or Y<=i:
            d = j-i
            
        # ver 2
        elif i<=X and Y<=j:
            d = X-i + 1 + j-Y
            
        # ver 3
        else:
            d = min(j-i,abs(X-i)+abs(Y-j)+1)
        # print(d)
        D[d-1] += 1
# print(D)

for d in D:
    print(d)
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
R = list(map(int,input().split()))
G = list(map(int,input().split()))
T = list(map(int,input().split()))
R.sort(reverse=True)
G.sort(reverse=True)
T.sort(reverse=True)
"""
print("X,Y:",X,Y)
print(R)
print(G)
print(T)
"""
R.append(0)
G.append(0)
T.append(0)

d=0
t=0
# TT = []
while X+Y-t > 0:
    # print("X+Y-t :",X+Y-t)

    if max(R[0],G[0],T[0])==R[0]:
        if X>0:
            d += R.pop(0)
            X += -1
        else:
            if G[0] >= T[0]:
                d += G.pop(0)
                Y += -1
            else:
                TT.append(T.pop(0))
                t += 1
            
    elif max(R[0],G[0],T[0])==G[0]:
        if Y>0:
            d += G.pop(0)
            Y += -1
        else:
            if R[0] >= T[0]:
                d += R.pop(0)
                X += -1
            else:
                TT.append(T.pop(0))
                t += 1
                
    else:
        d += T.pop(0)
        t += 1
    
print(d)

Fixed submission:
X,Y,A,B,C = map(int,input().split())
R = list(map(int,input().split()))
G = list(map(int,input().split()))
T = list(map(int,input().split()))
R.sort(reverse=True)
G.sort(reverse=True)
R = R[:X]
G = G[:Y]
A = T+R+G
A.sort(reverse=True)
print(sum(A[:X+Y]))
Buggy python submission (verdict: Runtime Error):
print(((int(input())+1)//2)

Fixed submission:
print((int(input())+1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
n = len(N)
dp = [[0,0] for _ in range(n)]
dp[0][0] = int(N[0])
dp[0][1] = 11-int(N[0])
for i in range(n-1):
    dp[i+1][0] = min(dp[i][0]+int(N[i+1]), dp[i][1]+int(N[i+1]))
    dp[i+1][1] = min(dp[i][0]+11-int(N[i+1]), dp[i][1]+9-int(N[i+1]))
print(min(dp[n-1][0],dp[n-1][1]))

Fixed submission:
# import time
N = input()
n = len(N)
# t1 = time.time()
# ぴったり払う:a 余分に払う:b
a = int(N[0])
b = 11-int(N[0])
# t2 = time.time()
for i in range(n-1):
    a1 = min(a+int(N[i+1]), b+int(N[i+1]))
    b1 = min(a+11-int(N[i+1]), b+9-int(N[i+1]))
    a = a1
    b = b1
print(min(a,b))
# t3 = time.time()

# print(t2-t1,t3-t2)
Buggy python submission (verdict: Time Limit Exceeded):
n = 1000000007
 
def comb(p,q):
    r = 1
    for i in range(q):
        r = r * (p-i) // (1+i)
    return r%n
    
    
r1,c1,r2,c2 = list(map(int,input().split()))
 
 
y = comb(r2+c2+2,c2+1) - comb(r2+c1+1,c1) - comb(r1+c2+1,c2+1) + comb(r1+c1,c1)
print(y % n)

Fixed submission:
M=1000000007
r1,c1,r2,c2=map(int,input().split())
n=r2+c2+2
fac=[1]+[0]*n
for i in range(1,n+1):fac[i]=fac[i-1]*i%M
f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-1
print((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))

c = 0
for i in range(N):
    f = True
    pi = P[i]
    for j in range(i):
        if pi>P[j]:
            f = False
            break
    if f:
        c += 1
print(c)

Fixed submission:
N = int(input())
P = list(map(int,input().split()))

c = 1
pmin = 1000000
for i in range(1,N):
    if P[i-1]<pmin:
        pmin = P[i-1]
    if pmin >= P[i]:
        c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

y = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            # print(i,j,k)
            c = str(i)
            p = 0
            l = 0
            while l < N:
                if p == 0 and S[l] == c:
                    c = str(j)
                    p = 1
                elif p == 1 and S[l] == c:
                    c = str(k)
                    p = 2
                elif p == 2 and S[l] == c:
                    y += 1
                    # print("pin")
                    break
                l += 1
print(y)

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

y = 0
L = []
for i in range(10):
    for j in range(10):
        L = []
        # print(i,j,k)
        c = str(i)
        p = 0
        l = 0
        while l < N:
            if p == 0 and S[l] == c:
                c = str(j)
                p = 1
            elif p == 1 and S[l] == c:
                p = 2
            elif p == 2 and S[l] not in L:
                L.append(S[l])
            l += 1
        y += len(L)
print(y)

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

L = []
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            num = S[i]+S[j]+S[k]
            if num not in L:
                L.append(num)
print(len(L))

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

y = 0
L = []
for i in range(10):
    for j in range(10):
        L = []
        # print(i,j,k)
        c = str(i)
        p = 0
        l = 0
        while l < N:
            if p == 0 and S[l] == c:
                c = str(j)
                p = 1
            elif p == 1 and S[l] == c:
                p = 2
            elif p == 2 and S[l] not in L:
                L.append(S[l])
            l += 1
        y += len(L)
print(y)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
c = 0
for i in range(1000):
    s = "0"*(3-len(str(i)))+str(i)
    #print(s)
    k = 0
    for j in S:
        if j == s[k]:
            k += 1
            if k == 3:
                c += 1
                #print(s)
                break
        #print("j={},k={}".format(j,k))
print(c)

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

y = 0
L = []
for i in range(10):
    for j in range(10):
        L = []
        # print(i,j,k)
        c = str(i)
        p = 0
        l = 0
        while l < N:
            if p == 0 and S[l] == c:
                c = str(j)
                p = 1
            elif p == 1 and S[l] == c:
                p = 2
            elif p == 2 and S[l] not in L:
                L.append(S[l])
            l += 1
        y += len(L)
print(y)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
# print(A)
RGB = [1,0,0]
M = 10**9+7

c = 3
for i in range(1,N):
    c = (c * RGB.count(A[i]))%M
    RGB[RGB.index(A[i])] += 1
    # print(RGB)
print(c)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
# print(A)
RGB = [1,0,0]
M = 1000000007

c = 3

f = False
if A[0] != 0:
    f = True

for i in range(1,N):
    try:
        cnt = RGB.count(A[i])
        idx = RGB.index(A[i])
    except:
        f = True
        break
    c = (c * cnt)%M
    RGB[idx] += 1
    # print(RGB)
if f:
    print(0)
else:
    print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if N % 2 == 1:
  ans = "No"
else:
  zenhan = S[0:int(N/2)] 
  kouhan = S[int(N/2):N]
  if zenhan == kouhan:
    ans = "Yes"

print(ans)

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

if N % 2 == 1:
  ans = "No"
else:
  zenhan = S[0:int(N/2)] 
  kouhan = S[int(N/2):N]
  if zenhan == kouhan:
    ans = "Yes"
  else:
    ans = "No"

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = N /2
print(ans)
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N + 1) / N / 2

print(ans)


Fixed submission:
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N + 1) / N / 2

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
A_factors=prime_factorize(A)
B_factors=prime_factorize(B)
B_factors = set(B_factors)
A_factors = set(A_factors)
C = A_factors & B_factors
ans = len(C) + 1
print(ans)

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
A, B = map(int,input().split())
A_factors=prime_factorize(A)
B_factors=prime_factorize(B)
B_factors = set(B_factors)
A_factors = set(A_factors)
C = A_factors & B_factors
ans = len(C) + 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(N):
  ans += i
print(ans)

Fixed submission:
N = int(input())
ans = N * (N -1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[0],reverse=True)
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
while count < N:
  for i in range(N):
    time += AB[i][0]
    if time > AB[i][1]:
      ans = "No"
      break

Fixed submission:
N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
ans = "Yes"

for i in range(N):
  time += AB[i][0]
  if time > AB[i][1]:
    ans = "No"
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[0],reverse=True)
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
while count < N:
  for i in range(N):
    time += AB[i][0]
    if time > AB[i][1]:
      ans = "No"
      break
    else:
      count += 1
      ans = "Yes"
print(ans)


Fixed submission:
N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
ans = "Yes"

for i in range(N):
  time += AB[i][0]
  if time > AB[i][1]:
    ans = "No"
print(ans)
Buggy python submission (verdict: Runtime Error):
total = sum(W)
prefix = []
delta = []
for i in range(N):
  prefix.append(sum(W[:i+1]))
  
for i in range(N):
  delta.append(abs(prefix[N-1] /2 - prefix[i]))
  
print(min(delta) * 2)


Fixed submission:
N = input()
N = int(N)
W = input().split()

for i in range(N):
  W[i] = int(W[i])
  
total = sum(W)
prefix = []
delta = []
for i in range(N):
  prefix.append(sum(W[:i+1]))
  
for i in range(N):
  delta.append(abs(prefix[N-1] /2 - prefix[i]))
  
answer = min(delta) * 2
print(int(answer))
Buggy python submission (verdict: Runtime Error):
import math
a = input.slice("")[0]
p = input.slice("")[1]

print(math.floor((3a+p)/2))

Fixed submission:
import math

a,p = (int(i) for i in input().split(" "))

print(math.floor((3*a+p)/2))
Buggy python submission (verdict: Runtime Error):
a,b = input(),split()
a = int(a)
b = int(b)
price = 0
if(a>=13):
  price = b
if(a>=6):
  price = b / 2
print(price)

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b)
price = 0
if a>=13:
    price = b
elif a>=6:
    price = b / 2
else:
    price = 0
price = int(price)
print(price)
Buggy python submission (verdict: Runtime Error):
S = input()

n = 0

for i in S:
    if S[i] == '+':
        n += 1
    else:
        n -= 1

print(n)

Fixed submission:
S = input()

n = 0

i = 0

while i < 4:
    if S[i] == '+':
        n += 1
    else:
        n -= 1
    i += 1

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)


ans = function(0)
for i in range(n):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)
    

ans = function(0)
for i in range(b):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)


ans = function(0)
for i in range(n):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)
    

ans = function(0)
for i in range(b):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)


ans = function(0)
for i in (n):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)
    

ans = function(0)
for i in range(b):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)


ans = function(0)
for i in (n):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)

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


def function(x, a=a, b=b):
    return int(a * x / b) - a * int(x / b)
    

ans = function(0)
for i in range(b):
    if i * b - 1 > n:
        ans = max(ans, function(n))
        break
    ans = max(ans, function(i * b - 1))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

count = 0
List = []
for i in range(n):
    s = input()
    if s not in List:
        count += 1
        List.append(s)

print(count)

Fixed submission:
n = int(input())
List = [[] for i in range(10)]
for i in range(n):
    s = input()
    List[len(s) - 1].append(s)

count = 0
for each_list in List:
    each_list = list(set(each_list))
    count += (len(each_list))



print(count)
Buggy python submission (verdict: Runtime Error):
na, nb, a, b, c = map(int, input().split())
ab_list = [0 for i in range(na + nb)]
ab_list[:na] = list(map(int, input().split()))[:na]
ab_list[na:] = list(map(int, input().split()))[:nb]
c_list = list(map(int, input().split()))[:min(na + nb, c)]

ab_list.sort()
c_list.sort(reverse=True)

c_max = c_list[0]
for index in range(len(ab_list)):
    if c_max <= ab_list[index]:
        ab_index = index
        break
ab_list[:ab_index] = sorted(ab_list[:ab_index] + c_list[:ab_index], reverse=True)[:ab_index]

print(sum(ab_list))

Fixed submission:
na, nb, a, b, c = map(int, input().split())
ab_list = [0 for i in range(na + nb)]
ab_list[:na] = sorted(list(map(int, input().split())), reverse=True)[:na]
ab_list[na:] = sorted(list(map(int, input().split())), reverse=True)[:nb]
ab_list += sorted(list(map(int, input().split())), reverse=True)[:min(na + nb, c)]

ab_list.sort(reverse=True)

print(sum(ab_list[:na + nb]))
Buggy python submission (verdict: Runtime Error):
n,d = (int(i) for i in input().split())

d = d*2 +1
q = n//d
mod = n % d
ans = q
if mod != 0:
    ans += 1

print(ans)

Fixed submission:
r = int(input())
t = 3*r**2
print(t)
Buggy python submission (verdict: Runtime Error):
x, a = = (int(i) for i in input().split())
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
function(x,a)

Fixed submission:
x, a = (int(i) for i in input().split())
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
print(function(x,a))

Buggy python submission (verdict: Runtime Error):
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
function(x, a)

Fixed submission:
x, a = (int(i) for i in input().split())
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
print(function(x,a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for input in range(n):
    a, b = int(input().split())
    count += b-a+1

print(count)

Fixed submission:
n = int(input())
count = 0
for i in range(n):
    a, b = map(int, input().split())
    count += b-a+1

print(count)
Buggy python submission (verdict: Runtime Error):
o = input()
e = input()

o_length = len(o)
e_length = len(e)

for letter in range(len(o)):
    print(o[letter], end="")
    print(e[letter], end="")

if len(o) == len(e):
    print(o[len(o)], end="")
    print(e[len(e)])
else:
    print(o[len(o)])

Fixed submission:
o = input()
e = input()

for letter in range(len(o)-1):
    print(o[letter], end="")
    print(e[letter], end="")

if len(o) == len(e):
    print(o[len(o)-1], end="")
    print(e[len(e)-1])
else:
    print(o[len(o)-1])
Buggy python submission (verdict: Runtime Error):
b = [int(e) for e in input().split()]
count=0

for i in range(b[0]+1):
    for j in range(b[1]+1):
        for k in range(b[2]+1):
            x = 500*i+100*j+50*k
            if(x == b[3]):
                count += 1

print(count)

Fixed submission:
#b = [int(e) for e in input().split()]
a=input()
a=int(a)
b=input()
b=int(b)
c=input()
c=int(c)
d=input()
d=int(d)


count=0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            x = 500*i+100*j+50*k
            if(x == d):
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
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")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
a= int(input())
b = int(input())
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")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
import math

n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
list = []
for i in range(n+1):
    x=math.floor(i/1000) +math.floor(i/100)+math.floor(i/10)+i%10
    #print(x)
    if(x>=a and x<=b):
        list.append(i)

print(sum(list))
#print(list)

Fixed submission:
import math

b = [int(e) for e in input().split()]
"""
n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
"""
list = []
for i in range(b[0]+1):
    x=i
    check = 0
    #print(x)
    while(True):
        check=check+x%10
        x=math.floor(x/10)
        #print(x)
        if(x==0):
            break
    if(check>=b[1] and check<=b[2]):
        list.append(i)

print(sum(list))
#print(list)
Buggy python submission (verdict: Runtime Error):
n=input()
list=[]
for i in range(int(n)):
    a = input()
    list.append(int(a))
count=0
flag=0

while True:
    for i in range(int(n)):
        if(list[i]%2 != 0):
            flag += 1
    if(flag==1):
        break
        
    for i in range(int(n)):
        list[i] = list[i]/2
    count += 1
    
print(count)

Fixed submission:
n=input()
n=int(n)

b = [int(e) for e in input().split()]
count=0
flag=0

#print(b[0])

while True:
    for i in range(n):
        if(b[i]%2 != 0):
            flag=1
            break
    if(flag==1):
        break
    count += 1
    for i in range(n):
        b[i]=b[i]/2

print(count)