Harryxun/stf_run huggingface dataset:
import sys
h, w, k = map(int, input().split())
grid = [[1 if v == '1' else 0 for v in input()] for _ in range(h)]


def ass(v):
    if not v:
        print(-1)
        sys.exit(0)

ass(h > 0 and w > 0 and k > 0)
for row in grid:
    ass(len(row) == w)


def count_ones(i):
    cnt = 0
    while i:
        if i & 1:
            cnt += 1
        i >>= 1
    return cnt

ans = h + w

for state in range(1 << h):
    j = 0
    vcnt = 0
    counters = [0] * (h + 1)
    is_ok = True
    while j < w:
        hi = 0
        i = 0
        local_counters = [0] * (h + 1)
        ass(len(counters) == len(local_counters))
        while i < h:
            if (1 << i) & state:
                hi = i
            # print(hi, i, j)
            # print(grid[i])
            ass(len(local_counters) > hi)
            ass(i < h and j < w)
            local_counters[hi] += grid[i][j]
            i += 1
        for i, v in enumerate(local_counters):
            if v > k:
                is_ok = False
                break
            counters[i] += local_counters[i]
        if not is_ok:
            break
        if max(counters) > k:
            counters = local_counters.copy()
            vcnt += 1

        j += 1


    if is_ok and ans > count_ones(state) + vcnt:
        ans = count_ones(state) + vcnt
print(ans)



### FIXED CODE ###

import sys
def ass(v):
    if not v:
        print(-1)
        sys.exit(0)

h, w, k = map(int, input().split())
grid = [[1 if v == '1' else 0 for v in input()] for _ in range(h)]


ass(h > 0 and w > 0 and k > 0)
for row in grid:
    ass(len(row) == w)


def count_ones(i):
    cnt = 0
    while i:
        if i & 1:
            cnt += 1
        i >>= 1
    return cnt

ans = h + w

for state in range(1 << h):
    j = 0
    vcnt = 0
    counters = [0] * (h + 1)
    is_ok = True
    while j < w:
        hi = 0
        i = 0
        local_counters = [0] * (h + 1)
        ass(len(counters) == len(local_counters))
        while i < h:
            if (1 << i) & state:
                hi = i
            # print(hi, i, j)
            # print(grid[i])
            ass(len(local_counters) > hi)
            ass(i < h and j < w)
            ass(len(grid) > i)
            ass(len(grid[i]) > j)
            local_counters[hi] += grid[i][j]
            i += 1
        for i, v in enumerate(local_counters):
            if v > k:
                is_ok = False
                break
            counters[i] += local_counters[i]
        if not is_ok:
            break
        # ass(len(counters))
        # ass(k)
        if max(counters) > k:
            counters = local_counters[:]
            vcnt += 1

        j += 1


    if is_ok and ans > count_ones(state) + vcnt:
        ans = count_ones(state) + vcnt
print(ans)
from collections import deque

def bfs(que,d): #幅優先探索
  "
  #いつもはここで定義
  #入力のグラフを初期化
  #d = [[float("inf")] * w for i in range(h)] 
  #que = deque([])
  #que.append((sx,sy))
  #d[sx][sy] = 0
  "
  dx = [-1,0,0,1]
  dy = [0,-1,1,0]
  
  while que:
    lead_h,lead_w = que.popleft()
    lead = d[lead_h][lead_w]
    #lead == queの先頭にある要素を取り出す
    for i in range(4):
      nx = lead_w + dx[i]
      ny = lead_h + dy[i]
      if ny<0 or h<=ny or nx<0 or w<=nx:
        #範囲外の場合
        continue
      if d[ny][nx]==float("inf"):
        d[ny][nx] = lead + 1
        que.append((ny,nx))
  return lead

h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]

#多点スタートなのでbfs()内で定義して初期化しない
d = [[float("inf")] * w for i in range(h)] 

#キューも同様
que = deque([])
for i in range(h):
  for j in range(w):
    if maze[i][j] == "#":
      que.append((i,j))
      #各"#"を入れる
      d[i][j] = 0

#print(bfs())
lead = bfs(que,d)
print(lead)

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

# '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            black_cells.append((h, w))
            dist[h][w] = 0

