Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
h = list(map(int,input().split()))

min = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a] < h[b]:
        min.append(a)
    if h[a] == h[b]:
        min.append(a)
        min.append(b)
    if h[a] > h[b]:
        min.append(b)

print(len(h)-len(set(min)))


### FIXED CODE ###

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

min = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        min.append(a)
    if h[a-1] == h[b-1]:
        min.append(a)
        min.append(b)
    if h[a-1] > h[b-1]:
        min.append(b)

print(len(h)-len(set(min)))
from collections import defaultdict


def prepare(n, MOD):
    f = 1
    factorials = [1] * (n + 1)
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials[m] = f
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs


def prime_factorize(n):
    r2 = len(bin(n & -n)) - 3
    if r2:
        yield r2
    i = 3
    k = n >> f[2]
    while 1 < k and i * i <= k:
        cnt = 0
        while True:
            d, m = divmod(k, i)
            if m == 0:
                cnt += 1
                k = d
            else:
                break
        if cnt:
            yield cnt
        i += 2
    if k > 1:
        yield 1


MOD = 1000000007
n, m = map(int, input().split())
pf = list(prime_factorize(m))
mx = max(pf)
f, r = prepare(n + mx - 1, MOD)
ans = 1
for e in pf:
    ans *= f[n + e - 1]
    ans %= MOD
    ans *= r[n - 1]
    ans %= MOD
    ans *= r[e]
    ans %= MOD
print(ans)


### FIXED CODE ###

from collections import defaultdict


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs


def prime_factorize(n):
    f = defaultdict(lambda: 0)
    f[2] = len(bin(n & -n)) - 3
    i = 3
    k = n >> f[2]
    while k > 1:
        while True:
            d, m = divmod(k, i)
            if m == 0:
                f[i] += 1
                k = d
            else:
                break
        i += 2
    return f


MOD = 1000000007
n, m = map(int, input().split())
pf = prime_factorize(m)
mx = max(pf.values())
f, r = prepare(n + mx, MOD)
ans = 1
for p, e in pf.items():
    ans *= f[n + e - 1] * r[n - 1]
    ans %= MOD
    ans *= r[e]
    ans %= MOD
print(ans)
#Tenka1 Programmer Beginner Contest-C Align
"""
リストを並び替えて隣り合う要素の差の最大を出力
"""
import sys
from collections import deque
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = []
for i in range(n):
    lst1.append(int(readline()))

d = deque()

