Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
s=[]
c=[]
for _ in range(M):
    S,C=map(int,input().split())
    s.append(S)
    c.append(C)

num=[10]*N

for i in range(M):
    if s[i]==1 and c[i]==0:
        num="-1"
        break
    elif num[s[i]-1]==10:
        num[s[i]-1]=c[i]
    elif num[s[i]-1]!=10 and num[s[i]-1]!=c[i]:
        num="-1"
        break
for l in range(N):
    if num[l]==10:
        num[l]=0
if num=="-1":
    print(num)
else:
    if num[0]==0:
        num[0]=1
    for j in range(N):
        print(num[j],end="")

### FIXED CODE ###

N,M=map(int,input().split())
s=[]
c=[]
for _ in range(M):
    S,C=map(int,input().split())
    s.append(S)
    c.append(C)

num=[10]*N

for i in range(M):
    if N>1 and s[i]==1 and c[i]==0:
        num="-1"
        break
    elif num[s[i]-1]==10:
        num[s[i]-1]=c[i]
    elif num[s[i]-1]!=10 and num[s[i]-1]!=c[i]:
        num="-1"
        break
if num=="-1":
    print(num)
else:
    for l in range(N):
        if num[l]==10:
            num[l]=0
    if num[0]==0 and N>1:
        num[0]=1
    for j in range(N):
        print(num[j],end="")
n = int(input())
a = list(map(int,input().split()))
if a.index(0) >= 0:
    print(0)
    exit()
ret = 1
for a_ in a:
  ret *= a_
  if ret > 10**18:
    print(-1)
    exit()
print(ret)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)
    exit()
ret = 1
for a_ in a:
    ret *= a_
    if ret > 10**18:
        print(-1)
        exit()
print(ret)
n,k=map(int,input().split())
LIST=list(map(int,input().split()))
kazu=0
for i in LIST:
  if i>=k:
    kazu=kazu+1

print (kazu)


### FIXED CODE ###

n=int(input())
cnt=0
ans=0
for i in range(1,n+1):
  cnt+=1
  if i%2==1:
    ans+=1
    
print(ans/cnt)
import sys
def l(s,n):
    o=ord(s.lower())
    if not 97<=o<=122:
        return s
    if 97<=o+n<=122:
        if 97<=ord(s)<=122:
            return chr(o+n)
        else:
            return chr(o+n).upper()
    elif o+n>122:
        if 97<=ord(s)<=122:
            return chr(o+n-26)
        else:
            return chr(o+n-26).upper()

for t in sys.stdin:
    s=t[:-1]
    u=s.lower()
    for i in range(0,26):
        cv=lambda y:"".join(map(lambda x:l(x,i),y))
        if cv("this") in u or cv("that") in u or cv("the") in u:
            break
    print("".join(map(lambda x:l(x,-i),s)))



### FIXED CODE ###

import sys
def l(s,n):
    o=ord(s.lower())
    if not 97<=o<=122:
        return s
    if 97<=o+n<=122:
        if 97<=ord(s)<=122:
            return chr(o+n)
        else:
            return chr(o+n).upper()
    elif o+n>122:
        if 97<=ord(s)<=122:
            return chr(o+n-26)
        else:
            return chr(o+n-26).upper()
    else:
        if 97<=ord(s)<=122:
            return chr(o+n+26)
        else:
            return chr(o+n+26).upper()

for t in sys.stdin:
    s=t[:-1]
    u=s.lower()
    for i in range(0,26):
        cv=lambda y:"".join(map(lambda x:l(x,i),y))
        if cv("this") in u or cv("that") in u or cv("the") in u:
            break
    print("".join(map(lambda x:l(x,-i),s)))