def bfs(black_cells, dist):
    d = 0
    while black_cells:
        # キューとして使うのでpop()ではなくpopleft()
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
                dist[new_h][new_w] = d+1
                black_cells.append((new_h, new_w))
    return d

d = bfs(black_cells, dist)
print(d)
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
    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):
        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()


### 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()
n = int(input())
values = input().split()

mult = 1
for i in range(len(values)):
  mult *= int(values[i])
  
if mult > 10**18:
  print(-1)
else:
  print(mult)


### FIXED CODE ###

val_1 = input()
nums = val_1.split()
mult = int(nums[0]) * int(nums[1])
print(mult)
n,t=map(int,input().split())
arr=list(map(int,input()))
s=arr[0]
ans=0
tmp=0
for i in range(1,n):
  if arr[i]-s<=t:
    tmp=arr[i]-s
  else:
    ans+=tmp+t
    tmp=0
ans+=tmp+t
print(ans)

### FIXED CODE ###

n,t=map(int,input().split())
arr=list(map(int,input().split()))
start=arr[0]
ans=0
for i in range(1,n):
  tmp=arr[i]
  if tmp-start<t:
    ans+=tmp-start
  else:
    ans+=t
  start=tmp
print(ans+t)
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N: int, M: int, a: "List[int]"):
    l = [a[i+1]-a[i] for i in range(M-1)]
    if(len(l) and min(l)<=1):
        print(0)
        exit()

    dp = [1] * (N+1)
    dp[1] = 1
    dp[2] = 2
    x = 0
    
    for i in range(2,N+1):
        if(a[x] == i-1):
            dp[i] = dp[i-2] % MOD
            # x = min(x+1,M-1)
        elif(a[x] == i-2):
            dp[i] = dp[i-1] % MOD
            x = min(x+1,M-1)
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD
    
    print(dp[N])
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N: int, M: int, a: "List[int]"):
    if(len(a) >= 2):
        l = [a[i+1]-a[i] for i in range(M-1)]
        if(len(l) and min(l)<=1):
            print(0)
            exit()

    dp = [1] * (N+1)
    dp[1] = 1
    if(N >= 2):
        dp[2] = 2
    x = 0
    # if(M == 0):
    #     for i in range(2,N+1)
    
    for i in range(2,N+1):
        if(len(a) and a[x] == i-1):
            dp[i] = dp[i-2] % MOD
            # x = min(x+1,M-1)
        elif(len(a) and a[x] == i-2):
            dp[i] = dp[i-1] % MOD
            x = min(x+1,M-1)
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD
    
    print(dp[N])
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()
#input
r_1, c_1, r_2, c_2 = map(int, input().split())

#output
mod = 10**9 + 7

n_ = 10**10 + 3
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

answer = 0
for j in range(c_1, c_2+1):
    answer += cmb(r_2+j+1, j+1) % mod - cmb(r_1+j, j+1) % mod

print(answer % mod)

### FIXED CODE ###

#input
r_1, c_1, r_2, c_2 = map(int, input().split())

#output
mod = 10**9 + 7

n_ = 2*10**6 + 1
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

answer = 0
for j in range(c_1, c_2+1):
    answer += cmb(r_2+j+1, j+1) % mod - cmb(r_1+j, j+1) % mod

print(answer % mod)
n=int(input())
if n%1000=0:
  print(0)
else:
  print(1000-n%1000)

### FIXED CODE ###

n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)
def main():
    h,w = map(int, input().split())
    grid = []
    for i in range(h):
        s = list(input().rstrip())
        grid.append(s)
    l = [[0]*w for _ in range(h)]
    r = [[0]*w for _ in range(h)]
    d = [[0]*w for _ in range(h)]
    u = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if grid[i][j]!="#":
                if j==0:
                    l[i][j]=1
                    r[i][-(j+1)]=1
                else:
                    l[i][j]=l[i][j-1]+1
                    r[i][-(j+1)]=r[i][-(j)]
                    if j==w-1:
                      r[i][0]=r[i][1]+1
            if grid[i][-(w-j+1)]=="#":
                l[i][j]=0
                r[i][-(j+1)]=0
    for i in range(h):
        for j in range(w):
            if grid[i][j]!="#":
                if i==0:
                    d[i][j]=1
                    u[-(i+1)][j]=1
                else:
                    d[i][j]=d[i-1][j]+1
                    u[-(i+1)][j]=du[-(i)][j]+1
                    if i==h-1:
                      u[0][j] = u[1][j]
            if grid[i][j]=="#":
                d[i][j]=0
                u[-(i)][j]=0

    tmp = 0
    for i in range(h):
        for j in range(w):
            tmp = max(tmp, l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)

    print(tmp)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict

def dfs(i,j,dx,dy,kum):
    visited[i][j] = 1
    if grid[i][j]!="#" and visited[i][j]!=1:
        num[i][j]=max(num[i][j],dfs(i+dx,j+dy,dx,dy,kum+1))
    num[i][j] = max(num[i][j],kum)
    return kum
def main():
    h,w = map(int, input().split())
    grid = []
    for i in range(h):
        s = list(input().rstrip())
        grid.append(s)
    l = [[0]*w for _ in range(h)]
    r = [[0]*w for _ in range(h)]
    d = [[0]*w for _ in range(h)]
    u = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if grid[i][j]!="#":
                if j==0:
                    l[i][j]=1
                else:
                    l[i][j]=l[i][j-1]+1
            if grid[i][j]=="#":
                l[i][j]=0
            if grid[i][j]!="#":
                if i==0:
                    d[i][j]=1
                else:
                    d[i][j]=d[i-1][j]+1
            if grid[i][j]=="#":
                d[i][j]=0
    for i in range(h):
        for j in range(w-1,-1,-1):
            if grid[i][j]!="#":
                if j==w-1:
                    r[i][j]=1
                else:
                    r[i][j]=r[i][j+1]+1
            if grid[i][j]=="#":
                r[i][j]=0

    for i in range(h-1,-1,-1):
        for j in range(w):
            if grid[i][j]!="#":
                if i==h-1:
                    u[i][j]=1
                else:
                    u[i][j]=u[i+1][j]+1
            if grid[i][j]=="#":
                u[i][j]=0
    tmp = 0

    for i in range(h):
        for j in range(w):
            tmp = max(tmp, l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)



    print(tmp)

if __name__ == '__main__':
    main()
def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    BC = [[0, 0] for i in range(M)]

    for i in range(M):
        BC[i] = list(map(int, input().split()))
    BC.sort(key=lambda x: x[1], reverse=True)
    A.sort()
    index = 0
    for j in range(M):
        for i in range(BC[j][0]):
            if A[index] < BC[j][1]:
                A[index] = BC[j][1]
                index += 1

    print(sum(A))


if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    BC = [list(map(int, input().split())) for i in range(M)]

    BC.sort(key=lambda x: x[1], reverse=True)
    A.sort()
    index = 0
    for j in range(M):
        if index >= N:
            break
        elif A[index] > BC[j][1]:
            break
        for i in range(BC[j][0]):
            if index >= N:
                break
            elif A[index] < BC[j][1]:
                A[index] = BC[j][1]
                index += 1

    print(sum(A))


if __name__ == '__main__':
    main()
import numpy as np
import fractions
 
A,B,C,D = map(int,input().split())
BA = np.arange(A, B+1)
BA_C = BA % C
BA_D = BA % D
BA_CD = BA % (C * D//fractions.gcd(C, D))
 
C_count = np.count_nonzero(BA_C == 0)
D_count = np.count_nonzero(BA_D == 0)
CD_count = np.count_nonzero(BA_CD == 0)
 
print(len(BA)-(C_count+D_count-CD_count))

### FIXED CODE ###

from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)
# coding: utf-8
import time
import re
import math

def main():
    global N,A,memo
    N=int(input())
    A=[int(input()) for  a in range(N)] 
    if sum(A)%10==0:
        nm0=[]
        for a in A:
            if not a%10==0:
                nm0.append(a)
        if len(nm0)==0:
            print(0)
        else:
            print(sum(A)-math.min(nm0))

    else:
        print(sum(A))

main()

### FIXED CODE ###

# coding: utf-8
import time
import re
import math