lst1.sort()
lst2 = lst1[:n//2] #小さい方
lst1 = lst1[n//2:] #大きい方
large = deque(lst1)
small = deque(lst2)
#2又に分かれるまで手動
res1 = large.pop()
res2 = small.popleft()
def func(x):
    global res1,res2
    if abs(res1-x) > abs(res2-x):
        res = abs(res1-x)
        res1 = x
        return res
    else:
        res = abs(res2-x)
        res2 = x
        return res

ans = res1-res2
ans += func(small.popleft())
while True:
    if not len(large):
        pass
    else:
        ans += func(large.pop())
    if not len(large):
        pass
    else:
        ans += func(large.pop())
    if not len(small):
        pass
    else:
        ans += func(small.popleft())
    if not len(small):
        pass
    else:
        ans += func(small.popleft())
    if not (len(large) or len(small)):
        print(ans)
        exit()


### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = []
for i in range(n):
    lst1.append(int(readline()))
lst1.sort(reverse=True)
if n % 2 == 1:
    minority = n//2
    majority = n - minority
    A = sum(lst1[:minority])*2 - sum(lst1[minority:])*2+sum(lst1[minority:minority+2])
    B = sum(lst1[:majority])*2 - sum(lst1[majority:])*2 - sum(lst1[majority-2:majority])
    ans = max(A, B)
else:
    C = sum(lst1[:n//2])*2 - sum(lst1[n//2:])*2 + lst1[n//2]-lst1[n//2-1]
    D = -C
    ans = max(C, D)
print(ans)
#!/usr/bin/python                                                                                                                                 
# -*- coding: utf-8 -*-                                                                                                                           

import sys


station = ""
for c in range(ord('a'), ord('z') + 1):
    station += chr(c)
for c in range(ord('A'), ord('Z') + 1):
    station += chr(c)

while True:
    n = int(sys.stdin.readline())
    if n == 0:
        break

    l = sys.stdin.readline()
    l = map(lambda x: int(x), l.split())

    s = sys.stdin.readline().rstrip()
    res = ""
    for i, x in enumerate(s):
        index = ord(x) - (ord('a') if x.islower() else ord('A') + 26) - l[i % len(l)]
        res += station[index]
    print res

### FIXED CODE ###

#!/usr/bin/python                                                                                                                                 
# -*- coding: utf-8 -*-                                                                                                                           

import sys


def main():
    station = ""
    for c in range(ord('a'), ord('z') + 1):
        station += chr(c)
    for c in range(ord('A'), ord('Z') + 1):
        station += chr(c)

    while True:
        n = int(sys.stdin.readline())
        if n == 0:
            return 0

        l = sys.stdin.readline()
        l = map(lambda x: int(x), l.split())

        s = sys.stdin.readline().rstrip()
        res = ""
        for i, x in enumerate(s):
            index = ord(x) - (ord('a') if x.islower() else ord('A') + 26) - l[i % len(l)]
            index %= len(station)
            res += station[index]
        print res

if __name__ == '__main__':
    main()
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i+*500+j*100+k*50 == x:
        ans += 1


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500+j*100+k*50 == x:
        ans += 1
print(ans)
a = list(map(int,input().split()))
num_5 = 0
num_7 = 0

for  i in a:
  if i=="5":
    num_5 = num_5+1
  if i=="7":
    num_7 = num_7+1

if num_5=2 and num_7=1:
  print "YES"
else:
  print "NO"

### FIXED CODE ###

a = list(map(int,input().split()))
num_5 = 0
num_7 = 0

for i in a:
  if i==5:
    num_5 = num_5+1
  if i==7:
    num_7 = num_7+1

if num_5==2 and num_7==1:
  print("YES")
else:
  print("NO")
n, m = map(int, input().split())

if n 

m = (n-1) // 2
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):

    if n - d in memo or d * 2 == n:
        cnt += 1
        d += 1
    memo.add(d)
    if cnt > 1 or a < 1 or a+d > n:
        print(1/0)
    print(a, a+d)
    a -= 1
    d += 2


### FIXED CODE ###

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

a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):

    if (n - d in memo) or (2*d == n):
        cnt += 1
        d += 1
    memo.add(d)
    if cnt > 1 or a < 1 or a+d > n:
        print(1/0)
    print(a, a+d)
    a -= 1
    d += 2
import math

def Eratos(n):
	primes = [2]
	if n % 2 == 0:
		num = [2*i+1 for i in range(1,n/2)]
	else:
		num = [2*i+1 for i in range(1,(n+1)/2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

def list_count(list_a,n):
	cont = 0
	for i in range(len(list_a)):
		if list_a[i] > n:
			break
		else:
			cont += 1
	return cont

primes = Eratos(1000000)
while True:
	try:
		n = int(input())
		print(list_count(primes,n))
	except EOFError:
		break


### FIXED CODE ###

import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

def list_count(list_a,n):
	cont = 0
	for i in range(len(list_a)):
		if list_a[i] > n:
			break
		else:
			cont += 1
	return cont

primes = Eratos(1000000)
while True:
	try:
		n = int(input())
		print(list_count(primes,n))
	except EOFError:
		break
s=input()
a=""
for i i range(len(s)):
  a+="x"
print(a)

### FIXED CODE ###

s=input()
a=""
for i in range(len(s)):
  a+="x"
print(a)
import sys
n=int(input())

def flush():
    sys.stdout.write("\033[2K\033[G")
    sys.stdout.flush()

print(0)
s=input()
if(s=='Vacant'):
    sys.exit()
flush()
pre_i=0
i=(n-1)//2
while(True):
    print(i)
    si=input()
    if(si=='Vacant'):
        break
    temp=i
    if(s==si):
        i=i+(i-pre_i)//2
    else:
        i=i-(i-pre_i)//2
    s=si
    pre_i=temp




### FIXED CODE ###

import sys
n=int(input())

print(0)
sexlow=input()
if(sexlow=='Vacant'):
    sys.exit()

print(n-1)
sexhigh=input()
if(sexhigh=='Vacant'):
    sys.exit()

low=0
high=n-1
piv=0
while(True):
    piv=(low+high)//2

    print(piv)
    sexn=input()
    if(sexn=='Vacant'):
        break
    elif(( (piv-low)%2==0 and sexlow!=sexn) or ( (piv-low)%2!=0 and sexlow==sexn)):
        high=piv
        sexhigh=sexn
    elif(( (high-piv)%2==0 and sexhigh!=sexn) or ( (high-piv)%2!=0 and sexhigh==sexn)):
        low=piv
        sexlow=sexn
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
X=sorted([(A[i],B[i]) for i in range(N)],key=lambda x:x[1])
A=[X[i][0] for i in range(N)]
B=[X[i][1] for i in range(N)]
C=sorted([(A[i],i) for i in range(N)],key=lambda x:x[0])
for i in range(N):
    if C[i][0]>B[i]:
        print("No")
        exit()
if len(set(A))<N:
    print("Yes")
    exit()
Y=[0 for i in range(N)]
j=0
for i in range(N):
    Y[j]=1
    j=C[j][1]
    
if sum(Y)==N:
    #A:C[i][0]
    #B:X[i][1]
    for i in range(N-1):
        if C[i+1][0]<=X[i][1]:
            print("Yes")
            exit()
    print("No")
else:
    print("Yes")


### FIXED CODE ###

class segtree():
    def segfunc(x,y):
        return min(x,y)
    #####単位元######
    ide_ele = -1
    n=1
    init_val=[0]*n
    #num:n以上の最小の2のべき乗
    num =2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    
    def __init__(self,INIT_VAL,SEGFUNC,IDE_ELE):
        self.ide_ele=IDE_ELE
        self.init_val=[i for i in INIT_VAL]
        self.segfunc=SEGFUNC
        self.n=len(self.init_val)
        self.num =2**(self.n-1).bit_length()
        self.seg=[self.ide_ele]*2*self.num

        #set_val
        for i in range(self.n):
            self.seg[i+self.num-1]=self.init_val[i]    
        #built
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self,k,x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self,p,q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res
N,M=map(int,input().split())
Edge=[]
for i in range(M):
    l,r,c=map(int,input().split())
    Edge.append((l-1,r-1,c))
Edge.sort()
INF=10**15
dp=segtree([INF for i in range(N)],min,INF)
dp.update(0,0)
for i in range(M):
    l,r,c=Edge[i]
    dist=dp.query(l,r+1)
    tmp=dp.query(r,r+1)
    dp.update(r,min(tmp,dist+c))
ans=dp.query(N-1,N)
if ans==INF:
    ans=-1
print(ans)
a,b,c,=(int(x) for x in input().split())

if a+b+c<=21:
  print(win)
  
else:
  print(bust)

### FIXED CODE ###

a,b,c,=(int(x) for x in input().split())
 
if a+b+c<=21:
  print("win")
  
else:
  print("bust")
from fractions import gcd 
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    ans=max(ans,gcd(a[:i]+a[i+1:]))
print(ans)

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
L=[0]
R=[0]
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.append(gcd(R[i],a[-1-i]))
MAX=0
for i in range(n):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)
x,a,b = map(int, input().split())
if b-a <= 0:
  print("delicious")
elif b-a =< x:
  print("safe")
else:
  print("dangerous")

### FIXED CODE ###

x,a,b = map(int, input().split())
if b-a <= 0:
  print("delicious")
elif b-a <= x:
  print("safe")
else:
  print("dangerous")
a,b=map(int,input().split())
flag=0
for i in range(1,4):
    if a*b*c%2==1:
        flag=1
if flag==1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b=map(int,input().split())
flag=0
for i in range(1,4):
    if a*b*i%2==1:
        flag=1
if flag==1:
    print("Yes")
else:
    print("No")
x, y = map(int, raw_input.split())



while True:
  if x < y:
     print 'x y'
  elif x > y :
     print 'y x'
  elif x == y:
     print 'x y'
  if x == y == 0:
     break

 

### FIXED CODE ###




while 1:
  x, y = map(int, raw_input().split())
  if x == y == 0:
     break


  if x < y:
     print '%d %d' %(x, y)
  elif x > y :
     print '%d %d' %(y, x)
  elif x == y:
     print '%d %d' %(x, y)
def cross(x, y):
    return (x.conjugate() * y).imag
 
def area_polygon(points):
    area = 0
    n = len(points)
    for i in range(n):
        area += cross(points[i], points[(i+1)%n])
    return area / 2
     
     
import sys
 
p = []
for line in sys.stdin:
    x, y = map(float, line.split(','))
    p.append(x+y*j))
 
print(abs(area_polygon(p)))

### FIXED CODE ###

def op(u,v):
    return (complex.conjugate(u)*v).imag

f = []
while True:
    try:
        st = input().strip().split(',')
        x,y = list(map(float,st ))
        f.append(x + y*1j)
    except EOFError:
        break

s = 0.0
fo = f[0]
for j in range(2,len(f)):
    i = j - 1
    s += op(f[i]-fo,f[j]-fo)/2.0
print("%.6f" % abs(s))
t = input().split())

if t[0] == t[1]:
    print(t[2])
elif t[0] == t[2]:
    print(t[1])
else:
    print(t[0])

### FIXED CODE ###

A,B,C = map(int,input().split())
if A == B: print(C)
elif B == C: print(A)
else: print(B)
def main():
    N,K = map(int,input().split())
    XY = [list(map(int,input().split())) for _ in [0]*N]
    iX = [0]*N
    iY = [0]*N
    for i,xy in enumerate(XY):
        x,y = xy
        iX[i] = x
        iY[i] = y
    iX.sort()
    iY.sort()
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j,cij in enumerate(ci[1:],1):
            ci1[j] += cij

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = K-1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while r<N:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:r+=1

    print(ans)
main()

### FIXED CODE ###

N,K = map(int,input().split())
xy = sorted([list(map(int,input().split())) for _ in range(N)],key = lambda x:(x[0],x[1]))

ans = 10**20

for i in range(K,N+1):
    for j in range(0,N-i+1):
        xy2 = sorted(xy[j:j+i],key = lambda x:(x[1]))
        for k in range(0,i-K+1):
            xy3 = xy2[k:k+K]
            Y_wid = xy3[-1][1] - xy3[0][1]
            x3 = [tmp for tmp,_ in xy3]
            X_wid = max(x3) - min(x3)
            ans = min(ans,X_wid*Y_wid)
print(ans)
n = int(input())
a = [[0,0] for _ in range(n)]

for i in range(n):
    a[i][0],a[i][1]=map(int,input().split())
a.sort()
cnt=0
now=0
temp=1
for i in range(n-1):
    if a[now][0]+a[now][1]>a[now+temp][0]+a[now+temp][1]:
        now+=temp
        cnt+=1
    elif  a[now+temp][0]-a[now+temp][1]<a[now][0]+a[now][1]:
        temp+=1
        cnt+=1
    else:
        now+=temp
        temp=1

print(n-cnt)

### FIXED CODE ###

n = int(input())
a = [[0,0] for _ in range(n)]

for i in range(n):
    a[i][0],a[i][1]=map(int,input().split())
    a[i][0],a[i][1]=(a[i][0]-a[i][1]),(a[i][0]+a[i][1])
a.sort(key=lambda x: x[1])
INF = 10**10
preR = -INF
cnt=0
for L,R in  a:
    if L<preR:
        continue
    cnt+=1
    preR=R
print(cnt)
n = input()
if n == ins[::-1]:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = input()
if n == n[::-1]:
    print("Yes")
else:
    print("No")
from functools import reduce


def modcombination(n, k, mod):
    # nCk % mod
    num = reduce(lambda x, y: x * y % mod, range(n, n - k, -1))
    den = reduce(lambda x, y: x * y % mod, range(1, k + 1))
    return num * pow(den, mod - 2, mod) % mod


if __name__ == '__main__':
    MOD = 10 ** 9 + 7
    x, y = map(int, input().split())
    if (x + y) % 3 != 0:
        print(0)
        exit(0)

    m = (2 * x - y) // 3
    n = x - (2 * m)
    if n < 0 or m < 0:
        print(0)
        exit(0)
    print(modcombination(n + m, n, MOD) % MOD)


### FIXED CODE ###

from functools import reduce


def modcombination(n, k, mod):
    # nCk % mod
    num = reduce(lambda x, y: x * y % mod, range(n, n - k, -1))
    den = reduce(lambda x, y: x * y % mod, range(1, k + 1))
    return num * pow(den, mod - 2, mod) % mod


if __name__ == '__main__':
    MOD = 10 ** 9 + 7
    x, y = map(int, input().split())
    if (x + y) % 3 != 0:
        print(0)
        exit(0)

    m = (2 * x - y) // 3
    n = x - (2 * m)
    if n < 0 or m < 0:
        print(0)
        exit(0)
    if n == 0 or m == 0:
        print(1)
        exit(0)
    print(modcombination(n + m, n, MOD) % MOD)
N = input()
sum = 0

for i in range(N):
    sum += i**2
    
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0

for i in range(N):
    sum += i+1

print(sum)
from itertools import accumulate


def solve(string):
    n, k, *p = map(int, string.split())
    *p, = accumulate((1 + _p) / 2 for _p in p)
    return str(max(p2 - p1 for p1, p2 in zip(p, p[k:])))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


### FIXED CODE ###

from itertools import accumulate


def solve(string):
    n, k, *p = map(int, string.split())
    *p, = accumulate((1 + _p) / 2 for _p in p)
    return str(max(p2 - p1 for p1, p2 in zip(p, p[k:]))) if k < n else str(p[-1])


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
def sum_digits(n):
    r = 0
    while n / 10 >= 1:
        r += n % 10
        n /= 10
    return r




if __name__ == '__main__':
    n = int(input())

    s = sum_digits(n)
    if n % s == 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import math

def sum_digits(n):
    r = 0
    while n / 10 > 0:
        r += n % 10
        n = math.floor(n/10)
    return r


if __name__ == '__main__':
    n = int(input())

    s = sum_digits(n)
    if n % s == 0:
        print('Yes')
    else:
        print('No')
def encode(message): 
    encoded_message = "" 
    i = 0
   
    while (i <= len(message)-1): 
        count = 1
        ch = message[i] 
        j = i 
        while (j < len(message)-1): 
            if (message[j] == message[j+1]): 
                count = count+1
                j = j+1
            else: 
                break
        encoded_message=encoded_message+str(count)+ch 
        i = j+1
    return encoded_message 

def solve():
    s = input()
    t = encode(s).split('L')

    ans = []
    for i in range(len(t)-1):
        l = t[i]
        if int(l[0])-int(l[2]) == 1:
            if int(l[0])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [l[2]] + [l[0]] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [l[0]] + [l[2]] + ['0']*(int(l[2])-1)
        elif int(l[2])-int(l[0]) == 1:
            if int(l[2])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [l[2]] + [l[0]] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [l[0]] + [l[2]] + ['0']*(int(l[2])-1)
        else:
            x = (int(l[0])+int(l[2]))//2
            ans = ans + ['0']*(int(l[0])-1) + [str(x)]*2 + ['0']*(int(l[2])-1)
        

    return ' '.join(ans)

print(solve())

### FIXED CODE ###

S = input()
 
def solve(S):
    buf = [1] * len(S)
 
    for i in range(len(buf) - 2):
        if S[i] == "R" and S[i+1] == "R":
            buf[i+2] += buf[i]
            buf[i] = 0
 
    for i in range(len(buf) - 1, 1, -1):
        if S[i] == "L" and S[i-1] == "L":
            buf[i-2] += buf[i]
            buf[i] = 0
 
    return " ".join(map(str, buf))
 
print(solve(S))
import numpy as np

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]

