Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def for_factorial(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
    return int(val/2)
N = int(input())
l = []
_l = [] #並び替えた文字列の格納
_c = 0 #カウントの総合
#1)リストの作成
for i in range(N):
    l.append(input())
#2)文字列の並び替えを"_l"に格納
for s in l:
    one_l = [c for c in s]
    one_l.sort()
    _one_l = "".join(one_l)
    _l.append(_one_l)
#3)アナグラム判定
for s in _l[:]:
    c = _l.count(s)
    if c > 1:
        #cの組み合わせを考える c C 2 
        _c += for_factorial(c)
        _l.remove(s)
print(_c)

Fixed submission:
A, B = map(int, input().split())
M = []
kakeru = A*B
tasu = A+B
hiku = A-B
M.append(kakeru)
M.append(tasu)
M.append(hiku)
M.sort(reverse = True)
print(M[0])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
f = [1 << 31] * n 

f[0] = 0
for i in range(0, n):
    lim = max(i - k, 0)
    for j in range(lim, i):
        f[i] = min(f[i], abs(h[j] - h[i]) + f[j])

print(f[n - 1])

Fixed submission:
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
f = [1 << 31] * n 

f[0] = 0
for i in range(0, n):
    lim = max(i - k, 0)
    for j in range(lim, i):
        f[i] = min(f[i], abs(h[j] - h[i]) + f[j])

print(f[n - 1])
Buggy python submission (verdict: Runtime Error):
a=input();
b=input();
if a<b:
    print(0);
else:
    print(10);

Fixed submission:
x,a=map(int,input().split())
if x<a:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Runtime Error):
str = input()
N = int(str.split()[0])
d = []
for i in range(N) :
	s = str = input()
	dict = {}
	for j in range(26):
		dict[j] = 0
	for j in range(10) :
		k = ord(s[j]) - ord("a")
		dict[k] = dict[k] + 1
	d.append(dict)
	
E = 0
while(len(d) != 0) :
	deli = []
	for i in range(1, len(d)) :
		f = 0
		for j in range(26):
			if (d[0][j] != d[i][j]) :
				f = 1
				break
		if (f != 1) :
			deli.append(i)
	a = 0
	while(len(deli) != 0) :
		d.pop(deli[0] - a)
		deli.pop(0)
		a = a + 1
	if (len(d) != 0) :
		if (a != 0) :
			E = E + a * (a - 1) / 2
		d.pop(0)
print(E)


Fixed submission:
str = input()

A = (int(str.split()[0]))
B = (int(str.split()[1]))

X = A + B
Y = A - B
Z = A * B
E = 0
if (X < Y) :
	if (Y < Z) :
		E = Z
	else :
		E = Y
else :
	if (X < Z) :
		E = Z
	else :
		E = X
print("{}".format(E))

Buggy python submission (verdict: Runtime Error):
pdic = {1: 0, 2: 1, 3: 3}

def p(a):
	if (a in pdic) :
		return dpic[a]
	else :
		pdic[a] = p(a - a) * a
	return p(a - 1) * a

str = input()
N = int(str.split()[0])
d = []
for i in range(N) :
	s = str = input()
	dict = {}
	for j in range(26):
		dict[j] = 0
	for j in range(10) :
		k = ord(s[j]) - ord("a")
		dict[k] = dict[k] + 1
	d.append(dict)
	
E = 0
while(len(d) != 0) :
	deli = []
	for i in range(1, len(d)) :
		f = 0
		for j in range(26):
			if (d[0][j] != d[i][j]) :
				f = 1
				break
		if (f != 1) :
			deli.append(i)
	a = 0
	while(len(deli) != 0) :
		d.pop(deli[0] - a)
		deli.pop(0)
		a = a + 1
	if (len(d) != 0) :
		if (a != 0) :
			E = E + p(a + 1)
		d.pop(0)
print(E)


Fixed submission:
str = input()

A = (int(str.split()[0]))
B = (int(str.split()[1]))

X = A + B
Y = A - B
Z = A * B
E = 0
if (X < Y) :
	if (Y < Z) :
		E = Z
	else :
		E = Y
else :
	if (X < Z) :
		E = Z
	else :
		E = X
print("{}".format(E))
Buggy python submission (verdict: Runtime Error):
str = input()
N = int(str.split()[0])
X = int(str.split()[1])

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	D = D + L[i]
	i = i + 1


