Harryxun/stf_run huggingface dataset:
X,Y,A,B,C =map(int,input().rstrip().split(" "))
RA = list(map(int,input().rstrip().split(" ")))
GA = list(map(int,input().rstrip().split(" ")))
WA = list(map(int,input().rstrip().split(" ")))
RA.sort()
RA.reverse()
GA.sort()
GA.reverse()
WA.sort()
WA.reverse()
eatRA = X
eatGA = Y
eatWA = 0
ans = 0
RAeatList = RA[:X]
GAeatList = GA[:Y]
while RAeatList[-1] < WA[0] or GAeatList[-1] < WA[0]:
  n= 1
  while RAeatList[-1 * n] == GAeatList[-1 * n] or n == min(X,Y) :
    n -= 1
  if RAeatList[-1 * n] < GAeatList[-1 * n]:
    RAeatList.pop(len(RAeatList) -1)
    RAeatList.insert(0,WA[0])
  else:
    GAeatList.pop(len(RAeatList) -1)
    GAeatList.insert(0,WA[0])
  if len(WA) == 1:
    break
  WA.pop(0)
  if eatWA == C:
    break

for i in range(X):
  ans += RAeatList[i]
for i in range(Y):
  ans += GAeatList[i]
print(ans)

### FIXED CODE ###

X,Y,A,B,C =map(int,input().rstrip().split(" "))
RA = list(map(int,input().rstrip().split(" ")))
GA = list(map(int,input().rstrip().split(" ")))
WA = list(map(int,input().rstrip().split(" ")))
RA.sort()
RA.reverse()
GA.sort()
GA.reverse()
WA.sort()
WA.reverse()
eatRA = X
eatGA = Y
eatWA = 0
ans = 0
while RA[eatRA - 1] < WA[eatWA] or GA[eatGA -1] < WA[eatWA]:
  n= 1
  while RA[eatRA - n] == GA[eatGA -n] and n != min(eatRA,eatGA):
    n += 1
  if RA[eatRA - n] > GA[eatGA - n]:
    eatGA -= 1
  else:
    eatRA -= 1
  eatWA += 1
  if eatWA == C or eatRA == 0 or eatGA == 0:
    break
if eatRA == 0 and eatGA != 0 and eatWA != C:
  while GA[eatGA -1] < WA[eatWA]:
    eatGA -= 1
    eatWA += 1
    if eatWA == C or eatGA == 0:
      break
elif eatRA != 0 and eatGA == 0 and eatWA != C:
  while RA[eatRA -1] < WA[eatWA]:
    eatRA -= 1
    eatWA += 1
    if eatWA == C or eatRA == 0:
      break
for i in range(eatRA):
  ans += RA[i]
for i in range(eatGA):
  ans += GA[i]
for i in range(eatWA):
  ans += WA[i]
