Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]
second = []
flag = False
for x in range(M):
    if ab[x][0] == 1:
        second.append(ab[x][1])

for y in range(len(second)):
    for z in range(M):
        if ab[z][0] == second[y] and ab[z][1] == N:
            flag = True
if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]
start = []
goal = []
flag = False
for x in range(M):
    if ab[x][0] == 1:
        start.append(ab[x][1])

    if ab[x][1] == N:
        goal.append(ab[x][0])

start_goal = set(start) & set(goal)

if start_goal:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
import itertools


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

if (N == 1 and A != B) or (B < A):
    print(0)
    exit()

combi = list(itertools.combinations_with_replacement(
    range(A, B + 1, 1), N - (B - A)))


sum_array = []
for x in combi:
    sumX = A + sum(x) + B
    sum_array.append(sumX)
print(len(set(sum_array)))


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

if (N == 1 and A != B) or (B < A):
    print(0)
else:
    print((B - A) * (N - 2) + 1)

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


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

if N == 1 and A != B:
    print(0)
    exit()

combi = list(itertools.combinations_with_replacement(
    range(A, B + 1, 1), N - (B - A)))


sum_array = []
for x in combi:
    sumX = A + sum(x) + B
    sum_array.append(sumX)
print(len(set(sum_array)))


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

if (N == 1 and A != B) or (B < A):
    print(0)
else:
    print((B - A) * (N - 2) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    tmp = As[i] * (sum(As[i+1:]) % MOD)
    result += tmp
    result %= MOD

print(result)



Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    tmp = As[i] * (sum(As[i+1:]) % MOD)
    result += tmp
    result %= MOD

print(result)



Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    tmp = As[i] * sum(As[i+1:])
    result += tmp
    result %= MOD

print(result)



Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    tmp = As[i] * sum(As[i+1:])
    result += tmp

result %= MOD

print(result)



Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    tmp = As[i] * sum(As[i+1:])
    tmp %= MOD
    result = (result+tmp) % MOD

print(result)



Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

for i in range(len(As)-1):
    for j in range(i+1, len(As)):
        tmp = As[i] * As[j]
        tmp %= MOD
        result = (result+tmp) % MOD

print(result)


Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

result = 0
MOD = 10**9+7

S = sum(As)

for i in range(len(As)-1):
    S -= As[i]
    tmp = As[i] * S
    result += tmp
    result %= MOD

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

multi = 1
pre_multi = 1

for i in range(len(As)):
    multi *= As[i]
    if i >= K-1:
        multi /= As[i-K]
    if i >= K:
        if multi > pre_multi:
            print("Yes")
        else:
            print("No")

    pre_multi = multi



Fixed submission:
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

for i in range(len(As)):
    if i >= K:
        if As[i] > As[i-K]:
            print("Yes")
        else:
            print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

multi = 1
pre_multi = 1

for i in range(len(As)):
    multi *= As[i]
    if i >= K-1:
        multi /= As[i-K]
    if i >= K:
        if multi > pre_multi:
            print("Yes")
        else:
            print("No")

    pre_multi = multi



Fixed submission:
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

for i in range(len(As)):
    if i >= K:
        if As[i] > As[i-K]:
            print("Yes")
        else:
            print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

LIMIT = 10**18

# result = np.prod(As)
#
# if result > LIMIT:
#     print(-1)
# else:
#     print(result)

result = 1
for a in As:
    result *= a
    # if result > LIMIT:
    #     result = -1
    #     break

if result > LIMIT:
    print(-1)
else:
    print(result)


Fixed submission:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))

LIMIT = 10**18

if 0 in set(As):
    print(0)
else:
    result = 1
    for a in As:
        result *= a
        if result > LIMIT:
            result = -1
            break
    
    print(result)
Buggy python submission (verdict: Runtime Error):
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

visited = set()
visited_list = []
index = 0
visited.add(index)
visited_list.append(0)
count = 0
flag = False
for i in range(K):
    index = As[index] - 1
    count += 1
    if index in visited:
        flag = True
        break
    visited.add(index)
    visited_list.append(index)

temp_index = visited_list.index(index)
count = count - temp_index

if flag:
    K %= count-temp_index
    for i in range(K):
        index = As[index] - 1

print(index+1)


Fixed submission:
N, K = map(lambda x: int(x), input().split(" "))
As = list(map(lambda x: int(x), input().split(" ")))

