Harryxun/stf_run huggingface dataset:
D, G = map(int, input().split())
PC = [0]+[list(map(int,input().split())) for _ in range(D)]

def dfs(d, g):
    # if(d == 0):
    #     return 1e9

    c = min(g//(100*d), PC[d][0])
    s = 100*d*c
    if c == PC[d][0]:
        s += PC[d][1]
    if s<g:
        c += f(d-1, g-s)
    return min(c, f(d-1,g))

print(dfs(D, G))

### FIXED CODE ###

D, G = map(int, input().split())
PC = [0]+[list(map(int,input().split())) for _ in range(D)]

def dfs(d, g):
    if(d == 0):
        return 1e9

    c = min(g//(100*d), PC[d][0])
    s = 100*d*c
    if c == PC[d][0]:
        s += PC[d][1]
    if s<g:
        c += dfs(d-1, g-s)
    return min(c, dfs(d-1,g))

print(dfs(D, G))
import math
def main():
    A, B = map(int, input().split())
    ans = int(A * B / math.gcd(A, B))
    print(ans)
main()


### FIXED CODE ###

import fractions
def main():
    A, B = map(int, input().split())
    ans = int(A * B / fractions.gcd(A, B))
    print(ans)
main()
from collections import deque

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

ans=[]

A_dict={}

for n in range(N):
    a = A.popleft()
    A_dict[a]=n+1
    
for n in range(N):
    ans.append(A_dict[n+1])

print(*ans, sep=' ')


### FIXED CODE ###

from collections import deque

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

ans=[]

A_dict={}

for n in range(N):
    a = A.popleft()
    A_dict[a]=n+1
    
for n in range(N):
    ans.append(A_dict[n+1])

print(*ans, sep=' ')
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

dp = [0] * (N + 1)
for i in range(N, -1, -1):
  for j in range(3):
    x = a[j]
    y = b[j]
    if i - x >= 0:
      dp[i - x] = max(dp[i - x], dp[i] + y)
for i in range(N + 1): dp[i] += i
#print(dp)
t = max(dp)
e = []
def check(x):
  tt = t - b[e[0]] * x
  return (tt // b[e[1]]) * a[e[1]] + tt % b[e[1]] + a[e[0]] * x

if t > N:
  for i in range(3):
    if b[i] < a[i]: e.append(i)
  if len(e) == 0:
    print(t)
  elif len(e) == 1:
    print(a[e[0]] * (t // b[e[0]]) + t % b[e[0]])
  else:
    if b[e[0]] < b[e[1]]: e[0], e[1] = e[1], e[0]
    x = e[0]
    res = 0
    for i in range(t // b[x] + 1): res = max(res, check(i))
    print(res)
else:
  dp = [0] * (N + 1)
  for i in range(N, -1, -1):
    for j in range(3):
      y = a[j]
      x = b[j]
    if i - x >= 0:
      dp[i - x] = max(dp[i - x], dp[i] + y)
  for i in range(N + 1): dp[i] += i
  print(max(dp))

### FIXED CODE ###

N, K = map(int, input().split())
if K == 1: print(0)
else: print(N - K)
import math
import numpy as np

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

def check():
    x = np.arange(1, N+1)
    tmp = np.floor(A * (x/B) ) - (A * np.floor(x / B))
    print(int(max(tmp)))
        
check()


### FIXED CODE ###

import math

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

if N < B:
    x = N
else:
    x = B - 1

def check(x):
    return math.floor((A * x) / B)
            
print(check(x))
a, b, x = map(int, input().split())
#aからbまでをliに格納
li = list(range(a, b+1))
ans = 0

#liの要素数だけfor文を回す
for i in range(len(li)):
  #li[i]がxで割り切れる時
  if li[i] % x == 0:
    #ansに1を追加
    ans += 1
    
print(ans)

### FIXED CODE ###

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

#aの商と余り、bの商を求める
qa = a // x
qb = b // x
ra = a % x
#bの商からaの商を引く
ans = qb - qa

#ここまでの操作で、a以外の値の内、xで割り切れる値の数がansに入っているため、
#aが割り切れるかどうかで条件分岐させる
if ra == 0:
  print(ans+1)
else:
  print(ans)
s=list(raw_input())
s=set(s)
print 'Yes' if len(s)==4 or (len(s)==2 and 'S' in s and 'N' in s) or (len(2) and 'W' in s and 'E' in s) else 'No'

### FIXED CODE ###

s=list(raw_input())
s=set(s)
print 'Yes' if len(s)==4 or (len(s)==2 and 'S' in s and 'N' in s) or (len(s)==2 and 'W' in s and 'E' in s) else 'No'
import math

 

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

pair = {N:S,M:T}


def lcd(n,m):
    return int(n * m / gcd(n,m))
def gcd(n,m):
    if n % m == 0:
        return m
    else:
        return gcd(m,n % m)
#    return int(m*n/math.gcd(n,m))
    
def prove(n,m):
    if gcd(n,m)==1:
        return lcd(n,m)
    global pair
    n_i = int(n/gcd(n,m))
    m_i = int(m/gcd(n,m))
    n_list = pair[n][::n_i]
    m_list = pair[m][::m_i]
#    print(c)
#    print(pair[m])
    if n_list[0:len(m_list)]==m_list:
        return lcd(n,m)
    else:
        return -1
n = max(pair.keys())
m = min(pair.keys())
if pair[N][0]!=pair[M][0]:
    print(-1)
elif N==M:
    if S==T:
        print(N)
    else
        print(-1)
else:
    print(prove(n,m))



### FIXED CODE ###

import math

 

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

pair = {N:S,M:T}


def lcd(n,m):
    return int(n * m / gcd(n,m))
def gcd(n,m):
    if n % m == 0:
        return m
    else:
        return gcd(m,n % m)
#    return int(m*n/math.gcd(n,m))
    
def prove(n,m):
    if gcd(n,m)==1:
        return lcd(n,m)
    global pair
    n_i = int(n/gcd(n,m))
    m_i = int(m/gcd(n,m))
    n_list = pair[n][::n_i]
    m_list = pair[m][::m_i]
#    print(c)
#    print(pair[m])
    if n_list[0:len(m_list)]==m_list:
        return lcd(n,m)
    else:
        return -1
n = max(pair.keys())
m = min(pair.keys())
if pair[N][0]!=pair[M][0]:
    print(-1)
elif N==M:
    if S==T:
        print(N)
    else:
        print(-1)
else:
    print(prove(n,m))
import bisect

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

ans = 0
for i in range(N-1):
  k = li[i]
  for j in range(i+1, N):
    l = li[j]
    tmp = bisect_left(li, k+l)
    ans += tmp - i -1
    
    
print(ans)

### FIXED CODE ###

import bisect

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

for i in range(N-1):
  k = A[i]
  for j in range(i+1, N):
    l = A[j]
    res = bisect.bisect_left(A, k+l)
    ans += res-j-1
    
print(ans)
a=list(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
b=input()
print(a[b])

### FIXED CODE ###

a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b=int(input())
print(a[b-1])
import math
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
a.sort()
for i in range(n-1):
    mina = min(mina,math.gcd(a[i],a[i+1]))
print(mina)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
mina = max(a)
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
a.sort()
for i in range(n-1):
    mina = min(mina,gcd(a[i],a[i+1]))
print(mina)
import re

S = input()

print(len(max(re.findall('[ATCG]+', S))))

### FIXED CODE ###

import re

S=input()

ans=0
for i in range(10):
  for j in range(i,10+1):
    str=S[i:j]
    if re.search(r'^[AGCT]+$' ,str):
      ans=max(ans,len(str))

print(ans)
input = raw_input
S = input()
n = len(S) # N-1
s = S


up_count = 0
down_count = 0

for i, c in enumerate(S):
    if c == "<":
        start_i = i
        break
    down_count += 1

nums = []
for num in reversed(range(down_count+1)):
    nums.append(num)

up = True
for c in S[start_i:]: 
    if c == "<":
        if not up: # down->up
            if up_count >= down_count:
                for num in range(1, up_count+1):
                    nums.append(num)
                for num in reversed(range(0, down_count)):
                    nums.append(num)
            else:
                for num in range(0, up_count):
                    nums.append(num)
                for num in reversed(range(1, down_count+1)):
                    nums.append(num)
                 
            down_count = 0
            up_count = 1
            up = True
        else:
            up_count += 1
    else:
        if up:
            up = False
            down_count = 1
        else:
            down_count += 1
        

if up:
    for num in range(up_count+1):
        nums.append(num)
else:
    if up_count >= down_count:
        for num in range(1, up_count+1):
            nums.append(num)
        for num in reversed(range(0, down_count)):
            nums.append(num)
    else:
        for num in range(0, up_count):
            nums.append(num)
        for num in reversed(range(1, down_count+1)):
            nums.append(num)

out = sum(nums)
print(out)

### FIXED CODE ###

input = raw_input
S = input()
n = len(S) # N-1
s = S


up_count = 0
down_count = 0

start_i = None
for i, c in enumerate(S):
    if c == "<":
        start_i = i
        break
    down_count += 1

if start_i is None:
    start_i = n

nums = []
for num in reversed(range(down_count+1)):
    nums.append(num)

up = True
for c in S[start_i:]: 
    if c == "<":
        if not up: # down->up
            if up_count >= down_count:
                for num in range(1, up_count+1):
                    nums.append(num)
                for num in reversed(range(0, down_count)):
                    nums.append(num)
            else:
                for num in range(0, up_count):
                    nums.append(num)
                for num in reversed(range(1, down_count+1)):
                    nums.append(num)
                 
            down_count = 0
            up_count = 1
            up = True
        else:
            up_count += 1
    else:
        if up:
            up = False
            down_count = 1
        else:
            down_count += 1
        

if up:
    for num in range(up_count+1):
        nums.append(num)
else:
    if up_count >= down_count:
        for num in range(1, up_count+1):
            nums.append(num)
        for num in reversed(range(0, down_count)):
            nums.append(num)
    else:
        for num in range(0, up_count):
            nums.append(num)
        for num in reversed(range(1, down_count+1)):
            nums.append(num)

out = sum(nums)
print(out)
S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]
C = S[2]

D = int(A/B)
        
if D > C:
  print(C)
else D < C:
  print(D)

### FIXED CODE ###

S = input()
 
S = list(map(int, S.split()))
 
A = S[0]
B = S[1]
C = S[2]
 
D = int(B/A)
        
if D > C:
  print(C)
else:
  print(D)
M=input(int())
print(24+(24-M))

### FIXED CODE ###

M=int(input())
print(24+(24-M))
N,Y = map(int,input().split())

ans = [-1,-1,-1]

for n1 in range(N+1):
  for n2 in range(N-n1+1):
    yen = n1 * 10000 + n2 * 5000 + (N-n1-n2) * 1000
    if yen == Y:
      ans = [n1,n2,N-n1-n2]
      break
print(" ".join(ans))

### FIXED CODE ###

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

ans = [-1,-1,-1]

for n1 in range(N+1):
  for n2 in range(N-n1+1):
    yen = n1 * 10000 + n2 * 5000 + (N-n1-n2) * 1000
    if yen == Y:
      ans = [n1,n2,N-n1-n2]
      break

print(" ".join(map(str,ans)))
length0 = input()
print(" ")
#length = length0.split()
#a = length[0]
#b = length[1]
#print(str(a)+" "+str(b))
#area = a*b
#per = 2*a+2*b
#print(str(area)+" "+str(per))


### FIXED CODE ###

length0 = input()
#print(length0)
length = length0.split()
a = int(length[0])
b = int(length[1])
#print(str(a)+" "+str(b))
area = a*b
per = 2*a+2*b
print(str(area)+" "+str(per))
from collections import deque

def solve():
    H, W = map(int, input().split())
    A = [list(input()) for _ in range(H)]
    INF = 10 ** 9
    d = [[INF] * W for i in range(H)]
    d[0][0] = 1 if A[0][0] == '#' else 0

    def bfs():
        prepare = 1 if A[0][0] == '#' else 0
        q = deque([(0, 0, prepare)])
        while q:
            w, h, c = q.popleft()
            for a, b in [(1,0), (0,1)]:
                w_n, h_n = w+a, h+b
                if w_n >= W or h_n >= H: continue
                k = 1 if A[w_n][h_n] == '#' else 0
                if c+k >= d[h_n][w_n]: continue
                d[h_n][w_n] = c+k
                q.append((w_n, h_n, c+k))
    bfs()
    return d[W-1][H-1]

print(solve())

### FIXED CODE ###

from collections import deque

def solve():
    H, W = map(int, input().split())
    A = [list(input()) for _ in range(H)]
    INF = 10 ** 9
    d = [[INF] * W for i in range(H)]
    d[0][0] = 1 if A[0][0] == '#' else 0

    prepare = 1 if A[0][0] == '#' else 0
    q = deque([(prepare, 0, 0)])
    while q:
        c, x, y = q.popleft()
        for a, b in [(1,0), (0,1)]:
            nx, ny = x+a, y+b
            if nx >= W or ny >= H: continue
            k = 1 if A[y][x] != A[ny][nx] else 0
            if c+k >= d[ny][nx]: continue
            d[ny][nx] = c+k
            q.append((c+k, nx, ny))

    return (d[H-1][W-1]+1)//2

print(solve())
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

a,b = MI()
print(int((a+b+1)/2)


### FIXED CODE ###

import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

a,b = MI()
print(int((a+b+1)/2))
length0 = input()
length = length0.split()
a = length[0]
b = length[1]
area = a*b
per = 2*a+2*b
print(str(area)+" "+str(per))


### FIXED CODE ###

length0 = input()
#print(length0)
length = length0.split()
a = int(length[0])
b = int(length[1])
#print(str(a)+" "+str(b))
area = a*b
per = 2*a+2*b
print(str(area)+" "+str(per))
N = int(input())
ls = [1]
ans = 0

if N == 1:
        print(1)
else:
    for i in range(1, N+1):
        new_ls = map(lambda x: x*i, ls)
        for j in new_ls    
            if j not in ls:
                ans += 1
                ls.append(j)
    print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# problem C2

## N! = 1 * 2 * ... * N
## N! = 2~e2 + 3~e3 + 5~e5 + ... + prime~eprime
## e2 = ord2(1) + ord2(2) + ... + ord2(N)
## ans = (e2 + 1)(e3 + 1)(e5 + 1)...
## e2 = [N/2] + [N/4] + [N/8] + [N/16] +...

from math import floor as gs
N = int(input())

## creating prime numbers until N
def fun_prime(k):
    counter = 0
    primes = [2, 3]

    for n in range(5, k+1, 2):
        isprime = True
        for i in range(1, len(primes)):
            if primes[i] ** 2 > n:
                break
            if n % primes[i] == 0:
                isprime = False
                break
        if isprime == True:
            primes.append(n)
    return(primes)
primes_N = fun_prime(N)

ans = 1
if N == 1:
    print(int(ans))
else:
    for prime in primes_N:
        e = 0
        power = prime
        while power <= N:
            e += gs(N/power)
            power = power * prime
        ans = ans * (e + 1)
    ans = ans % (10 ** 9 + 7)
    print(int(ans))
A, B, K = [int(i) for i in input().split()]

a = max(A - K, 0)
print(f"{a} {B - max(K - A, 0)}")

### FIXED CODE ###

A, B, K = [int(i) for i in input().split()]

a = max(A - K, 0)
k = max(K - A, 0)
b = max(B - k, 0)
print(str(a) + ' ' + str(b))
s = list(x for x in input())
temp = 0
ans = []
for i in s:
  if i == 'A' or i == 'C' or i =='G' or i =='T':
    temp += 1
  else:
    ans.append(temp)
    temp = 0
print(max(ans))


### FIXED CODE ###

s = list(x for x in input())
temp = 0
ans = []
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] =='G' or s[i] =='T':
    temp += 1
    if i == len(s) - 1:
      ans.append(temp)
  else:
    ans.append(temp)
    temp = 0
print(max(ans))
x,n = map(int,input().split())

p_list = list(map(int,input().split()))
p_list = sorted(p_list)

import sys
if n == 0:
    print(x)
    sys.exit()

sa_min = 1000000
for i in range(1, 101):
    if i not in p_list:
        if sa_min > abs(i - x):
            sa_min = abs(i - x)
            ans = i
print(ans)

### FIXED CODE ###

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

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

import sys
if n == 0:
    print(x)
else:
    sa_min = 1000000
    for i in range(-110, 210):
        if i not in p_list:
            if sa_min > abs(i - x):
                sa_min = abs(i - x)
                ans = i
    print(ans)
A = input()
if A == "S"
	print("天気が雨である日が連続していた最大の日数を出力せよ。")
if A = "SSS"
	print(0)
if A == "RSS" or "SRS" or "SSR" or "RSR":
  print(1)
if A == "SRR" or "RRS":
  print(2)
if A == "RRR":
  print(3)

### FIXED CODE ###

A = input()
if A == "SSS":
	print(0)
elif A == "RRR":
  print(3)  
elif A ==  "SRR" or A == "RRS":
  print(2)
else:
  print(1)
n=int(input())

def f_xyz(x,y,z):
  return x**2+y**2+z**2+x*y+y*z+z*x 

li=[0]*(n+1)
for x in range(1,200):
  for y in range(1,200):
    for z in range(1,200):
      num=f_xyz(x,y,z)
      if num<=n:
        li[f_xyz(x,y,z)+1]+=1
      else:
        break
        
for i in li[2:n+1]:
  print(i)
  

### FIXED CODE ###

n=int(input())

def f_xyz(x,y,z):
  return x**2+y**2+z**2+x*y+y*z+z*x 

li=[0]*(n+5)
for x in range(1,200):
  for y in range(1,200):
    for z in range(1,200):
      num=f_xyz(x,y,z)
      if num<=n:
        li[f_xyz(x,y,z)+1]+=1
      else:
        break
        
for i in li[2:n+2]:
  print(i)
import sys
import math

def propare():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))

    solve(N)

def solve(N: int):
    # Symmetry, a<=b, a<=math.sqrt(N)
    N_max = min(N, 1000000000000)
    a_max = int(math.sqrt(N_max))
    tmp_list = []
    for a in range(1, a_max):
        if N%a == 0:
            b = int(N/a)
            tmp_list.append((a, b))

    if tmp_list:
        answer = tmp_list[0][0] + tmp_list[0][1]

    for i_tp in tmp_list:
        tmp = i_tp[0] + i_tp[1]

        if tmp < answer:
            answer = tmp

    print(answer - 2)
    return

 
if __name__ == "__main__":
    propare()

### FIXED CODE ###

import sys
import math

def propare():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))

    solve(N)

def solve(N: int):
    # Symmetry, a<=b, a<=math.sqrt(N)
    N_max = min(N, 1000000000000)
    a_max = int(math.sqrt(N_max))
    tmp_list = []
    for a in range(1, a_max+1):
        if N%a == 0:
            b = int(N/a)
            tmp_list.append((a, b))

    if tmp_list:
        answer = tmp_list[0][0] + tmp_list[0][1]

    for i_tp in tmp_list:
        tmp = i_tp[0] + i_tp[1]

        if tmp < answer:
            answer = tmp

    print(answer - 2)
    return

 
if __name__ == "__main__":
    propare()
import os
import sys

import numpy as np
from scipy.sparse.csgraph._shortest_path import floyd_warshall

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

H, W = list(map(int, sys.stdin.buffer.readline().split()))
S = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(H)]


def to_i(h, w):
    return h * W + w


N = H * W
graph = [[0] * N for _ in range(N)]
for h in range(H):
    for w in range(W):
        if S[h][w] == '.':
            if 0 <= h - 1 < H and S[h - 1][w] == '.':
                graph[to_i(h - 1, w)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h - 1, w)] = 1
            if 0 <= h + 1 < H and S[h + 1][w] == '.':
                graph[to_i(h + 1, w)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h + 1, w)] = 1
            if 0 <= w - 1 < W and S[h][w - 1] == '.':
                graph[to_i(h, w - 1)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h, w - 1)] = 1
            if 0 <= w + 1 < H and S[h][w + 1] == '.':
                graph[to_i(h, w + 1)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h, w + 1)] = 1
