Harryxun/stf_run huggingface dataset:
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))

for i in np.argsort(mat[:, 2]):
	print(res[int(i)])


### FIXED CODE ###

import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])
A, B = map(int, input().split())
 
priceA1 = A / 0.08
priceA2 = (A+1) / 0.08
priceB1 = B / 0.10
priceB2 = (B+1) / 0.10

if priceA1 <= priceB1 < priceA2:
    print(int(priceB))
elif priceB1 <= priceA1 < priceB2:
    print(int(priceA))
else:
    print(-1)

### FIXED CODE ###

import math

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

priceA1 = math.ceil(A / 0.08)
priceA2 = (A+1) / 0.08
priceB1 = math.ceil(B / 0.10)
priceB2 = (B+1) / 0.10

if math.floor(priceA2) < priceA2:
    priceA2 = math.floor(priceA2)
else:
    priceA2 = math.floor(priceA2) - 1


if math.floor(priceB2) < priceB2:
    priceB2 = math.floor(priceB2)
else:
    priceB2 = math.floor(priceB2) - 1

if priceA1 <= priceB1 <= priceA2:
    print(math.ceil(priceB1))
elif math.ceil(priceB1) < math.ceil(priceA1) < priceB2:
    print(math.ceil(priceA1))
elif math.ceil(priceA1) == math.ceil(priceB1):
    print(math.ceil(priceA1))
else:
    print(-1)
def main():
    a1 = input().split()[0]
    a2 = input().split()[1]
    a3 = input().split()[2]

    print (a1+a2+a3)


if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()



### FIXED CODE ###


def main():
    a1 = input()[0]
    a2 = input()[1]
    a3 = input()[2]

    print (a1+a2+a3)


if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
d = [0] * (M - 1)

if N >= M:
    print(ans)
else:
    for i in range(M - 1):
        d[i] = abs(X[i + 1] - X[i])
    d.sort(reverse=True)
    print(sum(d[N - 1:]))

### FIXED CODE ###

N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
d = [0] * (M - 1)
ans = 0

if N >= M:
    print(ans)
else:
    for i in range(M - 1):
        d[i] = abs(X[i + 1] - X[i])
    d.sort(reverse=True)
    b = d[:N - 1]
    for i in range(M - 1):
        if d[i] in b:
            b.remove(d[i])
        else:
            ans += d[i]
    print(ans)
import sys

line = sys.stdin.readline():
     x, y = line.split(" ")

x = int(x)
y = int(y)

divide = 1

if x > y:
    x, y = y, x

for i in range(2, x + 1):
    if x % i == 0 and y % i == 0:
        divide *= i
        x /= i
        y /= i
        i -= 1

print divide

### FIXED CODE ###

import sys

def div(x, y):
    if x % y == 0:
        print y
    else:
        div(y, x%y)


line = sys.stdin.readline()
x, y = line.split(" ")

x = int(x)
y = int(y)

if x < y:
    x, y = y, x

if x == y:
    print x

else:
    div(x, y)
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

MA = [S[0]]
NA = [T[0]]

L = lcm(M, N)

m = L/M
n = L/N

for i in range(M):
    if i % n == 0:
        MA.append(S[i])

for i in range(N):
    if i % m == 0:
        NA.append(T[i])

if MA == NA:
    print(L)
else:
    print("-1")






### FIXED CODE ###

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

def lcm(x, y):
    return (x * y) // gcd(x, y)



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

MA = [S[0]]
NA = [T[0]]

L = lcm(M, N)

m = L/M
n = L/N

for i in range(M):
    if i % n == 0:
        MA.append(S[i])

for i in range(N):
    if i % m == 0:
        NA.append(T[i])

if MA == NA:
    print(L)
else:
    print("-1")
import math
A,B,H,M=map(int, input().split())
a=math.pi
b=math.cos(a*((60*H-11M)/360))
Z=A**2+B**2-2*A*B*b
print(Z**(1/2))

### FIXED CODE ###

import math
A,B,H,M=map(int, input().split())
a=math.pi
b=math.cos(a*((60*H-11*M)/360))
Z=A**2+B**2-2*A*B*b
print(Z**(1/2))
n = int(input())
n %= 10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('bon')2

### FIXED CODE ###

n = int(input())
n %= 10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('bon')
weather = input()

if weather in [RRR]:
    print("3")
elif weather in [RR]:
    print("2")
elif weather in [R]:
    print("1")
else:
    print("0")

### FIXED CODE ###

weather = input()

if weather in ["RRR"]:
    print("3")
elif weather in ["SRR","RRS"]:
    print("2")
