Harryxun/stf_run huggingface dataset:
def depth(s, time):
    time += 1
    flag[s] = 1
    d[s] = t
    for i in range(1, n+1):
        if G[s][i] == 1:
            if flag[i] == 0:
                depth(i, time)
                t = f[i]
    f[s] = time + 1
 
n = int(raw_input())
G = [[0 for i in range(n+1)] for j in range(n+1)]
d = [0 for i in range(n+1)]
f = [0 for i in range(n+1)]
 
for i in range(n):
    v = map(int, raw_input().split())
    for j in range(v[1]):
        G[v[0]][v[2+j]] = 1
 
flag = [0 for i in range(n+1)]
for i in range(1, n+1):
    if flag[i] == 0:
        depth(i, max(f))
 
for i in range(1, n+1):
    print(str(i) + " " + str(d[i]) + " " + str(f[i]))

### FIXED CODE ###

def depth(s, time):
    time += 1
    flag[s] = 1
    d[s] = time
    for i in range(1, n+1):
        if G[s][i] == 1:
            if flag[i] == 0:
                depth(i, time)
                time = f[i]
    f[s] = time + 1
 
n = int(raw_input())
G = [[0 for i in range(n+1)] for j in range(n+1)]
d = [0 for i in range(n+1)]
f = [0 for i in range(n+1)]
 
for i in range(n):
    v = map(int, raw_input().split())
    for j in range(v[1]):
        G[v[0]][v[2+j]] = 1
 
flag = [0 for i in range(n+1)]
for i in range(1, n+1):
    if flag[i] == 0:
        depth(i, max(f))
 
for i in range(1, n+1):
    print(str(i) + " " + str(d[i]) + " " + str(f[i]))
a,b=input().split()
if a > b:
  print('GREATER')
elif a == b:
  print('EQUAL')
else:
  print('LESS')

### FIXED CODE ###

a, b = [int(input()) for _ in range(2)]
if a > b:
    print('GREATER')
elif a == b:
    print('EQUAL')
else:
    print('LESS')
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
 score += b[i]
 _order = a[i]
 if order+1 == _order:
   score += c[order - 1]
 order = _orderprint(score)

### FIXED CODE ###

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

score = 0
order = -1

for i in range(n):
  score += b[i]
  _order = a[i]

  if order + 1 == _order:
    score += c[order - 1]
    
  order = _order

print(score)
n,a,b,c = map(int, input().split())
ans = []
number = dict()
number['A'] = a
number['B'] = b
number['C'] = c
query = [input() for i in range(n)]
for i in range(n):
    s = query[i]
    s_1, s_2 = s[0], s[1]
    if number[s_1] == 0 and number[s_2] == 0:
        print("No")
        exit()
    else:
        if number[s_1] > number[s_2]:
            number[s_1] -= 1
            number[s_2] += 1
            ans.append(s_2)
        elif number[s_1] < number[s_2]:
            number[s_2] -= 1
            number[s_1] += 1
            ans.append(s_1)
        else:
            if i == n-1:
                number[s_2] -= 1
                number[s_1] += 1
                ans.append(s_1)
            else:
                if query[i+1] == s_1 + s_2:
                    number[s_2] -= 1
                    number[s_1] += 1
                    ans.append(s_1)
                else:
                    n_1,n_2 = query[i+1]
                    if s_1 in set(n_1,n_2):
                        number[s_2] -= 1
                        number[s_1] += 1
                        ans.append(s_1)
                    else:
                        number[s_1] -= 1
                        number[s_2] += 1
                        ans.append(s_2)

    #print("A:{} B:{} C:{}".format(number['A'],number['B'],number['C']))
print("Yes")
for i in range(n):
    print(ans[i])

### FIXED CODE ###

