Harryxun/stf_run huggingface dataset:
n,ave = list(map(int, input().split()))
a = list(map(int, input().split()))

dp = [Zeros(3000,n+1) for k in range(n+1)]

dp[0][0][0] = 1
for i in range(n):
    for j in range(2900):
        for k in range(n):
            dp[i+1][j+a[i]][k+1] += dp[i][j][k]
            dp[i+1][j][k] += dp[i][j][k]

            
ans = 0
for k in range(n):
    ans+= dp[-1][ave*(k+1)][k+1]
print(ans)


### FIXED CODE ###

import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ZipArray(a):
    aa = [[a[i],i]for i in range(n)]

    aa.sort(key = lambda x : x[0])
    for i in range(n):
        aa[i][0]=i+1
    aa.sort(key = lambda x : x[1])
    b=[aa[i][0] for i in range(len(a))]
    return b

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def Zeros(a):
    return [0 for i in range(a)]

def Zeros(a,b):
    if(b<=0):
        return Zeros(a)
    else:
        return [[0 for i in range(b)] for i in range(a)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
            
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

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

#################################################
#################################################
#################################################
#################################################



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

dp = [Zeros(3000,n+1) for k in range(n+1)]

dp[0][0][0] = 1
for i in range(n):
    for j in range(2900):
        for k in range(n):
            dp[i+1][j+a[i]][k+1] += dp[i][j][k]
            dp[i+1][j][k] += dp[i][j][k]

            
ans = 0
for k in range(n):
    ans+= dp[-1][ave*(k+1)][k+1]
print(ans)
def solve(c,h,w,count):
	if 0 <= h < H and 0 <= w < W:
		if type(c) is not int and c == A[h][w]:
			A[h][w] = count
			solve(c,h+1,w,count)
			solve(c,h-1,w,count)
			solve(c,h,w+1,count)
			solve(c,h,w-1,count)

while 1:
	H,W = map(int,raw_input().split())
	if H == W == 0:
		break
	A = [list(raw_input()) for i in range(H)]
	count = 0
	for h in range(H):
		for w in range(W):
			if type(A[h][w]) is not int:
				solve(A[h][w],h ,w,count)
				count += 1
	print count

### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)
def solve(h,w,count,c):
    if 0 <= h < H and 0 <= w < W and A[h][w] == c:
        A[h][w] = count
        for dh,dw in zip([1,0,-1,0],[0,1,0,-1]):
            solve(h+dh,w+dw,count,c)
while 1:
    H,W = map(int,raw_input().split())
    if H == W == 0: break
    A = [list(raw_input()) for _ in range(H)]
    count = 0
    for h in range(H):
        for w in range(W):
            if type(A[h][w]) is not int:
                solve(h,w,count,A[h][w])
                count += 1
    print count
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe)
        

### FIXED CODE ###

s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")
n = int(input())
a = list(map(int, input().strip().split()))

a.sort()

old = 0
for item in a[:-1]:
    if abs(old - a[-1]/2) <= abs(item - a[-1]/2):
        print(a[-1], old)
        break
    old = item

### FIXED CODE ###

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

if a <= x <= a+b:
    print('YES')
else:
    print('NO')
while True:
    x = int(input())
    if x == 0:
        break
    sum = 0
    for i in range(len(x)):
        sum += x[i]
    print sum

### FIXED CODE ###

