Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Fixed submission:
input_st = input().split()
input_num = [int(s) for s in input_st]
num = sorted(input_num)
if num[0] == 5 and num[1] == 5 and num[2] == 7:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in range(len(D)):
    Da.remove(D[i])
Da_str = [str(j) for j in Da]

a_1 = [''.join(j) for j in itertools.product(b_st, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(b_st, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]

 
for i in nu:
    if i >= N:
        print(i)
        break

Fixed submission:
input_st = input().split()
input_num = [int(s) for s in input_st]
num = sorted(input_num)
if num[0] == 5 and num[1] == 5 and num[2] == 7:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
NL = input().split()
N = int(NL[0])
L = int(NL[1])
aba = ["axx", "fxx", "dxx"]
st = []
for i in range(N):
    a = aba[i]
    st.append(a)
s_st = sorted(st)
dic = ""
for j in range(len(s_st)):
    dic += s_st[j]
print(dic)

Fixed submission:
NL = input().split()
N = int(NL[0])
L = int(NL[1])

st = []
for i in range(N):
    a = input()
    st.append(a)
s_st = sorted(st)
dic = ""
for j in range(len(s_st)):
    dic += s_st[j]
print(dic)

Buggy python submission (verdict: Runtime Error):
NL = ["3", "3"]
N = int(NL[0])
L = int(NL[1])

st = []
for i in range(N):
    a = input()
    st.append(a)
s_st = sorted(st)
dic = ""
for j in range(len(s_st)):
    dic += s_st[j]
print(dic)
  

Fixed submission:
NL = input().split()
N = int(NL[0])
L = int(NL[1])

st = []
for i in range(N):
    a = input()
    st.append(a)
s_st = sorted(st)
dic = ""
for j in range(len(s_st)):
    dic += s_st[j]
print(dic)
Buggy python submission (verdict: Time Limit Exceeded):
l=[2658,3]
d=[2,4,5]
d_bar=[]
for m in range(10):
    if m not in d:
        d_bar.append(m) 
d_bar.sort()
n=[int(k) for k in str(l[0])]

for i in range(len(n)):
    dig1=''
    dig2=0
    for j in range(l[1]):
        p=dig1.join(str(d_bar[j]))
        if int(p)>l[0]:
          dig2=dig2+int(dig1)*l[1]**(l[0]-i)
          break
        dig1=p     
dig2=dig2+1
r=int(dig1)
q=int(dig1)
R=[]
while q!=0 or q!=1:
    q=q/l[1]
    r=q%l[1]
    R.insert(0,r)
s=''
for t in range(len(R)):
    s=s+str(R[t])
print(int(s))




Fixed submission:
L = sorted(map(int, input().split()))
 
ans = 'YES' if L == [5, 5, 7] else 'NO'
print(ans)

Buggy python submission (verdict: Runtime Error):
if sorted(map(int, input().split())) == [5, 5, 7]:
  return 'Yes'
else:
  return 'No'
  

Fixed submission:
L = sorted(map(int, input().split()))
 
ans = 'YES' if L == [5, 5, 7] else 'NO'
print(ans)

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
list = [A, B, C]
if list.sort() == [5, 5, 7]:
  return 'Yes'
else:
  return 'No'

Fixed submission:
L = sorted(map(int, input().split()))
 
ans = 'YES' if L == [5, 5, 7] else 'NO'
print(ans)

Buggy python submission (verdict: Runtime Error):
list = [A, B, C]
if list.sort() == [5, 5, 7]:
  return 'Yes'
else:
  return 'No'
   

Fixed submission:
L = sorted(map(int, input().split()))
 
ans = 'YES' if L == [5, 5, 7] else 'NO'
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort（）
str1=''
for i in range (H):
    str1=str1+S[i] 
print(str1)

Fixed submission:
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort()
str1=''
for i in range (H):
    str1=str1+S[i] 
print(str1)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort（）
str1=''
str1.append(S[i] for i in range (H))
print(str1)

Fixed submission:
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort()
str1=''
for i in range (H):
    str1=str1+S[i] 
print(str1)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort（）
str1=''
str1.append(S[i] for i in range (H))

Fixed submission:
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort()
str1=''
for i in range (H):
    str1=str1+S[i] 
print(str1)
Buggy python submission (verdict: Runtime Error):
abc = list(map(int,input().split()))

if 5 in abc and 7 in abc and abc.count(7)==1:
  print('YES')
else 
  print('NOT')


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

if 5 in abc and 7 in abc and abc.count(7)==1:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
num_1 = int(input())
num_2 = int(input())
num_3 = int(input())

elif num_1 == 5:
	elif nmu_2 == 5 and num_3 == 7 or nmu_2 == 7 and num_3 == 5:
  		print('Yes')
    else 
    	print('NO')
else:
    	elif nmu_2 == 5 and num_3 == 7 or nmu_2 == 7 and num_3 == 5:
  		print('Yes')
    else 
    	print('NO')


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

if 5 in abc and 7 in abc and abc.count(7)==1:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().split()))
S.sort()
if S.sort()==[5,5,7]:
  return("YES")