n,a,b,c = map(int, input().split())
ans = []
number = dict()
number['A'] = a
number['B'] = b
number['C'] = c
query = [input() for i in range(n)]
for i in range(n):
    s = query[i]
    s_1, s_2 = s[0], s[1]
    if number[s_1] == 0 and number[s_2] == 0:
        print("No")
        exit()
    else:
        if number[s_1] > number[s_2]:
            number[s_1] -= 1
            number[s_2] += 1
            ans.append(s_2)
        elif number[s_1] < number[s_2]:
            number[s_2] -= 1
            number[s_1] += 1
            ans.append(s_1)
        else:
            if i == n-1:
                number[s_2] -= 1
                number[s_1] += 1
                ans.append(s_1)
            else:
                if query[i+1] == s_1 + s_2:
                    number[s_2] -= 1
                    number[s_1] += 1
                    ans.append(s_1)
                else:
                    n_1,n_2 = query[i+1]
                    if s_1 in set([n_1,n_2]):
                        number[s_2] -= 1
                        number[s_1] += 1
                        ans.append(s_1)
                    else:
                        number[s_1] -= 1
                        number[s_2] += 1
                        ans.append(s_2)

    #print("A:{} B:{} C:{}".format(number['A'],number['B'],number['C']))
print("Yes")
for i in range(n):
    print(ans[i])
def input_li():
    return list(map(int, input().split()))


def input_int():
    return int(input())


def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


A, B = input_li()
A_LI = [x[0] for x in prime_factorization(A)]
B_LI = [x[0] for x in prime_factorization(B)]
print(len(set(A_LI) & set(B_LI)) + 1)


### FIXED CODE ###

def input_li():
    return list(map(int, input().split()))


def input_int():
    return int(input())


def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


A, B = input_li()
A_SET = set(prime_factorization(A))
B_SET = set(prime_factorization(B))
print(len((A_SET) & set(B_SET)) + 1)
N = int(input())
S = int(input())
max_shurui = 0
for n in range(1,N):
    X, Y = set(S[:n]), set(S[n:])
    max_shurui = max(len(X&Y), max_shurui)
print(max_shurui)

### FIXED CODE ###

N = int(input())
S = input()
max_shurui = 0
for n in range(1,N):
    X, Y = set(S[:n]), set(S[n:])
    max_shurui = max(len(X&Y), max_shurui)
print(max_shurui)
a = int(input())

low, hi = map(int, input().split())

start = a * low//a

boolean = False

while not (start > hi):
  if lo <= start <= hi: 
    boolean = True
    break

if boolean: print("OK")
else: print("NG")

### FIXED CODE ###

a = int(input())

low, hi = map(int, input().split())

