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

E_list = [[]for i in range(N)]

marks = [False for i in range(N)]

def dfs(n):
    global E_list
    global marks
    global N,M

    marks[n] = True

    steps = 1

    for nx in E_list[n]:
        if not marks[nx]:
            marks[nx] = True
            steps += dfs(nx)
    
    return steps



for i in range(M):
    e1,e2 = map(int, input().split())
   
    E_list[e1-1].append(e2-1)
    E_list[e2-1].append(e1-1)

m = 1



for i in range(N):
    if not marks[i]:
        st = dfs(i)

    m = max(m,st)

print(m)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

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

E_list = [[]for i in range(N)]

marks = [False for i in range(N)]
m = 1
def dfs(n):
    global E_list
    global marks
    global N,M

    marks[n] = True

    steps = 1

    for nx in E_list[n]:
        if not marks[nx]:
            marks[nx] = True
            steps += dfs(nx)
    
    return steps



for i in range(M):
    e1,e2 = map(int, input().split())
   
    E_list[e1-1].append(e2-1)
    E_list[e2-1].append(e1-1)


for i in range(N):
    E_list[i] = list(set(E_list[i]))

for i in range(N):
    if not marks[i]:
        st = dfs(i)

    m = max(m,st)

print(m)
def takahashi(A,B):
    if A and B >= 1:
        if A and B <= 9:
            print(A * B)
        else:
            print('-1')
    else:
        print('-1')

A = int(input('数字を入力してくださいA'))
B = int(input('数字を入力してくださいB'))

takahashi(A,B)

### FIXED CODE ###

A, B = map(int, input().split())
 
if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
Num = []
Num = list(map(int,input().split(" "))) #0-all 1-pick
lists = []
for i in range(0,Num[0]):
    lists.append(int(input()))
lists.sort()
lists.reverse()
dist = lists[0] - lists[0+Num[1]-1]
for j in range(1,Num[0] - Num[1] + 1):
    tmp = lists[j] - lists[j+Num[1]-1]
    if (dist > tmp):
        dist = tmp
print(dist)

### FIXED CODE ###

D = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
import math

N = int(input())
T = [int(input()) for _ in range(N)]
lcm = 1

for i in T:
    lcm = lcm*i//math.gcd(lcm, i)

print(lcm)

### FIXED CODE ###

import sys
input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


N = int(input())
T = [int(input()) for _ in range(N)]

if N == 1:
    print(T[0])

else:
    LCM = lcm(T[0], T[1])
    
    for i in range(1, N-1):
        LCM = lcm(LCM, T[i+1])
    
    print(LCM)
k = int(input())
s = input()

if len(s)<=k:
	print(s)

else:
	print(s[0:k] + "...")

### FIXED CODE ###

n = int(input()) 
en = str(n)
if (en[-1:]=="2" or en[-1:]=="4" or en[-1:]=="5" or en[-1:]=="7" or en[-1:]=="9"):
	print("hon")
elif (en[-1:]=="0" or en[-1:]=="1" or en[-1:]=="6" or en[-1:]=="8"):
	print("pon")
else:
	print("bon")
from math import gcd

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

# output
print(int(a*b/gcd(a, b)))


### FIXED CODE ###

from fractions import gcd

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

# output
print(int(a*b/gcd(a, b)))
import math
a,b=int(input().split())
x=a*b/2
print(math.ceil(x))


### FIXED CODE ###

import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))
n = input().split()
print(str(n[0] * n[1]) + " " + str((n[0] * 2) + (n[1] * 2)))



### FIXED CODE ###

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

#n = [int(i) for i in n]
print(str(n[0] * n[1]) + " " + str((n[0] + n[1]) * 2))
print [str.lower() for str in] 
print [str.upper() for str in]

### FIXED CODE ###

s = input()
print(s.swapcase())
n = int(input())
s = input()
k = int(input())

key = s[k]
result =""
for letter in s:
    if letter == key:
        result = result + key
    else:
        result =result +  "*"

print(result)

### FIXED CODE ###

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

key = s[k-1]
result =""

for letter in s:
    if letter == key:
        result = result + key
    else:
        result =result +  "*"

print(result)
N,W = map(int, input().split())
ws = []
vs = []
for i in range(N):
    w,v = map(int, input().split())
    ws.append(w)
    vs.append(v)
ws_m = [w-ws[0] for w in ws]

sum_ws_m = sum(ws_m)