elif weather in ["SSR","SRS","RSS","RSR"]:
    print("1")
else:
    print("0")
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, X, mod = mapint()

s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
    X = pow(X, 2, mod)
    if X in s:
        if X in s_loop:
            loops.append(X)
            break
        loop += X
        s_loop.add(X)
        loops.append(X)
    s.add(X)
    ans += X

rest = N-i-2
if rest:
    ans += (rest//len(s_loop))*loop
    amari = rest%len(s_loop)+1
    for i in range(amari):
        ans += loops[i]
    print(ans)
else:
    print(ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, sX, mod = mapint()

X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
i = -1
for i in range(min(10**5*2+10, N-1)):
    X = pow(X, 2, mod)
    if X in s:
        if X in s_loop:
            loops.append(X)
            break
        loop += X
        s_loop.add(X)
        loops.append(X)
    s.add(X)
    ans += X

rest = N-i-2
if rest:
    ans += (rest//len(s_loop))*loop
    amari = rest%len(s_loop)+1
    for i in range(amari):
        ans += loops[i]
    print(ans)
else:
    print(ans)
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a,b,c))

### FIXED CODE ###

import sys
 
def gcd(inta, intb):
    large = max(inta, intb)
    small = min(inta,intb)
    mod = large % small
    if mod ==0:
        return small
    else:
        return gcd(small, mod) 
     
def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)
 
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = gcd(a, b)
    print(c, lcm(a, b, c))
