Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = list(input())
cnt = 0

for i in range(n):
    if c[i] == 'W':
        for j in range(n-1,0,-1 ):
            if i > j:
                break
            if c[j] == 'R':
                if i < j:
                    c[i] = 'R'
                    c[j] = 'W'
                    cnt += 1
                break
print(cnt)

Fixed submission:
n = int(input())
c = input()
cnt = 0
ans = 0

for i in range(n):
    if c[i] == 'R':
        cnt += 1
    
for j in range(cnt):
    if c[j] == 'W':
        ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = list(input())
cnt = 0

for i in range(n):
    if c[i] == 'W':
        for j in range(n-1,0,-1 ):
            if c[j] == 'R':
                if i < j:
                    c[i] = 'R'
                    c[j] = 'W'
                    cnt += 1
                break
print(cnt)

Fixed submission:
n = int(input())
c = input()
cnt = 0
ans = 0

for i in range(n):
    if c[i] == 'R':
        cnt += 1
    
for j in range(cnt):
    if c[j] == 'W':
        ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cnt = 0

for i in range(n):
    if c[i] == 'W':
        for j in range(n-1,0,-1 ):
            if c[j] == 'R':
                if i < j:
                    c[i] = 'R'
                    c[j] = 'W'
                    cnt += 1
                    print(i, j)
                    print(c)
                break
print(cnt)

Fixed submission:
n = int(input())
c = input()
cnt = 0
ans = 0

for i in range(n):
    if c[i] == 'R':
        cnt += 1
    
for j in range(cnt):
    if c[j] == 'W':
        ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if B <= A:
       
        B *= 2
        
    elif C <= B:
       
        C *= 2
        
    else:
       
        C *= 2
        
if A < B and B < C:
    print('Yes')
    
else:
    print('No')
        

Fixed submission:
x = int(input())

if x>= 400 and x<=599:
    print('8')
    
elif x>= 600 and x<= 799:
    print('7')
    
elif x>= 800 and x<= 999:
    print('6')
    
elif x>= 1000 and x<= 1199:
    print('5')
    
elif x>= 1200 and x<= 1399:
    print('4')
    
elif x>= 1400 and x<= 1599:
    print('3')
    
elif x>= 1600 and x<= 1799:
    print('2')

elif x>= 1800 and x<= 1999:
    print('1')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))

Fixed submission:
r = int(input())
print(r*r)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b,c = map(int, input().split())
s = input()
print("{} {}".format(a+b+c, s))

Fixed submission:
r = int(input())
print(r*r)
Buggy python submission (verdict: Runtime Error):
def A(S):
    answer = 0

    if S[1] == 'R':
        answer += 1
        if S[0] == 'R':
            answer += 1
        if S[2] == 'R':
            answer += 1
    elif S[0] == 'R' or S[2] == 'R':
        answer = 1

    return answer

  
 print(A(input()))

Fixed submission:
def A(S):
    answer = 0

    if S[1] == 'R':
        answer += 1
        if S[0] == 'R':
            answer += 1
        if S[2] == 'R':
            answer += 1
    elif S[0] == 'R' or S[2] == 'R':
        answer = 1

    return answer

  
S = input()
print(A(S))
Buggy python submission (verdict: Runtime Error):
import math


hp, length = [int(v) for v in input().split(' ')]
damages = sorted([int(d) for d in input().split(' ')])


if damages[-1] + damages[-2] >= hp:
    print('yes')
else:
    print('no')

Fixed submission:
import sys
 
 
hp, length = [int(v) for v in input().split(' ')]
damages = sorted([int(d) for d in input().split(' ')])
 
 
for d in reversed(damages):
    hp -= d
    if hp <= 0:
        print('Yes')
        sys.exit(0)

print('No')
Buggy python submission (verdict: Time Limit Exceeded):


N,K = input().split()
AList = list(map(int, input().split()))
CSList = []

i=int(K)
j=0
while j<=int(N)-int(K):
    BList=AList[j:i]
    if j==0:
        MAE=BList[0]
    elif MAE>=BList[-1]:
        print("No")
        MAE=BList[0]
    elif MAE<BList[-1]:
        print("Yes")
        MAE=BList[0]
    i+=1
    j+=1










Fixed submission:


N,K = map(int, input().split())
AList = list(map(int, input().split()))

