Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))

div_num = 998244353
result = 1
ct_l = []

for i in range(n):
    ct_l.append(0)

for item in l:
    ct_l[item] += 1

#print(ct_l)
prev_v = -1
curr_v = -1
e = n-1

for i, item in enumerate(ct_l):
    if i == 2:
        break
    if i == 0 and item == 1:
        pass
    else:
        e -= item
    if i == 1:
        prev_v = item

for i, item in enumerate(ct_l[2:]):
    #print(prev_v, item, e, result)
    e -= item
    if item == 0:
        break
    curr_v = item
    result *= prev_v**curr_v
    prev_v = curr_v
    #print(prev_v, curr_v, result)

if e < 0:
    print(0)
else:
    print(result%div_num)

Fixed submission:
n = int(input())
ct = 0

for i in range(1,int(n/2)+1):
    if i == n-i:
        continue
    ct += 1

print(ct)
Buggy python submission (verdict: Runtime Error):
n = int(input())

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n = int(n/i)
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

l = prime_decomposition(n)
l.append(1)
l.sort()
l.reverse()
a = 1
b = 1

for i in range(len(l)):
    if a <= b:
        a *= l[len(l)-1-i]
    else:
        b *= l[len(l)-1-i]

print(a+b-2)

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

if 1<= a <=9 and 1<= b <= 9:
    print(a*b)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0

for i in range(n):
    if i + 1 == n:
        break
    for j in range(i+1, n):
        for k in range(j+1, n):
            if l[i] + l[j] <= l[k]:
                break
            ans += 1
print(ans)

Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans_set = set()
ans = 0

for i in range(n):
    if i + 1 == n:
        break
    for j in range(i+1, n):
        ans += max(bisect.bisect_left(l, l[i]+l[j]) - j-1, 0)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans_set = set()

def is_triangle(a, b, c):
    if a < b + c and b < c + a and c < a + b:
        return True
    return False

for i in range(len(l)):
    for j in range(len(l)):
        for k in range(len(l)):
            if i == j or j == k or k == i:
                continue
            if is_triangle(l[i], l[j], l[k]):
                ans_set.add(frozenset([i, j, k]))

print(len(ans_set))

Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans_set = set()
ans = 0

for i in range(n):
    if i + 1 == n:
        break
    for j in range(i+1, n):
        ans += max(bisect.bisect_left(l, l[i]+l[j]) - j-1, 0)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans_set = set()

def is_triangle(a, b, c):
    if a < b + c and b < c + a and c < a + b:
        return True
    return False

for i, item1 in enumerate(l):
    for j, item2 in enumerate(l):
        for k, item3 in enumerate(l):
            if i == j or j == k or k == i:
                continue
            if is_triangle(item1, item2, item3):
                ans_set.add(frozenset([i, j, k]))

print(len(ans_set))

Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans_set = set()
ans = 0

for i in range(n):
    if i + 1 == n:
        break
    for j in range(i+1, n):
        ans += max(bisect.bisect_left(l, l[i]+l[j]) - j-1, 0)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s_list = []
for i in range(n):
    s_list.append(input())

s_dic = {}
max_num = 0
for i in range(n):
    if s_list[i] in s_dic:
        continue
    s_dic[s_list[i]] = s_list.count(s_list[i])
    if s_dic[s_list[i]] > max_num:
        max_num = s_dic[s_list[i]]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)


Fixed submission:
n = int(input())
max_num = 0
s_dic = {}
for i in range(n):
    input_line = input()
    if input_line in s_dic:
        s_dic[input_line] = s_dic[input_line] + 1
    else:
        s_dic[input_line] = 1
    if s_dic[input_line] > max_num:
        max_num = s_dic[input_line]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s_list = []
for i in range(n):
    s_list.append(input())

s_dic = {}
for i in range(n):
    if s_list[i] in s_dic:
        continue
    s_dic[s_list[i]] = s_list.count(s_list[i])

value_max = max(s_dic.values())
anser_list = []
for key,value in s_dic.items():
    if value == value_max:
        anser_list.append(key)

anser_list.sort()
for i in range(len(anser_list)):
    print(anser_list[i])



