Harryxun/stf_run huggingface dataset:
H,W,D=map(int,input().split())
A=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for i in range(H):
    Ai=list(map(int,input().split()))
    for j in range(W):

        A[Ai[j]%D][Ai[j]//D]=(i,j)
A[0][0]=(0,0)
B=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for j in range(D):
    for i in range(len(A[0])-1):
        if type(A[j][i+1])!=type((0,0)):
            B[j][i+1]=B[j][i]
            continue
        B[j][i+1]=B[j][i]+abs(A[j][i][0]-A[j][i+1][0])+abs(A[j][i][1]-A[j][i+1][1])
Q=int(input())
for _ in range(Q):
    L,R=map(int,input().split())
    print(B[R%D][R//D]-B[L%D][L//D])


### FIXED CODE ###

from math import ceil
H,W,D=map(int,input().split())
A=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for i in range(H):
    Ai=list(map(int,input().split()))
    for j in range(W):
        A[(Ai[j]-1)%D][(Ai[j]-1)//D]=(i,j)
B=[[0]*(int(ceil(H*W/D))+1) for i in range(D)]
for j in range(D):
    for i in range(len(A[j])):
        if  type(A[j][i])!=type((0,0)):
            #B[j][i+1]=B[j][i]
            break
        if i==0:
            B[j][i+1]=A[j][i][0]+A[j][i][1]
            continue
        B[j][i+1]=B[j][i]+abs(A[j][i-1][0]-A[j][i][0])+abs(A[j][i-1][1]-A[j][i][1])
Q=int(input())
for _ in range(Q):
    L,R=map(int,input().split())
    L,R=L-1,R-1
    print(B[R%D][R//D+1]-B[L%D][L//D+1])
from collections import Counter
s = list(input())
x, y = map(int, input().split())
cs = Counter(s)

ss = []
idx = 0
cnt = 0
while idx < len(s):
    if s[idx] == 'F':
        cnt += 1
    else:
        if cnt != 0:
            ss += [cnt]
        ss += [0]
        cnt = 0

    idx += 1

    if idx == len(s):
        if cnt != 0:
            ss += [cnt]

p = [[], []]
now = 0

for i in ss:
    if i == 0:
        now = abs(1-now)
    else:
        p[now] += [i]

s1 = p[0]
s2 = p[1]

if len(s1) == 0 and len(s2) == 0:
    if x == 0 and y == 0:
        print('Yes')
    else:
        print('No')
    exit()

if len(s1) > 0:
    dp = [[0]*(2*max(2*x, sum(s1))+1) for _ in range(len(s1)+1)]
    zero = sum(s1)
    dp[0][zero] = 1
    sum_s1 = sum(s1)
    for i in range(len(s1)):
        m = s1[i]
        for j in range(sum_s1+1):
            if zero+j+m < 2*sum_s1 and zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m] | dp[i][zero+j+m]
            elif zero+j+m < 2*sum_s1:
                dp[i+1][zero+j] = dp[i][zero+j+m]
            elif zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m]

            if zero-j+m < 2*sum_s1 and zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m] | dp[i][zero-j+m]
            elif zero-j+m < 2*sum_s1:
                dp[i+1][zero-j] = dp[i][zero-j+m]
            elif zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m]

    if dp[-1][x+zero] == 0:
        print('No')
        exit()
else:
    if x != 0:
        print('No')
        exit()

if len(s2) > 0:
    dp = [[0]*(2*max(2*y, sum(s2))+1) for _ in range(len(s2)+1)]
    zero = sum(s2)
    dp[0][zero] = 1
    sum_s2 = sum(s2)
    for i in range(len(s2)):
        m = s2[i]
        for j in range(sum_s2+1):
            if zero+j+m < 2*sum_s2 and zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m] | dp[i][zero+j+m]
            elif zero+j+m < 2*sum_s2:
                dp[i+1][zero+j] = dp[i][zero+j+m]
            elif zero+j-m > 0:
                dp[i+1][zero+j] = dp[i][zero+j-m]

            if zero-j+m < 2*sum_s2 and zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m] | dp[i][zero-j+m]
            elif zero-j+m < 2*sum_s2:
                dp[i+1][zero-j] = dp[i][zero-j+m]
            elif zero-j-m > 0:
                dp[i+1][zero-j] = dp[i][zero-j-m]
    if dp[-1][y+zero] == 0:
        print('No')
        exit()
