Harryxun/stf_run huggingface dataset:
A,B = map(int,input().split())
a = format(A-1,'b')
b = format(B,'b')
le = len(b)
part = []
whole = []
for i in range(1,le+1):
  whole += [int(b[i-1])]
  df = le - len(a)
  if i <= df:
    part += [0]
  else:
    part += [int(a[i-1-df])]
p = 0
for i in range(le):
  p *= 10
  if i == le-1:
    if int(a)%4 == 1 or int(a)%4 == 2:
      p += 1
  elif part[i] == 0:
    pass
  else:
    p += 1- int(a)%2
w = 0
for i in range(le):
  w *= 10
  if i == le-1:
    if int(b)%4 == 1 or int(b)%4 == 2:
      p += 1
  elif whole[i] == 0:
    pass
  else:
    w += 1- int(b)%2
print(int(str(p),2)^int(str(w),2))

### FIXED CODE ###

a,b = map(lambda x:
          int(format(int(x),'b')),input().split())
a -= 1
A = str(a)
la = len(A)
ga = [0]*la
if a%4 == 1 or a%4 == 2:
  ga[-1] = 1
for ai in range(0,la-1):
  if A[ai] == '1' and A[-1] == '0':
    ga[ai] = 1
aa = 0
for ai in range(la):
  aa *= 2
  aa += ga[ai]
B = str(b)
lb = len(B)
gb = [0]*lb
if b%4 == 1 or b%4 == 2:
  gb[-1] = 1
for bi in range(0,lb-1):
  if B[bi] == '1' and B[-1] == '0':
    gb[bi] = 1
bb = 0
for bi in range(lb):
  bb *= 2
  bb += gb[bi]
if a < 0:
  print(bb)
else:
  print(aa^bb)
N = int(input())
S = input()

