Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2
    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = nums.index(x)
        if i < center:
            if is_even:
                print(nums[center])
            else:
                print(nums[center+1])
        else:
            if is_even:
                print(nums[center-1])
            else:
                print(nums[center+1])


if __name__ == '__main__':
    main()


Fixed submission:


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2

    dic = {}
    for i,x in enumerate(nums):
        if x not in dic:
            dic[x] = i

    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = dic[x]
        if is_even:
            if i < center:
                print(nums[center])
            else:
                print(nums[center-1])
        else:
            print(nums[center+1])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = list(set(X))
    lis = [-1]*200001

    for x in X:
        lis[x] += 1

    for x in X:
        if lis[x] < 1:
            ind = nums.index(x)
            edited = nums[:ind] + nums[ind+1:]
            
            print(edited[len(edited)//2])
        else:
            print(nums[len(nums)//2])



if __name__ == '__main__':
    main()


Fixed submission:


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2

    dic = {}
    for i,x in enumerate(nums):
        if x not in dic:
            dic[x] = i

    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = dic[x]
        if is_even:
            if i < center:
                print(nums[center])
            else:
                print(nums[center-1])
        else:
            print(nums[center+1])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):


def main():
    N = int(input())

    X = list(map(int, input().split(" ")))

    for i in range(len(X)):
        x = X[:i] + X[i+1:]
        x = sorted(x)

        print(x[len(x)//2])


if __name__ == '__main__':
    main()


Fixed submission:


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2

    dic = {}
    for i,x in enumerate(nums):
        if x not in dic:
            dic[x] = i

    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = dic[x]
        if is_even:
            if i < center:
                print(nums[center])
            else:
                print(nums[center-1])
        else:
            print(nums[center+1])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
l = raw_input().split()

N = int(l[0])
X = int(l[1])

acc = []

for i in range(N):
    acc.append(int(raw_input()))

acc.sort()
first, rest = acc[0], acc[1:]

priceAmt = reduce(lambda x,y: x+y ,rest)
rem = X - priceAmt

size = rem / first

print size + len(rest)


Fixed submission:
l = list(raw_input())

x1 = 100 if l[0] == "o" else 0
x2 = 100 if l[1] == "o" else 0
x3 = 100 if l[2] == "o" else 0

print 700+ x1 + x2 + x3

Buggy python submission (verdict: Runtime Error):
l = raw_input().split()

N = int(l[0])
X = int(l[1])

acc = []

for i in range(N):
    acc.append(int(raw_input()))
    print i

acc.sort()
first, rest = acc[0], acc[1:]

priceAmt = reduce(lambda x,y: x+y ,rest)
rem = X - priceAmt

size = rem / first

print size + len(rest)

Fixed submission:
l = list(raw_input())

x1 = 100 if l[0] == "o" else 0
x2 = 100 if l[1] == "o" else 0
x3 = 100 if l[2] == "o" else 0

print 700+ x1 + x2 + x3

Buggy python submission (verdict: Runtime Error):
def C(A,B,C,X,Y):
    both_price=min(A+B,C*2)
    A_price=min(A,C*2)
    B_price=min(B,C*2)

    both_num=min(X,Y)
    X_num=X-both_num
    Y_num=Y-both_num
    return both_price*both_num+X_num*A_price+Y_num*B_price

inp = sys.stdin.read().split()
inp=[int(i) for i in inp]
print(C(inp[0], inp[1], inp[2],inp[3],inp[4],inp[5]))

Fixed submission:
def main(func):
    ret=func(input())
    print(ret)


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

main(A)

Buggy python submission (verdict: Runtime Error):
def B(N,X,m):
    ret=0
    X-=sum(m)
    ret+=len(m)

    ret+=int(X/min(m))

    return ret

inp = sys.stdin.read().split()
inp=[int(i) for i in inp]
print(B(inp[0], inp[1], inp[2:]))

Fixed submission:
def main(func):
    ret=func(input())
    print(ret)


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

main(A)

Buggy python submission (verdict: Runtime Error):
def B(N,X,m):
    ret=0
    X-=sum(m)
    ret+=len(m)

    ret+=int(X/min(m))

    return ret

inp = input().split()
inp=[int(i) for i in inp]
print(B(inp[0], inp[1], inp[2:]))

Fixed submission:
def main(func):
    ret=func(input())
    print(ret)


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

main(A)

Buggy python submission (verdict: Runtime Error):
def B(N,X,m):
    ret=0
    X-=sum(m)
    ret+=len(m)
    
    ret+=int(X/min(m))
    
    return ret

inp=input().split()
print(B(inp[0],inp[1],inp[2:]))


Fixed submission:
def main(func):
    ret=func(input())
    print(ret)


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

main(A)
Buggy python submission (verdict: Runtime Error):
def C(A,B,C,X,Y):
    both_price=min(A+B,C*2)
    A_price=min(A,C*2)
    B_price=min(B,C*2)
 
    both_num=min(X,Y)
    X_num=X-both_num
    Y_num=Y-both_num
    return both_price*both_num+X_num*A_price+Y_num*B_price
 
inp = sys.stdin.read().split()
inp=[int(i) for i in inp]
print(C(inp[0], inp[1], inp[2],inp[3],inp[4],inp[5]))

Fixed submission:
def parse_input(raw,format):
    raw=raw.split()
    format=format.split()

    ret={}
    rawpos=0
    for f in format:
        pass


def A(S):
    ret=700
    ret+=S.count("o")*100
    return ret

def B(N,X,m):
    ret=0
    X-=sum(m)
    ret+=len(m)

    ret+=int(X/min(m))

    return ret

def C(A,B,C,X,Y):
    both_price=min(A+B,C*2)
    A_price=min(A,C*2)
    B_price=min(B,C*2)

    both_num=min(X,Y)
    X_num=X-both_num
    Y_num=Y-both_num
    return both_price*both_num+X_num*A_price+Y_num*B_price

import sys

inp = sys.stdin.read().split()
inp=[int(i) for i in inp]
print(C(inp[0], inp[1], inp[2],inp[3],inp[4]))
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    red = []
    for i in range(N):
        x,y = [int(i) for i in input().split()]
        red.append([x,y])
    blue = []
    for i in range(N):
        x,y = [int(i) for i in input().split()]
        blue.append([x,y])
    red.sort(reverse=True)
    blue.sort(reverse=True)
    #print(red)
    #print(blue)
    pair = 0
    for a in range(N):
        flag = False
        for i in range(N):
            for j in range(N):
                if(red[i][0] <= blue[j][0] and red[i][1] <= blue[j][1]):
                    pair = pair + 1
                    flag = True
                    #print(f'{red[i]} {blue[j]}')
                    blue[j][0] = -10000000000
                    blue[j][1] = -10000000000
                    break
                
        if flag:
            break
    print(pair)
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    A,B,C =list(map(int,input().split()))
    if(C <=(A+B)):
        print("Yes")
    else:
        print("No")



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    N,M =list(map( int,input().split()))
    arr = [[1 for i in range(N+2)] for j in range(M+3)]
    ans = 0
    
    for y in range(1,N+1):
        for x in range(1,M+1):
                arr[x][y] = 0 if arr[x][y] else 1 
                arr[x-1][y] = 0 if arr[x-1][y] else 1 
                arr[x][y-1] = 0 if arr[x][y-1] else 1 
                arr[x-1][y-1] = 0 if arr[x-1][y-1] else 1 
                arr[x+1][y] = 0 if arr[x+1][y] else 1 
                arr[x][y+1] = 0 if arr[x][y+1] else 1 
                arr[x+1][y+1] = 0 if arr[x+1][y+1] else 1
                arr[x+1][y-1] = 0 if arr[x+1][y-1] else 1
                arr[x-1][y+1] = 0 if arr[x-1][y+1] else 1
                
    
    for y in range(1,N+1):
        for x in range(1,M+1):
            if arr[x][y] == 0:
                ans = ans + 1

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
N,M = list(map(int,input().split()))
ans = (N-2)*(M-2)
if N == 1 and M == 1:
    ans = 1
elif M == 1:
    ans = abs(N - 2)
print(abs(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from pprint import pprint
def uragaesi(x,y):
    global arr
    arr[x][y] = 0 if arr[x][y] else 1 
    arr[x-1][y] = 0 if arr[x-1][y] else 1 
    arr[x][y-1] = 0 if arr[x][y-1] else 1 
    arr[x-1][y-1] = 0 if arr[x-1][y-1] else 1 
    arr[x+1][y] = 0 if arr[x+1][y] else 1 
    arr[x][y+1] = 0 if arr[x][y+1] else 1 
    arr[x+1][y+1] = 0 if arr[x+1][y+1] else 1
    
def main():
    N,M =list(map( int,input().split()))
    arr = [[1 for i in range(N+2)] for j in range(M+3)]
    ans = 0
    
    for y in range(1,N+1):
        for x in range(1,M+1):
                arr[x][y] = 0 if arr[x][y] else 1 
                arr[x-1][y] = 0 if arr[x-1][y] else 1 
                arr[x][y-1] = 0 if arr[x][y-1] else 1 
                arr[x-1][y-1] = 0 if arr[x-1][y-1] else 1 
                arr[x+1][y] = 0 if arr[x+1][y] else 1 
                arr[x][y+1] = 0 if arr[x][y+1] else 1 
                arr[x+1][y+1] = 0 if arr[x+1][y+1] else 1
                arr[x+1][y-1] = 0 if arr[x+1][y-1] else 1
                arr[x-1][y+1] = 0 if arr[x-1][y+1] else 1
                
    
    for y in range(1,N+1):
        for x in range(1,M+1):
            if arr[x][y] == 0:
                ans = ans + 1

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
N,M = list(map(int,input().split()))
ans = (N-2)*(M-2)
if N == 1 and M == 1:
    ans = 1
elif M == 1:
    ans = abs(N - 2)
print(abs(ans))
Buggy python submission (verdict: Runtime Error):
import time

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(N == 0):
        print(2)
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()


Fixed submission:
import time
import sys

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()

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

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    print(fib(int(N)+1))

if __name__ == '__main__':
    main()


Fixed submission:
import time
import sys

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()

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

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

a = input()
print(fib(int(a)+1))


Fixed submission:
import time
import sys

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()

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

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

a = input()
print(fib(int(a)+1))


Fixed submission:
import time
import sys

def fib(n):
    memo = [0] * n
    memo[0:2] = [2, 1]
    for i in range(2, n):
        memo[i] = memo[i - 1] + memo[i - 2]
    return memo[i]

def main():
    N = input()
    if(int(N) == 0):
        print(2)
        sys.exit()
    elif(int(N) == 1):
        print(1)
        sys.exit()
    else:
        print(fib(int(N)+1))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = input()
a = [input() for i in range(N)]
l = map(int, a[1].split())
m = map(int, a[2].split())
if a[0] == 1:
  t = l[0] + l[1]
  print(p)
else:
  f = a[0]
  t = 0
  for i in range(len(f-1)):
    t = t + l[i]
  t = t + m[f-1] + m[f]
  print(t)

Fixed submission:
import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)

Buggy python submission (verdict: Runtime Error):
N = input()
a = [input() for i in range(N)]
 
l = map(int, a[1].split())
m = map(int, a[2].split())
 
if a[0] == 1:
  t = l[0] + l[1]
  print(p)
  
else:
  f = a[0]
  t = 0
  for i in range(len(f-1)):
    t = t + l[i]
  t = t + m[f-1] + m[f]
  print(t)

Fixed submission:
import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)

Buggy python submission (verdict: Runtime Error):
N = input()
a = [input() for i in range(N)]

q = a[0] - a[1]
p = q % a[2]

print(p)

Fixed submission:
import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)

Buggy python submission (verdict: Runtime Error):
N = input()
a = [input() for i in range(N)]

q = a[2] - a[0]
p = q % a[1]

print(p)

Fixed submission:
import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)

Buggy python submission (verdict: Runtime Error):
N = input()
a = []
for i in range(N):
    a.append(input())

#a[0] + a[1]*x < a[2]

test = a[2] - a[0]

p = test % a[1]

print(p)

Fixed submission:
import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)
Buggy python submission (verdict: Runtime Error):
t = input().split())

if t[0] == t[1]:
    print(t[2])
elif t[0] == t[2]:
    print(t[1])
else:
    print(t[0])

Fixed submission:
A,B,C = map(int,input().split())
if A == B: print(C)
elif B == C: print(A)
else: print(B)

Buggy python submission (verdict: Runtime Error):
if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)