A=str(K)
i=int(A)
j=0
while j<=N-K:
    #BList=AList[j:i]
    if j==0:
        MAE=AList[j]
    elif MAE>=AList[i-1]:
        print("No")
        MAE=AList[j]
    elif MAE<AList[i-1]:
        print("Yes")
        MAE=AList[j]
    i+=1
    j+=1
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
#N = int(input())
A,V=map(int, input().split())
B,W=map(int, input().split())
T=int(input())

if V<=W:
    print("NO")
    quit()

SA=abs(A-B)
i=0
while i<T:
    SA=SA-(V-W)
    i+=1
    
if SA<=0:
    print("YES")
else:
    print("NO")

Fixed submission:
# coding: utf-8
#N = int(input())
A,V=map(int, input().split())
B,W=map(int, input().split())
T=int(input())

if V<=W:
    print("NO")
    quit()

SA=abs(A-B)
CHIJI=(V-W)
SA=SA-(CHIJI*T)
#print(SA)
    
if SA<=0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N=int(input())
List = list(map(int, input().split()))

ANS=List[0]
i=1
while i<N:
    ANS=ANS*List[i]
    i+=1

if ANS>1000000000000000000:
    print(-1)
else:
    print(ANS)





Fixed submission:
# coding: utf-8
# Your code here!
N=int(input())
List = list(map(int, input().split()))
List=sorted(List)
List=List[::-1]
#print(List)
if List.count(0)!=0:
    print(0)
    quit()
ANS=List[0]
i=1
while i<N:
    ANS=ANS*List[i]
    if ANS>1000000000000000000:
        print(-1)
        quit()
    i+=1

print(ANS)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools
import functools

K = int(input())

lista=list(range(1, (K+1)))
listb=list(range(1, (K+1)))
listc=list(range(1, (K+1)))

ans = [0]

#print(lista)
for pair in itertools.product(lista, listb, listc):
    #print(pair)
    values = list(pair)
    #print(values)
    gcd = functools.reduce(math.gcd, values)
    #print(gcd)
    ans.append(gcd)
print(sum(ans))

Fixed submission:
# coding: utf-8
# Your code here!
import math
import itertools
import functools

K = int(input())

if K==151:
    print(4616104)
elif K==152:
    print(4718640)
elif K==153:
    print(4812789)
elif K==154:
    print(4918561)
elif K==155:
    print(5003286)
elif K==156:
    print(5131848)
elif K==157:
    print(5205481)
elif K==158:
    print(5299011)
elif K==159:
    print(5392008)
elif K==160:
    print(5521384)
elif K==161:
    print(5610705)
elif K==162:
    print(5739009)
elif K==163:
    print(5818390)
elif K==164:
    print(5930196)
elif K==165:
    print(6052893)
elif K==166:
    print(6156139)
elif K==167:
    print(6239472)
elif K==168:
    print(6402720)
elif K==169:
    print(6493681)
elif K==170:
    print(6623853)
elif K==171:
    print(6741078)
elif K==172:
    print(6864016)
elif K==173:
    print(6953457)
elif K==174:
    print(7094451)
elif K==175:
    print(7215016)
elif K==176:
    print(7359936)
elif K==177:
    print(7475145)
elif K==178:
    print(7593865)
elif K==179:
    print(7689630)
elif K==180:
    print(7886244)
elif K==181:
    print(7984165)
elif K==182:
    print(8130747)
elif K==183:
    print(8253888)
elif K==184:
    print(8403448)
elif K==185:
    print(8523897)
elif K==186:
    print(8684853)
elif K==187:
    print(8802826)
elif K==189:
    print(8949612)
elif K==190:
    print(9267595)
elif K==191:
    print(9376656)
elif K==192:
    print(9574704)
elif K==193:
    print(9686065)
elif K==194:
    print(9827097)
elif K==195:
    print(9997134)
elif K==196:
    print(10174780)
elif K==197:
    print(10290813)
elif K==198:
    print(10493367)
elif K==199:
    print(10611772)
elif K==200:
    print(10813692)
else:
        
    lista=list(range(1, (K+1)))
    listb=list(range(1, (K+1)))
    listc=list(range(1, (K+1)))
    
    ans = 0
    
    #print(lista)
    for pair in itertools.product(lista, listb, listc):
        #print(pair)
        #values = list(pair)
        #print(values)
        gcd = functools.reduce(math.gcd, list(pair))
        #print(gcd)
        ans+=gcd
    print(ans)
Buggy python submission (verdict: Runtime Error):
from scipy import special
N, M = map(int, input().split())

Nmath = special.comb(N, 2)
Mmath = special.comb(M, 2)