print(i)


Fixed submission:
str = input()
N = int(str.split()[0])
X = int(str.split()[1])

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	if (i == len(L)) :
		if (D <= X):
			i = N + 1
		break
	D = D + L[i]
	i = i + 1


print(i)
Buggy python submission (verdict: Runtime Error):
i = input().split()
if i[0] % i[1] == 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):
W,H,x,y=map(int,input().split())

#case1
a=x*H
b=(W-x)*H

if a>=b:
    case1=b
else:
    case1=a

#case2
c=W*y
d=W*(H-y)

if c>=d:
    case2=d
else:
    case2=c

if case1==case2:
    z=1

else:
    z=0

print("{0:.6f}".format(max(case1,case2)),z)


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

if x<a:
    print("0")

else:
    print("10")

Buggy python submission (verdict: Runtime Error):
W,H,x,y=map(str,input().split())

#case1
a=x*H
b=(W-x)*H

if a>=b:
    case1=b
else:
    case1=a

#case2
c=W*y
d=W*(H-y)

if c>=d:
    case2=d
else:
    case2=c

if case1==case2:
    z=1

else:
    z=0

print("{0:.9f}".format(max(case1,case2)),z)


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

if x<a:
    print("0")

else:
    print("10")
Buggy python submission (verdict: Runtime Error):
import math

n=int(input())

#最小公倍数を定義
def lcm(x,y):
    return (x*y)//math.gcd(x,y)

print(lcm(n,2))


Fixed submission:
N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(N*2)

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

n=int(input())

#最小公倍数を定義
def lcm(x,y):
    return (x*y)//math.gcd(x,y)

print(lcm(n,2))


Fixed submission:
N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(N*2)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())

if b-a+1<=2*k:
    for i in range(a,b+1):
        print(i)

else:
    aa=[a+i for i in range(k)]
    bb=[b-j for j in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)


Fixed submission:
s=input()

if "a" in s and "b" in s and "c" in s:
    print("Yes")

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

nums=[i for i in range(a,b+1)]
nums2=sorted(nums,reverse=True)

if b-a+1<=2*k:
    for i in nums:
        print(i)

else:
    ans=[]
    for i in range(k):
        ans.append(nums[i])
        ans.append(nums2[i])
    ans=sorted(ans)
    for j in ans:
        print(j)


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

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)

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


nums=[]
for i in range(a,b+1):
    nums.append(i)
#print(nums)
nums2=sorted(nums,reverse=True)
#print(nums2)

if k>=b-a+1:
    for x in nums:
        print(x)
else:
    ans=[]
    for j in range(k):
        ans.append(nums[j])
        ans.append(nums2[j])

    ans=sorted(set(ans))

    #print(ans)

    for l in ans:
        print(l)


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

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
nums=[]

for i in range(a,b+1):
    nums.append(i)

nums2=sorted(nums,reverse=True)

#ans作成
ans=[]
for j in nums[:k]:
    ans.append(j)

for x in nums2[:k]:
    ans.append(x)
ans=sorted(set(ans))

if (b-a)+1<k:
    for y in nums:
        print(y)

else:
    for z in ans:
        print(z)


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

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
nums=[]

for i in range(a,b+1):
    nums.append(i)

nums2=sorted(nums,reverse=True)

#ans作成
ans=[]
for j in nums[:k]:
    ans.append(j)

for x in nums2[:k]:
    ans.append(x)
ans=sorted(set(ans))

if (b-a)+1<k:
    for y in nums:
        print(y)

else:
    for z in ans:
        print(z)


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

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

count=0

while True:
    if n-3>=3:
        count+=1
    
    if n<3:
        print(count)
        break


Fixed submission:
n=int(input())