Fixed submission:
A,B,C = map(int,input().split())
if A == B: print(C)
elif B == C: print(A)
else: print(B)
Buggy python submission (verdict: Runtime Error):
N, A = map(int,input().split())
t=N**2-A
print(t)

Fixed submission:
N = int(input())
A = int(input())
t=N**2-A
print(t)

Buggy python submission (verdict: Runtime Error):
N, A = map(int,input().split())
t=N^2-A
print(t)

Fixed submission:
N = int(input())
A = int(input())
t=N**2-A
print(t)
Buggy python submission (verdict: Runtime Error):
X,t=map(int,input().split())
print(max(X-t,0)

Fixed submission:
X,t=map(int,input().split())
print(max(X-t,0))

Buggy python submission (verdict: Runtime Error):
X,t=map(int,input().split())
print(max(X-t, 0)

Fixed submission:
X,t=map(int,input().split())
print(max(X-t,0))

Buggy python submission (verdict: Runtime Error):
n = input().split(" ")
print(int(n[0])-int(n[t])

Fixed submission:
X,t=map(int,input().split())
print(max(X-t,0))
Buggy python submission (verdict: Runtime Error):
s = input()
n, x = map(int, s.sprit())
a = []
total = 0
for i in range(n):
  b = int( input() )
  a.append(b)
  total += b

x-=b
ans  = n
ans += x / n

print(ans)

Fixed submission:
check = 700
s = input()
for t in s:
  if t == 'o':
    check += 100

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

A = []
B = []
for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())


for i in range(N-M):
    x = A[i].find(B[0])
    if x != -1:
        result = True
        break
    result = False

for j in range(1,M):
    if (j >= M or j >= N ):
        result = False
        break
    idx = A[j][x:].find(B[j])
    if idx != x:
        result = False
        break

if result == True:
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
if __name__ == '__main__':

    N,M = map(int, input().split())

    A = []
    B = []
    for i in range(N):
        A.append(input())
    for i in range(M):
        B.append(input())

    char = B[0][0]
    matc = False
    for i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == char:
                matc = True
                for k in range(M):
                    for l in range(M):
                        if A[i+k][j+l] == B[k][l]:
                            matc = True
                        else:
                            matc = False
                            break
                    if not matc:
                        break
                if matc == True:
                    print("Yes")
                    sys.exit(0)

    if matc == True:
        print("Yes")
    else:
        print("No")

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

A = []
B = []
for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())


for i in range(N-M):
    x = A[i].find(B[0])
    if x != -1:
        result = True
        break
    result = False

for j in range(1,M):
    idx = A[j][x:].find(B[j])
    if idx != x:
        result = False
        break

if result == True:
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
if __name__ == '__main__':

    N,M = map(int, input().split())

    A = []
    B = []
    for i in range(N):
        A.append(input())
    for i in range(M):
        B.append(input())

    char = B[0][0]
    matc = False
    for i in range(N-M+1):
        for j in range(N-M+1):
            if A[i][j] == char:
                matc = True
                for k in range(M):
                    for l in range(M):
                        if A[i+k][j+l] == B[k][l]:
                            matc = True
                        else:
                            matc = False
                            break
                    if not matc:
                        break
                if matc == True:
                    print("Yes")
                    sys.exit(0)

    if matc == True:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
                                                                                                                           
result = 0
for q in range(k, n):
  for b in range(q+1, n+1):
    result += int((n-q)/b)+1 if q > 0 else int((n-q)/b)

print(result)

Fixed submission:
print("{}{}{}".format(input()[0], input()[1], input()[2]))
Buggy python submission (verdict: Time Limit Exceeded):
h, w, d = list(map(int, input().split()))

a_dict = {}
for i in range(h):
  r = list(map(int, input().split()))
  for j in range(w):
    a_dict[r[j]] = [i+1, j+1]

q = int(input())

test = [list(map(int, input().split())) for i in range(q)]

for t in test:
  power = 0
  for i in range((t[1]-t[0])//d):
    current = a_dict[t[0]+i*d]
    _next = a_dict[t[0]+(i+1)*d]
    power += abs(current[0] - _next[0]) + abs(current[1] - _next[1])
  print(power) 

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

a_dict = {}
for i in range(h):
  r = list(map(int, input().split()))
  for j in range(w):
    a_dict[r[j]] = [i+1, j+1]

q = int(input())

need_power = {}

for i in range(1, h*w+1):
  if i <= d:
    need_power[i] = 0
    continue

  need_power[i] = need_power[i-d] + abs(a_dict[i][0] - a_dict[i-d][0]) + abs(a_dict[i][1] - a_dict[i-d][1])

test = [list(map(int, input().split())) for i in range(q)]

for t in test:                                                                                                             
  print(need_power[t[1]] - need_power[t[0]])
Buggy python submission (verdict: Runtime Error):
# coding:utf-8

K, A, B = map(int, raw_input().split())
n=0

if A <= B:
    print '-1'
else:
    for i in range(K+1):
        if (A*(n+2)-B*(n+1))>K and (A*(n+1)-B*n)<K:
            print 2*n+3
        n+=1

Fixed submission:
# coding:utf-8

K, A, B = map(int, raw_input().split())
if K <=A:
    print 1

elif A <= B:
    print -1
else:
    x = (K-B-1)/(A-B)+1
    print 2*x-1
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools

N = input()

A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())


for i, j, k in itertools.product(range(N), range(N), range(N)):
    if A[i]<B[j]<C[k]:
            count+=1
    else:
        continue
print count


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

C1=raw_input()
C2=raw_input()

if C1[0]!=C2[2]:
    print 'NO'
elif C1[1]!=C2[1]:
    print 'NO'
elif C1[2]!=C2[0]:
    print 'NO'
else:
    print 'YES'

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

C1=raw_input()
C2=raw_input()

if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print 'YES'
else:
    print 'NO

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

C1=raw_input()
C2=raw_input()

if C1[0]!=C2[2]:
    print 'NO'
elif C1[1]!=C2[1]:
    print 'NO'
elif C1[2]!=C2[0]:
    print 'NO'
else:
    print 'YES'
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = input()

for i in range(N):
    if i*i > N:
        print (i-1)*(i-1)
        break
else:
    pass

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
import math

N = input()

sq = np.sqrt(N)
s = int(math.floor(sq))
print s*s
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
    a.append(map(int, raw_input().split()))

s1=set()
s2=set()
for i in xrange(M):
    if a[i][0]==1:
        s1.add(a[i][1])
    if a[i][1]==N:
        s2.add(a[i][0])
if s1 & s2:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'

else:
 print 'IMPOSSIBLE'

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

N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
    a.append(map(int, raw_input().split()))

s1=set()
s2=set()
for i in xrange(M):
    if a[i][0]==1:
        s1.add(a[i][1])
    if a[i][1]==N:
        s2.add(a[i][0])
if s1 & s2:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'
Buggy python submission (verdict: Runtime Error):
x = input().split()

print(min(x[0], x[1])+min(x[2],x[3]))

Fixed submission:
x = []
count = 0

while count<4:
  n = input()
  x.append(n)
  count = count + 1

out = min(int(x[0]),int(x[1]))+min(int(x[2]),int(x[3]))

print(out)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))


mid_dis = [abs(a[n-1] / 2 - a[i]) for i in range(n-1)]
arg_max_i = [i for i in range(n-1) if mid_dis[i] == min(mid_dis)][0]

print(a[n-1], a[arg_max_i])

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

if (A <= X) and (X <= A+B):
  res = "YES"
else:
  res = "NO"

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median

N = int(input())
X = list(map(int, input().split()))

for i in range(N):
  tmp_X = [X[j] for j in range(N) if j != i]
  #print(tmp_X)
  print(median(tmp_X))

Fixed submission:
from statistics import median

N = int(input())
X = list(map(int, input().split()))

X_sorted = sorted(X)
X_med = median(X)
for i in range(N):
  if X[i] < X_med:
    res = X_sorted[N // 2]
  elif X_med < X[i]:
    res = X_sorted[N // 2 - 1]
  else:
    res = X[i]

  print(res)