Harryxun/stf_run huggingface dataset:
import collections
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
if n ==1:
    print(0)
else:
    ans = 0
    c = collections.Counter(prime_factorize(n))
    for v in c.values():
        m = v
        i = 1
        for _ in range(1, m+1):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
print(ans)

### FIXED CODE ###

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

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    ans = 0
    c = factorization(n)
    for arr in c:
        m = arr[1]
        i = 1
        for _ in range(m):
            if i > m:
                break
            ans += 1
            m -= i
            i += 1
    print(ans)
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""

H1, M1, H2, M2, K = input().split(" ")

awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K

can_study_time = start_limit_time - awake_time

print(can_study_time)


### FIXED CODE ###

import sys

"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = map(int, sys.stdin.read().split())
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M2
start_limit_time = sleep_time - K
can_study_time = start_limit_time - awake_time
 
print(can_study_time)
yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if d>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if d>30:
        print('TBD')
      else:
        print('Heisei')



  if mm<=4:
    if dd<=30:
      print('Heisei')
else:
  print('TBD')



### FIXED CODE ###

yy,mm,dd =map(int,input().split('/'))

if yy>2019:
  print('TBD')
else:
  if mm>4:
    print('TBD')
  else:
    if mm==1 or mm==3:
      if dd>31:
        print('TBD')
      else:
        print('Heisei')
    if mm==2:
      if dd>29:
        print('TBD')
      else:
        print('Heisei')
    if mm==4:
      if dd>30:
        print('TBD')
      else:
        print('Heisei')
import numpy as np
import copy
D = int(input())
c_list = np.array(list(map(int,input().split())))
s_list = [list(map(int,input().split())) for _ in range(D)]
last_d_list = np.array([0]*26)
s_max_list = [np.argmax(s_row) for s_row in s_list]

for day,s_row in enumerate(s_list):
    choice_d = None
    max_reward = -1
    for i,last_d in enumerate(last_d_list):
        reward = s_row[i] + (last_d+1)*c_list[i]# - sum(c_list)
        next_max_reward = -1
        for j,new_last_d in enumerate(last_d_list):
            if j!=i:
                next_reward = s_list[day+1][j] + (new_last_d+2)*c_list[j]
            else:
                next_reward = s_list[day+1][j] + c_list[j]
            if next_reward > next_max_reward:
                next_max_reward = next_reward
        reward += next_max_reward
        if reward > max_reward:
            max_reward = reward
            choice_d = i
    last_d_list+=1
    last_d_list[choice_d] = 0
    
    print(choice_d+1)
    

### FIXED CODE ###

import numpy as np
D = int(input())
c_list = np.array(list(map(int,input().split())))
s_list = [list(map(int,input().split())) for _ in range(D)]
last_d_list = np.array([0]*26)
for s_row in s_list:
    choice_d = None
    max_reward = -1
    for i,last_d in enumerate(last_d_list):
        reward = s_row[i] + (last_d+1)*c_list[i]# - sum(c_list)
        if reward > max_reward:
            max_reward = reward
            choice_d = i
    last_d_list+=1
    last_d_list[choice_d] = 0
    
    print(choice_d+1)
S = list(input())
K = int(input())

N = len(S)
first = S[0]
last = S[-1]
now = 1
ing = 0
a = []
cnt = 1
flag = 0
while now < N:
    if S[now] == S[now-1]:
        ing = 1
        cnt += 1
        now += 1
        continue
    else:
        if ing ==1:
            a.append(cnt)
            cnt = 1
            now +=1
            ing = 0
        else:
            now +=1
            cnt = 1
            ing = 0
if ing ==1:
    a.append(cnt)

output = 0
for j in range(len(a)):
    output += a[j]//2

if first==last:
    if S[0]==S[1]:
        if S[-1]==S[-2]:
            X =a[0]
            Y =a[-1]
        else:
            X = a[0]
            Y = 1
    else:
        if S[-1]==S[-2]:
            X = 1
            Y =a[-1]
        else:
            X = 1
            Y = 1

    if (X==1)and(Y==1):
        output += 1
        flag = 1
    elif X==1:
        if Y%2==1:
            output+=1
            flag = 1
    elif Y==1:
        if X%2==1:
            output+=1
            flag = 1
    else:
        if (X%2==1)and(Y%2==1):
            output += 1
            flag = 1

