Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())

print(math.ceil(A*B / math.gcd(A,B)))

Fixed submission:
from fractions import gcd
x,y=map(int,input().split())
print((x * y) // gcd(x, y))
Buggy python submission (verdict: Runtime Error):
N=int(input())
shogen=[]
count_ans=[]
for i in range(N):
    A=int(input())
    shogen.append([list(map(int,input().split())) for i in range(A)])
def saiki(A):
    if len(A)==N:
        honest=set()
        honest_kari=set()
        unkind=set()
        count=0
        unkind_kari=set()
        for i in range(N):
            if A[i]==1:
                honest.add(i)
            else:
                unkind.add(i)
        for i in range(N):
            if i in honest:
                for j in range(len(shogen[i])):
                    if shogen[i][j][1]==0:
                        unkind_kari.add(shogen[i][j][0])
                    else:
                        honest_kari.add(shogen[i][j][0])
        for i in honest:
            if i not in unkind_kari:
                if i not in unkind:
                    count+=1
        for i in unkind:
            if i not in honest_kari:
                if i not in honest:
                    count+=1
        if count==len(unkind_kari)+len(honest_kari):
            count_ans.append(len(honest))

        
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
print(max(count_ans))

Fixed submission:
N=int(input())
shogen=[]
count_ans=[]
for i in range(N):
    A=int(input())
    shogen.append([list(map(int,input().split())) for i in range(A)])
#print(shogen)
def saiki(A):
    if len(A)==N:
        honest=set()
        honest_kari=set()
        unkind=set()
        count=0
        unkind_kari=set()
        for i in range(N):
            if A[i]==1:
                honest.add(i)
            else:
                unkind.add(i)
        for i in range(N):
            if i in honest:
                for j in range(len(shogen[i])):
                    if shogen[i][j][1]==0:
                        unkind_kari.add(shogen[i][j][0]-1)
                    else:
                        honest_kari.add(shogen[i][j][0]-1)
        #print(honest,honest_kari)
        for i in unkind_kari:
            if i in unkind:
                count+=1
        for i in honest_kari:
            if i in honest:
                count+=1
        if count==len(unkind_kari)+len(honest_kari):
            kari=set(list(honest)+list(honest_kari))
            #print(honest,honest_kari,count)
            count_ans.append(len(kari))

        
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
print(max(count_ans))
Buggy python submission (verdict: Runtime Error):
S=int(input())
MON=6
TUE=5
WED=4
THU=3
FRI=2
SAT=1
SUN=0
print(7-S)

Fixed submission:
S = input()
if S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)
else :
    print(7)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A < 10 and 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):
