Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = input()
r = dict(Counter(s))
l = {'W': 0, 'E': 0}
if s[0] == 'W':
    a = r['E']
else:
    a = r['E'] - 1
for c in s:
    if c == 'W' and r['W'] > 0:
        l['W'] += 1
        r['W'] -= 1
    if c == 'E' and r['E'] > 0:
        l['E'] += 1
        r['E'] -= 1
    if c == 'W':
        a = max(1, min(a, l['W'] + r['E'] - 1))
    else:
        a = max(1, min(a, l['W'] + r['E']))
print(a)



Fixed submission:
from collections import Counter
n = int(input())
s = input()
r = dict(Counter(s))
if 'W' not in r:
    r['W'] = 0
if 'E' not in r:
    r['E'] = 0
l = {'W': 0, 'E': 0}
a = []
for c in s:
    l[c] += 1
    r[c] -= 1
    l[c] -= 1
    a.append(l['W'] + r['E'])
    l[c] += 1
print(min(a))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if !(s[i].isdigit()):
      print('No')
      sys.exit(0)
  for i in range(b):
    if !(s[len(a)+i+1].isdigit()):
      print('No')
      sys.exit(0)
  if s[len(a)] != '-':
    print('No')
  else:
    print('Yes')

Fixed submission:
a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if s[i].isdigit() == False:
      print('No')
      sys.exit(0)
  for i in range(b):
    if s[a+i+1].isdigit() == False:
      print('No')
      sys.exit(0)
  if s[a] != '-':
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: sum += i
    
print(sum)

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

def digitSum(n):
    return sum(list(map(int, list(str(n)))))
  
s = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: s += i
    
print(s)

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

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c && c <= b: sum += i
    
print(sum)

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

def digitSum(n):
    return sum(list(map(int, list(str(n)))))
  
s = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: s += i
    
print(s)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')


Fixed submission:
x, y = input().split()
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')
Buggy python submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c2 = c2[::-1]

import sys
for (a, b) in zip(c1, c2):
    if a != b:
        print('NO')
        sys.exit(1)

print('YES')


Fixed submission:
c1 = input()
c2 = input()
c2 = c2[::-1]

import sys
for (a, b) in zip(c1, c2):
    if a != b:
        print('NO')
        sys.exit(0)

print('YES')
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
ss = [list(input()) for i in range(h)]
s = list(map(lambda x: list(map(lambda y: 1 if y == '#' else 0, x)), ss))

def calc(x, y):
    if (x+1) == 1 and (y+1) == 1:
        return s[x+1][y] + s[x][y+1] + s[x+1][y+1]
    elif (x+1) == h and (y+1) == 1:
        return s[x-1][y] + s[x][y+1] + s[x-1][y+1]
    elif (x+1) == 1 and (y+1) == w:
        return s[x+1][y] + s[x][y-1] + s[x+1][y-1]
    elif (x+1) == h and (y+1) == w:
        return s[x-1][y] + s[x][y-1] + s[x-1][y-1]
    elif (x+1) == 1:
        return s[x+1][y] + s[x][y-1] + s[x][y+1] + s[x+1][y+1] + s[x+1][y-1]
    elif (x+1) == h:
        return s[x-1][y] + s[1][y-1] + s[x][y+1] + s[x-1][y+1] + s[x-1][y-1]
    elif (y+1) == 1:
        return s[x+1][y] + s[x-1][y] + s[x][y+1] + s[x-1][y+1] + s[x+1][y+1]
    elif (y+1) == w:
        return s[x+1][y] + s[x-1][y] + s[x][y-1] + s[x-1][y-1] + s[x+1][y-1]
    else:
        return s[x-1][y] + s[x+1][y] + s[x][y-1] + s[x][y+1] + s[x+1][y+1] + s[x+1][y-1] + s[x-1][y+1] + s[x-1][y-1]

a = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if ss[i][j] == '#': a[i][j] = '#'
        else: a[i][j] = calc(i, j)

for i in range(h):
    for j in range(w):
        print(a[i][j], end='')
    print('')


