Harryxun/stf_run huggingface dataset:
N = int(input())
h = list(map(int, input().split()))


# DP 最小化問題用 change minimum
# 2つの引数をとり，1つめより2つめが小さかったら更新する

def chmin(array, x):
    if (array > x):
        array = x
        return array
    return array

#大きな値
INF = 9999

# DPtable
dp = [INF]*10000

#初期条件
dp[0] = 0

#ループ
for i in range(N):
    if i == 0:
        continue
    else:
        x = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        dp[i] = x
        if i > 1:
            x1 = chmin(dp[i], dp[i-2] + abs(h[i]-h[i-2]))
            dp[i] = x1

# print(dp[0:N])

print(dp[N-1])


### FIXED CODE ###

# N = int(input())
# h = list(map(int, input().split()))
# 
# #大きな値
# INF = 9999
# 
# # DPtable
# dp = [INF]*9999
# 
# #初期条件
# dp[0] = 0
# dp[1] = abs(h[1]-h[0])
# 
# #ループ
# for i in range(N):
#     if i == 0 or i == 1:
#         continue
#     else:
#         dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))
# 
# print(dp[N-1])

N = int(input())
h = list(map(int, input().split()))
dp = [10 ** 10 for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[-1])
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i-1] 
    if b > 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()[:-1]
n = int(input())
l = list(map(int, input().split(" ")))
output = 1

if 0 in l:
    print(0)
    sys.exit()

for i in range(n):
    output = output * int(l[i])
    if output > 10 ** 18:
        output = -1
        break
print(output)
L = input()

L/=3
print(pow(L,3))

### FIXED CODE ###

L = int(input())
print(pow(L/3,3))
x = int(input())
if x = 3 oe x = 5 or x= 7:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

x = int(input())
if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO")
import math
import sys
sys.setrecursionlimit(100000)

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

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

ans = []

def ncr(n, r):
    if n<r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

subg = {i+1:i+1 for i in range(n)}

nodes = {i+1:1 for i in range(n)}

res = []
r = ncr(n, 2)

def fetch(i):
    if i == subg[i]:
        return i
    j = fetch(subg[i])
    subg[i] = min(j, subg[i])
    return j

for a, b in reversed(br):
    # print(subg, nodes)

    if len(nodes.keys()) == 1:
        res.append(0)
        continue
    else:
        res.append(r)

    mi, ma = min(a,b), max(a,b)
    v, w = max(fetch(mi), fetch(ma)), min(fetch(mi), fetch(ma))
    
    x = nodes[v] 
    y = nodes[w]

    r += ncr(x, 2) + ncr(y, 2)
    r -= ncr(x+y, 2)

    nodes[w] += nodes[v]
    del nodes[v]
    subg[mi] = w
    subg[ma] = w

for i in reversed(res):
    print(i)



### FIXED CODE ###


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

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

ans = []

def nc2(n):
    if n<2:
        return 0
    return n * (n-1) // 2


class UnionFind:

    def __init__(self, size):
        self.table = [-1 for _ in range(size+1)]
        self.size = [1 for _ in range(size+1)]

    def find(self, x):
        while self.table[x] >= 0:
            x = self.table[x]
        return x

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] != self.table[s2]:
                if self.table[s1] < self.table[s2]:
                    self.table[s2] = s1
                    self.size[s1] += self.size[s2]
                    self.size[s2] = 0
                else:
                    self.table[s1] = s2
                    self.size[s2] += self.size[s1]
                    self.size[s1] = 0
            else:
                self.table[s1] += -1
                self.table[s2] = s1
                self.size[s1] += self.size[s2]
                self.size[s2] = 0

    def get_size(self, x):
        s1 = self.find(x)
        return self.size[s1]

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

res = []
r = nc2(n)

uf = UnionFind(n)

for a, b in reversed(br):

    res.append(r)

    if not uf.check_same(a,b):
        r -= uf.get_size(a)*uf.get_size(b)

    uf.union(a,b)

for i in reversed(res):
    print(i)
n, x = map(int, input().split())
L = [l for l in map(int, input().split())]