visited = set()
visited_list = []
index = 0
visited.add(index)
visited_list.append(0)
count = 0
flag = False
for i in range(K):
    index = As[index] - 1
    count += 1
    if index in visited:
        flag = True
        break
    visited.add(index)
    visited_list.append(index)

temp_index = visited_list.index(index)
K -= count
count = count - temp_index

if flag:
    K %= count
    for i in range(K):
        index = As[index] - 1

print(index+1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

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


K = int(input())
result = 0

temp = []

for i in range(1, K+1):
    for j in range(1, K+1):
        temp.append(gcd(i, j))

for k in range(1, K+1):
    for t in temp:
        add = gcd(t, k)
        result += add

print(result)


Fixed submission:
import math
from functools import reduce

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


K = int(input())
result = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            add = gcd(i, j, k)
            result += add

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

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


K = int(input())
result = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            add = gcd(i, j, k)
            result += add

print(result)


Fixed submission:
import math
from functools import reduce

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


K = int(input())
result = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            add = gcd(i, j, k)
            result += add

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

is_reversed = False

for _ in range(Q):
    q = input().split(" ")
    if q[0] == "1":
        is_reversed = not is_reversed
    else:
        if q[1] == "1":
            if is_reversed:
                S += q[2]
            else:
                S = q[2] + S
        else:
            if is_reversed:
                S = q[2] + S
            else:
                S += q[2]
            
if is_reversed:
    S = ''.join(list(reversed(S)))

print(S)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

is_reversed = False

S = deque(S)

for _ in range(Q):
    q = input().split(" ")
    if q[0] == "1":
        is_reversed = not is_reversed
    else:
        if q[1] == "1":
            if is_reversed:
                S.append(q[2])
            else:
                S.appendleft(q[2])
        else:
            if is_reversed:
                S.appendleft(q[2])
            else:
                S.append(q[2])

S = list(S)
if is_reversed:
    S = ''.join(list(reversed(S)))
else:
    S = ''.join((S))

print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for _ in range(Q):
    q = input().split(" ")
    if q[0] == "1":
        S = ''.join(list(reversed(S)))
    else:
        if q[1] == "1":
            S = q[2] + S
        else:
            S += q[2]

print(S)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

is_reversed = False

S = deque(S)

for _ in range(Q):
    q = input().split(" ")
    if q[0] == "1":
        is_reversed = not is_reversed
    else:
        if q[1] == "1":
            if is_reversed:
                S.append(q[2])
            else:
                S.appendleft(q[2])
        else:
            if is_reversed:
                S.appendleft(q[2])
            else:
                S.append(q[2])

S = list(S)
if is_reversed:
    S = ''.join(list(reversed(S)))
else:
    S = ''.join((S))

print(S)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))

result = 0
expected_list = []
for p in Ps:
    temp = (p * (p + 1) / 2 )/ p
    expected_list.append(temp)

for i in range(n-k+1):
    temp = expected_list[i:i+k]
    temp = sum(temp)
    result = max(result, temp)

print(result)

Fixed submission:
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))

result = 0
expected_list = []
temp_result = 0
for i, p in enumerate(Ps):
    temp = (p * (p + 1) / 2 )/ p
    expected_list.append(temp)
    temp_result += temp
    if i+1 >= k:
        result = max(result, temp_result)
        temp_result -= expected_list[i-k+1]

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))

result = 0
expected_list = []
for p in Ps:
    temp = sum(range(1, p+1)) / p
    expected_list.append(temp)

for i in range(n-k+1):
    temp = expected_list[i:i+k]
    temp = sum(temp)
    result = max(result, temp)

print(result)

Fixed submission:
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))

result = 0
expected_list = []
temp_result = 0
for i, p in enumerate(Ps):
    temp = (p * (p + 1) / 2 )/ p
    expected_list.append(temp)
    temp_result += temp
    if i+1 >= k:
        result = max(result, temp_result)
        temp_result -= expected_list[i-k+1]

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

result = 0
for i in range(N):
    result += i

print(result)


Fixed submission:
N = int(input())

n = N - 1
result = 0

if n != 0:
    result = n * (n+1) // 2

print(result)

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

result = 0
for i in range(N):
    result += i

print(result)


Fixed submission:
N = int(input())

n = N - 1
result = 0