print(ans)
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int N; 
long long h[100010];
long long dp[100010];
int main(){
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i] ;
    for (int i = 0; i < N; ++i) dp[i] = INF;
    dp[0] = 0;
    for (int i = 0; i < N; ++i){
        chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        chmin(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
cout << dp[N - 1] << endl;    
    
    
    
    
}

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(1, n - 1):
    dp[i + 1] = min(dp[i - 1] + abs(h[i + 1] - h[i - 1]), dp[i] + abs(h[i + 1] - h[i]))
print(dp[n - 1])
#coding:utf-8
S=input()
n=len(S)-1
answer=0
for i in range(2**n):
  formula=list(S)
  for j in range(n):
    if ((i<<j)&1):
      formula=S.insart("+",j+1)
  for i,elem in enumerate(formula):
    num=""
    if elem=="+" or i==len(formula)-1:
      answer+=int(num)
      num=0
    else:
      num+=elem
print(answer)
    


### FIXED CODE ###

#coding:utf-8
S=str(input())
n=len(S)-1
answer=0
for i in range(2**(n)):
  formula=S[0]
  for j in range(n):
    if ((i>>j)&1):
      formula+="+"
    formula+=S[j+1]
  answer+=sum(map(int,formula.split("+")))
print(answer)
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ans = [1]*n
for i in range(m):
    if h[ab[i][0]-1] == h[ab[i][1]-1]:
        ans[ab[i][0]-1] = 0
        ans[ab[i][1]-1] = 0
    elif h[ab[i][0]-1] > h[ab[i][1]]:
        ans[ab[i][1]-1] = 0
    else:
        ans[ab[i][0]-1] = 0
print(sum(ans))


### FIXED CODE ###

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ans = [1]*n
for i in range(m):
    if h[ab[i][0]-1] == h[ab[i][1]-1]:
        ans[ab[i][0]-1] = 0
        ans[ab[i][1]-1] = 0
    elif h[ab[i][0]-1] > h[ab[i][1]-1]:
        ans[ab[i][1]-1] = 0
    else:
        ans[ab[i][0]-1] = 0
print(sum(ans))
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((len(strs)-1)*9+strs[1])
else:
    print((len(strs)-1)*9+strs[1]-1)

### FIXED CODE ###

n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((len(strs)-1)*9+strs[0])
else:
    print((len(strs)-1)*9+strs[0]-1)
def cakes_and_donuts(N=N):
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

N = int(input())
s = cakes_and_donuts(N)
print(''.format(s))

### FIXED CODE ###

N = int(input())

def cakes_and_donuts(N=N):
  if N % 4 ==0 or N % 7 ==0:
    return 'Yes'  
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

s = cakes_and_donuts(N)
print('{}'.format(s))
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
  txy=list(map(int,input().split(" ")))
  txylist+=txy
if n==1:
  t1,x1,y1=txylist[2]
  if t==abs(x1)+abs(y1):
    p=True
  else:
    print("No")
else:
  for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t=t1-t0
    x=x1-x0
    y=y1-y0
    longs=abs(x)+abs(y)
    if longs==t:
      p=True
    else:
      print("No")
      break
if p==True:
  print("Yes")

### FIXED CODE ###

n=int(input())
txylist=[[0,0,0]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t=t1-t0
    x=x1-x0
    y=y1-y0
    tt=abs(x)+abs(y)
    legs=t-tt
    if legs>=0 and legs%2==0:
        p=True
    else:
        print("No")
        break
if p==True:
    print("Yes")
l = [int(input()) for i in range(5)]
a = []
b = []
c = []
total = 0
for i in l:
    if i % 10 == 0:
        a.append(i)
    else:
        b.append(i)
c.append(b.pop(-1))
for i in b:
    total += i + 10 - i % 10
for i in a:
    total += i
total += c[0]
print(total)

### FIXED CODE ###

l = [int(input()) for i in range(5)]
a = []
b = []
c = []
total = 0
for i in l:
    if i % 10 == 0:
        a.append(i)
    else:
        b.append(i)
minNum = 10
ans = 0
for i in b:
    if i % 10 < minNum:
        minNum = i % 10
        ans = i
if b:
    c.append(ans)
    b.remove(ans)
if a:
    for i in a:
        total += i
if b:
    for i in b:
            total += i + (10 - i % 10)
if c:
    total += c[0]
print(total)
print(cnt)import string
s = input()
t = input()
l = []
alp = string.ascii_lowercase
G = dict([(alp[i],-1) for i in range(len(alp))])
for i in range(len(s)-1,-1,-1):
  l.append(G.copy())
  G[s[i]] = i
l = l[::-1]  
stG = G.copy()

cnt = 0
ind = 0
while ind < len(t): 
  if stG[t[ind]] == -1:
    cnt = -1
    break
  else:
    lind = stG[t[ind]]
    ind += 1
    while l[lind][t[ind]] != -1:   
      lind = l[lind][t[ind]]
      ind += 1
      if ind == len(t):
        break          
    cnt += 1

###    
if cnt != -1:      
  print(cnt*len(s)-(len(s)-(lind+1)))
else:
  print(cnt)  

### FIXED CODE ###

import string
s = input()
t = input()
l = []
alp = string.ascii_lowercase
G = dict([(alp[i],-1) for i in range(len(alp))])
for i in range(len(s)-1,-1,-1):
  l.append(G.copy())
  G[s[i]] = i
l = l[::-1]  
stG = G.copy()

cnt = 0
ind = 0
while ind < len(t): 
  if stG[t[ind]] == -1:
    cnt = -1
    break
  else:
    lind = stG[t[ind]]
    ind += 1
    if ind >= len(t):
      cnt += 1
      break 
    while l[lind][t[ind]] != -1:   
      lind = l[lind][t[ind]]
      ind += 1
      if ind >= len(t):
        break          
    cnt += 1

###    
if cnt != -1:      
  print(cnt*len(s)-(len(s)-(lind+1)))
else:
  print(cnt)
n, k = map(int, input().split())

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

visited = [1]
is_visited = [0] * n
now = 1
step = 0
for i in range(k):
    now = a[now-1]
    step += 1
    if is_visited[now-1] == 0:
        is_visited[now-1] = 1
    else:
        ind = visited.index(now)
        loop = visited[ind:]
        tmp = (k-step) % len(loop)
        now = loop[tmp]
        break

print(now)


### FIXED CODE ###

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

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

visited = [1]
is_visited = [0] * n
now = 1
step = 0
for i in range(k):
    now = a[now-1]
    step += 1
    if is_visited[now-1] == 0:
        is_visited[now-1] = 1
        visited.append(now)
    else:
        ind = visited.index(now)
        loop = visited[ind:]
        tmp = (k-step) % len(loop)
        now = loop[tmp]
        break

print(now)
N,K,X,Y=map(int,input().split(/n))
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)

### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
import math
n = int(input())
l1 = []
l = []
ans = 0
for i in range(n):
    x,y = map(int,input().split())
    l.append(i)
    l1.append((x,y))
per = permutations(l)
for elm in per:
    for i in range(1,len(elm)):
        x=(((l1[elm[i]][0]-l1[elm[i-1]][0])**2)+((l1[elm[i]][1]-l1[elm[i-1]][1])**2))
        ans+=math.sqrt(x)
ans = ans/(math.factorial(n))
print(ans)

### FIXED CODE ###

from itertools import permutations
import math
n = int(input())
l1 = []
l = []
ans = 0
for i in range(n):
    x,y = map(int,input().split())
    l.append(i)
    l1.append((x,y))
per = permutations(l)
for elm in per:
    for i in range(1,len(elm)):
        x=(((l1[elm[i]][0]-l1[elm[i-1]][0])**2)+((l1[elm[i]][1]-l1[elm[i-1]][1])**2))
        ans+=math.sqrt(x)
ans = ans/(math.factorial(n))
print(ans)
N = int(input())
A = list(map(int, input().split()))
A_0 = A[0]
for i in range(N, 0, -1):
    ans = A[i-1]
    for o in range(1, int(i ** 0.5) + 1):
        if i%o == 0:
            A[o-1]  = (A[o-1] + ans)//2
            if o != i//o:
                A[(i//o) - 1] = (A[(i//o) - 1] + ans)//2
if ans[0] != A_0:
    print(-1)
else:
    print(ans.count(1))
    [print(q) for q, w in zip(range(1, N+1), ans) if w == 1]

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
for i in range(N//2+1, 0, -1):
  sum = 0
  for o in range(1, (N//i)+1):
    sum += A[i*o-1]
  A[i-1] = sum%2
  
print(A.count(1))
ans = [str(q) for q,w in zip(range(1, N+1), A) if w == 1]
print(" ".join(ans))
n = int(input())
s_word = list(input())
start_w = s_word[0]
goal_num = 0
for i in range(n-1):
    if s_word[i+1] != start_w:
        start_w = s_word[i+1]
        res += 1
res +=1
print(res)

### FIXED CODE ###

n = int(input())
s_word = list(input())
start_w = s_word[0]
goal_num = 0
for i in range(n-1):
    if s_word[i+1] != start_w:
        start_w = s_word[i+1]
        goal_num += 1
goal_num +=1
print(goal_num)
a =int(input())
B =list(input())

D =[1]


def dfs(x):
    for dx in D:
        C =B[x]
        B[x] = "."
        nx = x + dx
        if nx >= 0 and nx <= a-1 and B[nx] == C:
            dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            dfs(i)
            res += 1
print(res)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

a =int(input())
B =list(input())

def dfs(x):
    
    C =B[x]
    B[x] = "."
    nx = x + 1
    if nx >= 0 and nx <= a-1 and B[nx] == C:
        dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            # Wが残っているならそこから dfs をはじめる
            dfs(i)
            res += 1
print(res)
#1
x,y,z=map(int, input().split())
count=0
for i in range(x,y+1) :
    if i%z==0 :
        count+=1
print(count)

### FIXED CODE ###

#2
n = int(input())
print(int(n**(1/2))**2)
import sys
sys.setrecursionlimit(10000000)
def main():
    N = int(input())
    d = {}
    v = set()
    for _ in range(N-1):
        x, y = map(int, input().split())
        if x in d:
            d[x].append(y)
        else:
            d[x] = [y]
        if y in d:
            d[y].append(x)
        else:
            d[y] = [x]
    w, b = dfs(1, d, v)
    return w + b
def dfs(node, d, v):
    v.add(node)
    l = []
    for i in d[node]:
        if i in v:
            continue
        w, b = dfs(i, d, v)
        l.append((w,b))
    w = 1
    b = 1
    for tw, tb in l:
        w *= (tw + tb)
        b *= tw
    return w, b

print(main() % (10**9 + 7))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
def main():
    N = int(input())
    d = {}
    v = set()
    if N == 1:
        return 2
    for _ in range(N-1):
        x, y = map(int, input().split())
        if x in d:
            d[x].append(y)
        else:
            d[x] = [y]
        if y in d:
            d[y].append(x)
        else:
            d[y] = [x]
    w, b = dfs(1, d, v)
    return w + b
def dfs(node, d, v):
    v.add(node)
    l = []
    for i in d[node]:
        if i in v:
            continue
        w, b = dfs(i, d, v)
        l.append((w,b))
    w = 1
    b = 1
    for tw, tb in l:
        w *= (tw + tb)
        b *= tw
    return w, b

print(main() % (10**9 + 7))
from math import factorial
n,k = map(int, input().split())
mod = 10**9+7
def comb(n,r):
    return factorial(n) // (factorial(r) * factorial(n - r))
# a = comb(n, r)
for i in range(1,k+1):
        a = comb(n-k+1,i)
        b = comb(k-1,i-1)
        print((a*b)%mod)

### FIXED CODE ###

n,k = map(int, input().split())
mod = 10**9+7
from scipy.misc import comb

for i in range(1,k+1):
    print((comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True))%mod)
N = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(0, min(N, len(l)), 2):
  if l[i] % 2 != 0:
    cnt += 1

print(cnt)

### FIXED CODE ###

L, R, d = map(int, input().split())
  
cnt = 0
for i in range(L, R+1, 1):
  if i % d == 0:
    cnt += 1

print(cnt)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*h = list(map(int,read().split()))
h = [0,*h]

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*H = list(map(int,read().split()))
h = [0]
h.extend(H)

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])
n = int(input())
a = list(map(int, input().split()))
a.sort()

ans = 0
for i in range(1, n):
    ans += a[n-int(i/2)]
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

maxval = a[0]
cc = {maxval: 1}

ans = 0
idx = 0

for i in range(1, n):
    if a[i] in cc:
        cc[a[i]] += 2
    else:
        cc[a[i]] = 2
    cc[maxval] -= 1
    ans += maxval
    if cc[maxval] == 0:
        while 1:
            idx += 1
            if maxval > a[idx]:
                maxval = a[idx]
                break

print(ans)
A, B = map(int, input().split())
    capacity = 1
    ans = 0
     
    while True:
      if capacity>=B:
        print(ans)
        break
      capacity += A-1
      ans +=1

### FIXED CODE ###

A, B = map(int, input().split())
capacity = 1
ans = 0

while True:
  if capacity>=B:
    print(ans)
    break
  capacity += A-1
  ans +=1
k = 0
i = 1
 
while k == 1:
   x = input()
   if x != 0:
      print Case i: x
      i =+ 1
   else:
      k = 1

### FIXED CODE ###

i = 0
     
while 1:
   i += 1
   x = input()
   if x == 0:
      break
   else:
      print "Case %d: %d" %(i, x)
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

gone = []

isLooped = False


def dfs(index):
    global isLooped
    if index in gone:
        isLooped = True
        return

    gone.append(index)
    dfs(Alist[index-1])


dfs(1)

last = gone[-1]

if isLooped:
    loopStartIndex = gone.index(Alist[last-1])
    divK = K % len(gone[loopStartIndex:])
    print(Alist[divK])


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = []
ord = [-1 for i in range(n+1)]
v = 1
c = 1
l = 0
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord[v]
l = ord[v]
if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])
def main():
    A, B, C, D, E, F = map(int, input().split())
    ans = 0
    for a in range(F // (A * 100) + 1):
        for b in range((F - 100 * A * a) // (B * 100) + 1):
            for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
                for d in range((F - 100 * A * a - 100 * B * b - C * c) // D + 1):
                    x = a * A + b * B
                    y = c * C + d * D
                    if x == 0:
                        continue
                    if x * E >= y and ans < (100 * y)/(x*100+y):
                        ans = (100 * y)/(x*100+y)
                        sugar = y
                        sugar_water = 100 * x + y
    print(sugar_water,sugar)

if __name__ == "__main__":
    main()

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())

sugar_water = -1
sugar = -1
concentration = -1

for i in range(F//(A*100)+1):
    for j in range((F-A*100*i)//(B*100)+1):
        for k in range((F-A*i*100-B*100*j)//C+1):
            for l in range((F-A*i*100-B*100*j-C*k)//D+1):
                x = i * A + j * B
                y = k * C + l * D
                if x == 0:
                    continue
                if x * E >= y and concentration < (100 * y)/(x*100+y):
                    sugar_water = 100 * x + y
                    sugar = y
                    concentration = (100 * y)/(x*100+y)

print(sugar_water,sugar)
import sys
from collections import Counter
readline = sys.stdin.buffer.readline # 一行読み込み

n=int(input())
s=["".join(readline().rstrip()) for _ in range(n)]
print(s)

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

### FIXED CODE ###

from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')
R,G = map(int, input().split())
print(2*G-R)

### FIXED CODE ###

R = int(input())
G = int(input())
print(2*G-R)
''' 3???????????? '''
def sample(x):
    return x * x * x 

# ??\???
n = input()

print sample(int(n))

### FIXED CODE ###

def sample(n):
    return n * n * n

n = input()
x = sample(n)
print x
# スペース区切りの整数の入力
a, b = map(int, input().split())
#積の定義
ans = a * b
#積の判定
if ans % 2 == 0:
	print(Even)
else
	print(Odd)

### FIXED CODE ###

# スペース区切りの整数の入力
a, b = map(int, input().split())
#積の定義
ans = a * b
#積の判定
if ans % 2 == 0:
  print("Even")
else:
  print("Odd")
import numpy as np
a, b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
gcd = gcd(a, b)

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass, is_prime

ass, is_prime = primes(gcd)
is_prime[1] = True

ans = 0
for p, isprime in enumerate(is_prime):
    
    if p == 0:
        continue
    if is_prime[p] == True and a%p==0 and b%p==0:
#         print(p, isprime)
        ans += 1
print(ans)

### FIXED CODE ###

import numpy as np
a, b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n = gcd(a, b)

table = []
i = 2
while i*i <= n:
    if n%i == 0:
        table.append(i)
        n //= i
    else:
        i += 1
if n > 1:
    table.append(n)

print(len(set(table))+1)
n, q = map(int, input())
tree = {}
for i in range(n):
    a, b = map(int, input())
    tree[b] = a
ans = [0]*n
for i in range(q):
    a, b = map(int)
    ans[a-1] += b
for i in tree:
    ans[i] += ans[tree[i]]
print(ans)

### FIXED CODE ###

from collections import deque

def main():
    n, q = map(int, input().split())
    tree = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    
    ans = [0]*n
    for _ in range(q):
        p, x = map(int, input().split())
        ans[p-1] += x
    
    not_yet = deque([0])
    already = [False]*n
    already[0] = True
    
    while not_yet:
        key = not_yet.popleft()
        for value in tree[key]:
            if already[value]:
                continue
            already[value] = True
            not_yet.append(value)
            ans[value] += ans[key]
    
    print(*ans)

if __name__ == "__main__":
    main()
print(48 -int(input())

### FIXED CODE ###

print( 48 - int(input()) )
NK = list(map(int, input().split()))
P = list(map(int, input().split()))
S =[0] * (NK[0] - NK[1])

for i in range(NK[0] - NK[1]):
    S[i] = (sum(P[i:i+NK[1]]) + NK[1]) / 2

print(max(S))


### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
S =[0] * (N - K + 1)
S[0] = sum(P[0:K])

for i in range(1, N - K + 1):
    S[i] = S[i-1] - P[i-1] + P[i+K-1]

print((max(S) + K) / 2)
N = int(input())

for a in range(1, 10):
    for b in range(1, 10):
        if a * b == N:
            print("Yes")
            sys.exit(0)

print("No")

### FIXED CODE ###

import sys
N = int(input())

for a in range(1, 10):
    for b in range(1, 10):
        if a * b == N:
            print("Yes")
            sys.exit(0)

print("No")
word=input().lower()
how_int=0
while True:
    letters=input()
    if letters=='END_OF_TEXT':
        break
    for i in letters.lower().split():
        if i==word:
            how_in+=1
print(how_in)

### FIXED CODE ###

word=input().lower()
how_in=0
while True:
    letters=input()
    if letters=='END_OF_TEXT':
        break
    for i in letters.lower().split():
        if i==word:
            how_in+=1
print(how_in)
N, M = map(int, input().split(" "))
X = list(map(int, input().split(" ")))
X.sort()
total = X[-1]-X[0]
dif = [X[i+1] - X[i] for i in range(len(X)-1)]
dif.sort()
print(dif)
Y = [0 for i in range(N-1)]
for i in range(N-1):
	Y[i] = dif.pop()
print(total-sum(Y))

### FIXED CODE ###

N, M = map(int, input().split(" "))
X = list(map(int, input().split(" ")))
X.sort()
total = X[-1]-X[0]
dif = [X[i+1] - X[i] for i in range(len(X)-1)]
dif.sort()
Y = [0 for i in range(N-1)]
for i in range(N-1):
  try:
    Y[i] = dif.pop()
  except:
    Y[i]=0
print(total-sum(Y))
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]

ans = 0
for i in range(M):
    ab_list = [[] for i in range(N)]
    for j in range(M):
        if i != j:
            k = ab[j]
            ab_list[k[0] - 1].append(k[1] - 1)
            ab_list[k[1] - 1].append(k[0] - 1)
            
    DFS_list = [0 for j in range(N)]
    DFS_list[i] = 0
    def DFS(v):
        for j in ab_list[v]:
            if DFS_list[j] == 0:
                DFS_list[j] = 1
                DFS(j)
    DFS(i)
    if sum(DFS_list) != N:
        ans += 1
print(ans)


### FIXED CODE ###

def wf(this_graf):
    s = len(graf)
    for k in range(s):
        for i in range(s):
            for j in range(s):
                this_graf[i][j] = min(this_graf[i][j], this_graf[i][k] + this_graf[k][j])
    return this_graf

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
graf = [[10 ** 10 for i in range(n)] for j in range(n)]

for i, j in ab:
    graf[i - 1][j - 1] = 1
    graf[j - 1][i - 1] = 1

import copy
cnt = 0

for i, j in ab:
    this_graf = copy.deepcopy(graf)
    tmp = 0
    this_graf[i - 1][j - 1] = 10 ** 10
    this_graf[j - 1][i - 1] = 10 ** 10
    this_graf = wf(this_graf)
    for i in range(n):
        for j in range(n):
            if this_graf[i][j] == 10 ** 10:
                tmp = 1
                break
        if tmp:
            break
    cnt += tmp

print(cnt)