Fixed submission:
n = int(input())
max_num = 0
s_dic = {}
for i in range(n):
    input_line = input()
    if input_line in s_dic:
        s_dic[input_line] = s_dic[input_line] + 1
    else:
        s_dic[input_line] = 1
    if s_dic[input_line] > max_num:
        max_num = s_dic[input_line]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)
Buggy python submission (verdict: Runtime Error):
def main(a, b):
    if (a * b) % 2 == 0:
        print('Even')
    else:
        print('Odd')

a = int(input())
b = int(input())
main(a, b)


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

Buggy python submission (verdict: Runtime Error):
def main(a, b):
    if (a * b) % 2 == 0:
        print('Even')
    else:
        print(Odd)

a = int(input())
b = int(input())
main(a, b)

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

Buggy python submission (verdict: Runtime Error):
def calc(a, b):
    if (a * b) % 2 == 0:
        print('Even')
    else:
        print('Odd')
 
calc(a, b)

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
if __name__=="__main__":
    n = int(input())
    args = input().split()
    p = []
    for i in range(len(args)):
        p.append(int(args[i]))

    cnt = 1
    p_pre = [p[0]]
    for i in range(1,len(args)):
        p_pre.append(p[i])
        if p[i]==min(p_pre):
            cnt += 1

    print(cnt)

Fixed submission:
if __name__=="__main__":
    n = int(input())
    args = input().split()
    p = []
    for i in range(len(args)):
        p.append(int(args[i]))

    cnt = 1
    p_pre = [p[0]]
    min_p_pre = p[0]
    for i in range(1,len(args)):
        p_pre.append(p[i])
        min_p_pre = min(min_p_pre, p[i])
        if p[i] == min_p_pre:
            cnt += 1

    print(cnt)
Buggy python submission (verdict: Runtime Error):
if __name__=="__main__":
    n, m = map(int, input().split())
    p, s=[], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = 0
    cnt_ac = 0
    pfin = 0
    for i in range(m):
        if pfin < p[i]:
            if s[i]=="WA":  
                cnt_wa += 1
            else:
                cnt_ac += 1
                pfin = p[i]
                if pfin==n:
                    break
        
    print("{} {}".format(cnt_ac, cnt_wa))

Fixed submission:
abts = "abcdefghijklmnopqrstuvwxyz"
cin = str(input())
for i in range(len(abts)):
  if cin == abts[i]:
    print(abts[i+1])
Buggy python submission (verdict: Runtime Error):
print(sys.stdin)

Fixed submission:
if len(set(input().split())) == 2:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split(" ")

flag = False
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            flag = True
            break
    if flag:
        break

print('NO' if flag else 'YES')


Fixed submission:
n = int(input())
a = input().split(" ")

a.sort()
flag = False
for i in range(n-1):
    if a[i] == a[i+1]:
        flag = True
        break

print('NO' if flag else 'YES')
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().spllit())
if A - B * 2 < 0:
  print(0)
else:
  print(A - B * 2)

Fixed submission:
A,B = map(int,input().split())
ANS = A - B * 2
if ANS <= 0:
  print(0)
else:
  print(ANS)
Buggy python submission (verdict: Runtime Error):
arr = ['Sunny', 'Cloudy', 'Rainy']
in = input()
ind = (arr.index(in) + 1) % 3
print(arr[ind])


Fixed submission:
arr = ['Sunny', 'Cloudy', 'Rainy']
i = input()
ind = (arr.index(i) + 1) % 3
print(arr[ind])
Buggy python submission (verdict: Runtime Error):
import scipy.misc

N=int(input())
X=list(map(int,input().split()))
SX=sorted(X)
M=SX.pop()
MV=10**9
ANS=0
for x in SX:
  z = M - x
  if MV > z:
    MV = z
    ANS = x
print("{} {}".format(M,ANS))



Fixed submission:
from heapq import heapify, heappop, heappush, heappushpop

class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)
      
N,M=map(int,input().split())
L = list(map(lambda s:int(s) * -1,input().split()))
#print(L)
pq = PriorityQueue(L)
import math
for _ in range(M):
  m = pq.pop()
  #print(m)
  pq.push(math.ceil(m / 2))
ANS=0
for _ in range(N):
  k = pq.pop()
  #print(k)
  ANS += k