output = output * K - flag

print(output)

### FIXED CODE ###

S = list(input())
K = int(input())

N = len(S)
first = S[0]
last = S[-1]
now = 1
ing = 0
a = []
cnt = 1
flag = 0
if N > 1:
    while now < N:
        if S[now] == S[now-1]:
            ing = 1
            cnt += 1
            now += 1
            continue
        else:
            if ing ==1:
                a.append(cnt)
                cnt = 1
                now +=1
                ing = 0
            else:
                now +=1
                cnt = 1
                ing = 0
    if ing ==1:
        a.append(cnt)

    output = 0
    for j in range(len(a)):
        output += a[j]//2

    if first==last:
        if S[0]==S[1]:
            if S[-1]==S[-2]:
                X =a[0]
                Y =a[-1]
            else:
                X = a[0]
                Y = 1
        else:
            if S[-1]==S[-2]:
                X = 1
                Y =a[-1]
            else:
                X = 1
                Y = 1

        if (X==1)and(Y==1):
            output += 1
            flag = 1
        elif X==1:
            if Y%2==1:
                output+=1
                flag = 1
        elif Y==1:
            if X%2==1:
                output+=1
                flag = 1
        else:
            if (X%2==1)and(Y%2==1):
                output += 1
                flag = 1

    output = output * K - flag
    if (len(a)==1)and(a[0]==N):
        output = (K*N)//2
elif N == 1:
    output = K//2

print(output)
a = str(input())
s = o
for i in range(0, 3):
    if a[i] == '1':
        s += 1
print(s)

### FIXED CODE ###

a = str(input())
s = 0
for i in range(0, 3):
    if a[i] == '1':
        s += 1
print(s)
s=int(input())

b=int(s%1000)
a=int((s-b)/1000)
d=int(b%100)
c=int((b-d)/100)
f=int(d%10)
e=int((d-f)/10)

if a=d or d=e or e=f :
    print("Bad")
else:
    print("Good")

### FIXED CODE ###

s=int(input())

b=int(s%1000)
a=int((s-b)/1000)
d=int(b%100)
c=int((b-d)/100)
f=int(d%10)
e=int((d-f)/10)

if a==c or c==e or e==f :
    print("Bad")
else:
    print("Good")
N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)
N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)


### FIXED CODE ###

N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)
C1 = list(input().split())
C2 = list(input().split())

if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

C1 = input()
C2 = input()

if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print('YES')
else:
    print('NO')
from collections import deque

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

q=deque([0])

TFl=[0]*N
TFl[0]=1
ml=[-1]*N

for i in range(M):
  A,B=map(int,input().split())
  l[B-1].append(A-1)
  l[A-1].append(B-1)

while q:
  p = q.popleft()
  for i in l[p]: #普通に1行ずつ回してるイメージ
    if TFl[i]==1:
      continue
    TFl[i]=1
    ml=p
    q.append(i)

if all([i==1 for i in TFl]):
  print('Yes')
  for i in range(1, N):
    print(ml[i]+1)

else:
  print('No')


### FIXED CODE ###

from collections import deque

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

q=deque([0])

TFl=[0]*N
TFl[0]=1
ml=[-1]*N

for i in range(M):
  A,B=map(int,input().split())
  l[B-1].append(A-1)
  l[A-1].append(B-1)

while q:
  p = q.popleft()
  for i in l[p]: #普通に1行ずつ回してるイメージ
    if TFl[i]==1:
      continue
    TFl[i]=1
    ml[i]=p
    q.append(i)

if all([i==1 for i in TFl]):
  print('Yes')
  for i in range(1, N):
    print(ml[i]+1)

else:
  print('No')
A,B,C,D = map(int,input().split())
if C<=A:
    if D>=B:
        print(B-A)
    elif A<=D:
        print(D-A)
    else:
        print(0)
elif C<=B:
    if D<=B:
        print(D-C)
    else:
        print(B-C)
    else:
        print(0)
else:
    print(0)

### FIXED CODE ###

A,B,C,D = map(int,input().split())
if C<=A:
    if D>=B:
        print(B-A)
    elif A<=D:
        print(D-A)
    else:
        print(0)
elif C<=B:
    if D<=B:
        print(D-C)
    else:
        print(B-C)