Fixed submission:
h, w = map(int, input().split())
s = [input() for _ in range(h)]
for i in range(h):
    l = ''
    for j in range(w):
        if s[i][j] == '#': l += '#'
        else:
            l += str(sum([ss[max(0, j-1):min(w, j+2)].count('#') for ss in s[max(0, i-1):min(h, i+2)]]))
    print(l)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_b = [input() for i in range(n)]
min = 1000000001
max = -1
max_point = 0
for i in a_b:
    a, b = map(int, i.split())
    if(min > a):
        min = a
    if(max < a):
        max = a
        max_point = b

num = 0
num += min
num += max - min
num += max_point

print(num)


Fixed submission:
s = str(input())
char = list(s)
num = 0
for c in char:
    if int(c) == 1:
        num += 1

print(num)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a_b = [input() for i in range(n)]
min = 1000000001
max = -1
max_point = 0
for i in a_b:
    a, b = map(int, i.split())
    if(min > a):
        min = a
    if(max < a):
        max = a
        max_point = b

num = 0
num += min
num += max - min
num += max_point

print(num)


Fixed submission:
s = str(input())
char = list(s)
num = 0
for c in char:
    if int(c) == 1:
        num += 1

print(num)
Buggy python submission (verdict: Runtime Error):
def flip(N, M, K, Mnum, Nnum, black):
    if black < 0 or black > K:
        return False
    if black == K:
        return True

    return flip(N, M, K, Mnum, Nnum+1, black+N-(Mnum*2)) or flip(N, M, K, Mnum+1, Nnum, black+M-(Nnum*2))

if __name__ == '__main__':
    inputs = input('> ').split()
    if flip(int(inputs[0]), int(inputs[1]), int(inputs[2]), 0, 0, 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
N, M, k = tuple(int(i) for i in input().split(' '))
ans = 'No'
for a in range(N + 1):
    for b in range(M + 1):
        if M * a + N * b - 2 * a * b == k:
            ans = 'Yes'
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
def flip(N, M, K, Mnum, Nnum, black):
    if black < 0 or black > K:
        return False
    if black == K:
        return True

    return flip(N, M, K, Mnum+1, Nnum, black+M-Nnum) or flip(N, M, K, Mnum, Nnum+1, black+N-Nnum)

if __name__ == '__main__':
    inputs = input('> ').split()
    if flip(int(inputs[0]), int(inputs[1]), int(inputs[2]), 0, 0, 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
N, M, k = tuple(int(i) for i in input().split(' '))
ans = 'No'
for a in range(N + 1):
    for b in range(M + 1):
        if M * a + N * b - 2 * a * b == k:
            ans = 'Yes'
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
def flip(N, M, K, Mnum, Nnum, black):
    print('count: ', Mnum+Nnum)
    print(black)
    if black < 0 or black > K:
        return False
    if black == K:
        return True

    return flip(N, M, K, Mnum+1, Nnum, black+M-Nnum) or flip(N, M, K, Mnum, Nnum+1, black+N-Nnum)

if __name__ == '__main__':
    inputs = input('> ').split()
    if flip(int(inputs[0]), int(inputs[1]), int(inputs[2]), 0, 0, 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
N, M, k = tuple(int(i) for i in input().split(' '))
ans = 'No'
for a in range(N + 1):
    for b in range(M + 1):
        if M * a + N * b - 2 * a * b == k:
            ans = 'Yes'
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
print(''.join([s[i] if i%2 == 1 for i in range(len(s))]))

Fixed submission:
s = input()
print(''.join([s[i] for i in range(len(s)) if i%2 == 0]))
Buggy python submission (verdict: Runtime Error):
cos = map(int, intput().split())
res = min(cos)
cos.remove(min(cos))
res += min(cos)
print(res)


Fixed submission:
cos = list(map(int, input().split()))
res = min(cos)
cos.remove(min(cos))
res += min(cos)
print(res)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c in y in c):
    print('Yes')
else:
    print('No')


Fixed submission:
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
ab = [int(input()) for _ in range(2)]
if a[0] > a[1]: print('GREATER')
elif a[0] < a[1]: print('LESS')
else: print('EQUAL')

Fixed submission:
a = [int(input()) for _ in range(2)]
if a[0] > a[1]: print('GREATER')
elif a[0] < a[1]: print('LESS')
else: print('EQUAL')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
cur = 0
for c in s:
	if c == 'I':
		cur += 1
        ans = max(ans, cur)
    else:
		cur -= 1
          
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = 0
cur = 0
for c in s:
    if c == 'I':
        cur += 1
        ans = max(cur, ans)
    else:
        cur -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
num = list(map(int, input().split()))
if max(num) == sum(num.remove(max(num))): print('Yes')
else: print('No')

Fixed submission:
print('Yes' if (lambda x: sum(x[:2]) == x[2])(sorted(map(int, input().split()))) else 'No')
Buggy python submission (verdict: Runtime Error):
l = sort(map(int, input().split()))
if l[0] == l[1] == l[2]:
    print('1')
elif l[0] == l[1]:
    print('2')
else:
    print('3')


Fixed submission:
l = sorted(map(int, input().split()))
if l[0] == l[1] == l[2]:
    print('1')
elif l[0] == l[1] or l[1] == l[2]:
    print('2')
else:
    print('3')
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

ans = 1
a = 7
i = K
while K > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)


Fixed submission:
K = int(input())

ans = 1
a = 7
i = K
while i > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)

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