if n != 0:
    result = n * (n+1) // 2

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(0,n):
  ans*=A[i]
if ans>10**18:
  print(-1)
  exit()
print(ans)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(n):
  if A[i]==0:
    print(0)
    exit()
for i in range(n):
  if len(str(A[i]))>19:
    print(-1)
    exit()
  ans*=A[i]
  if ans>10**18:
    print(-1)
    exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(0,n):
  ans*=A[i]
if ans>10**18:
  print(-1)
  exit()
print(ans)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(n):
  if A[i]==0:
    print(0)
    exit()
for i in range(n):
  if len(str(A[i]))>19:
    print(-1)
    exit()
  ans*=A[i]
  if ans>10**18:
    print(-1)
    exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = list(map(decimal.Decimal,input().split()))
y*=100
print(math.floor((x*y)/100))


Fixed submission:
import math
import decimal
x,y = list(map(decimal.Decimal,input().split()))
print(math.floor(x*y))

Buggy python submission (verdict: Runtime Error):
x,y = list(map(decimal.Decimal,input().split()))
y*=100
print(math.floor(x*y/100))


Fixed submission:
import math
import decimal
x,y = list(map(decimal.Decimal,input().split()))
print(math.floor(x*y))

Buggy python submission (verdict: Runtime Error):
import decimal
a,b=list(map(int,input().split()))
x = decimal.Decimal(a)
y = decimal.Decimal(b)
print(x*y)


Fixed submission:
import math
import decimal
x,y = list(map(decimal.Decimal,input().split()))
print(math.floor(x*y))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy
n,m=list(map(int,input().split()))
A=[0]*m
B=[0]*m
ans=[0]*n
for i in range(m):
  A[i],B[i]=list(map(int,input().split()))
C=A.copy()
C.extend(B)
root=1
R=[]
for room in range(1,n+1):
  L= [j for j,k in enumerate(B) if k==root]
  if L==[]:
    exit()
  for l in L:
    if ans[B[l]]0=0:
      ans[B[l]]=root
 	  R.append(B[l])
    
print(A,B)

Fixed submission:
import numpy as np
a,b,h,m=list(map(int,input().split()))
ta=(60*h+m)*0.5%360
tb=(60*h+m)*6%360
print(np.sqrt(a**2+b**2-2*a*b*np.cos(np.radians(tb)-np.radians(ta))))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
hlist = list(map(int,input().split()))
ablist = []
for i in range(m):
    ablist.append(input().split())
x=np.zeros(n,int)
for ab in ablist:
  a=int(ab[0])
  b=int(ab[1])
  if hlist[a-1]<hlist[b-1]:
    x[a-1]=1#ダメ
  elif hlist[a-1]>hlist[b-1]:
    x[b-1]=1#ダメ
  elif hlist[a-1]==hlist[b-1]:
    x[a-1]=1
    x[b-1]=1
count=0
for l in range(n):
  if x[l]==0:
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a1=[]
a2=[]
for i in range(n):
  a1.append(i-a[i])
for i in range(n):
  a2.append(i+a[i])
count=0
p=0
q=1
for k in range(int(n*(n-1)/2)):
  if a1[q]==a2[p]:
    count+=1
  p+=1
  if p==q:
    p=0
    q+=1
print(count)

Fixed submission:
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a1=[]
a2=[]
for i in range(n):
  a1.append(i+1-a[i])
for i in range(n):
  a2.append(i+1+a[i])
count=0
p=0
q=1
while q<n:
  if a1[q]==a2[p]:
    count+=1
  p+=1
  if p==q:
    p=0
    q+=1
print(count)

Fixed submission:
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a1=[]
a2=[]
for i in range(n):
  a1.append(i+1-a[i])
for i in range(n):
  a2.append(i+1+a[i])
count=0
for k in range(n):
  for l in range(k-1):
    if a1[k]==a2[l]:
      count+=1
print(count)

Fixed submission:
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a1=[]
a2=[]
for i in range(n):
  if i+1-a[i]>0:
    a1.append(i+1-a[i])
for i in range(n):
  a2.append(i+1+a[i])
count=0
for k in a1:
  for l in a2:
    if k==l:
      count+=1
print(count)

Fixed submission:
from collections import Counter
n=int(input())
alist=list(map(int,input().split()))
a1=[]
a2=[]
for i,a in enumerate(alist):
  a2.append(i-a)
  a1.append(i+a)