else:
    if y != 0:
        print('No')
        exit()
print('Yes')

### FIXED CODE ###

s = input()
x, y = map(int, input().split())
d = [len(i) for i in s.split('T')]
 
s1 = d[2::2]
s2 = d[1::2]
 
now_x = [0]
now_y = [0]

x -= d[0]

for i in s1:
    nx = set()
    for j in now_x:
        nx.add(j-i)
        nx.add(j+i)
    now_x = nx

for i in s2:
    ny = set()
    for j in now_y:
        ny.add(j-i)
        ny.add(j+i)
    now_y = ny

if x in now_x and y in now_y:
    print('Yes')
else:
    print('No')
k,s = map(int,input().split())
cnt = 0
 
for x in range(k+1):
  for y in range(k+1):
      if x + y <= s and x + y >= s - k 
        cnt += 1
print(cnt)

### FIXED CODE ###

k,s = map(int,input().split())
cnt = 0
 
for x in range(k+1):
  for y in range(k+1):
      if x + y <= s and x + y >= s - k:
        cnt += 1
print(cnt)
N = int(input())
S = [int(input()) for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

### FIXED CODE ###

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

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)
from collections import deque

def bfs(que,d): #幅優先探索
  #入力のグラフを初期化
  #d = [[float("inf")] * w for i in range(h)] 
  #d == mazeリストの"."を"inf"に変えたリスト
  lead = 0
  dx = [-1,0,0,1]
  dy = [0,-1,1,0]
  
  #que = deque([])
  #que.append((sx,sy))
  #d[sx][sy] = 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[nx][ny]==float("inf"):
        d[nx][ny] = lead + 1
        que.append((nx,ny))
  return lead

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

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)
N = int(input())
arr = list(map(int, input().split()))

ans = arr[0]+arr[N-1]
for i in range(1,N-1,1):
   ans += min(arr[i],arr[i-1])
   
print(ans)


### FIXED CODE ###

n = int(input()) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
summ = b[0] #waiting_for_pudging

for i in range(1, len(b)): #pudging
    summ += min(b[i-1], b[i]) #pudging
print(summ + b[-1]) #pugding
#accepted
import math as m
a,b,c = map(int,input().split())
if (c - a - b)**2 < 10**9:
	print("Yes" if 4*a*b < (c - a - b)**2 else "No")
else:
	print("Yes" if m.log(4*a*b) < 2*m.log((c - a - b)) else "No")



### FIXED CODE ###

import math as m
a,b,c = map(int,input().split())
print("Yes" if 4*(a*b) < (c - a - b)**2 and c-a-b > 0 else "No")
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,C = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]

T_MAX = 2*(10**5)+1

time = [0]*(T_MAX)
for l in L:
    time[l[0]*2-1] += 1
    time[l[1]*2+1] -= 1

ans = 0
tmp = 0
for t in time:
    tmp += t
    ans = max(ans, tmp)

print(ans)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,C = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]

T_MAX = 10**5
time = [[0]*C for i in range(T_MAX)]

for s,t,c in L:
    time[s-1][c-1] += 1
    time[t-1][c-1] -= 1
 
ans = 0
tmp = 0
for i in range(T_MAX):
    tmp += time[i].count(1)
    ans = max(ans,tmp)
    tmp -= time[i].count(-1)

print(ans)
import sys
input = sys.stdin.readline
import math


def read():
    N = int(input().strip())
    X = input().strip()
    return N, X


def bitdiv(N:int, X:str, d:int):
    q = 0
    for i in range(N):
        q <<= 1
        q |= int(X[i])
        p, q = divmod(q, d)
    return q


