Harryxun/stf_run huggingface dataset:
import math

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

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

if N_H[1] <= b[a_max_idx]:
    print(1)
    
while True:
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break



### FIXED CODE ###

import math

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

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
b_max = max(b)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b_max and counter == 0:
        counter += 1
        print(counter)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
num = list(map(int, input().split()))

X= num[0]
Y =num[1]

for i in range(X):
  if 4*X - 2*i == Y:
    print("Yes")
    braek;
  else:
    print("No")
    break;

### FIXED CODE ###

num = list(map(int, input().split()))
X= num[0]
Y =num[1]

ans = "No"
for i in range(X+1):
  if 4*X - 2*i == Y:
    ans = "Yes"
    break;
print(ans)
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print('-1')    

### FIXED CODE ###

import math
R = int(input())
print(2*R*math.pi)
import sys
from functools import lru_cache

sys.setrecursionlimit(100000)


@lru_cache(maxsize=None)
def dfs(v):
    lv = links[v]
    return max(map(dfs, lv)) + 1 if lv else 0


n, m = map(int, input().split())
sss = set(range(n))
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    sss.discard(y)
    links[x].add(y)

print(max(map(dfs, sss)))


### FIXED CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(1000000)


@lru_cache(maxsize=None)
def dfs(v):
    lv = links[v]
    return max(map(dfs, lv)) + 1 if lv else 0


n, m = map(int, input().split())
sss = set(range(n))
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    sss.discard(y)
    links[x].add(y)

print(max(map(dfs, sss)))
N = int(input())
A = list(map(int,input().split()))
A.sort()
d = []
ans = 0
while A:
    a = A.pop(0)
    f = 0
    for p in d:
        if a % p == 0:
            f = 1
            break
    if f == 0:
        d.append(a)
        if len(A) == 0:
            break
        if a == A[0]:
            while a == A[0]:
                A.pop(0)
        else:
            ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
d = {}
n = A[-1]
def makePrimeChecker(n):
    isPrime = [True] * (n + 1)
    i = 0
    for j in A:
        if i == j:
            isPrime[i] = False
            continue
        i = j
        if isPrime[i]:
            for j in range(i * 2, n + 1, i):
                isPrime[j] = False
    return isPrime
P = makePrimeChecker(n)
i = 0
ans = 0
for j in A:
    if i == j:
        continue
    else:
        i = j
        if P[i]:
            ans += 1
print(ans)
r = int(input())
 
 print(3*r*r)

### FIXED CODE ###

# coding: utf-8
# Your code here!

r = int(input())
 
print(3*r*r)
N, M = [int(x) for x in input().split()]

LR = []
for _ in range(M):
  LR.append([int(x) for x in input().split()])

print(sum(check(n) for n in range(1, N+1)))
def check(n):
  return 1 if all(l <= n <=r for l, r in range LR) else 0


### FIXED CODE ###

N, M = [int(x) for x in input().split()]

def check(n, LR):
    return 1 if all(l <= n <=r for l, r in LR) else 0

L = 0
R = N
for _ in range(M):
    l, r = [int(x) for x in input().split()]
    if L < l:
        L = l
    if r < R:
        R = r

if L <= R:
    print(R - L + 1)
else:
    print(0)
import logging
import unittest
from collections import (
    Counter,
)

debug = logging.getLogger(__name__).debug


def input_ints():
    return list(map(int, input().strip().split()))


def _main():
    n, = input_ints()
    xy = [input_ints() for _ in range(n)]

    (_, count), = Counter(
        (x1 - x2, y1 - y2)
        for (x1, y1) in xy
        for (x2, y2) in xy
        if not (x1 == x2 and y1 == y2)
    ).most_common(1)

    print(len(xy) - count)


class Test(unittest.TestCase):
    def setUp(self):
        import run
        self._test = run

    def test_main(self):
        self._test.test_files(self, _main)


if __name__ == '__main__':
    _main()


### FIXED CODE ###

from collections import (
    Counter,
)


def input_ints():
    return list(map(int, input().strip().split()))


def _main():
    n = input_ints()[0]
    xy = [input_ints() for _ in range(n)]

    if len(xy) == 1:
        print(1)
        return

    (_, count), = Counter(
        (x1 - x2, y1 - y2)
        for (x1, y1) in xy
        for (x2, y2) in xy
        if not (x1 == x2 and y1 == y2)
    ).most_common(1)

    print(len(xy) - count)