M = 2147483647
a = [M for i in range(100000*2)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2



### FIXED CODE ###

M = 2147483647
a = [M for i in range(500000)]

def j_min(x,y):
    if x < y:return x
    else: return y

def find(x,y,i,l,r):
    if r<=x or y<=l:return M
    if x<=l and r<=y: return a[i]
    return j_min(find(x,y,i*2,l,(l+r)/2),find(x,y,i*2+1,(l+r)/2,r))

if __name__=='__main__':
    n, m = (int(x) for x in input().split())
    t=1
    while t<n :t *= 2

    for i in range(m-1,-1,-1):
        com,x,y = (int(x) for x in input().split())
        if com :
            #continue
            print(find(x,y+1,1,0,t))
        else:
            x+=t
            a[x]=y
            while isinstance(x, int) or x >= 2:
               a[int(x/2)]=j_min(a[int(x)],a[int(x)^1])
               x/=2
import sys
import numpy as np

# import os
# path = os.getcwd()
# path = os.path.join(path,"input.txt")
# sys.stdin = open(path)

input = sys.stdin.readline
N,W  = map(int,input().split())
dp = np.zeros((N+1,W+1),dtype=int)
w,v = [],[]
for _ in range(N):
    w_,v_ = map(int,input().split())
    w.append(w_)
    v.append(v_)

for row in range(N):
    dp[row+1,:w[row]] = dp[row,:w[row]]
    dp[row+1,w[row]:] = np.maximum(v[row]+dp[row,-w[row]:],dp[row,w[row]])


print(dp[N][-1])

### FIXED CODE ###

import sys
import numpy as np


input = sys.stdin.readline
N,W  = map(int,input().split())
dp = np.zeros((N+1,W+1),dtype=int)
w,v = [],[]
for _ in range(N):
    w_,v_ = map(int,input().split())
    w.append(w_)
    v.append(v_)

for row in range(N):
    dp[row+1,:w[row]] = dp[row,:w[row]]
    dp[row+1,w[row]:] = np.maximum(dp[row,w[row]:],v[row]+dp[row,:-w[row]])
print(dp[N,-1])
MOD = 1000000007
MOD2 = 1000000005

facs = [1 for _ in range(50001)]
inv = [1 for _ in range(50001)]


for i in range(1, 50001):
	facs[i] = (facs[i-1] * i) % MOD
	inv[i] = pow(i, MOD2, MOD)

# print(facs[:10])
# print(inv[:10])


def choose(n, k):
	if k==0 or n==k:
		return 1
	if n==0:
		return 0
	r = (facs[n]*inv[k]) % MOD
	r = (r*inv[n-k]) % MOD
	# print(r)
	return r



def main():
	N, K = map(int, input().split())
	numbers = sorted(map(int, input().split()))
	if K==1:
		return 0
	if K==N:
		return numbers[0] - numbers[-1]

	score = 0
	for i, x in enumerate(numbers):
		s = ((choose(i, K-1) - choose(N-1-i, K-1)) * x)
		score = int((score+s))

	return int(score%MOD)
	
	
print(main())


### FIXED CODE ###

import time
MOD =  1000000007
MOD2 = 1000000005
MAX = 100001

facs = [1 for _ in range(MAX)]
inv = [1 for _ in range(MAX)]


for i in range(1, MAX):
	facs[i] = (facs[i-1] * i) % MOD

for i in range(1, MAX):
	inv[i] = pow(facs[i], MOD2, MOD)


def get_facs(x):
	return facs[x]


def get_inv(x):
	return inv[x]

def choose(n, k):

	if k==0 or n==k:
		return 1
	if n==0:
		return 0
	if k>n:
		return 0
	r = (get_facs(n)*get_inv(k)) % MOD
	r = (r*get_inv(n-k)) % MOD
	return r



def main():
	N, K = map(int, input().split())
	numbers = sorted(map(int, input().split()))
	if K==1:
		return 0
	if K==N:
		return abs(numbers[0] - numbers[-1])

	score = 0
	for i, x in enumerate(numbers):
		score += ((choose(i, K-1) - choose(N-1-i, K-1)) * x)

	return score%MOD
	
	
print(main())
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]=-s[3]:
  print("Bad")
else:
  print("Good")

### FIXED CODE ###

s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")
import time

# success
# https://atcoder.jp/contests/abc151/tasks/abc151_e
# https://blogarithms.github.io/articles/2019-01/fermats-theorem


MOD =  1000000007
MOD2 = 1000000005
MAX = 100001

facs = [1 for _ in range(MAX)]



"""for i in range(1, MAX):
	facs[i] = (facs[i-1] * i) % MOD"""


def get_facs(n, k):
	if k<n-k:
		k = n-k
	r = 1
	for i in range(k+1, n+1):
		r *= i
	for i in range(2, n-k+1):
		r /= i
	return r

def choose(n, k):

	if k==0 or n==k:
		return 1
	if n==0:
		return 0
	if k>n:
		return 0
	return get_facs(n, k)