print(ANS * -1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
import numpy as np
x = np.arange(N+1)
print(np.sum(x)-N)

Fixed submission:
N=int(input())
print(N*(N+1)//2-N)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
print(sum(range(1,N+1))-N)

Fixed submission:
N=int(input())
print(N*(N+1)//2-N)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N=int(input())
L=list(itertools.permutations(map(int,input().split())))
ANS=-1
for l in L:
  TMP = l[0]
  for i in range(1, N):
    TMP = (l[i] + TMP) / 2.0
  if ANS <= TMP:
    ANS = TMP
print(ANS)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ANS = L[0]
for i in range(1, N):
  ANS = (L[i] + ANS) / 2.0
  
print(ANS)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N=int(input())
L=list(itertools.permutations(map(int,input().split())))
ANS=-1
for l in L:
  ll = list(l)
  TMP = ll[0]
  for i in range(1, N):
    TMP = (ll[i] + TMP) / 2.0
  if ANS <= TMP:
    ANS = TMP
print(ANS)


Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ANS = L[0]
for i in range(1, N):
  ANS = (L[i] + ANS) / 2.0
  
print(ANS)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
print(min(N*A),B)

Fixed submission:
N,A,B = map(int, input().split())
print(min(N*A,B))
Buggy python submission (verdict: Time Limit Exceeded):
M,N = map(int,input().split())
ans=set(range(1,M+1))
for s in range(N):
  S,Z = map(int,input().split())
  ans =  ans & set(range(S, Z+1))
print(len(ans))

Fixed submission:
M,N = map(int,input().split())
ans=set(range(1,M+1))
START=0
END=10**5
for s in range(N):
  S,Z = map(int,input().split())
  if START <= S:
    START = S
  if END >= Z:
    END = Z
ans = range(START,END+1)
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
M,N = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
Z=list(range(1,M+1))
ans = set(Z)
for s in L:
  k = set(range(s[0], s[1]+1))
  ans = ans & k
print(len(ans))

Fixed submission:
M,N = map(int,input().split())
ans=set(range(1,M+1))
START=0
END=10**5
for s in range(N):
  S,Z = map(int,input().split())
  if START <= S:
    START = S
  if END >= Z:
    END = Z
ans = range(START,END+1)
print(len(ans))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
print(S[0:K]+S[K].lower()+S[-K:])

Fixed submission:
N,K=map(int,input().split())
S=input()
K=K-1
print(S[0:K]+S[K].lower()+S[K+1:])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("Yes" if a == b and a == c "No")

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a == b and a == c else "No")
Buggy python submission (verdict: Runtime Error):
N=int(input)
if N == 1:
  print("Hello World")
else:
  print(str(int(input()) + int(input()))

Fixed submission:
N=int(input())
if N == 1:
  print("Hello World")
else:
  print(str(int(input()) + int(input())))
Buggy python submission (verdict: Runtime Error):
ANS='No'
S=input()
T=input()
N=len(S)
for i in range(S):
  if S[i:N] + S[:i] == T:
    ANS='Yes'
    break
print(ANS)

Fixed submission:
ANS='No'
S=input()
T=input()
N=len(S)
for i in range(N):
  if S[i:N] + S[:i] == T:
    ANS='Yes'
    break
print(ANS)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input.split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  TMP+=(K-1)
  ANS+=1
  if N <= K:
    break
print(ANS)


Fixed submission:
N,K=map(int,input().split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  while True:
    TMP+=(K-1)
    ANS+=1
    if N <= TMP:
      break
print(ANS)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input.split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  TMP=(K-1)
  ANS+=1
  if N <= K:
    break
print(ANS)


Fixed submission:
N,K=map(int,input().split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  while True:
    TMP+=(K-1)
    ANS+=1
    if N <= TMP:
      break
print(ANS)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input.split())
TMP=K
ANS=1
if N =< K:
  ANS=1
else:
  TMP=(K-1)
  ANS+=1
  if N <= K:
    break
print(ANS)


Fixed submission:
N,K=map(int,input().split())
TMP=K
ANS=1
if N <= K:
  ANS=1
else:
  while True:
    TMP+=(K-1)
    ANS+=1
    if N <= TMP:
      break
print(ANS)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
A=1
ANS=0
while A!=0:
  A = 0
  for i in range(N):
    if L[i] % 2 == 0 and A == 0:
      L[i] = L[i] // 2
      A = 1
      break
  if A != 0:
  	ANS += 1
print(ANS)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
A=1
ANS=IND=0
while A!=0:
  A = 0
  for i in range(IND, N):
    if L[i] % 2 == 0 and A == 0:
      L[i] = L[i] // 2
      A = 1
      break
    else:
      IND += 1
  if A != 0:
  	ANS += 1
print(ANS)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
A=1
ANS=0
while A!=0:
  A = 0
  for i in range(N):
    if L[i] % 2 == 0 and A == 0:
      L[i] = L[i] // 2
      A = 1
    else:
      L[i] *= 3
  if A != 0:
  	ANS += 1
print(ANS)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
A=1
ANS=IND=0
while A!=0:
  A = 0
  for i in range(IND, N):
    if L[i] % 2 == 0 and A == 0:
      L[i] = L[i] // 2
      A = 1
      break
    else:
      IND += 1
  if A != 0:
  	ANS += 1
print(ANS)
Buggy python submission (verdict: Runtime Error):
n=int(input())
m = int(pow(n,1/2)) + 1
k = 0
for i in range(m):
  fi n > pow(i,2):
    break
  else:
    k = pow(i,2)
print(k)

Fixed submission:
n=int(input())
m = int(pow(n,1/2)) + 1
k = 0
for i in range(n+1):
  if n < pow(i,2):
    break
  if k <= pow(i,2):
    k = pow(i,2)  
  for z in range(3,n):
    if n < pow(i,z):
      break
    elif k <= pow(i,z):
      k = pow(i,z)
 
print(k)
Buggy python submission (verdict: Time Limit Exceeded):
import scipy.misc

N=int(input())
X=list(map(int,input().split()))
SX=sorted(X)
M=SX.pop()
MV=0
ANS=0
for x in SX:
  if (M - x) in SX:
    continue
  else:
    cb = scipy.misc.comb(M,x)
    if MV < cb:
      MV = cb
      ANS = x
print("{} {}".format(M,ANS))



Fixed submission:
import scipy.misc

N=int(input())
X=list(map(int,input().split()))
SX=sorted(X)
M=SX.pop()
MV=10**9
ANS=0
for x in SX:
  z = abs(M - x - x)
  if MV > z:
    MV = z
    ANS = x
print("{} {}".format(M,ANS))

Buggy python submission (verdict: Time Limit Exceeded):
def cmb(n, r):
  if n - r < r: r = n - r
  if r == 0: return 1
  if r == 1: return n
  
  numerator = [n - r + k + 1 for k in range(r)]
  denominator = [k + 1 for k in range(r)]
  for p in range(2,r+1):
    pivot = denominator[p - 1]
    if pivot > 1:
      offset = (n - r) % p
      for k in range(p-1,r,p):
        numerator[k - offset] /= pivot
        denominator[k] /= pivot
        
  result = 1
  for k in range(r):
    if numerator[k] > 1:
      result *= int(numerator[k])
      
  return result


N=int(input())
X=list(map(int,input().split()))
SX=sorted(X)
M=SX.pop()
MV=0
ANS=0
for x in SX:
  if (M - x) in SX:
    continue
  else:
    cb = cmb(M,x)
    if MV < cb:
      MV = cb
      ANS = x
print("{} {}".format(M,ANS))



Fixed submission:
import scipy.misc

N=int(input())
X=list(map(int,input().split()))
SX=sorted(X)
M=SX.pop()
MV=10**9
ANS=0
for x in SX:
  z = abs(M - x - x)
  if MV > z:
    MV = z
    ANS = x
print("{} {}".format(M,ANS))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=list(range(a,b+1))
la= set(l[:k]) | set(l[-k:])
for i in (sorted(la)):
  print(i)

Fixed submission:
a,b,k=map(int,input().split())
if b-a < k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in list(range(a,a+k)) + list(range(b-k+1,b+1)):
    print(i)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=list(range(a,b+1))
la= set(l[:k]+l[-k:])
for i in (sorted(la)):
  print(i)

Fixed submission:
a,b,k=map(int,input().split())
if b-a < k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in list(range(a,a+k)) + list(range(b-k+1,b+1)):
    print(i)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=list(range(a,b+1))
la= set(l[:k]+l[-k:])
for i in (sorted(la)):
  print(i)

Fixed submission:
a,b,k=map(int,input().split())
if b-a < k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in list(range(a,a+k)) + list(range(b-k+1,b+1)):
    print(i)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=list(range(a,b+1))
la= set(l[:k]+l[-k:])
for i in (sorted(la)):
  print(i)

Fixed submission:
a,b,k=map(int,input().split())
if b-a < k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in list(range(a,a+k)) + list(range(b-k+1,b+1)):
    print(i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)

Fixed submission:
n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(len(M)):
  for j in range(i+1,len(M)):
    for k in range(j+1,len(M)):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
LL = [input() for x in range(n)]
LL = [x for x in LL if x[0] in ['M','A','R','C','H']]
import itertools
LL = list(itertools.combinations(LL, 3))
ANS = [x for x in LL if x[0][0] != x[1][0] and x[1][0] != x[2][0] and x[0][0] != x[2][0]]
print(len(ANS))

Fixed submission:
n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(len(M)):
  for j in range(i+1,len(M)):
    for k in range(j+1,len(M)):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)
Buggy python submission (verdict: Runtime Error):
iimport collections
N=int(input())
L=list(map(int,input().split()))
ANS=[0,0]
c = collections.Counter(L).most_common()
    
for k,v in c:
  if v <= 1:
    break
  if v >= 4:
    ANS.append(k)
    ANS.append(k)
  else:
    ANS.append(k)

Z=sorted(ANS)
print(Z[-1]*Z[-2])

Fixed submission:
import collections
N=int(input())
L=list(map(int,input().split()))
ANS=[0,0]
c = collections.Counter(L).most_common()
    
for k,v in c:
  if v <= 1:
    break
  if v >= 4:
    ANS.append(k)
    ANS.append(k)
  else:
    ANS.append(k)

Z=sorted(ANS)
print(Z[-1]*Z[-2])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
  if len(lst & fst) != 0:
    break
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')

Fixed submission:
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
c = []
d = []
for i in range(m): 
  r = list(map(int,input().split()))
  if r[0] == 1 or r[1] == n:
    c.append(r)
    if r[1] == n:
      d.append(r[0])
ans = [z for z in c if z[0] == 1 and z[1] in d ]
print('IMPOSSIBLE' if len(ans) == 0 else 'POSSIBLE')

Fixed submission:
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
c = []
d = []
for i in range(m): 
  r = list(map(int,input().split()))
  if r[0] == 1 or r[1] == n:
    c.append(r)
    if r[1] == n:
      d.append(r[0])
ans = [z for z in c if z[0] == 1 and z[1] in d ]
print('IMPOSSIBLE' if len(ans) == 0 else 'POSSIBLE')

Fixed submission:
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a = [list(map(int,input().split())) for i in range(m)]
c = [x for x in a if x[0] == 1 or x[1] == n]
d = [z[0] for z in c if z[1] == n ]
ans = [z for z in c if z[0] == 1 and z[1] in d ]
print('IMPOSSIBLE' if len(ans) == 0 else 'POSSIBLE')

Fixed submission:
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a = [list(map(int,input().split())) for i in range(m)]
c = [x for x in a if x[0] == 1 or x[1] == n]
d = [z[0] for z in c if z[1] == n ]
ans = [z for z in c if z[0] == 1 and z[1] in d ]
print('IMPOSSIBLE' if len(ans) == 0 else 'POSSIBLE')

Fixed submission:
n,m=map(int,input().split())
lst = set()
fst = set()
for i in range(m): 
  r = list(map(int,input().split()))
  if r[1] == n:
    lst.add(r[0])
  elif r[0] == 1:
    fst.add(r[1])
print('IMPOSSIBLE' if len(fst & lst) == 0 else 'POSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
j=1
for i in range(n,0,-1):
  j*=i
print(j if j <= 10**5 else j%((10**9)+7))

Fixed submission:
import math
n = int(input())
j=math.factorial(n)
print(j if j <= 10**5 else j%((10**9)+7))