if __name__ == '__main__':
    _main()
a,b = (int(x) for x in input.split())

if a==1:
    a=14
if b==1:
    b=14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")


### FIXED CODE ###

a,b = (int(x) for x in input().split())

if a==1:
    a=14
if b==1:
    b=14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")
x,y = map(int, input().split())
 
if (x + y) % 3  != 0:
  print(0)
  exit()
  
k = x - (x+y)//3
m = y - (x+y)//3
 
if k < 0 or m < 0:
  print(0)
  exit()
  
def nCr(k,m):
  mod = 10**9 + 7
  k,m = max(k,m),min(k,m)
  l = s = 0
  for i in range(m,k - m + 1):
    l = l * (m + i) % mod
    s = s * (i + 1) % mod
    
print(l/s)

### FIXED CODE ###

import math
M = 10**9+7
X,Y = map(int,input().split())
if (X+Y)/3 != (X+Y)//3:
    print(0)
    exit()
n = (X+Y)//3
r = Y-n
if r<0 or r>n:
    print(0)
    exit()
 
 
#nCr and Mod
def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
 
print(nCr(n,r,M))
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(X)>=3:
  if S[0]=='0':
    X.pop(0)
  if S[-1]=='0':
    X.pop(-1)
  P=(len(X)-1)//2
  
  answer= min(X[P-1]+X[P],X[P]+X[P+1])
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)

### FIXED CODE ###

import numpy as np
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(S)==1:
  X=[1]
if len(X)>=3:
  X=np.cumsum(X)
  t=float('inf')
  for i in range(len(X)-1):
    u=max(X[i],len(S)-X[i])
    t=min(u,t)
  answer=t
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)
N,ave = map(int,input().split())
card_ls = list(map(int, input().split()))
#dp[i+1][n][s] := i番目までのカード(0idx)からn枚使って合計がsとなるパターンの数
dp = [[[0]*(ave*N+1) for _ in range(N+1)] for _ in range(N+1)]
dp[1][1][card_ls[0]] = 1
dp[1][0][0] = 1
for i in range(1,N):
    for n in range(N):
        for s in range(ave*N+1):
            # i番目を新しく使う
            if s+card_ls[i] < ave*N+1:
                dp[i+1][n+1][s+card_ls[i]] += dp[i][n][s]
            # i番目を使わない
            dp[i+1][n][s] += dp[i][n][s]

#print(dp)
ans = 0
for n in range(1,N+1):
    ans += dp[N][n][n*ave]
print(ans)

### FIXED CODE ###

N,ave = map(int,input().split())
card_ls = list(map(int, input().split()))
#dp[i+1][n][s] := i番目までのカード(0idx)からn枚使って合計がsとなるパターンの数
dp = [[[0]*(ave*N+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for n in range(N):
        for s in range(ave*N+1):
            # i番目を新しく使う
            if s+card_ls[i] < ave*N+1:
                dp[i+1][n+1][s+card_ls[i]] += dp[i][n][s]
            # i番目を使わない
            dp[i+1][n][s] += dp[i][n][s]

#print(dp)
ans = 0
for n in range(1,N+1):
    ans += dp[N][n][n*ave]
print(ans)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i+1] == a[i]+1:
        ans += c[i-1]
        
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i] == a[i-1]+1 and i > 0:
        ans += c[val-1]
        
print(ans)
import sys
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans

### FIXED CODE ###

def findTrailingZeros(n): 
      
    if (n%2!=0): 
        return 0

    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        return ans 
  
n = int(input())
  
print(findTrailingZeros(n))
A = [[0 for i in range(10)]for l in range(N)]
ans = ''
end = False
for l in L:
    if l[0] == 1 & l[1] == 0:
        print(-1)
        end = True
        break
    else:
        A[l[0]-1][l[1]] = 1
if not end:
    if any(sum(a) > 1 for a in A):
        print(-1)
    else:
        for i in range(N):
            if i == 0:
                if sum(A[i]) == 0:
                    ans+='1'
                else:
                    ans+=str(A[i].index(1))
            else:
                if sum(A[i]) == 0:
                    ans+='0'
                else:
                    ans+=str(A[i].index(1))

        print(ans)


### FIXED CODE ###

N,M = map(int, input().split())
L = []
ans = []
for i in range(M):
	L.append(list(map(int, input().split())))
	ans.append(False)

for i in range(10**N):
    num = str(i)
    if len(num) == N:
        for j,l in enumerate(L):
            if num[l[0]-1] == str(l[1]):
                ans[j] = True 
                continue
            else:
                break
        if all(ans):
            print(i)
            break
if not all(ans):
  print(-1)
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*N
  for pos in range(1, N+1):
    count = 0
    low = max(math.ceil(pos-(lightPow[pos-1]+0.5)), 1)
    high = max(math.floor(pos+(lightPow[pos-1]+0.5)), 1)

    for area in range(low, high+1):
      newLightPow[area-1] += 1
    #print(pos)
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  lightPow = newLightPow
  
print(*lightPow)


### FIXED CODE ###

import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])
n = int(input())
ans = [0]*n
n1 = int(n/6)+1