while True:
    x = str(raw_input())
    if int(x) == 0:
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print sum
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    res = []
    dp = [0]*n

    def yakusuu(N):
        n = int(N**.5)+1
        res1 = []
        res2 = []
        for i in range(1, n):
            if N%i==0:
                res1.append(i)
                if N!=i**2:
                    res2.append(N//i)
        res2.reverse()
        return res1+res2

    for i in range(n-1, -1, -1):
        if (a[i]==1 and dp[i]==0) or (a[i]==0 and dp[i]==1):
            l = yakusuu(a[i])
            res.append(i+1)
            for j in l:
                dp[j] = (dp[j] + 1) % 2
        else:
            continue
    print(len(res))
    if len(res)>0:
        print(' '.join(map(str, res)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    res = []
    #dp[i]:i番目の箱に入ってるかどうか
    dp = [0]*n

    #iの倍数の箱を調べる
    for i in range(n, 0, -1):
        #調べる箱列挙
        t = 0
        for j in range(i, n+1, i):
            t += dp[j-1]
        if t%2 != a[i-1]:
            res.append(i)
            dp[i-1] = 1

    if not 1 in a:
        print(0)
    else:
        if len(res)>0:
            print(len(res))
            print(*res)
        else:
            print(-1)

if __name__ == '__main__':
    main()
n=int(input())
k=int(input())
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[k].lower()
elif k == 0:
    r=s[0:(k-1)].lower() + s[k]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k]
print(r)

### FIXED CODE ###

n, k = (int(i) for i in input().split())  
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[n-1].lower()
elif k == 1:
    r=s[0].lower() + s[1:n]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k:n]
print(r)
h,w=map(int,input().split())
D=[[0]*w for _ in range(h)]

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<=h and 0<=Y<=w:
                if S[i][j]=="." and S[X][Y]=="#":
                    D[X][Y]=D[i][j]+1
                    
ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

### FIXED CODE ###

inf=float("inf")
h,w=map(int,input().split())
D=[[inf]*w for _ in range(h)]
D[0][0]=0

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<h and 0<=Y<w:
                if S[i][j]=="." and S[X][Y]=="#":D[X][Y]=min(D[i][j]+1,D[X][Y])
                else:D[X][Y]=min(D[i][j],D[X][Y])

#import numpy as np
#print(np.array(D))
ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)
import random
from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor

# import sys
# sys.setrecursionlimit(50000)
from collections import defaultdict, deque

import collections

s = input()

if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")


### FIXED CODE ###


s = input()

if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
f=lambda:map(int,input().split())
n,m=f()
g = [[] for _ in range(m)]
for _ in range(m):
  a,b=f()
  g[a-1].append(b-1)
  g[b-1].append(a-1)
p = [0]*n
from collections import deque
q = deque([0])

while q:
  v = q.popleft()
  for c in g[v]:
    if p[c]<1:p[c]=v+1;q.append(c)
if 0 in p: print('No')
else: print('Yes',*p[1:],sep='\n')

### FIXED CODE ###

f=lambda:map(int,input().split())
n,m=f()
g=[[] for _ in range(n)]
for _ in range(m):
  a,b=f()
  g[a-1]+=[b-1]
  g[b-1]+=[a-1]
p=[0]*n
from collections import*
q=deque([0])
while q:
  v=q.popleft()
  for c in g[v]:
    if p[c]<1: p[c]=v+1; q.append(c)
if 0 in p: print('No')
else: print('Yes',*p[1:],sep='\n')
n = input()
k = input()
q = input()
a = [k-q for i in range(n)]

for i in range(q):
  b = input()
  a[b-1]++
  
for i in range(n):
  if a[i] > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n,k,q = list(map(int, input().split()))
a = [k-q for i in range(n)]

for i in range(q):
  b = int(input())
  a[b-1] += 1
  
for i in range(n):
  if a[i] > 0:
    print("Yes")
  else:
    print("No")
a = [int(input()) for i in range(4)]
print(min(a[0],a[1])+min(a[2]+a[3]))

### FIXED CODE ###

a = [int(input()) for i in range(4)]
print(min(a[0],a[1])+min(a[2],a[3]))
N=int(input())
NCount = 0
while N =>0:
    NCount+= 1
    N -=3
print(NCount-1)

### FIXED CODE ###

a=int(input())
b=input()
if 'Y' in b:
    print("Four")
else:
    print("Three")
# C
# 解説みた
a, b, c = map(int, input().split())

if 4*a*b < (c - a - b)**(1/2) and 0 < c - a - b: 
    print('Yes')
else:
    print('No')

### FIXED CODE ###

# C
# 解説みた
a, b, c = map(int, input().split())

if 4*a*b < (c - a - b)**2 and 0 < c - a - b: 
    print('Yes')
else:
    print('No')
A,B = map(int,input().split())
if A == "H" and B == "H":
    print("H")
elif A == "H" and B == "D":
    print("D")
elif A == "D" and B == "H":
    print("D")
else:
    print("H")


### FIXED CODE ###

A,B = map(str,input().split())
if A == "H" and B == "H":
    print("H")
elif A == "H" and B == "D":
    print("D")
elif A == "D" and B == "H":
    print("D")
else:
    print("H")
def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
            else:
                p = (p+1) % len(player)

    print(result)