print(int(Nmath+Mmath))

Fixed submission:
import itertools
r = 2
N, M = map(int, input().split())
Nmath = len(list(itertools.combinations(range(N), r)))
Mmath = len(list(itertools.combinations(range(M), r)))

print(int(Nmath+Mmath))

Buggy python submission (verdict: Runtime Error):
from scipy import special
N, M = map(int, input().split())

Nmath = special.comb(N, 2,True)
Mmath = special.comb(M, 2,True)

print(Nmath+Mmath)

Fixed submission:
import itertools
r = 2
N, M = map(int, input().split())
Nmath = len(list(itertools.combinations(range(N), r)))
Mmath = len(list(itertools.combinations(range(M), r)))

print(int(Nmath+Mmath))
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
while i<=10000:
  if (int((i*0.08)==A)) and (int((i*0.1)==B)):
    print(i)
    exit()
  i+=1
print(-1)

Fixed submission:
A,B = map(int,input().split())
i=1
while i<=10000:
  if (int(i * 0.08) == A) & (int(i * 0.10) == B):
    print(i)
    exit()
  i+=1
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
 
i=0
while i<10000:
  if A*0.08==i and B*0.1==i:
    print(i)
    quit()
print(-1)

Fixed submission:
A,B = map(int,input().split())
i=1
while i<=10000:
  if (int(i * 0.08) == A) & (int(i * 0.10) == B):
    print(i)
    exit()
  i+=1
print(-1)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

i=0
while i<10000:
  if A*0.08==i and B*0.1==i:
    print(i)
    quit()
print(-1)

Fixed submission:
A,B = map(int,input().split())
i=1
while i<=10000:
  if (int(i * 0.08) == A) & (int(i * 0.10) == B):
    print(i)
    exit()
  i+=1
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
S = input()
Q = int(input())
Qlist = [list(input().split()) for _ in range(Q)]

#print(S)
i=0
while i<Q:
    if Qlist[i][0]=="1":
        S=S[::-1]
    else:
        check=Qlist[i][2]
        if Qlist[i][1]=="1":
            S=check+S
        else:
            S=S+check
    i+=1

print(S)
    
    





Fixed submission:
S = input()
Q = int(input())
Qlist = [list(input().split()) for _ in range(Q)]
toplist=[]
backlist=[]
Flag=1

i=0
while i<Q:
    if Qlist[i][0]=="1":
        Flag*=-1
    else:
        #check=Qlist[i][2]
        if Qlist[i][1]=="1" and Flag==-1:
            backlist.append(Qlist[i][2])
        elif Qlist[i][1]=="1" and Flag==1:
            toplist.append(Qlist[i][2])
        elif Qlist[i][1]=="2" and Flag==-1:
            toplist.append(Qlist[i][2])
        elif Qlist[i][1]=="2" and Flag==1:
            backlist.append(Qlist[i][2])
    i+=1
if Flag==1:
    #print(toplist)
    #print(S)
    #print(backlist)
    print("".join(toplist[::-1])+S+"".join(backlist))
else:
    #print(backlist[::-1])
    #print(S)
    #print(toplist[::-1])
    print("".join(backlist[::-1])+S[::-1]+"".join(toplist))
Buggy python submission (verdict: Runtime Error):
S, T = map(int, input().split())
A, B = map(int, input().split())
U = input()

if S==U:
    print(A-1)
else:
    print(B-1)

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

if S==U:
    print(A-1,B)
else:
    print(A,B-1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
List = list(map(int, input().split()))
List.sort()
List.reverse()
ans=0

if len(List) == K-1:
    print(0)
    quit()

def Check(List,ans):
    if sum(List) <= 0:
        print(ans)
        quit()

#print(List)

List=List[K:]

Check(List,ans)

j=0
while 1==1:
    ans+=List[j]
    List[j]=0
    Check(List,ans)
    j+=1
    

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

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
List = list(map(int, input().split()))
List.sort()
List.reverse()
ans=0

if len(List) == K-1:
    print(0)
    quit()

def Check(List,ans):
    if sum(List) <= 0:
        print(ans)
        quit()

#print(List)

i=0
while i<K:
    del List[0]
    i+=1

Check(List,ans)

j=0
while 1==1:
    ans+=List[j]
    List[j]=0
    Check(List,ans)
    j+=1
    

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

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)
Buggy python submission (verdict: Runtime Error):
from sympy import isprime
X=int(input())

while 1==1:
    if isprime(X)==True:
        print(X)
        quit()
    
    X+=1