for l in range(1,n+1):
  for i in range(1,n1):
    for j in range(1,n1):
      for k in range(1,n1):
        if i**2 + j**2 + k**2 + i*j + j*k + k*i == l:
          ans[(l-1)] += 1
        elif i**2 + j**2 + k**2 + i*j + j*k + k*i > l:
          break 
    if i**2 + j**2 + k**2 + i*j + j*k + k*i > l:
      break 
  if i**2 + j**2 + k**2 + i*j + j*k + k*i > l:
    break 

for l in range(1,n+1):      
   print(ans[(l-1)])

### FIXED CODE ###

n = int(input())
ans = [0]*n

for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      l = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if l <= n:
        ans[l-1] += 1
      
for m in range(n): 
  print(ans[m])
i=int(input())
j=int(input())
print(str(6-(i+j))

### FIXED CODE ###

i=int(input())
j=int(input())
a=6-(i+j)
print(str(a))
n=int(input())
a=list(map(int,input().split()))
s=n
for i in range(n-1):
  if a[i]!=a[i+1]:
    s=i
    f=0 if a[s]<a[s+1] else f=1
    break
p=0
for i in range(s+1,n-1):
  if f==0:
    if a[i]>a[i+1]:
      p+=1
      f=1
  else:
    if a[i]<a[i+1]:
      p+=1
      f=0
print(p)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.append(0)
b=[]
for i in range(n):
  if a[i]!=a[i+1]:
    b.append(a[i])
n=len(b)
s=n
for i in range(n-1):
  if b[i]!=b[i+1]:
    s=i
    if b[s]<b[s+1]:
      f=0
    else:
      f=1
    break
p=1
for i in range(s+1,n-1):
  if f==0:
    if b[i]>b[i+1]:
      p+=1
      if i==n-2 or b[i+1]>b[i+2]:
        f=1
      else:
        f=0
  else:
    if b[i]<b[i+1]:
      p+=1
      if i==n-2 or b[i+1]>b[i+2]:
        f=1
      else:
        f=0
print(p)
N = int(input())
D = list(map(int,input().split()))
BIGNUM = 998244353

ans = 1
# 距離:頂点に対応する辞書
if D[0] != 0:
    ans = 0
distance_dict = {0:1}
for i in D[1:]:
    if not i in distance_dict:
        distance_dict[i] = 1
    else:
        distance_dict[i] += 1

#dist_list = list((distance_dict.keys())) # 0~N-1 一つでもとんでったらアウト。距離がない
#print(distance_dict)

for i in range(1,max(distance_dict.keys())+1):
    if not i in distance_dict:
        ans = 0
    else:
        ans *= distance_dict[i-1]**distance_dict[i] # どこにつながるかの候補とつながる点の数
print(ans%BIGNUM)

### FIXED CODE ###

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

ans = 1
# 距離:頂点に対応する辞書
if D[0] != 0:
    ans = 0
distance_dict = {0:1}
for i in D[1:]:
    if not i in distance_dict:
        distance_dict[i] = 1
    else:
        distance_dict[i] += 1

#dist_list = list((distance_dict.keys())) # 0~N-1 一つでもとんでったらアウト。距離がない
#print(distance_dict)

if distance_dict[0] != 1:
    print(0)
    exit()

for i in range(1,max(distance_dict.keys())+1):
    if not i in distance_dict: # 一つでもとんでったらアウト。距離がない。連結できない
        ans = 0
        print(0)
        exit()

    elif i != 0:
        ans *= (distance_dict[i-1]**distance_dict[i]) # どこにつながるかの候補とつながる点の数
print(ans%BIGNUM)
n,k = map(int, input().split())
from math import factorial
import numpy as np
for i in range(1,k+1):
    perm = factorial(n-k+1)/factorial((n-k+1)-i)
    tmp = np.ceil(k/i)
    a, b = int(k//tmp), int(k%tmp)
    perm /= (factorial(a)*factorial(b))
    print(int(perm)%(10**9+7))

### FIXED CODE ###

import math
N,K = (int(x) for x in input().split())
R = N - K
mod = 10**9 + 7
def fact(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,K+1):
    ans = 0 if N - K + 1 < i else fact(R+1, i)*fact(K-1,i-1)
    print(int(ans)%mod)
n, k = map(int, input().split())
s = input()

if s[k-1] == 'A':
    print(s[:k-1]　+ 'a' + s[k:])

elif s[k-1] == 'B':
    print(s[:k-1] + 'b' + s[k:])

else:
    print(s[:k-1] + 'c' + s[k:])

### FIXED CODE ###

n, k = map(int, input().split())
s = str(input())

if s[k-1] == 'A':
    print(s[:k-1] + 'a' + s[k:])

elif s[k-1] == 'B':
    print(s[:k-1] + 'b' + s[k:])

else:
    print(s[:k-1] + 'c' + s[k:])
s = input()
a = []
for i in range(len(str(s))-2):
  a.extend(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))

### FIXED CODE ###

s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))
N,M,X=map(int,input().split())
a = [int(input()) for in range(M)]
count_low = 0
count_high = 0
for i in range(a):
  if a[i-1]<X:
    count_low +=1
