Harryxun/stf_run huggingface dataset:
def kolorowe_grafy():
    N = wczytaj_liste()[0]
    lista_krawedzi = []
    listy_krawedzi = [[]]
    for i in range(N-1):
        lista_krawedzi.append(wczytaj_liste())
        listy_krawedzi.append([])
    for w1, w2 in lista_krawedzi: 
        listy_krawedzi[w1-1].append(w2)
        listy_krawedzi[w2-1].append(w1)
        
    do_przejrzenia = [1]
    kolory_zabronione = {1: 0}
    indeks_przegladanego = 0 
    kolor_tenczy = {}
    while indeks_przegladanego < len(do_przejrzenia): 
        aktualnie_przegladany = do_przejrzenia[indeks_przegladanego]
        kolor = 1
        if kolor == kolory_zabronione[aktualnie_przegladany]:
            kolor += 1
        for sasiad in listy_krawedzi[aktualnie_przegladany-1]: 
            if sasiad not in kolory_zabronione: 
                kolory_zabronione[sasiad] = kolor
                kolor_tenczy[(aktualnie_przegladany,sasiad)]=kolor
                kolor_tenczy[(sasiad,aktualnie_przegladany)]=kolor
                kolor += 1
                
                if kolor == kolory_zabronione[aktualnie_przegladany]:
                    kolor += 1
                do_przejrzenia.append(sasiad)
        indeks_przegladanego += 1
    maximum = 0
    for w1, w2 in lista_krawedzi:
        maximum = max(kolor_tenczy[(w1,w2)], maximum)
    print(maximum)
    for w1, w2 in lista_krawedzi:
        print(kolor_tenczy[(w1,w2)])

kolorowe_grafy()

### FIXED CODE ###

def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista

def kolorowe_grafy():
    N = wczytaj_liste()[0]
    lista_krawedzi = []
    listy_krawedzi = [[]]
    for i in range(N-1):
        lista_krawedzi.append(wczytaj_liste())
        listy_krawedzi.append([])
    for w1, w2 in lista_krawedzi: 
        listy_krawedzi[w1-1].append(w2)
        listy_krawedzi[w2-1].append(w1)
        
    do_przejrzenia = [1]
    kolory_zabronione = {1: 0}
    indeks_przegladanego = 0 
    kolor_tenczy = {}
    while indeks_przegladanego < len(do_przejrzenia): 
        aktualnie_przegladany = do_przejrzenia[indeks_przegladanego]
        kolor = 1
        if kolor == kolory_zabronione[aktualnie_przegladany]:
            kolor += 1
        for sasiad in listy_krawedzi[aktualnie_przegladany-1]: 
            if sasiad not in kolory_zabronione: 
                kolory_zabronione[sasiad] = kolor
                kolor_tenczy[(aktualnie_przegladany,sasiad)]=kolor
                kolor_tenczy[(sasiad,aktualnie_przegladany)]=kolor
                kolor += 1
                
                if kolor == kolory_zabronione[aktualnie_przegladany]:
                    kolor += 1
                do_przejrzenia.append(sasiad)
        indeks_przegladanego += 1
    maximum = 0
    for w1, w2 in lista_krawedzi:
        maximum = max(kolor_tenczy[(w1,w2)], maximum)
    print(maximum)
    for w1, w2 in lista_krawedzi:
        print(kolor_tenczy[(w1,w2)])

kolorowe_grafy()
import math

N = int(raw_input())

def genprimes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

primes = genprimes(55556)

ans = []
for p in primes:
    if str(p)[-1] == '1':
        ans.append(p)

print(' '.join(map(str, ans[:N])))


### FIXED CODE ###

l = map(int, raw_input().split())
a = l[0]
b = l[1]

if a <= b:
    print(a)
else:
    print(a - 1)
import numpy as np
import fractions

N = int(input())
A = np.array([int(i) for i in (input()).split(" ")])

maxA = np.max(A)

if(maxA == np.min(A)):
    print(maxA)