else:
    print(0)
N = int(input())
D = list(map(int, input().split()))

waru = 998244353

dic = {}
dic2 = {}

for i in range(1, N+1):
    dic[i] = D[i-1]

for number, distance in dic.items():
    if distance in dic2:
        dic2[distance] = dic2[distance] + 1
    else:
        dic2[distance] = 1

if 0 in dic2:
    if dic2[0] >= 2:
        print(0)
        exit(0)
else:
    print(0)
    exit(0)

l = []

for i in range(1, len(dic2.items()) -1):
    l.append(dic2[i] ** dic2[i+1])

r = 1
for x in l:
    r *= x
d, m = divmod(r, waru)
print(m)

### FIXED CODE ###

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

if D[0] != 0:
    print(0)
    exit(0)

waru = 998244353

dic = {}
dic2 = {}

for i in range(1, N+1):
    dic[i] = D[i-1]

for number, distance in dic.items():
    if distance in dic2:
        dic2[distance] = dic2[distance] + 1
    else:
        dic2[distance] = 1

if 0 in dic2:
    if dic2[0] >= 2:
        print(0)
        exit(0)

l = []

for i in range(1, len(dic2.items()) - 1):
    if i in dic2 and (i+1) in dic2:
        l.append(dic2[i] ** dic2[i+1])
    else:
        print(0)
        exit(0)

r = 1
for x in l:
    r *= x