def main():
    global N,A,memo
    N=int(input())
    A=[int(input()) for  a in range(N)] 
    if sum(A)%10==0:
        nm0=[]
        for a in A:
            if not a%10==0:
                nm0.append(a)
        if len(nm0)==0:
            print(0)
        else:
            print(sum(A)-min(nm0))

    else:
        print(sum(A))

main()
x,n=map(int,input().split())
lis=[i+1 for i in range(100)]
flag=True
if n==0:
  flag=False
  print(x)
if x==100:
  p=list(map(int,input().split()))
  print(100)
  flag=False

if flag:
  p=list(map(int,input().split()))
  for i in p:
    lis.remove(i)
  for i in range(len(lis)):
    if lis[i]>x:
      id=i
      break
  if id>=1:
    if abs(x-lis[id])<abs(x-lis[id-1]):
      print(lis[id])
    else:
      print(lis[id-1])
  else:
    print(lis[0])

### FIXED CODE ###

x,n=map(int,input().split())
lis=[i-1 for i in range(103)]
flag=True
if n==0:
  flag=False
  print(x)

if flag:
  p=list(map(int,input().split()))
  for i in p:
    lis.remove(i)
  #print(lis)
  for i in range(len(lis)):
    if lis[i]>x:
      index=i
      break
  if abs(x-lis[index])<abs(x-lis[index-1]):
    print(lis[index])
  else:
    print(lis[index-1])
st=input().split()
    H=int(st[0]);W=int(st[1])
    c=[[0 for i in range(10)] for i in range(10)]
    A=[[0 for i in range(W)]for i in range(H)]
    for i in range(10):
        st=input().split()
        for j in range(10):
            c[i][j]=int(st[j])
    for i in range(H):
        st=input().split()
        for j in range(W):
            A[i][j]=int(st[j])
    import math
    def Dijkstra(s):
        d=[math.inf]*10
        d[s]=0
        Q=list(range(10))
        V=list(range(10))
        while(len(Q)>0):
            u=Q[0]
            for i in Q:
                if d[i]<d[u]:
                    u=i
            Q.remove(u)
            Vtmp=list(range(10))
            Vtmp.remove(u)
            for v in Vtmp:
                if (d[v]>d[u]+c[u][v]):
                    d[v]=d[u]+c[u][v]
        return d[1]
    result=0
    DD=[0]*10
    for i in range(10):
        DD[i]=Dijkstra(i)
    for i in range(H):
        for j in range(W):
            if A[i][j]!=-1:
                result+=DD[A[i][j]]
    print(result)

### FIXED CODE ###

import math
st=input().split()
H=int(st[0]);W=int(st[1])
c=[[0 for i in range(10)] for i in range(10)]
A=[[0 for i in range(W)]for i in range(H)]
for i in range(10):
    st=input().split()
    for j in range(10):
        c[i][j]=int(st[j])
for i in range(H):
    st=input().split()
    for j in range(W):
        A[i][j]=int(st[j])
def Dijkstra(s):
    d=[10000]*10
    d[s]=0
    Q=set(range(10))
    V=set(range(10))
    while(len(Q)>0):
        u=list(Q)[0]
        for i in Q:
            if d[i]<d[u]:
                u=i
        Q-={u}
        for v in V-{u}:
            if (d[v]>d[u]+c[u][v]):
                d[v]=d[u]+c[u][v]
    return d[1]
result=0
DD=[0]*10
for i in range(10):
    DD[i]=Dijkstra(i)
for i in range(H):
    for j in range(W):
        if A[i][j]!=-1:
            result+=DD[A[i][j]]
print(result)
l = sorted(map(int,raw_input().split())))
print (str(l[0]),str(l[1]),str(l[2]))

### FIXED CODE ###

l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])
if input() == "7" or input() == "5" or input() == "3":
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a=int(input())
if(a==7 or a==5 or a==3):
  print("YES")
else:
  print("NO")
n = int(input())
x = list(map(int, input().split()))

x_diff = []
for i in range(n-1):
    x_diff.append(x[i+1] - x[i])



def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

base = 1
for i in range(1, n):
    base *= i
    base %= 10**9+7