"""
i番目まで見て、n個選んでいて、重さがwのときのvの最大値
ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする
dp[i][n][w] 
"""
dp = [[[0]*(3*N+1) for i in range(N+1)] for j in range(N+1)]
dp[0][0][0] = 0
for i,(w,v)  in enumerate(zip(ws_m,vs)):
    for n in range(i+1):
        for j in range(3*N+1):
            # もらうDP
            # j-wなら、新しくwをナップサックに入れて価値が増えるか見る
            if ws[0]*(n+1)+j+w <= W:
                dp[i+1][n+1][j+w] = max(dp[i+1][n+1][j+w], dp[i][n][j]+v)
            # 追加できない場合は以前の情報を更新
                
            dp[i+1][n][j] = max( dp[i+1][n][j], dp[i][n][j] )
            # if dp[i][n][j] == -1: continue
            # # if j + n*ws[0] > W: continue
            # # print("check",i,n,j,v)    )
            # dp[i+1][n][j] = max(dp[i+1][n][j], dp[i][n][j])
            # dp[i+1][n+1][j+w] = max(dp[i][n+1][j+w], dp[i][n][j] + v)
        # print(dp[i+1][n])
ans= 0
for i,As in enumerate(dp[N]):
    w = min( W - i*ws[0], sum_ws_m )
    if w >= 0:
        ans = max(ans,max(As[:w+1]))
print(ans)   

### FIXED CODE ###

N,W = map(int, input().split())
ws = []
vs = []
for i in range(N):
    w,v = map(int, input().split())
    ws.append(w)
    vs.append(v)
ws_m = [w-ws[0] for w in ws]

sum_ws_m = sum(ws_m)

"""
i番目まで見て、n個選んでいて、重さがwのときのvの最大値
ただし、wはN個選んだときにW-N*[w[0]]となっているので、そこをmaxとする
dp[i][n][w] 
"""
dp = [[[0]*(3*N+10) for i in range(N+10)] for j in range(N+10)]
dp[0][0][0] = 0
for i,(w,v)  in enumerate(zip(ws_m,vs)):
    for n in range(i+1):
        for j in range(3*N):
            # もらうDP
            # j-wなら、新しくwをナップサックに入れて価値が増えるか見る
            if ws[0]*(n+1)+j+w <= W:
                dp[i+1][n+1][j+w] = max(dp[i+1][n+1][j+w], dp[i][n][j]+v)
            # 追加できない場合は以前の情報を更新
                
            dp[i+1][n][j] = max( dp[i+1][n][j], dp[i][n][j] )
            # if dp[i][n][j] == -1: continue
            # # if j + n*ws[0] > W: continue
            # # print("check",i,n,j,v)    )
            # dp[i+1][n][j] = max(dp[i+1][n][j], dp[i][n][j])
            # dp[i+1][n+1][j+w] = max(dp[i][n+1][j+w], dp[i][n][j] + v)
        # print(dp[i+1][n])
ans= 0
for i,As in enumerate(dp[N]):
    w = min( W - i*ws[0], sum_ws_m )
    if w >= 0:
        ans = max(ans,max(As[:w+1]))
print(ans)
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
b = [[0]*2 for i in range(0,m)]
for i in range(0,m):
    b[i][1],b[i][0] = list(map(int,input().split()))

a.sort()
b.sort(reverse = True)

now = 0

for i in range(0,m):
    if now >n:
        break
    for j in range(0,b[i][1]):
        if now > n:
            break
        if a[now] < b[i][0]:
            a[now] = b[i][0]
            now += 1
        else:
            break

print(sum(a))

### FIXED CODE ###

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

a.sort()
b.sort(reverse = True)

now = 0
end = False

for i in range(0,m):
    if now >= n or end == True:
        break
    for j in range(0,b[i][1]):
        if now >= n:
            break
        if a[now] < b[i][0]:
            a[now] = b[i][0]
            now += 1
        else:
            end = True
            break

print(sum(a))
s=list(input())
x=s.index('A')
t=reversed(s)
y=t.index('Z')
print(len(s)-x-y)

### FIXED CODE ###

s=list(input())
x=s.index('A')
t=list(reversed(s))
y=t.index('Z')
print(len(s)-x-y)
n = int(input())
dp = [float('inf')]*(n+1)
dp[0] = 0
for i in range(1,n):
    cost = int(input())
    for j in range(i):
        dp[j] = min(dp[j],dp[i-j]+cost)
        dp[i-j] = min(dp[j]+cost,dp[i-j])
    #print(dp)