else:
  return("NO")

Fixed submission:
S = list(map(int, input().split()))
S.sort()
if S == [5,5,7]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().split()))
S.sort()
if S.sort()==[5,5,7]:
  return(YES)
else: return(NO)

Fixed submission:
S = list(map(int, input().split()))
S.sort()
if S == [5,5,7]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
if (A == 5 and B == 5 and C == 7) or (A == 5, B == 7, C == 5) or (A==7, B==5, C==5):
	return(YES)
else: return(NO)

Fixed submission:
S = list(map(int, input().split()))
S.sort()
if S == [5,5,7]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
List = [input() for i in range(n)]

print("".join(sorted(List))


Fixed submission:
n,m = map(int,input().split())
List = [input() for i in range(n)]

List2 = sorted(List)
print("".join(List2))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
List = [input() for i in range(n)]

print(''.join(sorted(List))

Fixed submission:
n,m = map(int,input().split())
List = [input() for i in range(n)]

List2 = sorted(List)
print("".join(List2))
Buggy python submission (verdict: Runtime Error):
list = list(map(int(input())))
print(list)

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

if list.count(5) == 2 and list.count(7) == 1:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
list = list(map(int(input())))

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

if list.count(5) == 2 and list.count(7) == 1:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
l = map(int,list(input()))
if(l[0]==l[1]):
  print("YES")
else:
  print("NO")

Fixed submission:
l = input().split()

x = l.count("5")
y = l.count("7")

if(x==2 and y==1):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
import sys
import itertools
readline = lambda:sys.stdin.readline().rstrip()
N,K = readline().split()
dd = {int(s) for s in readline().split()}
table = [None] * 10
a = 10
for i in range(9,-1,-1):
    if i not in dd:
        a = i
    table[i] = a

nn = [int(n) for n in N]
mm = [table[n] for n in nn]
tab_min = min(x for x in table if x>0)
tab_zero = table[0]
        
if mm[0]==10:
    print(tab_min, end='')
    for z in itertools.repeat(tab_zero, len(mm)-1):
        print(z, end='')
else:
    for z,c in zip(mm, mm[1:]+[0]): 
        if c==10:
            print(min(tab_min, z), end='')
        elif z==10:
            print(tab_zero, end='')
        else:
            print(z, end='')
print()

Fixed submission:
import sys
readline = lambda:sys.stdin.readline().rstrip()
a,b,c = sorted(map(int, readline().split()))
ans = 'YES' if a==b==5 and c==7 else 'NO'
print(ans)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
result = []

for i in range(N):
  result.append(i)
 
print("".join(sorted(result)))

Fixed submission:
N, L = map(int, input().split())
result = []
 
for i in range(N):
  result.append(input())
 
print("".join(sorted(result)))
Buggy python submission (verdict: Runtime Error):
x = list(map(int,input().split()))
for i in 0 to X[0]
    A.append(input())

result = ''.join(A)
print(result)


Fixed submission:
x = list(map(int,input().split()))
A = []
for i in range(x[0]):
    A.append(input())

A.sort()
result = ''.join(A)
print(result)
Buggy python submission (verdict: Runtime Error):
l = [int(i) for i in range(input().split()]
print('YES') if  l.count(5) == 2 and l.count(7) == 1 else print('NO') 
                        

Fixed submission:
l = [int(i) for i in  input().split()]
print('YES') if  l.count(5) == 2 and l.count(7) == 1 else print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

f_line = input().split()
N = int(f_line[0])
L = int(f_line[1])
S = []
s = ""
for i in range(N):
    S.append(input())
S.sort()
for i in range(N):
    s = s + S[i]
print("%s"%(s))


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

f_count = 2
s_count = 1
haikuflag = False
input_stuck = input().split()
num = [int(input_stuck[0]),int(input_stuck[1]),int(input_stuck[2])]
for i in num:
    if i == 5:
        f_count-=1
    elif i == 7:
        s_count-=1
if f_count == 0 and s_count == 0:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

f_line = input().split()
N = int(f_line[0])
L = int(f_line[1])
S = []
s = ""
for i in range(N):
    S.append(input())
S.sort()
for i in range(N):
    s = s + S[i]
print("%s"%(s))

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

f_count = 2
s_count = 1
haikuflag = False
input_stuck = input().split()
num = [int(input_stuck[0]),int(input_stuck[1]),int(input_stuck[2])]
for i in num:
    if i == 5:
        f_count-=1
    elif i == 7:
        s_count-=1
if f_count == 0 and s_count == 0:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A+B+C == 17 and (A==5 or A==7) and (B==5 or B==7) and (C==5 or C==7):
  print('YES')
  else:
    print('NO')

Fixed submission:
A,B,C = map(int,input().split())
if A+B+C == 17 and (A==5 or A==7) and (B==5 or B==7) and (C==5 or C==7):
  print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
test=list(map(int, input().split()))
 
def iroha():
 	if test==[5,5,7]:
		print("yes")
    elif test==[5,7,5]:
		print("yes")
    elif test==[7,5,5]:
        print("yes")
    else:
        print("no")
iroha()

Fixed submission:
test=list(map(int, input().split()))
 
def iroha():
    if test==[5,5,7]:
        print("YES")
    elif test==[5,7,5]:
        print("YES")
    elif test==[7,5,5]:
        print("YES")
    else:
        print("NO")
 

iroha()

Buggy python submission (verdict: Runtime Error):
test=list(map(int, input().split()))

 def iroha():
 	if test==[5,5,7]:
		print("yes")
    elif test==[5,7,5]:
		print("yes")
    elif test==[7,5,5]:
        print("yes")
     else:
        print("no")

iroha()

Fixed submission:
test=list(map(int, input().split()))
 
def iroha():
    if test==[5,5,7]:
        print("YES")
    elif test==[5,7,5]:
        print("YES")
    elif test==[7,5,5]:
        print("YES")
    else:
        print("NO")
 

iroha()
Buggy python submission (verdict: Runtime Error):
N,L = map(int,input().split())
 
for n in range(int(N)):
    data.append(input())
 
 
    
result=sorted(data)
result

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

data=[]
for n in range(int(N)):
    data.append(input())
  
iroha=""
A=sorted(data)
for i in A:
    iroha+=i
    
print(iroha)

Buggy python submission (verdict: Runtime Error):
N,L = map(int,input().split())

for n in range(int(N)):
    data.append(input())


    
result=sorted(data)

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

data=[]
for n in range(int(N)):
    data.append(input())
  
iroha=""
A=sorted(data)
for i in A:
    iroha+=i
    
print(iroha)

Buggy python submission (verdict: Runtime Error):
test=sorted(list(input().split()))



print(test[0]+test[1]+test[2])

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

data=[]
for n in range(int(N)):
    data.append(input())
  
iroha=""
A=sorted(data)
for i in A:
    iroha+=i
    
print(iroha)
Buggy python submission (verdict: Runtime Error):
s = input().split()

if s.count("5") == 2 and s.count("7") = 1:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input().split()

if s.count("5") == 2 and s.count("7") == 1:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
s = input().split()

if s.find("5") == 2 and s.find("7") == 1:
  print("YES")
else:
  print("NO")

Fixed submission:
s = input().split()

if s.count("5") == 2 and s.count("7") == 1:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
dlist = list(map(int, input().split()))

for i in range(n, 10000):
    flg: bool = True
    for s in str(i):
        if int(s) in dlist:
            flg = False
            break
    if flg:
        print(i)
        break


Fixed submission:
n, k = map(int, input().split())
dlist = input().split()
flg = True
while flg:
    s = str(n)
    for t in s:
        if t in dlist:
            n += 1
            break
    else:
        flg = False
print(n)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if [A, B, C].count(5) = 2 and [A, B, C].count(7) = 1:
	print("YES")
else:
  	print("NO")



Fixed submission:
A, B, C = map(int, input().split())
if [A, B, C].count(5) == 2 and [A, B, C].count(7) == 1:
	print("YES")
else:
  	print("NO")

Buggy python submission (verdict: Runtime Error):
def k(l,i1,i2):
  if(a==7):
    i1 = i1+1
  if(a==5):
    i2 = i2+1
return i1,i2
  
l=list(int,input().split())
i1=0
i2=0
for i in l:
  i1,i2 = k(i,i1,i2)
print('YES' if i1==1 and i2==2 else 'NO')

Fixed submission:
def k(a,i1,i2):
  if(a==7):
    i1 = i1+1
  if(a==5):
    i2 = i2+1
  return i1,i2
  
a,b,c=map(int,input().split())
i1=0
i2=0
i1,i2 = k(a,i1,i2)
i1,i2 = k(b,i1,i2)
i1,i2 = k(c,i1,i2)
print('YES' if i1==1 and i2==2 else 'NO')

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

args = sys.args[1::]
numbers = [int(s) for s in args]

if sorted(numbers) == [5, 5, 7]:
  return 'YES'
else:
  return 'No'


Fixed submission:
import sys

args = list(map(int, input().split()))

if sorted(args) == [5, 5, 7]:
  print('YES')
else:
  print('NO')

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

args = sys.args[1::]
ints = [int(s) for s in args]

return sorted(ints) == [5, 5, 7]


Fixed submission:
import sys

args = list(map(int, input().split()))

if sorted(args) == [5, 5, 7]:
  print('YES')
else:
  print('NO')

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

cnt = 0
for i in A:
  if i != 7 or i !=5:
  	print('NO')
  else i == 7:
    cnt += 1

if cnt == 1:
  print('YES')
else:
  print('NO')

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

cnt = 0
for i in A:
  if i != 7 and i !=5:
  	cnt = 5
  elif i == 7:
    cnt += 1

if cnt == 1:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
A = map(int, list(input() for _ in range(N)))
B = sorted(A)

print(''.join(B))

Fixed submission:
N, L = map(int, input().split())
A = map(str,list(input() for _ in range(N)))
B = sorted(A)

print(''.join(B))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
line = map(int, input().split())

ans = "YES" if line.count(5) == 2 and line.count(7) == 1 else "NO"

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
line = map(int, input().split())
#ans = "YES" if line.count(5) == 2 and line.count(7) == 1 else "NO"

if sorted(line) == [5, 5, 7]:
    print("YES")
else:
    print("NO")

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

def main(arg_list):
    if(len(arg_list == 3) and arg_list.count('5')==2 and arg_list.count('7') == 1):
        return "YES"
    return "NO"

if __name__ == "__main__":
    main(sys.argv)

Fixed submission:
import fileinput

def main(arg_list):
    if(len(arg_list) == 3 and arg_list.count('5')==2 and arg_list.count('7') == 1):
        print("YES")
        return 
    print("NO")

if __name__ == "__main__":
    for line in fileinput.input():
        main(line.rstrip("\n\r").split(" "))

Buggy python submission (verdict: Runtime Error):
if '557' == ''.join(sorted(input().split())):
    return 'YES'
else:
    return 'NO'


Fixed submission:
res = 'YES' if '557' == ''.join(sorted(input().split())) else 'NO'
print(res)
Buggy python submission (verdict: Runtime Error):
a = map(int, input().split()
flag5=0
flag7=0

for i in range(len(a)):
    if a[i] = 5:
        flag5 += 1
    elif a[i] = 7:
        flag7 += 1
    else:
        flag5 = 0
        break
if flag5=2 and flag7=1:
    print('YES')
else:
    print('NO')


Fixed submission:
a = list(map(int, input().split()))
#a = [5,7,5]
a.sort()
if a==[5,5,7]:
        print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
n, _ = input().split(' ')
o = set([d for d in range(10)])
d = set([int(t) for t in input().split(' ')])
o = list(o.difference(d))
o.sort()
ans = []
for t in n:
    t = int(t)
    for tt in o:
        if tt >= t:
            ans.append(tt)
            break
    else:
        ans.append(o[0])

if int(''.join(map(str,ans))) < int(n):
    ans.insert(0, o[0] if o[0] != 0 else o[1])

print(''.join(map(str,ans)))

Fixed submission:
n = map(int, input().split(' '))
cnt1 = 0
cnt2 = 0
for t in n:
    if t == 5:
        cnt1 += 1
    if t == 7:
        cnt2 += 1

if cnt1 == 2 and cnt2 == 1:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python2
#encoding: UTF-8

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import math
line=raw_input().rstrip().split(' ')
N=int(line[0])
L=int(line[1])
listo=[]
for i in range(L):
    listo.append(raw_input().rstrip())
listi=sorted(listo)
listni=''
for i in range(L):
    listni+=listi[i]
print listni    

Fixed submission:
#!/usr/bin/env python2
#encoding: UTF-8

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import math
line=raw_input().rstrip().split(' ')
a=int(line[0])
b=int(line[1])
c=int(line[2])
if((a==7 and b==5 and c==5)or(a==5 and b==7 and c==5)or(a==5 and b==5 and c==7)):
    print 'YES'
else:
    print 'NO'
Buggy python submission (verdict: Runtime Error):
k = iinput()
li= input().split()
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Fixed submission:
k = int(input())
li= list(map(int, input().split()))
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Buggy python submission (verdict: Runtime Error):
try:
  k=input()
except EOFError:
  print("wtf")

try:
  li=input()
except EOFError:
  print("wtf2")


li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
print(sum)

Fixed submission:
k = int(input())
li= list(map(int, input().split()))
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Buggy python submission (verdict: Runtime Error):
k=input()

li=input()

li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)


Fixed submission:
k = int(input())
li= list(map(int, input().split()))
li.sort()
sum=0
for k in range(len(li)):
  
  if k%2==0:
   
    sum=sum+li[k]
 
print(sum)

Buggy python submission (verdict: Runtime Error):

num = int(input())
li = int(input().split())

print(num)
print(li)

Fixed submission:
n = int(input())
li = [int(x) for x in input().split()]

def skews(n,li):
    
    li = sorted(li)
    li = [l for i,l in enumerate(li) if i%2==0] 
    return sum(li)


print(skews(n,li))
Buggy python submission (verdict: Runtime Error):
N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)


def rhombus(N,X):
  	if N<X:
        temp = N
        N = X
        X = temp 
        
    if X==1: 
        return N+1
    if X==0:
        return 0

    if N%X == 0:
        return X*(N//X)*2-X
      
    else: 
        k = N//X
        return k*2*X + rhombus(X,N-(k*X))

      

answer = answer + rhombus(N-X,X)
print(answer)

Fixed submission:
N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)


def rhombus(N,X):
  	
    if X==1: 
        return N*2-1
    if X==0:
        return 0

    if N%X == 0:
        return X*(N//X)*2-X
      
    else: 
        k = N//X
        return k*2*X + rhombus(X,N-(k*X))

      

answer = answer + rhombus(N-X,X)
print(answer)
Buggy python submission (verdict: Runtime Error):
def main(p1,p2):
    print(p1)
    print(p2)
    L_np = np.sort(np.array(p2))
    x_total = 0
    for i in range(p1):
        x_total += L_np[2*i]
    print(x_total)

if __name__ == "__main__":
    #a = [int(input()) for i in range(5)]
    N = int(input())
    L = [int(item) for item in input().split()]
    main(N,L)

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

import numpy as np

def main(p1,p2):
    L_np = np.sort(np.array(p2))
    x_total = 0
    for i in range(p1):
        x_total += L_np[2*i]
    print(x_total)

if __name__ == "__main__":
    #a = [int(input()) for i in range(5)]
    N = int(input())
    L = [int(item) for item in input().split()]
    main(N,L)

Buggy python submission (verdict: Runtime Error):
kusiyaki = int(input())
kushi = []

for i in range(kusiyaki*2):
  kushi.append(int(input()))
  
kushi = sorted(kushi)
print(sum(kushi[0::2]))

Fixed submission:
a = int(input())
b = sorted(map(int,input().split()))
print(sum(b[0::2]))

Buggy python submission (verdict: Runtime Error):
kusiyaki = int(input('作りたい串焼きの本数を入力してください：'))
kushi = [None] * kusiyaki * 2
i = 0
sum = 0

for kushi_length in kushi:
  kushi_length = input('串の長さを入力してください：')
  kushi[i] = int(kushi_length)
  i += 1


kushi = sorted(kushi)
kushi_min_length = kushi[0:len(kushi):2]
print(kushi)
print(kushi_min_length)
for length in kushi_min_length:
  sum += int(length)

print(sum)

Fixed submission:
a = int(input())
b = sorted(map(int,input().split()))
print(sum(b[0::2]))

Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
z=3.5*y+x
print(z)

Fixed submission:
x=input()
y = sorted(list(map(int, input().split())))
i=1
z=0
for i in range(int(len(y)/2)):
     z+=y[-2*i]
     i+=1

print(z)

Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
z=3.5*y+x
print(z)

Fixed submission:
x=input()
y = sorted(list(map(int, input().split())))
i=1
z=0
for i in range(int(len(y)/2)):
     z+=y[-2*i]
     i+=1

print(z)
Buggy python submission (verdict: Time Limit Exceeded):
N,X = map(int,input().split())
x = X
y = N-X
res = N
while 1:
    if x==y:
        res += x
        break
    if x > y:
        x,y = y,x
    res += x*2
    y -= x
print(res)

Fixed submission:
N,X = map(int,input().split())
x = X
y = N-X
if x<y:
    x,y = y,x
res = N
while y>0:
    x,y = y,x
    m = x*(y//x)
    res += m*2
    y -= m
res -= x
print(res)