def main():
	N, K = map(int, input().split())
	numbers = sorted(map(int, input().split()))
	if K==1:
		return 0
	if K==N:
		return abs(numbers[0] - numbers[-1])

	score = 0
	for i, x in enumerate(numbers):
		score += ((choose(i, K-1) - choose(N-1-i, K-1)) * x)

	return int(score%MOD)
	
	
print(main())


### FIXED CODE ###

import time
MOD =  1000000007
MOD2 = 1000000005
MAX = 100001

facs = [1 for _ in range(MAX)]
inv = [1 for _ in range(MAX)]


for i in range(1, MAX):
	facs[i] = (facs[i-1] * i) % MOD

for i in range(1, MAX):
	inv[i] = pow(facs[i], MOD2, MOD)


def get_facs(x):
	return facs[x]


def get_inv(x):
	return inv[x]

def choose(n, k):

	if k==0 or n==k:
		return 1
	if n==0:
		return 0
	if k>n:
		return 0
	r = (get_facs(n)*get_inv(k)) % MOD
	r = (r*get_inv(n-k)) % MOD
	return r



def main():
	N, K = map(int, input().split())
	numbers = sorted(map(int, input().split()))
	if K==1:
		return 0
	if K==N:
		return abs(numbers[0] - numbers[-1])

	score = 0
	for i, x in enumerate(numbers):
		score += ((choose(i, K-1) - choose(N-1-i, K-1)) * x)

	return score%MOD
	
	
print(main())
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
score = 0
num = 0

for i in range(N):
    j = A[i] - 1
    if a[i] == j:
        score += B[j] + C[j-1]
    else:
        score += B[j]
print(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

for i in range(N):
    j = A[i] - 1
    if i > 0 and A[i] - A[i-1] == 1:
        score += B[j] + C[j-1]
    else:
        score += B[j]
print(score)
while True:
    #n,m = list(map(int,input().split()))
    spam = input().split()


    print(1)

### FIXED CODE ###

while True:
    try:
        n,m = list(map(int,input().split()))
        if n == 0 and m == 0:
            break
        amari = n % m
        yasai = list(map(int,input().split())) 
        yasai.sort()

        s = 0
        for i in range(n):
            if (i+1) % m > 0:
                s += yasai[-i-1]
        print(s)
    except:
        pass
l=str(s1s2s3)
print(l.count(1)

### FIXED CODE ###

s=str(input())
print(s.count('1'))
a = int(input())
b = int(input())
h = int(input())  

print(int((a+b)*h/2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())  

print(int((a+b)*h/2))
from itertools import product
H, W, N = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(N)]
count = {}
for x, y in A:
    for xx, yy in product(range(x-1, x+2), range(y-1, y+2)):
        if not(2 <= xx <= H-1 and 2 <= yy <= W-1):
            continue
        count[(xx, yy)] = count.get((xx, yy), 0) + 1
ans = [0] * 10
for k, v in count.items():
    ans[v] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans, sep="\n")


### FIXED CODE ###

from itertools import product

S = tuple(input())
N = len(S)
res = 0
for ops in product(["+", ""], repeat=N-1):
    exp = "".join([n + op for n, op in zip(S, ops+("",))]).strip("+")
    res += eval(exp)
print(res)
import copy

def gcd(n,m):#n,mは正の整数、最大公約数　許容は？
    if n==0:
        return m
    elif m==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)

def longgcd(S):
    if len(S)==2:
        return gcd(S[0],S[1])
    else:
        s=S[len(S)-1]
        S.remove(S[len(S)-1])
        return gcd(s,longgcd(S))

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

m=0

for i in range(0,N):
    B=copy.copy(A)
    B[i]=0
    x=longgcd(B)
    if x>m:
        m=x
print(m)

### FIXED CODE ###

def gcd(n,m):#n,mは正の整数、最大公約数　許容は？
    if n==0:
        return m
    elif m==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)

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

list1=[1 for i in range(0,N)]
list2=[1 for i in range(0,N)]
list1[0]=A[0]
list2[0]=A[N-1]

for i in range(1,N):
    list1[i]=gcd(list1[i-1],A[i])
    list2[i]=gcd(list2[i-1],A[N-1-i])
m=list2[N-2]
for i in range(0,N-2):
    test=gcd(list1[i],list2[N-3-i])
    if test>m:
        m=test
