Harryxun/stf_run huggingface dataset:
n, q = map(int, input().split())

graph = [[] for _ in range(n+1)] 
for i in range(1, n):
  a, b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)

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

seen = [False]*(n+1)
counter = [0]*(n+1)
sum_point = 0

def dfs(v):
  
  global graph
  global seen
  global sum_point
  global counter
  
  seen[v] = True
  sum_point += point[v]
  
  for next_v in graph[v]:
    
    if seen[next_v]: 
      continue
    dfs(next_v)
  
  counter[v] = sum_point
  sum_point -= point[v]

dfs(1)
print(*counter[1::])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n, q = map(int, sys.stdin.readline().split())

graph = [[] for _ in range(n+1)] 
for i in range(1, n):
  a, b = map(int, sys.stdin.readline().split())
  graph[a].append(b)
  graph[b].append(a)

point = [0]*(n+1)
for i in range(q):
  p, x = map(int, sys.stdin.readline().split())
  point[p] += x

seen = [False]*(n+1)
counter = [0]*(n+1)
sum_point = 0

def dfs(v):
  
  global graph
  global seen
  global sum_point
  global counter
  
  seen[v] = True
  sum_point += point[v]
  
  for next_v in graph[v]:
    
    if seen[next_v]: 
      continue
    dfs(next_v)
  
  counter[v] = sum_point
  sum_point -= point[v]

dfs(1)
print(*counter[1::])
import sys
import math 
ni = lambda: int(ns())
import numpy as np
na = lambda: list(map(int, input().split()))
ns = lambda: input()

h,w  = na()
grid = [input().strip() for i in range(h)]
#print(grid)

T = [[0]*w for i in range(h)]
Y = [[0]*w for i in range(h)]

for i in range(h):
    count=0
    for j in range(w):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            #print(i,j)
            T[i][j]=count

for i in range(h):
    for j in range(w-2,-1,-1):
        if grid[i][j] == "#":
            T[i][j] = 0
        else:
            T[i][j] = max(T[i][j],T[i][j+1])

for j in range(w):
    count=0
    for i in range(h):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            Y[i][j]=count

for j in range(w):
    for i in range(h-2,-1,-1):
        if grid[i][j] == "#":
            Y[i][j] = 0
        else:
            Y[i][j] = max(Y[i][j],Y[i+1][j])

ANS = -1
for i in range(h):
    for j in range(w):
        ANS = max(ANS, Y[i][j] + T[i][j] - 1)
#print(T)
#print(Y)
print(ANS)

### FIXED CODE ###

ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

h,w  = na()
grid = [input().strip() for i in range(h)]
#print(grid)

T = [[0]*w for i in range(h)]
Y = [[0]*w for i in range(h)]

for i in range(h):
    count=0
    for j in range(w):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            #print(i,j)
            T[i][j]=count

for i in range(h):
    for j in range(w-2,-1,-1):
        if grid[i][j] == "#":
            T[i][j] = 0
        else:
            T[i][j] = max(T[i][j],T[i][j+1])

for j in range(w):
    count=0
    for i in range(h):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            Y[i][j]=count

for j in range(w):
    for i in range(h-2,-1,-1):
        if grid[i][j] == "#":
            Y[i][j] = 0
        else:
            Y[i][j] = max(Y[i][j],Y[i+1][j])

ANS = -1
for i in range(h):
    for j in range(w):
        ANS = max(ANS, Y[i][j] + T[i][j] - 1)
#print(T)
#print(Y)
print(ANS)
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10000)

def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def root(P, C, a):
    if P[a] == a:
        return a
    r = root(P, C, P[a])
    P[a] = r
    C[a] = C[r]
    return r


