Harryxun/stf_run huggingface dataset:
n=int(input())
XYH=[]
for i in range(n):
  x,y,h=map(int,input().split())
  XYH.append([x,y,h])
XYH.sort(key=lambda x:x[2])
for i in range(101):
  for j in range(101):
    peak=abs(i-XYH[0][0])+abs(j-XYH[0][1])+XYH[0][2]
    flag=1
    for k in range(1,n):
      if max(0,peak-abs(i-XYH[k][0])-abs(j-XYH[k][1]))!=XYH[k][2]:
        flag=0
    if flag==1:
      Ans=[i,j,peak]
print(*Ans)

### FIXED CODE ###

n=int(input())
XYH=[]
for i in range(n):
  x,y,h=map(int,input().split())
  XYH.append([x,y,h])
XYH.sort(key=lambda x:x[2])
for i in range(101):
  for j in range(101):
    peak=abs(i-XYH[-1][0])+abs(j-XYH[-1][1])+XYH[-1][2]
    flag=1
    for k in range(n-1):
      if max(0,peak-abs(i-XYH[k][0])-abs(j-XYH[k][1]))!=XYH[k][2]:
        flag=0
    if flag==1:
      Ans=[i,j,peak]
print(*Ans)
x = [int(input()) for i in range(5)]
a = []
res = 0
for i in range(5):
    if x[i]%10!=0:
        a.append(10-x[i]%10)
b = max(a)
c = sum(a)-b
print(sum(x)+c)


### FIXED CODE ###

x = [int(input()) for i in range(5)]
a = [0]
res = 0
for i in range(5):
    if x[i]%10!=0:
        a.append(10-x[i]%10)
b = max(a)
c = sum(a)-b
print(sum(x)+c)
N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = [0] * (N+10)
dp[2] = A[1] - A[0] 
for i in range(2,N):
    res = []
    if K+1 > i:
        K = i + 1
    for j in range(1,K):
        res.append(abs(A[i] - A[i-j])+dp[i-j+1])
    dp[i+1] = min(res)

print(dp[N])

### FIXED CODE ###

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    dp = [0] * (N+10)
    dp[2] = abs(A[1] - A[0])
    for i in range(2,N):
        res = []
        if K > i:
            kk = i+1
        else:
            kk = K + 1
        for j in range(1,kk):
            res.append(abs(A[i] - A[i-j])+dp[i-j+1])
        dp[i+1] = min(res)
    
    print(dp[N])
if __name__ == "__main__":
    main()
N=int(input())
A=list(map(int, input().split()))
A_rev = [-x for x in A[::-1]] #逆順にして各要素を-1倍する
left, right = A[:N], A_rev[:N]
sum_left_list, sum_right_list = [0]*(N+1), [0]*(N+1)
sum_left, sum_right = sum(left), sum(right)
sum_left_list[0], sum_right_list[0]=sum_left, sum_right

#left: k=N, N+1,..., 2N-1まで動かして大きい方からN個の和を求める
for k in range(N, 2*N):
	val=A[k]
	heapq.heappush(left, val)
	min_val = heapq.heappop(left)
	sum_left += val
	sum_left -= min_val
	sum_left_list[k-N+1] = sum_left

#right: k=N, N+1,..., 2N-1まで動かして大きい方からN個の和を求める
for k in range(N, 2*N):
	val = A_rev[k]
	heapq.heappush(right, val)
	min_val = heapq.heappop(right)
	sum_right += val
	sum_right -= min_val
	sum_right_list[k-N+1] = sum_right
sum_right_list[::-1]

ans=-float("inf")
for i in range(N+1):
	ans=max(ans, sum_left_list[i]+sum_right_list[i])
print(ans)

### FIXED CODE ###

#########################ABC解説実装#########################
import heapq
N=int(input())
A=list(map(int, input().split()))

left, right = A[:N], [-1 * i for i in A[2*N:]]
sum_left, sum_right = sum(left), sum(right)

results = [0] * (N+1)
results[0] = sum_left
results[N] = sum_right

heapq.heapify(left)
heapq.heapify(right)