test=list1[N-2]
if test>m:
    m=test
print(m)
w, h, x, y = map(int, input().split())
if w/x > h/y:
    print(x*h/1, '1')
elif w/x == h/y:
    print(x*h/1, '0')
else:
    print(h*y/1, '1')

### FIXED CODE ###

w, h, x, y = map(int, input().split())
if w==2*x and h ==2*y:
    print(w*h/2, 1)
else:
    print(w*h/2, 0)
n,m = [int(i) for i in input().split()]
A=[]
b=[]

for i in range(m):
	A.append([int(j) for j in input().split()])

for i in range(m):
	b.append(int(input()))

for i in range(n):
	s = 0
	for j in range(m):
		s+=A[i][j]*b[j]
print(s)

### FIXED CODE ###

a,b=map(int,input().split())
A=[]
B=[]
for i in range(a):
	A.append([int(j) for j in input().split()])

for i in range(b):
	B.append(int(input()))


for i in range(a):
	s=0
	for j in range(b):
		s+=A[i][j]*B[j]
	print(s)
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
n=[]
for i in range(1,len(x)):  
  for j in range(i,len(x)):
    n.append(abs(x[0]-x[i-1])+abs(x[i]-x[j-1])+abs(x[j]-x[-1]))
print(min(n))

### FIXED CODE ###

n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)
s=set(int(input().split()))
print(len(s))

### FIXED CODE ###

s=set(map(int,input().split()))
print(len(s))
n = int(input())
arr = list(map(int,input().split(" ")))

count = 0
s = 1000000000
add = 0
for num in arr:
  if num < 0:
    count += 1
  s = min(s, abs(num))
  add += abs(num)

print(add-(count%2)*abs(s)*2)

### FIXED CODE ###

l = list(map(int,input().split(" ")))
A = l[0]
B = l[1]
T = l[2]

print((T//A)*B)
N = int(input())
if N % 2 == 1:
  print(((N + 1)/2)/N)
else:
  print((N/2/)N)

### FIXED CODE ###

N = int(input())
if N % 2 == 1:
  print((int(N/2) + 1)/N)
else:
  print(0.5)
N,K = [int(i) for i in input().split()]
H = sorted([int(input()) for i in range(N)])
ans = H[K - 1] - H[0]
for i in range(N - K + 1):
    t = H[K + i - 1] - H[i]
    if ans > t:
        ans = t
print(ans)

### FIXED CODE ###

D = int(input())
if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
import math
map = map(int, raw_input().split())
r = map[0]
area = r*r*math.pi
length = 2*r*math.pi
print "%f %f"%(area, length)

### FIXED CODE ###

from math import pi
r, = map(float, raw_input().split())
area = r**2*pi
length = 2*r*pi
print "%f %f"%(area, length)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static class Point {
		double x;
		double y;
		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
		public String toString() {
			return String.format("%.8f %.8f", x, y);
		}
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		reader.close();		
		getKochCurve(n, new Point(0, 0), new Point(100, 0));
	}

	private static void getKochCurve(int n, Point start, Point end) {
		System.out.println(start);
		getKochCurve(0, n, start, end);
		System.out.println(end);
	}

	private static void getKochCurve(int i, int n, Point start, Point end) {		
		if (i < n) {
			Point firstPoint = getPoint(start, end, 1.0/3.0);
			Point thirdPoint = getPoint(start, end, 2.0/3.0);
			Point secondPoint = getSecondPoint(start, end, firstPoint, thirdPoint);
			getKochCurve(i + 1, n, start, firstPoint);
			System.out.println(firstPoint);
			getKochCurve(i + 1, n, firstPoint, secondPoint);
			System.out.println(secondPoint);
			getKochCurve(i + 1, n, secondPoint, thirdPoint);
			System.out.println(thirdPoint);
			getKochCurve(i + 1, n, thirdPoint, end);
		}
	}

	private static Point getPoint(Point start, Point end, double d) {
		double deltaX = end.x - start.x;
		double deltaY = end.y - start.y;
		deltaX = deltaX * d;
		deltaY = deltaY * d;				
		return new Point(start.x + deltaX, start.y + deltaY);
	}

	private static Point getSecondPoint(Point start, Point end, Point second, Point third) {
		double deltaX = third.x - second.x;
		double deltaY = third.y - second.y;
		double len = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));		
		double x;
		double y;		
		if (deltaY == 0) {
			x = start.x + (end.x - start.x) / 2;
			if (start.x < end.x) {
				y = second.y + Math.sqrt((Math.pow(len, 2) - Math.pow(len / 2.0, 2)));
			} else {
				y = second.y - Math.sqrt((Math.pow(len, 2) - Math.pow(len / 2.0, 2)));
			}
		} else if (start.x < end.x && start.y < end.y) {
			x = start.x;
			y = third.y;
		} else if (start.x < end.x && start.y > end.y) {
			x = end.x;
			y = second.y;
		} else if (start.x > end.x && start.y < end.y) {
			x = end.x;
			y = second.y;
		} else {
			x = start.x;
			y = third.y;
		}
		return new Point(x, y);
	}
}


