Harryxun/stf_run huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 9)

def dfs(v, n, graph, visited):
    all_visited = 1

    for i in range(n):
        if visited[i] == 0:
            all_visited = 0
            break

    if all_visited:
        return 1

    n_paths = 0

    for i in range(0, n):
        if not graph[v][i]:
            continue
        if visited[i]:
            continue

        visited[i] = 1
        n_paths += dfs(i, n, graph, visited)
        visited[i] = 0

    return n_paths


def main():
    n, m = [int(i) for i in input().split()]
    if m == 0:
      print(0)
      return None
    graph = [[0] * m for _ in range(m)]
    for _ in range(m):
        a, b = [int(i) for i in input().split()]
        graph[a-1][b-1] = 1
        graph[b-1][a-1] = 1

    visited = [0] * n

    visited[0] = 1
    n_paths = dfs(0, n, graph, visited)
    print(n_paths)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import itertools


def main():
    n, m = [int(i) for i in input().split()]
    path_matrix = [[False] * n for _ in range(n)]
    for _ in range(m):
        a, b = [int(i) for i in input().split()]
        a -= 1
        b -= 1
        path_matrix[a][b] = True
        path_matrix[b][a] = True

    ans = 0
    for path in itertools.permutations(range(n), n):
        if path[0] != 0:
            continue
        for i in range(n):
            if i == n - 1:
                ans += 1
                break
            if not path_matrix[path[i]][path[i+1]]:
                break

    print(ans)


if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))

lcm = 1
from math import gcd
for i in range(n):
    lcm *= a[i] // gcd(a[i], lcm)

ans = 0
for i in a:
    ans += lcm // i

print(ans % (10**9+7))

### FIXED CODE ###

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

lcm = 1
from fractions import gcd
for i in range(n):
    lcm *= a[i] // gcd(a[i], lcm)

ans = 0
for i in a:
    ans += lcm // i

print(ans % (10**9+7))
#58
a,b,c=map(int,input().split())
if b-a=c-b:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

#58
a,b,c=map(int,input().split())
if b-a==c-b:
    print('YES')
else:
    print('NO')
import math
 

def f(n, base):
    X_dumy = base
    lis = []
    while X_dumy > 0:
        lis.append(X_dumy % n)
        X_dumy = X_dumy // n
    return sum(lis)
 
 
def solve():
    N, S = int(input()), int(input())
    # print(N, S)
 
    if N == S:
        return N + 1
 
    for b in range(2, int(math.sqrt(N)) + 1):
        if f(b, N) == S:
            return b
 
    largest = N**2
    lowest = largest
    for p in range(1, int(math.sqrt(N)) + 1):
        b = int((N - S) / p + 1)
        if f(b, N) == S:
            lowest = min(lowest, b)
 
    if not lowest == largest:
        return lowest
 
    return -1
 

if __name__ == '__main__':
    res = solve()
    print(res)


### FIXED CODE ###

import math


def f(base, n):
    # 10進数 n を, base 進数に変換して各桁を足し合わせる
    total = 0
    while n > 0:
        # print('除', n // base, 'あまり', n % base)
        total += n % base
        n = n // base
    return total


def solve():
    N, S = int(input()), int(input())
    # print(N, S)

    if N == S:
        return N + 1

    for b in range(2, int(math.sqrt(N)) + 1):
        if f(b, N) == S:
            return b

    largest = N**2
    lowest = largest
    for p in range(1, int(math.sqrt(N)) + 1):
        b = int((N - S) / p + 1)
        if b > 1 and f(b, N) == S:
            lowest = min(lowest, b)

    if not lowest == largest:
        return lowest

    return -1


if __name__ == '__main__':
    res = solve()
    print(res)
n = input()
v = sorted(map(int, input().split()))
vt = v[0]
vt = list(map(lambda x:(vt+x)/2, v[1:]))
for vn in v[1:]:
	vt = (vt + vn)/2
print(vt)

### FIXED CODE ###

n = input()
v = sorted(map(int, input().split()))
vt = v[0]
for vn in v[1:]:
	vt = (vt + vn)/2
print(vt)
class combination2():
    def __init__(self, n, mo=10 ** 9 + 7):
        self.fac = [0] * (n + 1)
        self.inv = [1] * (n + 1)
        self.fac[0] = 1
        self.fact(n,mo)
        for i in range(2, n + 1):
            self.inv[n] *= i
            self.inv[n] %= mo
        self.inv[n] = pow(self.inv[n], mo - 2, mo)
        for i in range(1, n):
            self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
        return

    def fact(self, n, mo):
        if self.fac[n] != 0:
            return self.fac[n]
        self.fac[n] = n * self.fact(n - 1,mo) % mo
        return self.fac[n]

    def invf(self, n):
        return self.inv[n]

    def comb(self, x, y, mo):
        if y < 0 or y > x:
            return 0
        return self.fac[x] * self.inv[x - y] * self.inv[y] % mo