dist = floyd_warshall(graph, directed=False)
dist[dist == np.inf] = 0
print(int(dist.max()))


### FIXED CODE ###

import os
import sys

import numpy as np
from scipy.sparse.csgraph._shortest_path import floyd_warshall

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

H, W = list(map(int, sys.stdin.buffer.readline().split()))
S = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(H)]


def to_i(h, w):
    return h * W + w


N = H * W
graph = [[0] * N for _ in range(N)]
for h in range(H):
    for w in range(W):
        if S[h][w] == '.':
            if 0 <= h - 1 < H and S[h - 1][w] == '.':
                graph[to_i(h - 1, w)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h - 1, w)] = 1
            if 0 <= h + 1 < H and S[h + 1][w] == '.':
                graph[to_i(h + 1, w)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h + 1, w)] = 1
            if 0 <= w - 1 < W and S[h][w - 1] == '.':
                graph[to_i(h, w - 1)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h, w - 1)] = 1
            if 0 <= w + 1 < W and S[h][w + 1] == '.':
                graph[to_i(h, w + 1)][to_i(h, w)] = 1
                graph[to_i(h, w)][to_i(h, w + 1)] = 1
dist = floyd_warshall(graph, directed=False)
dist[dist == np.inf] = 0
print(int(dist.max()))
n = int(input())
s = inuput()
alfha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in s:
  a += alfha[(alfha.index(i)+n) % 26]
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
alfha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in s:
  ans += alfha[(alfha.index(i)+n) % 26]