for i in range(a):
  if a[i-1]>X:
    count_high +=1
print(min(count_low,count_high))

### FIXED CODE ###

n,m,x = map(int,input().split())
a = list(map(int,input().split()))
s = len(a)
ans = 0
for i in a:
  if i < x:
    ans+=1
print(min(ans,s-ans))
from itertools import permutations
for t in xrange(input()):
    h, w = map(int, raw_input().split())
    A = [list(raw_input()) for i in xrange(h)]
    xmin = {}; xmax = {}
    ymin = {}; ymax = {}
    obj = set()
    for i in xrange(h):
        for j in xrange(w):
            c = A[i][j]
            if c == '.': continue
            xmin[c] = min(xmin.get(c, 99), j)
            xmax[c] = max(xmax.get(c, -1), j)
            ymin[c] = min(ymin.get(c, 99), i)
            ymax[c] = max(ymax.get(c, -1), i)
            obj.add(c)
    if not obj:
        print "SAFE"
        continue
    ok = 1
    for q in obj:
        for i in xrange(ymin[q], ymax[q]+1):
            for j in xrange(xmin[q], xmax[q]+1):
                if A[i][j] == '.':
                    ok = 0
                    break
            if not ok: break
        if not ok: break
    if not ok:
        print "SUSPICIOUS"
        continue
    for p in permutations(obj):
        valid = [[1]*w for i in xrange(h)]
        ok = 1
        for q in p:
            for i in xrange(ymin[q], ymax[q]+1):
                for j in xrange(xmin[q], xmax[q]+1):
                    if A[i][j] != q and not valid[i][j]:
                        ok = 0
                        break
                    elif A[i][j] == q:
                        valid[i][j] = 0
                if not ok: break
            if not ok: break
        if ok:
            print "SAFE"
            break
    else:
        print "SUSPICIOUS"

### FIXED CODE ###