def main():
    N, M = read_values()
    V = [read_list() for _ in range(M)]
    P = [i for i in range(N)]
    C = [1] * N
    res = [N * (N - 1) // 2] * M
    total = 0
    for i in range(M - 2, -1, -1):
        a, b = V[i + 1]
        a -= 1
        b -= 1

        ra = root(P, C, a)
        rb = root(P, C, b)
        if ra == rb:
            res[i] -= total
            continue

        P[ra] = rb
        total += C[ra] * C[rb]
        C[ra] += C[rb]
        C[rb] = C[ra]
        res[i] -= total

    print("\n".join(map(str, res)))
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import itertools
input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def root(P, C, a):
    if P[a] == a:
        return a
    r = a
    while P[r] != r:
        r = P[r] 
    
    P[a] = r
    C[a] = C[r]
    return r


def main():
    N, M = read_values()
    V = [read_list() for _ in range(M)]
    P = [i for i in range(N)]
    C = [1] * N
    res = [N * (N - 1) // 2] * M
    total = 0
    for i in range(M - 2, -1, -1):
        a, b = V[i + 1]
        a -= 1
        b -= 1

        ra = root(P, C, a)
        rb = root(P, C, b)
        if ra == rb:
            res[i] -= total
            continue

        P[ra] = rb
        total += C[ra] * C[rb]
        C[ra] += C[rb]
        C[rb] = C[ra]
        res[i] -= total

    print("\n".join(map(str, res)))
    

if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int,input().split()))
ans = 0
a = 0
max_flag = False
for l in range(N):
    a = A[l]
    for j in range(l+1,N):
        x = x ^ A[j]
        if x - a == A[j]:
            ans += 1
        else:
            break
print(ans + N)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
num = 0
a = 0
x = 0
k = 0
for l in range(N):
    for j in range(k,N):
        a += A[j]
        x =  x ^ A[j]
        if a  != x:
            ans += j - l
            k = j
            x = x ^ A[l] ^ A[j]
            a = a - A[l] - A[j]
            break
        elif j == N-1:
            ans += N-l
            k = j
            x = x ^ A[l] ^ A[j]
            a = a - A[l] - A[j]
print(ans )
second=input()
first=splitlines(second)
P=first[0]
S=first[1]
count=0
for t in range(0,len(P)-1):
  if P[t]=S[t]:count=count+1
    else count=count
print(int(count))

### FIXED CODE ###

a=[input() for i in range(2)]
P=a[0]
S=a[1]
count=0
for t in range(len(P)):
  if P[t] != S[t]:
    count=count+1
print(count)
from collections import deque
inf = 10 ** 7
N, M = map(int, input().split())
P = [list(map(int,input().split())) for i in range(M)]
a = [[] for i in range(N)]
for i in P:
    a[i[0]-1].append(i[1]-1)
    a[i[1]-1].append(i[0]-1)
path = [-1] * N
path[0] = 0
checked = [False] * N
stack = deque([(0,0)])
while (len(stack) != 0):
    kk = stack.pop(0)
    now = kk[0]
    pre = kk[1]
    if  not checked[now]:    
        nextP = a[now]
        checked[now] = True
        path[now] = pre
        for i in nextP:
            stack.append((i,now))
if False in checked:
    print("No")
else:
    print("Yes")
    for i in path[1:]:
        print(i + 1)





### FIXED CODE ###

from collections import deque
inf = 10 ** 7
N, M = map(int, input().split())
P = [list(map(int,input().split())) for i in range(M)]
a = [[] for i in range(N)]
for i in P:
    a[i[0]-1].append(i[1]-1)
    a[i[1]-1].append(i[0]-1)
path = [-1] * N
path[0] = 0
checked = [False] * N
stack = deque([(0,0)])
while (len(stack) != 0):
    kk = stack.popleft()
    now = kk[0]
    pre = kk[1]
    if  not checked[now]:    
        nextP = a[now]
        checked[now] = True
        path[now] = pre
        for i in nextP:
            stack.append((i,now))
if False in checked:
    print("No")
else:
    print("Yes")
    for i in path[1:]:
        print(i + 1)
