Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

s = input().split()

n = int(s[0])
m = int(s[1])

ld = {}

for i in range(m):
    t = input().split()
    if int(t[0]) in ld:
       ld[int(t[0])].add(int(t[1]))
    else:
       ld[int(t[0])] = {int(t[1])}
    if int(t[1]) in ld:
        ld[int(t[1])].add(int(t[0]))
    else:
        ld[int(t[1])] = {int(t[0])}


if sum(ld.keys()) < int(((n + 1) * n ) / 2):
    print("No")
else:
    s1 = {1}
    s2 = set()
    count = 0
    mydict = {}

    while len(ld) > 0:
        s2.clear()
        for i in ld:
            if len(s1 & ld[i]) != 0:
                #s3 = list(s1 & ld[i])
                mydict.setdefault(i,list(s1 & ld[i])[0])
                s2.add(i)
        for i in s2:
            del ld[i]
        s1 = s2.copy()

    print("Yes")
    for i in range(2,n+1):
        print(mydict[i])


### FIXED CODE ###

import collections

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

coriddorList = [set() for i in range(n+1)]
deepList = [-1 for i in range(n+1)]


for i in range(m):
    a,b = list(map(int,input().split()))
    coriddorList[a].add(b)
    coriddorList[b].add(a)

checkList = [0] * (n + 1)
ansList = [0] * (n + 1)
checkList[1] = 1
q = collections.deque()
q.appendleft(1)

while len(q) > 0:
    value = q.pop()
    for k in coriddorList[value]:
        if checkList[k] == 0:
            checkList[k] = 1
            ansList[k] = value
            q.appendleft(k)

print("Yes")
for i in range(2,n+1):
    print(ansList[i])
### BUGGY CODE ###

import heapq as h
import sys

input=sys.stdin.readline


N,M=map(int,input().split())
to=[[] for i in range(0,N)]
fr=[[] for i in range(0,N)]
for i in range(0,N+M-1):
    a,b=map(int,input().split())
    to[a-1].append(b-1)
    fr[b-1].append(a-1)

root=-1
for i in range(0,N):
    if fr[i]==[]:
        root=i
        break


parent=[-1 for i in range(0,N)]
q=[]
q.append(root)
h.heapify(q)
sub=[]
h.heapify(sub)
while q!=[]:
    while q!=[]:
        x=h.heappop(q)
        for p in to[x]:
            h.heappush(sub,p)
            parent[p]=x
        if q==[]:
            q=sub
            sub=[]
            h.heapify(sub)
            break

for i in range(0,N):
    print(parent[i]+1)


### FIXED CODE ###

import heapq as h
import sys

input=sys.stdin.readline


N,M=map(int,input().split())
to=[set([]) for i in range(0,N)]
fr=[set([]) for i in range(0,N)]
for i in range(0,N+M-1):
    a,b=map(int,input().split())
    to[a-1].add(b-1)
    fr[b-1].add(a-1)

root=-1
for i in range(0,N):
    if fr[i]==set([]):
        root=i
        break

parent=[-1 for i in range(0,N)]
visited=set([])
q=[]
q.append(root)
h.heapify(q)
sub=[]
h.heapify(sub)
while q!=[]:
    while q!=[]:
        x=h.heappop(q)
        visited.add(x)
        for p in to[x]:
            if visited>=fr[p]:
                h.heappush(sub,p)
                parent[p]=x
        if q==[]:
            q=sub
            sub=[]
            h.heapify(sub)
            break

for i in range(0,N):
    print(parent[i]+1)
### BUGGY CODE ###

import sys
import resource
sys.setrecursionlimit(10000)
n,k=map(int,input().rstrip().split())
p=list(map(int,input().rstrip().split()))
c=list(map(int,input().rstrip().split()))
def find(start,now,up,max,sum,count,flag):
    if start==now:
        flag+=1
    if start==now and flag==2:
        return [max,sum,count]
    elif count==up:
        return [max,sum,count]
    else:
        count+=1
        sum+=c[p[now-1]-1]
        if max<sum:
            max=sum
        return find(start,p[now-1],up,max,sum,count,flag)