if A < 10 and 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):
if A <= 10 and if 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):
if A <= 10 and 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):
import math
n=int(input())
kouho = []
ans = []
for i in range(1,math.floor(math.sqrt(n))):
    if n % i == 0 :
        kouho.append([i,n//i])
for j in range(len(kouho)):
    ans.append(kouho[j][0]+kouho[j][1]-2)
print(min(ans))

Fixed submission:
import math
n=int(input())
kouho = []
ans = []
for i in range(1,math.ceil(math.sqrt(n)+1)):
    if n % i == 0 :
        kouho.append([i,n//i])
for j in range(len(kouho)):
    ans.append(kouho[j][0]+kouho[j][1]-2)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())

if A > 2B :
    print(A - 2B)
else :
    print(0)

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

if A > 2*B :
    print(A - 2*B)
else :
    print(0)

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A > 2B :
  print(A - 2B)
else :
  print(0)

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

if A > 2*B :
    print(A - 2*B)
else :
    print(0)

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A >> 2B :
  print(A - 2B)
else :
  print(0)

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

if A > 2*B :
    print(A - 2*B)
else :
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
TotalList = []

for A in range(N-1):
  for B in range(A+1):
    D[A]*D[B] = K
    TotalList.append(K)

print(sum(TotalList))

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
TotalList = 0

for A in range(N-1):
  for B in range(A+1,N):
    TotalList += D[A]*D[B]
    

print(TotalList)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
TotalList = []

for A in range(N-1):
  for B in range(A+1):
    D(A)*D(B) = K
    TotalList.append(K)

print(sum(TotalList))

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
TotalList = 0

for A in range(N-1):
  for B in range(A+1,N):
    TotalList += D[A]*D[B]
    

print(TotalList)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N=int(input())
triangle=[]
count=0
L=list(map(int,input().split()))
for i in combinations(L,3):
    triangle.append(list(i))
for i in triangle:
    #print(i)
    if i[0]<i[1]+i[2] and i[1]<i[2]+i[0] and i[2]<i[1]+i[0]:
        count+=1
print(count)

Fixed submission:
from bisect import bisect_left
N=int(input())
triangle=[]
count=0
L=list(map(int,input().split()))
L.sort()
#print(L)
for a in range(N):
    for b in range(a+1,N):
        c=L[a]+L[b]
        zahyo=bisect_left(L,c)
        count+=max(0,zahyo-b-1)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N=int(input())
triangle=[]
count=0
L=list(map(int,input().split()))
for i in combinations(L,3):
    triangle.append(list(i))
for i in triangle:
    #print(i)
    if i[0]<i[1]+i[2] and i[1]<i[2]+i[0] and i[2]<i[1]+i[0]:
        count+=1
print(count)

Fixed submission:
from bisect import bisect_left
N=int(input())
triangle=[]
count=0
L=list(map(int,input().split()))
L.sort()
#print(L)
for a in range(N):
    for b in range(a+1,N):
        c=L[a]+L[b]
        zahyo=bisect_left(L,c)
        count+=max(0,zahyo-b-1)
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
cnt =　0
for i in range(n):
  if (i+1)%2　==　1:
    cnt +=　1
print(cnt/n)


Fixed submission:
N = int(input())
print((N-(N//2))/N)

Buggy python submission (verdict: Runtime Error):
n = int(input())
cnt =　0
for i in range(1,n+1):
  if i%2　==　1:
    cnt +=　1
print(cnt/n)

Fixed submission:
N = int(input())
print((N-(N//2))/N)
Buggy python submission (verdict: Runtime Error):
s=input()
if s=="Sunny":
    print("Cloudy ")　
if s=="Cloudy":
    print("Rainy")
if s=="Rainy":
    print("Sunny")


Fixed submission:
S=input()
if S == "Sunny":
    print("Cloudy")
if S == "Cloudy":
    print("Rainy")
if S == "Rainy":
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
T,X=int(input())
print(T/X)

Fixed submission:
T,X=map(int,input().split())
print(T/X)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
heikin=sum(A)/N
kouho = []

if heikin in A:
    print(A.index(heikin))
else:
    for i in A:
        kouho.append(abs(heikin-i))
    ans = kouho.copy()
    ans.sort()
print(kouho.index(ans[0]))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
heikin=sum(A)/N
kouho = []

if heikin in A:
    print(A.index(heikin))
else:
    for i in A:
        kouho.append(abs(heikin-i))
    ans = kouho.copy()
    ans.sort()
    print(kouho.index(ans[0]))
Buggy python submission (verdict: Runtime Error):
A,B,C=input().split()
ichi=eval(AB+C)
two=eval(A+BC)
print(max(ichi,two))

Fixed submission:
A,B,C=map(int,input().split())
ichi=10*A+B+C
two=A+10*B+C
three=C*10+A+B
print(max(ichi,two,three))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,Y = map(int,input().split())
ans = []
count = 0
for i in range(N+1):
    for k in range(N-i+1):
        for m in range(N+1-k-i):
            if 10000*i+5000*k+1000*m==Y and i+k+m==N:
                ans.append(i)
                ans.append(k)
                ans.append(m)
                count += 1
                print(str(ans[0])+" "+str(ans[1])+" "+str(ans[2]))
                sys.exit()
                
if count == 0:
    print("-1 -1 -1")

Fixed submission:
N,Y=map(int,input().split())
for i in range(N+1):
    for j in range(N-i+1):
        if 10000*i+5000*j+1000*(N-i-j)==Y:
            print(i,j,(N-i-j))
            exit()
else:
    print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
from math import gcd
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)
Buggy python submission (verdict: Runtime Error):
N=input()
ans=[a,i,u,e,o]
if N in ans:
  print("vowel")
else:
  print("consonant")

Fixed submission:
N=input()
ans=["a","i","u","e","o"]
if N in ans:
  print("vowel")
else:
  print("consonant")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
count = 0
for i in range(a,b+1):
    if i%x==0:
        count += 1
print(count)

Fixed submission:
a,b,x=map(int,input().split())
count = (b//x)-(a//x)
if a%x==0:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s=input()
kouho = []
ans = [s[i] for i in range(len(s))]
for i in range(len(s)):
    if s[i] == "B" and i>=1:
        kouho.append(i-1)
kouho.sort()
kouho.reverse()
for j in kouho:
    ans.pop(j)
    ans.pop(j)
kesu = []
for k in range(len(ans)):
    if ans[k]=="B":
        kesu.append(k)
kesu.sort()
kesu.reverse()
for m in kesu:
    ans.pop(m)
print(*ans,sep="")

Fixed submission:
s=input()
ans = []
for i in range(len(s)):
    ans.append(s[i])
j=1
while True:
    if ans[0]=="B":
        ans.pop(0)
    elif j>=len(ans):
        break
    elif ans[j]=="B":
        ans.pop(j-1)
        ans.pop(j-1)
        j-=1
    else:
        j+=1
print(*ans,sep="")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
    cnt[A[i]-1] += 1
S = 0
for i in range(N):
    S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
    if cnt[A[i]] == 1:
        print(S)
    else:
        print(int(S+(3-2*cnt[A[i]-1])/2))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
    cnt[A[i]-1] += 1
S = 0
for i in range(N):
    S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
    if cnt[A[i]-1] == 1:
        print(int(S))
    else:
        print(int(S+(3-2*cnt[A[i]-1])/2))
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
s = a * int(b)
t = b * int(a)
print(s if s < t else t)* int(b)
t = b * int(a)
print(s if s < t else t)


Fixed submission:
a, b = input().split()
s = a * int(b)
t = b * int(a)
print(s if s < t else t)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))


Fixed submission:
import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = map(input().split())
ans = 0
for i in range(n):
    if h[i] >= k:
        ans += 1
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in range(n):
    if h[i] >= k:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(-X[i][1])

Fixed submission:
N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
		else j += 1
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

Fixed submission:
N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

Fixed submission:
N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = []
for i in range(M):
    b, c = map(int, input().split())
    for j in range(b):
        C.append(c)
A.sort()
C.sort(reverse=True)
ans = 0
for i in range(N):
    if i < len(C):
        ans += max(A[i], C[i])
    else:
        ans += A[i]
print(ans)


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = []
for i in range(M):
    b, c = map(int, input().split())
    C.append([c, b])
A.sort()
C.sort(reverse=True)
ans = 0
k = 0
c = C[k][0]
minC = min(C)
b = 1
flg = False
for i in range(N):
    if flg == True:
        ans += A[i]
    elif b <= C[k][1]:
        ans += max(A[i], c)
        b += 1
    else:
        if k < len(C) - 1:
            k += 1
            c = C[k][0]
            b = 1
            ans += max(A[i], c)
            b += 1
        else:
            flg = True
            ans += A[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = []
for i in range(M):
    b, c = map(int, input().split())
    for j in range(b):
        C.append(c)
A.sort()
C.sort(reverse=True)
ans = 0
for i in range(N):
    if i < len(C):
        ans += max(A[i], C[i])
    else:
        ans += A[i]
print(ans)


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = []
for i in range(M):
    b, c = map(int, input().split())
    C.append([c, b])
A.sort()
C.sort(reverse=True)
ans = 0
k = 0
c = C[k][0]
minC = min(C)
b = 1
flg = False
for i in range(N):
    if flg == True:
        ans += A[i]
    elif b <= C[k][1]:
        ans += max(A[i], c)
        b += 1
    else:
        if k < len(C) - 1:
            k += 1
            c = C[k][0]
            b = 1
            ans += max(A[i], c)
            b += 1
        else:
            flg = True
            ans += A[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a_plus_b = []
for i in a:
    for j in b:
        a_plus_b.append(i + j)
a_plus_b.sort(reverse=True)

a_plus_b_plus_c = []
for i in a_plus_b[:k]:
    for j in c:
        a_plus_b_plus_c.append(i + j)
a_plus_b_plus_c.sort(reverse=True)

for i in range(k):
    print(a_plus_b_plus_c[i])


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

a_plus_b = []
for i in a:
    for j in b:
        a_plus_b.append(i + j)
a_plus_b.sort(reverse=True)

a_plus_b_plus_c = []
for i in a_plus_b[:k]:
    for j in c:
        a_plus_b_plus_c.append(i + j)
a_plus_b_plus_c.sort(reverse=True)

for i in range(k):
    print(a_plus_b_plus_c[i])

Buggy python submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))

a[0].sort()
a[1].sort()
a[2].sort()

# da = [a[i] - a[i+1] for i in range(len(a)-1)]
# db = [b[i] - b[i+1] for i in range(len(b)-1)]
# dc = [c[i] - c[i+1] for i in range(len(c)-1)]

ia = [len(a[0])-1, len(a[1])-1, len(a[2])-1]
deli = a[0][ia[0]] + a[1][ia[1]] + a[2][ia[2]]
for i in range(k):
    how_modi = None
    min_delta = 0
    if i != 0:
        for j in range(3):
            if ia[j] == 0:
                continue
            delta = a[j][ia[j]] - a[j][ia[j-1]]
            min_delta = delta
            for l in range(3):
                if l == j:
                    continue
                idx = ia[l]
                while True:
                    if a[l][idx] > delta or idx == len(a[l])-1:
                        break
                    idx += 1
                if min_delta > delta - a[l][idx] + a[l][ia[l]]:
                    if idx == ia[l]:
                        min_delta = delta - a[l][idx] + a[l][ia[l]]
                        how_modi = [j, l, idx]
                    else:
                        min_delta = delta - a[l][idx] + a[l][ia[l]]
                        how_modi = [j]
                else:
                    how_modi = [j]
    deli -= min_delta
    if len(how_modi) == 1:
        ia[how_modi[0]] -= 1
    else:
        ia[how_modi[0]] -= 1
        ia[how_modi[1]] = how_modi[2]
    print(deli)


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

a_plus_b = []
for i in a:
    for j in b:
        a_plus_b.append(i + j)
a_plus_b.sort(reverse=True)

a_plus_b_plus_c = []
for i in a_plus_b[:k]:
    for j in c:
        a_plus_b_plus_c.append(i + j)
a_plus_b_plus_c.sort(reverse=True)

for i in range(k):
    print(a_plus_b_plus_c[i])
Buggy python submission (verdict: Runtime Error):
inverse = ['A': 'T', 'T': 'A', 'G': 'C', 'C': 'G']
print(inverse[input()])


Fixed submission:
b = input()
if b == "A":
	print("T")
elif b == "T":
	print("A")
elif b == "G":
	print("C")
elif b == "C":
	print("G")
Buggy python submission (verdict: Runtime Error):
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
a.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)


Fixed submission:
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
arr.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m  = map(int, input().split())
a, b = [], []
for i in range(n):
    x, y = map(int, input().split())
    a.append([x, i])
    b.append([y, i])
a.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    i = a[idx][1]
    for j in range(len(b)):
        if b[j][1] == i:
            kosuu = b[j][0]
    if kosuu <= m:
        ans += kosuu * a[idx][0]
        m -= kosuu
        idx += 1
    else:
        ans += m * a[idx][0]
        m = 0
print(ans)


Fixed submission:
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
arr.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m  = map(int, input().split())
a, b = [], []
for i in range(n):
    x, y = map(int, input().split())
    a.append([x, i])
    b.append([y, i])
a.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    i = a[idx][1]
    for j in range(len(b)):
        if b[j][1] == i:
            kosuu = b[j][0]
    if kosuu <= m:
        ans += kosuu * a[idx][0]
        m -= kosuu
        idx += 1
    else:
        ans += m * a[idx][0]
        m = 0
print(ans)


Fixed submission:
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
arr.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        int p;
        cin >>p;
        a[i] = p;
    }
    int sum = 0;
    int yasui = 100000;
    for(int i = 0; i < n; ++i){
        sum += a[i];
        if(yasui > a[i]) yasui = a[i];
    }
    cout << sum - yasui/2 << endl;
}


Fixed submission:
N = int(input())
p = [int(input()) for x in range(N)]
print(int(sum(p)-max(p)/2))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(input())) for _ in range(n)]
h.sort()
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]) )

Fixed submission:
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
d = [h[i+1]-h[i] for i in range(0, len(h)-1)]
S = 0
for i in range(k-1):
    S += d[i]
ans = S
for i in range(0, n-k):
    SS = S + d[i+k-1] - d[i]
    if SS <= ans:
        ans = SS
    S = SS
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = int(input().split())
h = [int(input())) for _ in range(n)]
h.sort()
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]) )

Fixed submission:
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
d = [h[i+1]-h[i] for i in range(0, len(h)-1)]
S = 0
for i in range(k-1):
    S += d[i]
ans = S
for i in range(0, n-k):
    SS = S + d[i+k-1] - d[i]
    if SS <= ans:
        ans = SS
    S = SS
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
print(max(a)-min(a))


Fixed submission:
a = [int(i) for i in input().split()]
print(max(a)-min(a))