print(dp[n//2])

### FIXED CODE ###


n = int(input())
dp = [float('inf')]*(n+1)
dp[0] = 0
cost = [int(input()) for _ in range(n-1)]
for i in range(1,n):
    for j in range(i):
        if dp[i-j]+cost[i-1] < dp[j]: dp[j] = dp[i-j]+cost[i-1]# = min(dp[j],dp[i-j]+cost[i-1])
        if dp[j]+cost[i-1] < dp[i-j]: dp[i-j] = dp[j]+cost[i-1]# = min(dp[i-j],dp[j]+cost[i-1])
    #print(dp)
print(dp[n//2])
def dfs(i, f, sum):
    if i == 3 and sum == 7:
        print(f+"=7")
        exit()
    else :
        dfs(i+1, f + '-' + s[i+1], sum - int(s[i+1]))
        dfs(i+1, f + '+' + s[i+1], sum + int(s[i+1]))
        
s = input()
dfs(0, s[0], int(s[0]))





### FIXED CODE ###

#abc079 train ticket
s = input()
for bit in range(1<<3):
    a = int(s[0])
    func = s[0]
    for i in range(3):
        if bit & (1<<i):
            func += '+'
            a += int(s[i+1])
        else : #もし1というフラグが立っていなければ、引くというプログラム
            func += '-'
            a -= int(s[i+1])
        func += s[i+1]
    
    if a == 7:
        print(func + '=7')
        exit()
print('No')
import sys
input=sys.stdin.readline
# coding: utf-8
# Your code here!

n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()
"""
print(a[0])
print(a[1])
print(a[2])
"""
def bin_upper(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[0][pc]>=b and a[0][pc-1]<b:
            return pc
        elif a[0][pc]<b:
            pl=pc+1
            if pl>n-1:
                return n
        else:
            pr=pc-1
            if pr<0:
                return 0
                
def bin_lower(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[2][pc]<=b and a[2][pc+1]>b:
            return n-1-pc
        elif a[2][pc]>b:
            pr=pc-1
            if pr<0:
                return n
        else:
            pl=pc+1
            if pl>n-1:
                return 0
"""
print(bin_upper(a[1][0]))
print(bin_lower(a[1][0]))
print(bin_upper(a[1][1]))
print(bin_lower(a[1][1]))
print(bin_upper(a[1][2]))
print(bin_lower(a[1][2]))
"""

cnt=0
for i in range(n):
    cnt+=bin_upper(a[1][i])*bin_lower(a[1][i])
print(cnt)


### FIXED CODE ###

import sys
input=sys.stdin.readline
from bisect import bisect_right, bisect_left
n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()



cnt=0
for i in range(n):
    index_1 = bisect_left(a[0],a[1][i])
    index_2 = n-bisect_right(a[2],a[1][i])
    cnt+=index_1*index_2
print(cnt)
from collections import defaultdict
def check():
  D = defaultdict(lambda: '')
  N, M = map(int, input().split())
  if M==0:
    return 'Yes'
  for i in range(M):
    l,r,d = map(int, input().split())
    if i==0:
      D[l] = 0
    if D[r]!='' and D[r] != D[l]+d:
      return 'No'
    D[r] = D[l]+d
  if max(D.values())-min(D.values())>10**9:
    return 'No'
  return 'Yes'
print(check())

### FIXED CODE ###

from collections import deque
def check():
  N, M = map(int, input().split())
  edge = [[] for _ in range(N)]
  for i in range(M):
    a,b,d = map(int, input().split())
    edge[a-1].append([b-1,d])
    edge[b-1].append([a-1,-d])
  
  visited = [float('inf')]*N
  D = deque()
  for i in range(N):
    if visited[i]==float('inf'):
      visited[i]=0
      D.append(i)
      while len(D)>0:
        v = D.popleft()
        for w,d in edge[v]:
          if visited[w]==float('inf'):
            visited[w] = visited[v]+d
            D.append(w)
          elif visited[w]!=visited[v]+d:
            return 'No'
  return 'Yes'
print(check())
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if dp[i][j]!=0:
            dp[i+1][j+x[i+1]]+=dp[i][j]
            dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

### FIXED CODE ###

n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)
n, m = map(int, input().split())
l = 1
r = n
for i in range(m):
  li, ri = map(int, input().split())
  l = max(l, li)
  r = min(r, ri)
print(max(l - r + 1), 0)

### FIXED CODE ###

n, m = map(int, input().split())
l = 1
r = n
for i in range(m):
  li, ri = map(int, input().split())
  l = max(l, li)
  r = min(r, ri)
print(max(r - l + 1, 0))
b=list(input())
a=int(input())
if b[0]=="1":
  print(1)
else:
  print(b[1])


### FIXED CODE ###

s=input()
k=int(input())
for i in range(k):
  if s[i]!="1":
    break
print(s[i])
from collections import gcd

MOD = 10 ** 9 + 7

N = int(input())

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

B = [1] * (N + 1)

for index, a in enumerate(A):
    tmp = gcd(B[index], a)
    B[index + 1] = B[index] * a // tmp

C = [1] * (N + 1)
for i in range(N - 1, -1, -1):
    tmp =gcd(C[i + 1], A[i])
    C[i] = C[i + 1] * A[i] // tmp

# print (B)
# print (C)

ans = 0
for i in range(N):
    tmp1 = gcd(B[i], C[i + 1])
    tmp2 = B[i] * C[i + 1] // tmp1

    tmp3 = gcd(tmp2, A[i])
    tmp4 = tmp2 * A[i] // tmp3

    ans += (tmp4 // A[i] % MOD)
    ans %= MOD

    # print (ans)

print (ans)

### FIXED CODE ###

def main():
    from fractions import gcd

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

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  G[a - 1].append(b - 1)
  G[b - 1].append(a - 1)
V = []
for i, v in enumerate(G):
  if len(v) % 2:
    print('No')
    break
  if len(v) >= 6:
    print('Yes')
    break
  if len(v) == 4:
    V.append[i]
else:
  if len(V) != 2:
    print('Yes' if len(V) > 2 else 'No')
  else:
    s = V[0]
    for i in range(3):
      t = G[s].pop()
      while t not in V:
        t = G[t].pop()
      if s == t:
        print('Yes')
        break
    else:
      print('No')

### FIXED CODE ###

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  G[a - 1].append(b - 1)
  G[b - 1].append(a - 1)
V = []
D = 0
for i in range(N):
  if len(G[i]) % 2:
    print('No')
    break
  D = max(len(G[i]), D)
  if len(G[i]) == 4:
    V.append(i)
else:
  if D >= 6:
    print('Yes')
  elif len(V) != 2:
    print('Yes' if len(V) > 2 else 'No')
  else:
    s = V[0]
    for i in range(3):
      t = G[s].pop()
      G[t].pop(G[t].index(s))
      while t not in V:
        d = G[t].pop()
        G[d].pop(G[d].index(t))
        t = d
      if s == t:
        print('Yes')
        break
      else:
        s = t
    else:
      print('No')
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem D

if __name__ == '__main__':
    height, width = map(int, input().split(" "))
    s = [map(str, input().split(",")) for i in range(width)]

    total_count = height * width
    white_count_min = (height - 1) + width
    current_black_count = s.count("#")

    result = total_count - current_black_count - white_count_min

    if result > 0:
        print(result)
    else:
        print(-1)


### FIXED CODE ###

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


def main():
    from collections import deque

    h, w = map(int, input().split())
    s = [list(input()) for _ in range(h)]
    dist = [[float('inf') for _ in range(w)] for _ in range(h)]
    is_visited = [[False for _ in range(w)] for _ in range(h)]
    dxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
    white_count = 0

    for i in range(h):
        for j in range(w):
            if s[i][j] == '.':
                white_count += 1

    # スコアの最大化：全ての白マス－最短距離で(H, W)まで移動するのに必要なマスの数
    # BFS
    # Initialize
    d = deque()
    d.append(tuple((0, 0)))
    dist[0][0] = 1
    is_visited[0][0] = True

    while d:
        di = d.popleft()

        for dy, dx in dxy:
            nx = dx + di[1]
            ny = dy + di[0]

            if (nx < 0 or w <= nx or ny < 0 or h <= ny):
                continue
            elif s[ny][nx] == '#':
                continue
            elif is_visited[ny][nx]:
                continue
            else:
                dist[ny][nx] = dist[di[0]][di[1]] + 1
                is_visited[ny][nx] = True
                d.append((ny, nx))

    if dist[h - 1][w - 1] == float('inf'):
        print(-1)
    else:
        print(white_count - dist[h - 1][w - 1])


if __name__ == '__main__':
    main()
N,M= map(int,input().split())

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print('R',R,'L',L)
print(R.count(1))


### FIXED CODE ###

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

#print('     ','R',R,'L',L) 
for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==1 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    L[y[i]-1]=L[y[i]-1]+1
  #print(i+1,x[i],y[i],'R',R,'L',L) 
    

print(R.count(1))
a,b,c,k=map(int,input().split())

if k%2 == 0 and abs(a-b)<=10**8:print(a-b)
elif k%2 != 0 abs(b-a)<=10**8:print(b-a)
else:print("Unfair")

### FIXED CODE ###

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

if k%2 == 0 and abs(a-b)<=10**18:print(a-b)
elif k%2 != 0 and abs(b-a)<=10**18:print(b-a)
else:print("Unfair")
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n - 1):
    v = math.gcd(v, a[i])
print(v)


### FIXED CODE ###

import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = fractions.gcd(v, a[i])
print(v)
import sys
input = sys.stdin.readline

def digit_sum(n, b):
    if n < b:
        return n
    res = n % b + digit_sum(n // b, b)
    return res

def main():
    n = int(input())
    s = int(input())
    if n < s:
        ans = -1
    elif n == s:
        ans = n + 1
    else:
        key = []
        start, first = n, 1

        for i in range(1, n):
            first = digit_sum(n, start)
            end = start - n // i // (i + 1)
            if start == end:
                judge = end
                break
            while True:
                if digit_sum(n, end) == i * (start - end) + first:
                    end -= 1
                    continue
                break
            next_start = end - 1
            end = digit_sum(n, end)
            key.append((start, end, i, first))
            start = next_start
        for i in range(2, judge + 1):
            sub = digit_sum(n, i)
            if sub == s:
                ans = i
                break
        else:
            for start, end, i, first in reversed(key):
                if end < s:
                    continue
                if (s - first) % i:
                    continue
                ans = start - (s - first) // i
                break
    try:
        print(ans)
    except:
        print(-1)


def judge():
    n = int(input())
    for i in range(2, min(n+5, 1000)):
        ans = digit_sum(n, i)
        print(str(i).zfill(3), ans)
    
#judge()
main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def digit_sum(n, b):
    res = 0
    while n > 0:
        res += n % b
        n //= b
    return res

def main():
    n = int(input())
    s = int(input())
    ans = -1

    if n < s:
        ans = -1

    elif n == s:
        ans = n + 1

    else:
        key = []
        start, first = n, 1

        for i in range(1, n):
            first = digit_sum(n, start)
            end = start - n // i // (i + 1)
            if start == end+1:
                judge = start
                break

            while end > 1:
                if digit_sum(n, end) == i * (start - end) + first:
                    end -= 1
                    continue
                break
            next_start = end
            value = digit_sum(n, start)
            end = value + (start - end - 1) * i
            key.append((start, value, end, i, first))
            judge = start
            start = next_start
            if start == 1:
                break

        for i in range(2, judge + 1):
            sub = digit_sum(n, i)
            if sub == s:
                ans = i
                break
        else:
            for index, start, end, i, first in reversed(key):
                if end < s or s < start:
                    continue
                if (s - start) % i:
                    continue
                ans = index - (s - first) // i
                break

    print(ans)


if __name__ == "__main__":
    main()
n=int(input())
ans=1
for i in range(a,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)    
  


### FIXED CODE ###

n=int(input())
ans=1
for i in range(1,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)
while True:
    a, b, c = input().split()
    if b == '?':
        break
    a = int(a)
    c = int(c)
    if b == '+':
        print(a + b)
    if b == '-':
        print(a - b)
    if b == '*':
        print(a * b)
    if b == '/':
        print(a / b)



### FIXED CODE ###

while True:
    a, b, c = input().split()
    if b == '?':
        break
    a = int(a)
    c = int(c)
    if b == '+':
        print(a + c)
    if b == '-':
        print(a - c)
    if b == '*':
        print(a * c)
    if b == '/':
        print(a // c)
H, W = map(int, input().split())

result = []
for h in range(1, (H+1)//2):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, (W+1)//2):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))


### FIXED CODE ###

H, W = map(int, input().split())

result = []
for h in range(1, H):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, W):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))
n,a,b = map(int,input().split())

k = n//(a+b) + 
L = ["b"]*a +["r"]*b
L = L*k
print(L[0:n+1].count("b"))

### FIXED CODE ###

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

print((n//(a+b))*a + min(n%(a+b), a))
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
for k,v in c:
  if ma == v:
    print(k)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
ans = []
for k,v in c.items():
  if ma == v:
    ans.append(k)

ans = sorted(ans)

for a in ans:
  print(a)