s = input()
t = input()
n, m = len(s), len(t)
dp = [[0]*(m+1) for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(1, m+1):
        if s[i] == t[j]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

i, j = n, m

ans = []

while i > 0 and j > 0:
    if dp[i][j] == dp[i][j-1]:
        j -= 1
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
    else:
        ans.append(s[i])
        i -= 1
        j -= 1

print(ans)

### FIXED CODE ###

s = input()
t = input()
n, m = len(s), len(t)
dp = [[0]*(m+1) for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(1, m+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

i, j = n, m

ans = []

while i > 0 and j > 0:
    if dp[i][j] == dp[i][j-1]:
        j -= 1
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

print("".join(reversed(ans)))
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import deque
import pprint

inf = 10**18
mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
pre = a[0]
if a[0] != a[1]:
    if pre == 1:
        print(1)
        sys.exit()
else:
    if pre == 1:
        print(0)
        sys.exit()
c = collections.Counter(a)
for k,v in c.items():
    if v == 1:
        b.append(k)

judge = [False for i in range(10**6+1)]
for num in b:
    judge[num] = True
for i in range(1,(10**6)//2+1):
    if judge[i]:
        for j in range(i*2,10**6+1,i):
            judge[j] = False
ans = 0
for i in range(1,10**6+1):
    if judge[i]:
        ans+=1
print(ans)

### FIXED CODE ###

# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import deque
import pprint

inf = 10**18
mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 1:
    print(1)
    sys.exit()
if n == 2:
    if a[0] == a[1]:
        print(0)
    elif a[1]%a[0] == 0:
        print(1)
    else:
        print(2)
    sys.exit()

b = []
pre = a[0]
if a[0] != a[1]:
    if pre == 1:
        print(1)
        sys.exit()
else:
    if pre == 1:
        print(0)
        sys.exit()

judge = [False for i in range(10**6+1)]
for num in a:
    judge[num] = True
for i in range(1,(10**6)):
    if judge[i]:
        for j in range(i*2,10**6+1,i):
            judge[j] = False
ans = 0
for i in range(1,10**6+1):
    if judge[i]:
        ans+=1
subans = 0
c = collections.Counter(a)
for k,v in c.items():
    if v > 1 and judge[k]:
        subans+=1
print(ans-subans)
g=lambda a,b:abs(a[0]*b[1]-a[1]*b[0])

while True:
    l=[float(i) for i in input().split()]
    if not l:break
    ba=[l[0]-l[2],l[1]-l[3]]
    ab=[-i for i in ba]
    cb=[l[2]-l[4],l[3]-l[5]]
    bc=[-i for i in cb]
    ca=[l[0]-l[4],l[1]-l[5]]
    ac=[-i for i in ca]
    ap=[l[6]-l[0],l[7]-l[1]]
    bp=[l[6]-l[2],l[7]-l[3]]
    cp=[l[6]-l[4],l[7]-l[5]]
    if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp) or g(ca,cb)<g(ca,cp):
        print("NO")
    else:
        print("YES")


### FIXED CODE ###

g=lambda a,b,c:(a[0]-b[0])*(b[1]-c[1])-(b[0]-c[0])*(a[1]-b[1])

while True:
    try:t=input()
    except:break
    l=[float(i) for i in t.split()]
    b=[g(l[0:2],l[2:4],l[6:8]),g(l[2:4],l[4:6],l[6:8]),g(l[4:6],l[0:2],l[6:8])]
    if len([i for i in b if i>0])==3 or len([i for i in b if i<0])==3:
        print("YES")
    else:
        print("NO")
a = input()
b = input()
h = input()
print((a+b)*h/2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
H,W = map(int, input().split())
List = [input() for i in range(H)]
queue = [(0,0,1)]
shape = sum(row.count("#") for row in List)
used ={(0,0)}

def check(x,y,c):
    if(x>W-1 or y>H-1 or x<0 or y<0):
        return
    if(List[y][x] == '#'):
        return
    if(x,y) in used:
        return
    queue.append((x,y,c+1))
    used.add((x,y))

f= -1
while queue:
    x,y,c = queue[0]
    if x==W-1 and y==H-1:
        f=1
        break
    queue.pop(0)
    check(x+1,y,c)
    check(x, y+1,c)
    check(x-1,y,c)
    check(x, y-1,c)
print(f if f == -1 else(H*W-c-shape))


### FIXED CODE ###

N = int(input())
A = int(input())
mod = N % 500
if mod <= A:
    print('Yes')
else:
    print('No')
%%time
n,q=map(int,input().split())
c=input()
s=[input().split() for _ in [0]*q]
def judge(x,opt):
    for y in s:
        if y[0]==c[x]:
            if y[1]=='L':
                x-=1
            else:
                x+=1
            if not opt:
                if x>=n:
                    return False
                elif x<0:
                    return True
            else:
                if x<0:
                    return False
                elif x>=n:
                    return True
    return False
def bisect(l,r,opt):
    print(l,r)
    center=(r+l)//2
    if judge(center,opt):
        if r-l<=1:
            if not opt:
                return l+1
            else:
                return  n-l
        if not opt:
            return bisect(center+1,r,opt)
        else:
            return bisect(l,center,opt)
    else:
        if r-l<=1:
            if not opt:
                return l
            else:
                return n-r
        if not opt:
            return bisect(l,center,opt)
        else:
            return bisect(center+1,r,opt)
def func():
    l=bisect(0,n,0)
    r=bisect(0,n,1)
    print(n-l-r)
func()

### FIXED CODE ###

n,q=map(int,input().split())
c=input()
s=[input().split() for _ in [0]*q]
def judge(x,opt):
    for y in s:
        if y[0]==c[x]:
            if y[1]=='L':
                x-=1
            else:
                x+=1
            if not opt:
                if x>=n:
                    return False
                elif x<0:
                    return True
            else:
                if x<0:
                    return False
                elif x>=n:
                    return True
    return False
def bisect(l,r,opt):
    center=(r+l)//2
    if judge(center,opt):
        if r-l<=1:
            if not opt:
                return l+1
            else:
                return  n-l
        if not opt:
            return bisect(center+1,r,opt)
        else:
            return bisect(l,center,opt)
    else:
        if r-l<=1:
            if not opt:
                return l
            else:
                return n-r
        if not opt:
            return bisect(l,center,opt)
        else:
            return bisect(center+1,r,opt)
def func():
    l=bisect(0,n,0)
    r=bisect(0,n,1)
    print(n-l-r)
func()
s = list(input())
t = list(input())


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    
  if min(s) < max(t):
    print('Yes')
    exit()



### FIXED CODE ###

s = list(input())
t = list(input())


for i in range(101):
  if min(s) > max(t):
    print('No')
    exit()
    
  elif min(s) == max(t):
    s.remove(min(s))
    t.remove(max(t))
    if s == [] and t != []:
      print('Yes')
      exit()
    elif s == [] and t == []:
      print('No')
      exit()
    elif s != [] and t == []:
      print('No')
      exit()
  if min(s) < max(t):
    print('Yes')
    exit()
n = int(input())
rem = n%1000
if rem!=0:
  return 1000-rem
return 0

### FIXED CODE ###

n = int(input())
rem = n%1000
if rem!=0:
  print(1000-rem)
else:
  print(0)
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1

pre = []
for i in reversed(range(1,a)):
    r = N // 26**i
    pre.append(r)
    N = int(N%(26**i))

ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])

### FIXED CODE ###

N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1

pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))

ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])
N, T = map(int,input())
ans=10000

for i in range(N):
  c, tt==map(int,input())
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)

### FIXED CODE ###