print(n//3)
Buggy python submission (verdict: Runtime Error):
n=int(input())

a=[]
for i in range(n):
    a.append(int(input()))

cnt=0
ans=-1
x=1

for i in range(n):
    x=a[x-1]
    cnt+=1
    if x==2:
        ans=cnt
        break

print(ans)

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

if x+1<=(b-a):
    print("dangerous")

elif a>=b:
    print("delicious")

elif (b-a)<=x:
    print("safe")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

pic1=[]
pic2=[]

for i in range(n):
    pic1.append(input())

for j in range(m):
    pic2.append(input())

#print(pic1)
#print(pic2)

ans="No"

for i in range(n-m+1):
    for j in range(n-m+1):
        flag=True
        for k in range(m):
            for l in range(m):
                if pic1[i+k][j+l]!=b[k][l]:
                    flag=False

            if not flag:
                break
        if flag:
            print("Yes")
            exit()

print("No")



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

pic1=[]
pic2=[]

for i in range(n):
    pic1.append(input())

for j in range(m):
    pic2.append(input())

#print(pic1)
#print(pic2)

ans="No"

for i in range(n-m+1):
    for j in range(n-m+1):
        flag=True
        for k in range(m):
            for l in range(m):
                if pic1[i+k][j+l]!=pic2[k][l]:
                    flag=False

            if not flag:
                break
        if flag:
            print("Yes")
            exit()

print("No")
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()

x=int(a)*int(b)
y=int(c)*int(d)

if x>y:
    print(x)

elif x<y:
    print(y)

else:
    print(x)

Fixed submission:
a,b,c,d=input().split()

x=int(a)*int(b)
y=int(c)*int(d)

if x>y:
    print(x)

elif x<y:
    print(y)

else:
    print(x)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        z=s-(i+j)
        
        if 0<=z<=s:
            count+=1
print(count)


Fixed submission:
x = input()
x=x.replace(","," ")
print(x)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        z=s-(i+j)
        
        if nums.count(z):
            count+=1
print(count)


Fixed submission:
k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        if s-k<=i+j<=s:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

nums=[]

for i in  range(k+1):
    nums.append(i)

x=y=nums

count=0

for i in x:
    for j in y:
        z=s-(i+j)
        
        if nums.count(z):
            count+=1
print(count)


Fixed submission:
k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        if s-k<=i+j<=s:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

nums=[]

for i in  range(k+1):
    nums.append(i)

x=y=z=nums

count=0

for i in x:
    for j in y:
        for k in z:
            if i+j+k==s:
                count+=1
print(count)


Fixed submission:
k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        if s-k<=i+j<=s:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
A=input('数字を入力＞')
op=input('＞')
B=input('数字を入力＞')
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))

Fixed submission:
# -*- coding: utf-8 -*-

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

if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
A=input('数字を入力＞')
op=raw_input('＞')
B=input('数字を入力＞')
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))

Fixed submission:
# -*- coding: utf-8 -*-

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

if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
A=input('数字を入力＞')
op=raw_input('＋又はーを入力＞')
B=input('数字を入力>')
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))


Fixed submission:
# -*- coding: utf-8 -*-

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

if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
# coding: cp932
A=input('数字を入力＞')
op=raw_input('＋又はーを入力＞')
B=input('数字を入力>')
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))

Fixed submission:
# -*- coding: utf-8 -*-

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

if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
Buggy python submission (verdict: Runtime Error):
w,h,n=map(int,input().split())


x_min=0
y_min=0

for i in range(n):
    x,y,a=map(int,input().split())

    if a==1:
        x_min=max(x_min,x)

    elif a==2:
        w=min(x,w)

    elif a==3:
        y_min=max(y_min,y)

    elif a==4:
        h=min(y,h)

white=(w-x_min)*(h-y_min)

if white>0:
  print(white)
  
else:
  print("0")

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

answer=sorted(nums,reverse=True)

if sum(answer)%2==0 and answer[0]==answer[1]+answer[2]:
	print("Yes")

else:
	print("No")

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

min_x=0
min_y=0

for i in range(n):
    x,y,a=map(int,input().split())

    if a==1:
        min_x=max(min_x,x)

    elif a==2:
        w=min(w,x)

    elif a==3:
        min_y=max(min_y,y)

    elif a==4:
        h=min(h,y)

white=int((w-min_x)*(h-min_y))

if white>0:
    print(white)

else:
    print("0")


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

answer=sorted(nums,reverse=True)

if sum(answer)%2==0 and answer[0]==answer[1]+answer[2]:
	print("Yes")

else:
	print("No")

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

min_x=0
min_y=0

for i in range(n):
    x,y,a=map(int,input().split())

    if a==1:
       min_x=max(min_x,x)

    elif a==2:
        w=min(w,x)

    elif a==3:
        min_y=max(min_y,y)

    else:
        h=min(h,y)

white=(w-min_x)*(h-min_y)
print(white)


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

answer=sorted(nums,reverse=True)

