Harryxun/stf_run huggingface dataset:
"""
C - Exam and Wizard
"""
import numpy as np

#メイン処理
if __name__ == '__main__':
    #入力
    n = int(input())
    a = np.array(list(map(int, input().split())))
    b = np.array(list(map(int, input().split())))

    if(np.sum(a) < np.sum(b)):
        print(-1)
        exit()

    c = b - a

    #不足リスト
    cm = c[c > 0]
    #print(cm)
    count = cm.size
    #print(count)
    if(count == 0):
        print(0)
        exit()
    point = np.sum(cm)
    #print('point:{0}'.format(point))

    #あまりリスト
    cp = np.sort(c[c < 0])[::-1]
    #print(cp)

    for i in range(cp.size):
        point = point - cp[i]
        count = count + 1
        if(point < 0):
            #終了
            print(count)
            exit()



### FIXED CODE ###

"""
A - Beginning
"""
#入力処理
def simple_input():
    temp_input = input().rstrip().split(' ')
    if len(temp_input) > 1:
        return temp_input
    return temp_input[0]

#メイン処理
if __name__ == '__main__':
    #入力
    n1,n2,n3,n4 = simple_input()
    n1 = int(n1)
    n2 = int(n2)
    n3 = int(n3)
    n4 = int(n4)   

    result = "NO"

    l = [0,0,0,0,0,0,0,0,0,0]

    l[n1] = 1
    l[n2] = 1
    l[n3] = 1
    l[n4] = 1

    if(l[1]==1 and l[9]==1 and l[7] == 1 and l[4] == 1):
        result = "YES"

    #出力
    print(result)
import numpy as np
N, Q=map(int, input().split())
value=np.array([0]*N)
#各ノードの下につくノード

oya=[-1]*N
for i in range(N-1):
  a,b=map(int, input().split())
  
  oya[b-1]=a-1
  
#adds=[0]*N



for i in range(Q):
  p,x=map(int, input().split())
  value[p-1]+=x

for i in range(N):
  if i >0:
    value[i]+=value[oya[i]]
    ans=value[i]
  else:
    ans=value[i]
  print(ans, end=" ")



### FIXED CODE ###

from collections import deque 
N,Q=map(int, input().split())
G=[[] for _ in range(N)]
for i in range(N-1):
    a,b=map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
X=[0]*N
for i in range(Q):
    p,x=map(int, input().split())
    X[p-1]+=x
que=deque([(0,-1)])
#print(que)
while que:
    now, pre=que.pop()
    for nex in G[now]:
        if nex==pre:
            continue
        else:
            X[nex]+=X[now]
            que.append((nex,now))

print(" ".join(map(str, X)))
def get_primes(n):
    x = [0,0]+[i for i in range(2,n+1)]
    for i in range(int(n**0.5+1)):
        e = x[i]
        if e !=0:
            for j in range(e*2, n+1,e):
                x[j] = 0
    return x

PRIMES = get_primes(100000000)
n = int(input())
c = 0
for i in range(n):
    p = int(input())
    if x[p] == 0:
        c += 1
print c

### FIXED CODE ###

def get_primes(n):
    x = [0,0]+[i for i in range(2,n+1)]
    for i in range(int(n**0.5+1)):
        e = x[i]
        if e !=0:
            for j in range(e*2, n+1,e):
                x[j] = 0
    return filter(None, x)

PRIMES = get_primes(10000)
n = int(input())
c = 0
for i in range(n):
    p = int(input())
    f = 1
    for e in PRIMES:
        if e >= p:
            break
        if p % e == 0:
            f = 0
            break
    c += f
print c
N = int(input())
Alist = list(map(int, input().split()))
Alist = [Alist[i] - (i+1) for i in range(N)]
Alist.sort()

sumlist = []
for i in range(N-1):
    if i < N // 2:
        sumlist.append(- sum(Alist[:i+1]) + sum(Alist[i+1:]) - Alist[i+1] * (N - 2 * (i + 1)))
    else:
        sumlist.append(- sum(Alist[:i+1]) + sum(Alist[i+1:]) + Alist[i] * (N - 2 * (N - i - 1)))
    
print(min(sumlist))


### FIXED CODE ###

N = int(input())
Alist = list(map(int, input().split()))
Alist = [Alist[i] - (i+1) for i in range(N)]
Alist.sort()