### FIXED CODE ###

import math
class Point:
	def __init__(self,x,y):
		self.x=x
		self.y=y
	def __str__(self):
		return str(self.x)+' '+str(self.y)
	
def koch(n,a,b):
	if n==0: return
	s=Point(0,0)
	t=Point(0,0)
	u=Point(0,0)
	th=math.pi*60/180
	s.x=(2*a.x+1*b.x)/3
	s.y=(2*a.y+1*b.y)/3
	t.x=(1*a.x+2*b.x)/3
	t.y=(1*a.y+2*b.y)/3
	u.x=(t.x-s.x)*math.cos(th)-(t.y-s.y)*math.sin(th)+s.x
	u.y=(t.x-s.x)*math.sin(th)+(t.y-s.y)*math.cos(th)+s.y
	
	koch(n-1,a,s)
	print(s)
	koch(n-1,s,u)
	print(u)
	koch(n-1,u,t)
	print(t)
	koch(n-1,t,b)

n=int(input())
a=Point(0,0)
b=Point(100,0)
print(a)
koch(n,a,b)
print(b)
a,b = map(int,input().split())
if (a+b)%2 ===0:
  print((a+b)/2)
 else:
  print("IMPOSSIBLE")


### FIXED CODE ###

A,B = map(int,input().split())
 
if (A+B)%2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")
def CountingSort(A, B, k):
    C = [0] * (k+1)
    #C[i] に i の出現数を記録する 
    for j in range(0,k):
        C[A[j]]+=1
    #print("C ",j,C[:k+1])
    #C[i] に i 以下の数の出現数を記録する
    for i in range(1,k+1):
        C[i] = C[i] + C[i-1]
    #print("C' ",j,C[:k+1])
    for j in range(k-1,-1,-1):
        B[C[A[j]]] = A[j]
        C[A[j]]-=1
        #print(j,A[j],C[A[j]],B[C[A[j]]],B,C)

n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
CountingSort(A,B,n)
print(' '.join(map(str,B[1:])))



### FIXED CODE ###

def CountingSort(A, B, k):
    C = [0] * (k+1)
    for i in range(k):
        C[i] = 0
    #C[i] に i の出現数を記録する 
    for j in range(0,n):
        C[A[j]]+=1
    #print("C ",j,C[:100])
    #C[i] に i 以下の数の出現数を記録する
    for i in range(1,k+1):
        C[i] = C[i] + C[i-1]
    #print("C' ",j,C[:100])
    for j in range(n-1,-1,-1):
        B[C[A[j]]] = A[j]
        C[A[j]]-=1
        #print(j,A[j],C[A[j]],B[C[A[j]]],B,C)

n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
CountingSort(A,B,100000)
print(' '.join(map(str,B[1:])))
N, M = [int(i) for i in input().split()]
l = max(N, M)
WA, AC = [0] * l, [False] * l
wa, ac = 0, 0
for i in range(M):
    inp = input().split()
    P, S = int(inp[0]), inp[1]
    if not AC[P] and S == "AC":
        AC[P] = True
        ac += 1
        wa += WA[P]
    elif S == "WA":
        WA[P] += 1
print(ac, wa)


### FIXED CODE ###

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

ac, wa = 0, 0
hist_ac, hist_wa = [0] * N, [0] * N
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if hist_ac[p] == 0:
        if s == "AC":
            hist_ac[p] = 1
            ac += 1
            wa += hist_wa[p]
        else:
            hist_wa[p] += 1