### FIXED CODE ###

def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
                p = p % len(player)
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    if len(player) > 1:
        for pi in player[1:]:
            result += ' ' + str(pi+1)

    print(result)
N, W = map(int, input().split())

DP = [-1] * (W+1)
DP[W] = 0

def maxv(i, v):
    if i >= 0:
        if v > DP[i]:
            DP[i] = v

for w, v in (map(int, input().split()) for _ in range(N)):
    for i in range(1, W+1):
        if DP[i] >= 0:
            maxv(i-w, DP[i]+v)
            maxv(0, DP[i-w])

print(DP[0])


### FIXED CODE ###

N = int(input())
wa, wb, wc = [0] * 3
for a, b, c in (map(int, input().split()) for _ in range(N)):
  wa, wb, wc = a + max(wb, wc), b + max(wa, wc), c + max(wa, wb)
print(max(wa, wb, wc))
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

k=0
m=100000000000000
for i in range(1,n+1):
    b=a-t+h[i]*0.006
    if m>abs(b):
        m=abs(b)
        k=i


print(k)        
        

### FIXED CODE ###

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

k=0
m=100000000000000
for i in range(1,n+1):
    b=a-t+h[i-1]*0.006
    if m>abs(b):
        m=abs(b)
        k=i


print(k)
# import sys
# sys.setrecursionlimit(2000)

N = int(input())
COR = [tuple((map(int, input().split()))) for _ in range(N)]


class Group:
    
    def __init__(self):
        self.n = 0
        self.x = []
        self.y = []
        
    def new_cor_n(self):
        if self.n <= 2:
            return 0
        return len(self.x) * len(self.y) - self.n


def grouping_y(group, y, xcor, ycor):
    ycor[y][1] = True
    group.y.append(y)
    for x in ycor[y][0]:
        if xcor[x][1]:
            continue
        group.n += 1
        grouping_x(group, x, xcor, ycor)
        
def grouping_x(group, x, xcor, ycor):
    xcor[x][1] = True
    group.x.append(x)
    for y in xcor[x][0]:
        if ycor[y][1]:
            continue
        group.n += 1
        grouping_y(group, y, xcor, ycor)
    
if N <= 2:
    print(0)
else:
    xcor, ycor = {}, {}
    for xi, yi in COR:
        if xi in xcor:
            xcor[xi][0].append(yi)
        else:
            xcor[xi] = [[yi], False]
        if yi in ycor:
            ycor[yi][0].append(xi)
        else:
            ycor[yi] = [[xi], False]
    group_list = []
    for x, v in xcor.items():
        if v[1]:
            continue
        group = Group()
        group_list.append(group)
        grouping_x(group, x, xcor, ycor)
    s = 0
    for group in group_list:
        s += group.new_cor_n()
    print(s)

### FIXED CODE ###

# import sys
# sys.setrecursionlimit(20000)


N = int(input())
COR = [tuple((map(int, input().split()))) for _ in range(N)]


class Group:
    
    def __init__(self):
        self.n = 0
        self.x = 0
        self.y = 0
        self.xy = {}
        
    def new_cor_n(self):
        return self.x * self.y - self.n
        

def grouping(group, x, xcor, ycor):
    x_list = []
    group.x += 1
    for y in xcor[x][0]:
        if (x, y) not in group.xy:
            group.n += 1
            group.xy[(x, y)] = None
        if ycor[y][1]:
            continue
        ycor[y][1] = True
        group.y += 1
        for x_ in ycor[y][0]:
            if (x_, y) not in group.xy:
                group.n += 1
                group.xy[(x_, y)] = None
            if xcor[x_][1]:
                continue
            xcor[x_][1] = True
            x_list.append(x_)
    return x_list

if N <= 2:
    print(0)
else:
    xcor, ycor = {}, {}
    for xi, yi in COR:
        if xi in xcor:
            xcor[xi][0].append(yi)
        else:
            xcor[xi] = [[yi], False]
        if yi in ycor:
            ycor[yi][0].append(xi)
        else:
            ycor[yi] = [[xi], False]
    group_list = []
    for i, v in xcor.items():
        if v[1]:
            continue
        group = Group()
        group_list.append(group)
        xcor[i][1] = True
        x_list = [i]
        while True:
            new_x_list = []
            for x in x_list:
                new_x_list += grouping(group, x, xcor, ycor)
            if new_x_list == []:
                break
            x_list = new_x_list
    s = 0
    for group in group_list:
        s += group.new_cor_n()
    print(s)