start = a * int(low//a)

boolean = False

while not (start > hi):
  if low <= start <= hi: 
    boolean = True
    break
  start += a

if boolean: print("OK")
else: print("NG")
n=int(intput())
cnt=0
for i in range(n+1):
  if i%3!=0:
    if i%5!=0:
      cnt=cnt+i
print(cnt)

### FIXED CODE ###

n=int(input())
cnt=0
for i in range(n+1):
  if i%3!=0:
    if i%5!=0:
      cnt=cnt+i
print(cnt)
# test for NO is correct 
N,A,B= list(map(int,input().split()))
B1 = A^B


from collections import defaultdict
d = defaultdict(list)
for i in range(2**N):
    bits_total = bin(i)[2:].count('1')
    d[bits_total].append(i)
def count_bits(n):
    return bin(n)[2:].count('1')

def int_to_bin(n):
    return list(reversed(list((map(lambda x:x=='1',bin(n)[2:])))))+[0]*N
def bin_to_int(V):
    ans = 0
    for i,val in enumerate(V):
        ans += val *(2 **i)
    return ans

assert bin_to_int([1])==1
assert bin_to_int([0,1])==2

def movable(i):
    res = set()
    for bit_num in range(N):
        if i>= 2**bit_num and bin(i)[2:][-bit_num-1]=='1':
            res.add(i - 2**bit_num)
        else:
            res.add(i+2**bit_num)
    return res

used = set()
i=0
next = -1
used.add(0)
order = [0]
try:
    while len(used) < 2**N:
        next = max(movable(i) - used)
        used.add(next)
        i=next
        order.append(i)
except:
    print("NO")
    exit()

if count_bits(next)!= count_bits(B1):
    print("NO")
    exit()
raise


def find_all(x):
    res = []
    for bit_num in range(N):
        if x>= 2**bit_num and bin(x)[2:][-bit_num-1]=='1':
            res.append(bit_num)
    return res
a= find_all(B1)
b= find_all(next)

def convert(x,p,q):
    V = int_to_bin(x)
    for i in range(len(p)):
        tmp = V[p[i]]
        V[p[i]]=V[q[i]]
        V[q[i]]= tmp
    return bin_to_int(V)

print("YES")
print(" ".join([str(convert(n,a,b) ^A) for n in order]))

### FIXED CODE ###

from collections import defaultdict,Counter

N = int(input())
S=  input()

d=  defaultdict(int)
back = 0
front =1
ans = 1
c= Counter(S)

for i in c:
    ans *= c[i]+1
    ans = ans%(10**9+7)


print(ans-1)
N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if result >= 10**18:
  print("-1")
 else:
  print(result)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
result = 1
 
if 0 in A:
  print(0)
  exit()

for a in A:
  result *= a
  if result > 10**18:
    print(-1)
    exit()

print(result)
N, K = map(int,input().split())
    H = []
    for i in range(N):
        h = int(input())
        H.append(h)
     
    H.sort()
    l = 0
    r = K-1
    from math import inf
    ans = inf
    while r <= N-1:
        sub = H[r] - H[l]
        ans = min(ans, sub)
        r += 1
        l += 1
     
    print(ans)

### FIXED CODE ###

N, K = map(int,input().split())
H = []
for i in range(N):
    h = int(input())
    H.append(h)

H.sort()
l = 0
r = K-1
ans = 10**10
while r <= N-1:
    sub = H[r] - H[l]
    ans = min(ans, sub)
    r += 1
    l += 1

print(ans)
H = input()
W = input()
h = input()
w = input()
tate = H-h
yoko = W-w
print(tate*yoko)

### FIXED CODE ###

import numpy as np
H,W = map(int, input().split())
h,w = map(int, input().split())
print((H-h)*(W-w))
class UnionFind:
    def __init__(self, n):
        self.d = []
        for _ in range(n):
            self.d.append(-1)
    
    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.d[self.find(x)]


N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    uf.union(a,b)
group = set()
for i in range(N):
    group.add(uf.find(i))

print(len(group)-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
class UnionFind:
    def __init__(self, n):
        self.d = []
        for _ in range(n):
            self.d.append(-1)
    
    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.d[self.find(x)]


N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a,b)
group = set()
for i in range(N):
    group.add(uf.find(i))

print(len(group)-1)
a=[];n=input()
for i in range(52):
 a.append("SHCD"[i/13]+" "+str(i%13+1))
 if i<n:a.remove(raw_input())
for i in a:print i

### FIXED CODE ###

j=input();i=52;a=[""]*i
while i:i-=1;a[i]="SHCD"[i/13]+" "+str(i%13+1)
while j:j-=1;a.remove(raw_input())
for i in a:print i
n=int(input())
s=list(input())
cnt=0
for i in range(n-2):
  if s[i]="A" and s[i+1]="B" and s[i+2]="C":
    cnt += 1
print(cnt)

### FIXED CODE ###

n=int(input())
s=list(input())
cnt=0
for i in range(n-2):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    cnt += 1
print(cnt)
n = int(input)
h = n//100
if 100*n <= n <= 105*n:
  print(1)
else:
  print(0)

### FIXED CODE ###

n = int(input())
h = n//100
if 100*h <= n <= 105*h:
  print(1)
else:
  print(0)
3 2 9

### FIXED CODE ###

import math
A, B, T = map(int, input().split())
total = 0
time = math.floor(T + 0.5)
total = B * (math.floor(time / A))
print(total)
def dfs(v,t,f,used,graph):
    if v==t:
        return f
    used[v] = True
    for to in graph[v]:
        c = graph[v][to]
        if used[to] or c==0:
            continue
        d = dfs(to,t,min(f,c),used,graph)
        if d>0:
            graph[v][to] -= d
            graph[to][v] += d
            return d
    return 0

def max_flow(s,t,graph):
    flow = 0
    while True:
        used = [False]*len(graph)
        f = dfs(s,t,float('inf'),used,graph)
        flow += f
        if f==0:
            return flow

H,W = map(int,input().split())

def encode(h,w):
    return h*W+w

def decode(d):
    return (d//W,d%W)

a = [input() for _ in range(H)]
a = [[s for s in a[i]] for i in range(H)]

ans = 10**9
for h in range(H):
    for w in range(W):
        if a[h][w]=='S':
            s = encode(h,w)
            a[h][w]='o'
        if a[h][w]=='T':
            t = encode(h,w)
            a[h][w]='o'

if decode(s)[0]==decode(t)[0] or decode(s)[1]==decode(t)[1]:
    ans = -1

graph = [{} for _ in range(H*W)]

for h in range(H):
    for w in range(W):
        if a[h][w]=='.':
            continue
        for i in range(H):
            if i==h:
                continue
            if a[i][w]=='.':
                continue
            graph[encode(h,w)][encode(i,w)] = 1
            graph[encode(i,w)][encode(h,w)] = 1
        for j in range(W):
            if j==w:
                continue
            if a[h][j]=='.':
                continue
            graph[encode(h,w)][encode(h,j)] = 1
            graph[encode(h,j)][encode(h,w)] = 1

ans = min(ans,max_flow(s,t,graph))
print(ans)

### FIXED CODE ###

def dfs(v,t,f,used,graph):
    if v==t:
        return f
    used[v] = True
    for to in graph[v]:
        c = graph[v][to]
        if used[to] or c==0:
            continue
        d = dfs(to,t,min(f,c),used,graph)
        if d>0:
            graph[v][to] -= d
            graph[to][v] += d
            return d
    return 0
 
def max_flow(s,t,graph):
    flow = 0
    while True:
        used = [False]*len(graph)
        f = dfs(s,t,float('inf'),used,graph)
        flow += f
        if f==0 or f==float('inf'):
            return flow
 
H,W = map(int,input().split())

a = [input() for _ in range(H)]
a = [[s for s in a[i]] for i in range(H)]

graph = [{} for _ in range(H+W+2)]

for h in range(H):
    for w in range(W):
        if a[h][w]=='o':
            graph[h][H+w] = 1
            graph[H+w][h] = 1
        if a[h][w]=='S':
            graph[H+W][h] = float('inf')
            graph[H+W][H+w] = float('inf')
            graph[h][H+W] = 0
            graph[H+w][H+W] = 0
        if a[h][w]=='T':
            graph[H+W+1][h] = 0
            graph[H+W+1][H+w] = 0
            graph[h][H+W+1] = float('inf')
            graph[H+w][H+W+1] = float('inf')

ans = max_flow(H+W,H+W+1,graph)
if ans == float('inf'):
    ans = -1

print(ans)
print((eval(input().replace(" ","%")>0)+0)

### FIXED CODE ###

a, b = map(int,input().split())
if a % b == 0:
  print(0)
elif a < b:
  print(1)
else:
  print(1)
def main():
    #print = out.append
    ''' Cook your dish here! '''
    n = get_int()
    print("?", " ".join(map(str, range(1, 1 + n))), flush=True)
    start = input()
    ptr = 0
    res = ['' for _ in range(2*n)]
    for i in range(2, n+2):
        print("?", " ".join(map(str, range(i, i+n))), flush=True)
        cr = input()
        ptr += 1
        if cr!=start:
            res[ptr-1] = start[0]
            res[ptr + n - 1] = 'R' if res[ptr-1]!='R' else 'B'
            break
    outer = list(range(1, ptr)) + list(range(ptr+n+1, (2*n)+1))
    inner = list(range(ptr+1, ptr + n))
    for i in outer:
        print("?", i, " ".join(map(str, inner)), flush=True)
        res[i-1] = input()[0]
    for i in inner:
        print("?", i, " ".join(map(str, outer)), flush=True)
        res[i-1] = input()[0]
    print("!", "".join(res), flush=True)


''' Coded with love at India by Satyam Kumar '''
import sys
#from collections import defaultdict
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
#print(*out, sep='\n')


### FIXED CODE ###

def main():
    #print = out.append
    ''' Cook your dish here! '''
    x, y = get_list()
    res = 100000 * (4-x) if x<=3 else 0
    res += 100000 * (4-y) if y<=3 else 0
    if x==1 and y==1: res += 400000
    print(res)


''' Coded with love at India by Satyam Kumar '''
import sys
#from collections import defaultdict
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))
rlst=ruiseki(a)
# print(rlst)
lst=[]
for i in range(n+1):
    for j in range(i+1,n+1):
        lst.append(rlst[j]-rlst[i])
# print(lst)
tmp=math.log2(rlst[-1])
now=int(tmp)

while now>=0:
    anslst=[]
    for i in range(len(lst)):
        if 1&(lst[i]>>now)==1:
            anslst.append(lst[i])
    if len(anslst)>=k:
        lst=anslst
    now-=1
# print(lst)
ans=lst[0]
for i in range(k):
    ans=ans&lst[i]
print(ans)

### FIXED CODE ###

import sys
from collections import *
import heapq
import math
# from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
# def input():
#     return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))
rlst=ruiseki(a)
# print(rlst)
lst=[]
for i in range(n+1):
    for j in range(i+1,n+1):
        # print(i,j)
        lst.append(rlst[j]-rlst[i])
# print(lst)
tmp=math.log(rlst[-1],2)
now=int(tmp)

while now>=0:
    anslst=[]
    for i in range(len(lst)):
        if 1&(lst[i]>>now)==1:
            anslst.append(lst[i])
    if len(anslst)>=k:
        lst=anslst
    now-=1
# print(lst)
ans=lst[0]
for i in range(k):
    ans=ans&lst[i]
print(ans)
t = raw_input()
s = t.split()
if s[0] == s[1]:
	print "a == b"
else:
	if int(s[0]) > int(s[1])
		print "a > b"
	else:
		print "a < b"

### FIXED CODE ###

t = raw_input()
s = t.split()
if s[0] == s[1]:
	print "a == b"
else:
	if int(s[0]) > int(s[1]):
		print "a > b"
	else:
		print "a < b"
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [0, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i % MOD)
factX = fact[x]
factY = fact[y]
factN = fact[n]

c = factN * modinv(factX, MOD) * modinv(factY, MOD)
c %= MOD
print(c)


### FIXED CODE ###

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [1, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i % MOD)
factX = fact[x]
factY = fact[y]
factN = fact[n]
# print(x,y,n)
# print(factX,factY,factN)

c = factN * modinv(factX, MOD) * modinv(factY, MOD)
c %= MOD
print(c)
s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)