for l in reversed(range(1,N//2+1)):
    for i in range(N-2*l+1):
        for j in range(i+l,N-l+1):
            print(S[i:i+l],S[j:j+l])
            if S[i:i+l] == S[j:j+l]:
                print(l)
                exit()

print(0)

### FIXED CODE ###

from itertools import accumulate
max2 = lambda x,y: x if x > y else y
min2 = lambda x,y: x if x < y else y

N = int(input())
S = input()

res = 0
for i in range(1,N):
    m = 0
    r = 0
    for a,b in zip(S,S[i:]):
        if a == b:
            r += 1
        else:
            r = 0
        m = max2(m,r)
    m = min2(m,i)
    res = max2(res, m)

print(res)
p, q, r = map(int, input().split())
sorted_list = sorted(list[p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)


### FIXED CODE ###

p, q, r = map(int, input().split())
sorted_list = sorted([p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)
N = int(input())
S = input()
print(max([len(set(S[:i]).intersection(set(S[i:]))) for i in range(N)]))


### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b,max(a-b,a*b)))
# coding: utf-8
L = [0 for _ in range(8)]
N = int(input())
A = list(map(int, input().split()))
v = 0
for i in range(N):
    idx = A[i] // 400
    if idx > 8:
        v += 1
    else:
        L[idx] += 1
amin, amax = 0, 0
for i in range(len(L)):
    if L[i] > 0:
        amin += 1
    if L[i] == 0 and v > 0:
        L[i] += 1
        v -= 1
amin = max(1, amin)
for i in range(len(L)):
    if L[i] > 0:
        amax += 1
print(amin, amax)

### FIXED CODE ###

# coding: utf-8
L = [0 for _ in range(8)]
N = int(input())
A = list(map(int, input().split()))
v = 0
for i in range(N):
    idx = A[i] // 400
    if idx >= 8:
        v += 1
    else:
        L[idx] += 1
amin, amax = 0, 0
for i in range(len(L)):
    if L[i] > 0:
        amin += 1
    # if L[i] == 0 and v > 0:
    #     L[i] += 1
    #     v -= 1
# amin = max(1, amin)
# for i in range(len(L)):
#     if L[i] > 0:
#         amax += 1
print(max(1, amin), amin + v)
n,m =list(map(int,input().split(" ")))
xs  =list(map(int,input().split(" ")))
ys =list(map(int,input().split(" ")))
MOD = (10**9) + 7
x_diff = [abs(i - j) for i,j in zip(xs[:n-1],xs[1:n]) ]
y_diff = [abs(i - j) for i,j in zip(ys[:n-1],ys[1:n]) ]

cot = 1
x = 0
for i in range(n -1 ):
    x +=cot * (n-i -1) * x_diff[i]
    cot += 1

cot = 1
y = 0
for i in range(m -1):
    y += cot * (m-i -1) * y_diff[i]
    cot += 1



print (x* y % MOD )


### FIXED CODE ###


n,m =list(map(int,input().split(" ")))
xs  =list(map(int,input().split(" ")))
ys =list(map(int,input().split(" ")))
MOD = (10**9) + 7
x_diff = [abs(i - j) for i,j in zip(xs[:n-1],xs[1:n]) ]
y_diff = [abs(i - j) for i,j in zip(ys[:m-1],ys[1:m]) ]

cot = 1
x = 0
for i in range(n -1 ):
    x +=cot * (n-i -1) * x_diff[i]
    cot += 1

cot = 1
y = 0
for i in range(m -1):
    y += cot * (m-i -1) * y_diff[i]
    cot += 1



print (x* y % MOD )
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    tmp_color = 1
    for edge in n_list[node]:
        try:
            if edge[1] == parent_edge_id:
                continue
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            tmp_color += 1
        except Exception:
            print(0)
        paint(edge[0], edge[1])

    
paint(tmp[0][0], -1)
print(tmp[0][1]) # color num    a
for i in range(N-1):
    print(colors[i])

### FIXED CODE ###

import sys
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    #print(node, parent_edge_id)
    tmp_color = 1
    for edge in n_list[node]:
        #print("ege:", edge)
        if edge[1] != parent_edge_id:
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            paint(edge[0], edge[1])
            tmp_color += 1

    
sys.setrecursionlimit(10**7)
paint(tmp[0][0], -1)
print(tmp[0][1]) # color num 
for i in range(N-1):
    print(colors[i])
N = int(input())
H = list(map(int, input().split()))
C = [0 for i in range(N)]
for i in range(N):
  if i == 0:
    C[i] == 0
  elif i == 1:
    c[i] == abs(H[i-1]-H[i])
  else:
    c[i] == min(abs(H[i-1]-H[i]), abs(H[i-2]-H[i]))
print(c[i])

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
C = [0 for i in range(N)]
for i in range(N):
  if i == 0:
    C[i] = 0
  elif i == 1:
    C[i] = abs(H[i-1]-H[i])
  else:
    C[i] = min(C[i-1] + abs(H[i-1]-H[i]), C[i-2] + abs(H[i-2]-H[i]))
print(C[N-1])
n=int(input())
pn = input().split()

a = 9999
b = 9999
c = 9999
cnt = 0

for i in range(n):
	c = pn[i]
	if i >= 2
		if (a<b and b<c) or (c<b and b<a) or (a==b and b>c) or (b==a and b>c)or(a==c and b>a):
			cnt += 1
	a = b
	b = c

print(cnt)

### FIXED CODE ###

n=int(input())
pn = list(map(int, input().split()))
cnt = 0

for i in range(1, n-1):
		if pn[i-1]<pn[i]<=pn[i+1] or pn[i+1]<pn[i]<=pn[i-1]:
			cnt += 1
print(cnt)
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
a = np.array(input().split(), dtype='int')

ans = ''
count_all = 0

for j in range(n):
    num = a[j]
    if len(a[a == num]) != 1:
        ans == 'NO'
        break
    a = np.delete(a, j)

if ans == 'NO':
    print(ans)
else:
    print('YES')

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
a = np.array(input().split(), dtype='int')

a_sort = np.sort(a)
ans = ''

for i in range(n - 1):
    if a_sort[i] == a_sort[i + 1]:
        ans = 'NO'
        break
    
if ans == 'NO':
    print(ans)
else:
    print('YES')
a, b = map(int, raw_input().split)
print a * b, 2 * a + 2 * b

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
if len(odds) > len(evens):
    evens.append("")
chars = []
for odd, even in zip_longest(odd, even, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

### FIXED CODE ###

from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
chars = []
for odd, even in zip_longest(odds, evens, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)
a, b, c, d = [0] * n, [0] * n, [0] * m, [0] * m
for i in range(n):
    a[i], b[i] = map(int, input().split())
for i in range(m):
    c[i], d[i] = map(int, input().split())

for i in range(n):
    min_dist, min_c = abs(a[0]-c[0]) + abs(b[0]-d[0]), 0
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)

### FIXED CODE ###

n, m = map(int, input().split())
a, b, c, d = [0] * n, [0] * n, [0] * m, [0] * m
for i in range(n):
    a[i], b[i] = map(int, input().split())
for i in range(m):
    c[i], d[i] = map(int, input().split())

for i in range(n):
    min_dist, min_c = 10**9, -1
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)
# 辺と長さが与えられる
# 頂点1からの各点の距離を計算する
sys.setrecursionlimit(100000)
N = int(input())
path = [[] for _ in range(N + 1)]
for _ in range(N - 1):
  u, v, w = map(int, input().split())
  # 無向グラフ
  path[u].append((v, w))
  path[v].append((u, w))
  # d[0]は使わない
  d = [-1] * (N + 1)

  def walk(i, c):
    if d[i] == -1:
      d[i] = c
      for x, w in path[i]:
        walk(x, c + w)

        walk(1, 0)
        for c in d[1:]:
          print(c)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def tree_path():
    # 辺と長さが与えられる
    # 頂点1からの各点の距離を計算する
    # 距離が偶数か奇数かで色分け
    sys.setrecursionlimit(100000)
    n = int(input())
    path = [[] for _ in range(n + 1)]
    for _ in range(n - 1):
        u, v, w = map(int, input().split())
        # 無向グラフ
        path[u].append((v, w))
        path[v].append((u, w))
    # d[0]は使わない
    d = [-1] * (n + 1)

    def walk(i, c):
        if d[i] == -1:
            d[i] = c
            for x, w in path[i]:
                walk(x, c + w)

    walk(1, 0)
    for i in d[1:]:
        print(i % 2)

        
tree_path()
# input
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    T[P[i][0]] -= P[i][1]
    print(sum(T))
    T[P[i][0]] += P[i][1]

### FIXED CODE ###

# input
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    temp = T[P[i][0] - 1]
    T[P[i][0] - 1] = P[i][1]
    print(sum(T))
    T[P[i][0] - 1] = temp
n, k = map(int, input().split())
lr = list(input())
j = 0
counts = [0]
for i in range(n):
    if lr[j] == lr[i]:
        counts[-1] += 1
    else:
        j = i
        counts.append(1)

for _ in range(k):
    if len(counts)>=3:
        counts[0] += counts[1]+counts[2]
        del counts[1:3]
    else:
        counts[0] += counts[1]
        del counts[1]

count = sum(counts) - len(counts)
print(count)

### FIXED CODE ###

n, k = map(int, input().split())
lr = list(input())
j = 0
counts = [0]
for i in range(n):
    if lr[j] == lr[i]:
        counts[-1] += 1
    else:
        j = i
        counts.append(1)

for _ in range(k):
    if len(counts)>=3:
        counts[0] += counts[1]+counts[2]
        del counts[1:3]
    elif len(counts)==2:
        counts[0] += counts[1]
        del counts[1]
    else:
        break

count = sum(counts) - len(counts)
print(count)
def main():
    import sys
    input = sys.stdin.readline
    k, q = map(int, input().split())
    d = list(map(int, input().split()))
    query = [list(map(int, input().split())) for i in range(q)]
    for n, x, m in query:
        print(answer_query(n, x, m))

def answer_query(n, x, m):
    l = []
    for i in range(k):
        l.append(d[i]%m)
    zero = l.count(0)
    total = sum(l)*((n-1)//k)
    total += x%m
    zero_total = zero*((n-1)//k)

    s = n
    n -= 1
    n -= n//k * k
    t = 0
    for i in range(n):
        t += l[i]
    total += t

    for i in range(n):
        if l[i] == 0:
            zero_total += 1

    return s-1-total//m-zero_total

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
k, q = map(int, input().split())
d = list(map(int, input().split()))
query = [None]*q
for i in range(q):
    query[i] = list(map(int, input().split()))

def answer_query(n, x, m):
    l = [m if i%m == 0 else i%m for i in d]
    count = n // k
    rem = n % k
    s = sum(l)
    total = s%m * count + x%m
    for i in range(rem):
        total += l[i]

    total //= m
    total += s//m * count

    print(n-total)


for n, x, m in query:
    answer_query(n-1, x, m)
n=int(input())
a=list(int,input().split())
al=[a[2*i] for i in range(n//2)]
bo=[a[2*i+1] for i in range(n//2)]
print(sum(al)-sum(bo))

### FIXED CODE ###

N=input()
a=list(map(int,input().split()))
alice=0
bob=0
a=sorted(a,reverse=True)
for i in range(int(N)):
    if i%2==0:
        alice+=a[i]
    else:
        bob+=a[i]
print(alice-bob)
n=int(input())
A=[int(x) for x in input().split()]
B=sorted(A)
Alice=[]
Bob=[]
while len(B)!=0 or len(B)!=1:
  Alice.append(B[-1])
  B.pop()
  Bob.append(B[-1])
  B.pop()
if len(B)==1:
  Alice.append(B[0])
  B.pop()
print(sum(Alice)-sum(Bob))

### FIXED CODE ###

n=int(input())
A=[int(x) for x in input().split()]
B=sorted(A)
Alice=[]
Bob=[]
while len(B)!=0 and len(B)!=1:
  Alice.append(B[-1])
  B.pop()
  Bob.append(B[-1])
  B.pop()
if len(B)==1:
  Alice.append(B[0])
  B.pop()
print(sum(Alice)-sum(Bob))
n,k=map(int,input().split())
s=list(input())
point=s[0]
count=1
while k!=0:
    if s[count]!=point:
        while 1:
            if s[count]!=point:
                s[count]=point
                count +=1
            elif s[count]==point:break
        k -=1
    else:
        count +=1

ans=0
for i in range(n-1,0,-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))
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M, Q = map(int, input().split())
trains = []
for _ in range(M):
    a, b = map(int, input().split())
    trains.append([a, b])

query = []
for _ in range(Q):
    a, b = map(int, input().split())
    query.append([a, b])


def solve():
    # i駅目以前に(i駅も含む)出発した電車
    start_acc = [0]*(N+2)
    # i駅目以前に(i駅も含む)終点を迎えた電車
    finished_acc = [0]*(N+2)

    train = sorted(trains, key=lambda x: x[0])

    # 各駅の出発・到着数をカウント
    for start, dest in train:
        start_acc[start] += 1
        finished_acc[dest] += 1

    # 累積和にする
    for i in range(1, N+2):
        start_acc[i] += start_acc[i-1]
        finished_acc[i] += finished_acc[i-1]

    # qs~qdの数 = qD(を含む)までに終わった数 - qs(を含む)までに終わったやつ - qs(を含まない)より前に出発したやつ
    ans = []
    for qs, qd in query:
        a = finished_acc[qd] - finished_acc[qs-1] - start_acc[qs-1]
        ans.append(a)

    return ans


def solve2():
    start = [set() for _ in range(N+1)]
    end = [set() for _ in range(N+1)]

    for i in range(M):
        tr = trains[i]
        s = tr[0]
        g = tr[1]
        start[s].add(i)
        end[g].add(i)

    for i in range(1, N+1):
        start[i] |= start[i-1]
        end[i] |= end[i-1]

    ans = []
    for ds, dq in query:

        ans.append(len((start[dq] - start[ds-1]) & (end[dq] - end[ds-1])))

    return ans


ans = solve2()
for a in ans:
    print(a)


### FIXED CODE ###

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

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

mat = [[0]*(N+1) for _ in range(N+1)]

for _ in range(M):
    a, b = map(int, input().split())
    mat[a][b] += 1


def solve():

    for i in range(N+1):
        for j in range(1, N+1):
            mat[i][j] += mat[i][j-1]

    ans = []

    for _ in range(Q):
        ql, qr = map(int, input().split())
        tmp = 0
        for i in range(ql, qr+1):
            tmp += mat[i][qr] - mat[i][ql-1]
        ans.append(tmp)

    for a in ans:
        print(a)


def solve2():

    for i in range(1, N+1):
        for j in range(1, N+1):
            mat[i][j] += mat[i-1][j] + \
                mat[i][j-1] - mat[i-1][j-1]

    ans = [0]*Q
    for i in range(Q):
        ql, qr = map(int, input().split())
        t = mat[qr][qr] - mat[ql-1][qr] - mat[qr][ql-1] + mat[ql-1][ql-1]
        ans[i] = t

    for a in ans:
        print(a)


solve2()
a,b=map(int,input().split())
print(40,100)
rows=['#'*100 for _ in range(20)]+['.'*100 for _ in range(20)]
rows[0]='#.'*(a%50-1)+'##'*(51-a%50)
for i in range(a//50):
  rows[2*i+2]='#.'*50
rows[21]='#.'*(b%50-1)+'..'*(51-b%50)
for i in range(b//50):
  rows[2*i+23]='#.'*50
for row in rows:
  print(row)


### FIXED CODE ###

a,b=map(int,input().split())
print(40,100)
rows=['#'*100 for _ in range(20)]+['.'*100 for _ in range(20)]
rows[0]='#.'*((a-1)%50)+'##'*(50-(a-1)%50)
for i in range((a-1)//50):
  rows[2*i+2]='#.'*50
rows[21]='#.'*((b-1)%50)+'..'*(50-(b-1)%50)
for i in range((b-1)//50):
  rows[2*i+23]='#.'*50
print('\n'.join(rows))
# -*- coding: utf-8 -*-
# モジュールのインポート
import math
import numpy as np

# 標準入力の取得
A, B, N = list(map(int, input().split()))


def func(x: np.ndarray) -> np.ndarray:
    return np.floor(A*x/B) - A*np.floor(x/B)


# 求解処理
MAX_VALUE = pow(10, 7)
result = 0
for i in range((N//MAX_VALUE)+1):
    x = np.array([])
    if i == 0:
        x = np.arange(min(N, B-1), min(N, MAX_VALUE)+1, B)
    else:
        x = np.arange(MAX_VALUE*i, min(N, MAX_VALUE*(i+1))+1, B)
    x = func(x)
    result = max(result, int(np.max(x)))

# 結果出力
print(result)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, N = list(map(int, input().split()))


def f(x: int) -> int:
    return math.floor(A*x/B) - A*math.floor(x/B)


# 求解処理
result = f(min(B-1, N))

# 結果出力
print(result)
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))

count = {}

for i in range(n):
    if d[i] in count.keys():
        count[d[i]] += 1
    else:
        count[d[i]] = 1  

for i in range(m):
    if count[t[i]] == 0:
        print("NO")
        break
    else:
        count[t[i]] -=1
    if i == m-1:
        print("YES")

### FIXED CODE ###

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

count = {}

for i in range(n):
    if d[i] in count.keys():
        count[d[i]] += 1
    else:
        count[d[i]] = 1  

for i in range(m):
    if t[i] not in count.keys():
        print("NO")
        break
    if count[t[i]] == 0:
        print("NO")
        break
    else:
        if t[i] not in count.keys():
            print("NO")
            break
        else:
            count[t[i]] -=1
    if i == m-1:
        print("YES")
n = int(input())
p = 10**9 + 7

# def fact(n, p):
#     n_ = 1
#     yield n_
#     for i in range(1, n+1):
#          n_ = (n_*i) % p
#          yield n_

# def invfact(n, f, p):
#     m = pow(f[n], p-2, p)
#     yield m
#     for i in range(n, 0, -1):
#         m = m * i % p
#         yield m

def fact(n, p):
    n_ = [1]
    for i in range(1, n+1):
         n_.append((n_[-1]*i) % p)
    return n

def invfact(n, f, p):
    m = [pow(f[n], p-2, p)]
    for i in range(n, 0, -1):
        m.append(m[-1] * i % p)
    return m

ans = 0
m = n - 1
f = fact(m, p)
rf = invfact(m, f, p)
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    perm_ = f[k-1] * rf[2*k-n] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

### FIXED CODE ###

n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    b = m - k
    a = (m - 1) - (2 * b)
    perm_ = f[a+b] * rf[a] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)
try:
    while True:
        a,b,c,d,e,f=map(int, input().split())
        print( (c*e-b*f)/)a*e-b*d), (a*f-c*d)/(a*e-b*d))
except EOFError:
    pass

### FIXED CODE ###

try:
    while True:
        a,b,c,d,e,f=map(float, input().split())
        x=(c*e-b*f)/(a*e-b*d)
        y=(a*f-c*d)/(a*e-b*d)
        if x==0:
            x=0
        if y==0:
            y=0
        print("{0:.3f}".format(round(x,3)), "{0:.3f}".format(round(y,3)))
except EOFError:
    pass
import math

N = input()
print(math.ceil(N/2))

### FIXED CODE ###

import math
 
N = float(input())
print(math.ceil(N/2))
import bisect
N = int(input())
candidate = [int(i*111) for i in range(1,10)]
print(candidate[bisect.bisect_right(candidate, N)])

### FIXED CODE ###

import bisect
N = int(input())
candidate = [int(i*111) for i in range(1,10)]
print(candidate[bisect.bisect_left(candidate, N)])
import numpy as np
n,k = map(int,input().split())
c = [0] * (10**5+1)
for _ in range(n):
  a,b = map(int,input().split())
  c[a] += b

A = np.array(c,dtype=np.int32)
A = A.cumsum()
answer = (A >= k).nonzero()[0].min()
print(answer)

### FIXED CODE ###

import numpy as np
n,k = map(int,input().split())
c = [0] * (10**5+1)
for _ in range(n):
  a,b = map(int,input().split())
  c[a] += b

A = np.array(c,dtype=np.int64)
A = A.cumsum()
answer = (A >= k).nonzero()[0].min()
print(answer)
a = int(input("ここに数値を入力してください:"))
b = int(input("ここに数値を入力してください:"))
c = int(input("ここに数値を入力してください:"))

if a + b + c == 17:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input().split(" ")
if s.count('5') == 2 and s.count('7') == 1:
	print("YES")
else:
	print("NO")
from collections import Counter
c = Counter(list(input())).values()
print(2 * min(c))
from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))


### FIXED CODE ###

from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))
n, k = map(int,input().split())
a = list(map(int, input().split()))
t = [1]
x = [0]*n
x[0] = 1
y = 1
z = 0
d = 0
for i in range(k):
    t.append(a[t[i]-1])
    if x[a[t[i]-1]-1] != 0:
        y = x[a[t[i]-1]-1]
        z = i+2
        b = [a[t[i]-1]]
        break
    else:
        x[a[t[i]-1]-1] += i+2
        z = i+2

d = z-y


if d != 0:
    r = (k - y) % d
else:
    r = k - y

for i in range(r+1):
    b.append(a[b[i]-1])

print(b[r+1])


### FIXED CODE ###

n, k = map(int,input().split())
a = list(map(int, input().split()))
t = [1]
x = [0]*n
x[0] = 1
y = 1
z = 0
d = 0
flag = False
for i in range(k):
    t.append(a[t[i]-1])
    if x[a[t[i]-1]-1] != 0:
        y = x[a[t[i]-1]-1]
        z = i+2
        b = [a[t[i]-1]]
        break
    else:
        x[a[t[i]-1]-1] += i+2
        z = i+2
        b = [a[t[i]-1]]
    if i == k - 1:
        flag = True

if flag:
    print(a[t[k-1]-1])
    exit()

d = z-y


if d != 0:
    r = (k - y) % d
else:
    r = k - y

for i in range(r+1):
    b.append(a[b[i]-1])

print(b[r+1])
N, X, M = map(int,input().split())
a = [X]
sa = set([X])
for i in range(1,N):
  X = (X**2)%M
  if X in sa:
    break
  else:
    a.append(X)
    sa.add(X)

if i==N-1:
  print(sum(a))
  exit()
start = a.index(X)
ans = sum(a[:start])
base = sum(a[start:])
rep = i-start
sets = (N-start)//rep
more = (N-start)%rep
ans += base*sets + sum(a[start:start+more])
print(ans)

### FIXED CODE ###

N, X, M = map(int,input().split())
if N==1:
  print(X)
  exit()
a = [X]
sa = set([X])
for i in range(1,N):
  X = (X**2)%M
  if X in sa:
    break
  else:
    a.append(X)
    sa.add(X)

if i==N-1:
  print(sum(a))
  exit()
start = a.index(X)
ans = sum(a[:start])
base = sum(a[start:])
rep = i-start
sets = (N-start)//rep
more = (N-start)%rep
ans += base*sets + sum(a[start:start+more])
print(ans)
N = int(input())
x_li = list(map(int, input().split()))
import math
ans = math.inf
for i in range(1, 101):
    d = 0
    for j in range(N):
        d += (x_li[j] - i) ** 2
    ans = min(ans, d)
print(ans)


### FIXED CODE ###

N = int(input())
x_li = list(map(int, input().split()))
ans = 10000000000000
for i in range(1, 101):
    d = 0
    for j in range(N):
        d += (x_li[j] - i) ** 2
    ans = min(ans, d)
print(ans)