for t in xrange(input()):
    h, w = map(int, raw_input().split())
    A = [list(raw_input()) for i in xrange(h)]
    xmin = {}; xmax = {}
    ymin = {}; ymax = {}
    obj = set()
    for i in xrange(h):
        for j in xrange(w):
            c = A[i][j]
            if c == '.': continue
            xmin[c] = min(xmin.get(c, 99), j)
            xmax[c] = max(xmax.get(c, -1), j)
            ymin[c] = min(ymin.get(c, 99), i)
            ymax[c] = max(ymax.get(c, -1), i)
            obj.add(c)
    if not obj:
        print "SAFE"
        continue
    ok = 1
    g = {e: set() for e in obj}
    deg = {e: 0 for e in obj}
    for q in obj:
        for i in xrange(ymin[q], ymax[q]+1):
            for j in xrange(xmin[q], xmax[q]+1):
                c = A[i][j]
                if c == '.':
                    ok = 0
                    break
                if c != q:
                    g[q].add(c)
            if not ok: break
        if not ok: break
    if not ok:
        print "SUSPICIOUS"
        continue
    for e in obj:
        for t in g[e]:
            deg[t] += 1
    cnt = len(obj)
    used = set()
    for e in obj:
        for e in obj:
            if not deg[e] and e not in used:
                for t in g[e]:
                    deg[t] -= 1
                used.add(e)
                cnt -= 1
    if cnt:
        print "SUSPICIOUS"
    else:
        print "SAFE"
K = int(input())
S = input().strip()

MOD = 10 ** 9 + 7

ans = 0

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]


def cmb(n, k, p):
    global fact, factinv
    if (k < 0) or (n < k):
        return 0
    r = min(k, n - k)
    return fact[n] * factinv[k] * factinv[n - k] % p


N = 10 ** 6
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)


for i in range(K + 1):
    ans += pow(25, i, MOD) * cmb(i + len(S) - 1, len(S) - 1, MOD) * pow(26, K - i, MOD)
    ans %= MOD

print(ans)

### FIXED CODE ###

import sys
import math
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    K = int(input())
    S = input().strip()

    MOD = 10 ** 9 + 7

    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]

    def cmb(n, k, p):
        if (k < 0) or (n < k):
            return 0
        r = min(k, n - k)
        return fact[n] * factinv[k] * factinv[n - k] % p

    N = 10 ** 6 * 2
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)

    ans = 0
    for i in range(K + 1):
        if len(S) == 1:
            ans += pow(25, i, MOD) * pow(26, K - i, MOD)
        else:
            ans += pow(25, i, MOD) * cmb(i + len(S) - 1, len(S) - 1, MOD) * pow(26, K - i, MOD)

    print(ans % MOD)


if __name__ == '__main__':
    main()
A = int(input())
P = int(input())

N = (A*3+P%2)//2+P//2

print(N)

### FIXED CODE ###

A, P = (int(i) for i in input().split())
  
N = (A*3+P%2)//2+P//2

print(N)
from collections import Counter

n,k,l=map(int,input().split())
city1=[i for i in range(n)]
city2=[i for i in range(n)]

def root(c,x):
  if x==c[x]:
    return x
  else:
    return root(c,c[x])

def union(c,x,y):
  rx=root(c,x)
  ry=root(c,y)
  c[rx]=ry

for i in range(k):
  a,b=map(int,input().split())
  union(city1,a-1,b-1)
for i in range(l):
  a,b=map(int,input().split())
  union(city2,a-1,b-1)
r=[]
for i in range(n):
  r.append((root(city1,i),root(city2,i)))
c=Counter(r)
for i in range(n):
  ans=c[r[i]]
  if i==n-1:
    print(ans)
  else:
    print(ans,end=' ')

### FIXED CODE ###

from collections import Counter

n,k,l=map(int,input().split())
city1=[i for i in range(n)]
city2=[i for i in range(n)]

def root(c,x):
  if x==c[x]:
    return x
  else:
    c[x]=root(c,c[x])
    return c[x]

def union(c,x,y):
  rx=root(c,x)
  ry=root(c,y)
  if rx>ry:
    c[rx]=ry
  else:
    c[ry]=rx

for i in range(k):
  a,b=map(int,input().split())
  union(city1,a-1,b-1)
for i in range(l):
  a,b=map(int,input().split())
  union(city2,a-1,b-1)
r=[]
for i in range(n):
  r.append((root(city1,i),root(city2,i)))
c=Counter(r)
for i in range(n):
  ans=c[r[i]]
  if i==n-1:
    print(ans)
  else:
    print(ans,end=' ')
s = list(input())

if s == '1':
    print(1)
else:
    a = []
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            a.append(max(len(s[:i+1]), len(s[i+1:])))
            
    print(min(a))

### FIXED CODE ###

s = list(input())
l = len(s)
a = [l]
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        a.append(max(i+1, len(s)-i-1))
        
print(min(a))