num = 0
dist = 0
while dist <= x:
  dist += L[num]
  num += 1
  
print(num)

### FIXED CODE ###

n, x = map(int, input().split())
L = [l for l in map(int, input().split())]

dist = 0
num = 1

for (i, v) in enumerate(L):
  dist += v
  if dist <= x:
    num += 1
    continue
  else:
    break
    
print(num)
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3)
    print " %d" % i,

### FIXED CODE ###

n = int(raw_input())
print "",
for i in range(1, n+1):
  if i % 3 == 0:
    print "%d" % i,
  else:
    z = i
    while 1:
      if z % 10 == 3:
        print "%d" % i,
        break
      z /= 10
      if z == 0:
        break
s = str(s)
list_ans.append("KIHBR")
list_ans.append("AKIHBR")
list_ans.append("KIHABR")
list_ans.append("KIHBAR")
list_ans.append("KIHBRA")
list_ans.append("AKIHABR")
list_ans.append("AKIHBAR")
list_ans.append("AKIHBRA")
list_ans.append("KIHABAR")
list_ans.append("KIHABRA")
list_ans.append("KIHBARA")
list_ans.append("AKIHABAR")
list_ans.append("AKIHABRA")
list_ans.append("AKIHBARA")
list_ans.append("KIHABARA")
list_ans.append("AKIHABARA")
if s in list_ans:
    print("YES")
else:
    print("NO")

### FIXED CODE ###


s = str(input())
list_ans = []
list_ans.append("KIHBR")
list_ans.append("AKIHBR")
list_ans.append("KIHABR")
list_ans.append("KIHBAR")
list_ans.append("KIHBRA")
list_ans.append("AKIHABR")
list_ans.append("AKIHBAR")
list_ans.append("AKIHBRA")
list_ans.append("KIHABAR")
list_ans.append("KIHABRA")
list_ans.append("KIHBARA")
list_ans.append("AKIHABAR")
list_ans.append("AKIHABRA")
list_ans.append("AKIHBARA")
list_ans.append("KIHABARA")
list_ans.append("AKIHABARA")
if s in list_ans:
    print("YES")
else:
    print("NO")
N = int(input())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for j range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)

### FIXED CODE ###

N = int(input())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for j in range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)
import math

a, b = map(int, input().split())
ans = a*b / math.gcd(a, b)
print(int(ans))


### FIXED CODE ###

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

x = max(a, b)
y = min(a, b)
if x % y == 0:
    gcd = y
else:
    while x % y != 0:
        z = x % y
        x = y
        y = z
    gcd = z

ans = a * b / gcd

print(int(ans))
N = int(input())
S = list(input())
 
length = 1
i = 0
while i < N-1:
  if S[i] == S[i+1]:
    i += 1
  else:
    lendth += 1
    i += 1
    
print(length)

### FIXED CODE ###

N = int(input())
S = list(input())
 
length = 1
i = 0
while i < N-1:
  if S[i] == S[i+1]:
    i += 1
  else:
    length += 1
    i += 1
    
print(length)
n = input()
b = 1
a = list(map(str,input().split()))
if "0" in a:
    print(0)
else:
    for a in range(int(a)):
        b *= int(a[0])
    if b > 10**18:
        print(-1)
    else:
        print(b)

### FIXED CODE ###

n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= a[i]
        if b > 10**18:
            print(-1)
            break
    if b <=10**18:
        print(b)
n = int(input())
v = [[0] * n for _ in range(n)] 
for i in range(0,n):
  l = list(map(int,input().split()))
  u = l[0]
  k = l[1]
  for j in l[2:]:
    v[i-1][j-1]=1

for i in range(n):
  for j in range(n):
    print(v[i][j]+" ")

### FIXED CODE ###

n = int(input())
v = [[0]*n  for _ in range(n)]
for i in range(n):
  l = list(map(int,input().split()))
  u = l[0]
  k = l[1]
  c = l[2:]
  for j in c:
    v[u-1][j-1]=1
for m in v:
    print(' '.join(map(str, m)))