print(ans)
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

A = [0]
B = [0]
for i in range(n):
	A.append(A[i]+a[i])
for j in range(m):
	B.append(B[j]+b[j])

#print(A,B)

maxij = 0
l = m
for i in range(n+1):
	for j in range(m):
#		print(i,l,A[i],B[l],k)
		if((A[i]+B[l]) <= k):
		 	maxij=max(maxij,i+l)
#		 	print("mm",maxij)
		 	break
		else:
		 	l-=1
print(maxij)

### FIXED CODE ###

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

A = [0]
B = [0]
for i in range(n):
	A.append(A[i]+a[i])
for j in range(m):
	B.append(B[j]+b[j])

#print(A,B)

maxij = 0
l = m
for i in range(n+1):
	for j in range(m):
#		print(i,l,A[i],B[l],k)
		if(l == -1):
			break
		elif((A[i]+B[l]) <= k):
		 	maxij=max(maxij,i+l)
#		 	print("mm",maxij)
		 	break
		else:
		 	l-=1
print(maxij)
mod = 10**9 + 7
def go(v):
    global tmp
    tmp += 1
    used[v] = True
    for i in range(len(g[v])):
        if not used[g[v][i]]:
            go(g[v][i])
def solve():
    n, m = map(int, input().split())
    global g, used, tmp
    tmp = 0
    g = [[] for i in range(n + 1)]
    ans = 0
    used = [False for i in range(n + 1)]
    for i in range(m):
        x, y = map(int, input().split())
        if y not in x:
            g[x].append(y)
            g[y].append(x)
    for i in range(1, n + 1):
        if not used[i]:
            tmp = 0
            go(i)
            ans = max(ans, tmp)
    print(ans)
t = 1
while t > 0:
    solve()
    t -= 1

### FIXED CODE ###

import sys
sys.setrecursionlimit(200001)
mod = 10**9 + 7
def go(v):
    global tmp
    tmp += 1
    used[v] = True
    for i in range(len(g[v])):
        if not used[g[v][i]]:
            go(g[v][i])
def solve():
    n, m = map(int, input().split())
    global g, used, tmp
    tmp = 0
    g = [[] for i in range(n + 1)]
    ans = 0
    d = {}
    used = [False for i in range(n + 1)]
    for i in range(m):
        x, y = map(int, input().split())
        if (x, y) not in d:
            g[x].append(y)
            g[y].append(x)
            d[(x, y)] = 1
    for i in range(1, n + 1):
        if not used[i]:
            tmp = 0
            go(i)
            ans = max(ans, tmp)
    print(ans)
t = 1
while t > 0:
    solve()
    t -= 1