Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

N=int(input())
n=[]
n.append(int(input())
n.append(int(input())
n.append(int(input())
n.append(int(input())
n.append(int(input())

print(5+N//min(n))
    

Fixed submission:
import math
import heapq
import sys
from collections import Counter
import numpy as np
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

N=int(input())
n=[]
n.append(int(input()))
n.append(int(input()))
n.append(int(input()))
n.append(int(input()))
n.append(int(input()))

print(4+math.ceil(N/min(n)))
Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,x=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
a=list(map(int,input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(a)  # リストを優先度付きキューへ

for i in range(N):
    x-=heapq.heappop(a)  # 最小値の取り出し
    #print(x,a)
    if x<=0 or i==N-1:
        print(i+1)
        break

Fixed submission:
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,x=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
a=list(map(int,input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(a)  # リストを優先度付きキューへ

for i in range(N):
    x-=heapq.heappop(a)  # 最小値の取り出し
    #print(x,a)
    if x<=0 or i==N-1:
        if x==0:
            print(i+1)
        else:
            print(i)
        break
Buggy python submission (verdict: Runtime Error):
N=int(input())

for i in range(0,N//4):
    if (N-4*i)%7==0:
        print('Yes')
        sys.exit()
        
print('No')

Fixed submission:
import math
import heapq
import sys
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())

for i in range(0,N//4+1):
    if (N-4*i)%7==0:
        print('Yes')
        sys.exit()
        
print('No')

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

for i in range(0,N//4):
    if (N-4*i)%7==0:
        print('Yes')
        sys.exit()
        
print('No')

Fixed submission:
import math
import heapq
import sys
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())

for i in range(0,N//4+1):
    if (N-4*i)%7==0:
        print('Yes')
        sys.exit()
        
print('No')
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
for i in range(len(S)):
    if S!=T:
        S=S[-1]+S[:-1]
        print(S)
    else:
        print('Yes')
        sys.exit()
        
print('No')

Fixed submission:
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

S=input()
T=input()
for i in range(len(S)):
    if S!=T:
        S=S[-1]+S[:-1]
    else:
        print('Yes')
        sys.exit()
        
print('No')
Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input[0])
a=list(map(int,input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

cnt=0
for i in range(len(a)-1):
    if a[i]==a[i+1]:
        a[i+1]=-1
        cnt+=1
        #print(a)


print(cnt)


Fixed submission:
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
a=list(map(int,input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

cnt=0
for i in range(len(a)-1):
    if a[i]==a[i+1]:
        a[i+1]=-1
        cnt+=1
        #print(a)


print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//math.gcd(2,N))

Fixed submission:
import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//fractions.gcd(2,N))

Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//math.gcd(2,N))

Fixed submission:
import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//fractions.gcd(2,N))

Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき


N=int(input())

print((2*N)//math.gcd(2,N))
    

Fixed submission:
import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//fractions.gcd(2,N))

Buggy python submission (verdict: Runtime Error):
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

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

N=int(input())

print(lcm(2,N))
    

Fixed submission:
import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//fractions.gcd(2,N))
Buggy python submission (verdict: Runtime Error):
import math

N,K=map(int, inp[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
A=list(map(int, inp[0].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき


if N==K:
    print(1)
else:
    print(math.ceil((N-1)/(K-1)))


Fixed submission:
import math

N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
A=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき


if N==K:
    print(1)
else:
    print(math.ceil((N-1)/(K-1)))
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())

print(min(A,B)+min(C+D))

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())

print(min(A,B)+min(C,D))
Buggy python submission (verdict: Runtime Error):
import math
import heapq
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
A=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

S=Counter(A)
s= S.most_common(K)

print(N-[sum(x) for x in zip(*s)][1])


Fixed submission:
import math
import heapq
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
A=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

S=Counter(A)
s= S.most_common(K)

print(N-[sum(x) for x in zip(*s)][1])
Buggy python submission (verdict: Runtime Error):
import math

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

if A==1:
    A=14
if B==1:
    B=14
    
if A>B:
    print('Alice')
elif A<B:
    if b=='H':
        print('Bob')
    else:
        print('Draw')

Fixed submission:
import math

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

if A==1:
    A=14
if B==1:
    B=14
    
if A>B:
    print('Alice')
elif A<B:
    print('Bob')
else:
    print('Draw')
Buggy python submission (verdict: Runtime Error):
1 <= a <= b <=20

a,b=(int(x) for x in input().split())


if b % a == 0:
    print(a + b)
else :
    print(a - b)


Fixed submission:
a = int()
b = int()

1 <= a <= b <=20

a,b=(int(x) for x in input().split())


if b % a == 0:
    print(a + b)
else :
    print(b - a)
Buggy python submission (verdict: Runtime Error):
N A B = tuple(input().split())
print((N // (A + B)) * A + N % (A + B))

Fixed submission:
inp = input().split()
inp = [int(i) for i in inp]
N, A, B = inp
ans = (N//(A+B))*A
rem = N%(A+B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if N-r*R-g*G < 0:
            break
        if N-r*R-g*G >= 0 and (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if N-r*R-g*G >= 0 and (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if N-r*R-g*G >= 0 and (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
TD=[]

for q in range(Q):
	TD.append(list(map(str,input().split())))

L = []
s=''
for i in range(N):
	s=S[i]+s
	L.append(s)
R = []
s=''
for i in range(N)[::-1]:
	s=S[i]+s
	R.append(s)


L=S[:]
R=S[::-1]
lw=0
rw=0
ansl = 0
ansr = 0
for q in range(Q)[::-1]:
	if TD[q][1] == 'L':
		if TD[q][0] == L[lw]:
			
			ansl = max(ansl, lw+1)
			lw = min(lw+1, N-1)
		if TD[q][0] == R[rw-1]:
			rw = 0
	if TD[q][1] == 'R':
		if TD[q][0] == R[rw]:
			ansr = max(ansr, rw+1)
			rw = min(rw+1, N-1)
		if TD[q][0] == R[rw]:
			lw = 0
print(N-(ansr+ansl))
			


Fixed submission:
N,Q=map(int,input().split())
S=input()
TD=[]
for q in range(Q):
	TD.append(list(map(str,input().split())))
L=S[:]
R=S[::-1]
lw=0
rw=0
ansl = 0
ansr = 0
for q in range(Q)[::-1]:
	if TD[q][1] == 'L': 
		if TD[q][0] == L[lw]: #now word is OK
			ansl = max(ansl, lw+1)
			if lw+1 == N: #all clear
				break
			else:
				lw += 1
		if rw>0: 
			if TD[q][0] == R[rw-1]: #before word is wrong
				ansr = max(ansr-1, 0)
				rw -=1
	if TD[q][1] == 'R':
		if TD[q][0] == R[rw]: #now word is OK
			ansr = max(ansr, rw+1)
			if rw+1 == N: #all clear
				break 
			else:
				rw += 1
		if lw>0: 
			if TD[q][0] == L[lw-1]: #before word is wrong
				ansl = max(ansl-1, 0)
				lw -=1


print(max(0,N-(ansr+ansl)))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
B=list(map(int,input().split()))
def DP(L):
	if L==[]:
		return 1,[]
	ret=[]
	for i in range(len(L))[::-1]:
		if L[i]==i+1:
			tL=L[:]
			del tL[i]
			f,dp=DP(tL)
			if f==1:
				return 1,[i+1]+dp
	return -1,[]
f,dp=DP(B)
if f==1:
	for d in dp[::-1]:
		print(d)
else:
	print(-1)

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
def DP(L):
	if L==[]:
		return 1,[]
	ret=[]
	for i in range(len(L))[::-1]:
		if L[i]==i+1:
			tL=L[:]
			del tL[i]
			f,dp=DP(tL)
			if f==1:
				return 1,[i+1]+dp
			else:
				break
	return -1,[]
f,dp=DP(B)
if f==1:
	for d in dp[::-1]:
		print(d)
else:
	print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
B=list(map(int,input().split()))
def DP(L):
	if L==[]:
		return 1,[]
	ret=[]
	for i in range(len(L)):
		if L[i]==i+1:
			tL=L[:]
			del tL[i]
			f,dp=DP(tL)
			if f==1:
				return 1,[i+1]+dp
	return -1,[]
f,dp=DP(B)
if f==1:
	for d in dp[::-1]:
		print(d)
else:
	print(-1)

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
def DP(L):
	if L==[]:
		return 1,[]
	ret=[]
	for i in range(len(L))[::-1]:
		if L[i]==i+1:
			tL=L[:]
			del tL[i]
			f,dp=DP(tL)
			if f==1:
				return 1,[i+1]+dp
			else:
				break
	return -1,[]
f,dp=DP(B)
if f==1:
	for d in dp[::-1]:
		print(d)
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
Sstr = list(input())
S = [int(i) for i in Sstr]

bit=[]
for i in range(0,len(S)-1):
    bit.append([abs(7-S[i]),i])


bit.sort(key=lambda x : x[0])

j=0
start=[]
while bit[0][0] == bit[j][0]:
    start.append(bit[j][1])
    j+=1

test=0
ans=1000
for st in start:
    if len(S)-st >= 3:
        test=abs(753-(S[st]*100+S[st+1]*10+S[st+2]))
        if ans > test:
            ans=test
print(ans)

Fixed submission:
Sstr = list(input())
S = [int(i) for i in Sstr]

bit=[]
for i in range(0,len(S)-2):
    bit.append([abs(7-S[i]),i])


bit.sort(key=lambda x : x[0])

j=0
start=[]

for j in range(len(bit)):
    if bit[0][0] == bit[j][0]:
        start.append(bit[j][1])
        j+=1
    else:
        break

test=0
ans=1000
for st in start:
    if len(S)-st >= 3:
        test=abs(753-(S[st]*100+S[st+1]*10+S[st+2]))
        if ans > test:
            ans=test
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder
'''
if Q>R :
    k=int((Q-R)//(1+N))
    k-=1
    Q -= k
    R += k*N
    '''
memo=0
while R%Q != 0:
    k= int(Q//(N+R//Q+1))   #max k:k*(N+R//Q)<Q-k
    #print(R,Q,R%Q,R//Q,k)
    while (R+k*N)//(Q-k) != memo and k >= 0:
        k -= 1
        #print(k,memo,(R+k*N)//(Q-k))
    if k > 0:
        Q -= k
        R += k*N
        memo=R//Q
    else:
        Q -= 1
        R += N
        memo=R//Q

print(Q)

Fixed submission:
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder
'''
if Q>R :
    k=int((Q-R)//(1+N))
    k-=1
    Q -= k
    R += k*N
    '''
memo=0
while R%Q != 0:
    k= int((Q-R%Q)//(N+R//Q+1))   #max k:k*(N+R//Q)<Q-k
    #print(R,Q,R%Q,R//Q,k)
    while (R+k*N)//(Q-k) > memo:
        k -= 1
        #print(k,memo,(R+k*N)//(Q-k))
    if k > 0:
        Q -= k
        R += k*N
        memo=R//Q
    else:
        Q -= 1
        R += N
        memo=R//Q

print(Q)

Buggy python submission (verdict: Time Limit Exceeded):
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder
'''
if Q>R :
    k=int((Q-R)//(1+N))
    k-=1
    Q -= k
    R += k*N
    '''
memo=0
while R%Q != 0:
    k= int(Q//(N+R//Q+1))   #max k:k*(N+R//Q)<Q-k
    #print(R,Q,R%Q,R//Q,k)
    while (R+k*N)//(Q-k) != memo:
        k -= 1
        #print(k,memo,(R+k*N)//(Q-k))
    if k > 0: # and (R+k*N)//(Q-k) == memo:
        Q -= k
        R += k*N
        memo=R//Q
    else:
        Q -= 1
        R += N
        memo=R//Q

print(Q)

Fixed submission:
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder
'''
if Q>R :
    k=int((Q-R)//(1+N))
    k-=1
    Q -= k
    R += k*N
    '''
memo=0
while R%Q != 0:
    k= int((Q-R%Q)//(N+R//Q+1))   #max k:k*(N+R//Q)<Q-k
    #print(R,Q,R%Q,R//Q,k)
    while (R+k*N)//(Q-k) > memo:
        k -= 1
        #print(k,memo,(R+k*N)//(Q-k))
    if k > 0:
        Q -= k
        R += k*N
        memo=R//Q
    else:
        Q -= 1
        R += N
        memo=R//Q

print(Q)

Buggy python submission (verdict: Time Limit Exceeded):
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder

while R%Q != 0:
    Q -= 1
    R += N

print(Q)

Fixed submission:
#a_1+a_2+...+a_N = M   Find greatest common divisor of a
N,M=map(int,input().split())

Q=M//N #Quotient
R=M%N  #Reminder
'''
if Q>R :
    k=int((Q-R)//(1+N))
    k-=1
    Q -= k
    R += k*N
    '''
memo=0
while R%Q != 0:
    k= int((Q-R%Q)//(N+R//Q+1))   #max k:k*(N+R//Q)<Q-k
    #print(R,Q,R%Q,R//Q,k)
    while (R+k*N)//(Q-k) > memo:
        k -= 1
        #print(k,memo,(R+k*N)//(Q-k))
    if k > 0:
        Q -= k
        R += k*N
        memo=R//Q
    else:
        Q -= 1
        R += N
        memo=R//Q

print(Q)
Buggy python submission (verdict: Runtime Error):
N,x=map(int,input().split())
l=list(map(int,input().split()))
ans=0
l.sort()

for n in range(N):
    if n!=N-1:
        if l[n]<x:
            x-=l[n]
            ans+=1
        elif l[n]==x:
            x-=l[n]
            ans+=1
            break
        else:
            break
    else:
        if l[n]==x:
            x-=l[n]
            ans+=1
        else:
            break

print(ans)

Fixed submission:
N=int(input())
n=list(map(int,str(N)))
for i in range(3):
    if n[i]==1:
        n[i]=9
    elif n[i]==9:
        n[i]=1
print(n[0]*100+n[1]*10+n[2])
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        if 0 not in x:
            x.insert(i,0)
            flag=1
        break

for i in range(len(x)):
        x[i]=abs(x[i])

ans=10**11

if flag==1:
    for k in range(zp+K-len(x)+1,min(zp,K)+1):
        ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )
else:
    for k in range(zp+K-len(x),min(zp,K)+1):
        ans=min( ans, x[zp-k]+ x[zp+K-k-1]+ min(x[zp-k],x[zp+K-k-1]) )

print(ans)

Fixed submission:
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0

ans=10**11
for i in range(0,len(x)-K+1):
    if x[i]*x[K-1+i] <0:
        anss=abs(x[i])+ abs(x[K-1+i])
        anss += min(abs(x[i]),abs(x[K-1+i]))
    else:
        anss=max(abs(x[i]), abs(x[K-1+i]))
    ans=min( ans, anss)

print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        if 0 not in x:
            x.insert(i,0)
        break
for i in range(len(x)):
    if x[i]<=0:
        x[i]=abs(x[i])

ans=10**11
for k in range(zp+K-len(x)+1,min(zp,K)+1):
    ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )

print(ans)

Fixed submission:
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0

ans=10**11
for i in range(0,len(x)-K+1):
    if x[i]*x[K-1+i] <0:
        anss=abs(x[i])+ abs(x[K-1+i])
        anss += min(abs(x[i]),abs(x[K-1+i]))
    else:
        anss=max(abs(x[i]), abs(x[K-1+i]))
    ans=min( ans, anss)

print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        x.insert(i,0)
        break
for i in range(len(x)):
    if x[i]<=0:
        x[i]=abs(x[i])

ans=10**11
for k in range(zp+K-len(x)+1,min(zp,K)+1):
    ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )

print(ans)

Fixed submission:
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0

ans=10**11
for i in range(0,len(x)-K+1):
    if x[i]*x[K-1+i] <0:
        anss=abs(x[i])+ abs(x[K-1+i])
        anss += min(abs(x[i]),abs(x[K-1+i]))
    else:
        anss=max(abs(x[i]), abs(x[K-1+i]))
    ans=min( ans, anss)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	if I[1]==N:
		C.append(I[0])
		D.append(I[1])
for b in B:
	for c in C:
		if b==c:
			print('POSSIBLE')
			exit()
print('IMPOSSIBLE')

Fixed submission:
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
for m in range(M):
	I=list(map(int,input().split()))
	A.append(I[0])
	B.append(I[1])
tA=[]
tB=[]
for i,x in enumerate(A):
	if x==1:
		tA.append(B[i])
for i,x in enumerate(B):
	if x==N:
		if A[i] in tA:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

Fixed submission:
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
for m in range(M):
	I=list(map(int,input().split()))
	A.append(I[0])
	B.append(I[1])
tA=[]
tB=[]
for i,x in enumerate(A):
	if x==1:
		tA.append(B[i])
for i,x in enumerate(B):
	if x==N:
		tB.append(A[i])
for a in tA:
	if a in tB:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')

Fixed submission:
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
for m in range(M):
	I=list(map(int,input().split()))
	A.append(I[0])
	B.append(I[1])
def DP(next,c):
	global N,A,B
	r=-1
	if c==3:
		return -1
	if c==2 and next==N:
		return 1
	for i,x in enumerate(A):
		if x==next:
			r=max(r,DP(B[i],c+1))
	for i,x in enumerate(B):
		if x==next:
			r=max(r,DP(A[i],c+1))
	return r

if DP(1,0)==1:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')

Fixed submission:
#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')