Harryxun/stf_run huggingface dataset:
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

ans = [10 for i in range(n)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

value = 0

for i in range(n):
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)

### FIXED CODE ###

n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

if m == 0:
    if n == 3:
        print(100)
        exit()
    elif n == 2:
        print(10)
        exit()
    elif n== 1:
        print(0)
        exit()

ans = [10 for i in range(n)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

value = 0

for i in range(n):
    if i == 0:
        if ans[i] == 10:
            value += 10 ** (n-i-1)
            continue
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)
from sys import stdin
from itertools import groupby

s = stdin.readline().rstrip()
k = int(stdin.readline().rstrip())

san = s*2

def cou(st):
    li = []
    point = 1
    for i in range(len(st)-1):
        if st[i] == st[i+1]:
            point += 1
            if i == len(st)-2:
                li.append(point)
        else:
            li.append(point)
            point = 1
    return li

lin = cou(s)

if len(lin) == 1:
    print(lin[0]*k//2)
    exit()

if k >= 1:
    if s[0] == s[-1]:
        lin[-1] += lin[0] 

point = 0
for i in range(1,len(lin)):
    point += lin[i]//2
point = point*k+lin[0]//2
print(point)

### FIXED CODE ###

# AGC039A - Connection and Disconnection
from itertools import groupby


def main():
    S = input().rstrip()
    K = int(input())
    cnt = [len(tuple(s)) for _, s in groupby(S)]  # count of continuous characters
    if S[0] == S[-1] and K > 1:
        if len(cnt) == 1:  # one character
            ans = cnt[0] * K // 2
        else:  # first (= last) character in S + characters inside S
            ans = cnt[0] // 2 + cnt[-1] // 2 + (cnt[0] + cnt[-1]) // 2 * (K - 1)
            ans += sum(i // 2 for i in cnt[1:-1]) * K
    else:
        ans = sum(i // 2 for i in cnt) * K
    print(ans)


if __name__ == "__main__":
    main()
li = [int(input()) for _ in range(5)]

time = 0
non10li = []
for i in li:
    if i%10==0:
        time+=i
    else:
        non10li.append(i)

minili = [i%10 for i in non10li]
ind = non10li.pop(minili.index(min(minili)))
for i in non10li:
    time+=(i//10)*10+10

time+=ind
print(time)


### FIXED CODE ###

li = [int(input()) for _ in range(5)]

time = 0
non10li = []
for i in li:
    if i%10==0:
        time+=i
    else:
        non10li.append(i)
if len(non10li)!=0:
    minili = [i%10 for i in non10li]
    ind = non10li.pop(minili.index(min(minili)))
    for i in non10li:
        time+=(i//10)*10+10

    time+=ind
print(time)
S = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
s = print()
result = abs(S.index(s)-S.index("SUN"))
print(result)

### FIXED CODE ###

S = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
s = input()
result = abs(S.index(s)-S.index("SUN"))
if result ==0:
  result = 7
else:
  pass
print(result)
#https://atcoder.jp/contests/dp/tasks/dp_a
#A - Frog 1

N=int(input())
H=list(map(int,input().strip().split(" ")))


def find(H):
    if len(H)==1:
        return 0

    dp=[0]*len(H)
    dp[1]=abs(H[1]-H[0])
    for i in range(2,len(H)):
        dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
    return dp[-1]    

pint(find(H))   

### FIXED CODE ###

# https://atcoder.jp/contests/dp/tasks/dp_a
# A - Frog 1

N=int(input())
H=list(map(int,input().strip().split(" ")))


def find(H):
    if len(H) == 1:
        return 0

    dp = [0] * len(H)
    dp[1] = abs(H[1] - H[0])
    for i in range(2, len(H)):
        dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))
    return dp[-1]


#H = [10, 30, 40, 20]
print(find(H))
N,K=map(int, input().split()) 
h=list(map(int, input().split()))

ans = len([1 for x in h if x >= K])

print(ans)

### FIXED CODE ###

n = int(input())


if n%2 == 0:
    ans = 0.5
else:
    ans = (n+1)/(2*n)

print(ans)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    num = [0]*(2*10**5+1)
    for i in range(1, 2*10**5+1):
        num[i] = num[i % bin(i).count('1')] + 1

    reg = [0]*N
    tmp = 1
    for i in range(1, N+1):        
        if len(xbin) < i or xbin[-i] == '0':
            x = xdec + tmp
            popcount = m + 1
        else:
            x = xdec - tmp
            popcount = m - 1
        reg[i-1] = x % popcount
        tmp *= 2

    for i in range(N-1, -1, -1):
        print(num[reg[i]]+1)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    a = xdec % (m+1)
    b = xdec % (m-1) if m > 1 else 0

    num = [0]*N
    for i in range(1, N):
        num[i] = num[i % bin(i).count('1')] + 1

    for i in range(N):
        if xbin[i] == '0':
            y = ( a + pow(2, N-i-1, m+1) ) % ( m+1 )
            print(num[y] + 1)
        elif m <= 1:
            print(0)
        else:
            y = ( b - pow(2, N-i-1, m-1) ) % ( m-1 )
            print(num[y] + 1)

if __name__ == '__main__':
    solve()
s = input()
for i in len(s):
  if i%2 == 0:
    print(s[i], end = '')

### FIXED CODE ###

s = input()
t = ''
i = 0
while i <= len(s)-1:
  t += s[i]
  i += 2
print(t)
N=input()
print(N**3)

### FIXED CODE ###

N=int(input())
print(N**3)
A = [list(map(int, input().split())) for i in range(3)]

n = int(input())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

for k in range(3):
    if A[k][0]==a[k][1]==a[k][2]==0:
        print("Yes")
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit
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 ###

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        if A1[j] == b:
            A1[j] = 0
        if A2[j] == b:
            A2[j] = 0
        if A3[j] == b:
            A3[j] = 0

if A1[0]==A1[1]==A1[2]==0:
    print("Yes")
    exit
elif A2[0]==A2[1]==A2[2]==0:
    print("Yes")
    exit
elif A3[0]==A3[1]==A3[2]==0:
    print("Yes")
    exit

elif A1[0]==A2[0]==A3[0]==0:
    print("Yes")
    exit
elif A1[1]==A2[1]==A3[1]==0:
    print("Yes")
    exit
elif A1[2]==A2[2]==A3[2]==0:
    print("Yes")
    exit
    
elif A1[0]==A2[1]==A3[2]==0:
    print("Yes")
    exit
elif A1[2]==A2[1]==A3[0]==0:
    print("Yes")
    exit
else:
    print("No")
N, = list(map(int,input().split()))

ans = 0

for i in range(N):
    num = 0
    for j in range(200):
        if  N % j == 0:
        num += 1
    if  num == 8:
    ans += 1

print(ans)



### FIXED CODE ###

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

ans = 0

for i in range(N+1):
    if  i % 2 == 1:
        num = 0
        for j in range(1,201):
            if  i % j == 0:
                num += 1
                if  num == 8:
                    ans += 1
        
print(ans)
n = [i for i in input().split()]
a = n[1]
b = n[2]
if a < 10:
  b += (10-a)*100
print(b)

### FIXED CODE ###

n = [int(i) for i in input().split()]
a = n[0]
b = n[1]
if a < 10:
  b += (10-a)*100
print(b)
import math
import collections

def main():
  N = int(input())
  S = list()
  S = [input() for _ in range(N)]
  
  s = collections.counter(S)
  
  MaxCount = max(s.values())
  
  ans = []
  
  for key, value in s.items():
    if value == MaxCount:
      ans.append(key)
                 
  ans.sort()
  
  for i in ans:
    print(ans[i])
  
  
  
  
main()

### FIXED CODE ###


import math
import collections

def main():
  N = int(input())
  S = list()
  S = [input() for _ in range(N)]
  
  s = collections.Counter(S)
  
  MaxCount = max(s.values())
  
  ans = []
  
  for key, value in s.items():
    if value == MaxCount:
      ans.append(key)
                 
  ans.sort()
  
  for i in ans:
    print(i)
  
  
  
  
main()
# -*- coding: utf-8 -*-
while True:
	try:	
		a, b = (int(s) for s in input().split(" "))
		print len(str(a + b))
	except:
		break


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
for s in sys.stdin:
	print len(str(int(s.rstrip().split()[0])+int(s.rstrip().split()[1])))
import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    if seen[x-1]==0:
        uni[cnt].append(x)
        seen[x-1]=1
        for i in fri[x-1]:
            dfs(i)
    

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

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

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

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append([])
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(set(unii)&set(blk[j-1])-1
        seq[j-1]=cj

print(*seq)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    if seen[x-1]==0:
        uni[cnt].add(x)
        seen[x-1]=1
        for i in fri[x-1]:
            dfs(i)
    

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

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

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

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append(set())
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(unii&set(blk[j-1]))-1
        seq[j-1]=cj

print(*seq)
N = int(input())
L = list(map(int, input().split()))
for i in range(N):
  if sum(L) - L(i) <= L(i):
    print('No')
    exit()
print('Yes')

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
if sum(L)  <=  max(L)*2:
  print('No')
  exit()
print('Yes')
if n<a:
    print("Yes")
    exit()
if (n-a)%500:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

n = int(input())
a = int(input())
if n<a:
    print("Yes")
    exit()
if n % 500 <= a:
    print("Yes")
else:
    print("No")
import heapq

n, m = map(int, input().split(' '))
works = [[] for _ in range(100001)]

for i in range(n):
    a, b = map(int, input().split(' '))
    heapq[a].append(b)

ans = 0
h = []
for day in range(1, m + 1):
    for gain in works[day]:
        heapq.heappush(h, -gain)

    if h:
        gain = -heapq.heappop(h)
        ans += gain

print(ans)
    


### FIXED CODE ###

from collections import deque
import heapq

n, m = map(int, input().split(' '))
works = [[] for _ in range(100001)]

for i in range(n):
    a, b = map(int, input().split(' '))
    works[a].append(b)

ans = 0
h = []
for day in range(1, m + 1):
    for gain in works[day]:
        heapq.heappush(h, -gain)


    if h:
        gain = -heapq.heappop(h)
        ans += gain


print(ans)
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
b = sorted(a,reverse = True)
b = np.abs(b)
b_k = b[k]

a_new = [a[i] for i in range(len(a)) if np.abs(a)[i] > b_k]
 
comb = itertools.combinations(a_new,k)  
l = [list(_) for _ in comb]  
A = (functools.reduce(operator.mul,l[_]) for _ in range(len(l)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a, b, c = map(str, input().split())
e,f,g = map(str, input().split())
if a==g and b==f and c==e:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a=str(input())
b=str(input())

if a[0] == b[-1] and a[1] == b[-2] and a[2] == b[-3]:
    print("YES")
else:
    print("NO")
N = int(input())

x = []
y = []
h = []
for i in range(N):
    x_, y_, h_ = map(int, input().split())
    x.append(x_)
    y.append(y_)
    h.append(h_)

for i in range(0,101):
    for j in range(0,101):
        for hn in h:
            if hn > 0:
                tmph = hn + abs(i-x[n]) + abs(j-y[n])
                break
        count = 0
        for n in range(N):
            count += 1
            if h[n] != max(tmph - abs(i-x[n]) - abs(j-y[n]), 0):
                break
            if count == N:
                print(str(i) + ' ' + str(j) + ' ' + str(tmph))


### FIXED CODE ###

N = int(input())

x = []
y = []
h = []
for i in range(N):
    x_, y_, h_ = map(int, input().split())
    x.append(x_)
    y.append(y_)
    h.append(h_)

for i in range(0,101):
    for j in range(0,101):
        for n, hn in enumerate(h):
            if hn > 0:
                tmph = hn + abs(i-x[n]) + abs(j-y[n])
                break
        count = 0
        for n in range(N):
            count += 1
            if h[n] != max(tmph - abs(i-x[n]) - abs(j-y[n]), 0):
                break
            if count == N:
                print(str(i) + ' ' + str(j) + ' ' + str(tmph))
import itertools
import numpy
N, Ma, Mb = map(int, input().split())
r = Ma/Mb
costlist = []
data = [list(map(int, input().split())) for i in range(N)]
for i in range(1, max(N+1, 11)):
    combination = numpy.array(list(itertools.combinations(data, i)))
    for k in range(len(combination)):
        a_tot = 0
        b_tot = 0
        c_tot = 0
        for j in range(len(combination[k])):
            a_tot += combination[k][j][0]
            b_tot += combination[k][j][1]
            c_tot += combination[k][j][2]
        if a_tot/b_tot == r:
            costlist.append(c_tot)
if costlist == []:
    print(-1)
else:
    print(min(costlist))


### FIXED CODE ###

N, Ma, Mb = map(int, input().split())
r = Ma/Mb
a = 0
b = 0
costlist = [500000]
data = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
    a += data[i][0]
    b += data[i][1]


dp = [[[500000 for i in range(N+1)] for i in range(b+10)] for i in range(a+10)]
dp[0][0][0] = 0

#Aがiグラム、Bがjグラム、k番目までの薬を用いたときの最小コスト
for k in range(N):
    for j in range(b):
        for i in range(a):
            ai = data[k][0]
            bj = data[k][1]
            dp[i+ai][j+bj][k+1] = min(dp[i+ai][j+bj][k+1], dp[i][j][k] + data[k][2])
            dp[i][j][k+1] = min(dp[i][j][k], dp[i][j][k+1])

for i in range(1, a):
    for j in range(1, b):
        if i/j == r:
            costlist.append(dp[i][j][N])
if N == 1:
    if data[0][0]/data[0][1] == r:
        print(data[0][2])
    else:
        print(-1)

elif min(costlist) == 500000:
    print(-1)
else:
    print(min(costlist))
n = int(input())

m = {}
for i in range(1,27):
  m[i] = chr(96+i)

ans = ''
while 1:
  x = n // 26
  y = n % 26

  ans = m[y] + ans
  
  if x == 0:
    break
  else:
    n = n // 26

print(ans)

### FIXED CODE ###

n = int(input())

m = {}
for i in range(0,26):
  m[i] = chr(97+i)

ans = ''
while 1:

  n -= 1

  x = n // 26
  y = n % 26

  ans = m[y] + ans

  n = x
  if n == 0:
    break

print(ans)
from collections import deque

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

friends = [[0] * n for _ in range(n)]

blocks = [[0] * n for _ in range(n)]

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

for i in range(k):
    c, d = map(int, input().split())
    blocks[c-1][d-1] = 1
    blocks[d-1][c-1] = 1

for i in range(n):
    q = deque()
    q.append(i)
    cnt = [-1] * n
    cnt[i] = 0
    total = 0
    while q:
        k = q.popleft()
        for j in range(n):
            if friends[k][j] and cnt[j] == -1:
                q.append(j)
                cnt[j] = cnt[k] + 1
                if cnt[j] > 1 and not blocks[i][j]:
                    total += 1
    print(total)

### FIXED CODE ###

a = int(input())

if a % 2 == 0:
    b = a/2

else:
    b = (a+1)/2

print(int(b))
lens = int(input())
hashes = sorted()[''.join(sorted(input())) for _ in range(lens)])
i = 0
j = 0
r = 0
ans = 0
while i < lens - 1:
    i += 1
    if hashes[i] == hashes[j]:
        r += 1
    else:
        ans += (r * (r + 1)) // 2
        r = 0
        j = i
ans += (r ( r + 1))//2
print(ans)

### FIXED CODE ###

n = int(input())
ws = [list(input()) for _ in range(n)]
 
def sort_l(l):
    l.sort()
    return l
ws = list(map(sort_l, ws))
ws.sort()
 
i = 0
j = 0
r = 0
ans = 0
while(i<n-1):
    i += 1
    if ws[i] == ws[j]:
        r += 1
    else:
        ans += r * (r+1) // 2
        r = 0
        j = i
ans += r * (r+1) // 2
 
print(ans)
a,b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % e == 0:
    print('Possible')
else:
    print('Impossible')

### FIXED CODE ###

a,b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
N , M = input().split(" ")
tm = 0
for i in range(int(M)):
    i = input()
    tm = tm + int(i)
print(int(N)-tm)

### FIXED CODE ###

a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sum(c)
print(a-d if a-d>=0 else -1)
A = int(input())
i = 0
while (2 ** i) <= A:
    if (2 ** i) = A:
        print(A)
        break
    else:
        i += 1
print(2 ** (i - 1))

### FIXED CODE ###

A = int(input())
i = 0
while (2 ** i) <= A:
    if 2 ** i == A:
        print(A)
        break
    elif (2 ** i) < A:
        i += 1
        continue
else: print(2 ** (i - 1))
#ABC057.B
N,M = map(int(input().split()))
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3)+1)

### FIXED CODE ###

#ABC057.A
A,B = map(int,input().split())
if A+B <24:
    print(A+B)
else:
    print(A+B-24)
n,m,k = map(int, input().split())

N = 998244353

def fac(n,r,N):
    ans=1
    for i in range(r):
        ans=ans*(n-i)%N
    return ans

def combi(n,r,N):
    r= min(r, n-r)
    ans = fac(n,r,N)*pow(fac(r,r,N),N-2,N)%N
    return ans

ans=0
if k<n//2:
    for i in range(k+1):
        ans+=m*combi(n-1,i,N)*pow(m-1,n-1-i,N)%N
        ans%=N
    print(ans)
else:
    for i in range(k+1,n+1):
        ans+=m*combi(n-1,i,N)*pow(m-1,n-1-i,N)%N
        ans%=N
    ans = pow(m,n,N)-ans
    if ans < 0:
        ans +=N
    print(ans)


### FIXED CODE ###

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

N = 998244353

factorial = [1]
inverse = [1]
for i in range(1, n+2):
    factorial.append(factorial[-1] * i % N)
    inverse.append(pow(factorial[-1], N - 2, N))

def combi(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % N

ans=0
if k<n//2:
    for i in range(k+1):
        ans+=m*combi(n-1,i)*pow(m-1,n-1-i,N)%N
        ans%=N
    print(ans)
else:
    for i in range(k+1,n):
        ans+=m*combi(n-1,i)*pow(m-1,n-1-i,N)%N
        ans%=N
    ans = pow(m,n,N)-ans
    if ans < 0:
        ans +=N
    print(ans)
# input
O = input()
E = input()

password = [0 for _ in range(len(O) + len(E))]

for i in range(len(O)):
    password[2 * i] = O[i]

for i in range(len(E)):
    password[2 * i + 1] = E[i]

password_str = ''.join(str_list)
print(password_str)

### FIXED CODE ###

# input
O = input()
E = input()

password = [0 for _ in range(len(O) + len(E))]

for i in range(len(O)):
    password[2 * i] = O[i]

for i in range(len(E)):
    password[2 * i + 1] = E[i]

password_str = ''.join(password)
print(password_str)
N, X, M = map(int, input().split())
tx = X % M
tl = []
ttl = []
for i in range(N):
    tl.append(tx)
    tx = pow(tx, 2, M)
    if tx in tl:
        ttl = tl[tl.index(tx):]
        break
ans = sum(tl)
d, m = divmod(N-len(tl), len(ttl))
ans += sum(ttl)*d+sum(ttl[:m])
print(ans)


### FIXED CODE ###

N, X, M = map(int, input().split())
if X == 0:
    print(0)
    exit()
tx = X % M
tl = []
ts = set()
ttl = []
for i in range(N):
    tl.append(tx)
    ts.add(tx)
    tx = pow(tx, 2, M)
    if tx in ts:
        ttl = tl[tl.index(tx):]
        break
ans = sum(tl)
if len(ttl)>0:
    d, m = divmod(N-len(tl), len(ttl))
    ans += sum(ttl)*d+sum(ttl[:m])
print(ans)