### FIXED CODE ###

s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[-i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)
import sys
import numpy as np

n = int(input())
a = list(map(int,input().split()))
b = [1 for i in range(n)]
c = [1 for i in range(n-1)]
left = np.diag(b) + np.diag(c,k=1)
left[n-1][0] +=1
g = np.linalg.inv(left)
aa = np.dot(g,a)
aa = [int(aa[i]*2) for i in range(n)]

print(' '.join(map(str, aa)))

### FIXED CODE ###

n = int(input())
dam = list(map(int,input().split()))
mountain =[0]*n
all_water = sum(dam)
def dam_water(num):
  sum_dam = 0
  for i in range(num,n,2):
    sum_dam += dam[i]
  return sum_dam

mountain[0] = all_water - 2 * (dam_water(1))

for i in range(1,n):
  mountain[i] = 2*dam[i-1] - mountain[i-1]

print(" ".join(map(str,mountain)))
number = map(int, input().split())
list1=[]
for i in number:
    list1.append(i)
print(f"{list1[2]} {list1[0]} {list1[1]}")



### FIXED CODE ###

a, b, c = map(int, input().split())
print(c,a,b)
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

G = [[0]*N for i in range(N)]

for i in range(M):
    A, B = list(map(int, input().split()))
    G[A][B] = 1
    G[B][A] = 1

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for j in range(N):
        if (G[i][j] == 1):
            if (self_h <= H[j]):
                self_max_flag = False
        
    if (self_max_flag):
        ans += 1

print(ans)

### FIXED CODE ###

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

G = [[] for i in range(N)]

for i in range(M):
    A, B = list(map(int, input().split()))
    G[A - 1].append(B - 1)
    G[B - 1].append(A - 1)

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for to in G[i]:
        if (self_h <= H[to]):
            self_max_flag = False
        
    if (self_max_flag):
        ans += 1

print(ans)