def examD(mod):
    N = I()
    a = LI()
    double = []
    for s in a:
        if s in double:
            cur = s
            break
        double.append(s)
    curL = a.index(cur); curR = a[curL+1:].index(cur) + (curL+1)
    L = curL; M = curR-curL-1;  R = N - curR
#    print(curL,curR)
#    print(L,M,R)
    C = combination2(N+1,mod)
    ans = []
    ans.append(N)
    for i in range(2,N+2):
        cur = C.comb(N+1,i,mod)
        if N-1-M-(i-1)>=0:
            cur -= C.comb(N-1-M,i-1,mod)
        if cur<0:
            cur += mod
        ans.append(cur)
    for v in ans:
        print(v)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD(mod)


### FIXED CODE ###

class combination():
    #素数のmod取るときのみ　速い
    def __init__(self, n, mod):
        self.n = n
        self.fac = [1] * (n + 1)
        self.inv = [1] * (n + 1)
        for j in range(1, n + 1):
            self.fac[j] = self.fac[j - 1] * j % mod

        self.inv[n] = pow(self.fac[n], mod - 2, mod)
        for j in range(n - 1, -1, -1):
            self.inv[j] = self.inv[j + 1] * (j + 1) % mod

    def comb(self, n, r, mod):
        if r > n or n < 0 or r < 0:
            return 0
        return self.fac[n] * self.inv[n - r] * self.inv[r] % mod

def examD(mod):
    N = I()
    a = LI()
    c = Counter(a)
    db = c.most_common()[0][0]
    curL = a.index(db)
    curR = a.index(db, curL + 1)
    L = curL; M = curR-curL-1;  R = N - curR
#    print(curL,curR)
#    print(L,M,R)
    C = combination(N+1,mod)
    ans = []
    ans.append(N)
    for i in range(2,N+2):
        cur = C.comb(N+1,i,mod)
        if N-1-M-(i-1)>=0:
            cur -= C.comb(N-1-M,i-1,mod)
        if cur<0:
            cur += mod
        ans.append(cur)
    for v in ans:
        print(v)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD(mod)
n, k = map(int, input().split())

if n%k!=0:
	print(1)
else:
	pritn(0)

### FIXED CODE ###

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

if n%k!=0:
	print(1)
else:
	print(0)
n,k = map(int,input().split())
v = list(map(int,input().split()))
if n <= k:
    ans = sum(v)
    v.sort()
    count = 0
    v0 = []
    for i in range(k-n):
        if v[i] < 0:
            ans = ans - v[i]
            count = count + 1
            v0.append(v[i])
        if (k - count)%2 == 1:
            if len(v0) == 0:
                ans = ans - min(v)
            elif len(v0) > 0 and v[count] > -min(v0):
                ans = ans + min(v0)
            elif len(v0) > 0 and v[count] <= -min(v0):
                ans = ans - v[count]
else:
    ansl = []
    for x in range(k+1):
        v0 = []
        v1 = v[0:x]
        v2 = v[n-(k-x):n]
        v3 = sorted(v1)
        v4 = sorted(v2)
        p = 0
        r = 0
        if len(v3) > 0:
            while v3[p] < 0 and len(v1) > 0:
                if v3[p] + v1[-1] < 0:
                    v1.remove(v3[p])
                    del v3[p]
                    if len(v1) > 0:
                        del v1[-1]
                else:
                    p = p + 1
                if p == x-1:
                    break
        if len(v4) > 0:
            while v4[r] < 0 and len(v2) > 0:
                if v4[r] + v2[0] < 0:
                    v2.remove(v4[r])
                    del v4[r]
                    if len(v2) > 0:
                        del v2[0]
                else:
                    r = r + 1
                if r == k - x-1:
                    break
        ansl.append(sum(v1)+sum(v2))
    ans = max(ansl)
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
v = list(map(int,input().split()))
ansl = []
for i in range(min(k+1,n+1)):
    for j in range(i+1):
        v1 = v[0:j]
        v2 = v[n-(i-j):n]    
        v1.extend(v2)
        v1.sort()
        for x in range(k-i):
            if len(v1) != 0 and v1[0] < 0:
                del v1[0]
            else:
                break
        if len(v1) != 0:
            ansl.append(sum(v1))
        else:
            ansl.append(0)
ans = max(ansl)
print(ans)
def solve(n,k,ar):

    dp = [0]*n
    dp[0] = 0

    for i in range(1, n):
        for j in range(max(0, i - k), i):
            dp[i] = min(dp[j] + abs(ar[i] - ar[j]))

    print(dp[n-1])



if __name__ == '__main__':
    n,k = map(int,input().split())
    ar = list(map(int,input().split()))

    solve(n,k,ar)

### FIXED CODE ###