def solve(N, X):
    BP = [0 for i in range(N)]
    BM = [0 for i in range(N)]

    c = X.count("1")
    

    # 2^k mod (c+1) を高速に求める
    qp = bitdiv(N, X, c+1)
    BP[N-1] = 1 % (c+1)
    for i in range(N-2, -1, -1):
        BP[i] = (BP[i+1] * 2) % (c+1)
    
    # 2^k mod (c-1) を高速に求める
    qm = bitdiv(N, X, c-1)
    if c > 1:
        BM[N-1] = 1 % (c-1)
        for i in range(N-2, -1, -1):
            BM[i] = (BM[i+1] * 2) % (c-1)

    for i in range(N):
        q = 0
        ans = 0
        if X[i] == "0":
            # X_i \equiv (X + 2^i)
            q = (qp + BP[i]) % (c+1)
            ans += 1
        elif X[i] == "1" and c > 1:
            # X_i \equiv (X - 2^i)
            q = (qm - BM[i]) % (c-1)
            ans += 1
        else:
            q = 0
            ans = 0
        while q > 0:
            q %= (bin(q).count("1"))
            ans += 1
        print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
import math


def read():
    N = int(input().strip())
    X = input().strip()
    return N, X


def bitdiv(N:int, X:str, d:int):
    q = 0
    for i in range(N):
        q <<= 1
        q |= int(X[i])
        p, q = divmod(q, d)
    return q


def solve(N, X):
    BP = [0 for i in range(N)]
    BM = [0 for i in range(N)]

    c = X.count("1")
    

    # 2^k mod (c+1) を高速に求める
    qp = bitdiv(N, X, c+1)
    BP[N-1] = 1 % (c+1)
    for i in range(N-2, -1, -1):
        BP[i] = (BP[i+1] * 2) % (c+1)
    
    # 2^k mod (c-1) を高速に求める
    if c > 1:
        qm = bitdiv(N, X, c-1)
        BM[N-1] = 1 % (c-1)
        for i in range(N-2, -1, -1):
            BM[i] = (BM[i+1] * 2) % (c-1)

    for i in range(N):
        q = 0
        ans = 0
        if X[i] == "0":
            # X_i \equiv (X + 2^i)
            q = (qp + BP[i]) % (c+1)
            ans += 1
        elif X[i] == "1" and c > 1:
            # X_i \equiv (X - 2^i)
            q = (qm - BM[i]) % (c-1)
            ans += 1
        else:
            q = 0
            ans = 0
        while q > 0:
            q %= (bin(q).count("1"))
            ans += 1
        print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
def main():
    N, P = map(int, input().split())
    *A, = map(int, input().split())

    editorial(N, P, A)

def editorial(N, P, A):
    odds = [a for a in A if a % 2 == 1]
    odd = len(odds)
    even = N - odd

    if odd == 0:
        if P = 1:
            print(0)
        else:
            print(2 ** N)
        return
    
    # ある奇数袋を取り除いて、残りでの組み合わせ(選ぶ選ばないの2通りがN-1)
    ans = 2 ** (N - 1)
    # s = 組み合わせのビスケット枚数
    # P=0,s:奇数であるとき、加えるのは1通り
    # P=0,s:奇数でないとき、加えないのは1通り
    # P=1,s:奇数であるとき、加えないのは１通り
    # P=1,s:奇数でないとき、加えるのは1通り
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, P = map(int, input().split())
    *A, = map(int, input().split())

    odd = sum(a % 2 for a in A)
    even = N - odd
    o, e = 0, 0
    # 奇数枚の袋の選び方
    # P=0: 奇数個含まれる袋から足して２の倍数になる袋の組合せ(袋0でもよい)
    # P=1: 奇数なので奇数枚の袋を奇数個
    for i in range(P, odd+1, 2):
        o += ncr(odd, i)

    for i in range(even+1):
        e += ncr(even, i)
    ans = o * e

    print(ans)


def _factorial(n):
    if n < 0:
        raise ValueError("factorial() not defined for negative values")
    a = 1
    for i in range(1, n + 1):
        a *= i
    return a


def npr(n, r):
    if n < r:
        return 0
    a = 1
    for i in range(r):
        a *= n - i
    return a


