Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b = map(int,(input().split(",")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")

Fixed submission:
a, b = map(int,(input().split(" ")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b = map(int(input()))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")


Fixed submission:
a, b = map(int,(input().split(" ")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b = map(int(input()))
if a%2 == 1:
  if b%2 == 1:
  	print("Yes")
    else:
      print("No")
  else:
    print("No")


Fixed submission:
a, b = map(int,(input().split(" ")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b = map(int(input()))
if (a%2 * b%2) == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
a, b = map(int,(input().split(" ")))
if ((a%2) * (b%2)) != 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = input()
flag = True
s = []
w1 = input()
e = w1[-1]
for i in range(n-1):
  wi = input()
  if e != wi[-1]:
    flag = False
  
  e = wi[-1]
  
if flag:
  print("Yes")
  
else:
  print("No")

Fixed submission:
n = int(input())
flag = True
s = []
words = []
w1 = input()
words.append(w1)
e = w1[-1]

for i in range(n-1):
    wi = input()
    if e != wi[0]:
        flag = False
    for w in words:
        if w == wi:
            flag = False
    words.append(wi)
    e = wi[-1]


if flag:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x = sorted(x)

if N==1:
	print(abs(X-x[0]))
	exit()
print(gcd(*x))

Fixed submission:
import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x.sort()


mini = []
for i in range(len(x)-1):
	mini.append(x[i+1] - x[i])
print(reduce(fractions.gcd, mini))

Buggy python submission (verdict: Runtime Error):
import functools
import math

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


x = list(map(int,input().rstrip().split()))
x.append(X)

to = []
for i in range(len(x)-1):
	to.append(x[i+1] - x[i])

gcd = functools.reduce(math.gcd, to)
print(gcd)

Fixed submission:
import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x.sort()


mini = []
for i in range(len(x)-1):
	mini.append(x[i+1] - x[i])
print(reduce(fractions.gcd, mini))

Buggy python submission (verdict: Runtime Error):
import functools
import math

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


x = list(map(int,input().rstrip().split()))
x.append(X)
x = sorted(x)

to = []
for i in range(len(x)-1):
	to.append(x[i+1] - x[i])

gcd = functools.reduce(math.gcd, to)
print(gcd)

Fixed submission:
import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x.sort()


mini = []
for i in range(len(x)-1):
	mini.append(x[i+1] - x[i])
print(reduce(fractions.gcd, mini))

Buggy python submission (verdict: Runtime Error):
import functools
import math

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


x = list(map(int,input().rstrip().split()))
x.append(X)
x = sorted(x)
mini = x[1] - x[0]


to = []
for i in range(len(x)-1):
	to.append(x[i+1] - x[i])
	if mini > x[i+1] - x[i]:
		mini =  x[i+1] - x[i]
		

gcd = functools.reduce(math.gcd, to)
print(gcd)

Fixed submission:
import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x.sort()


mini = []
for i in range(len(x)-1):
	mini.append(x[i+1] - x[i])
print(reduce(fractions.gcd, mini))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

x,y = map(int,input().rstrip().split())


kk = [ i for i in itertools.product(range(1,x+1), repeat=3) if (i[0]+i[1])%y == 0 and (i[1]+i[2])%y == 0 and (i[2]+i[0])%y == 0]

print(len(kk))

Fixed submission:
N, K = map(int, input().split())
 
count1 = 0
count2 = 0
for a in range(1,N+1):
    if a%K == 0:
        count1 += 1
if K%2 == 0:
    for a in range(1,N+1):
        if a%K == K//2:
            count2 += 1
print(count1**3 + count2**3)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict

N, M = map(int, sys.stdin.readline().split())
E = defaultdict(list)

for _ in range(M):
    l, r, d = map(int, sys.stdin.readline().split())
    l -= 1
    r -= 1
    E[l].append((r, d))
    E[r].append((l, -d))

xs = [None] * N

def dfs(i, x):
    xs[i] = x
    mi, ma = x, x
    for j, d in E[i]:
        if xs[j] is None:
            res = dfs(j, x + d)
            if res is None:
                return None
            else:
                mi2, ma2 = res
                mi = min(mi2, mi)
                ma = max(ma2, ma)
        else:
            if xs[j] - x != d:
                return None
    return mi, ma

for i in range(N):
    if xs[i] is None:
        res = dfs(i, 0)
        if res is None:
            break
        else:
            mi, ma = res
            if ma - mi > 1e9:
                break
else:
    print('Yes')
    sys.exit()
print('No')


Fixed submission:
import sys
from collections import defaultdict

sys.setrecursionlimit(1000000)

N, M = map(int, sys.stdin.readline().split())
E = defaultdict(list)

for _ in range(M):
    l, r, d = map(int, sys.stdin.readline().split())
    l -= 1
    r -= 1
    E[l].append((r, d))
    E[r].append((l, -d))

xs = [None] * N

def dfs(i, x):
    xs[i] = x
    mi, ma = x, x
    for j, d in E[i]:
        if xs[j] is None:
            res = dfs(j, x + d)
            if res is None:
                return None
            else:
                mi2, ma2 = res
                mi = min(mi2, mi)
                ma = max(ma2, ma)
        else:
            if xs[j] - x != d:
                return None
    return mi, ma

for i in range(N):
    if xs[i] is None:
        res = dfs(i, 0)
        if res is None:
            break
        else:
            mi, ma = res
            if ma - mi > 1e9:
                break
else:
    print('Yes')
    sys.exit()
print('No')
Buggy python submission (verdict: Runtime Error):
import sys

a = []
for line in sys.stdin:
    a.append(int(line))
N = len(a)
count = 0
flag = True
for i in range(N):
    a_i = a[i]
    a_ii = a[i+1]
    if ai[-1] != a_ii[0]:
        flag = None
        break
    for j in range(i+1, N):
        if a[i] == a[j]:
            flag = None
            break
if flag:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(input())
flag = True
for j in range(N-1):
    a_i = a[j]
    a_ii = a[j+1]
    if a_i[-1] != a_ii[0]:
        flag = None
        break
    for k in range(j+1, N):
        if a[j] == a[k]:
            flag = None
            break
if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = list(map(int, input().split()))
ans = [i for i in range(A,B+1)]
res = []
for i in ans[:K]:
    res.append(i)
for i in ans[-K:]:
    res.append(i)
for i in sorted(list(set(res))):
    print(i)


Fixed submission:
A, B, K = list(map(int, input().split()))
ans = set() 
mi = max(B-K+1, A)
ma = min(A+K, B+1)
for i in range(A, ma):
    ans.add(i)
for i in range(mi, B+1):
    ans.add(i)
ans = list(ans)
for i in sorted(ans):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
def f(n, k):
    return 0.5*(n-k)*(n-k+1)

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

cnt = 0
for a in range(K, N+1):
    for b in range(K, a+1):
        if a <= 1 or b <= 1:
            continue
        if ((a%b) >= K):
            cnt += 1

cnt += f(N, K)
print(int(cnt))


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

cnt = 0
for b in range(1, N+1):
    p = N // b
    q = N % b
    cnt += max(b-K,0)*p + max(q+1-K,0)
if K == 0:
    cnt -= N
print(int(cnt))
Buggy python submission (verdict: Runtime Error):
H, W, D = list(map(int, input().split()))

dic = {}
for i in range(H):
    for j,v in enumerate(list(map(int, input().split()))):
        dic[v] = (i,j)

Q = int(input())

Qs = []
mi = 1000000
ma = 1
for i in range(Q):
    l,r = list(map(int, input().split()))
    Qs.append((l,r))
    mi = min(mi, l)
    ma = max(ma, r)

S = [0 for i in range(100000)]
acm = 0
pi, pj = dic[mi]
for i in range(mi, ma+D, D):
    x,y = dic[i]
    acm += abs(x-pi) + abs(y-pj)
    S[i] = acm
    pi,pj = x,y

for i in Qs:
    l,r = i
    print(S[r] - S[l])


Fixed submission:
H, W, D = list(map(int, input().split()))
 
dic = {}
for i in range(H):
    for j,v in enumerate(list(map(int, input().split()))):
        dic[v] = (i,j)
 
Q = int(input())
 
Qs = []
mi = 100000
ma = 1
for i in range(Q):
    l,r = list(map(int, input().split()))
    Qs.append((l,r))
    mi = min(mi, l)
    ma = max(ma, r)
 
S = [0 for i in range(100000)]
acm = 0
pi, pj = dic[mi]
for start in range(1, D+1):
    for i in range(start, ma+1, D):
        x,y = dic[i]
        acm += abs(x-pi) + abs(y-pj)
        S[i] = acm
        pi,pj = x,y

for i in Qs:
    l,r = i
    print(S[r] - S[l])

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

A = [[0 for i in range(W)] for j in range(H)]
dic = {}
for i in range(H):
    for j,v in enumerate(list(map(int, input().split()))):
        A[i][j] = v
        dic[v] = (i,j)

Q = int(input())

Qs = []
mi = 10000000
ma = 1
for i in range(Q):
    l,r = list(map(int, input().split()))
    Qs.append((l,r))
    mi = min(mi, l)
    ma = max(ma, r)

S = [0 for i in range(100000)]
acm = 0
pi, pj = dic[mi]
for i in range(mi, ma+D, D):
    x,y = dic[i]
    acm += abs(x-pi) + abs(y-pj)
    S[i] = acm
    pi,pj = x,y

for i in Qs:
    l,r = i
    print(S[r] - S[l])


Fixed submission:
H, W, D = list(map(int, input().split()))
 
dic = {}
for i in range(H):
    for j,v in enumerate(list(map(int, input().split()))):
        dic[v] = (i,j)
 
Q = int(input())
 
Qs = []
mi = 100000
ma = 1
for i in range(Q):
    l,r = list(map(int, input().split()))
    Qs.append((l,r))
    mi = min(mi, l)
    ma = max(ma, r)
 
S = [0 for i in range(100000)]
acm = 0
pi, pj = dic[mi]
for start in range(1, D+1):
    for i in range(start, ma+1, D):
        x,y = dic[i]
        acm += abs(x-pi) + abs(y-pj)
        S[i] = acm
        pi,pj = x,y

for i in Qs:
    l,r = i
    print(S[r] - S[l])
Buggy python submission (verdict: Runtime Error):
N = str(input())
ans = 0
for i in N:
    ans += int(i)
if (N % ans == 0):
    print('Yes')
else:
    print('No')


Fixed submission:
N = str(input())
ans = 0
for i in N:
    ans += int(i)
if (int(N) % ans == 0):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
 N = int(input())


 def fibn(a, b, k, n):
     if k < n:
         return fibn(b, a+b, k+1, n)
     else:
         return a+b

 print(fibn(2,1,2,N))


Fixed submission:
N = int(input())


def fibn(a, b, k, n):
    if k < n:
        return fibn(b, a+b, k+1, n)
    else:
        return a+b
if N == 1:
    print(1)
else:
    print(fibn(2,1,2,N))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
 
As = sorted(list(map(int, input().split())))
Bs = sorted(list(map(int, input().split())))
Cs = sorted(list(map(int, input().split())))
 
ans = 0
for c in Cs:
    i = bisect.bisect_left(Bs, c)
    for b in Bs[:i]:
        ans += bisect.bisect_left(As, b)
print(ans)

Fixed submission:
import bisect
N = int(input())

As = sorted(list(map(int, input().split())))
Bs = list(map(int, input().split()))
Cs = sorted(list(map(int, input().split())))

ans = 0
for b in Bs:
    a = bisect.bisect_left(As, b)
    c = bisect.bisect_right(Cs, b)
    ans += a * (N-c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())

As = sorted(list(map(int, input().split())))
Bs = sorted(list(map(int, input().split())))
Cs = sorted(list(map(int, input().split())))

ans = 0
for c in Cs:
    i = bisect.bisect_left(Bs, c)
    for b in Bs[:i]:
        ans += bisect.bisect_left(As, b)
print(ans)

Fixed submission:
import bisect
N = int(input())

As = sorted(list(map(int, input().split())))
Bs = list(map(int, input().split()))
Cs = sorted(list(map(int, input().split())))

ans = 0
for b in Bs:
    a = bisect.bisect_left(As, b)
    c = bisect.bisect_right(Cs, b)
    ans += a * (N-c)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

def match(a, b):
    for i in range(len(a)):
        if a[i] != '?' and b[i] != '?' and a[i] != b[i]:
            return False
    return True


Y=str(input())
T=str(input())
S = ''
if match(T,Y[-len(T):]):
    S = Y[:-len(T)] + T
    A = S.replace('?','a')
    print(A)
    sys.exit()
else:
    for i in range(len(Y) - len(T)):
        i += 1
        k = -(len(T)+i)
        if match(T, Y[k:-i]):
            S = Y[:k] + T + Y[-i:]
            A = S.replace('?','a')
            print(A)
            sys.exit()

print('UNRESTORABLE')

Fixed submission:
import sys

def match(a, b):
    for i in range(len(a)):
        if a[i] != '?' and b[i] != '?' and a[i] != b[i]:
            return False
    return True


Y=str(input())
T=str(input())
S = ''
if len(Y) < len(T):
    print('UNRESTORABLE')
    sys.exit()

if match(T,Y[-len(T):]):
    S = Y[:-len(T)] + T
    A = S.replace('?','a')
    print(A)
    sys.exit()
else:
    for i in range(len(Y) - len(T)):
        i += 1
        k = -(len(T)+i)
        if match(T, Y[k:-i]):
            S = Y[:k] + T + Y[-i:]
            A = S.replace('?','a')
            print(A)
            sys.exit()

print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
import sys
S = str(input())
i = 0
j = len(S) - 1
c = 0
while(True):
    if i == j:
        break
    if (S[i] == S[j]):
        i += 1
        j -= 1
    else:
        if (S[i] == 'x'):
            i += 1
            c += 1
        elif (S[j] == 'x'):
            j -= 1
            c += 1
        else:
            print('-1')
            sys.exit()
print(c)


Fixed submission:
import sys
S = str(input())
i = 0
j = len(S) - 1
c = 0
while(True):
    if i >= j:
        break
    if (S[i] == S[j]):
        i += 1
        j -= 1
    else:
        if (S[i] == 'x'):
            i += 1
            c += 1
        elif (S[j] == 'x'):
            j -= 1
            c += 1
        else:
            print('-1')
            sys.exit()
print(c)
Buggy python submission (verdict: Runtime Error):
def get_bomb_num(i, j):
    cnt = 0
    for p in range(-1,2):
        for s in range(-1,2):
            l = i + p
            m = j + s
----
            if (p == 0 and s == 0) or (l < 0) or (l >= H) or (m < 0) or (m >= W):
                continue--
            if b[l][m] == '#':
                cnt += 1
    return cnt

H,W = list(map(int, input().split()))
b =[]
for i in range(H):
    b.append(str(input()))

for i in range(H):
    for j in range(W):
        if b[i][j] == '#':
            print('#', end ='')
        else:
            print(get_bomb_num(i,j), end='')
    print('')

Fixed submission:
def get_bomb_num(i, j):
    cnt = 0
    for p in range(-1,2):
        for s in range(-1,2):
            l = i + p
            m = j + s
            if (p == 0 and s == 0) or (l < 0) or (l >= H) or (m < 0) or (m >= W):
                continue
            if b[l][m] == '#':
                cnt += 1
    return cnt

H,W = list(map(int, input().split()))
b =[]
for i in range(H):
    b.append(str(input()))

for i in range(H):
    for j in range(W):
        if b[i][j] == '#':
            print('#', end ='')
        else:
            print(get_bomb_num(i,j), end='')
    print('')
Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
for k in range(1, 100002):
    if k in d:
        c += d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)


Fixed submission:
X, t = list(map(int, input().split(' ')))
print(X - t if (X - t) >= 0 else 0)
Buggy python submission (verdict: Runtime Error):

N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
for k in range(1, 100002):
    if k in d:
        c += d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)


Fixed submission:
N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
keys = sorted(d.keys())
for k in keys:
    c = d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
keys = sorted(d.keys())
for k in keys:
    c = d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)
N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
for k in range(1, 100002):
    if k in d:
        c += d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)


Fixed submission:
N = int(input())
ls = list(map(int, input().split(' ')))
d = {}
for l in ls:
    if l in d:
        d[l] += 1
    else:
        d[l] = 1

m = 0
keys = sorted(d.keys())
for k in keys:
    c = d[k]
    if (k-1) in d:
        c += d[k-1]
    if (k+1) in d:
        c += d[k+1]
    m = max(m,c)
print(m)
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = list(map(int, input().split(' ')))

counter = {}

for i in l:
    if i in counter:
        counter[i] = counter[i] + 1
    else:
        counter[i] = 1

a = None
b = None
for k in sorted(counter.keys(), reverse=True):
    if counter[k] >= 4 and a == None and b == None:
        a , b = k
    elif counter[k] >= 2 and a == None:
        a = k
    elif counter[k] >= 2 and a != None:
        b = k
    if (a != None and b != None):
        break

if (a != None and b!= None):
    print(a * b)
else:
    print('0')



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

counter = {}

for i in l:
    if i in counter:
        counter[i] = counter[i] + 1
    else:
        counter[i] = 1

a = None
b = None
for k in sorted(counter.keys(), reverse=True):
    if counter[k] >= 4 and a == None and b == None:
        a = k
        b = k
    elif counter[k] >= 2 and a == None:
        a = k
    elif counter[k] >= 2 and a != None:
        b = k
    if (a != None and b != None):
        break

if (a != None and b!= None):
    print(a * b)
else:
    print('0')
Buggy python submission (verdict: Runtime Error):
ls = list(map(int, input().split()))
A = ls[0]
B = ls[1]
C = ls[2]
D = ls[3]

k = [ i for i in range(0,101) if A <= i <= B and C <= i <= D]
print(max(k) - min(k))


Fixed submission:
ls = list(map(int, input().split()))
A = ls[0]
B = ls[1]
C = ls[2]
D = ls[3]

k = [ i for i in range(0,101) if A <= i <= B and C <= i <= D]
if not k:
    print(0)
else:
    print(max(k) - min(k))

Buggy python submission (verdict: Runtime Error):
ls = list(map(int, input().split()))
A = ls[0]
B = ls[1]
C = ls[2]
D = ls[3]

k = [ i for i in range(0,101) if A <= i <= B and C <= i <= D]
print(max(k) - min(k))


Fixed submission:
ls = list(map(int, input().split()))
A = ls[0]
B = ls[1]
C = ls[2]
D = ls[3]

k = [ i for i in range(0,101) if A <= i <= B and C <= i <= D]
if not k:
    print(0)
else:
    print(max(k) - min(k))
Buggy python submission (verdict: Runtime Error):
 from functools import reduce

 def gcd(a, b):
     while b:
         a, b = b, a % b
     return a

 def lcm(a, b):
     return a * b / gcd(a,b)

 N = int(input())
 Ts = []
 for i in range(N):
     Ts.append(int(input()))

 c = 1
 for T in Ts:
     c = lcm(c, T)

 print(int(c))


Fixed submission:
from functools import reduce

#def gcd(a, b):
#    while b:
#        a, b = b, a % b
#    return a

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(a, b):
    return a * b // gcd(a,b)

N = int(input())
Ts = []
c = 1
for i in range(N):
    c = lcm(c, int(input()))

print(int(c))
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
ls = list(map(int, input().split()))
k = len(ls)
p = [ i for i in ls if (i%4) == 0]
j = [ i for i in ls if (i%4) != 0]
r = [ i for i in j if (i%2) == 0]

if(len(p) >= int(k/2)):
    print('Yes')
elif (len(p) >= (len(j) - len(r))):
    print('Yes')
else:
    print('No')
----

Fixed submission:
import sys

N = int(input())
ls = list(map(int, input().split()))
k = len(ls)
p = [ i for i in ls if (i%4) == 0]
j = [ i for i in ls if (i%4) != 0]
r = [ i for i in j if (i%2) == 0]

if(len(p) >= int(k/2)):
    print('Yes')
elif (len(p) >= (len(j) - len(r))):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
l = list(map(int, input().split(' ')))
N = l[0]
N_ = l[0] + 1
M = l[1]
y = []
u = []

for i in range(M):
    k = list(map(int, input().split()))
    a = k[0]
    b = k[1]
    if (a == 1):
        y.append(b)
    elif (b == N):
        u.append(a)

for i in y:
    if (i in u):
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')


Fixed submission:
import sys
l = list(map(int, input().split(' ')))
N = l[0]
N_ = l[0] + 1
M = l[1]
y = []
u = set()

for i in range(M):
    k = list(map(int, input().split()))
    a = k[0]
    b = k[1]
    if (a == 1):
        y.append(b)
    elif (b == N):
        u.add(a)

for i in y:
    if (i in u):
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):

 S = str(input())

 c = 0
 ma = 0
 for i in S:
     c = 0
     for k,j in enumerate(S):
         if ( k != 0 and k != len(S) and j != i and S[k-1] != a and S[k+1] != a):
             c += 1
     ma = min(ma, c)

 print(ma)



Fixed submission:
def check(s, S):
    for i in S:
        if (i != s):
            return True
    return False

S = str(input())
T = S

m = 1000
for s in S:
    num = 0
    T = S
    while (check(s, T)):
        num += 1
        K = []
        for i in range(0, len(T) - 1):
            if s == T[i+1]:
                K.append(T[i+1])
            else:
                K.append(T[i])
        T = K
    m = min(m, num)

print(m)

Buggy python submission (verdict: Runtime Error):

S = str(input())

c = 0
ma = 0
for i in S:
    c = 0
    for k,j in enumerate(S):
        if ( k != 0 and k != N-1 and j != i and S[k-1] != a and S[k+1] != a):
            c += 1
    ma = min(ma, c)

print(ma)




Fixed submission:
def check(s, S):
    for i in S:
        if (i != s):
            return True
    return False

S = str(input())
T = S

m = 1000
for s in S:
    num = 0
    T = S
    while (check(s, T)):
        num += 1
        K = []
        for i in range(0, len(T) - 1):
            if s == T[i+1]:
                K.append(T[i+1])
            else:
                K.append(T[i])
        T = K
    m = min(m, num)

print(m)
Buggy python submission (verdict: Runtime Error):
 nums = list(map(int, input().split()))
 t = nums[2]
 if (nums[0] <= t and nums[1] >= t):
     print('Yes')
 else:
     print('No')

Fixed submission:
nums = list(map(int, input().split()))
t = nums[2]
if (nums[0] <= t and nums[1] >= t):
    print('Yes')
else:
    print('No')