if sum(answer)%2==0 and answer[0]==answer[1]+answer[2]:
	print("Yes")

else:
	print("No")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a+b <= 16:
    print("Yay!")
else:
    print(":(")


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

if a+b <= 16 and a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce
import sys
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
a2 = a.copy()
res = []
for i in range(0,n):
    a2.pop(i)
    res.append(reduce(fractions.gcd,a2))
    a2 = a.copy()
print(max(res))

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)

Buggy python submission (verdict: Runtime Error):
import fractions
import copy
from functools import reduce
import sys
def gcd_list(numbers):
    return reduce(fractions.gcd,numbers)
  
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
a2 = copy.deepcopy(a)
res = []
for i in range(0,n):
    a2.pop(i)
    res.append(gcd_list(a2))
    a2 = copy.deepcopy(a)
print(max(res))

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)

Buggy python submission (verdict: Runtime Error):
import fractions
import copy
from functools import reduce
 
def gcd_list(numbers):
    return reduce(fractions.gcd,numbers)
  
n = int(input())
a = list(map(int,input().split()))
a2 = copy.deepcopy(a)
res = []
for i in range(0,n):
    a2.pop(i)
    res.append(gcd_list(a2))
    a2 = copy.deepcopy(a)
print(max(res))

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)

Buggy python submission (verdict: Runtime Error):
import fractions
import copy

def gcd_list(numbers):
    ans = numbers[0]
    for i in range(1,n-1):
        ans = fractions.gcd(ans,numbers[i])
    return ans
  
n = int(input())
a = list(map(int,input().split()))
a2 = copy.deepcopy(a)
res = []
for i in range(0,n):
    a2.pop(i)
    res.append(gcd_list(a2))
    a2 = copy.deepcopy(a)
print(max(res))

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if(b==0): 
        return a 
    else: 
        return gcd(b,a%b)

n = int(input())
a = list(map(int,input().split()))
res = []
for i in range(0,n):
    for j in range(0,n):
        if i != j:
            res.append(gcd(a[i],a[j]))
print(max(res))

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if(b==0): 
        return a 
    else: 
        return gcd(b,a%b)


n = int(input())
a = map(int,input().split())
a = list(map(int, a))
a1 = a
res = 0
count = 0
count1 = 0
for i in a:
    for j in a1:
        if count != count1 and gcd(i,j)>res:
            res = gcd(i,j)
        count1 = count1 + 1
    count = count + 1
    count1 = 0
print(res)

Fixed submission:
a,b,t=map(int,input().split());print(int(t/a)*b)
Buggy python submission (verdict: Runtime Error):
import math
a,p=map(int.input().split())
p=p+a*3
print(math.floor(p/3))

Fixed submission:
import math
a,p=map(int,input().split())
p=p+a*3
print(int(math.floor(p/2)))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
lr=[]
result=0
gates=0
for i in range(m):
  lr.append(input().split())
#print(lr[0])
for k in range(1,n+1):
  gates=0
  for h in range(m):
    if int(k)>=int(lr[h][0]) and int(k)<=int(lr[h][1]):
      gates+=1
  #print(gates,k)
  if gates==m:
    result+=1
    gates=0
    #print('ID')
print(result)

Fixed submission:
n,m=map(int,input().split())
l=1
r=n
lr=[]
for i in range(m):
  lr.append(input().split())
for j in lr:
  if l<int(j[0]):
    l=int(j[0])
  if r>int(j[1]):
    r=int(j[1])
if r>=l:
  print(int(r-l+1))
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
l1=[]
l2=[]
n,k=map(int,input().split())
for i in range(n):
  l1.append(input().split())
for j in range(n):
  for l in range(int(l1[j][1])):
    l2.append(int(l1[j][0]))
l2.sort()
print(l2[k-1])

Fixed submission:
l1=[]
ret=0
c=0
n,k=map(int,input().split())
for i in range(n):
  l1.append(input().split())
num=[0]*(10**5)

for j in range(n):
  num[int(l1[j][0])-1]+=int(l1[j][1])
#print(num)
for l in range(10**5):
  if num[l]>=k:
    print(l+1)
    break
  k-=num[l]
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
power=1
for i in range(1,n+1):
  power=power*i
print(power%(10**9+7))

Fixed submission:
n=int(input())
power=1
for i in range(1,n+1):
  power=(power*i)%(10**9+7)