def ncr(n, r):
    _npr = npr(n, r)
    if _npr == 0:
        return 0
    return _npr // _factorial(r)


if __name__ == '__main__':
    main()
n = input()
t = sum(map(int,n))

if (t // n) == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
t = sum(map(int,n))

if (int(n)%t) == 0:
    print('Yes')
else:
    print('No')
#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):s
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(c-cnt) + " " + str(c))

### FIXED CODE ###

#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(max([1,c-cnt])) + " " + str(c))
inf = float('inf')

# 計算量O(VE) V:頂点数, E:辺の数
# True - >正常に更新, False -> startからendまでの経路において負閉路有り
def bellmanford(start, end):
    global dist
    dist = [inf] * N
    dist[start] = 0
    # 頂点数Nなら更新は高々N-1回で済む
    for _ in range(N-1):
        for v ,nv, w in edges:
            if dist[nv] > dist[v] + w:
                dist[nv] = dist[v] + w
    # 負閉路の検出部分
    # N回目で更新があった場合、負閉路を含む
    for v, nv, w in edges:
        if dist[nv] > dist[v] + w:
            return False
    return True

# 頂点vが1を始点にNにたどり着けるならばTrueを返す
def dfs(v):
    visited[v] = True
    res = False
    if v == N-1:
        res = True
        bit[v] = res
        return res
    for nv, w in ad[v]:
        if not visited[nv]:
            res |= dfs(nv)
    bit[v] = res
    return res

N, M, P = map(int,input().split())
ad = [[] for _ in range(N)]
edges = []
for _ in range(M):
    A, B, C = map(int,input().split())
    A -= 1
    B -= 1
    ad[A].append((B, C))
    edges.append((A, B, -C+P))

visited = [False] * N
bit = [False] * N
dfs(0)
# 頂点1から頂点Nのパスに含まれない頂点を削除
edges = [(v, nv, w) for v, nv, w in edges if bit[v] and bit[nv]]

flag = bellmanford(0,N-1)
ans = max(-dist[N-1],0) if flag else -1
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**4)

inf = float('inf')

# 計算量O(VE) V:頂点数, E:辺の数
# True - >正常に更新, False -> startからendまでの経路において負閉路有り
def bellmanford(start, end):
    global dist
    dist = [inf] * N
    dist[start] = 0
    # 頂点数Nなら更新は高々N-1回で済む
    for _ in range(N-1):
        for v ,nv, w in edges:
            if dist[nv] > dist[v] + w:
                dist[nv] = dist[v] + w
    # 負閉路の検出部分
    # N回目で更新があった場合、負閉路を含む
    for v, nv, w in edges:
        if dist[nv] > dist[v] + w:
            return False
    return True

def dfs(v, ad):
    visited[v] = True
    for nv in ad[v]:
        if not visited[nv]:
            dfs(nv, ad)

N, M, P = map(int,input().split())
to = [[] for _ in range(N)]
fr = [[] for _ in range(N)]
edges = []
for _ in range(M):
    A, B, C = map(int,input().split())
    A -= 1
    B -= 1
    C -= P
    C *= -1
    to[A].append(B)
    fr[B].append(A)
    edges.append((A, B, C))

visited = [False] * N

dfs(0, to)
tmp = visited[:]
visited = [False] * N
dfs(N-1, fr)
visited = [a and b for a, b in zip(tmp, visited)]
edges = [(v, nv, w) for v, nv, w in edges if visited[v] and visited[nv]]

flag = bellmanford(0, N-1)
ans = max(-dist[N-1], 0) if flag else -1
print(ans)
import math
input_line = list(map(int,input().split(' ')))

ans = input_line[0] * input_line[1] // math.gcd(input_line[0], input_line[1])
print(ans)


### FIXED CODE ###

import fractions as math
input_line = list(map(int,input().split(' ')))

ans = input_line[0] * input_line[1] // math.gcd(input_line[0], input_line[1])
print(ans)
import sys
data = 'abcdefghijklmnopqrstuvwxyz'
for line in sys.stdin:
    sentence += line.lower()
for i in data:
    print(i + ' : ' + str(sentence.count(i)))