print(ac, wa)
import sys
input = sys.stdin.readline
#sys.setrecursionlimit(100000)
N,Q = map(int,input().split())
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b=map(int,input().split())
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    px = list(map(int,input().split()))
    ans[px[0]] += px[1]

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

N,Q = map(int,input().split())
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b=map(int,input().split())
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    p,x = map(int,input().split())
    ans[p] += x

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])
N=int(input())
A=list(map(int,input().split()))

import fraction
from functools import reduce
from copy import copy

def gcd(*numbers):
    return reduce(fraction.gcd, numbers)

gcds=[]
for i in range(N):
    A_=copy(A)
    A_=pop(i)
    gcds.append(gcd(*A_))

print(max(gcds))


### FIXED CODE ###

A,B,T=map(int,input().split())
print(T//A*B)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

#import numpy as np

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

#print(factorization(a))
prime_a = factorization(a).append(1)
prime_b = factorization(b).append(1)
#print(prime_a, prime_b)
print(1+len(set(prime_a)&set(prime_b)))

### FIXED CODE ###


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

#import numpy as np

a, b = map(int, input().split())
if a==1 and b==1:
    print(1)
else:
    #print(factorization(a))
    prime_a = factorization(a)
    prime_b = factorization(b)
    #print(prime_a, prime_b)
    print(1+len(set(prime_a)&set(prime_b)))
N = int(input())
A = list(map(int, input().split()))

# avg = sum(A) / N
sum_a = sum(a)
ans = float('inf')
ansf = -1
for i, ai in enumerate(A):
    # diff = abs(ai - avg)
    diff = abs(N * ai - sum_a)
    if diff < ans:
        ans = diff
        ansf = i

print(ansf)

### FIXED CODE ###

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

avg = sum(A) / N
ans = float('inf')
ansf = -1
for i, ai in enumerate(A):
    diff = abs(ai - avg)
    if diff < ans:
        ans = diff
        ansf = i

print(ansf)
n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))

    s = itertools.permutations(range(1, n+1))
    l = []
    for v in s:
        l.append(v)
    p_index = l.index(p)
    q_index = l.index(q)

    print(abs(p_index - q_index))


### FIXED CODE ###

import math
import copy


def main():
    n = int(input())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))

    p_order = 1
    q_order = 1

    p_diff = []
    q_diff = []
    p_sort = list(range(1, 9))
    q_sort = list(range(1, 9))

    for i in range(n):
        # 残っている要素の下から何番目かを順番に特定する
        p_diff.append(p_sort.index(p[i]))
        q_diff.append(q_sort.index(q[i]))
        p_sort.remove(p[i])
        q_sort.remove(q[i])

    for i in range(n):
        rest_p = len(p_diff[i+1:]) if i < n else 0
        rest_q = len(q_diff[i+1:]) if i < n else 0
        p_order += p_diff[i] * math.factorial(rest_p)
        q_order += q_diff[i] * math.factorial(rest_q)

    answer = abs(p_order - q_order)
    print(answer)


'''
    while p != []:
        i = 0
        diff = p[i] - min(p)
        if diff > 2:
            p_order += math.factorial(len(p) - 1)
        p.pop(i)
'''

'''
    pq_diff = [p[i] - q[i] for i in range(n)]

    answer = 0
    for i in range(n):
        if pq_diff[i] == 0:
            continue
        answer += (pq_diff[i] - 1) * math.factorial(n-i-1)
    print(answer
'''


if __name__ == "__main__":
    main()
A = int(input())
B = int(input())
C = int(input())
K = int(input())

for _ in range(K):
    if A >= B:
        B = 2*B
    else:
        C = 2*C
        
if C > B > A:
    print('Yes')
else:
  print('No')

### FIXED CODE ###

n = [int(i) for i in input().split()]
K = int(input())

for _ in range(K):
    if n[0] >= n[1]:
        n[1] = n[1] * 2
    else:
        n[2] = 2*n[2]
        

if n[2] > n[1] > n[0]:
    print('Yes')
else:
    print('No')
num = input()

intNum = 0

loop = len(num)
for i in range(loop):
  intNum += int(num)[i]

if intNum % 9 == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

num = input()

intNum = 0

loop = len(num)
for i in range(loop):
  intNum += int(num[i])

if intNum % 9 == 0:
  print('Yes')
else:
  print('No')