aa=Counter(a2)
count=0
for k in a1:
  count+=aa.get(k,0)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
ans=0
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x

for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      ans += gcd(a,gcd(b,c))
print(ans)

Fixed submission:
k = int(input())
ans=0
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
 
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      ans += gcd(a,gcd(b,c))
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0]==S[1]orS[1]==S[2]:
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S[0]==S[1] and S[0]==S[2]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n,m=list(map(input().split()))
print(m.append(n))

Fixed submission:
n,m=input().split()
print(m+n)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H,W=map(int,input().split())
grid = [input() for i in range(H)]

dist = [[-1]*W for _ in range(H)]
black_cells = deque()
#黒マスの位置をblack_cellsに保持
#distの黒マスの部分に0でフラッグ
for h in range(H):
  for w in range(W):
    if grid[h][w]=="#":
      black_cells.append((h,w))
      dist[h][w] = 0
def bfs(black_cells, dist):
  count=0
  while black_cells:
    h,w = black_cells.popleft()
    count = dist[h][w]
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        new_h = h + dy
        new_w = w + dx
        if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
          continue
        if dist[new_h][new_w] == -1:
          dist[new_h][new_w] = count+1
          black_cells.append((new_h,new_w))
  return count
print(bfs(black_cells,dist))

Fixed submission:
from collections import deque
H,W=map(int,input().split())
grid = [input() for i in range(H)]

dist = [[-1]*W for _ in range(H)]
black_cells = deque()
#黒マスの位置をblack_cellsに保持
#distの黒マスの部分に0でフラッグ
for h in range(H):
  for w in range(W):
    if grid[h][w]=="#":
      black_cells.append((h,w))
      dist[h][w] = 0
def bfs(black_cells, dist):
  count=0
  while black_cells:
    h,w = black_cells.popleft()
    count = dist[h][w]
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        new_h = h + dy
        new_w = w + dx
        if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
          continue
        if dist[new_h][new_w] == -1:
          dist[new_h][new_w] = count+1
          black_cells.append((new_h,new_w))
  return count
print(bfs(black_cells,dist))
Buggy python submission (verdict: Runtime Error):
n = int(input())
import math
lim = math.ceil(math.sqrt(n-5))
l = [0]*n
for x in range(1, lim):
    for y in range(1, lim):
        for z in range(1, lim):
            i = (x+y+z)**2 - (x*y + y*z + z*x)
            if (0<i) and (i<n+1):
                l[i-1] += 1
for i in l:
    print(i)

Fixed submission:
n = int(input())
import math
lim = math.ceil(math.sqrt(n))
l = [0]*n
for x in range(1, lim):
    for y in range(1, lim):
        for z in range(1, lim):
            i = (x+y+z)**2 - (x*y + y*z + z*x)
            if (0<i) and (i<n+1):
                l[i-1] += 1
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
from numpy import zeros
n, m = map(int, input().split())
h = list(map(int,input().split()))
t = zeros((n, n), dtype=int)
for j in range(m):
    a, b = map(int, input().split())
    t[a-1][b-1] = 1
    t[b-1][a-1] = 1
ans = [1]*n
for i in range(n):
    for j in range(n):
        if t[i][j] == 1:
            if h[i] <= h[j]:
                ans[i] *= 0
                break
print(sum(ans))

Fixed submission:
n, m = map(int, input().split())
h = list(map(int,input().split()))
ans = [1]*n
for j in range(m):
    a, b = map(int, input().split())
    if h[a-1] <= h[b-1]:
        ans[a-1] *= 0
    if h[b-1] <= h[a-1]:
        ans[b-1] *= 0
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

def checkIn(a, n):
    return (a[0] in a[1:n])

b = False
while(n > 1):
    if(checkIn(a,n)):
        print("NO")
        b = True
        break
    else:
        pass
    a = a[1:n]
    n = n-1

if(not b):
    print("YES")

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

a.sort()
b = False
for i in range(n-1):
    if(a[i-1] == a[i]):
        print("NO")
        b = True
        break

if(not b):
    print("YES")
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int,input().split()))
h = list(map(int,input().split()))

h.sort(reverse=True)

for i in range(k):
    h.pop(0)

print(sum(h))

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

h.sort()

if(n < k):
    print(0)
else:
    newH = h[0:(n-k)]
    print(sum(newH))