import numpy as np
N = int(input())
h = np.array(map(int, input().split()))
defa = np.inf
dp = [defa] * (N+1)

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

### FIXED CODE ###

import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s1, s2, s3 = input().split()
print(upper(s1[0]) + upper(s2[0]) + upper(s3[0]))


### FIXED CODE ###

print("".join(list(map(lambda s : s[:1], input().split(" ")))).upper())
import math

r = int(input())
area = r*r*math.pi
length = 2*math.pi*r

print("{:8f} {:8f}".format(area,length))

### FIXED CODE ###

import math

r = float(input())
area = r*r*math.pi
length = 2*math.pi*r

print("{:8f} {:8f}".format(area,length))
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)


N, Q = list(map(int, input().split()))
STX=[]
D=[]
for i in range(N):
    S, T, X = list(map(int, input().split()))
    bisect.insort(STX, (X, S, T))
for i in range(Q):
    D.append(int(input()))

skip = [-1 for i in range(Q)]

dist = [10000000000000 for i in range(Q)]

for (X, S, T) in STX:
    s = S - X
    t = T - X - 1
    a = bisect.bisect_left(D, s)
    b = bisect.bisect_right(D, t)
    #print(D)
    j = a
    while j < b:
        if skip[j] == -1:
            skip[j] = b
            dist[j] = X
            j+=1
        else:
            j=skip[j]



for i in range(Q):
    if dist[i] > 100000000000:
        print(-1)
    else:
        print(dist[i])

### FIXED CODE ###

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

