Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(x)
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)
b = 1
x = int(input())

while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b < 60:
    b += 1

if (x + b**5)**(1/5) != int((x + b**5)**(1/5)):
    b = -1
    while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b > -60:
        b -= 1

a = int((x + b**5)**(1/5))
print(a, b)

### FIXED CODE ###

x = int(input())

for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == x:
            print(a, b)
            quit()
def f(n):
  if n % 2 == 0:
    return n//2
  else:
    return 3*n + 1


s = int(input())
a = [s]
i = 0
while True:
  s = f(a[i])
  if a in s:
    print(i)
    break
  else:
    a.append(s)
    i += 1


### FIXED CODE ###

def f(n):
  if n % 2 == 0:
    return n//2
  else:
    return 3*n + 1


s = int(input())
a = [s]
i = 0
while True:
  s = f(a[i])
  if s in a:
    print(i+2)
    break
  else:
    a.append(s)
    i += 1
n, k = map(int,input().split())
d = list(map(int,input().split()))

x = 0
y = 0
while x <4:
    if n // (10**x) >0:
        y = x
    x += 1

i = 0
a = [0]
m = 0
while i <= y:
    a.append(((n//(10**(y-i)))%10))
    i +=1

i = 0
while i <= y:
    j = 0
    while j < k:
        if a[y-i+1] == d[j]:
            a[y-i+1] += 1
        if a[y-i+1] == 10:
            a[y-i+1] = 0
            a[y-i] +=1
        j+=1
    i+=1
    if a[0] == 1:
        a[1] = a[2] = a[3] = a[4] = i = 0
        continue

i = 0
while i <= y + 1:
    m += a[y-i+1]*(10**(i))
    i+=1


print(m)

### FIXED CODE ###

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

s = 0
while s<k and s == d[s]:
    s += 1

x = 0
y = 0
while x <4:
    if n // (10**x) >0:
        y = x
    x += 1

i = 0
a = [0]
m = 0
while i <= y:
    a.append(((n//(10**(y-i)))%10))
    i +=1

i = 0
t = 0
while i <= y + t:
    j = 0
    while j < k:
        if a[y-i+1] == d[j]:
            a[y-i+1] += 1
            if y-i+1 < y+1:
                a[y-i+2] = s
        if a[y-i+1] == 10:
            a[y-i+1] = 0
            a[y-i] +=1
        j+=1
    i+=1
    if a[0] == 1 and t == 0:
        i = 1
        while i<=y+1:
            a[i] = 0
            i += 1
        i = 0
        t = 1
        continue

i = 0
while i <= y + t:
    m += a[y-i+1]*(10**(i))
    i+=1


print(m)
import collections
n = int(input())
v = list(map(str, input().split()))
gu_row = [] * (int(n/2))
ki_row = [] * (int(n/2))

for i in range(n):
    if i % 2 == 0:
        gu_row.append(v[i])
    elif i % 2 == 1:
        ki_row.append(v[i])

gu_count = collections.Counter(gu_row).most_common()
ki_count = collections.Counter(ki_row).most_common()


if gu_count[0][0] != ki_count[0][0]:
    ans = n - gu_count[0][1] - ki_count[0][1]
else:
    ans = n - max(gu_count[0][1] + ki_count[1][1], gu_count[1][1] + ki_count[0][1])

print(ans)

### FIXED CODE ###

import collections
n = int(input())
v = list(map(str, input().split()))
gu_row = []
ki_row = []

for i in range(n):
    if i % 2 == 0:
        gu_row.append(v[i])
    elif i % 2 == 1:
        ki_row.append(v[i])

gu_count = collections.Counter(gu_row).most_common()
ki_count = collections.Counter(ki_row).most_common()

if len(gu_count) > 1 and len(ki_count) > 1:
    if gu_count[0][0] != ki_count[0][0]:
        ans = n - gu_count[0][1] - ki_count[0][1]
    elif gu_count[0][0] == ki_count[0][0] and len(gu_count) == 1:
        ans = n - gu_count[0][1] - ki_count[1][1]
    elif gu_count[0][0] == ki_count[0][0] and len(ki_count) == 1:
        ans = n - gu_count[1][1] - ki_count[0][1]
    else:
        ans = n - max(gu_count[0][1] + ki_count[1][1], gu_count[1][1] + ki_count[0][1])
else:
    if gu_count[0][0] != ki_count[0][0]:
        ans = n - gu_count[0][1] - ki_count[0][1]
    else:
        ans = gu_count[0][1]

print(ans)
import itertools
X = int(input())
A = [i for i in range(100, 106)]
num = int(X/100)
if X < 100: print(0)
elif X > 105*num: print(0)
else:
    for comb in itertools.combinations_with_replacement(A, num):
        if X == sum(comb):
            print(1)
            sys.exit()
    print(0)


### FIXED CODE ###

import itertools
import sys
X = int(input())
A = [i for i in range(100, 106)]
num = int(X/100)
if X < 100: print(0)
elif X > 105*num: print(0)
else:
    for comb in itertools.combinations_with_replacement(A, num):
        if X == sum(comb):
            print(1)
            sys.exit()
    print(0)
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
m = 0
d = 0
i = 0
while d <= x:
  d += l[i]
  i += 1
print(i-1)

### FIXED CODE ###

n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = 0
i = 0
c = 0
while d <= x:
  d += l[i]
  i += 1
  if n+1 == i and d <= x:
    c = 1
    break
if c == 1:
  print(n+1)
else:
  print(i-1)
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

# 移動量が最大2から最大Kになっただけ
# でもちょっとめんどい
# K回比較, を適当に関数にしとくことでforで回せるようになるらしい

dp=[float("inf")]*N
dp[0]=0
for i in range(1,N):
    for j in range(K):
        if i>j:
            dp[i] = min(dp[i], dp[i-j-1] + abs(H[i] - H[i-j-1]))
        # print(dp[i])
    print(dp)
print(dp[N-1])

### FIXED CODE ###

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

# 移動量が最大2から最大Kになっただけ
# でもちょっとめんどい
# K回比較, を適当に関数にしとくことでforで回せるようになるらしい

dp=[float("inf")]*N
dp[0]=0
for i in range(1,N):
    for j in range(K):
        if i>j:
            dp[i] = min(dp[i], dp[i-j-1] + abs(H[i] - H[i-j-1]))
        # print(dp[i])
    # print(dp)
print(dp[N-1])
from bisect import bisect_left
N, *A = map(int, open(0).read().split())

INF = 10 ** 6
dp = [INF] * (N + 1)
ans = 0
for i in range(N):
    idx = bisect_left(dp, A[i])
    dp[idx] = A[i]
    ans += 1 if idx == 0 else 0
print(ans)

### FIXED CODE ###

from bisect import bisect
N, *A = map(int, open(0).read().split())

INF = 10 ** 9 + 7
dp = [INF] * (N + 1)
for i in range(N):
    dp[bisect(dp, -A[i])] = -A[i]

print(sum(dp[i] < INF for i in range(N)))
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

M = 0
for l in range(N):
  M += 1/A[l]
print(1/M)

### FIXED CODE ###

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

M = 0
for l in range(N):
  M += 1/A[l]
print(1/M)
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou=>0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou>=0:
  print("Yes")
else:
  print("No")
S = input()
T = input()
n = len(S)
t = len(T)
ans = ''
for i in range(t, n+1):
    flag = True
    for j in range(t):
        if S[-i+j] != '?' and S[-i+j] != T[j]:
            flag = False
            break
    if flag:
        break
if flag:
    for s in S[:-i]:
        if s == '?':
            ans += 'a'
        else:
            ans += s
    ans += T
    if i != t:
        for s in S[-i+t:]:
            if s == '?':
                ans += 'a'
            else:
                ans += s
    print(ans)
else:
    print('UNRESTORABLE')

### FIXED CODE ###

S = input()
T = input()
n = len(S)
t = len(T)
ans = ''
if t > n:
    flag = False
for i in range(t, n+1):
    flag = True
    for j in range(t):
        if S[-i+j] != '?' and S[-i+j] != T[j]:
            flag = False
            break
    if flag:
        break
if flag:
    for s in S[:-i]:
        if s == '?':
            ans += 'a'
        else:
            ans += s
    ans += T
    if i != t:
        for s in S[-i+t:]:
            if s == '?':
                ans += 'a'
            else:
                ans += s
    print(ans)
else:
    print('UNRESTORABLE')
n=int(input())
s=input()
l=[0]*n
for i in range(n-1):
  if s[i]==I:
    l[i+1]=l[i]+1
  else:
    l[i+1]=i[i]-1
print(max(l))
    


### FIXED CODE ###

n=int(input())
s=input()
i=0
m=i
for c in s:
	if c == 'I':
		i+=1
	else:
		i-=1
	m=max(m,i)
print(m)
def root(g):
    return set(g.keys()).difference({y for x in g.values() for y in x}).pop()

def postorder(g):
    parent_stack = [None]
    dfs_stack = [(root(g), None)]            
    while dfs_stack:
        u, prev = dfs_stack.pop()
        dfs_stack.extend((t, u) for d, t in g[u])
        while parent_stack[-1] != prev:
            yield parent_stack.pop()
        parent_stack.append(u)
    while parent_stack[-1] is not None:
        yield parent_stack.pop()

from sys import stdin
from collections import defaultdict
readline = stdin.readline


n = int(readline())
g = defaultdict(list)
for _ in range(n - 1):
    s, t, d = map(int, readline().split())
    g[s].append((d, t))
diameter = []
dp = [0] * n
for i in postorder(g):
    if len(g[i]) == 0:
        continue
    candidate = sorted(d + dp[t] for d, t in g[i])
    dp[i] = candidate[-1]
    diameter.append(dp[i] if len(g[i]) == 1 else sum(candidate[-2:]))

print(max(diameter))

### FIXED CODE ###

def postorder(g):
    parent_stack = []
    dfs_stack = [(0, None)]            
    while dfs_stack:
        u, prev = dfs_stack.pop()
        dfs_stack.extend((t, u) for d, t in g[u])
        while parent_stack and parent_stack[-1] != prev:
            yield parent_stack.pop()
        parent_stack.append(u)
    while parent_stack:
        yield parent_stack.pop()

from sys import stdin
from collections import defaultdict
readline = stdin.readline

n = int(readline())
g = defaultdict(list)
for _ in range(n - 1):
    s, t, d = map(int, readline().split())
    g[s].append((d, t))
diameter = [0]
dp = [0] * n
for i in postorder(g):
    if len(g[i]) == 0:
        continue
    candidate = sorted(d + dp[t] for d, t in g[i])
    dp[i] = candidate[-1]
    diameter.append(dp[i] if len(candidate) == 1 else sum(candidate[-2:]))

print(max(diameter))
a=list(input())
a.sort()
print(int(a[0])+int(a[1]))

### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1])
import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
vs = [int(x) for x in input().rstrip('\n').split()]
g = []
rest = K
for k in [K-1,K]:
  for b in range(K//2):
    t = k-b
    if t>N:
      t=N
    for i in range(t+1):
      v = []
      if i <t:
        v.extend(vs[:i])
        v.extend(vs[-(t-i):])
        for _ in range(b):
          if min(v)<0:
            v.remove(min(v))
          else:
            break
      else:
        v.extend(vs[:t])
        for _ in range(b):
          if min(v)<0:
          	v.remove(min(v))
      g.append(sum(v))
print(max(g))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
vs = [int(x) for x in input().rstrip('\n').split()]
g = [vs[0],vs[-1]]
rest = K
for k in [K-1,K]:
  for b in range(K//2):
    t = k-b
    if t>N:
      t=N
    for i in range(t+1):
      v = []
      if i <t:
        v.extend(vs[:i])
        v.extend(vs[-(t-i):])
        for _ in range(b):
          if min(v)<0:
            v.remove(min(v))
          else:
            break
      else:
        v.extend(vs[:t])
        for _ in range(b):
          if min(v)<0:
          	v.remove(min(v))
      g.append(sum(v))
if max(g)<0:
  print(0)
else:
  print(max(g))
N=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)

### FIXED CODE ###

N=int(input())
d=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)
N=int(input())
X=input()
num_X = int(X, base=2)
pop_x = X.count("1")
mod1 = pop_x - 1
mod0 = pop_x + 1
res1 = num_X % (mod1)
res0 = num_X % (mod0)

pops = [0]*(N+20)
for i in range(N):
    tmp = 0
    if X[i] == "0":
        # +
        tmp = (res0 + pow(2, N-i-1, mod0))%mod0
    else:
        tmp = (res1 - pow(2, N-i-1, mod1))%mod1
    
    if tmp == 0:
        print(1)
        continue
    cnt = 1
    while tmp != 0:
        if not pops[tmp]:
            pop = bin(tmp).count("1")
            pops[tmp] = pop
        else:
            pop = pops[tmp]

        tmp %= pop
        cnt += 1
    print(cnt)

### FIXED CODE ###

N=int(input())
X=input()
num_X = int(X, base=2)
pop_x = X.count("1")
if pop_x <= 1:
    mod0 = pop_x + 1
    res0 = num_X % mod0
else:
    mod1 = pop_x - 1
    mod0 = pop_x + 1
    res1 = num_X % (mod1)
    res0 = num_X % (mod0)

# pops = [0]*(N+20)
for i in range(N):
    tmp = 0
    if X[i] == "0":
        # +
        tmp = (res0 + pow(2, N-i-1, mod0))%mod0
    else:
        if pop_x == 1:
            print(0)
            continue
        tmp = (res1 - pow(2, N-i-1, mod1))%mod1
    
    if tmp == 0:
        print(1)
        continue
    cnt = 1
    while tmp != 0:
        pop = bin(tmp).count("1")
        tmp %= pop
        cnt += 1
    print(cnt)
N = int(input())
AN = list(map(int, input().split()))

AN2 = AN[AN % 2 == 0]
(AN % 2 == 0).size
if AN2[AN2 % 3 == 0].size + AN2[AN2 % 5 ==0].size - AN2[AN2 % 15 ==0].size == AN2.size :
    print('APPROVED')

else:
    print('DENIED')


### FIXED CODE ###

import numpy as np


N = int(input())
AN = list(map(int, input().split()))
AN = np.array(AN)

AN2 = AN[AN % 2 == 0]

if AN2[AN2 % 3 == 0].size + AN2[AN2 % 5 ==0].size - AN2[AN2 % 15 ==0].size == AN2.size :
    print('APPROVED')

else:
    print('DENIED')
a, p = map(int(), input())

print((a*3 + p) // 2)

### FIXED CODE ###

a, p = map(int, input().split())
print(int((3*a+p)/2))
def combination(n, r):  # nCrを求める
    r = min(n - r, r)
    result = 1
    for i in range(n, n - r, -1):
        result *= i
    for i in range(1, r + 1):
        result //= i
    return result


n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)
ans1 = v[:a]/a
num1 = v[:a].count(v[a-1])
num2 = v[a:n].count(v[a-1])

ans2 = 0
if v[0] == v[a]:
    for i in range(a,n):
        if v[i] == v[a-1]:
            idx = i + 1
    for i in range(a,min(b,idx) + 1):
        ans2 += combination(num1 + num2, i)
else:
    ans2 = combination(num1 + num2,num1)
    
print(ans1)
print(ans2)

### FIXED CODE ###

def combination(n, r):  # nCrを求める
    r = min(n - r, r)
    result = 1
    for i in range(n, n - r, -1):
        result *= i
    for i in range(1, r + 1):
        result //= i
    return result


n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)
ans1 = sum(v[:a])/a
num1 = v[:a].count(v[a-1])
num2 = v[a:n].count(v[a-1])

ans2 = 0
if v[0] == v[a]:
    for i in range(a,n):
        if v[i] == v[a-1]:
            idx = i + 1
    for i in range(a,min(b,idx) + 1):
        ans2 += combination(num1 + num2, i)
else:
    ans2 = combination(num1 + num2,num1)

print(ans1)
print(ans2)
N, M = map(int, input().split(" "))
height = list(map(int, input().split(" ")))
flag = [1 for i in height]
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  elif height[b - 1] > height[a - 1]:
    flag[a - 1] = 0
  else:
    flag[a - 1] = 0
    flag[b - 1] = 0
print(sum(flag))

### FIXED CODE ###

s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
from sys import stdin
import numpy as np

def main(args):
    r = args[0]
    d = args[1]
    x = args[2]
    ar = np.zeros([10], dtype=int)

    ar[0] = r*x-d
    for i in range(1,len(ar)):
        ar[i] = r*ar[i-1]-d

    for i in ar:
        print(i)

if __name__ == "__main__":
    main([int(x) for x in stdin.readline().rstrip().split()])

### FIXED CODE ###

import numpy as np
from sys import stdin
#sys.setrecursionlimit(10**6) 

def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

if __name__ == "__main__":
    main()
ss = str(input())
t  = str(input())

for i in range(len(ss)):

    if ss == t :
        print("Yes")
        exit(0)

    s  = list(ss)

    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]
       
        ss = ss.replace(c1 ,"-")
        ss = ss.replace(c2 ,c1 )
        ss = ss.replace("-",c2 )
        print(ss)

print("No")

### FIXED CODE ###

s  = list(str(input()))
t  = list(str(input()))

sd = {}
td = {}

for k in range(ord('a'),ord('z')+1):   
    sd[chr(k)] = 0
    td[chr(k)] = 0

for i in range(len(s)) :
    if s[i] in sd :
        sd[s[i]] = sd[s[i]] + 1

    if t[i] in td :
        td[t[i]] = td[t[i]] + 1
""" 
for k in range(ord('a'),ord('z')+1):   
    print(str(chr(k)) + ":",end="")
    if chr(k) in sd :
        print(str(sd[chr(k)]) + " ",end="")
    else:
        print("0 ",end="")
print()
for k in range(ord('a'),ord('z')+1):   
    print(str(chr(k)) + ":",end="")
    if chr(k) in td :
        print(str(td[chr(k)]) + " ",end="")
    else:
        print("0 ",end="")
print() """

ta = []
sa = []
for k in range(ord('a'),ord('z')+1):
    if td[chr(k)] != sd[chr(k)] : 
        if td[chr(k)] > 0 :
            ta.append(td[chr(k)])
        if sd[chr(k)] > 0 :    
            sa.append(sd[chr(k)])
#print(ta)
#print(sa)

ta.sort()
sa.sort()

if ta == sa :
    print("Yes")
else :
    print("No")
k[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
s=input()
print(k[s-1])

### FIXED CODE ###

k=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
s=int(input())
s=s-1
print(k[s])
b,c=map(int,input().split())
a=list(map(int,input().split()))
d=sum(a)
new_a=sorted(a)
e=-1
f=0
g=4*c

while new_a[e] >= d/g:
    e=e-1
    f=f+1

if f >= c:
    print("Yes")
else :
    print("No")

### FIXED CODE ###

b,c=map(int,input().split())
a=list(map(int,input().split()))
d=sum(a)
new_a=sorted(a)
e=-1
f=0
g=4*c

while new_a[e] >= d/g:
    e=e-1
    f=f+1
    if -e>b:
        break

if f >= c:
    print("Yes")
else :
    print("No")
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input()) + 1

print(a[k])

### FIXED CODE ###

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input()) -1

print(a[k])
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
v = [[] for _ in range(N)]
for _ in range(N-1) :
    a, b = map(int, input().split())
    v[a-1].append(b-1)
    v[b-1].append(a-1)
    
visited = [False] * N
visited[0] = True
parent = [[] for _ in range(N)]

def bfs(cur, par) :
    parent[cur] = [cur] + par
    for nex in v[cur] :
        if not visited[nex] :
            visited[nex] = True
            bfs(nex, parent[cur])

bfs(0, [])

pq = [0 for _ in range(N)]
for _ in range(Q) :
    p, q = map(int, input().split())
    pq[p-1]  += q

ret = []
for i in range(N) :
    s = 0
    for j in parent[i] :
        s += pq[j]

    ret.append(s)
    
print(*ret)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, Q = map(int, input().split())
v = [[] for _ in range(N)]
for _ in range(N-1) :
    a, b = map(int, input().split())
    v[a-1].append(b-1)
    v[b-1].append(a-1)
    
pq = [0 for _ in range(N)]
for _ in range(Q) :
    p, q = map(int, input().split())
    pq[p-1] += q
    
visited = [False] * N
visited[0] = True

ret = [0] * N
def bfs(cur, score) :
    ret[cur] = score + pq[cur]
    for nex in v[cur] :
        if not visited[nex] :
            visited[nex] = True
            bfs(nex, ret[cur])

bfs(0, 0)
    
print(*ret)
N = int(input())
a = [int(i) for i in input().split()]

li_ans = []
ans = 0

for j in range(min(a), max(a)):
    for k in a:
        ans += abs(k - j) ** 2
    else:
        li_ans.appned(ans)
        ans = 0

if len(li_ans) == 0:
    print(0)
else:
    print(min(li_ans))


### FIXED CODE ###

N = int(input())

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

ans = []
sum = 0

for j in range(min(a), max(a)):
    for num in a:
        sum += (num - j) ** 2
    else:
        ans.append(sum)
        sum = 0

if len(ans) == 0:
    print(0)
else:
    print(min(ans))
import collections
n,m,k=map(int,input().split())

#[index,parent]
unionfind=[[i,-1] for i in range(n)]
friendlist=[[] for _ in range(n)]
blocklist=[[] for _ in range(n)]

def findroot(ind):
    if(unionfind[ind][1]==-1):
        return unionfind[ind][0]
    else:
        return findroot(unionfind[ind][1])

for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    friendlist[a].append(b)
    friendlist[b].append(a)

    if(findroot(a) != findroot(b)):
        unionfind[findroot(b)][1]=unionfind[findroot(a)][0]

for i in range(k):
    c,d=map(int,input().split())
    c-=1
    d-=1
    blocklist[c].append(d)
    blocklist[d].append(c)

grouplist={}
for i in range(n):
    rooti=findroot(i)
    groupi=grouplist.get(rooti, [])
    groupi.append(i)
    grouplist[rooti]=groupi

ans=[]
for i in range(n):
    ans.append(len(set(grouplist[findroot(i)]) - set(friendlist[i]) - set(blocklist[i]) ) - 1)
print(*ans)


### FIXED CODE ###

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

class UnionFind:
    def __init__(self,n):
        self.group=[i for i in range(n)]
        self.size=[1 for i in range(n)]

    def find(self,x):
        if(self.group[x]==x):
            return x
        else:
            return self.find(self.group[x])

    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if(x==y):
            pass
        elif(self.sizeof(y) > self.sizeof(x)):
            self.group[x] = self.group[y]
            self.size[y] += self.size[x]
            self.size[x]=0
        else:
            self.group[y] = self.group[x]
            self.size[x] += self.size[y]
            self.size[y]=0

    def sizeof(self,a):
        return self.size[self.find(a)]

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

uf=UnionFind(n)
friends=[0 for _ in range(n)]
blocks=[0 for _ in range(n)]


for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    friends[a]+=1
    friends[b]+=1
    uf.unite(a,b)

for i in range(k):
    c,d=map(int,input().split())
    c-=1
    d-=1
    if(uf.same(c, d)):
        blocks[c]+=1
        blocks[d]+=1

ans=[]
for i in range(n):
    ans.append(uf.sizeof(i) - friends[i] - blocks[i]  - 1)
print(*ans)
bool a = input()
print(!a)

### FIXED CODE ###

a = int(input())
print(int(not a))