frac = []
for i in range(1, n):
    frac.append(base*modinv(i) % (10**9+7))

import itertools
frac = list(itertools.accumulate(frac))

ans = 0
for i in range(n-1):
    ans += frac[i]*x_diff[i]
    ans %= 10**9+7

print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
music = []
for i in range(n):
    s, t = input().split()
    music.append([s,t])

x = input()
flag = 0
for i in range(n):
    if flag == 1:
        ans += int(music[i][1])
    if music[i][0] == x:
        flag = 1

print(ans)
n,a,b = map(int,input().split())
h =[0]*n
for i in range(n):
    h[i]=int(input())
def hantei(now):
    ab=a-b
    nokori = sum(kiriage( max(0,hh-now*b) ,ab)//(ab)  for hh in h)
    return nokori<=now
def kiriage(x,c):
    if x%c==0:
        return x
    else:
        return (x//c+1) *c

ma = 10**9//b +1
mi = 1
while mi<ma:
    now=(mi+ma)//2
    which = hantei(now)
#     print(which,mi,now,ma)
    if which:
        ma=now
        ans=now
    else:
        mi=now+1
print(ans)

### FIXED CODE ###

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

def hantei(now):
    ab=a-b
    nokori = sum(kiriage( max(0,hh-now*b) ,ab)//ab  for hh in h)
    return nokori<=now
def kiriage(x,c):
    if x%c==0:
        return x
    else:
        return (x//c+1) *c

ma = 10**9 +1
mi = 1

while mi<ma:
    now=(mi+ma)//2
    which = hantei(now)
#     print(which,mi,now,ma)
    if which:
        ma=now
        ans=now
    else:
        mi=now+1
print(ans)
def resolve():
    N, M = map(int, input().split())

    person_group = [0] * (N+5)
    group_counter = 0
    member_counter = {0: 0}

    def _marge_group(a, b):
        for i in range(len(person_group)):
            if person_group[i] == b:
                person_group[i] == a
        member_counter[a] = member_counter[a] + member_counter.pop(b)

    for _ in range(M):
        A, B = map(int, input().split())
        if person_group[A] == 0 and person_group[B] == 0:
            group_counter += 1
            person_group[A] = group_counter
            person_group[B] = group_counter
            member_counter[group_counter] = 2
        elif person_group[A] != 0 and person_group[B] == 0:
            person_group[B] = person_group[A]
            member_counter[person_group[A]] += 1
        elif person_group[A] == 0 and person_group[B] != 0:
            person_group[A] = person_group[B]
            member_counter[person_group[B]] += 1
        else:
            if person_group[A] == person_group[B]:
                continue
            else:
                _marge_group(person_group[A], person_group[B])
    print(max(member_counter.values()))

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

class UnionFind():
    def __init__(self, n: int):
        """
        n: ノード数
        """
        self.n = n
        """
        d: UnionFind木のデータ構造
            各要素の根要素を格納するリスト
            根要素の場合は, グループの要素数*-1を格納する
        """
        self.d = [-1] * n

    def find(self, x: int) -> int:
        """
        要素xが属するグループの根を返す
        """
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]

    def unite(self, x: int, y: int) -> bool:
        """
        要素xが属するグループと, 要素yが属するグループを併合する
        """
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False

        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x: int, y: int) -> bool:
        """
        要素x, yが同じグループに属するかどうかを返す
        """
        return self.find(x) == self.find(y)

    def size(self, x: int) -> int:
        """
        要素xが属するグループのサイズ(要素数)を返す
        """
        return -self.d[self.find(x)]

    def members(self, x: int) -> list:
        """
        要素xが属するグループの要素をリストで返す
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def groups(self) -> list:
        """
        すべての根の要素をリストで返す
        """
        return [i for i, x in enumerate(self.d) if x < 0]

    def group_count(self) -> int:
        """
        グループの数を返す
        """
        return len(self.groups())


def resolve():
    N, M = map(int, input().split())

    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(int, input().split())
        uf.unite(A-1, B-1)

    ans = 0
    for i in uf.groups():
        ans = max(ans, uf.size(i))
    print(ans)

if __name__ == "__main__":
    resolve()