print(int(power))

Buggy python submission (verdict: Runtime Error):
n=input()
power=1
for i in range(1,n+1):
  power=power*i
print(power%(10**9+7))

Fixed submission:
n=int(input())
power=1
for i in range(1,n+1):
  power=(power*i)%(10**9+7)
print(int(power))
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
res=0
for x in range(k+1):
  for y in range(k+1):
    if s-x-y=>0:
      res+=1
print(res)

Fixed submission:
k,s=map(int,input().split())
res=0
for x in range(k+1):
  for y in range(k+1):
    if s-x-y<=k and s-x-y>=0:
      res+=1
      #print(x,y,s-x-y)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
res=0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        res+=1
print(res)

Fixed submission:
k,s=map(int,input().split())
res=0
for x in range(k+1):
  for y in range(k+1):
    if s-x-y<=k and s-x-y>=0:
      res+=1
      #print(x,y,s-x-y)
print(res)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t=map(int,input().split())
#n==len(t)
m=int(input())
px=[]
for i in range(n):
  px.append(map(input().split()))
res=0
for j in range(m):
  for k in range(n):	
    if j==px[j][0]:
      res+=px[j][1]
    else:
      res+=t[k]
  print(res)
  res=0

Fixed submission:
n=int(input())
t=input().split()
#n==len(t)
m=int(input())
px=[]
for i in range(m):
  px.append(input().split())
res=0
for j in range(1,m+1):
  for k in range(1,n+1):	
    if k==int(px[j-1][0]):
      res+=int(px[j-1][1])
      #print(12345)
    else:
      res+=int(t[k-1])
      #print('drink')
  print(res)
  res=0
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[]
res=''
for i in range(n):
  s.append(input())
s.sort()
for k in range(n):
  res+=s[k]
print(res)

Fixed submission:
str=input().split()
str.sort()
if str==['5','5','7']:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[0]*n
res=''
for i in range(n):
  s.append(input())
s.sort()
for k in range(n):
  res+=s[k]
print(res)

Fixed submission:
n,l=map(int,input().split())
s=[]
t=''
for i in range(n):
  s.append(input())
s.sort()
for k in s:
  t+=k
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
d=input().split()
stopcode=False
while stopcode==False:
  for i in range(len(str(n))):
    if str(n)[i] in d:
      n+=1
      break
    elif i==len(str(n)):
      stopcode=True
      break
    else:
      break
print(n)

Fixed submission:
n,k=map(int,input().split())
d=input().split()
stopcode=False
while stopcode==False:
  for i in range(len(str(n))):
    if str(n)[i] in d:
      n+=1
      break
    elif i+1==len(str(n)):
      stopcode=True
      break
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
d=input().split()
stopcode=False
while stopcode==False:
  for i in range(len(str(n))):
    if str(n)[i] in d:
      n+=1
      break
    elif i==range(len(str(n))):
      stopcode=True
      break
    else:
      break
print(n)

Fixed submission:
n,k=map(int,input().split())
d=input().split()
stopcode=False
while stopcode==False:
  for i in range(len(str(n))):
    if str(n)[i] in d:
      n+=1
      break
    elif i+1==len(str(n)):
      stopcode=True
      break
print(n)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

N = int(input())
s = [list(input()) for i in range(N)]
 
a = 0
for i,j in combinations(s,2):
  if set(i) == set(j):
    a+=1
print(a)

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

a1 = A+B
a2 = A-B
a3 = A*B

am = max([a1,a2,a3])

print(am)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations

N = int(input())
s = [list(input()) for i in range(N)]
 
a = 0
for i,j in combinations(s,2):
  if set(i) == set(j):
    a+=1
print(a)

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

a1 = A+B
a2 = A-B
a3 = A*B

am = max([a1,a2,a3])

print(am)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [list(input()) for i in range(N)]
 
from itertools import combinations
 
a = 0
for i,j in combinations(s,2):
  if set(i) == set(j):
    a+=1
print(a)

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

a1 = A+B
a2 = A-B
a3 = A*B

am = max([a1,a2,a3])

print(am)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

K = (A+B)/2
K_ = (A+B)%2
if K_>0:
  print("IMPOSSIBLE")
else:
  print(int(K)

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

K = (A+B)/2
K_ = (A+B)%2
if K_>0:
  print("IMPOSSIBLE")
else:
  print(int(K))