import sys

def solve(n,k,ar):

    dp = [sys.maxsize]*n
    dp[0] = 0

    for i in range(n):
        for k in range(1,k+1):
            if i+k <= n-1:
                dp[i+k] = min(dp[i+k], dp[i] + abs(ar[i]-ar[i+k]))

    print(dp[n-1])



if __name__ == '__main__':
    n,k = map(int,input().split())
    ar = list(map(int,input().split()))

    solve(n,k,ar)
a = []
for i in range(5):
    a.append(int(input()))
k = input()

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")


### FIXED CODE ###

a = []
for i in range(5):
    a.append(int(input()))
k = int(input())

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")
S = str(input())
remainderDictionary = {}
    
sum = 0
x = 1
for i in S:
  sum += int(i) * x
  remainder = sum % 2019
  remainderDictionary[remainder] += remainderDictionary.get(remainder,0) + 1
  x = (x * 10) % 2019
     
ans = 0
for i in remainderDictionary:
  value = remainderDictionary[i]
  ans += value * (value - 1) // 2 # N C 2
print(ans)

### FIXED CODE ###

number = str(input())[::-1]
remainderDictionary = {0: 1}
    
sum = 0
x = 1
for i in number:
  x = (x * 10) % 2019
  sum += int(i) * x
  sum %= 2019
  remainderValue = remainderDictionary.get(sum,0) + 1
  remainderDictionary[sum] = remainderValue
     
ans = 0
for i in remainderDictionary:
  value = remainderDictionary[i]
  ans += value * (value - 1) // 2 # N C 2
print(ans)
n=input()
a=[int(i) for i in input().split(' ')]
a.sort()
print(a[N-1]-a[0])

### FIXED CODE ###

n=input()
a=[int(i) for i in input().split(' ')]
a.sort()
print(a[-1]-a[0])
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))

cnt = 0

for i in range(len(a)):
    A = a[i]
    j = 0
    while j < len(b):
        if A < b[j]:
            cnt += 1
            j += 1
            k = 0
            while k < len(c):
                if b[j] > c[k]:
                    cnt += 1
                    k += 1
        else:
            break
print(cnt)

### FIXED CODE ###

from bisect import *

n = int(input())
a,b,c = [sorted(map(int,input().split())) for i in range(3)]

print(sum([bisect_left(a,i)*(n-bisect_right(c,i)) for i in b]))
print('YES' if input().split().sort()==['1','4','7','9'])

### FIXED CODE ###

print('YES' if sorted(input().split())==['1','4','7','9'] else 'NO')
if a >= 3200:
    print(s)
elif a < 3200:
    print('red')

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)
elif a < 3200:
    print('red')
a, b = (int(i) for i in input().split()) 
print((c-1)*(d-1))

### FIXED CODE ###

a, b = (int(i) for i in input().split()) 
print((a-1)*(b-1))
from itertools import accumulate

N, K = map(int, input().split())
Ss = list(map(int, input()))

consecutive01s = [[], [0]]
turn = 0
num = 0
for S in Ss+[9]:
    if S == turn:
        num += 1
    else:
        consecutive01s[turn].append(num)
        turn = 1-turn
        num = 1
if turn == 0:
    consecutive01s[0].append(0)
consecutive01s[1].append(0)

N0, N1 = len(consecutive01s[0]), len(consecutive01s[1])

acc0s = list(accumulate([0]+consecutive01s[0]))
acc1s = list(accumulate([0]+consecutive01s[1]))

len0s = [acc0s[i+K]-acc0s[i] for i in range(N0-K+1)]
len1s = [acc1s[i+K+1]-acc1s[i] for i in range(N1-K)]

ans = max([len0+len1 for len0, len1 in zip(len0s, len1s)])
print(ans)


### FIXED CODE ###

from itertools import accumulate

N, K = map(int, input().split())
Ss = list(map(int, input()))

consecutive01s = [[], [0]]
turn = 0
num = 0
for S in Ss+[9]:
    if S == turn:
        num += 1
    else:
        consecutive01s[turn].append(num)
        turn = 1-turn
        num = 1
if turn == 0:
    consecutive01s[0].append(0)
consecutive01s[1].append(0)

N0, N1 = len(consecutive01s[0]), len(consecutive01s[1])
K = min(K, N0)

acc0s = list(accumulate([0]+consecutive01s[0]))
acc1s = list(accumulate([0]+consecutive01s[1]))

len0s = [acc0s[i+K]-acc0s[i] for i in range(N0-K+1)]
len1s = [acc1s[i+K+1]-acc1s[i] for i in range(N1-K)]

ans = max([len0+len1 for len0, len1 in zip(len0s, len1s)])
print(ans)
n = input()
R = []
for i in xrange(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1)
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] 
print maxv   

### FIXED CODE ###