import re
s = input()
t = input()

for i in range(len(s) - len(t), -1, -1):
	if re.fullmatch(s[i:i + len(t)].replace("?", "."), t):
		print((s[:i] + t + s[i+len(t)]).replace("?","a"))
		break
else:
	print("UNRESTORABLE")

### FIXED CODE ###

s = input()[::-1]
t = input()[::-1]
sl, tl = len(s), len(t)
for i in range(sl - tl + 1):
    for j in range(tl):
        if s[i + j] != "?" and s[i + j] != t[j]:
            break
    else:
        print((s[:i] + t + s[i + tl:]).replace("?", "a")[::-1])
        break
else:
    print("UNRESTORABLE")
import numpy as np


class Okojo:
    def __init__(self, line):
        self.line = line
        self.bool = np.array([], dtype=bool)
        self.get_lr()

    def get_lr(self):
        for i in range(len(self.line)):
            if self.line[i] == 'L':
                self.bool = np.append(self.bool, True)
            else:
                self.bool = np.append(self.bool, False)

    def get_l(self):
        return self.bool

    def get_r(self):
        return np.logical_not(self.bool)

    def get_next(self, state):
        l = state.copy()
        r = state.copy()
        l[self.get_r()] = 0.
        r[self.get_l()] = 0.
        l = np.roll(l, -1)
        r = np.roll(r, 1)
        return l + r


def resolve():
    line = input()

    okojo = Okojo(line)

    now = np.ones(len(line), dtype=int)
    before1 = now
    for i in range(10 ** 100):
        before2 = before1
        before1 = now
        now = okojo.get_next(before1)
        if np.all(before1 == now):
            break
        elif np.all(before2 == now):
            if i % 2 == 0:
                now = before1
            break

    li = now.tolist()
    print(*li)


resolve()

### FIXED CODE ###

def resolve():
    line = input()
    result = [0] * len(line)

    r_odd = 0
    r_even = 0
    for i in range(len(line)):
        if line[i] == 'L':
            if i % 2 == 0:
                result[i] += r_even
                result[i-1] += r_odd
            else:
                result[i] += r_odd
                result[i-1] += r_even
            r_odd = 0
            r_even = 0
        elif line[i] == 'R':
            if i % 2 == 0:
                r_even += 1
            else:
                r_odd += 1
    l_odd = 0
    l_even = 0
    for i in range(len(line)-1, -1, -1):
        if line[i] == 'R':
            if i % 2 == 0:
                result[i] += l_even
                result[i+1] += l_odd
            else:
                result[i] += l_odd
                result[i+1] += l_even
            l_odd = 0
            l_even = 0
        elif line[i] == 'L':
            if i % 2 == 0:
                l_even += 1
            else:
                l_odd += 1

    print(*result)
    
resolve()
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=[:X]
q=[:Y]
r=[:max(X,Y)]
p.sort()
q.sort()
p.reverse()
q.reverse()
 
a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
b=q[:]
b.extend(r)
b.sort()
b.reverse()
c=p[:]
c.extend(r)
c.sort()
c.reverse()
red=0
green=0
sum=0
sum1=0
sum2=0
d=0
for i in range(X+Y):
  if(a[i] in p):
    red+=1
  elif(a[i] in q):
    green+=1
  d+=a[i]
 
  if(i<X):
      sum1+=p[i]
      sum2+=c[i]
  if(i<Y):
      sum1+=b[i]
      sum2+=q[i]
    
if(red<=X and green<=Y):
  print(d)
elif(red>X):
  print(sum1)
elif(green>Y):
  print(sum2)

### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p.reverse()
q.reverse()
p=p[:X]
q=q[:Y]
 
a=p[:]
a.extend(q)
a.extend(r)
a.sort()
a.reverse()
sum=0
for i in range(X+Y):
  sum+=a[i]
print(sum)
N = int(input())
K = int(input())
l = list(map(int, input().split()))

ans = 0
for i in l:
  ans += min([K-l, l])*2
  
print(ans)

### FIXED CODE ###

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

ans = 0
for i in l:
  ans += min([K-i, i])*2
  