ans = 1
a = 7
i = K
while K > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)


Fixed submission:
K = int(input())

ans = 1
a = 7
i = K
while i > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())


power = 1


for i in range(1, N + 1):
    power *= i


power %= 10 ** 9 + 7

print(power)


Fixed submission:
# N回だけトレーニングする
import numpy as np
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力

for i in range(1, N + 1):
    power = np.mod(i * power, 10 ** 9 + 7)
print(power)

Buggy python submission (verdict: Time Limit Exceeded):
# N回だけトレーニングする
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
for i in range(1, N + 1):
    power *= i

# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力
power %= 10 ** 9 + 7

print(power)


Fixed submission:
# N回だけトレーニングする
import numpy as np
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力

for i in range(1, N + 1):
    power = np.mod(i * power, 10 ** 9 + 7)
print(power)

Buggy python submission (verdict: Time Limit Exceeded):
# N回だけトレーニングする
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
for i in range(1, N + 1):
    power *= i

# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力
power %= 10 ** 9 + 7

print(power)


Fixed submission:
# N回だけトレーニングする
import numpy as np
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力

for i in range(1, N + 1):
    power = np.mod(i * power, 10 ** 9 + 7)
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
# 非負の整数a, b(a ≤ b)と 、 正の整数xが与えられます 。
# a以上b以下の整数のうち 、 xで割り切れるものの個数を求めてください 。
a, b, x = [int(i) for i in input().split()]

cou = 0
for i in range(a, b + 1):
    if i % x == 0:
        cou += 1

print(cou)


Fixed submission:
a, b, x = [int(i) for i in input().split()]

def ret(n):
    if n>=0:
        return n//x+1
    else:
        return 0
print(ret(b)-ret(a-1))
Buggy python submission (verdict: Runtime Error):
X,Y = map(int, input().split())

for i in range(0,X):
    foot = 2*i+4*(X-i)
    if foot==Y:
        print('Yes')
        break
else:
    print('No')


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

count=x.index(0)
ans = count+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a = list(map(int, input().split()))

for i in range(k,n):
    thescore=a[i]
    lastsemester=a[i-1]
    for j in range(1,k):
        thescore*=a[i-j]
        lastsemester*=a[i-1-j]
    if thescore>lastsemester:
        print("Yes")
    else:
        print("No")

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

for i in range(k,n):
    if a[i]>a[i-k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

K=int(input())
ans=0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(i,math.gcd(k,j))
print(ans)

Fixed submission:
from math import gcd

K=int(input())
ans=0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i,gcd(k,j))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math

K=int(input())
ans=0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(i,math.gcd(k,j))
print(ans)

Fixed submission:
from math import gcd

K=int(input())
ans=0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i,gcd(k,j))
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K=map(int, input().split())
nums=list()
nums.append(N)
 
while abs(N-K)<N:
    N=abs(N-K)
    nums.append(N)
print(min(nums))

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

Buggy python submission (verdict: Runtime Error):
N, K=map(int, input().split())
nums=list()
nums.append(N)

while abs(N-K)<N:
    N=abs(N-K)
    nums.append(N)