### FIXED CODE ###

import sys
sentence = ''
data = 'abcdefghijklmnopqrstuvwxyz'
for line in sys.stdin:
    sentence += line.lower()
for i in data:
    print(i + ' : ' + str(sentence.count(i)))
N = int(input())
f = 0
a = N//100
b = (N-a*100)//10
c = N-a*100-b*10
if a == 7 or b == 7 or c == 7:
    f = 1
if f == 1:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

N = int(input())
f = 0
a = N//100
b = (N-a*100)//10
c = N-a*100-b*10
if a == 7 or b == 7 or c == 7:
    f = 1
if f == 1:
    print('Yes')
else:
    print('No')
def mh(a,b,c,d):
    return abs(a-c)+abs(b-d)

n,m = map(int,input().split())
stu = []
for i in range(n):
    a,b = map(int,input().split())
    stu.append([a,b])
ans = [[99,1000000000] for i in range(m)]
#ans[1][1] = 0
#print(ans)
for j in range(1,m+1):
    x,y = map(int,input().split())
    for i in range(n):
        tmp = mh(stu[i][0],stu[i][1],x,y)
        if tmp < ans[i][1]:
            ans[i][0] = j
            ans[i][1] = tmp
for i in range(n):
    print(ans[i][0])


### FIXED CODE ###

def f(gx,gy):
    ans = 10**9
    no = 0
    for i in range(m):
        tmp = abs(gx-checkpoint[i][0]) + abs(gy-checkpoint[i][1])
        if tmp < ans:
            ans = tmp
            no = i
    return no+1

n,m = map(int,input().split())
gakusei = []
for i in range(n):
    x,y = map(int,input().split())
    gakusei.append([x,y])
checkpoint = []
for j in range(m):
    x,y = map(int,input().split())
    checkpoint.append([x,y])

#print(gakusei,checkpoint)
for i in range(n):
    print(f(gakusei[i][0],gakusei[i][1]))
N, Q = map(int, input().split())

tree = [set([i]) for i in range(N)]
points = [0] * N

for i in range(1, N):
  a, b = map(int, input().split())
  # print(a, b)
  tree[a].add(b)
  for j in range(i):
    if a in tree[j]:
      # print(j)
      tree[j].add(b)
      
for i in range(Q):
  p, x = map(int, input().split())
  for node in tree[p]:
    points[node-1] += x

# print(tree)

for point in points:
  print(point, end=" ")

### FIXED CODE ###

n,q = map(int,input().split())
rl = [0] * n
scores = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a-1
for j in range(q):
    p,x = map(int,input().split())
    scores[p-1] += x
for k in range(1,n):
    scores[k] += scores[rl[k]]
print(*scores)
import random
import sys

sys.setrecursionlimit(100000)

n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()

for i in range(m):
    a, b = map(int, input().split())
    # a, b = random.sample(range(1,n+1), 2)
    if group[a]==0 and group[b] == 0:
        g_num += 1
        group[a] = g_num
        group[b] = g_num
        g_mem[g_num] = 2
    elif group[a] == 0:
        group[a] = group[b]
        g_mem[group[b]] += 1
    elif group[b] == 0:
        group[b] = group[a]
        g_mem[group[a]] += 1
    elif group[a] != group[b]:
        if edge.get(group[a]):
            edge[group[a]].add(group[b])
        else:
            edge[group[a]] = {group[b]}
        if edge.get(group[b]):
            edge[group[b]].add(group[a])
        else:
            edge[group[b]] = {group[a]}

# print(g_mem)
# print(sum(g_mem.values()))
# print(edge)

g_reached = {i: 0 for i in range(1, g_num+1)}

def dps(g_mem, edge, now):
    count = g_mem[now]
    if edge.get(now):
        for e in edge[now]:
            if g_reached[e] == 0:
                g_reached[e] = 1
                count += g_mem[e]
                for ee in edge[e]:
                    if g_reached[ee] == 0:
                        g_reached[ee] = 1
                        count += dps(g_mem, edge, ee)
    return count