print(ans)
lst = []
n, m  = map(int, input().split())
for _ in range(m):
    i, h = input().split()
    lst.append([int(i), str(h)])

jdg_wa = [0] * n 
jdg_ac = [0] * n

for _ in lst:
    if _[1] == 'WA' and jdg_ac[_[0]] == 0:
        jdg_wa[_[0]] += 1
    if _[1] == 'AC' and jdg_ac[_[0]] == 0:
        jdg_ac[_[0]] = 1

print(sum(jdg_ac),sum(jdg_wa))

### FIXED CODE ###

lst = []
n, m  = map(int, input().split())
for _ in range(m):
    i, h = input().split()
    lst.append([int(i), str(h)])

jdg_wa = [0] * n 
jdg_ac = [0] * n

penalty = 0
for _ in lst:
    idx = _[0] - 1
    if  jdg_ac[idx] != 1:
        if _[1] == 'WA':
            jdg_wa[idx] += 1
        elif _[1] == 'AC':
            jdg_ac[idx] = 1
            penalty +=  jdg_wa[idx]
print(sum(jdg_ac), penalty)
n = int(input())
for _ in range(n):
    a = sum([int(input()) for _ in range(n)])
    print(a if a < 10**80 else 'overflow')

### FIXED CODE ###

for _ in range(int(input())):
    a=int(input())+int(input())
    print(a if a < 10**80 else 'overflow')
import math


def C(k, n, mod):
    return math.factorial(n) // math.factorial(n - k) // math.factorial(k) % mod


n, k = map(int, input().split())
mod = int(1e9) + 7
s = 0
for i in range(1, k + 1):
    print((C(i - 1, k - 1, mod) * C(n - k - i + 1, n - k + 1, mod))%mod)


### FIXED CODE ###

import math


def C(k, n, mod):
    return math.factorial(n) // math.factorial(n - k) // math.factorial(k) % mod


n, k = map(int, input().split())
mod = int(1e9) + 7
s = 0
for i in range(1, k + 1):
    if n + 1 - k - i >= 0:
        print((C(i - 1, k - 1, mod) * C(i, n - k + 1, mod)) % mod)
    else:
        print(0)
n,m = map(int,input().split())
par = []
for i in range(n):
    par.append(i)  #初期親
rank = [1 for i in range(n)] #初期ランク
cut = []
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
for i in range(n):
    shorten(i)
import collections
c = collections.Counter(par)
ans = 0
for i in range(n):
    ans = max(ans,c[i])
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
import sys
sys.setrecursionlimit(10**9)
rks = [None] *n
p = [set([]) for i in range(n)]
flist = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    flist[a-1].append(b-1)
    flist[b-1].append(a-1)
def dfs(graph,w,c):
    if rks[w] is None:
        rks[w] = 0
    for i in range(len(graph[w])):
        if rks[graph[w][i]] is not None:
            continue
        p[c].add(flist[w][i])
        dfs(graph, graph[w][i],c)
c = -1
for w in range(n):
    c += 1
    if rks[w] is None:
        dfs(flist,w,c)
ans = 0
for i in range(n):
    ans = max(ans,len(p[i])+1)
print(ans)
n=input()
n=str(n)
t='nd'
for i in n;
	if i=='7':
    	print('Yes')
      	t='d'
if t=='nd':print('No')        

### FIXED CODE ###

n=input()
n=str(n)
t='nd'
for i in n:
    if i=='7':
        print('Yes')
        t='d'
        break
if t=='nd':print('No')
n = input()
w = [int(i) for i in input().split()]

s = sum(w)
ss = 0
ll = []

for i in w:
  ss += i
  rest = s - ss
  ll.append(abs(ss - rest))
  
return(min(ll))

### FIXED CODE ###

n = input()
w = [int(i) for i in input().split()]

s = sum(w)
ss = 0
ll = []

for i in w:
  ss += i
  rest = s - ss
  ll.append(abs(ss - rest))
  
print(min(ll))
a=int(input())
b=0
c=[0]*a
for i in range(1,a+1):
  e=i
  while 1:
    i%=2
    if i%2!=0:
      c[e]=b
      break
    b+=1
print(max(c))
      
  


### FIXED CODE ###

a=int(input())
b=0
for i in range(7):
  if 2**i<=a:
    b=2**i
print(b)