print(min(nums))

Fixed submission:
A, B, C=map(int, input().split())
print(C,A,B)
Buggy python submission (verdict: Time Limit Exceeded):
N, K=map(int, input().split())
nums=list()
nums.append(N)

while abs(N-K)<N:
    N=abs(N-K)
    nums.append(N)
print(min(nums))

Fixed submission:
N, K=map(int,input().split())
t=N%K
ans=min(abs(t),abs(t-K))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

for i in range(1100):
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        exit()
print(-1)

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())

for i in range(1,1100):
    if int(i*0.8)==A and int(i*0.1)==B:
        print(i)
        break
else:
    print(-1)


Fixed submission:
N, A, B, =map(int, input().split())
ans=N//(A+B)*A
rem=N%(A+B)
ans+=min(rem,A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())

while True:
    A-=1
    K-=1
    if A==0 or K==0:
        break
while True:
    B-=1
    K-=1
    if B==0 or K==0:
        break
print(A,B)


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

if A-K>=0:
    A=A-K
elif B-(K-A)>=0:

    B=B-(K-A)
    A=0
else:
    A=0
    B=0
print(A,B)
Buggy python submission (verdict: Runtime Error):
N,A,B = input().split()
N = long long (N)
A = int(A)
B = int(B)
rep = (int)(N/(A+B))

numb = min(N%(A+B),A) + rep*A

print(numb)

Fixed submission:
N,A,B = input().split()
N = int (N)
A = int(A)
B = int(B)
rep = (int)(N/(A+B))

numb = min(N%(A+B),A) + rep*A

print(numb)
Buggy python submission (verdict: Runtime Error):
S=input()
n=len(S)
a=0
b=0
for i in range((n-1)/2):
	if S[i]!=S[n-i]:
    	a=1
        print("No")
        break;
p=""
q=""
if a==0:
	for i in range((n-1)/2):
		p.append(S[i])
    	q.append(S[i+1+(n-1)/2])
	for i in range((len(p)-1)/2):
  		if p[i]!=p[len(p)-i] or q[i]!=q[len(p)-i]:
        	b=1
            print("No")
            break;
if a==0 and b==0:
	print("Yes")


Fixed submission:
S=input()
n=len(S)
a=0
b=0
for i in range(1,int(n/2)+1):
    if S[i-1]!=S[n-i]:
        a=1
        print("No")
        break;
p=[]
q=[]
if a==0:
    for i in range(1,int(n/2)+1):
        p.append(S[i-1])
        q.append(S[i+int(n/2)])
    #print(p,q)
    for i in range(1,int((len(p))/2)+1):
        #print(p[i-1],p[len(p)-i],q[i-1],q[len(p)-i])
        if p[i-1]!=p[len(p)-i] or q[i-1]!=q[len(p)-i]:
            b=1
            print("No")
            break;
if a==0 and b==0:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(6-a-b)

Fixed submission:
a=int(input())
b=int(input())
c=6-a-b
print(c)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>=b:
    c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue

Fixed submission:
a,b=map(int,input().split())
if a>=b:
    c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>=b:
	c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue


Fixed submission:
a,b=map(int,input().split())
if a>=b:
    c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
      f++
    else:
      g++
    #printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)
 

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
#print(A)
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
        f+=1
    else:
        g+=1
#printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(0,n):
    a[i]=int(input())
f=0
g=1
for i in range(0,n):
    if a[i]!=g:
      f++
    else:
      g++
    #printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)



Fixed submission:
n=int(input())
A=list(map(int,input().split()))
#print(A)
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
        f+=1
    else:
        g+=1
#printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a<10&&b<10:
	print(a*b)
else:
	print(-1)

Fixed submission:
a,b=map(int,input().split())
if a<10 and b<10:
	print(a*b)
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = sorted(map(int, input().split()))
print(d[N/2]-d[N/2-1])


Fixed submission:
N = int(input())
d = sorted(map(int, input().split()))
K = d[int(N/2)]-d[int(N/2)-1]
print(K)
Buggy python submission (verdict: Runtime Error):
a, p=map(int, input().split())
b=(a/3)+p
if b%2==0:
    print(b/2¥n)
else:
    print((b-1)/2¥n)