for i in range(N, 2*N):
    v = A[i]
    p = heapq.heappushpop(left, v)
    sum_left += v - p
    results[i-N+1] += sum_left
    
for i in range(2*N-1, N-1, -1):
    v = -1 * A[i]
    p = heapq.heappushpop(right, v)
    sum_right += v - p
    results[i-N] += sum_right
print(max(results))
N, M, C = map(int, input().split())
B = [int(input()) for i in range(M)]
A = [[int(input()) for i in range(M)] for j in range(N)]
cnt = 0
for i in range(N):
    ans = 0
    for j in range(M):
        ans += A[i][j] * B[j]
    if ans + C > 0:
        cnt += 1
print(cnt)


### FIXED CODE ###

N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0

for i in range(N):
    A = list(map(int, input().split()))
    tmp = C
    for i, j in zip(A, B):
        tmp += i * j
    if tmp > 0:
        ans += 1
print(ans)
str=input()
maxcnt=0
cnt=0
for i in range(len(str)):
  if(str[i]=="R"):
    cnt+=1
    maxcnt=max(cnt,max)
  else:
    cnt=0
    
print(max)

### FIXED CODE ###

str=input()
maxcnt=0
cnt=0
for i in range(len(str)):
  if(str[i]=="R"):
    cnt+=1
    maxcnt=max(cnt,maxcnt)
  else:
    cnt=0
    
print(maxcnt)
import math
import copy
import sys
import bisect
input = sys.stdin.readline

def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=math.gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=math.gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( math.gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()

### FIXED CODE ###

def gcd(a, b): #最大公約数
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
        
def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()
import sys,math
for line in sys.stdin.readlines():
    line=raw_input()
    x1,y1,x2,y2,xq,yq=map(float,line.strip().split(","))
    L=((x1-x2)**2+(y1-y2)**2)**0.5
    t=math.atan2(y2-y1,x2-x1)
    R1=((x1-xq)**2+(y1-yq)**2)**0.5
    R2=((x2-xq)**2+(y2-yq)**2)**0.5
    a=math.acos((L*L+R1*R1-R2*R2)/(2*L*R1))
    x,y=x1+R1*math.cos(t+a),y1+R1*math.sin(t+a)
    if not (xq-0.00001<=x<=xq+0.00001 and yq-0.00001<=y<=yq+0.00001):
        print x,y
    else:
        print x1+R1*math.cos(t-a),y1+R1*math.sin(t-a)
#temp

### FIXED CODE ###

import sys
for line in sys.stdin.readlines():
    x1,y1,x2,y2,xq,yq=map(float,line.strip().split(","))
    if x1==x2:
        x,y=-xq+2*x1,yq
    elif y1==y2:
        x,y=xq,-yq+2*y1
    else:
        m=(y1-y2)/(x1-x2)
        n=-m*x1+y1
        x=(2*yq*m-2*m*n+xq-m*m*xq)/(m*m+1)
        y=(xq-x)/m+yq
    print "{:.6f} {:.6f}".format(x+0,y+0)
a, b = map(int, input().split())

if (a+b)%2 == 0 :
    print((a+b)/2))
else :
    print("IMPOSSIBLE")


### FIXED CODE ###

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