ans = []
for now in range(1, g_num+1):
    if g_reached[now] == 0:
        g_reached[now] = 1
        ans.append(dps(g_mem, edge, now))

# print(ans)
print(max(ans))


### FIXED CODE ###

import random
import sys

n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()

for i in range(m):
    a, b = map(int, input().split())
    # a, b = random.sample(range(1,n+1), 2)
    if group[a]==0 and group[b] == 0:
        g_num += 1
        group[a] = g_num
        group[b] = g_num
        g_mem[g_num] = 2
    elif group[a] == 0:
        group[a] = group[b]
        g_mem[group[b]] += 1
    elif group[b] == 0:
        group[b] = group[a]
        g_mem[group[a]] += 1
    elif group[a] != group[b]:
        if edge.get(group[a]):
            edge[group[a]].add(group[b])
        else:
            edge[group[a]] = {group[b]}
        if edge.get(group[b]):
            edge[group[b]].add(group[a])
        else:
            edge[group[b]] = {group[a]}

# print(g_mem)
# print(sum(g_mem.values()))
# print(edge)

g_reached = {i: 0 for i in range(1, g_num+1)}
ans = list(g_mem.values())
for now in range(1, g_num+1):
    if g_reached[now] == 0:
        g_reached[now] = 1
        if edge.get(now):
            count = g_mem[now]
            queue = set(edge[now])
            while len(queue) > 0:
                next_now = queue.pop()
                if g_reached[next_now] == 0:
                    g_reached[next_now] = 1
                    count += g_mem[next_now]
                    queue |= edge[next_now]
                queue -= {now}
                now = next_now
            ans.append(count)


# print(ans)
if len(ans) > 0:
    print(max(ans))
else:
    print(1)
a,b = map(int,input().split())
ans = 0
for i in range():
  if a*(i+1) <= b:
    ans += 1
  else:
    quit()
print(ans)


### FIXED CODE ###

x,y = map(int, input().split())
cnt = 1
while x*2 ** cnt <= y:
    cnt += 1
print(cnt)
from collections import deque
n,m=map(int,input().split())
road=[[] for i i range(n)]
flag=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)
count=0
for i in range(n):
    if flag[i]!=0:
        continue
    count+=1
    q=[k]
    while q:
        p=q.popleft()
        for z in road[p]:
            if flag[z]==0:
                q.append(z)
print(count-1)

### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
road=[[] for i in range(n)]
flag=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)
count=0
for i in range(n):
    if flag[i]!=0:
        continue
    count+=1
    q=deque([i])
    while q:
        p=q.popleft()
        flag[p]=1
        for z in road[p]:
            if flag[z]==0:
                q.append(z)
print(count-1)
N ,X = map(int, input().split())
difs = list(map(int, input().split()))
steps = [0]
for i in range(N):
    steps.append(steps[i] + difs[i])
for i in range(N+1):
    if steps[i] > X:
        print(i)
        break
    elif i == N:
        print(N+1)

### FIXED CODE ###

X,A = map(int, input().split())
if X<A:
    print(0)
else:
    print(10)
n=int(input())
k=int(input())
x=int(input())
y=inr(input())
if n>k:
	kane=k*x+(n-k)*y
else:
	kane=k*x
print(kane)

### FIXED CODE ###

n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
	kane=k*x+(n-k)*y
else:
	kane=n*x
print(kane)
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
import numpy as np
lis = np.argsort(np.array(a))

ans=0
for i in range(n):
    if i%2 != lis[i]%2:
        ans+=1
print(ans//2)

### FIXED CODE ###

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
import numpy as np
lis = np.argsort(np.array(a))

ans=0
for i in range(n):
    if i%2 != lis[i]%2:
        ans+=1
print(ans//2)
N = int(input())
A = map(int, input().split())

L = [abs((N-1) - 2*i) for i in range(N)]

L.sort(); A.sort()

print(pow(2, (N-N%2)/2, 10**9+7) if L == A else 0)

### FIXED CODE ###

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

L = [abs((N-1) - 2*i) for i in range(N)]

L.sort(); A.sort()

print(pow(2, (N-N%2)//2, 10**9+7) if L == A else 0)