print((A*3 + P)//2)
import collections

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

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

queue = collections.deque([0])
visited = [-1]*N
visited[0] = 0
while queue:
    x = queue.popleft()
    for i in G[x]:
        if visited[i] == -1:
            visited[i] = visited[x] + 1
            queue.append(i)

print("Yes")
print(*visited[1:], sep="\n")

### FIXED CODE ###

import collections

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

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

queue = collections.deque([0])
visited = [0]*N
visited[0] = 1
while queue:
    x = queue.popleft()
    for i in G[x]:
        if visited[i] == 0:
            visited[i] = x + 1
            queue.append(i)

print("Yes")
print(*visited[1:], sep="\n")
A,B = map(int,input().split())
b = format(B, "b")
d_num = len(b)
a = [0]*(B-A + 1)
a[-1] = b
digit_list = [0]*d_num
for i in range(B-A):
  a[i] = format(A + i,"0"+str(d_num) + "b")
for i in range(len(a)):
  for digit in a[i]:
    digit_list[i]+=int(digit) 
result = [1 if digit % 2 != 0 else 0 for digit in digit_list]
print(int(''.join(map(str,result)),2))


### FIXED CODE ###

def solver(N):
  if N % 2 == 1:
    return oddodd(N)
  else:
    return (N+1) ^ oddodd(N+1)

def oddodd(N):
  return 1 if (N+1)/2 % 2 == 1 else 0 

A,B = map(int,input().split())

print(solver(B) ^ solver(A-1))
def Ics(X, Y):
    m = len(X)
    n = len(Y)
    c1, c2 = [0] * (n + 1)
    for i in range(m):
        d = X[i]
    for j in range(n):
        if d == Y[j]:
            c1[j+1] = c2[j] + 1
        elif c1[j+1] < c1[j]:
            c1[j+1] = c1[j]
    return c1[-1]

q = int(input().rstrip())
t = []
for i in range(n):
    s1 = input().rstrip()
    s2 = input().rstrip()
    t.append(Ics(s1, s2))
print(*t, sep="\n")

### FIXED CODE ###

def Ics(X, Y):
    m = len(X)
    n = len(Y)
    c1 = [0] * (n + 1)
    for i in range(m):
        d = X[i]
        c2 = c1[:]
        for j in range(n):
            if (d == Y[j]):
                c1[j + 1] = c2[j] + 1
            elif (c1[j + 1] < c1[j]):
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
t = []
for i in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    t.append(Ics(s1, s2))
print(*t, sep = "\n")
s=input()
n=len(s)
k=int(input())
st=min(s)

if k==1:
    print(st)
    exit()

ans=[]
x=1
while x<6:
    for i in range(n-x):
        if i<0:
            continue
        for j in range(i+x,n+x):
            if j>n:
                continue
            ans.append(s[i:j])
    x+=1
    
ans=list(set(ans))
ans=sorted(ans)
print(ans[k-1])

### FIXED CODE ###

s=input()
k=int(input())

lis=[]

for i in range(len(s)):
    for j in range(k):
        tmp=s[i:i+j+1]
        lis.append(tmp)

lis=sorted(list(set(lis)))        
print(lis[k-1])
import math

n, X = list(map(int, input().split()))
x = list(map(int, input().split()))

ans = None
for ind, i in enumerate(x):
    x[ind] = abs(i - X)
    if ans is None:
        ans = x[ind]
    else:
        ans = math.gcd(ans, x[ind])
print(ans)

### FIXED CODE ###

import math
import numpy as np
def yakusu(num):
    top = []
    bot = []
    for i in range(int(math.sqrt(num))):
        k = i+1
        if num%k == 0:
            top.append(num//k)
            bot.append(k)
    return top + bot[::-1]

n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
start = x[0]
x = np.array(x[1:])
x -= start
# print(x)

for ans_pred in yakusu(x[0]):
    if ans_pred == 1:
        break
    flag = True
    for i in x:
        if i % ans_pred != 0:
            flag= False
            break
    if flag:
        break

print(ans_pred)
r, c = [int(i) for i in input().split()]

data = []
sum_row = [0] * (c + 1)
for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join(str[d] for d in data[ri]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]

print(" ".join([str(s) for s in sum_row]))

### FIXED CODE ###

r, c = [int(i) for i in input().split()]

data = []
sum_row = [0] * (c + 1)

for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]

print(" ".join([str(s) for s in sum_row]))
n = int(input())
x = input()
count_1 = x.count('1')
value = [0, 0]
value[0] = int(x, 2) % (count_1 - 1) if count_1 > 1 else 0
value[1] = int(x, 2) % (count_1 + 1)
for i in range(n):
    div = 1 if x[i] == '0' else -1
    tmp = (pow(2, n - i - 1, count_1 + div) + value[div*(-1)]) % (count_1 + div)
    ans = 1
    while tmp > 0:
        tmp = tmp % (bin(tmp).count('1'))
        ans += 1
    print(ans)

### FIXED CODE ###

n = int(input())
x = input()
count_1 = x.count('1')
value = [0, 0]
x_int = int(x, 2)
value[0] = x_int % (count_1 - 1) if count_1 > 1 else 0
value[1] = x_int % (count_1 + 1)
for i in range(n):
    if x[i] == '0':
        tmp = (pow(2, n - i - 1, count_1 + 1) + value[1]) % (count_1 + 1)
    else:
        if count_1 == 1:
            print(0)
            continue
        tmp = (-pow(2, n - i - 1, count_1 - 1) + value[0]) % (count_1 - 1)
    ans = 1
    while tmp > 0:
        tmp = tmp % (bin(tmp).count('1'))
        ans += 1
    print(ans)
n = map(int, input().split())
ls = list(map(int, input().split()))

for i in range(len(ls)):
    ls2 = ls.copy()
    ls2.remove(ls[i])
    print(sorted(ls2)[1])


### FIXED CODE ###

n =  int(input())
ls = list(map(int, input().split()))
sorted_ls = ls.copy()
sorted_ls.sort()
f = sorted_ls[int(n/2)]
b = sorted_ls[int(n/2)-1]

for i in ls:
    if i < f:
        print(f)
    else:
        print(b)
# -*- coding utf-8 -*-
MOD = 10 ** 9 + 7

a = int(input())
b = input()

if a >= 3200:
    print(s)
else:
    print('red')


### FIXED CODE ###

# -*- coding utf-8 -*-
MOD = 10 ** 9 + 7

a = int(input())
b = input()

if a >= 3200:
    print(b)
else:
    print('red')
n=int(input())
if n%2!=0:
  print(0)
else:
  a=0
  for i in range(1,26):
    a+=(n//(2*5**i))
print(a)

### FIXED CODE ###

n=int(input())
if n%2!=0:
  print(0)
else:
  a=0
  for i in range(1,26):
    a+=(n//(2*5**i))
  print(a)
n,q=map(int,input().split())
ans=[0]*(n+1)
score=[0]*(n+1)
g=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
for j in range(q):
    p,x=map(int,input().split())
    score[p]+=x
visited=set()
visited.add(1)
def dfs(v):
    ans[v]+=score[v]
    for i in range(len(g[v])):
        if not g[v][i] in visited:
            ans[g[v][i]]+=ans[v]
            dfs(g[v][i])
dfs(1)
ans_chr=""
for i in range(1,n+1):
    ans_chr=ans_chr+str(ans[i])+" "
print(ans_chr)


### FIXED CODE ###

import sys
sys.setrecursionlimit(400000)
n,q=map(int,input().split())
ans=[0]*(n+1) #答え
score=[0]*(n+1) #xの総和
g=[[] for _ in range(n+1)] #グラフ
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)
for j in range(q):
    p,x=map(int,input().split())
    score[p]+=x

visited=[0]*(n+1)
def dfs(v):
    visited[v]+=1
    global ans
    ans[v]+=score[v]
    for i in range(len(g[v])):
        if visited[g[v][i]]==0:
            ans[g[v][i]]+=ans[v]
            dfs(g[v][i])
dfs(1)
print(" ".join(map(str, ans[1:])))
N = int(input())
H = list(map(int, input().split()))
flag = 0
No = 0

for i in range(N-1):
    diff = H[i+1]-H[i]   
    
    if diff < -1 or (diff == -1 and flag ==1):
        No = 1
    elif diff == -1 and flag == 0:
        flug = 1
    elif diff > 0:
        flug = 0    
        
if No == 0: print("Yes")
else: print("No")

### FIXED CODE ###

A, B, C=map(int, input().split())


ans = C-(A-B)
if ans<0:
  ans = 0
  
print(ans)
n = int(input())
ds = list(map(int, input().split()))

from collections import defaultdict
d = defaultdict(int)

d[0] = 1
for d_ in ds:
    d[d_] += 1
    if d_ == 12 and d[d_] == 2:
        print(0)
        exit()
    elif d_ == 0 and d[d_] == 2: 
        print(0)
        exit()
    elif d[d_] == 3:
        print(0)
        exit()

def calcmin(tmp):
    n = len(tmp)
    ret = 1 << 50
    for i in range(n):
        for j in range(i+1,n):
            ret = min(ret, abs(tmp[i]-tmp[j]))
    return ret

two = []
x = []
for k in d.keys():
    if d[k] == 2:
        two.append(k)
        two.append(24-k)
    if d[k] == 1:
        x.append(k)
two = list(set(two))
n = len(x)

ans = 0
for i in range(1 << n):
    tmp[:] = x[:]
    for j in range(n):
        if i & (1 << j):
            tmp[j] = 24-x[j]
    tmp.extend(two)
    ans = max(calcmin(tmp), ans)
print(ans)

### FIXED CODE ###

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

from collections import defaultdict
d = defaultdict(int)

d[0] += 1
for d_ in ds:
    d[d_] += 1
    if (d_ == 12 or d_ == 0) and d[d_] == 2:
        print(0)
        exit()
    elif d[d_] == 3:
        print(0)
        exit()

def calcmin(tmp):
    n = len(tmp)
    ret = 1 << 50
    for i in range(n):
        for j in range(i+1,n):
            ret = min(ret, abs(tmp[i]-tmp[j]),24-abs(tmp[i]-tmp[j]))
    return ret

two = []
x = []

for k in d.keys():
    if d[k] == 2 or k == 12:
        two.append(k)
        two.append(24-k)
    elif d[k] == 1:
        x.append(k)

two = list(set(two))
n = len(x)
ans = 0
for i in range(1 << n):
    tmp = x[:]
    for j in range(n):
        if i & (1 << j):
            tmp[j] = 24-x[j]
    # print(tmp,two)
    tmp.extend(two)
    ans = max(calcmin(tmp), ans)

print(ans)
# N = int(input())
# A = []
lst = [list(f"{i:0{N}b}") for i in range(2**N)]
# X = [[] for i in range(N)]
# Y = [[] for i in range(N)]

# for i in range(N):
#     tmp_A = int(input())
#     A.append(tmp_A)
#     for j in range(tmp_A):
#         tmp_x,tmp_y = input().split()
#         X[i].append(int(tmp_x)-1)
#         Y[i].append(tmp_y)

ans = -1

# for i in range(2**N):
#     flag = 1
#     for j in range(N):
#         if lst[i][j] == "1":
#             for k in range(A[j]):
#                if lst[i][X[j][k]] != Y[j][k]:
#                    flag = 0
#     if flag:
#         tmp = 0
#         for j in lst[i]:
#             if j == "1":
#                tmp += 1
#         if tmp > ans:
#             ans = tmp

print(ans)

### FIXED CODE ###

N = int(input())
A = []
lst = [list(format(i, '0%db' % N)) for i in range(2**N)]
X = [[] for i in range(N)]
Y = [[] for i in range(N)]

for i in range(N):
    tmp_A = int(input())
    A.append(tmp_A)
    for j in range(tmp_A):
        tmp_x,tmp_y = input().split()
        X[i].append(int(tmp_x)-1)
        Y[i].append(tmp_y)

ans = -1

for i in range(2**N):
    flag = 1
    for j in range(N):
        if lst[i][j] == "1":
            for k in range(A[j]):
               if lst[i][X[j][k]] != Y[j][k]:
                   flag = 0
    if flag:
        tmp = 0
        for j in lst[i]:
            if j == "1":
               tmp += 1
        if tmp > ans:
            ans = tmp

print(ans)
S = list(input())
S.append("A")
for i in range(26):
    if S.count(chr(97 + i)) >= 2:
        for j in range(len(S) - 1):
            if (S[j] == chr(97 + i)) and (S[j + 1] == chr(97 + i)):
                print(j+1, j+2)
                exit()
            if (S[j] == chr(97 + i)) and (S[j + 2] == chr(97 + i)):
                print(j+1, j+3)
                exit()
else:
    print("-1 -1")


### FIXED CODE ###

S = list(input())
S.append("A")
for j in range(len(S) - 2):
    if (S[j] == S[j + 1]):
        print(j+1, j+2)
        exit()
    if (S[j] == S[j + 2]):
        print(j+1, j+3)
        exit()
else:
    print("-1 -1")
https://beta.atcoder.jp/contests/abc081/tasks/abc081_a

### FIXED CODE ###

A = list(input())

print(A.count("1"))
def tobin(n):
    return bin(n)[2:][::-1]

def occur(n, i):
    if i >= len(n):
        return 0
    if n[i] == '1':
        if i == 0:
            o = 1
        else:
            o = int(n[:i][::-1], 2) + 1
    else:
        o = 0
    if i < len(n) - 1:
        o += int(n[i+1:][::-1], 2) * (2 ** i)
    return o

A, B = map(int, input().split())
A, B = tobin(A-1), tobin(B)
F = ""

for i in range(len(B)):
    F += str((occur(B, i) - occur(A, i)) % 2)

print(int(F[::-1], 2))

### FIXED CODE ###

def tobin(n):
    return bin(n)[2:][::-1]

def occur(n, i):
    if i >= len(n):
        return 0
    if n[i] == '1':
        if i == 0:
            o = 1
        else:
            o = int(n[:i][::-1], 2) + 1
    else:
        o = 0
    if i < len(n) - 1:
        o += int(n[i+1:][::-1], 2) * (2 ** i)
    return o

A, B = map(int, input().split())
A, B = tobin(A-1 if A > 0 else 0), tobin(B)
F = ""

for i in range(len(B)):
    F += str((occur(B, i) - occur(A, i)) % 2)

print(int(F[::-1], 2))