if (a+b)%2 == 0 :
    print((a+b)//2)
else :
    print("IMPOSSIBLE")
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=0

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[i]

print(cnt)
      

### FIXED CODE ###

from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)
from math import sqrt
n = int(input())
d = 1000000000000000000000
for i in range(1, sqrt(n)+1):
  if n % i == 0:
    d = min(d, i + n // i - 2)
print(d)


### FIXED CODE ###

from math import sqrt
n = int(input())
d = 1000000000000000000000
for i in range(1, int(sqrt(n))+1):
  if n % i == 0:
    d = min(d, i + n // i - 2)
print(d)
import math, sys
sys.setrecursionlimit(100000000)
mod = 10**9+7
N, K = map(int, input().split())
edge = [[] for _ in range(N)]
flag = [False]*N
flag[0] = True
for i in range(N-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
P = [1]*(K+10)
T = [1]*(K+10)
for i in range(1, K+10):
    P[i] = (P[i-1]*(K-i))%mod
    T[i] = T[i-1]*(K-i-1)%mod
def count(x):
    flag[x]=True
    res = 1
    l = len(edge[x])-1
        
    for e in edge[x]:
        if flag[e]:
            continue
        res*=count(e)
    if x==0:
        return res*K*P[l+1]%mod
    return res*T[l]%mod
print(count(0))


### FIXED CODE ###


N, A, B = map(int, input().split())
print(min(B, A*N))
n = int(input())
V = list(map(int,input().split()))
De = {}
Do = {}
for i in range(n):
    x = V[i]
    if i%2==0:
        if x not in De:
            De[x] = 0
        De[x] += 1
    else:
        if x not in Do:
            Do[x] = 0
        Do[x] += 1
DeL = sorted(list(De.items()),key=lambda x:x[1],reverse=True)
DoL = sorted(list(Do.items()),key=lambda x:x[1],reverse=True)
y = DeL[0][0]
z = DoL[0][0]
if y!=z:
    n0 = n//2-De[y]
    n1 = n//2-Do[z]
elif y==z:
    if De[y]>Do[z]:
        z = DoL[1][0]
        n0 = n//2-De[y]
        n1 = n//2-Do[z]
    elif De[y]<Do[z]:
        y = DeL[1][0]
        n0 = n//2-De[y]
        n1 = n//2-Do[z]
    elif De[y]==Do[z]:
        if De[y]==n//2:
            no = 0
            n1 = n//2
        elif DeL[1][1]>=DoL[1][1]:
            y = DeL[1][0]
            n0 = n//2-De[y]
            n1 = n//2-Do[z]
        else:
            z = DoL[1][0]
            n0 = n//2-De[y]
            n1 = n//2-Do[z]
print(n0+n1)

### FIXED CODE ###

n = int(input())
V = list(map(int,input().split()))
De = {}
Do = {}
for i in range(n):
    x = V[i]
    if i%2==0:
        if x not in De:
            De[x] = 0
        De[x] += 1
    else:
        if x not in Do:
            Do[x] = 0
        Do[x] += 1
DeL = sorted(list(De.items()),key=lambda x:x[1],reverse=True)
DoL = sorted(list(Do.items()),key=lambda x:x[1],reverse=True)
y = DeL[0][0]
z = DoL[0][0]
if y!=z:
    n0 = n//2-De[y]
    n1 = n//2-Do[z]
elif y==z:
    if De[y]>Do[z]:
        z = DoL[1][0]
        n0 = n//2-De[y]
        n1 = n//2-Do[z]
    elif De[y]<Do[z]:
        y = DeL[1][0]
        n0 = n//2-De[y]
        n1 = n//2-Do[z]
    elif De[y]==Do[z]:
        if De[y]==n//2:
            n0 = 0
            n1 = n//2
        elif DeL[1][1]>=DoL[1][1]:
            y = DeL[1][0]
            n0 = n//2-De[y]
            n1 = n//2-Do[z]
        else:
            z = DoL[1][0]
            n0 = n//2-De[y]
            n1 = n//2-Do[z]
print(n0+n1)
from decimal import *
n,m,k=map(Decimal,input().split())
a=list(map(Decimal,input().split()))
b=list(map(Decimal,input().split()))

a.append(10**9+1)
b.append(10**9+1)
k/=10**9
i,j,ans=0,0,0
while k>=0:
    if a[i]>10**9:
        k-=Decimal(b[j]/(10**9))
        j+=1
    elif b[i]>10**9:
        k-=Decimal(a[i]/(10**9))
        i+=1
    elif a[i]>b[j]:
        k-=Decimal(b[j]/(10**9))
        j+=1
    else:
        k-=Decimal(a[i]/(10**9))
        i+=1
    if k<0:
        break
    ans+=1

print(ans)
    

### FIXED CODE ###

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

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
N=int(input())
for i in range(1,10):
  if N%i==0 and N/i<=9:
    print(Yes)
    break
    
  

### FIXED CODE ###

N=int(input())
judge=0
for i in range(1,10):
  if N%i==0 and N/i<=9:
    print("Yes")
    judge=1
    break
if(judge==0):
  print("No")
a = input(α)
b = a.isupper()
print(b)
if b == True:
    print("A")
else:
    print("a")


### FIXED CODE ###

a = input()
b = a.isupper()
if b == True:
    print("A")
else:
    print("a")
a,b,c = map(int, input().split())
flag = 0
for i in range(1,b+1):
    if (a*1-c)%b==0:
        flag = 1
        break
print('YES' if flag = 1 else 'NO')


### FIXED CODE ###

a,b,c = map(int, input().split())
flag = 0
for i in range(1,b+1):
    if (a*i-c)%b==0:
        flag = 1
        break
print('YES' if flag == 1 else 'NO')
tmp = list(map(int, input().split()))
a = tmp[0]
b = tmp[1]
c = tmp[2]
d = tmp[3]

divc = b // c - (a-1) // c
divd = b // d - (a-1) // d

lcmcd = c * d // math.gcd(c,d)
divcd = b // lcmcd - (a-1) // lcmcd

print(b - a + 1 - divc - divd + divcd)

### FIXED CODE ###

import fractions

tmp = list(map(int, input().split()))
a = tmp[0]
b = tmp[1]
c = tmp[2]
d = tmp[3]

divc = b // c - (a-1) // c
divd = b // d - (a-1) // d

lcmcd = c * d // fractions.gcd(c,d)
divcd = b // lcmcd - (a-1) // lcmcd

print(b - a + 1 - divc - divd + divcd)
a=[N,K,X,Y]
for i in range(0,4):
    a=append(input())
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
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    #mng = [][]
    sl = []
    for _ in range(N):
        sl.append(sorted(sys.stdin.readline().rstrip()))

    ans = 0
    while True:
        if sl == []:
            break
        e = sl[0]
        cnt = sl.count(e)
        if cnt > 1:
            n = cnt
            r = 2
            ans += factorial(n) / factorial(r) / factorial(n - r)
        sl = [x for x in sl if x != e]

    print(int(ans))

    """
    sl = []
    mng = []
    for _ in range(N):
        s = set(sys.stdin.readline().rstrip())
        if s in sl:
            i = sl.index(s)
            mng[i] += 1
        else:
            sl.append(s)
            mng.append(0)

    ans = 0
    r = 2
    #print(mng)
    for n in mng:
        if n > 0:
            n += 1
            ans += factorial(n) / factorial(r) / factorial(n - r)

    print(int(ans))
    """

### FIXED CODE ###

import math
import sys
import itertools
import queue
from fractions import gcd

import sys
sys.setrecursionlimit(10000)

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial
import collections

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    #mng = [][]
    sl = []
    for _ in range(N):
        tmp = sorted(sys.stdin.readline().rstrip())
        #print(''.join(tmp))
        sl.append(''.join(tmp))
    #print(sl)
    c = collections.Counter(sl)
    ans = 0
    for n in c.values():
        r = 2
        if n > 1:
            ans += factorial(n) // (factorial(n - r) * factorial(r))

    print(int(ans))
a = int(input())
b = int(input())

print(a * b, 2 * (a+b))

### FIXED CODE ###

a, b = map(int, raw_input().split())
print(str(a*b) + " " + str(2*(a+b)))
X, A = int(input().split(''))
if X < A:
    print(0)
else:
    print(10)


### FIXED CODE ###

X, A = map(int, input().split(' '))
if X < A:
    print(0)
else:
    print(10)
S = input()

c0=0
c1=0
for i in S:
  if i == '0':
    c0+=1
  elif:
    c1+=1

print(2*min(c0,c1))


### FIXED CODE ###

S = input()

c0=0
c1=0
for i in S:
  if i == '0':
    c0+=1
  else:
    c1+=1

print(2*min(c0,c1))
c=input()
boin=[a,e,i,o,u]
if c in boin:
	print("vowel")
else:
	print("consonant")

### FIXED CODE ###

c=input()
boin=["a","e","i","o","u"]
if c in boin:
	print("vowel")
else:
	print("consonant")
sd = input()
t = input()

for i in range(len(sd) - len(t) + 1):
    cnt = 0
    q = 0
    for j in range(len(t)):
        if sd[i + j] == '?':
            q += 1
            continue
        if sd[i + j] == t[j]:
            cnt += 1
    if cnt == len(t) - q:
        idx = i
        s = sd[:idx] + t + sd[idx + len(t) + 1:]
        for k in range(len(sd)):
            if s[k] == '?':
                s = s[:k] + 'a' + s[k + 1:]
                print(s)
        break
else:
    print('UNRESTORABLE')

### FIXED CODE ###

s = input()
t = input()

for i in range(len(s) - len(t) + 1)[::-1]:
    cnt = 0
    q = 0
    for j in range(len(t))[::-1]:
        if s[i + j] == '?':
            q += 1
        elif s[i + j] == t[j]:
            cnt += 1
    
    if cnt == len(t) - q:
        idx = i
        s = s[:idx] + t + s[idx + len(t):]
        for k in range(len(s)):
            if s[k] == '?':
                s = s[:k] + 'a' + s[k + 1:]
        print(s)
        break
else:
    print('UNRESTORABLE')
from itertools import product
from collections import Counter
N=int(input())
D=list(map(int, input().split()))
print(list(sorted(D)))
res=0
c=Counter(D).values()
if c[0]>0 or max(c)>2:print(0);exit()
if N>13:print(1);exit()
for b in product(*((d,24-d) for d in D)):
    d0, m= 0,1<<30
    for d in sorted(b):
        m=min((d-d0),24-(d-d0),m)
        d0=d
    m=min(d0,24-d0,m)
    res = max(res,m)
print(res)

### FIXED CODE ###

from collections import Counter
import marshal
N = int(input())
D = Counter(list(map(int, input().split())))
P = [[0]]
for i in range(13):
    if D.get(i,0) == 0:
        continue
    if D.get(i,0) == 1:
        Q = marshal.loads(marshal.dumps(P))
        for p in P:
            p.append(i)
        for q in Q:
            q.append(24-i)
        P += Q
    if D.get(i,0) == 2:
        for p in P:
            p.append(i)
            p.append(24-i)
    if D.get(i,0) >= 3:
        print(0)
        exit()
res = 0
for p in P:
    m = float("inf")
    for i in range(len(p)):
        for j in range(i+1,len(p)):
            if abs(p[i]-p[j])>12:
                m = min(24-abs(p[i]-p[j]),m)
            else:
                m = min(abs(p[i]-p[j]),m)
    res = max(m,res)
print(res)
# -*- coding: utf-8 -*-
N = int(input())
G = [None for i in range(N)]
for i in range(N):
  temp = list(map(int, input().split()))
  G[i] = temp[1:]
  
INF = 2**31 -1

temp = 1
while temp < N:
  temp *= 2

lis = [INF for i in range(2*temp-1)]

def getSum(x):
  x += temp-1
  w_sum = lis[x]
  while x > 0:
    x = (x-1) // 2
    w_sum += lis[x]
  return w_sum

def add(a, b, x, k=0, l=0, r=temp):
  if r <= a or b <= l:
    return 0

  if a <= l and r <= b:
    lis[k] += x
    return 0
  
  add(a, b, k*2+1, l, (l+r)//2)
  add(a, b, k*2+2, (l+r)//2, r)
arr = [[0,0] for i in range(200010)]

def dfs(k, a=0):
  arr[0][k] = a
  a += 1
  for i in range(len(G[k])):
    dfs(G[k][i])
  arr[1][k] = a
  
dfs()
Q = int(intput())
for i in range(Q):
  querry = list(map(int, input().split()))
  if querry[0] == 0:
    add()
  else:
    print(getSum()




### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(1000000)

class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10*6)

def search(values,hp,vp,item):
	if not (0<=hp<len(values)): return
	if not (0<=vp<len(values[hp])): return
	if item!=values[hp][vp]: return
	values[hp][vp]=True
#	for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
#		search(values,hp+dh,vp+dv,item)
	search(values,hp-1,vp,item)
	search(values,hp+1,vp,item)
	search(values,hp,vp-1,item)
	search(values,hp,vp+1,item)

def solve(values):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(values)):
		for j in range(len(values[i])):
			if values[i][j] in valid_items:
				search(values,i,j,values[i][j])
				count+=1
	return count

def main():
	line,values=input().strip(),list()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		value = list()
		for _ in range(H):
			value.append(list(x for x in input().strip()))
		print(solve(value))
		values.append(value)
		line = input().strip()
#	for value in values:
#		print(solve(value))

if __name__=='__main__':
	main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**6)

def search(field,hp,vp,item):
	if not (0<=hp<len(field)): return
	if not (0<=vp<len(field[hp])): return
	if item!=field[hp][vp]: return
	field[hp][vp]=True
	for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
		search(field,hp+dh,vp+dv,item)
#	search(field,hp-1,vp,item)
#	search(field,hp+1,vp,item)
#	search(field,hp,vp-1,item)
#	search(field,hp,vp+1,item)

def solve(field):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(field)):
		for j in range(len(field[i])):
			if field[i][j] in valid_items:
				search(field,i,j,field[i][j])
				count+=1
	return count

def main():
	line = input().strip()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		field = list()
		for _ in range(H):
			field.append(list(input().strip()))
		print(solve(field))
		line = input().strip()

if __name__=='__main__':
	main()
# C - Guess The Number
def guess_number(N: int, M: int, conditions: list) -> int:
    if N == 1:
        digit, num = conditions[0]
        if len(set(conditions)) == 1 and digit == 1:
            return num
        return -1

    if any(cond == (1, 0) for cond in conditions):  # 1st digit mustn't be 0
        return -1

    result = [0] * N
    for digit, num in conditions:
        if result[-digit] not in (0, num):
            return -1
        result[-digit] = num
    return sum(x * (10 ** i) for i, x in enumerate(result))


def main():
    N, M, *SC = map(int, open(0).read().split())
    conditions = list(zip(*[iter(SC)] * 2))
    ans = guess_number(N, M, conditions)
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

# C - Guess The Number
def guess_number(N: int, conditions: list) -> int:
    if N > 1 and any(cond == (1, 0) for cond in conditions):  # 1st digit mustn't be 0 if N > 1
        return -1
    result = [-1] * N
    for digit, num in conditions:
        if result[-digit] >= 0 and result[-digit] != num:
            return -1
        result[-digit] = num
    if result[-1] == -1:  # 1st digit must be 1 if N > 1 (no leading zeros)
        result[-1] = 1 if N > 1 else 0
    return sum(x * (10 ** i) if x != -1 else 0 for i, x in enumerate(result))


def main():
    N, M, *SC = map(int, open(0).read().split())
    conditions = list(zip(*[iter(SC)] * 2))
    ans = guess_number(N, conditions)
    print(ans)


if __name__ == "__main__":
    main()
N = int(input())
A = [0]*N

print(A)
for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N+1):
    print(A[j])

### FIXED CODE ###

N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])
#include<bits/stdc++.h>
using namespace std;

#define int long long

int mod = 1000000007;

// #include "debug.cpp"

int dp[1000010][4];

int32_t main(){
	int n;
	cin >> n;

	if(n == 1){
		cout << "0\n";
		return 0;
	}

	dp[2][0] = 64;
	dp[2][1] = 17;
	dp[2][2] = 17;
	dp[2][3] = 2;

	for(int i=3; i<=n; i++){
		dp[i][0] = dp[i-1][0]*8;
		dp[i][1] = dp[i-1][0] + dp[i-1][1]*9;
		dp[i][2] = dp[i-1][0] + dp[i-1][2]*9;
		dp[i][3] = dp[i-1][1] + dp[i-1][2] + dp[i-1][3]*10;

		dp[i][0] %= mod;
		dp[i][1] %= mod;
		dp[i][2] %= mod;
		dp[i][3] %= mod;
	}

	cout << dp[n][3] << "\n";
}

### FIXED CODE ###

x = int(input())
print(x^1)