d, m = divmod(r, waru)
print(m)
def main():
    from collections import Counter
    n, s = int(input()), input()
    c = Counter(s)
    d = list(c.values())

    ans = d[0] * d[1] * d[2]
    rgb = {"R", "G", "B"}
    for i in range(1, n // 2 + 1):
        for j in range(i):
            x = s[j::i]
            for a, b, c in zip(x, x[1:], x[2:]):
                g = {a, b, c}
                if g == rgb:
                    ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, s = int(input()), input()
    r, g, b = s.count('R'), s.count('G'), s.count('B')
    ans = r * g * b
    v = {'R', 'G', 'B'}
    for i in range(n - 2):
        for j in range(n // 2 + 1):
            if i + j + j < n:
                if v == {s[i], s[i + j], s[i + j + j]}:
                    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()
x,y=map(int,input().split())
z=0
 
for i in range(x):
    if i*2+(x-i)*4!==y:
        z=z
    else:
        z=1
 
if z==1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x,y=map(int,input().split())
z=0
 
for i in range(0,x+1):
    if i*2+(x-i)*4 == y:
        z=1

 
if z==1:
    print("Yes")
else:
    print("No")
N=int(input())
A=list(map(int,input().split()))
a=set(A)
print(len(a))

### FIXED CODE ###

N=int(input())
A=[]
for i in range(N):
  A.append(input())
a=set(A)
print(len(a))
import sys
input = sys.stdin.readline
N = int(input())
node = [0 for i in range(N)]

neigh = [[0 for i in range(N)] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1
def dfs(neighbor,start,visited,c):
    global k
    if sum(visited) == N:
        return ans
    for i in range(N):
        if visited[i] == 0 and neighbor[start][i] == 1:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            dfs(neighbor,i,visited,c)
for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1][0] += 1
    node[bi-1][0] += 1
    neigh[ai-1][bi-1] = 1
    neigh[bi-1][ai-1] = 1
c = list(map(int,input().split()))
c.sort(reverse=True)
m = max(node)
nn = node.index(m)
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn,visited,c)
ans2 = ' '.join([str(ans[i]) for i in range(N)])
print(sum(c)-max(c))
print(ans2)

### FIXED CODE ###

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


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except RuntimeError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn)
"""
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)
import itertools

n=int(input())
s=list(input())
v=list(reversed(s))
ans=float('inf')
s1=[]

s=itertools.accumulate(s)
v=itertools.accumulate(v)
s=['']+list(s)
v=['']+list(v)

for i in range(n):
    cnt=s[i].count('#')+v[-(i+1)].count('.')
    ans=min(cnt,ans)
print(ans)


    

    
        
        
        
    
                
    
        

     

    

     

    


### FIXED CODE ###

import itertools

n=int(input())
s=list(input())
a=s.count('#')
b=0
ans=a

for i in range(1,n+1):
    if s[-i]=='.':
        b+=1
    else:
        a-=1
        
    ans=min(a+b,ans)
print(ans)
from collections import defaultdict
import math
n=int(input())
d=defaultdict(int)

m=int(math.sqrt(n-2))+2
for l in range(3,m+1):
    for i in range(1,l-1):
        for j in range(1,l-i):
            k=l-i-j
            N=i*i+j*j+k*k+i*j+j*k+k*i
            d[N]+=1
for i in range(1,n+1):
    print(d[i])

### FIXED CODE ###

from collections import defaultdict
import math
n=int(input())
d=defaultdict(int)

if n>2:
    m=int(math.sqrt(n))
    for k in range(1,m):
        for i in range(1,m):
            for j in range(1,m):
                N=i*i+j*j+k*k+i*j+j*k+k*i
                d[N]+=1
for i in range(1,n+1):
    print(d[i])
S = input()

T = []

x_list = []

temp = 0
for i in range(len(S)):
    if S[i]!="x":
        T.append(S[i])
        x_list.append(temp)
        temp=0
    else:
        temp+=1
x_list.append(temp)

U = T[::-1]
flag=False
for i in range(len(T)):
    if T[i]!=U[i]:
        flag=True
        break

if flag:
    print(-1)
else:
    count=0
    for i in range(len(x_list)//2):
        count+=abs(x_list[i]-x_list[len(x_list)-i])

    print(count)

### FIXED CODE ###

S = input()

T = []

x_list = []

temp = 0
for i in range(len(S)):
    if S[i]!="x":
        T.append(S[i])
        x_list.append(temp)
        temp=0
    else:
        temp+=1
x_list.append(temp)

U = T[::-1]
flag=False
for i in range(len(T)):
    if T[i]!=U[i]:
        flag=True
        break

if flag:
    print(-1)
else:
    count=0
    for i in range(len(x_list)//2):
        count+=abs(x_list[i]-x_list[len(x_list)-1-i])

    print(count)
I=lambda:[int(i)for i in input().split()]
n,m=I()
P=I()
D={i:i for i in range(n)}
def U(x):
  if D[x]!=x:
    D[x]=U(D[x])
  return D[x]
for _ in [0]*m:
  x,y=I();D[U(x)]=U(y)
print(sum(U(i)==U(p)for i,p in enumerate(P)))


### FIXED CODE ###

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

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
        else:
            self.par[ry] = rx
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)

    

        
N, M = map(int, sdin().split())
P = list(map(int, sdin().split()))
XY = []
for i in range(M):
    XY.append(list(map(int, sdin().split())))


root_node = defaultdict(list)

uf = UnionFind(N)
for x,y in XY:
    x -= 1
    y -= 1
    uf.unite(x,y)

for i in range(N):
    uf.find(i)
    
par = uf.par

for i,root in enumerate(par):
    root_node[root].append(i)
    
ans = 0
for node_list in root_node.values():
    num_list = []
    for i in node_list:
        num_list.append(P[i]-1)
    
    ans += len(set(node_list)&set(num_list))
            
print(ans)
import math
from fractions import gcd
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(gcd,l))

### FIXED CODE ###

import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))
N = input()

N = N*N*N

print(N¥n)


### FIXED CODE ###

N = input()

N = pow(N,3)

print(N)
a = []
for i in range(3):
   a.append([int(x) for x in input().split()])

n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(n):
   for j in range(3):
      for k in range(3):
         if (b[i] == a[j][k]):
            a[j][k] = 0

for i in range(3):
   sum = 0
   for j in range(3):
      sum += a[i][j]
   if (sum == 0):
      print('Yes')
      exit(1)

for i in range(3):
   sum = 0
   for j in range(3):
      sum += a[j][i]
   if (sum == 0):
      print('Yes')
      exit(1)

if (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')


### FIXED CODE ###

import sys

a = []
for i in range(3):
   a.append([int(x) for x in input().split()])

n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(n):
   for j in range(3):
      for k in range(3):
         if (b[i] == a[j][k]):
            a[j][k] = 0

for i in range(3):
   x = 0
   for j in range(3):
      x += a[j][i]
   if (x == 0):
      print('Yes')
      sys.exit()

tmp = [sum(a[i]) for i in range(3)]
if (min(tmp) == 0):
   print('Yes')
elif (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')
c1 = map(int,input().split())
c2 = map(int,input().split())
c3 = map(int,input().split())

d1 = [c2[i] - c1[i] for i in range(3)]
d2 = [c3[i] - c1[i] for i in range(3)]

if(d1[0] == d1[1] and d1[0] == d1[2] and d2[0] ==d2[1] and d2[0] == d2[2]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
 
d1 = [c2[i] - c1[i] for i in range(3)]
d2 = [c3[i] - c1[i] for i in range(3)]
 
if(d1[0] == d1[1] and d1[0] == d1[2] and d2[0] ==d2[1] and d2[0] == d2[2]):
  print("Yes")
else:
  print("No")
import sys #追加
sys.setrecursionlimit(10**9)

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

bl = [i//2 for i in al]
from fractions import gcd
ans = 1
for b in bl:
   ans = (ans * b) // gcd(ans, b)

import numpy as np
print(ans, al)
al = ans % (np.array(al) / 2)
if any(al):
   print(0)
   import sys
   sys.exit()
   

def ceil(a, b):
   return a // b + (a % b > 0)

print(ceil(m // ans, 2))



### FIXED CODE ###

import sys #追加
sys.setrecursionlimit(10**9)
import time
s = time.time()

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

bl = [i//2 for i in al]
from fractions import gcd
ans = 1
for b in bl:
   if time.time() - s > 1.9:
      print(0)
      import sys
      sys.exit()
   ans = (ans * b) // gcd(ans, b)

for a in al:
   if time.time() - s > 1.9:
      print(0)
      import sys
      sys.exit()
   if ans % a == 0:
      print(0)
      import sys
      sys.exit()

def ceil(a, b):
   return a // b + (a % b > 0)

print(ceil(m // ans, 2))
N = int(input())
A = list(map(int, input().split()))
# print(N, A)

ans = list(set(A))
if len(ans) > 3:
    print('No')
    exit()

a0 = ans[0]
a1 = ans[1]
a2 = ans[2]

if a0 ^ a1 == a2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

ans = list(set(A))
l = len(ans)
if l > 3:
    print('No')
    exit()

if l == 1:
    if ans[0] == 0:
        print('Yes')
    else:
        print('No')
    exit()

if l == 2:
    a0 = ans[0]
    a1 = ans[1]
    num_a0 = A.count(ans[0])
    num_a1 = A.count(ans[1])
    if a0 != 0 and a1 != 0:
        print('No')
        exit()
    num_0 = num_a0 if a0 == 0 else num_a1
    num_n0 = num_a1 if a0 == 0 else num_a0
    if num_0 * 2 == num_n0:
        print('Yes')
    else:
        print('No')
    exit()

a0 = ans[0]
a1 = ans[1]
a2 = ans[2]

if a0 ^ a1 != a2:
    print('No')
    exit()

num_a0 = A.count(ans[0])
num_a1 = A.count(ans[1])
num_a2 = A.count(ans[2])

if num_a0 != num_a1 or num_a0 != num_a2:
    print('No')
else:
    print('Yes')
a=int(iput())
b=int(input())
h=int(input())
print(int((a+b)*h/2))

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print( int( (a+b)*h/2 ) )
length =int(input())

s, t = map(int, input().split())

result = ""

for i in s:
  list_t = list(t)
  result = result + s + list_t[i]
 
print(result) 


### FIXED CODE ###

length =int(input())

s, t = map(str, input().split())

result = ""

list_s = list(s)
list_t = list(t)

for i in range(length):
  result = result + list_s[i]
  result = result + list_t[i]
  #result = result + s + list_t[i]
 
print(result)
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
            H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            test.append(H)
            # print(x,y,H)
            
if(len(test)!=1):
    print(5/0)
else:
    print(x,y,H)

### FIXED CODE ###

N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = []

for x in range(101):
    for y in range(101):
        H = []
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t.append([x,y,H])

if len(t) >= 2:
    t = []
    for x in range(101):
        for y in range(101):
            H = []
            for i in array:
                if True:
                    H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                    H.append(H_i)
            Hset = set(H)
            H = list(Hset)[0]
            if(len(Hset)==1 and H>=0):
                t.append([x,y,H])
            
print("{0[0]} {0[1]} {0[2]}".format(t[0]))