Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    x, y = map(int, readline().split())
    ans = 0
    ilist = [1]
    tmp = 1
    for i in range(1, max(x,y)+1):
        tmp *= i
        ilist.append(tmp)
    for b in range(x//2+1):
        a = x - 2 * b
        if 2*a + b == y:
            ans += ilist[a+b] // ilist[b] //ilist[a]
    print(ans)


if __name__ == '__main__':
    solve()

Fixed submission:
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    x, y = map(int, readline().split())
    ans = 0
    tmp = 1

    def modinv(a, mod=10 ** 9 + 7):
        return pow(a, mod - 2, mod)

    def com(n, r, mod):
        r = min(r, n - r)
        if r == 0:
            return 1
        res = ilist[n] * iinvlist[n - r] * iinvlist[r] % mod
        return res

    ilist = [0]
    iinvlist = [1]
    tmp = 1


    for i in range(1, x + y + 1):
        tmp *= i
        tmp %= mod
        ilist.append(tmp)
        iinvlist.append(modinv(tmp, mod))


    for b in range(x//2+1):
        a = x - 2 * b
        if 2*a + b == y:
            ans += ilist[a+b] * iinvlist[a] * iinvlist[b] % mod
    print(ans)


if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
N,W = map(int,input().split())
wv = [[0,0]]
dp = [[0]*(W+1) for _ in range(N+1)]
for _ in range(N):
    w,v = map(int,input().split())
    wv.append([w,v])

for weight in range(1,W+1):
    for good in range(1,N+1):
        if weight-wv[good][0] >= 0:
            dp[good][weight] = max(dp[good-1][weight-wv[good][0]]+wv[good][1], dp[good-1][weight])
        else:
            dp[good][weight] = dp[good-1][weight]

print(dp[N][W])

Fixed submission:
N,W = map(int,input().split())
wv = [[0,0]]
dp = [[0]*(W+1) for _ in range(N+1)]
for _ in range(N):
    w,v = map(int,input().split())
    wv.append([w,v])

for weight in range(1,W+1):
    for good in range(1,N+1):
        if weight-wv[good][0] >= 0:
            dp[good][weight] = max(dp[good-1][weight-wv[good][0]]+wv[good][1], dp[good-1][weight])
        else:
            dp[good][weight] = dp[good-1][weight]

print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
#A.sort()
B.sort()
C.sort()
lenC = len(C)
anssum = 0
for i in A:
    for l in B[bisect.bisect_right(B,i):]:
        anssum += lenC - bisect.bisect_right(C,l)
print(anssum)

Fixed submission:
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
anssum = 0
for i in B:
    moreB = N-bisect.bisect_right(C,i)
    lessB = bisect.bisect_left(A,i)
    anssum += moreB*lessB
print(anssum)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
#A.sort()
B.sort()
C.sort()
lenC = len(C)
anssum = 0
for i in A:
    for l in B[bisect.bisect_right(B,i):]:
        anssum += lenC - bisect.bisect_right(C,l)
print(anssum)

Fixed submission:
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
anssum = 0
for i in B:
    moreB = N-bisect.bisect_right(C,i)
    lessB = bisect.bisect_left(A,i)
    anssum += moreB*lessB
print(anssum)
Buggy python submission (verdict: Time Limit Exceeded):
# C Sum of product of pairs

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

s = 0
for i in range(N-1):
  s += A[i] * sum(A[i+1:])
        
print(s % (10**9 + 7))

Fixed submission:
# C Sum of product of pairs

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

s = 0
old = 0
for i in range(N-1):
  old += A[i]
  s += old * A[i+1]
        
print(s % (10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
# C Sum of product of pairs

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

s = 0
for i in range(N-1):
  for j in range(i+1, N):
    s += A[i] * A[j]
    
print(s % (10**9 + 7))

Fixed submission:
# C Sum of product of pairs

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

s = 0
old = 0
for i in range(N-1):
  old += A[i]
  s += old * A[i+1]
        
print(s % (10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

def count(n):
  num = 0
  sqrt_n = math.sqrt(n)
  for i in range(1, math.floor(sqrt_n)+1):
    if n % i == 0:
      num += 2
  if sqrt_n.is_integer():
    num -= 1
  return num
  
ans = 0
for k in range(1, n+1):
  ans += k * count(k)
  
print(ans)

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

for i in range(1, n+1):
  ans += (i + i*(n//i)) * (n//i) // 2
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = p[:k].sum()
  
print(ans)

Fixed submission:
inp1 = input()
inp2 = input()

lists1 = inp1.split()
lists2 = inp2.split()

N = int(lists1[0])
K = int(lists1[1])
values = sorted([int(i) for i in lists2])

result = sum(values[:K])

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

data = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

q, mod = divmod(n-1, 26)
print(q, mod)
answer = data[mod]

while q >= 1:
    q, mod = divmod(q-1, 26)
    print(q, mod)
    answer = data[mod] + answer

print(answer)



Fixed submission:
n = int(input())

data = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

q, mod = divmod(n-1, 26)
answer = data[mod]

while q >= 1:
    q, mod = divmod(q-1, 26)
    answer = data[mod] + answer

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
# B Multiplication 2

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

ans = 1
for ai in a:
  ans *= ai

if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
# B Multiplication 2

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

ans = 1
for ai in a:
  if not ans > 10**18:
    ans *= ai
  elif ai == 0:
    print(0)
    exit()

if ans > 10**18:
  print(-1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
# A Therefore

n = input()

if n[2] in ["2", "4", "5", "7", "9"]:
  print("hon")
elif n[2] in ["0", "1", "6", "8"]:
  print("pon")
else:
  print("bon")

Fixed submission:
# A Therefore

n = input()

if n[-1] in ["2", "4", "5", "7", "9"]:
  print("hon")
elif n[-1] in ["0", "1", "6", "8"]:
  print("pon")
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
# B Trick or Treat

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

sunuke = [0] * N
for i in k:
  d = int(input())
  a = list(map(int, input().split()))
  for ai in a:
    sunuke[ai-1] += 1
print(sunuke.count(0))
  
  

Fixed submission:
# B Trick or Treat

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

sunuke = [0] * N
for i in range(K):
  d = int(input())
  a = list(map(int, input().split()))
  for ai in a:
    sunuke[ai-1] += 1
print(sunuke.count(0))
Buggy python submission (verdict: Time Limit Exceeded):
# B Count Balls

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

cnt = 0
ans = 0
while cnt < N - (A + B):
  cnt += A+B
  ans += A

if N - cnt < A:
  ans += N - cnt
else:
  ans += A
  
print(ans)

Fixed submission:
# B Count Balls

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

set, mod = divmod(N, (A + B))
ans = set * A

if mod < A:
  ans += mod
else:
  ans += A

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum = (sum+ A[i]*A[j])%(10**9+7)
print(sum)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
a = 0
s = 0
for i in range(N):
    a = (a+A[i])%(10**9+7)
for i in range(N-1):
    a = a-A[i]
    s = (s+A[i]*a)%(10**9+7)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int,input().split()))
sum = 1
for i in range(N):
    sum = sum*li[i]
if sum > 10**18:
    print(-1)
else:
    print(sum)


Fixed submission:
N = int(input())
li = list(map(int,input().split()))
if 0 in li:
    print(0)
else:
    sum = 1
    for i in range(N):
        sum = sum*li[i]
        if sum > 10**18:
            sum = -1
            break
    print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    sum = A.count(i+1)
    print(sum)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.zeros(N)
for i in A:
    ans[i-1] +=1
for i in ans:
    print(int(i))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    sum = A.count(i+1)
    print(sum)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.zeros(N)
for i in A:
    ans[i-1] +=1
for i in ans:
    print(int(i))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
sum = [0]*N
for i in range(N):
    sum[i] = A.count(i+1)
    print(sum[i])

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.zeros(N)
for i in A:
    ans[i-1] +=1
for i in ans:
    print(int(i))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
sum = [0]*N
for i in range(N):
    sum[i] = A.count(i+1)
    print(sum[i])

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.zeros(N)
for i in A:
    ans[i-1] +=1
for i in ans:
    print(int(i))
Buggy python submission (verdict: Runtime Error):
H,W,M=map(int,input().split())
row_boms=[0 for i in range(H)]
col_boms=[0 for i in range(W)]

boms=[[0 for j in range(W)] for i in range(H)]
for i in range(M):
  h,w=map(int,input().split())
  boms[h-1][w-1]=1
  row_boms[h-1]+=1
  col_boms[w-1]+=1

row_max=max(row_boms)
col_max=max(col_boms)

rowmax_h=[]
colmax_w=[]
for i in range(H):
  if row_boms[i]==row_max:
    rowmax_h+=[i]
for i in range(W):
  if col_boms[i]==col_max:
    colmax_w+=[i]
rows=len(rowmax_h)
cols=len(colmax_w)
tf=0
for i in rowmax_h:
  for j in colmax_w:
    if boms[i][j]==0:
      tf=1
      break

if tf==1:
  print(row_max+col_max)
else:
  print(row_max+col_max-1)


Fixed submission:
import math
N,X,T=map(int,input().split())
n=math.ceil(N/X)
print(n*T)

Buggy python submission (verdict: Runtime Error):
H,W,M=map(int,input().split())
row_boms=[0 for i in range(H)]
col_boms=[0 for i in range(W)]

boms=[[0 for j in range(W)] for i in range(H)]
for i in range(M):
  h,w=map(int,input().split())
  boms[h-1][w-1]=1
  row_boms[h-1]+=1
  col_boms[w-1]+=1

row_max=max(row_boms)
col_max=max(col_boms)

rowmax_h=[]
colmax_w=[]
for i in range(H):
  if row_boms[i]==row_max:
    rowmax_h+=[i]
for i in range(W):
  if col_boms[i]==col_max:
    colmax_w+=[i]
rows=len(rowmax_h)
cols=len(colmax_w)
tf=0
for i in rowmax_h:
  for j in colmax_w:
    if boms[i][j]==0:
      tf=1
      break

if tf==1:
  print(row_max+col_max)
else:
  print(row_max+col_max-1)

Fixed submission:
import math
N,X,T=map(int,input().split())
n=math.ceil(N/X)
print(n*T)
Buggy python submission (verdict: Runtime Error):
X,K,D=map(int,input().split())
if D*K<:abs(X):
  print(abs(X)-D*K)
else:
  K2=abs(X)//D
  if (K-K2)%2==0:
    print(abs(X)-K2*D)
  else:
    K2=K2-1
    print(abs(X)-K2*D)
    

Fixed submission:
X,K,D=map(int,input().split())
if D*K<abs(X):
  print(abs(X)-D*K)
else:
  K2=abs(X)//D
  if K2>K:
    K2=K
  if (K-K2)%2==0:
    print(abs(X)-K2*D)
  else:
    ans=min(abs(X)-(K2-1)*D, (K2+1)*D-abs(X))
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
def check(x):
  if x==0:
    return 0
  else:
    t=0
    for i in range(N):
      t+=math.ceil(A[i]/x)-1
    if t<=K:
      return 10
    else:
      return 0
low=1
high=max(A)
sig=(low+high)//2
while True:
  if check(sig)==10:
    if check(sig-1)==0:
      ans=sig
      break
    else:
      high=sig-1
      sig=(low+high)//2
  else:
    low=sig+1
    sig=(high+low)//2
print(ans)


Fixed submission:
X=int(input())
if X>=30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
def check(x):
  if x==0:
    return 0
  else:
    t=0
    for i in range(N):
      t+=math.ceil(A[i]/x)-1
    if t<=K:
      return 10
    else:
      return 0
low=0
high=max(A)
sig=(low+high)//2
while True:
  if check(sig)==10:
    if check(sig-1)==0:
      ans=sig
      break
    else:
      high=sig-1
      sig=(low+high)//2
  else:
    low=sig+1
    sig=(high+low)//2
print(ans)

Fixed submission:
X=int(input())
if X>=30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
def check(x):
  if x==0:
    return 0
  else:
    t=0
    for i in range(N):
      t+=math.ceil(A[i]/x)-1
    if t<=K:
      return 10
    else:
      return 0
low=0
high=max(A)
sig=(low+high)//2
while True:
  if check(sig)==10:
    if check(sig-1)==0:
      ans=sig
      break
    else:
      high=sig-1
      sig=(low+high)//2
  else:
    low=sig+1
    sig=(high+low)//2
print(ans)


Fixed submission:
X=int(input())
if X>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
sum=[0]*(N+3)
ans=0
for i in range(1,N+1):
  sum[i]=sum[i-1]+i
for i in range(1,N+1):
  tmpn=N//i
  tmpsum = sum[tmpn]
  ans+=tmpsum*i
print(ans)

Fixed submission:
N=int(input())
sum=[0]*(N+3)
ans=0
for i in range(1,N+1):
  sum[i]=sum[i-1]+i
for i in range(1,N+1):
  tmpn=N//i
  tmpsum = sum[tmpn]
  ans+=tmpsum*i
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
from collections import defaultdict
import math
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]
def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num
ans=0
for i in range(1,N+1):
  ans+=search_divisor_num_1(i)*i
print(ans)

Fixed submission:
N=int(input())
sum=[0]*(N+3)
ans=0
for i in range(1,N+1):
  sum[i]=sum[i-1]+i
for i in range(1,N+1):
  tmpn=N//i
  tmpsum = sum[tmpn]
  ans+=tmpsum*i
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
from collection import defaultdict
def prime_factorization_1(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = defaultdict(int)
        for prime in prime_list:
            while num % prime == 0:
                dict_counter[prime] += 1
                num //= prime
        if num != 1:
            dict_counter[num] += 1

        dict_counter = dict(dict_counter)

        return dict_counter
ans=0
for i in range(1,N+1):
  ans+=prime_factorization_1(i)*i
print(ans)


Fixed submission:
N=int(input())
sum=[0]*(N+3)
ans=0
for i in range(1,N+1):
  sum[i]=sum[i-1]+i
for i in range(1,N+1):
  tmpn=N//i
  tmpsum = sum[tmpn]
  ans+=tmpsum*i
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
C=[]
A=[[] for  _  in range(N)]
for i in range(N):
  tmpA=list(map(int,input().split()))
  C+=[tmpA[0]]
  A[i]=tmpA[1:]

costmin=float('inf')
for k in range(2**N):
  tansaku=k
  koubai=[0 for i in range(N)]
  rikaido=[0 for i in range(N)]
  cost=0
  for i in range(N-1):
    koubai[i]=tansaku//(2**(N-i-1))
    tansaku=tansaku%(2**(N-i-1))
  koubai[-1]=tansaku
  for i in range(N):
    if koubai[i]==1:
      cost+=C[i]
      for j in range(M):
        rikaido[j]+=A[i][j]
  for i in range(M):
    if rikaido[i]<X:
      break
  else:
    costmin=min(costmin,cost)
if costmin!=float('inf'):
  print(costmin)
else:
  print(-1)

Fixed submission:
N,M,X=map(int,input().split())
C=[]
A=[[] for  _  in range(N)]
for i in range(N):
  tmpA=list(map(int,input().split()))
  C+=[tmpA[0]]
  A[i]=tmpA[1:]

costmin=float('inf')
for k in range(2**N):
  tansaku=k
  koubai=[0 for i in range(N)]
  rikaido=[0 for i in range(M)]
  cost=0
  for i in range(N-1):
    koubai[i]=tansaku//(2**(N-i-1))
    tansaku=tansaku%(2**(N-i-1))
  koubai[-1]=tansaku
  for i in range(N):
    if koubai[i]==1:
      cost+=C[i]
      for j in range(M):
        rikaido[j]+=A[i][j]
  for i in range(M):
    if rikaido[i]<X:
      break
  else:
    costmin=min(costmin,cost)
if costmin!=float('inf'):
  print(costmin)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
C=[]
A=[[] for  _  in range(N)]
for i in range(N):
  tmpA=list(map(int,input().split()))
  C+=[tmpA[0]]
  A[i]=tmpA[1:]
tf=1
for i in range(M):
  s=0
  for j in range(N):
    s+=A[j][i]
  if s<X:
    tf=0
    break
if tf==0:
  print(-1)
else:
  costmin=float('inf')
  for k in range(2**N):
    tansaku=k
    koubai=[0 for i in range(N)]
    rikaido=[0 for i in range(N)]
    cost=0
    for i in range(N-1):
      koubai[i]=tansaku//(2**(N-i-1))
      tansaku=tansaku%(2**(N-i-1))
    koubai[-1]=tansaku
    for i in range(N):
      if koubai[i]==1:
        cost+=C[i]
        for j in range(M):
          rikaido[j]+=A[i][j]
    for i in range(M):
      if rikaido[i]<X:
        break
    else:
      costmin=min(costmin,cost)
      
        
        
  

Fixed submission:
N,M,X=map(int,input().split())
C=[]
A=[[] for  _  in range(N)]
for i in range(N):
  tmpA=list(map(int,input().split()))
  C+=[tmpA[0]]
  A[i]=tmpA[1:]

costmin=float('inf')
for k in range(2**N):
  tansaku=k
  koubai=[0 for i in range(N)]
  rikaido=[0 for i in range(M)]
  cost=0
  for i in range(N-1):
    koubai[i]=tansaku//(2**(N-i-1))
    tansaku=tansaku%(2**(N-i-1))
  koubai[-1]=tansaku
  for i in range(N):
    if koubai[i]==1:
      cost+=C[i]
      for j in range(M):
        rikaido[j]+=A[i][j]
  for i in range(M):
    if rikaido[i]<X:
      break
  else:
    costmin=min(costmin,cost)
if costmin!=float('inf'):
  print(costmin)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

Fixed submission:
S=input()
if S=="ARC":
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False:
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
for i in range(N):
  groups[nums[i]]+=[i]
ans=0
for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1
print(ans)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
TF=[True for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    TF[B-1]=False
  elif H[A-1]<H[B-1]:
    TF[A-1]=False
  else:
    TF[A-1]=False
    TF[B-1]=False
ans=0
for i in range(N):
  if TF[i]==True:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

Fixed submission:
X=int(input())
for i in range(-150,150):
  for j in range(-150,150):
    if i**5-j**5==X:
      A=i
      B=j
print(*[A,B])