b = Alist[N//2]

ans = 0
for i in range(N):
    ans += abs(Alist[i] - b)
print(ans)
n = int(input())
a = list(map(int , input().split()))
b = [a[i] - (i+1) for i in range(n)]
#sa = sum(a)
b.sort()
#print(b)
ans = 10 ** 10
for j in range(3):
    bi = b[n//2+j]
    s = 0
    for i in range(n):
        s += abs(b[i] - bi)
    #print(s)
    ans = min(ans, s)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int , input().split()))
b = [a[i] - (i+1) for i in range(n)]

b.sort()
idx= n//2
bi = b[idx]
ans = 0
for i in range(n):
    ans += abs(a[i] - (i + 1 + bi))
print(ans)
## dijkstraで解く

from collections import deque
import heapq

H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh_, dw_ = map(int, input().split())

fs = []
for i in range(H):
    r = list(input())
    fs.append(r)

INF = 1 << 10
N = 10**4
dps = [[INF]*W for i in range(H)]
dps[ch-1][cw-1] = 0

heapq.heappush(q,(0, (ch-1)*N+(cw-1)))
while q:
    cnt, n  = heapq.heappop(q)
    h,w = divmod(n, N)
    if cnt > dps[h][w]:continue
    dps[h][w] = cnt
    # 歩いた
    for dh in range(-2,3):
        for dw in range(-2,3):            
            hn = h + dh
            wn = w + dw

            if not 0 <= wn < W: continue
            if not 0 <= hn < H: continue
            if fs[hn][wn] == "#": continue
            if dps[hn][wn] != INF:continue
            if abs(dh) + abs(dw) <= 1:
                heapq.heappush(q, (cnt, hn*N+wn))
            else:
                heapq.heappush(q, (cnt+1, hn*N+wn))

ans = dps[dh_-1][dw_-1]
print(ans if ans != INF else -1)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh_, dw_ = map(int, input().split())

fs = []
for i in range(H):
    r = list(input())
    fs.append(r)

walks = [(-1,0),(1,0),(0,1),(0,-1)]
magics = []
for i in range(-2,3):
    for j in range(-2,3):
        if i==j==0:continue
        if (i,j) not in walks:
            magics.append((i,j))

INF = 1 << 50
dps = [[INF]*W for i in range(H)]
dps[ch-1][cw-1] = 0
q = deque([])
q.appendleft((ch-1,cw-1,0))
while len(q)>0:
    h,w,cnt = q.popleft()
    if cnt > dps[h][w]:continue
    dps[h][w] = cnt
    for dh, dw in walks:
        hn = h + dh
        wn = w + dw
        if 0<=hn<H and 0<=wn<W:
            if dps[hn][wn] != INF:continue
            if fs[hn][wn] == ".":
                q.appendleft((hn, wn, cnt))
    for dh, dw in magics:
        hn = h + dh
        wn = w + dw
        if 0<=hn<H and 0<=wn<W:
            if dps[hn][wn] != INF:continue
            if fs[hn][wn] == ".":
                q.append((hn, wn, cnt+1))

ans = dps[dh_-1][dw_-1]
print(ans if ans != INF else -1)
n, q = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

cnt = [0 for i in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x

def dfs(frm, cur):
    cnt[cur] += cnt[frm]
    for to in edges[cur]:
        if frm != to:
            dfs(cur, to)

dfs(-1, 0)
print(*cnt)

### FIXED CODE ###

#138_D
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 6)

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

edges = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    
for _ in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x
    
def dfs(frm, cur):
    for to in edges[cur]:
        if to != frm:
            cnt[to] += cnt[cur]
            dfs(cur, to)
dfs(-1, 0)          
print(*cnt)
n=int(input())
cnt=0
l= list(map(int, input().split()))
l.sort(reverse=True)
k=[[0 for i in range(n-2)] for j in range(n-2)]
for i in range(n-2):
    for j in range(i,n-2):
        k[i][j-i]=-l[i+1]-l[j+2]
#print(k)
for i in range(n-1):
    x=i
    while x<n-2:
        cnt+=bisect.bisect_left(k[x],-l[i])
        #print(l[i],bisect.bisect_left(k[x],-l[i]))
        x+=1
print(cnt)

### FIXED CODE ###

import bisect
n=int(input())
cnt=0
l= list(map(int, input().split()))
l.sort(reverse=True)
k=[[0 for i in range(n-2)] for j in range(n-2)]
for i in range(n-2):
    for j in range(i,n-2):
        k[i][j-i]=-l[i+1]-l[j+2]
#print(k)
for i in range(n-1):
    x=i
    while x<n-2:
        cnt+=bisect.bisect_left(k[x],-l[i])
        #print(l[i],bisect.bisect_left(k[x],-l[i]))
        x+=1