else:
    check = np.unique(maxA // np.arange(1,maxA))
    #check = minA // np.arange(1,minA)
    for i in check[::-1]:
        #全てのAに対してiで割り切れるか＝最大公約数
        #iで割り切れた数＝len(A)-1なら，残りの数にiをかけて最大公約数に出来る．
        num = np.sum((A % i>0))
        if(num < 2):
            j = A[np.where(A % i>0)][0]
            #print(i,j,i*j//math.gcd(i,j))
            if(i*j//fractions.gcd(i,j) < 10**9):
                print(i)
                break


### FIXED CODE ###

import numpy as np
import fractions

N = int(input())
A = np.array([int(i) for i in (input()).split(" ")])

maxA = np.max(A)


if(maxA == np.min(A)):
    print(maxA)
elif(N==2):
    print(maxA)
else:
    R=np.zeros((N))
    L=np.zeros((N))
    M=np.zeros((N))

    L[0] = 0
    R[N-1] = 0
    for i in range(1,N):
        #0~i-1番目までの最大公約数
        L[i] = fractions.gcd(A[i-1],L[i-1])
        #i~N番
        R[N-1-i] = fractions.gcd(A[N-1-i+1],R[N-1-i+1])

    M[0] = R[0]
    M[-1] = L[-1]
    for i in range(1,N-1):
        M[i] = fractions.gcd(L[i],R[i])

    print("{}".format(int(np.max(M))))
from collections import defaultdict

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

d = defaultdict(int)

for i in range(N):
    d[A[i]] += 1

ans = 0
se = 0
dd = [0 for i in range(3)]
for k, v in d.items():
    value = v // 3 + (v % 3)
    dd[value] += 1
    if value % 3 == 0 or value % 3 == 1:
        ans += 1
    else:
        se += 1

print(ans + ((se//2)*2))

### FIXED CODE ###

from collections import defaultdict

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

d = defaultdict(int)

for i in range(N):
    d[A[i]] += 1

def func(v):
    if v < 3:
        return v
    a = v//3 + v%3

    return func(a)

ans = 0
se = 0
dd = [0 for i in range(3)]
for k, v in d.items():
    value = v // 3 + (v % 3)
    value = func(v)
    # dd[value] += 1
    if value % 3 == 0 or value % 3 == 1:
        ans += 1
    else:
        se += 1

print(ans + ((se//2)*2))
import sys
sys.setrecursionlimit(2*10**5)

N = int(input())  # 頂点数
C = [int(x) - 1  for x in input().split()]  # 頂点の色番号 (1~N) -> (0~N-1)

E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
    
def dfs(u, p = -1):

    color = C[u]  # 色番号
    VC[color].append(u)  # 色ごとに stack しておく
    
    s = 1  # 部分木サイズ（を格納する）
    for v in E[u]:
        if v == p:
            continue
            
        child[u] = 0  # v の方向にある子孫のうち辿れる頂点の数 = s - 子孫にある、同色を根とする部分木のサイズの合計
        ret = dfs(v, u)

        s += ret  # 純粋な部分木のサイズを計算
        child[u] += ret  # 同色の頂点が切り離されたあとの部分木サイズ
        
        ans[color] -= child[u] * (child[u] + 1) // 2        

    VC[color].pop()
    if VC[color]: # 上位に同じ色がある場合
        child[VC[color][-1]] -= s  # 一番近い同色から、自分の部分木の大きさをひく
    else:  # 上位に同じ色がない場合
        root_size[color] -= s  # 上位に残っている頂点の数
        
    return s

child = [0] * N  # 辿っている子の中でのの残り数　とりあえず 0で初期化
root_size = [N] * N  # 根方向に残っている頂点の数（を格納する。操作前は N 全部）
VC = [ [] for _ in range(N)]  # 色番号ごと
ans = [N*(N+1)//2] * N  # 色ごとの（残りの）組み合わせ数　初期値は 全点の組み合わせ

dfs(0)

for i in range(N):
    print(ans[i] - root_size[i] * (root_size[i] + 1) // 2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
 
N = int(input())  # 頂点数
C = [int(x) - 1  for x in input().split()]  # 頂点の色番号 (1~N) -> (0~N-1)
 
E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
    
def dfs(u, p = -1):
 
    color = C[u]  # 色番号
    VC[color].append(u)  # 色ごとに stack しておく
    
    s = 1  # 部分木サイズ（を格納する）
    for v in E[u]:
        if v == p:
            continue
            
        child[u] = 0  # v の方向にある子孫のうち辿れる頂点の数 = s - 子孫にある、同色を根とする部分木のサイズの合計
        ret = dfs(v, u)
 
        s += ret  # 純粋な部分木のサイズを計算
        child[u] += ret  # 同色の頂点が切り離されたあとの部分木サイズ
        
        ans[color] -= child[u] * (child[u] + 1) // 2        
 
    VC[color].pop()
    if VC[color]: # 上位に同じ色がある場合
        child[VC[color][-1]] -= s  # 一番近い同色から、自分の部分木の大きさをひく
    else:  # 上位に同じ色がない場合
        root_size[color] -= s  # 上位に残っている頂点の数
        
    return s

child = [0] * N  # 辿っている子の中でのの残り数　とりあえず 0で初期化
root_size = [N] * N  # 根方向に残っている頂点の数（を格納する。操作前は N 全部）
VC = [ [] for _ in range(N)]  # 色番号ごと
ans = [N*(N+1)//2] * N  # 色ごとの（残りの）組み合わせ数　初期値は 全点の組み合わせ
 
dfs(0)
 
for i in range(N):
    print(ans[i] - root_size[i] * (root_size[i] + 1) // 2)
a,b = map(int,input().split())

d = a // b
r = a % b
f = a / b

print('{} {} {.5f}'.format(d,r,f))

### FIXED CODE ###

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

d = a // b
r = a % b
f = a / b

print('{} {} {:.6f}'.format(d,r,f))
N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tools:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))


### FIXED CODE ###

N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tolls:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))
n = int(input())
an = list(map(int, input().split()))
s = 1
flg = False
for a in an:
  s = s * a
  if s > 10**18 or s< 0:
    flg = True
    break
if 0 in s:
  print(0)
elif flg:
  print(-1)
else:
  print(s)

### FIXED CODE ###

n = int(input())
an = list(map(int, input().split()))
s = 1
flg = False
for a in an:
  s = s * a
  if s > 10**18 or s< 0:
    flg = True
    break
if 0 in an:
  print(0)
elif flg:
  print(-1)
else:
  print(s)
n = int(input())
str = ''
for i in range(1, n+1):
 if i%3 == 0:
  str += " " + str(i)
 elif i%10 == 3:
  str += " " + str(i)
 div = i
 while div//10:
  div = div//10
  if div%10 == 3:
   str += " " + str(div)
   div = 0
print(str)

### FIXED CODE ###

n = int(input())
ans = ''
for i in range(1, n+1):
 if i%3 == 0:
  ans += " " + str(i)
 elif i%10 == 3:
  ans += " " + str(i)
 else:
  div = i
  while div//10:
   div = div//10
   if div%10 == 3:
    ans += " " + str(i)
    div = 0
print(ans)
N, K = map(int, input().split())
A = tuple( map(int, input().split()) )

L = [0 for i in range(N+1)]
L[1] = 1
x = 1
t = 1
while K>0:
  t += 1
  K -= 1
  x = A[x]
  if L[x] != 0:
    p = t - L[x]
    K %= p
    break
  else:
    L[x] = t
    
while K>0:
  x = A[x]
  K -= 1
print(x)

### FIXED CODE ###

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

L = [0 for i in range(N+1)]
L[1] = 1
x = 1
t = 1
while K>0:
  t += 1
  K -= 1
  x = A[x-1]
  if L[x] != 0:
    p = t - L[x]
    K %= p
    break
  else:
    L[x] = t
    
while K>0:
  x = A[x-1]
  K -= 1
print(x)
#use 14x14 paper
paper = [[0 for i in range(14)] for i in range(14)]
while True:
    try:
        x, y, s = map(int, raw_input().split(","))
        x += 2;	y += 2
        if s == 1:
            paper[x][y] += 1
            for i in range(-1,2,2):
                paper[x+i][y] += 1
                paper[x][y+1] += 1
        elif s == 2:
            for i in range(-1,2):
                for j in range(-1,2):
                    paper[x+i][y+j] += 1
        else:
            paper[x+2][y] += 1; paper[x-2][y] += 1
            paper[x][y+2] += 1; paper[x][y-2] += 1
            for i in range(-1,2):
                for j in range(-1,2):
                    paper[x+i][y+j] += 1
    except:
        break

#count white and check max element in paper
white = 0
max = 0
for i in range(2,12):
    for j in range(2,12):
        if paper[i][j] == 0:
            white += 1
	elif paper[i][j] > max:
            max = paper[i][j]
print "%d" % (white)
print "%max" % (max)

### FIXED CODE ###

paper = [[0 for i in range(10)] for j in range(10)]

def drop(x,y):
    global paper
    if 0 <= x < 10 and 0<= y < 10:
        paper[y][x] += 1
    return

def ink(x,y,s):
    drop(x,y)
    drop(x+1,y); drop(x,y+1)
    drop(x-1,y); drop(x,y-1)
    if s == 1: return
    drop(x+1,y+1); drop(x+1,y-1)
    drop(x-1,y+1); drop(x-1,y-1)
    if s == 2: return
    drop(x+2,y); drop(x,y+2)
    drop(x-2,y); drop(x,y-2)
    return

while True:
    try:
        x, y, s = map(int, raw_input().split(","))
        ink(x,y,s)
    except:
        break

print sum([i.count(0) for i in paper])
print max([max(i) for i in paper])
def solve(n, y):
    for man in range(n + 1):
        for gosen in range(n - man + 1):
            sen = n - man - gosen
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print('{} {} {}'.format(man, gosen, sen))
                return
    print("-1 -1 -1")
    return            

#main
n = int(input())
y = int(input())
solve(n, y)




### FIXED CODE ###

def solve(n, y):
    for man in range(n + 1):
        for gosen in range(n - man + 1):
            sen = n - man - gosen
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print('{} {} {}'.format(man, gosen, sen))
                return
    print("-1 -1 -1")
    return            

#main
n, y = map(int, raw_input().split())
solve(n, y)
def make_divisors(n):
    ans=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans+=1
            if i != n // i:
                ans+=1
    return ans

n=input()
ans=0
for i in range(1,n+1):
    if make_divisors(i)==8:
        ans+=1
print(ans)

### FIXED CODE ###

def make_divisors(n):
    ans=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans+=1
            if i != n // i:
                ans+=1
    return ans

n=int(input())
a=0
for i in range(1,n+1,2):
    if make_divisors(i)==8:
        a+=1
print(a)
def gcd(x , y):
    while y != 0:
        x , y = y , x % y
    return x
N = int(input())
A = list(map(int ,input().split()))
max_val = 0
if N == 2:
    print(max(A[1], A[0]))
    exit()
right = []
left = []
work_right = gcd(A[N - 2] , A[N - 1])
right.append(A[N - 1])
work_left = gcd(A[0] , A[1])
left.append(A[0])
for i in range(1 , N - 1):
    work_left = gcd(work_left , A[i])
    left.append(work_left)
    work_right = gcd(work_right , A[N - i - 1])
    right.append(work_right)
#print(right)
#print(left)
right.reverse()
max_val = 0
for i in range(N):
    if i == 0:
        max_val = right[0]
    elif i == N - 1:
        if max_val < left[-1]:
            max_val = left[N]
    else:
        tmp = gcd(right[i] , left[i - 1])
        if tmp > max_val:
            max_val = tmp
print(max_val)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
def gcd(x , y):
    while y != 0:
        x , y = y , x % y
    return x
N = int(input())
A = list(map(int ,input().split()))
max_val = 0
if N == 2:
    print(max(A[1], A[0]))
    exit()
right = []
left = []
work_right = gcd(A[N - 2] , A[N - 1])
right.append(A[N - 1])
work_left = gcd(A[0] , A[1])
left.append(A[0])
for i in range(1 , N - 1):
    work_left = gcd(work_left , A[i])
    left.append(work_left)
    work_right = gcd(work_right , A[N - i - 1])
    right.append(work_right)
#print(right)
#print(left)
right.reverse()
max_val = 0
for i in range(N):
    if i == 0:
        max_val = right[0]
    elif i == N - 1:
        if max_val < left[-1]:
            max_val = left[-1]
    else:
        tmp = gcd(right[i] , left[i - 1])
        if tmp > max_val:
            max_val = tmp
print(max_val)
'''
for i in range(N):
    work = A[:i] + A[i + 1:]
    for j in range(1 , len(work)):
        if j == 1:
            tmp = gcd(work[0],work[1])
        else:
            tmp = gcd(tmp , work[j])
    if max_val < tmp:
        max_val = tmp
print(max_val)
'''
a = raw_input().split(" ")
print a[0]*a[1], (a[0]+a[1])*2

### FIXED CODE ###

n = raw_input()
a = n.split(" ")
b = int(a[0])
c = int(a[1])
print str(b*c)+" "+str((b+c)*2)
h,w,k=map(int,input().split())
x=[]
for i in range(h):
    l=input()
    l2=[]
    for o in range(len(l)):
        l2.append(l[o])
    x.append(l2)
n=2**(h+w)
ans=0
for i in range(n):
    q=i
    num=[0]*(h*w)
    p=0
    while q>0:
        if q%2!=0:
            num[p]=1
        q=q//2
        p+=1
    cnt=0
    for tat in range(h):
        if num[tat]==0:
            for yok in range(w):
                if num[yok+h]==0  and  x[tat][yok]=="#":
                        cnt+=1
    if cnt==k:
        ans+=1
print(ans)


### FIXED CODE ###

h,w,k=map(int,input().split())
x=[]
for i in range(h):
    l=input()
    l2=[]
    for o in range(len(l)):
        l2.append(l[o])
    x.append(l2)
n=2**(h+w)
ans=0
for i in range(n):
    q=i
    num=[0]*(h+w)
    p=0
    while q>0:
        if q%2!=0:
            num[p]=1
        q=q//2
        p+=1
    cnt=0
    for tat in range(h):
        if num[tat]==0:
            for yok in range(w):
                if num[yok+h]==0  and  x[tat][yok]=="#":
                        cnt+=1
    if cnt==k:
        ans+=1
print(ans)
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
l = [0]*(max(A)+1)
for a in A:
  x=0
  while a%2==0:
    a//=2
    x+=1
    
  l[2]=max(l[2],x)
  
  f = 3
  while f**2<=a:
    x = 0
    while a%f==0:
      a//=f
      x+=1
    l[f]=max(l[f],x)
    f+=2
    
  if a!=1:
    l[a]=max(l[a],1)
    
b = 1
for i,x in enumerate(l):
  b*=pow(i,x,mod)
  b%=mod
  
ans = 0
for a in A:
  ans+=(b*pow(a,mod-2,mod))%mod
  ans%=mod
  
print(ans%mod)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
from fractions import gcd
mod = 10**9+7
g = A[0]
for a in A[1::]:
  g = g*a//gcd(g,a)
  
ans = 0
b = g%mod
for a in A:
  ans += g%mod*pow(a,mod-2,mod)
  ans %= mod
  
print(ans%mod)
N,K = map(int, input().split())
l = [input()]
l.sort(reverse = True)
print(sum(l[0::K]))


### FIXED CODE ###

N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
lrev = l[::-1]
print(sum(lrev[:K]))
import itertools
from collections import deque
n=int(input())
edge = [[] for _ in range(n)]
visited = [0]*n
for i in range(n-1):
    a,b=map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
path = []
def dfs(i):
    visited[i]=1
    if(i==n-1):
        return 1
    else:
        for j in edge[i]:
            if(not visited[j]):
                if(dfs(j)):
                    if(i!=0):
                        path.append(i)
                    return i

    return 0



dfs(0)
s = 0
f = 0
visited_new = [-1]*n
path_l = len(path)
for i in range(path_l):
    if(i<(path_l//2)):
        visited_new[path[i]]=1
        s+=1
    else:
        visited_new[path[i]]=2
        f+=1

visited_new[n-1]=3
visited_new[0]=3
que=deque()
que.append(n-1)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==2:continue
        if visited_new[next_v]==1 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            s+=1
que.append(0)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==3:continue
        if visited_new[next_v]==2 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            f+=1

if(f>=s):
    print("Fennec")
else:
    print("Snuke")


### FIXED CODE ###

import itertools
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n=int(input())
edge = [[] for _ in range(n)]
visited = [0]*n
for i in range(n-1):
    a,b=map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
path = []
def dfs(i):
    visited[i]=1
    if(i==n-1):
        return 1
    else:
        for j in edge[i]:
            if(not visited[j]):
                if(dfs(j)):
                    if(i!=0):
                        path.append(i)
                    return i

    return 0



dfs(0)
s = 0
f = 0
visited_new = [-1]*n
path_l = len(path)
for i in range(path_l):
    if(i<(path_l//2)):
        visited_new[path[i]]=1
        s+=1
    else:
        visited_new[path[i]]=2
        f+=1

visited_new[n-1]=3
visited_new[0]=3
que=deque()
que.append(n-1)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==2:continue
        if visited_new[next_v]==1 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            s+=1
que.append(0)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==3:continue
        if visited_new[next_v]==2 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            f+=1
if(f>s):
    print("Fennec")
else:
    print("Snuke")
n = int(input())
a = [int(i) for i in input().split()]

a = sorted(a)

import numpy as np
def getNearestValue(list, num):
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
  
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
ans = 0
for i in range(1,n):
    tmp0 = a[i] / 2
    tmp1 = getNearestValue(a[0:i], check)
    tmp2 = cmb(a[i], tmp1)
    if tmp2 > ans:
        ans = tmp2
        ans1 = a[i]
        ans2 = tmp1
print(ans1, ans2)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# kakomon toku
import math
import sys
import itertools
import numpy as np
 
n = int(input())
a = [int(i) for i in input().split()]
 
#print(a)
a = np.sort(a)
ai = a[n-1]
aj = a[0]
center = ai / 2
diff = ai
i=0
for m in a:
    if diff > abs(m - center) :
        aj = m
        diff = abs(aj - center)
    else:
        break
 
print(ai,aj)
n=int(input())
A=[int(input()) for i in range(n)]
s=0

Z=[]
R=[]
z=0
r=0
for a in A:
  if a==0:
    z+=1
  r+=a
  Z.append(z)
  R.append(r)

for i in range(n-1,-1,-1):
  if Z[i]>=R[i]:
    s+=sum(A[:i+1])
    A=A[i+1:]
    
    break

if A==[]:
  print(s)
  exit()
  
Z=[]
R=[]
z=0
r=0
for a in A[::-1]:
  if a==0:
    z+=1
  r+=a
  Z.append(z)
  R.append(r)
Z=Z[::-1]
R=R[::-1]

for i in range(n):
  if Z[i]>=R[i]:
    s+=sum(A[i:])
    A=A[:i]
    break

if A==[]:
  print(s)
  exit()

for i in range(len(A)):
  if A[i]==0:
    s+=1
    A[i]=1
s0=s

O=[]
E=[]
o=0
e=0
for a in A:
  if a%2==0:
    e+=1
  else:
    o+=1
  E.append(e)
  O.append(o)
l=0
f=0

for i in range(len(A)-1,-1,-1):
  if E[i]>O[i] and f==1:
    s+=O[i]
    A=A[i+1:]

    break
  if A[i]==1:
    f=1
O=[]
E=[]
o=0
e=0
for a in A[::-1]:
  if a%2==0:
    e+=1
  else:
    o+=1
  E.append(e)
  O.append(o)
l=0
f=0
E=E[::-1]
O=O[::-1]
for i in range(len(A)):
  if E[i]>O[i]:
    s+=O[i]
    A=A[i+1:]

    break


O=[]
E=[]
o=0
e=0
for a in A[::-1]:
  if a%2==0:
    e+=1
  else:
    o+=1
  E.append(e)
  O.append(o)
l=0
f=0
E=E[::-1]
O=O[::-1]
for i in range(len(A)):
  if E[i]>O[i]:
    s0+=O[i]
    A=A[i+1:]

    break
O=[]
E=[]
o=0
e=0
for a in A:
  if a%2==0:
    e+=1
  else:
    o+=1
  E.append(e)
  O.append(o)
l=0
f=0

for i in range(len(A)-1,-1,-1):
  if E[i]>O[i] and f==1:
    s0+=O[i]
    A=A[i+1:]

    break
  if A[i]==1:
    f=1
print(min(s,s0)) 

### FIXED CODE ###

n=int(input())
zot=lambda x:0 if x==0 else (x+1)%2+1
A=[int(input()) for i in range(n)]
D=[0,0,0,0,0]

for a in A:
  d0 = D[0] + a
  d1 = min(D[:2])+ [2,1,0][zot(a)]
  d2 = min(D[:3])+ [1,0,1][zot(a)]
  d3 = min(D[:4])+ [2,1,0][zot(a)]
  d4 = min(D) + a
  D=[d0,d1,d2,d3,d4]
print(min(D))
m1,d1 = map(int,input().aplit())
m2,d2= map(int,input().split())
if m1!=m2:print(1)
else: print(0)

### FIXED CODE ###

m1,d1 = map(int,input().split())
m2,d2= map(int,input().split())
if m1!=m2:
  print(1)
else:
  print(0)