Fixed submission:
a, p=map(int, input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
a, p=map(int, input().split())
b=(a/3)+p
if b%2==0:
    print(b/2¥n)
if else:
    print((b-1)/2¥n)

Fixed submission:
a, p=map(int, input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
a, p=map(int, input().split())
b=(a/3)+p
if b%2==0:
    print(b/2)
if else:
    print((b-1)/2)

Fixed submission:
a, p=map(int, input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
a,b=map(int input().split())
if a>=13:
    print(b)
elif a<=5:
    print(0)
else:
    print(b/2)
    


Fixed submission:
a,b=map(int,input().split())
if a>=13:
    print(b)
elif a<=5:
    print(0)
else:
    print(b//2)

Buggy python submission (verdict: Runtime Error):
a,b=map(int input().split())
if a>=13:
    print(b\n)
elif a<=5:
    print(0\n)
else:
    print(b/2\n)
    

Fixed submission:
a,b=map(int,input().split())
if a>=13:
    print(b)
elif a<=5:
    print(0)
else:
    print(b//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_li = list(map(int,input().split()))

result = a_li[0]
for i in range(1,n):
  result = result * a_li[i]

if result > 10 ** 18:
  print(-1)
else:
  print(result)

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

if 0 in a_li:
  print(0)
else:
  result = a_li[0]
  for i in range(1,n):
    result = result * a_li[i]
  
    if result > 10 ** 18:
      print(-1)
      break
    
  else:
    print(result)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int,input().split())

if a > k:
    print(k)
elif a + b > k:
    print(a)
else:
    sum = a
    for i in range(k - a - b):
        sum -= 1
    print(sum)

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

if a > k:
    print(k)
elif a + b > k:
    print(a)
else:
    sum = a - (k - a -b)
    print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
distance,num = map(int, input().split())
tmp = input()
a = tmp.split()
a = list(map(int,a))
b = []

for i in range(len(a)-1):
    b.append(a[i+1] - a[i])
b.append(distance - a[i+1] + a[0])

total = 0
min = 10000000000
for i in range(num):
    total = b[i]
    j = i + 1
    if i == 0:
        end = num - 1
    else:
        end = i - 1
    while(j != end):
        if j == num:
            j = 0
        else:
            total += b[j]
            j += 1
    if min > total:
        min = total

for i in range(num):
    total = b[i]
    j = i - 1
    if i == num - 1:
        end = 0
    else:
        end = i + 1
    while(j != end):
        if j == -1:
            j = num - 1
        else:
            total += b[j]
            j -= 1
    if min > total:
        min = total

print(min)

Fixed submission:
distance,num = map(int, input().split())
tmp = input()
a = tmp.split()
a = list(map(int,a))
b = []

for i in range(len(a)-1):
    b.append(a[i+1] - a[i])
b.append(distance - a[i+1] + a[0])

b = sorted(b)
min = 0
for i in range(len(b)-1):
    min += b[i]

print(min)
Buggy python submission (verdict: Time Limit Exceeded):
int(input())
A=list(map(int,input().split()))
ans=1
for i in A:
  ans*=i
if ans>10**18:
  print('-1')
else:
  print(ans)

Fixed submission:
int(input())
A=list(map(str,input().split()))
ans=1
if '0' in A:
  print('0')
  exit()
for i in A:
  ans*=int(i)
  if ans>10**18:
    print('-1')
    exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import re
def validate(text):
  match=re.search(r'(...)\1{2,}', text)
  return match.group(),match.start()

n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=1
count=''
for j in range(11):
  ans=a[ans-1]
  count+=str(ans)
#print(validate(count)[0][:3],validate(count)[1])
ans=1
for i in range((k-validate(count)[1])%len(validate(count)[0][:3])+validate(count)[1]):
  ans=a[ans-1]
print(ans)

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

p=1
if k<=n:
  for i in range(k):
    p=a[p-1]
  print(p)
  exit()

t=[-1]*n
t[0]=0
for i in range(1,n):
  p=a[p-1]
  if t[p-1] !=-1:
    break
  t[p-1]=i

d=i-t[p-1]
k-=i
k%=d
for i in range(k):
  p=a[p-1]
print(p)