print(cnt)
import functools
import math
N = int(input())
A = [int(i) for i in input().split()]
num = 1
for i in range(len(A)):
  B = A[:i] + A[i+1:]
  g = functools.reduce(math.gcd, B)
  if g > num:
    num = g    
print(num)


### FIXED CODE ###

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

n = t // a
print(n * b)
x,y = map(int,input())
print(x + y //2)

### FIXED CODE ###

x,y = map(int,input().split())
print(x + y //2)
n = int(input())
h = 30000

if n == 3:
    print("2 5 63")
    exit()
if n == 4:
    print("2 5 20 63")
    exit()
if n == 5:
    print("2 5 20 30 63")
    exit()


pret = [2, 3, 4]
it_count = int(n/4)
pret.extend([6*i for i in range(1, it_count)])
pret.extend( [6*i + 2 for i in range(1, it_count)])
pret.extend([6*i +3 for i in range(1, it_count)])
pret.extend(  [6*i + 4 for i in range(1, it_count)])

pret.sort()
ret = pret[:n]


sum_of_ret = sum(ret) % 6
if sum_of_ret == 2:
    ret.remove(8)
    ret.append(6* (it_count))
if sum_of_ret == 3:
    ret.remove(9)
    ret.append(6* (it_count))
if sum_of_ret == 5:
    ret.remove(9)
    ret.append(6* (it_count) + 4)


print(" ".join(list(map(str,ret))))



### FIXED CODE ###

n = int(input())
h = 30000

if n == 3:
    print("2 5 63")
    exit()
if n == 4:
    print("2 5 20 63")
    exit()
if n == 5:
    print("2 5 20 30 63")
    exit()


pret = [2, 3, 4]
it_count = int(n/4) + 1
pret.extend([6*i for i in range(1, it_count)])
pret.extend( [6*i + 2 for i in range(1, it_count)])
pret.extend([6*i +3 for i in range(1, it_count)])
pret.extend(  [6*i + 4 for i in range(1, it_count)])

pret.sort()
ret = pret[:n]


sum_of_ret = sum(ret) % 6
if sum_of_ret == 2:
    ret.remove(8)
    ret.append(6* (it_count))
if sum_of_ret == 3:
    ret.remove(9)
    ret.append(6* (it_count))
if sum_of_ret == 5:
    ret.remove(9)
    if not 6* (it_count - 1) + 4 in ret:
        ret.append(6* (it_count - 1) + 4)
    else:
        ret.append(6* (it_count) + 4)


print(" ".join(list(map(str,ret))))
a,b,c = map(int(), input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+kk*m
print(al)


### FIXED CODE ###

a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)
import math
def String_Sort(str):
    tmp = sorted(str)
    ans = ""
    for i in tmp:
        ans += i
    return ans

def sol(n):
    return math.factorial(n) / 2

# main
li = []
n = int(input())
ans = 0
for i in range(n):
    li.append(String_Sort(input()))
li.sort()
# temporary
str = li[0]
num = 0
for i in li:
    if (i == str):
        num += 1
        continue
    else:
        if num>1:
            ans += sol(num)
        num = 1
        str = i
if (num > 1):
    ans+=sol(num)
print(int(ans))


### FIXED CODE ###

import math
def String_Sort(str):
    tmp = sorted(str)
    ans = ""
    for i in tmp:
        ans += i
    return ans

def sol(n):
    return (n*(n-1))//2

# main
li = []
n = int(input())
ans = 0
for i in range(n):
    li.append(String_Sort(input()))
li.sort()
# temporary
str = li[0]
num = 0
for i in li:
    if (i == str):
        num += 1
        continue
    else:
        if num>1:
            ans += sol(num)
        num = 1
        str = i
if (num > 1):
    ans+=sol(num)
print(ans)
N=int(input())
S=input()

cnt=N
for i in range(N+1):
    if (S[0:i+1].count("#") + S[i+1:N].count(".")) <= cnt:
        cnt = left.count("#") + right.count(".")
print(cnt)

### FIXED CODE ###

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

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)
import sys

N = int(input())

mylist = list(input().split())


for i in range(N-1):
     
    if int(mylist[i+1]) == int(mylist[i]) or int(mylist[i+1]) > int(mylist[i]):
        continue
    elif int(mylist[i+1]) == (int(mylist[i]) -1):
        continue
    else:
        print('No')
        sye.exit()
    
    


print('Yes')

### FIXED CODE ###

import numpy as np

N = int(input())
H = np.array(list(map(int, input().split())))
H[0] -= 1
for i in range(0, N - 1):
    diff = H[i + 1] - H[i]
    if diff >= 1:
        H[i + 1] -= 1
    elif diff < 0:
        print("No")
        exit()
print("Yes")
import sys
from random import randint
from datetime import datetime

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]