kara=[-10000000000]
for i in range(1,n+1):
    m=find(i,i,n,c[p[i-1]-1],0,0,0)
    if m[2]>=k:
        m=find(i,i,k,c[p[i-1]-1],0,0,0)
        if m[0]>kara[0]:
            kara[0]=m[0]
    elif m[1]<=0:
        if m[0]>kara[0]:
            kara[0]=m[0]
    else:
        w=k%m[2]
        if w==0:
            w=m[2]
        spe=find(i,i,w,c[p[i-1]-1],0,0,0)[0]
        if m[1]+spe>m[0] and m[1]*(k-w)//m[2]+spe>kara[0]:
            kara[0]=m[1]*(k-w)//m[2]+spe
        elif m[1]+spe<=m[0] and m[1]*((k-w)//m[2]-1)+m[0]>kara[0]:
            kara[0]=m[1]*((k-w)//m[2]-1)+m[0]
print(kara[0])

### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
now=-100000000000
for i in range(1,n+1):
    retu=[]
    sum1=0
    sum2=0
    sum3=0
    max1=-1000000000000
    max2=-1000000000000
    flag=0
    x=i
    while(flag==0):
        x=p[x-1]
        sum1+=c[x-1]
        retu.append(c[x-1])
        if x==i:
            flag=1
    if len(retu)>=k: #操作回数が周期未満
        for j in range(k):
            sum2+=retu[j]
            if sum2>max1:
                max1=sum2
        ans=max1
    elif sum1<=0: #周期和が負
        for j in range(len(retu)):
            sum3+=retu[j]
            if sum3>max2:
                max2=sum3
        ans=max2
    else:
        w=k%len(retu)
        
        if w==0:
            w=len(retu)
        for j in range(w):
            sum2+=retu[j]
            if sum2>max1:
                max1=sum2
        for j in range(len(retu)):
            sum3+=retu[j]
            if sum3>max2:
                max2=sum3
        if max1+sum1>max2:
            ans=sum1*(k-w)//len(retu)+max1
        else:
            ans=sum1*((k-w)//len(retu)-1)+max2
    now=max(now,ans)
print(now)
### BUGGY CODE ###

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
MAX = 60

to = [[0] * (n + 1) for _ in range(MAX)]

to[0] = a

for i in range(1, MAX):
    for j in range(1, n + 1):
        to[i][j] = to[i-1][to[i-1][j]]

v = 1
for i in range(MAX - 1, -1, -1):
    num = 1 << i
    if k >= num:
        v = to[i][v]
        k -= num

print(v)


### FIXED CODE ###

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

st = set()
i = 1
li = []
while i not in st:
    st.add(i)
    li.append(i)
    i = a[i]

s = i
until_s = li.index(s)

if k < until_s:
    i = 1
    for _ in range(k):
        i = a[i]

    ans = i

else:
    k -= until_s
    loop_size = len(li) - until_s
    sim_time = k % loop_size
    i = s
    for _ in range(sim_time):
        i = a[i]

    ans = i

print(ans)
### BUGGY CODE ###

n, b, r = map(int, input().split())

num = 0
count = 0
res_b = 0
res_r = 0

for _ in range(n):
  if count % 2 == 0:
    num += b
    if num > n:
      res_b += b - (num - n)
    else:
      res_b += b
      
  else:
    num += r

  count += 1

  if num > n:
    break
  
print(res_b)

### FIXED CODE ###

n, b, r = map(int, input().split())

cnt_blk = n // (b+r)
res_b = cnt_blk*b
num = cnt_blk*(b+r) + b

if num > n:
  res_b += b - (num - n)
else:
  res_b += b
      
print(res_b)
### BUGGY CODE ###

import sys

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = [1]
n = gcd+1
for i in range(2, n):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
    if gcd < i:
        break
L = set(L)
print(len(L))

### FIXED CODE ###

import sys
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = [1]
n = int(math.sqrt(gcd))
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
if gcd>1:
    L.append(gcd)
L = set(L)
print(len(L))
### BUGGY CODE ###

def check(target_num, num_list):
    count = len([ i for i in num_list if i < target_num])
    if count == 0:
        return 1
    else:
        return 0

def solve(n, p_list):

    count = 0
    for i in range(n):
        target_num = p_list.pop()
        count += check(target_num, p_list)
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

### FIXED CODE ###

def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)
### BUGGY CODE ###

K, S = map(int, input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        for m in range(K+1):
            if (i + j + m ) == S:
                count += 1

print(count)

### FIXED CODE ###

K, S = map(int, input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        z = S - i - j
        if 0 <= z <= K:
            count += 1

print(count)
### BUGGY CODE ###

S=input()
N=len(S)
if N<4:
  print(0)
  exit(0)
M=2019
X=S
ans=0
x=[]
for l in range(N-3):
  for r in range(l+3,N):
    if int(X[l:r+1])%M==0:
      ans+=1
      x.append([l,r])
      break
def search(a,x,j):
  while j<len(x):
    if a[1]+1==x[j][0]:
      return 1+search(x[j],x,j+1)
    j+=1
  return 0
for i,a in enumerate(x):
  ans+=search(a,x,i+1)
print(ans)




### FIXED CODE ###

from collections import defaultdict
d = defaultdict(int)
S=input()
S=S[::-1]
i=1
x=0
MOD=2019
for s in S:
  x+=(int(s)*i)%MOD
  x%=MOD
  d[x]+=1
  i*=10
  i%=MOD
ans=0
for k in d.values():
  ans=ans+k*(k-1)//2
print(ans+d[0])
### BUGGY CODE ###

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

import heapq  # heapqライブラリのimport
#heapq.heapify(a)  # リストを優先度付きキューへ
#heapq.heappop(a)  # 最小値の取り出し
    #heapq.heappush(a, -2)
import copy
for unko in range(min(k,50)):

    denkyu=[]
    heapq.heapify(denkyu)
    cnt=0
    ans=[0]*n
    #print("start",a)
    for i,aa in  enumerate(a):
        if cnt==0:
            ans[i]+=1
            if aa>0:
                cnt+=1
                heapq.heappush(denkyu,i+aa+1)
        else:
            while 1:
                tmp=heapq.heappop(denkyu)
                if i<tmp:
                    heapq.heappush(denkyu, tmp)
                    break
                else:
                    cnt-=1
                if cnt==0:
                    break
            
            ans[i]+=cnt+1
            
            if aa>0:
                cnt+=1
                heapq.heappush(denkyu,i+aa+1)
        #print(aa,denkyu)
    #print(unko,ans,a)


    denkyu=[]
    heapq.heapify(denkyu)
    cnt=0
    for ii in  range(n):
        
        i=n-ii-1
        if cnt==0:
            if a[i]>0:
                cnt+=1
                heapq.heappush(denkyu,-1*(i-a[i]-1))
        else:
            while 1:
                tmp=heapq.heappop(denkyu)*(-1)
                if i>tmp:
                    heapq.heappush(denkyu, tmp*(-1))
                    break
                else:
                    cnt-=1
                if cnt==0:
                    break
  
            ans[i]+=cnt
            if a[i]>0:
                cnt+=1
                heapq.heappush(denkyu,(i-a[i]-1)*(-1))
        #print("migi",a[i],denkyu)

    a = copy.deepcopy(ans)

    #print(unko,a)


print(" ".join(list(map(str,a))))


### FIXED CODE ###

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

for _ in range(k):
    imos=[0]*(n+1)
    for i in range(n):
        imos[max(0,i-a[i])]+=1
        imos[min(n,1+i+a[i])]-=1
    
    a[0]=imos[0]
    if a[0]==n:
        flag=0
    else:
        flag=1

    for i in range(1,n):
        a[i]=a[i-1]+imos[i]
        if a[i]!=n:
            flag=1
    
    if flag==0:
        break

print(" ".join(list(map(str,a))))
### BUGGY CODE ###

import math
import sys
import bisect
import array

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N,K) = map(int,input().split())
A = list( map(int,input().split())) 
# print(N,K,A)
B = list( map(lambda x: x % K, A))
C = [0]
x = 0
i = 0 
for b in B:
    x = (x + b ) % K 
    C.append((x-i-1) % K) 
    i += 1 
    
# print(B,C)

E=[0 for _ in range(K)] 


ans=0
for i in range(N+1):
    ans += E[C[i]]
    if i >= K-1:
        E[C[i-K+1]] -= 1
    # print(i,C[i],ans,E)
    E[C[i]]+=1
print(ans)
exit(0)

### FIXED CODE ###

import math
import sys
import bisect
import array

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N,K) = map(int,input().split())
A = list( map(int,input().split())) 
# print(N,K,A)
B = list( map(lambda x: x % K, A))
C = [0]
x = 0
i = 0 
for b in B:
    x = (x + b ) % K 
    C.append((x-i-1) % K) 
    i += 1 
    
# print(B,C)

E={}


ans=0
for i in range(N+1):
    if C[i] in E:
        ans += E[C[i]]
        E[C[i]] = E[C[i]] + 1
    else:
        E[C[i]] = 1
    if i >= K-1:
        E[C[i-K+1]] = E[C[i-K+1]] - 1
        if E[C[i-K+1]] == 0:
             E.pop(C[i-K+1])

print(ans)
exit(0)
### BUGGY CODE ###

param_x, param_k, param_d = map(int, input().split())

# print(param_x, param_k, param_d)

param_x_tmp = param_x

if param_x > 0:
  int_times_nega_posi = -1
else:
  int_times_nega_posi =  1

# before cross 0
count = 0
while param_x_tmp*param_x > 0:
  
  param_x_tmp = param_x_tmp + param_d*int_times_nega_posi
  
  count = count + 1
  
  # 
  #print(count, param_x_tmp)
  
  if count == param_k:
    print(abs(param_x_tmp))

# after cross 0
if count < param_k:
  int_move = param_k - count #move left
  int_move_devide_2_no_amari = int_move % 2
  print(abs(param_x_tmp + param_d*int_move_devide_2_no_amari*int_times_nega_posi*-1))

### FIXED CODE ###

param_x, param_k, param_d = map(int, input().split())

param_x_tmp = param_x

if param_x > 0:
  int_times_nega_posi = -1
else:
  int_times_nega_posi =  1
  
if (param_x*int_times_nega_posi*-1) - (param_k*param_d) > 0:
  print((param_x*int_times_nega_posi*-1) - (param_k*param_d))
  
else:
  int_time_before_cross_0 = int((param_x*int_times_nega_posi*-1) / param_d)
  # print(int_time_before_cross_0)
  
  param_x_tmp = param_x + int_time_before_cross_0*param_d*int_times_nega_posi
  # print(param_x_tmp)
  
  int_move = param_k - int_time_before_cross_0 #move left
  int_move_devide_2_no_amari = int_move % 2
  print(abs(param_x_tmp + param_d*int_move_devide_2_no_amari*int_times_nega_posi))
  
  #count = 0
  #while param_x_tmp*param_x > 0:
  #  
  #  param_x_tmp = param_x_tmp + param_d*int_times_nega_posi
  #  
  #  count = count + 1
  #  
  #  if param_k - count == 0:
  #    print(abs(param_x_tmp))
  #
  #if count < param_k:
  #  int_move = param_k - count #move left
  #  int_move_devide_2_no_amari = int_move % 2
  #  print(abs(param_x_tmp + param_d*int_move_devide_2_no_amari*int_times_nega_posi*-1))
### BUGGY CODE ###

from copy import deepcopy
from collections import deque
from itertools import product

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

S = [[1000000 if s == '.' else '#' for s in row] for row in S]
ans = 0
for i, j in product(range(H), range(W)):
    if S[i][j] == '#':
        continue
    d = deepcopy(S)
    d[i][j] = 0
    v = [[False] * W for i in range(H)]
    q = deque([(i, j)])
    while len(q) > 0:
        x, y = q.popleft()
        v[x][y] = True
        if 0 <= x - 1 and S[x - 1][y] != '#':
            d[x - 1][y] = min(d[x][y] + 1, d[x - 1][y])
            if not v[x - 1][y]:
                q.append((x - 1, y))
        if x + 1 < H and S[x + 1][y] != '#':
            d[x + 1][y] = min(d[x][y] + 1, d[x + 1][y])
            if not v[x + 1][y]:
                q.append((x + 1, y))
        if 0 <= y - 1 and S[x][y - 1] != '#':
            d[x][y - 1] = min(d[x][y] + 1, d[x][y - 1])
            if not v[x][y - 1]:
                q.append((x, y - 1))
        if y + 1 < W and S[x][y + 1] != '#':
            d[x][y + 1] = min(d[x][y] + 1, d[x][y + 1])
            if not v[x][y + 1]:
                q.append((x, y + 1))
    for x, y in product(range(H), range(W)):
        if v[x][y]:
            ans = max(d[x][y], ans)
print(ans)


### FIXED CODE ###

from collections import deque
from itertools import product

INF = 1001001001
dr = [(1, 0), (-1, 0), (0, 1), (0, -1)]

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

ans = 0
for i, j in product(range(H), range(W)):
    if S[i][j] == '#':
        continue
    d = [[INF] * W for i in range(H)]
    d[i][j] = 0
    q = deque([(i, j)])
    while len(q) > 0:
        x, y = q.popleft()
        for dx, dy in dr:
            nx, ny = x + dx, y + dy
            if 0 <= nx < H and 0 <= ny < W and S[nx][ny] != '#' and d[nx][ny] == INF:
                d[nx][ny] = d[x][y] + 1
                ans = max(d[nx][ny], ans)
                q.append((nx, ny))
print(ans)
### BUGGY CODE ###


n = int(input())
An = list(map(int, input().split()))
ans = An[0]
for i in range(1,n):
  ans *= An[i]
if ans > (10 ** 18):
  ans = -1
print(str(ans))


### FIXED CODE ###

n = int(input())
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1
      break

print(str(ans))
### BUGGY CODE ###

def sort_list(list_n):
    ans = 0
    n_lst = sorted(list_n, reverse=True)
    for idx in range(len(list_n)-2):
        for diff_idx in range(idx+1, len(list_n)-1):
            diff = n_lst[idx] - n_lst[diff_idx]
            for search in range(diff_idx+1, len(list_n)):
                if n_lst[search] <= diff:
                    search -= 1
                    break
            conbo = search - diff_idx
            ans += conbo
    return ans


def main():
    _ = input()
    K = [int(x) for x in input().split()]
    ans = sort_list(K)
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import bisect


def sort_list():
    _ = input()
    K = [int(x) for x in input().split()]
    ans = 0

    len_k = len(K)
    n_lst = sorted(K)

    for idx in reversed(range(2, len_k)):
        for diff_idx in range(1, idx):
            diff = n_lst[idx] - n_lst[diff_idx]
            insert_index = bisect.bisect_right(n_lst, diff)
            if insert_index < diff_idx:
                # print(n_lst, diff, idx, diff_idx, insert_index)
                ans += diff_idx - insert_index
    print(ans)


if __name__ == "__main__":
    sort_list()
### BUGGY CODE ###

K = int(input())
if K % 2 == 0:
    print(-1)

else:
    c = 7
    count = 0
    while True :
        if c % K == 0:
            print(count+1)
            break

        c = int(str(c)+'7')
        count+=1


### FIXED CODE ###

K = int(input())

count = -1
n = 7
for i in range(K):
    if n % K == 0:
        count = i+1
        break
    n = int(str(n)+'7')
    n %= K
print(count)
### BUGGY CODE ###

from itertools import*
N,K,Q,*A=map(int,open(0).read().split())
s=sorted
print(min((s(sum((v[:max(0,len(v)-K+1)]for v in(k*s(v)for k,v in groupby(A,lambda a:a>=Y))),[]))[Q-1:]or[2e9])[0]-Y for Y in set(A)))

### FIXED CODE ###

N, K, Q, *A = map(int, open(0).read().split())

ans = float("inf")
for Y in A:
    C = []
    tmp = []
    for a in A:
        if a >= Y:
            tmp.append(a)
        else:
            if len(tmp) >= K:
                C += sorted(tmp)[:len(tmp) - K + 1]
            tmp = []
    if len(tmp) >= K:
        C += sorted(tmp)[:len(tmp) - K + 1]

    if len(C) >= Q:
        C.sort()
        X = C[Q - 1]
        ans = min(ans, X - Y)

print(ans)
### BUGGY CODE ###

s=input()
n=len(s)
d=[0]
for i in range(1,n+1):
    d.append(int(s[-i:])%2019)
import collections
c=collections.Counter(d)
ans=0
for i in c.values():
    ans+=i*(i-1)//2
print(ans)

### FIXED CODE ###

s=input()
n=len(s)
d=[0]
d10=[0,1,10]
for i in range(n):
    d10.append(d10[-1]*10%2019)
for i in range(1,n+1):
    d.append((d[-1]+int(s[-i])*d10[i])%2019)
import collections
c=collections.Counter(d)
ans=0
for i in c.values():
    ans+=i*(i-1)//2
print(ans)
### BUGGY CODE ###

import bisect
s = str(input())
t = str(input())

alpha2num = lambda c: ord(c) - ord('a')

S2 = [[] for i in range(26)]
for i in range(len(s)):
  S2[alpha2num(s[i])].append(i)
  
#print(S2)
time = 0
place = -1
for i in range(len(t)):
  now = alpha2num(t[i])
  if S2[now] == []:
    print(-1)
    quit()
  else:
    if place not in S2[now]:
      index = bisect.bisect_left(S2[now], place)
    else:
      index = bisect.bisect_left(S2[now], place + 1)
    #print(index, S2[now])  
      
    if index == len(S2[now]):
      place = S2[now][0]
      time += 1
    else:  
      place = S2[now][index]
  #print(place, time)  
    
    
ans = len(s) * time + place + 1
print(ans)
    
    
  
  

### FIXED CODE ###

import bisect
s = str(input())
t = str(input())

alpha2num = lambda c: ord(c) - ord('a')

S2 = [[] for i in range(26)]
for i in range(len(s)):
  S2[alpha2num(s[i])].append(i)
  
#print(S2)
time = 0
place = -1
for i in range(len(t)):
  now = alpha2num(t[i])
  if S2[now] == []:
    print(-1)
    quit()
  else:
    index = bisect.bisect_left(S2[now], place)
    #if index == place:
    #  index += 1
    #print(index, S2[now])  

    
    if index == len(S2[now]):
      place = S2[now][0]
      time += 1
    else:  
      if S2[now][index] == place:
        index += 1
        if index == len(S2[now]):
          place = S2[now][0]
          time += 1
        else:
          place = S2[now][index]
      else:  
        place = S2[now][index]
  #print(place, time)  
    
    
ans = len(s) * time + place + 1
print(ans)
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()

for _ in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count('AC'))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, q = map(int, input().split())
s = input()

score = [0]*n
for i in range(n-1):
    score[i+1] = score[i]
    if s[i]+s[i+1] == 'AC':
        score[i+1] += 1

for _ in range(q):
    l, r = map(int, input().split())
    print(score[r-1]-score[l-1])
### BUGGY CODE ###

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

# 平均を A にしたいので、
# 先に A を引いて、平均を 0 にすることを目指す

xs = [x - A for x in xs]

count = 0

for i in range(2 ** N):
  string = "{:0" + str(N) + "b}"
  use = string.format(i)[::-1]

  ans = 0
  for i, flag in enumerate(use):
    if flag == "1":
      ans += xs[i]
    else:
      pass
  if ans == 0:
    count += 1
  
if A != 0:
  count -= 1
    
print(count)

### FIXED CODE ###

# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    # dp[i][j][k] := patterns to make k with j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()