N, T = list(map(int, input().split()))
ans=10000

for i in range(N):
  c, tt=list(map(int, input().split()))
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)
n=input();s=input()
print(s.count('ABC')

### FIXED CODE ###

n=input();s=input()
print(s.count('ABC'))
s = input()
print(s.replace(2017, 2018))

### FIXED CODE ###

s = input()
print(s.replace('2017', '2018'))
K = int(input())

def isRunRun(X):
    x = str(X)
    sa = 0
    for i in range(len(x)-1):
        if abs(int(x[i]) - int(x[i+1])) > 1:
            return False
    return True

if K > 10000:
    num = 22111101
    count = 10000
elif K > 5000:
    num = 110111
    count = 1000
else:
    num = 1
    count = 0

while count < K:
    if isRunRun(num):
        count += 1
    num += 1

print(num-1)

### FIXED CODE ###

# 1行、2変数を受け取るとき
X, Y, Z = map(int, input().split())

print("{} {} {}".format(Z, X, Y))
[print"%dx%d=%d"%(i,j,i*j)for i in range(1, 10)for j in range(1, 10)]

### FIXED CODE ###

x=range(1,10);[print("%dx%d=%d"%(i,j,i*j))for i in x for j in x]
N = int(input())
h_list = list(map(int,input().split()))

costs = [None for _ in range(N)]

def func(stone_num):
    if stone_num == 0:
        return 0
    if stone_num == 1:
        return func(stone_num-1) + abs(h_list[stone_num-1] - h_list[stone_num])
    return min(
        func(stone_num-1) + abs(h_list[stone_num-1] - h_list[stone_num]),
        func(stone_num-2) + abs(h_list[stone_num-2] - h_list[stone_num])
    )

print(func(N-1))

### FIXED CODE ###

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

costs = [None for _ in range(N)]

for i in range(N):
    if i == 0:
        cost = 0
    elif i == 1:
        cost = costs[i-1] + abs(h_list[i-1] - h_list[i])
    else:
        cost = min(
            costs[i-1] + abs(h_list[i-1] - h_list[i]),
            costs[i-2] + abs(h_list[i-2] - h_list[i])
        )
    costs[i] = cost

print(costs[-1])
mod = 1012924417
primitive_root = 5
roots = [pow(primitive_root, (mod-1)>>i, mod) for i in range(22)]
inv_roots = [pow(root, mod-2, mod) for root in roots]

def ntt(A, n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w = 1
            s *= m*2
            for j in range(m):
                A[s+j], A[s+j+m] = (A[s+j]+A[s+j+m])%mod, (A[s+j]-A[s+j+m])*w%mod
                w *= roots[n-i]
                w %= mod

def intt(A, n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w = 1
            s *= m*2
            for j in range(m):
                A[s+j], A[s+j+m] = (A[s+j]+A[s+j+m]*w)%mod, (A[s+j]-A[s+j+m]*w)%mod
                w *= inv_roots[i+1]
                w %= mod
    inv = pow((mod+1)//2, n, mod)
    for i in range(1<<n):
        A[i] *= inv
        A[i] %= mod

def convolution(A, B):
    la = len(A)
    lb = len(B)
    deg = la + lb - 2
    n = deg.bit_length()
    N = 1<<n
    A += [0]*(N-la)
    B += [0]*(N-lb)
    ntt(A, n)
    ntt(B, n)
    A = [a*b%mod for a, b in zip(A, B)]
    intt(A, n)
    return A[:deg+1]


import sys
input = sys.stdin.readline
n = int(input())
A, B = [0], [0]
for _ in range(n):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
C = convolution(A, B)
print(*C[1:], sep="\n")

### FIXED CODE ###

mod = 998244353
primitive_root = 3
roots = [pow(primitive_root, (mod-1)>>i, mod) for i in range(24)]
inv_roots = [pow(root, mod-2, mod) for root in roots]

def ntt(A, n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w = 1
            s *= m*2
            for j in range(m):
                A[s+j], A[s+j+m] = (A[s+j]+A[s+j+m])%mod, (A[s+j]-A[s+j+m])*w%mod
                w *= roots[n-i]
                w %= mod

def intt(A, n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w = 1
            s *= m*2
            for j in range(m):
                A[s+j], A[s+j+m] = (A[s+j]+A[s+j+m]*w)%mod, (A[s+j]-A[s+j+m]*w)%mod
                w *= inv_roots[i+1]
                w %= mod
    inv = pow((mod+1)//2, n, mod)
    for i in range(1<<n):
        A[i] *= inv
        A[i] %= mod

def convolution(A, B):
    la = len(A)
    lb = len(B)
    deg = la + lb - 2
    n = deg.bit_length()
    N = 1<<n
    A += [0]*(N-la)
    B += [0]*(N-lb)
    ntt(A, n)
    ntt(B, n)
    A = [a*b%mod for a, b in zip(A, B)]
    intt(A, n)
    return A[:deg+1]


import sys
input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = convolution(A, B)
print(*C)
a, b = map(int, input().split('1 2'))

input_cal = []
input_cal.append(a + b)
input_cal.append(a - b)
input_cal.append(a * b)
print(max(input_cal))


### FIXED CODE ###


a, b = map(int, input().split())

input_cal = [a + b, a - b, a * b]
print(max(input_cal))
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if:
        list1[b - 1] = 0
print(sum(list1))

### FIXED CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
n = int(input())
a = list(map(int,input().split()))

x = [0]*n
j = 0
for i in range(n):
    k = 0
    while j < n-1:
        if i+1 == a[j]:
            j=j+1
            k=k+1
        else:
            break
    x[i] = k

ans = [print(_) for _ in x]

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
for i in range(len(a)):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])
def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

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

N, M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
d1 = L//N
d2 = L//M
d = lcm(d1,d2)
l = list(range(L))
l = l[::d]
b = True
for i in l:
    if S[i//d1] != T[i//d2]:
        b = False
        break

if not b:
    L = -1
print(L)


### FIXED CODE ###

import sys

def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

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

N, M = map(int,input().split())
S = input()
T = input()
d = gcd(N,M)
L = lcm(N,M)
for i in range(d):
    if S[i*(N//d)] != T[i*(M//d)]:
        print(-1)
        sys.exit()

print(L)
a,b=input().split()
a=int(a)
b=list(b)
b=[b[0],b[2],b[3]]
c=a*b[0]+a*b[2]//10+a*b[3]//100
print(c)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=list(b)
b=[int(b[0]),int(b[2]),int(b[3])]
c=(a*b[0]*100+a*b[1]*10+a*b[2])//100
print(c)
n,m =map(int.input().split())

if n <= m:
  print('unsafe')
else:
  print("safe")

### FIXED CODE ###

n,m =map(int,input().split())

if n <= m:
  print('unsafe')
else:
  print("safe")
f=lambda:map(int,input().split())
h,n=f()
dp=[0]+[10**9]*h
for i in range(n):
  a,b=f()
  for j in range(h+1): dp[j]=min(dp[j],dp[j-a]+b)
print(dp[h])

### FIXED CODE ###

import sys
f=lambda:map(int,sys.stdin.readline().split())
h,n=f()
INF=10**9
dp=[[INF]*(h+1) for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  a,b=f()
  for j in range(h+1):
    dp[i+1][j]=min(dp[i][j],dp[i+1][max(j-a,0)]+b)
print(dp[n][h])
from collections import Counter as c
n=int(input())
l=[[s,cou for s,cou in c(input()).items()]for i in range(n)]

### FIXED CODE ###

from itertools import groupby as gb
n=int(input())
s=set(list("qazwsxedcrfvtgbyhnujmiklop"))
l=[500 for i in range(26)]
for i in  range(n):
  strd=sorted(input())
  vs=set(strd)
  sstr=sorted(list(vs))
  gr=[(a,len(list(b))) for a,b in gb(strd)]
  for t in s-vs:
    l[ord(t)-97]=0
  if sum(l)==0:print();exit()
  for v in vs:
    fg=ord(v)-97
    l[fg]=min(l[fg],gr[sstr.index(v)][1])
  s&=vs
ans=""
for i,c in enumerate(l):
  if c:
    f=chr(i+97)
    ans+=f*c
print(ans)
import math

menu = [int(input()) for i in range(5)]
last_menu_index = min([[i, x % 10 ] for i, x in enumerate(menu) if x % 10 != 0 ], key=lambda x: x[1])[0]
print(sum([math.ceil(x / 10) * 10 if last_menu_index != i else menu[last_menu_index] for i, x in enumerate(menu)]))


### FIXED CODE ###

import math

menu = [int(input()) for i in range(5)]
last_menu_index = min([[i, x % 10 ] for i, x in enumerate(menu) if x % 10 != 0 ]+[[123,123]], key=lambda x: x[1])[0]
print(sum([math.ceil(x / 10) * 10 if last_menu_index != i else menu[last_menu_index] for i, x in enumerate(menu)]))
a,b=map(int,input().split())
print(sum(a+b)%24)

### FIXED CODE ###

print(sum(map(int,input().split()))%24)