Fixed submission:
X=int(input())

def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True
  
while 1==1:
    if isPrime(X)==True:
        print(X)
        quit()
    X+=1
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())

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

print(lcm(A, B))

Fixed submission:
from fractions import gcd

A, B = map(int, input().split())

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

print(lcm(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
List = list(map(int, input().split()))
AList = []

#i=1
for i in range(1,N+1):
    AList.append((List.index(i))+1)
    #i+=1
    
print(*AList)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
AList = [0]*N
for i in range(0,N):
    S=List[i]
    AList[S-1]=i+1
    
print(*AList)

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

i=1
while i<=N:
    AList.append((List.index(i))+1)
    i+=1
    
print(*AList)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
AList = [0]*N
for i in range(0,N):
    S=List[i]
    AList[S-1]=i+1
    
print(*AList)

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

i=1
while i<=N:
    AList.append((List.index(i))+1)
    
    i+=1
    
print(*AList)




Fixed submission:
N=int(input())
List = list(map(int, input().split()))
AList = [0]*N
for i in range(0,N):
    S=List[i]
    AList[S-1]=i+1
    
print(*AList)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
AList = [int(input()) for i in range(N)]

if AList.count(max(AList)) > 1:
    for i in range(N):
        print(max(AList))
else:
    SList=sorted(AList)
    SecMax=SList[-2]
    MaxIndex=AList.index(max(AList))
    
    for i in range(N):
        if i==MaxIndex:
            print(SecMax)
        else:
            print(max(AList))
    
    
    


Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A)
for n in A:
    if B[-1] != n:
        print(B[-1])
    else:
        print(B[-2])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
AList = [int(input()) for i in range(N)]

MList=[]
i=0
while i<N:
    B=str(AList[i])
    AList[i]=0
    MList.append(max(AList))
    AList[i]=int(B)
    
    i+=1

for i in MList:
    print(i)

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A)
for n in A:
    if B[-1] != n:
        print(B[-1])
    else:
        print(B[-2])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
AList = [int(input()) for i in range(N)]

MList=[]
i=0
while i<N:
    B=str(AList[i])
    AList[i]=0
    MList.append(max(AList))
    AList[i]=int(B)
    
    i+=1

for i in MList:
    print(i)

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A)
for n in A:
    if B[-1] != n:
        print(B[-1])
    else:
        print(B[-2])
Buggy python submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

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

LCM=lcm(C,D)

Cwari=(B//C)-((A-1)//C)
Dwari=(B//D)-((A-1)//D)
CDwari=(B//LCM)-(A//LCM)

print((B-A+1)-(Cwari+Dwari-CDwari))



Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
i=0
bow=0
while bow<=X:
    bow+=List[i]
    i+=1
print(i)

Fixed submission:
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
bow=0
cnt=1
for i in range(0,N):
    bow+=List[i]
    if bow>X:
        break
    else:
        cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A<5:
    print(0)
elif A<12:
    print(B/2)
else:
    print(B







Fixed submission:
# coding: utf-8
# Your code here!
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):
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)

Fixed submission:
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N, M = map(int, input().split())
List = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

SumList = [sum(List)]

i=0
while i<M:
    CheckList = List
    j=0
    while j<BC[i][0]:
        CheckList[CheckList.index(min(CheckList))] = BC[i][1]
        j+=1
    SumList.append(sum(CheckList))
    i+=1

print(max(SumList))

Fixed submission:
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N, M = map(int, input().split())
List = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

SumList = [sum(List)]

i=0
while i<M:
    CheckList = List
    
    j=0
    while j<BC[i][0]:
        CheckList[CheckList.index(min(CheckList))] = BC[i][1]
        j+=1
        
    SumList.append(sum(CheckList))
        
    i+=1

print(max(SumList))

Fixed submission:
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k
    print("Yay!")
else:
    print(":(")

Fixed submission:
# coding: utf-8
# Your code here!
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
    exit()

if n==k and k==len(p):
        print(sum(p))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
else:
    if n==k and k==len(p):
        print(sum(p))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
elif n==k:
    print(sum(p))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
    exit()

if n==k:
    print(sum(p))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=input().split()

if s[0]*s[1]>10**18:
    print(s[0]*s[1])
else:
    print("-1")

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)#小さい順に計算することで処理時間短縮
f=A[0]
for i in range(1,N):
    f*=A[i]
    if f>10**18:
        print(-1)
        exit()
            
print(f)