ans = np.zeros(N + 1)
ans[N] = 1
broken_a = np.zeros(N)
for a_ in a:
    broken_a[a_] = 1
if broken_a[N-1] != 1:
    ans[N - 1] = 1


for i in range(2, N + 1):
    if broken_a[N - i] != 1:
        ans[N - i] = (ans[N - i + 1] + ans[N - i + 2])
    else:
        ans[N - i] = 0
print(int(ans[0] % (10 ** 9 + 7)))



### FIXED CODE ###

N, M=map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10**9 + 7
step = [1]*(N+1)

for a in A:
    step[a]=0
for i in range(2, N+1):
    step[i]=(step[i-1]+step[i-2])%mod*step[i]
print(step[-1])
import numpy as np

n = int(input())
a = np.array(input().split(), dtype=np.int)
b = np.array(input().split(), dtype=np.int)
flag = False
mask = ~np.identity(n, dtype=np.bool)
for i in np.where(a <= b)[0]:
  if np.all(np.sort(a[mask[i]]) <= np.sort(b[mask[i]])):
    flag = True
    break
if flag:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import numpy as np

n = int(input())
a = np.array(input().split(), dtype=np.int)
b = np.array(input().split(), dtype=np.int)
arg = np.argsort(b)
a = a[arg]
b = b[arg]
arg = np.argsort(a)
if np.all(a[arg] <= b):
  i = arg[0]
  cycle_size = 1
  while i != 0:
    i = arg[i]
    cycle_size += 1
  if cycle_size == n and np.all(a[arg[1:]] > b[:-1]):
    print('No')
  else:
    print('Yes')
else:
  print('No')
N = int(input())
P = list(map(int, input().split(' ')))
print(sum(1 for i in range(N) if P[i] <= min(P[0:i])))


### FIXED CODE ###

N = int(input())
P = list(map(int, input().split(' ')))
cnt = 1
j = P[0]
for i in range(1, N):
    j = min(j, P[i])
    if P[i] <= j:
        cnt += 1
print(cnt)
s=input()
t=input()
u=['UNRESTORABLE']
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      for j in range(i,i+len(t)):
        if s[j]=='?':
          m=s[:j]+t[j-i]+s[j+1:]
      m=m.replace('?','a')
      u.append(m)
u.sort()
print(u[0])

### FIXED CODE ###

s=input()
t=input()
u='UNRESTORABLE'
a=[]
if len(s)>=len(t):
  for i in range(len(s)-len(t)+1):
    f=0
    for j in range(i,i+len(t)):
      if s[j]!='?' and s[j]!=t[j-i]:
        f=1
    if f==0:
      m=s[:i]+t+s[i+len(t):]
      m=m.replace('?','a',50)
      a.append(m)
if len(a)==0:
  print(u)
else:
  a.sort()
  print(a[0])