Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
OP = ['+','-']
ans = 0
for op1 in OP:
    for op2 in OP:
        for op3 in OP:
            if eval(abc[0]+op1+abc[1]+op2+abc[2]+op3+abc[3]) == 7:
                ans = abc[0]+op1+abc[1]+op2+abc[2]+op3+abc[3]
print(ans+'=7')

Fixed submission:
import itertools

a,b,c,d = input()
pm = ['+','-']
for pm1,pm2,pm3 in itertools.product(pm,repeat=3):
    ans = a+pm1+b+pm2+c+pm3+d
    if eval(ans) == 7:
        print(ans+'=7')
        break

Buggy python submission (verdict: Runtime Error):
import sys
a,b,c,d = input()
pm = ['+','-']
for pm1 in PM:
    for pm2 in PM:
        for pm3 in PM:
            ans = a+pm1+b+pm2+c+pm3+d
            if eval(ans) == 7:
                print(ans+'=7')
                sys.exit()

Fixed submission:
import itertools

a,b,c,d = input()
pm = ['+','-']
for pm1,pm2,pm3 in itertools.product(pm,repeat=3):
    ans = a+pm1+b+pm2+c+pm3+d
    if eval(ans) == 7:
        print(ans+'=7')
        break
Buggy python submission (verdict: Runtime Error):
def f(L,res):
    for i in range(1,M+1):
        #print(i,L[i])
        if len(L[i]) == 1:
          L[L[i][0]].remove(i)
          L[i] = []
          res = f(L,res+1)
    return res


N,M = map(int,input().split())
L = [[] for _ in range(N+1)]

for i in range(M):
    a,b = map(int,input().split())
    L[a].append(b)
    L[b].append(a)
print(f(L,0))

Fixed submission:
def f(L,res):
    for i in range(1,N+1):
        #print(i,L[i])
        if len(L[i]) == 1:
            L[L[i][0]].remove(i)
            L[i] = []
            res = f(L,res+1)
    return res


N,M = map(int,input().split())
L = [[] for _ in range(N+1)]

for i in range(M):
    a,b = map(int,input().split())
    L[a].append(b)
    L[b].append(a)
print(f(L,0))
Buggy python submission (verdict: Time Limit Exceeded):
ans = []
for i in range(int(input())):
    a = int(input())
    if a in ans:
        ans.remove(a)
    else:
        ans.append(a)
print(len(ans))

Fixed submission:
from collections import Counter

A = [int(input()) for _ in range(int(input()))]
C = Counter(A)

ans = 0
for c in C.values():
    if c%2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)

cur_a = 0
cur_c = 0
res = 0
for a,c in ac.items():
	if c < 2:
		break
	if c >= 4:
		res = max(res,a*a)
	if cur_c == c
		res = max(res,cur_a*a)
		cur_a = max(cur_a,a)
	else:
		cur_a = a
		cur_c = c

print(res)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int,input().split()))

ac = Counter(a)

cur_a = 0
res = 0
# print(ac)
for a,c in ac.items():
	# print(a,c)
	if c < 2:
		continue
	else:
		res = max(res,cur_a*a)
		cur_a = max(cur_a,a)
		if c >= 4:
			res = max(res,a*a)
	# print(cur_a,res)
print(res)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b,cur):
	if cur % a == 0 and cur % b == 0:
		return cur
	return gcd(a,b,cur+a)


n = int(input())
T = [int(input()) for _ in range(n)]

while len(T) != 1:
	if len(T)%2 == 1:
		T.append(1)
	new_T = []
	for i in range(0,len(T),2):
		t1,t2 = T[i],T[i+1]
		a = max(t1,t2)
		b = min(t1,t2)
		res = gcd(a,b,a)
		new_T.append(res)
	T = new_T
	# print(T)
print(*T)

Fixed submission:
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)

n = int(input())
T = [int(input()) for _ in range(n)]