import sys

n, m = list(map(int, input().split()))
l, r = 1, n
for line in sys.stdin:
    a, b = list(map(int, input().split()))
    l = max(a, l)
    r = min(b, r)
print(max(0, r - l + 1))


### FIXED CODE ###

import sys

n, m = list(map(int, input().split()))
l, r = 1, n
for line in sys.stdin:
    a, b = list(map(int, line.split()))
    l = max(a, l)
    r = min(b, r)
print(max(0, r - l + 1))
# coding: utf-8
# Your code here!
N,X=map(int,input().split())

def dfs(count,object):
    count+=1
    object="B"+object+"P"+object+"B"
    if count<N:
        dfs(count,object)
    else:
        print(object)
        exit()

n=0
burger="P"

(dfs(n,burger))


### FIXED CODE ###

# coding: utf-8
# Your code here!
N,X=map(int,input().split())

X-=1
def saiki(i,x,count):
    if i==-1:
        print(int(count)+1)
        exit()
    all=2**(i+2)-3
    paty=2**(i+1)-1
    if x==all-1:
        print(count+paty)
        exit()
    elif x==0:
        print(count)
    elif x==(all-1)//2:
        print(int(count+(paty-1)//2+1))
        exit()
    elif x>(all-1)//2:
        count+=((paty-1)//2+1)
        x-=(all//2)
        saiki(i-1,x-1,count)
    elif x<(all-1)//2:
        saiki(i-1,x-1,count)
    

ans=0
saiki(N,X,ans)
from collections import defaultdict 

n,m = map(int, input().strip().split(" "))

adjList = defaultdict(list)

for i in range(m):
    a,b = map(int, input().strip().split(" "))
    if b not in adjList[a]:
        adjList[a].append(b)
        
    if a not in adjList[b]:
        adjList[b].append(a)
    
mca = 0
visited = [False]*(n+1)

def dfs(node, cml):
    visited[node] = True
    
    if adjList[node]:
        for ngh in adjList[node]:
            if not visited[ngh]:
                cml = dfs(ngh, cml+1)
    
    return cml

for i in range(n):
    if not visited[i+1]:
        ca = dfs(i+1, 1)
        mca = max(mca, ca)

print(mca)
    
    

### FIXED CODE ###

from collections import defaultdict 

n,m = map(int, input().strip().split(" "))

dp = [-1]*n

def root(x):
    if dp[x] < 0:
        return x
    return root(dp[x])

def unite(x, y):
    rx = root(x)
    ry = root(y)
    
    if rx == ry:
        return False
        
    if dp[rx] > dp[ry]:
        rx,ry = ry,rx
        
    dp[rx] += dp[ry]
    dp[ry] = rx
    return True

def size(x):
    return -dp[root(x)]

for i in range(m):
    a,b = map(int, input().strip().split(" "))
    a-=1
    b-=1
    unite(a,b)
    
ans = 0
for i in range(n):
    ans = max(ans, size(i))
    
print(ans)
N = int(input())
LR = [list(map(int,input().split())) for _ in range(N)]

ML = max(LR)[0]
mR = min(LR,key=lambda x:x[1])[1]

if ML > mR:
    LR.sort(key=lambda x:[x[1],x[0]])
    L = [LR[i][0] for i in range(N)]
    for i in range(N):
        r = LR[i][1]
        if ML <= r:
            break

    L_ = [0]*N
    for j in range(N):
        L_[j] = max(L[j],L_[j-1])

    ans = LR[i][1]-ML+1
    for j in range(max(i,1),N):
        ans = max(ans,LR[j][1]-ML+1+max(mR-L_[j-1]+1,0))

else:
    l,r = min(LR,key=lambda x:x[1])
    LR.sort()
    R = [LR[i][1] for i in range(N)]
    for i in range(N):
        if LR[i][0] > l:
            break

    R_ = [0]*N
    R_[-1] = R[-1]
    for j in range(N-2,i-1,-1):
        R_[j] = min(R[j],R_[j+1])

    ans = mR-LR[i-1][0]+1
    for j in range(i-1,N-1):
        ans = max(ans,mR-L[j]+1+R_[j+1]-ML+1)

print(ans)


### FIXED CODE ###

N = int(input())
LR = [list(map(int,input().split())) for _ in range(N)]

LR.sort(key=lambda x:[-x[0],x[1]])
ML = LR[0][0]
MR = LR[0][1]
LR.sort(key=lambda x:[x[1],-x[0]])
mR = LR[0][1]
mL = LR[0][0]

ans = max(mR-ML+1,0)
for i in range(N):
    if LR[i] not in [[ML,MR],[mL,mR]]:
        ans = max(ans,max(mR-ML+1,0)+max(LR[i][1]-LR[i][0]+1,0))

LR.sort(key=lambda x:[x[1],x[0]])

L_ = [0]*N
for i in range(N):
    L_[i] = max(LR[i][0],L_[i-1])

for i in range(1,N):
    ans = max(ans,max(LR[i][1]-ML+1,0)+max(mR-L_[i-1]+1,0))

print(ans)
N = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
  print(0)
  break
A = 1
for i in range(N):
  A = A * a[i]
  if A > 1000000000000000000:
    print(-1)
    break
print(A)

### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
  print(0)
  exit()
for i in range(N):
  A = A * a[i]
  if A > 1000000000000000000:
    print(-1)
    exit()
print(A)
H, W, M = map(int, input().split())
hlst = [0]*(H+1)
wlst = [0]*(M+1)
hwlst = []

for i in range(M):
    h, w = map(int, input().split())
    hlst[h] += 1
    wlst[w] += 1
    hwlst.append([h,w])

h = max(hlst)
w = max(wlst)
hmax = [i for i in range(H+1) if hlst[i] == h]
wmax = [i for i in range(W+1) if wlst[i] == w]
ans = h + w -1


for i in hmax:
    for j in wmax:
        if [i, j]  not in hwlst:
            ans += 1
            break

print(ans)


### FIXED CODE ###

import sys
H, W, M = map(int, sys.stdin.readline().split())
hlst = {}
wlst = {}
hwlst = []

for i in range(M):
    h, w = sys.stdin.readline().split()
    if h in hlst:
        hlst[h] += 1
    else:
        hlst[h] = 1

    if w in wlst:
        wlst[w] += 1
    else:
        wlst[w] = 1

    hwlst.append([h, w])

h = max(hlst.values())
w = max(wlst.values())
hmax = [i for i in hlst if hlst[i] == h]
wmax = [i for i in wlst if wlst[i] == w]
num = len(hmax)*len(wmax)
ans = h + w -1


for i in hwlst:
    if hlst[i[0]] == h and wlst[i[1]] == w:
        num -= 1

if num == 0:
    print(h+w-1)
else:
    print(h+w)
def main():
    d,n = map(int, input().split())
    a_list = []
    
    if d == 0:
        for i in range(0,100):
            a_list.append(i)
        print(a_list[n])
        sys.exit()

    elif d == 1:
        for i in range(100, 10000, 100):
            a_list.append(i)
    else:
        for i in range(10000, 1000000, 10000):
            a_list.append(i)

    #print(n-1)
    print(a_list[n-1])
    #print(len(a_list))
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

d,n = map(int,input().split())
li = []
for i in range(1,102):
    if i != 100:
        li.append(i*100**d)
print(li[n-1])
import sys

input = sys.stdin.readline

N, M = map(int, input().split())

sc = []
dic = dict()
for _ in range(M):
    sc.append(list(map(int, input().split())))

sc.sort(key=lambda x:x[0])

if sc[-1][0] > N:
    print(-1)
    exit()

for i in range(M):
    if sc[i][0] not in dic.keys():
        dic[sc[i][0]] = sc[i][1]
    elif dic[sc[i][0]] != sc[i][1]:
        print(-1)
        exit()

if N == 1:
    if sc[0][0] == 1 and sc[0][1] == 0:
        print(0)
        exit()
else:
    if sc[0][0] == 1 and sc[0][1] == 0:
        print(-1)
        exit()

ans = ['a'] * N

for i in range(M):
    ans[sc[i][0]-1] = sc[i][1] 

if ans[0] == 'a':
    ans[0] = 1
if ans[1] == 'a':
    ans[1] = 0
if ans[2] == 'a':
    ans[2] = 0 

out = ""
for i in range(len(ans)):
    out += str(ans[i])

print(int(out))

### FIXED CODE ###

import sys

input = sys.stdin.readline

N, M = map(int, input().split())

if M == 0:
    ans = 0
    if N == 2:
        ans = 10
    if N == 3:
        ans = 100
    print(ans)
    exit()

sc = []
dic = dict()
for _ in range(M):
    sc.append(list(map(int, input().split())))

sc.sort(key=lambda x:x[1])
sc.sort(key=lambda x:x[0])

if sc[-1][0] > N:
    print(-1)
    exit()

for i in range(M):
    if sc[i][0] not in dic.keys():
        dic[sc[i][0]] = [sc[i][1]]
    elif sc[i][1] not in dic[sc[i][0]]:
        dic[sc[i][0]].append(sc[i][1])

for value in dic.values():
    if len(value) > 1:
        print(-1)
        exit()

if N == 1:
    if sc[0][0] == 1 and sc[0][1] == 0:
        print(0)
        exit()
else:
    if sc[0][0] == 1 and sc[0][1] == 0:
        print(-1)
        exit()

ans = ['a'] * N

for i in range(M):
    ans[sc[i][0]-1] = sc[i][1] 

if ans[0] == 'a':
    ans[0] = 1
for i in range(len(ans)):
    if ans[i] == 'a':
        ans[i] = 0

out = ""
for i in range(len(ans)):
    out += str(ans[i])

print(int(out))
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
            return
        else:
            return

       check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        a = [i + 1 for i, c in enumerate(s) if c == 'o']
        if len(a) == k:
            print(*a, sep='\n')
        else:
            print()
        exit()

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str, ans))
    print(ans)


if __name__ == '__main__':
    main()
n,k=map(int,input().split())
s=list(input())
point=s[0]
count=0
while k!=0 and count!=n-1:
    if s[count]!=point:
        while True:
            if s[count]!=point:
                s[count]=point
                count +=1
                if count==n:break
            else:break
        k -=1
    else:count +=1

print("".join(s))
ans=0
for i in range(n-1):
    if s[i]==s[i+1]:
        ans +=1
print(ans)

### FIXED CODE ###

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

s = input()

S = list(s)

num = 0
for i in range(N-1):

    if S[i] == S[i+1]:
        num += 1

print (min(N-1,num + 2*K))
a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
for i in range (c/2):
    if c== int(i*i):
        print("Yes")  
        break      
    elif i==1000-1:
        print("No")
        break

### FIXED CODE ###

a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
for i in range (1000):
    if c== int(i*i):
        print("Yes")  
        break      
    elif i==1000-1:
        print("No")
        break
a,b = int(input().split())

if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

a,b = map(int, input().split())
 
if a + b <= 16:
  if a <= 8 and b <= 8:
    print('Yay!')
  else:
    print(':(')
else:
  print(':(')
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md


p=0
cnt=0
ans=0

for i in range(n-1,-1,-1):
    while p<n and a[i]+a[p]<=md: 
        p+=1
    if p==n: break
    cnt+=n-p
    ans+=a[i]*(n-p)*2

ans+=(m-cnt)*md
print(ans)


### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
n, k = map(int, input().split())

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: 
      return 1
    over = reduce(mul, range(n,n-r,-1)
    under = reduce(mul, range(1,r+1))
    return over//under

def out(num):
    print(num%1000000007)

for i in range(1,k+1):
    if n-k+1 < i :
       return print('0')
    else out(cmb(k-1,i-1)*cmb(n-k+1,i))

### FIXED CODE ###

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: 
      return 1
    over = reduce(mul, range(n,n-r,-1))
    under = reduce(mul, range(1,r+1))
    return over//under

def out(num):
    print(num%1000000007)

for i in range(1,k+1):
    if n-k+1 < i :
      print("0")
    else:
      out(cmb(k-1,i-1)*cmb(n-k+1,i))
a = input().split("/")
print(a)
if a[1] <= 4:
    print('Heisei')
else:
    print('TBD')


### FIXED CODE ###

S = input().split("/")
if int(S[1]) < 5:
    print("Heisei")
else:
    print("TBD")
n = int(input())
a_list = list(map(int, input().split())
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0]

### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0])
A,B,C = list(map(int,input().split()))
if A == B == C and A%2 == 0 :
    print(-1)
elif A == B == C and A%2 == 1 :
    print(0)
else :
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
    print(cnt)


### FIXED CODE ###

A,B,C = list(map(int,input().split()))
if A == B == C and A%2 == 0 :
    print(-1)
elif A == B == C and A%2 == 1 :
    print(0)
else :
    cnt=0
    while A%2==B%2==C%2==0:
        total=A+B+C
        A=total//2-A//2
        B=total//2-B//2
        C=total//2-C//2
        cnt+=1
    print(cnt)
import sys


def resolve(in_):
    N, M = map(int, next(in_).split())
    PS = tuple(line.strip().split() for line in in_)
    
    ac = set()
    wa = {}

    for p, s in PS:
        if s == 'AC':
            ac.add(p)
        if s == 'WA' and p not in ac:
            wa[p] = wa.setdefault(p, 0) + 1

    penalties = 0
    for k, v in wa.items:
        if k in ac:
            penalties += v
    
    return '{} {}'.format(len(ac), penalties)


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys


def resolve(in_):
    N, M = map(int, next(in_).split())
    PS = tuple(line.strip().split() for line in in_)
    
    ac = set()
    wa = {}

    for p, s in PS:
        if s == 'AC':
            ac.add(p)
        if s == 'WA' and p not in ac:
            wa[p] = wa.setdefault(p, 0) + 1

    penalties = 0
    for k, v in wa.items():
        if k in ac:
            penalties += v
    
    return '{} {}'.format(len(ac), penalties)


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()
def isLast(m1, d1, m2, d2):
  return m2 > m1

if __name__ == "__main__":
  import sys
  m1, d1, m2, d2 = [int(_) for _ in sys.argv[1:]]
  print(isLast(m1, d1, m2, d2))

### FIXED CODE ###

def isLast(m1, d1, m2, d2):
  return m2 > m1
 
if __name__ == "__main__":
  import sys
  in_str = ''
  for line in sys.stdin:
    in_str += line
  m1, d1, m2, d2 = [int(_) for _ in in_str.split()]
  print(int(isLast(m1, d1, m2, d2)))
import math
n, d = map(int, input().split())
a = math.seil(n/(2*d+1))
print(a)


### FIXED CODE ###

n, d = map(int, input().split())
a = int((n+2*d)/(2*d+1))
print(a)
k, n = map(int, input().split())
l = list(map(int, input().split()))
maxi = [k-l[-1]+l[0]]
for i in range(1, n):
  maxi = max(l[i] - l[i-1], maxi)
print(k-maxi)

### FIXED CODE ###

k, n = map(int, input().split())
l = list(map(int, input().split()))
maxi = k-l[-1]+l[0]
for i in range(1, n):
    maxi = max(l[i] - l[i-1], maxi)
print(k-maxi)