def randomize(n):
    return [ randint(1, 26) for _ in range(n) ]

def get_now():
    dt = datetime.now()
    return dt.second + dt.microsecond/1000000

def main():
    start = get_now()
    end = get_now()
    # 開催日数
    D = ii()
    # 満足度の下がりやすさ
    C = lmi()
    # 得られる満足度
    S = lmif(D)
    # 開催するコンテスト
    T = [ randomize(D) ]

    def scoring():
        # 最後に開かれた日付
        last = [0]*26
        score = 0
        for i in range(D):
            score += S[i][T[i]-1]
            last[T[i]-1] = i+1
            for j in range(26):
                score -= C[j] * (i+1 - last[j])
        return score

    max_score = scoring()
    # print(max_score)
    ans = T.copy()
    # a = 0
    while end - start < 1.95:
        idx, value = randint(0, D-1), randint(1, 26)
        old = T[idx]
        T[idx] = value
        score = scoring()
        if max_score < score:
            ans = T.copy()
            max_score = score
        else:
            T[idx] = old
        # if a % 10000 == 0:
        #     print(a, *T, score, max_score)
        # a += 1
        end = get_now()
    print(*ans, sep='\n')

main()


### FIXED CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    for i in range(365):
        print(i%26+1)

main()
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person)-1)


### FIXED CODE ###

N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))
a, b = map(int, input().split())

print(24 % a + b)

### FIXED CODE ###

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

print((a + b) % 24)
#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = round(ans / (gcd(ans, T[i])) * T[i])
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = sorted(list(set([int(input()) for _ in range(N)])))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = (ans * T[i + 2]) // (gcd(ans, T[i + 2]))
    print(ans)

if __name__ == "__main__":
    main()
a,b,c = map(int,input().split())

count = 0
if a%2==1:
  count += 1
if b%2 == 1:
  count += 1
if c%2 == 1:
  count +1
 
print(count)

### FIXED CODE ###

print(input().count("1"))
a=input()
if a<=999:
    print("ABC")
else:
    print("ABD")

### FIXED CODE ###

a=int(input())
if a<=999:
    print("ABC")
else:
    print("ABD")
import sys

letter="abcdefghijklmnopqrstuvwxyz"
While True:
    table=[0]*26
    try:
        input_str=input()
    except:
        break
    for A in input_str:
        index=0
        for B in letter:
            if A == B or A == B.upper():
                table[index] += 1
                break
                index += 1

    for i in range(len(letter)):
        print("%s : %d"%(letter[i],table[i]))



### FIXED CODE ###

letter="abcdefghijklmnopqrstuvwxyz"
table=[0]*26
while True:
    try:
        input_str=input()
    except:
        break
    for A in input_str:
        index=0
        for B in letter:
            if A == B or A == B.upper():
                table[index] += 1
                break
            index += 1

for i in range(len(letter)):
    print("%s : %d"%(letter[i],table[i]))
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class UnionFind:
    def __init__(self, n):
        self.state = [-1] * n
        self.size_table = [1<<i for i in range(n)]
        # cntはグループ数
        # self.cnt = n

    def root(self, u):
        v = self.state[u]
        if v < 0: return u
        self.state[u] = res = self.root(v)
        return res

    def merge(self, u, v):
        ru = self.root(u)
        rv = self.root(v)
        if ru == rv: return
        du = self.state[ru]
        dv = self.state[rv]
        if du > dv: ru, rv = rv, ru
        if du == dv: self.state[ru] -= 1
        self.state[rv] = ru
        # self.cnt -= 1
        self.size_table[ru] |= self.size_table[rv]
        self.size_table[rv]=0
        return

    # グループの要素数
    def size(self, u):
        return self.size_table[self.root(u)]

def main():
    n,k,l=MI()
    road=UnionFind(n)
    train=UnionFind(n)
    for _ in range(k):
        u,v=MI1()
        road.merge(u,v)
    for _ in range(l):
        u,v=MI1()
        train.merge(u,v)
    ans=[bin(road.size(i)&train.size(i)).count("1") for i in range(n)]
    print(*ans)

main()


### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class UnionFind:
    def __init__(self, n):
        self.state = [-1] * n
        #self.size_table = [1<<i for i in range(n)]
        # cntはグループ数
        # self.cnt = n

    def root(self, u):
        v = self.state[u]
        if v < 0: return u
        self.state[u] = res = self.root(v)
        return res

    def merge(self, u, v):
        ru = self.root(u)
        rv = self.root(v)
        if ru == rv: return
        du = self.state[ru]
        dv = self.state[rv]
        if du > dv: ru, rv = rv, ru
        if du == dv: self.state[ru] -= 1
        self.state[rv] = ru
        # self.cnt -= 1
        #self.size_table[ru] |= self.size_table[rv]
        #self.size_table[rv]=0
        return

def main():
    n,k,l=MI()
    road=UnionFind(n)
    train=UnionFind(n)
    for _ in range(k):
        u,v=MI1()
        road.merge(u,v)
    for _ in range(l):
        u,v=MI1()
        train.merge(u,v)
    cnt=defaultdict(int)
    for u in range(n):
        cnt[road.root(u),train.root(u)]+=1
    ans=[cnt[road.root(u),train.root(u)] for u in range(n)]
    print(*ans)

main()
n=input()
a0,v0=n,0
for i in range(n):
  a,v=map(int,raw_input().split())
  if v>v0: a0,v0=a,v
  elif v=v0: a0=min(a0,a)
print a,v

### FIXED CODE ###

n=input()
x=[0]*n
for i in range(n):
  a,v=map(int,raw_input().split())
  x[a-1]=v
m=max(x)
print x.index(m)+1,m
import math
a,b=map(int,input().split())
c=math.gcd(a,b)
ans=a*b/c
print(int(ans))

### FIXED CODE ###

import fractions
a,b=map(int,input().split())
c=fractions.gcd(a,b)
ans=a*b/c
print(int(ans))
from math import gcd

a,b = map(int,input().split())
print(a*b//gcd(a,b))

### FIXED CODE ###

from fractions import gcd

a,b = map(int,input().split())
print(a*b//gcd(a,b))
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))

ans_1 = min(H[np.where(H==H.max())[0].min():]) > max(H)-2

tmp = H[1:] - H[:-1]

ans_2 = all(tmp2 > -2)

print("Yes") if ans_1 & ans_2 else print("No")

### FIXED CODE ###

import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))

tmp_1 = H[np.where(H==H.max())[0].min():]
ans_1 = min(tmp_1) > max(H)-2

tmp2 = H[1:] - H[:-1]

ans_2 = all(tmp2 > -2)

print("Yes") if ans_1 & ans_2 else print("No")
def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if (l[1]-weight)%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)
color[1] = 0
for i in range(1,N+1):
  tree[i] = []
  
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if l[1]%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)

for i in range(1,N+1):
  tree[i] = []
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
  
color[1] = 0
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))
import fractions

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

if k > max(a):
    print("IMPOSSIBLE")
else:
    minak = min(a)
    for i in range(0,n):
        a[i] -= minak

    gcda = fractions.gcd(a[0],a[1])

    for i in range(0,n):
        gcda = fractions.gcd(gcda,a[i])
        if gcda ==1:
            break

    if gcda == 0:
        if k == minak:
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")
    elif gcda == 1 or ((k-minak)) % gcda == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

### FIXED CODE ###

import fractions

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

if k > max(a):
    print("IMPOSSIBLE")
elif n == 1:
    if a[0] == k:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    minak = min(a)

    gcda = fractions.gcd(a[0],a[1])

    for i in range(0,n):
        gcda = fractions.gcd(gcda,a[i])
        if gcda ==1:
            break

    if gcda == 1 or k % gcda == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
import sys
#from bisect import bisect_left as bl
input = sys.stdin.readline

n,Q=map(int,input().split())
xs,qs = [],[]
for _ in range(n):
    s,t,x=map(int,input().split())
    s,t,x=s-x-0.5,t-x-0.5,x
    xs += [(s,1,x), (t,0,x)]
for _ in range(Q):
    qs.append(int(input()))

xs.sort()

h=set()
qi = 0
q = qs[qi]
for t,r,x in xs:
    if q < t:
        if h:
            c = -1
        else:
            c = -1
        while True:
            if q < t:
                print(c)
                Q-=1
                if Q:
                    qi += 1
                    q = qs[qi]
                    continue
                sys.exit()
            break
    if r:
        h.add(x)
    else:
        h.remove(x)
print("-1\n"*Q)


### FIXED CODE ###

a, b = map(int, input().split())
print((a*3 + b)//2)