n = input()
R = []
for i in range(0, n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   elif maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv
#!/usr/bin/env python
# coding: utf-8

import math


def main():
    x1, y1, x2, y2 = [int(i) for i in raw_input().split(" ")]
    if x1 < x2:
        x1, x2 = x2, x1
    w = x1 - x2
    if y1 < y2:
        y1, y2 = y2, y1
    h = y1 - y2
    print math.sqrt(w ** 2 + h ** 2)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

import math


def main():
    x1, y1, x2, y2 = [float(i) for i in raw_input().split(" ")]
    if x1 < x2:
        x1, x2 = x2, x1
    w = x1 - x2
    if y1 < y2:
        y1, y2 = y2, y1
    h = y1 - y2
    print "%1.8f" % math.sqrt(w ** 2 + h ** 2)

if __name__ == '__main__':
    main()
n = int(input())

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

list = [0] + list + [0]

total = 0

# まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

# 最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i-1] - list[i]) - abs(list[i] - list[i+1]) + abs(list[i-1] + list[i+1]))
    　

### FIXED CODE ###

n = int(input())

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

list = [0] + list + [0]

total = 0

#まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

#最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i] - list[i-1]) - abs(list[i+1] - list[i]) + abs(list[i+1] - list[i-1]))
N = int(input())
a = []
for i in range(N):
    a.append(map(int, input().split()))



for i in range(N):
    v = a[i]
    j = i-1
    while j>=0 and a[j]>v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    print(a) 


### FIXED CODE ###

N = int(input())
a = input().split()
b = [int(n) for n in a]


for i in range(N):
    v = b[i]
    j = i-1
    while j>=0 and b[j]>v:
        b[j+1] = b[j]
        j = j-1
        b[j+1] = v
    print(" ".join([str(n) for n in b]))
D = int(input())
T = int(input())
S = int(input())
if D / S <= T:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

D, T, S = map(int, input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n])

### FIXED CODE ###

n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n-1])
import math
n = int(input())
x = [int(i) for i in input().split()]
s = math.gcd(x[0],x[1])
for i in x:
    s = math.gcd(s,i)

print(s)

### FIXED CODE ###

import math
n = int(input())
l = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
s = gcd(l[0],l[1])
for i in l:
    s = gcd(s,i)
   

print(s)
import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

uf = UnionFind(N)

for i in range(M):
    node1, node2 = map(int, input().split())
    uf.union(node1 - 1, node2 - 1)

cnt = 0
for i in range(N):
    if uf.same(i, P[i]):
        cnt += 1
print(cnt)


### FIXED CODE ###

import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

uf = UnionFind(N)

for i in range(M):
    node1, node2 = map(int, input().split())
    uf.union(node1 - 1, node2 - 1)

cnt = 0
for i in range(N):
    if uf.same(i, P[i] - 1):
        cnt += 1
print(cnt)
r,d,x0=map(int,input().split())
for i in range(10):
  x0=xo*r-d
  print (x0)

### FIXED CODE ###

r,d,x0=map(int,input().split())
for i in range(10):
  x0=x0*r-d
  print (x0)
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

          def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

def main():
    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)
    roots = uf.roots()
    cnt = []
    for r in roots:
        cnt.append(uf.size(r))
    print(max(cnt))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

def main():
    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)
    roots = uf.roots()
    cnt = []
    for r in roots:
        cnt.append(uf.size(r))
    print(max(cnt))

if __name__ == '__main__':
    main()
X,A,B=map(int, input().split())
if A>=B:
  print('delicious')
elif A+X>=N:
  print('safe')
else:
  print('dangerous')

### FIXED CODE ###

X,A,B=map(int, input().split())
if A>=B:
  print('delicious')
elif A+X>=B:
  print('safe')
else:
  print('dangerous')
for i in range(3): l[i] = [int(i) for i in input().split()]
print(l[0][0] + l[1][1] + l[2][2])

### FIXED CODE ###

s = ''
for i in range(3): s += input()[i]
print(s)
n,m=map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
t = [a.pop(0)//2]

for i in range(0,m - 1):
  l = t.index(max(t))
  if a[0] > t[l]:
    t.append(a.pop(0)//2)
  else:
    t[l] = t[l]//2
print(sum(t) + sum(a))



### FIXED CODE ###

import heapq
import math
n,m=map(int,input().split())
a = list(map(int,input().split()))
h = []
for _a in a:
  heapq.heappush(h,-_a)
for i in range(m):
  heapq.heappush(h,math.ceil(heapq.heappop(h) / 2))
print(sum(h)*(-1))
n = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(n-1, 1, -1):
    for j in range(i-1, 0, -1):
        ans += j - bisect.bisect_right(L[:j], L[i]-L[j])

print(ans)

### FIXED CODE ###

import bisect

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

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(L, L[i]+L[j]) - (j+1)

print(ans)