ans = 1
for t in T:
	ans = ans*t//gcd(ans,t)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
T = [int(input()) for _ in range(n)]

main_t = max(T)
cur = main_t
flag = True
while 1:
	for t in T:
		if cur%t != 0:
			flag = False
			break
	if flag:
		ans = cur
		break
	cur += main_t
	flag = True
	# print(cur)

print(ans)

Fixed submission:
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)

n = int(input())
T = [int(input()) for _ in range(n)]

ans = 1
for t in T:
	ans = ans*t//gcd(ans,t)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = []

for i in range(1, N+1):
    ans.append(A.index(i)+1)
print(' '.join(map(str, ans)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0]*N

for i, a in enumerate(A):
    ans[int(a-1)] = str(i+1)
print(' '.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
for i in range(1, N+1):
    ans.append(A.index(i)+1)
print(' '.join(map(str, ans)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0]*N

for i, a in enumerate(A):
    ans[int(a-1)] = str(i+1)
print(' '.join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = []
dic = {}

for i, j in enumerate(A):
    dic[i+1] = j
    dic_s = sorted(dic.items(), key=lambda x: x[1])
for i in dic_s:
    ans.append(i[0])
print(' '.join(map(str, ans)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0]*N

for i, a in enumerate(A):
    ans[int(a-1)] = str(i+1)
print(' '.join(map(str, ans)))

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

for i in sorted(A):
    res = A.index(i)
    ans.append(res+1)
print(' '.join(map(str, ans)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0]*N

for i, a in enumerate(A):
    ans[int(a-1)] = str(i+1)
print(' '.join(map(str, ans)))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    num = a.index(max(a))
    a[num] = max(a) // 2
print(sum(a))

Fixed submission:
from heapq import heappop,heappush,heapify

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_minus = [-a for a in A]

heapify(A_minus)

for _ in range(M):
    heappush(A_minus, -((-heappop(A_minus)) // 2))
ans = -sum(A_minus)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    num = a.index(max(a))
    a[num] = max(a) // 2
    a.sort()
print(sum(a))

Fixed submission:
from heapq import heappop,heappush,heapify

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_minus = [-a for a in A]

heapify(A_minus)

for _ in range(M):
    heappush(A_minus, -((-heappop(A_minus)) // 2))
ans = -sum(A_minus)
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    a[-1] = a[-1] // 2
    a.sort()
print(sum(a))

Fixed submission:
from heapq import heappop,heappush,heapify

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_minus = [-a for a in A]

heapify(A_minus)

for _ in range(M):
    heappush(A_minus, -((-heappop(A_minus)) // 2))
ans = -sum(A_minus)
print(int(ans))
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()))
ans = sum(b)
for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        if a[i] == 1:
            ans += c[0]
        else:
            ans += c[i+1]
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        ans += c[a[i]-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    if a[i] < a[i+1] < a[i+2] or a[i+2] < a[i+1] < a[i]
        cnt += 1
print(cnt)

Fixed submission:
s = input()
a = []
for n in s:
    a.append(n)
if a.count(a[0]) == 2 and a.count(a[1]) == 2 and a.count(a[2]) == 2 and a.count(a[3]) == 2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    if a[i] < a[i+1] < a[i+2] or a[i+2] < a[i+1] < a[i]
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    b = sorted([a[i], a[i+1], a[i+2]])
    if b.index(a[i+1]) == 1:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

ans = 0
for x in range(0, K+1):
  for y in range(0, K+1):
    for z in range(0, K+1):
      if x + y + z == S:
        ans += 1
print(ans)

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

ans = 0
for x in range(0, K+1):
  for y in range(0, K+1):
    z = S - x - y
    if 0 <= z <= K:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))

count = 0
A = 0
B = 0

while count < N+1 and len(a) >0: 
	m = max(a)
	A += m
	a.remove(m)  
	if len(a) > 0:
		m = max(a)
		B += m
		a.remove(m)
	count +=1

print(A - B)

Fixed submission:
nums = input().split()
N = int(nums[0])
A = int(nums[1])
B = int(nums[2])

n = 0
ans = 0
while n < N+1:
	n4 = n // 10**4
	n3 = n // 10**3 - n4 * 10
	n2 = n // 10**2 - n4 * 100 - n3 * 10
	n1 = n // 10 - n4 * 1000 - n3 * 100 - n2 * 10
	n0 = n % 10
	X = n4 + n3 + n2 + n1 + n0
	if X >= A and X <= B:     
		ans += n 
	n += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and Z <= K:
            ans += 1
print(ans)

Fixed submission:
K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if S - x - y >= 0 and S - x - y <= K:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()
if S='Sunny':
    print('Cloudy')
elif S='Cloudy':
    print('Rainy')
elif S='Rainy':
    print('Sunny')

Fixed submission:
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
elif S=='Rainy':
    print('Sunny')
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[int(x) for x in input().split()]
b=0
for i in range(N):
    b+=1/a[i]
    
print(1/b)

Fixed submission:
a=int(input())
s=input()
if a>=3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[int(x) for x in input().split()]

for i in range(N):
    b+=1/a[i]
    
print(1/b)

Fixed submission:
N=int(input())
A = sorted(map(int, input().split( )))
b=0
for i in range(N):
    b+=1/A[i]
print(1/b)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = int(input())

if a >= 3200:
	print(s)
else:
	print('red')a = int(input())
s =input()

if a >= 3200:
	print(s)
else:
	print('red')

Fixed submission:
a = int(input())
s =input()

if a >= 3200:
	print(s)
else:
	print('red')
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print((a * b) // math.gcd(a, b))

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

a, b = map(int, input().split())

print((a * b) // gcd(a, b))
Buggy python submission (verdict: Runtime Error):
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
b = ''
e = int(input())

for c in list(input()):
  d = a.index(c)
  if d > 23:
    d = d - (23 + e + 1)
  b += a[(d+e)]

print(b)

Fixed submission:
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
b = ''
e = int(input())

for c in list(input()):
  d = a.index(c)
  if d > 25 - e:
    d = d - (26)
    b += a[(d+e)]
  else:
    b += a[(d+e)]

print(b)

Buggy python submission (verdict: Runtime Error):
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
b = ''

for c in list(input()):
  d = a.index(c)
  if d > 23:
    d = d - 26
  b += a[d+2]

print(b)

Fixed submission:
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
b = ''
e = int(input())

for c in list(input()):
  d = a.index(c)
  if d > 25 - e:
    d = d - (26)
    b += a[(d+e)]
  else:
    b += a[(d+e)]

print(b)
Buggy python submission (verdict: Runtime Error):
import math
s, t = input().split()
s = int(s)
t = int(t)
result = s * t / math.gcd(s,t)
print(int(result))

Fixed submission:
import fractions
s, t = input().split()
s = int(s)
t = int(t)
result = s * t / fractions.gcd(s,t)
print(int(result))

Buggy python submission (verdict: Runtime Error):
import math
s, t = input().split()
s = int(s)
t = int(t)
result = s * t // math.gcd(s,t)
print(result)

Fixed submission:
import fractions
s, t = input().split()
s = int(s)
t = int(t)
result = s * t / fractions.gcd(s,t)
print(int(result))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split()
if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)

Fixed submission:
a, b = map(int, input().split())
if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)

Fixed submission:
a, b = map(int, input().split())
if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)
Buggy python submission (verdict: Runtime Error):
import math

a,b = input().split()
a = int(a)
b = int(b)

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))





Fixed submission:

a,b = input().split()
a = int(a)
b = int(b)

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a



def lcm(a,b):
  return a*b//gcd(a,b)


print(lcm(a, b))

Buggy python submission (verdict: Runtime Error):
import math

a,b = input().split()
a = int(a)
b = int(b)

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))





Fixed submission:

a,b = input().split()
a = int(a)
b = int(b)

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a



def lcm(a,b):
  return a*b//gcd(a,b)


print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
weekday = [SUN,MON,TUE,WED,THU,FRI,SAT]
s = input()

if(s == "SUN"):
    print("7")
if(s == "MON"):
    print("6")
if(s == "TUE"):
    print("5")
if(s == "WED"):
    print("4")
if(s == "THU"):
    print("3")
if(s == "FRI"):
    print("2")
if(s == "SAT"):
    print("1")

Fixed submission:
n = input()

if(n == "SUN"):
    print(7)
elif (n == "MON"):
    print(6)
elif (n == "TUE"):
    print(5)
elif (n == "WED"):
    print(4)
elif (n == "THU"):
    print(3)
elif (n == "FRI"):
    print(2)
elif (n == "SAT"):
    print(1)
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
 
def Calprice(n):
  return a * n + b * len(str(n))
 
min = 0
max = 10 ** 9 + 1
 
while max - min > 1:
  dev = (max + min) // 2
  if Calprice(dev) > x:
    max = dev
  else:
    min = dev

print(min)
    

Fixed submission:
N = int(input())
S = list(input())
res =[]
for s in S:
    if(ord(s) + N > 90):
        res.append(chr((ord(s)+N-26)))
    else:
        res.append(chr((ord(s)+N)))
print("".join(res))
Buggy python submission (verdict: Runtime Error):
i = int(input())
s = input()
n = i // 2
s1 = s[0:n]
s2 = s[n:i]
#print(s1)
#print(s2)

if((i % 2 == 0)and(s1 == s2)):
    print("Yes")
e6lse:
    print("No")

Fixed submission:
i = int(input())
s = input()
n = i // 2
s1 = s[0:n]
s2 = s[n:i]

if((i % 2 == 0)and(s1 == s2)):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A, B, T = input().sprit()
print(int(T/A)*B)

Fixed submission:
A, B, T = map(int, input().split())
print(int(T/A)*B)
Buggy python submission (verdict: Runtime Error):
import numpy as np
def q3(a,b):
    return np.lcm(a,b)

ans = input().split()
a = int(ans[0])
b = int(ans[1])
print(q3(a,b))

Fixed submission:
def q3(a,b):
  x = a*b
  if(a<b):
    tmp = a
    a=b
    b=tmp
  r=a%b
  while(not(r==0)):
    a=b
    b=r
    r=a%b
  return int(x/b)


ans = input().split()
a = int(ans[0])
b = int(ans[1])
print(q3(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
 
for i in range(n):
    a[i] = int(input())
 
ct = 0
for i in range(n):
    t = a.count(a[i])
    if t % 2 == 1:  # nかかる？この時点でn^2?
        ct += 1
 
    i += t
 
print(ct)

Fixed submission:
N = int(input())
ans = 0
n = []
for i in range(N):
  n.append(int(input()))
n.sort()
i=0
cnt = 1
while(i<N-1):
  if n[i] == n[i+1]:
    cnt+=1
  else:
    if cnt%2==1:
      ans+=1
    cnt = 1
    
  i+=1
if cnt%2==1:
  ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
tmp = input().split(" ")
if tmp[2]-tmp[1] <= 0:
  print("delicious")
elif tmp[2]-tmp[1]>tmp[0] :
  print("dangerous")
else :
  print("safe")

Fixed submission:
tmp = input().split(" ")
x=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])

if b-a <= 0:
  print("delicious")
elif b-a>x :
  print("dangerous")
else :
  print("safe")
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())

lim = math.ceil(math.sqrt(n))

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
prime = callIsPrime(n)

arr = [0] * lim

for i in range(len(prime)):
  j = 1
  while n > prime[i] ** j :
    arr[i] += int(n / prime[i] ** j)
    j += 1
  
ans = 1
for i in arr :
  if i != 0:
    ans *= i+1

print(ans)

Fixed submission:
import math

n = int(input())

lim = n

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
prime = callIsPrime(n+1)

arr = [0] * len(prime)

for i in range(len(prime)):
  j = 1
  while n >= prime[i] ** j :
    arr[i] += int(n / prime[i] ** j)
    j += 1
  
ans = 1
for i in arr :
  if i != 0:
    ans *= i+1

print(ans % (10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())

As = input().split()
A = [0]*N

for n in range(N): 
  A[n] = float(int(As[n]))
A.sort()

for m in range(M):
  
  midx = 0
  mval = 0
  for n in range(N):
    if mval<A[n]:
      mval = A[n]
      midx = n
  A[midx]=A[midx]/2.0
  
Asum = 0
for n in range(N):
  Asum += int(A[n])
print(Asum)

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

As = input().split()
A = [0]*N

for n in range(N): 
  A[n] = float(int(As[n]))+0.1
A.sort()

tid = [0]*M
ct = -1
cid = -1
ms = 0

for m in range(M):
  if ct==-1:
    A[N-1] = A[N-1]/2.0
    tid[0] = N-1
    ct = 1
    cid = 0
  else:
    if N-1-m+ms<0 or A[tid[cid]]>A[N-1-m+ms]:
      A[tid[cid]] = A[tid[cid]]/2.0
      tid[ct] = tid[cid]
      ct += 1
      cid += 1
      ms+=1
    else:
      A[N-1-m+ms] = A[N-1-m+ms]/2.0
      tid[ct] = N-1-m+ms
      ct += 1

Asum = 0
for n in range(N):
  Asum += int(A[n])
print(Asum)
Buggy python submission (verdict: Runtime Error):
def encode(s):
#  r = [0]*26
#  for n in range(len(s)):
#    r[ord(s[n]) - ord('a')] += 1
#  return r
#  r = list(s)
#  r.sort()
#  return r
  r = 0
  for n in range(len(s)):
    so = ord(s[n]) - ord('a')
    r += 11**so
  return r

N = int(input())

S = []

for n in range(N):
  s = str(input())
  S = S + [encode(s)]

S.sort()
print('a')
ct = 0
M=1
ps=""
for cs in S:
  if cs==ps:
    M+=1
  else:
    ct += int((M**2-M)/2)
    M=1
    ps=cs
ct += int((M**2-M)/2)

print(ct)
      
  

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

x1=A+B
x2=A-B
x3=A*B

print(max(x1,max(x2,x3)))

Buggy python submission (verdict: Runtime Error):
def encode(s):
#  r = [0]*26
#  for n in range(len(s)):
#    r[ord(s[n]) - ord('a')] += 1
#  return r
#  r = list(s)
#  r.sort()
#  return r
  r = 0
  for n in range(len(s)):
    so = ord(s[n]) - ord('a')
    r += 11**so
  return r

N = int(input())

S = []

for n in range(N):
  s = str(input())
  S = S + [encode(s)]

S.sort()
ptint('a')
ct = 0
M=1
ps=""
for cs in S:
  if cs==ps:
    M+=1
  else:
    ct += int((M**2-M)/2)
    M=1
    ps=cs
ct += int((M**2-M)/2)

print(ct)
      
  

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

x1=A+B
x2=A-B
x3=A*B

print(max(x1,max(x2,x3)))
Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
G = []

for n in range(H):
  G = G + [input()]
  
L = [[0 for w in range(W)] for h in range(H)]
R = [[0 for w in range(W)] for h in range(H)]
U = [[0 for w in range(W)] for h in range(H)]
D = [[0 for w in range(W)] for h in range(H)]

for i in range(H):
  for j in range(1,W):
    if G[i][j]=='#' or G[i][j-1]=='#':
      L[i][j] = 0
    else:
      L[i][j] = L[i][j-1]+1
        
    if G[i][W-1-j]=='#' or G[i][W-j]=='#':
      R[i][W-1-j] = 0
    else:
      R[i][W-1-j] = R[i][W-j]+1
  
for i in range(1,H):
  for j in range(W):
    if G[i][j]=='#' or G[i-1][j]=='#':
      U[i][j] = 0
    else:
      U[i][j] = U[i-1][j]+1
        
    if G[H-1-i][j]=='#' or G[H-i][j]=='#':
      D[H-1-i][j] = 0
    else:
      D[H-1-i][j] = D[H-i][j]+1

v = [0]*H
for i in range(H):
  v_ = [0]*W
  for j in range(W):
    if G[i][j]=='.':
      v_[j] = L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
  v[i] = max(v_)
print(max(v))

Fixed submission:
H,W = map(int,input().split())
G = []

for n in range(H):
  G = G + [input()]
  
L = [[0 for w in range(W)] for h in range(H)]
R = [[0 for w in range(W)] for h in range(H)]
U = [[0 for w in range(W)] for h in range(H)]
D = [[0 for w in range(W)] for h in range(H)]

for i in range(H):
  for j in range(1,W):
    if G[i][j]=='#' or G[i][j-1]=='#':
      L[i][j] = 0
    else:
      L[i][j] = L[i][j-1]+1
        
    if G[i][W-1-j]=='#' or G[i][W-j]=='#':
      R[i][W-1-j] = 0
    else:
      R[i][W-1-j] = R[i][W-j]+1
  
for i in range(1,H):
  for j in range(W):
    if G[i][j]=='#' or G[i-1][j]=='#':
      U[i][j] = 0
    else:
      U[i][j] = U[i-1][j]+1
        
    if G[H-1-i][j]=='#' or G[H-i][j]=='#':
      D[H-1-i][j] = 0
    else:
      D[H-1-i][j] = D[H-i][j]+1

v = [0]*H
for i in range(H):
  v_ = [0]*W
  for j in range(W):
    if G[i][j]=='.':
      v_[j] = L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
  v[i] = max(v_)
print(max(v))
Buggy python submission (verdict: Time Limit Exceeded):
import re

S = input()
ct = 0

while True:
  D = re.findall('A+BC',S)
  if len(D)==0:
    break
  for d in D:
    num = len(d)-2
    R=re.subn(d, 'BC'+'A'*num, S)
    S=R[0]
    ct+=R[1]*num
print(ct)

Fixed submission:
import re

S = input()
ct = 0

na = 0
bf = False
ct = 0
for s in S:
  if s =='A':
    if bf==True:
      na = 1
    else:
      na += 1
    bf = False
      
  if s == 'B':
    if na > 0 and bf==False:
      bf = True
    else:
      na = 0
      bf = False
  if s == 'C':
    if bf:
      ct += na
    else:
      na = 0
    bf = False
print(ct)
Buggy python submission (verdict: Runtime Error):
A,P = map(int,input.split())

N = A*3+P
M = int(N/2)

print(M)

Fixed submission:
A,P = map(int,input().split())
 
N = A*3+P
M = int(N/2)
 
print(M)
Buggy python submission (verdict: Runtime Error):
import collections as cl

N=int(input())

L = cl.deque()

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]>P):
      L.insert(j,(S,P,i))
      flg = True
  if flg==False:
    L.append(j,(S,P,i))
    
I = [0]*N
for i in range(N):
  I[L[i][2]] = i+1

for i in range(N):
  print(I[i])
      




Fixed submission:
import collections as cl

N=int(input())

L = []

for i in range(N):
  S,P_ = input().split()
  P = int(P_)
  
  flg = False
  for j in range(len(L)):
    if L[j][0]>S or (L[j][0]==S and L[j][1]<P):
      L.insert(j,(S,P,i))
      flg = True
      break
  if flg==False:
    L.append((S,P,i))
        
#I = [0]*N
for i in range(N):
  print(L[i][2]+1)
#  I[L[i][2]] = i+1