Harryxun/stf_run huggingface dataset:
K = int(input())
A, B = list(map(int, input().split()))

N = (B // K)  * K
if (A <= N):
  print(‘OK’)
else:
  print(‘NG’)

### FIXED CODE ###

K = int(input())
A, B = list(map(int, input().split()))
 
N = (B // K)  * K
if (A <= N):
  print('OK')
else:
  print('NG')
n = int(input())
a = list(map(int, input().split()))

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

dp[1] = max(a[:2])
dp[2] = max(a[:3])

ep[1] = a[0]
ep[2] = max(a[:2])

for i in range(3,n):
    if (i+1)%2==0:
        ep[i] = ep[i-2] + a[i-1]
    else:
        ep[i] = max(ep[i-2]+a[i-1],ep[i-3]+a[i-2])
    dp[i] = max(dp[i-2]+a[i],ep[i])

print(dp[-1])

### FIXED CODE ###

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

if n==2:
    print(max(a))
    exit()

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

dp[1] = max(a[:2])
dp[2] = max(a[:3])

ep[1] = a[0]
ep[2] = max(a[:2])

for i in range(3,n):
    if (i+1)%2==0:
        ep[i] = ep[i-2] + a[i-1]
    else:
        ep[i] = max(ep[i-2]+a[i-1],ep[i-3]+a[i-2])
    dp[i] = max(dp[i-2]+a[i],ep[i])

print(dp[-1])
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n)]
visited = [-1 for _ in range(n)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b-1, c])
    tree[b - 1].append([a - 1, c])
def depth(now, cost):
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            depth(tree[now][i][0], cost+tree[now][i][1])
    return
q, k = [int(i) for i in input().split()]
depth(k-1, 0)
# print(visited)
for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

### FIXED CODE ###

n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
q, k = [int(i) for i in input().split()]

stack = [[k-1, 0]]
while True:
    size = len(stack)
    if size == 0:
        break
    now, cost = stack.pop()
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            stack.append([tree[now][i][0],
                          cost+tree[now][i][1]])

for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])
n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1)
    ans += i * g(n // i)
print(ans)

### FIXED CODE ###

n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1):
    ans += i * g(n // i)
print(ans)
ans = 0
count = 0
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else print("No")


### FIXED CODE ###

ans = "No"
count = 0
n = int(input())
for i in range(n):
  a,b=map(int,input().split())
  if a == b:
    count += 1
    if count >= 3:
        ans ="Yes"
  else:
    count = 0

print(ans)
s = str(input())
l = len(s)

counter = 0
prev = None
pivot = 0

while pivot < l:
    n = 1
    if prev == s[pivot]:
        if pivot + 1 < l:
            prev = s[pivot + 2]
            counter += 2
            pivot += 3

        else:
            break
    else:
        counter += 1
        prev = s[pivot]
        pivot += n

print(int(counter))

### FIXED CODE ###

s = str(input())
l = len(s)

counter = 0
prev = None
pivot = 0

while pivot < l:
    n = 1
    if prev == s[pivot]:
        if pivot + 1 < l:
            if pivot + 2 < l:
                prev = s[pivot + 2]
                counter += 2
                pivot += 3
            else:
                counter += 1
                break
        else:
            break
    else:
        counter += 1
        prev = s[pivot]
        pivot += n

print(int(counter))
import math
a, b = [int(i) for i in input().split()]

print(math.floor(a*b))

### FIXED CODE ###

a, b = input().split()

x = int(a)
y = round(100*float(b))

print(x * y // 100)
def isAC(S):
    if S[0] != 'A':
        return False
    if S[2:-1].count('C') != 1:
        return False
    S = S.remove('C')
    if not all('a' <= x <= 'z' for x in S):
        return False
    return True

print('AC' if isAC(input()) else 'WA')

### FIXED CODE ###

def isAC(S):
    if S[0] != 'A':
        return False
    if S[2:-1].count('C') != 1:
        return False
    S = S[1:].replace('C', '')
    if not all('a' <= x <= 'z' for x in S):
        return False
    return True

print('AC' if isAC(input()) else 'WA')
def main():
    N = input()
    sum = 0
    for i in range(N):
        i = i+1
        if i%3 ==0 or i%5 ==0 or i%15 ==0:
            continue
        else:
            sum = sum + i

    print(sum)




if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    sum = 0
    for i in range(N):
        i = i+1
        if i%3 == 0 or i%5 == 0 or i%15 == 0:
            continue
        else:
            sum = sum + i

    print(sum)




if __name__ == "__main__":
    main()
def main():
    
    N = int(input())
    
    POW6 = []
    POW9 = []
    for i in range(7):
        POW6.append(6**i)
        
    for i in range(6):
        POW9.append(9**i)
        
    
    dp = [N]*(N+1)
    dp[0] = 0
    for i in range(1, N+1):
        cnt = 0
        while i-POW6[cnt] >= 0:
            dp[i] = min(dp[i], dp[i-POW6[cnt]]+1)
            cnt += 1
        cnt = 0
        while i-POW9[cnt] >= 0:
            dp[i] = min(dp[i], dp[i-POW9[cnt]]+1)
            cnt += 1

    
    print(dp[N])
    
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

# ある数Nのみで割っていく関数
def div_by_N(inpt, N):
    if inpt < N:
        return inpt
    else:
        ans = 0
        while inpt>0:
            ans += inpt%N
            inpt = inpt // N
        return ans
        
def main():
    inpt = int(input())
    ans = 1000000
    for i in range(inpt+1):
        ans = min(ans, div_by_N(i,6)+div_by_N(inpt-i,9))
    print(ans)
    
    
if __name__ == "__main__":
    main()
H, W = map(int, input().split())
G = [list(input()) for _ in range(H)]
ans = 0


def change(x, y):
    if x < 0 or x >= W:
        return False
    if y < 0 or y >= H:
        return False

    if G[x][y] == ".":
        G[x][y] = "@"
        return False
    elif G[x][y] == "#":
        return True


def search(x, y):
    global ans
    count = 0
    sharp = 0

    while sharp == 0:
        if count == 0:
            G[x][y] = "@"
        else:
            for i in range(count+1):
                if change(x+count-i, y+1) or change(x-i, y+count-i) or \
                    change(x-count+i, y-i) or change(x+i, y-count+i):
                    sharp += 1

        if count > ans:
            ans = count

        count += 1


for i in range(H):
    for j in range(W):
        if G[i][j] == ".":
            search(i, j)

print(ans)




### FIXED CODE ###

from collections import deque

dyx = [(0, 1), (0, -1), (1, 0), (-1, 0)]
H, W = map(int, input().split())
edge = ['#']*(W+2)
field = [edge]
q = deque()

for i in range(H):
    field.append(['#'] + list(input()) + ['#'])
    for j in range(W):
        if field[i+1][j+1] == '#':
            q.append((i+1, j+1, 0))
field.append(edge)
res = 0

while q:
    y, x, lv = q.popleft()
    res = max(lv, res)

    for dy, dx in dyx:
        if field[y+dy][x+dx] == '.':
            field[y+dy][x+dx] = '#'
            q.append((y+dy, x+dx, lv+1))

print(res)
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
hole = []*(n+1)
for i in range(m):
  hole[int(input())] = 1
dp = [0]*(n+1)
MOD = 10**9+7
   
for i in range(1,n+1):
  if hole[i]==1:
    dp[i] = 0
  dp[i] = dp[i-1]+dp[i-2]
  dp[i] %= MOD

print(dp[-1])  


### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int,input().split())
hole = [0]*(n+1)
for i in range(m):
  hole[int(input())] = 1

dp = [0]*(n+1)
dp[0] = 1
MOD = 10**9+7
   
for i in range(1,n+1):
  if hole[i]==1:
    dp[i] = 0
  else:
    dp[i] = dp[i-1]+dp[i-2]
    dp[i] %= MOD

print(dp[-1])
def rally():
    N=input()
    X=list(map(int,input().split()))
    dispersion=[]
    cnt=0
    for i in range(min(X),max(X)):
        for j in X:
            cnt+=(j-i)**2
        dispersion.append(cnt)
        cnt=0
    print(min(dispersion))

rally()

### FIXED CODE ###

N=int(input())
X=list(map(int,input().split()))
dispersion=[]
cnt=0
for i in range(100):
    for j in range(N):
        cnt+=abs(X[j]-i)**2
    dispersion.append(cnt)
    cnt=0
print(min(dispersion))
n = int(input())
a = list(map(int, input().split()))

if sum(a)/2 == sum(a[:(n//2)]):
  print(0)
elif sum(a)/2 >= sum(a[:(n//2)]):
  x = n//2
  while sum(a)/2 >= sum(a[:x]):
    x += 1  
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x-1])-sum(a))))
else:
  while sum(a)/2 <= sum(a[:x]):
    x -= 1
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x-1])-sum(a))))


### FIXED CODE ###

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

x = n//2
if sum(a)/2 == sum(a[:(n//2)]):
  print(0)
elif sum(a)/2 >= sum(a[:(n//2)]):
  while sum(a)/2 >= sum(a[:x]):
    x += 1  
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x-1])-sum(a))))
else:
  while sum(a)/2 <= sum(a[:x]):
    x -= 1
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x+1])-sum(a))))
a,b = int(input().split())
print( a*b , 2 * (a+b) )

### FIXED CODE ###

import sys
num = input().split()
a = int(num[0])
b = int(num[1])
print( a*b , 2 * (a+b) )
import numpy as np
room, route_count = map(int,input().split())
route = np.array([list(map(int,input().split())) for _ in range(route_count)])
 
object_nums = [1]
ans = np.array([0]*(room-1))
 
def mem_ans(ans, object_num, next_nums):
    mask_array = np.zeros(room-1, dtype=bool)
    mask_array[next_nums-2] = True
    ans[ans=0 & mask_array] = object_num
    return ans
 
for object_num in object_nums:
 
    object_rows = route[np.any(route==object_num, axis=1)]
    route[np.any(route==object_num, axis=1)] = 0
    next_nums = object_rows[object_rows!=object_num]
    if next_nums is not None:
        ans = mem_ans(ans, object_num, next_nums)
        object_nums.extend(next_nums)
    else:
        break
 
if 0 in set(ans):
  print('No')
else:
  print('Yes')
  for i in ans:
    print(i)

### FIXED CODE ###

import networkx as nx
room, route_count = map(int,input().split())
route = [list(map(int,input().split())) for _ in range(route_count)]

G = nx.Graph()
G.add_nodes_from(range(1,room+1))
G.add_edges_from(route)
pre = nx.predecessor(G, 1)

print('Yes')
for i in range(2,room+1):
  print(pre[i][0])
#094d
from scipy.special import comb
from bisect import bisect_left, bisect_right

n = int(input())
a_list = [int(e) for e in input().split()]

#n 個のものから順番を無視して r 個を選ぶ場合の数を comb(n,r) と書くことにします。 
#n 個の非負の整数 a1,a2,...,an から 2 つの数 ai > aj を comb(ai,aj) が最大になるように選んで下さい。 
#最大になる組が複数ある場合、どれを選んでも構いません。

#全組み合わせはn*(n-1)≒10**10 地球爆発

#comb = n*(n-1)*…*(n-r) / r
#from scipy.special import combすれば = comb(n, r, exact=True) で計算可能
#nに最大の値、rにその半分の値(nが奇数なら±0.5)を使った時に大きい値をとることを下記で確認した。
#from scipy.special import comb

#for i in range(101):
#    max_comb = 0
#    max_comb_j = 1 
#    for j in range(1,i):
#        ij_comb = comb(i, j, exact=True) 
#        if ij_comb > max_comb:
#            max_comb = ij_comb
#            max_comb_j = j
#            
#    print(i,max_comb_j,max_comb)


#が、丁度良く半分の値があるとは限らない。
#∴n側は全探索して、rはbisectで半分の値を探る

a_list.sort(reverse=False)

#仮値を入れる
max_comb = comb(a_list[1], a_list[0], exact=True) 
max_comb_ai = a_list[1]
max_comb_aj = a_list[0]

#n側を全探索
for ai in a_list: #10**5
    aj_left = bisect_left(a_list, ai/2) #O(log N)…17回で探れる　∴17*10**5なので間に合いそう
    
    #半分に近い値を算出
    if a_list[aj_left] == ai/2:
        aj_list = [a_list[aj_left]]
    elif a_list[aj_left] < ai/2:
        if aj_left != n-1:
            aj_list = [a_list[aj_left],a_list[aj_left + 1]]
        else:
            aj_list = [a_list[aj_left]]
    elif a_list[aj_left] > ai/2:
        if aj_left != 0:
            aj_list = [a_list[aj_left],a_list[aj_left - 1]]
        else:
            aj_list = [a_list[aj_left]]
    
    #combを計算
    for aj in aj_list:
        temp_comb = comb(ai, aj, exact=True)
        if temp_comb > max_comb:
            max_comb = temp_comb
            max_comb_ai = ai
            max_comb_aj = aj
        
print(max_comb_ai,max_comb_aj)

### FIXED CODE ###

#094d
import math

N = int(input()) #N<10**5
a_list = list(int(e) for e in input().split())
a_tuple = tuple(a_list)

comb_n = max(a_tuple)

a_list.remove(comb_n)
diff = min([abs(comb_n/2 - a) for a in a_list])
a_tuple = tuple(a_list)
if int(comb_n/2 + diff) in a_tuple:
    comb_r = comb_n/2 + diff
elif int(comb_n/2 - diff) in a_tuple:
    comb_r = comb_n/2 - diff  
    
print(int(comb_n),int(comb_r))
# 正解ではない

from queue import Queue


def main():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    S = [list(input()) for i in range(H)]
    q1 = Queue()
    q2 = Queue()
    q1.put((0, Ch - 1, Cw - 1))

    answer = resolve(q1, q2, S, (Dh - 1, Dw - 1), H, W)
    print(answer)


def resolve(q1, q2, S, D, H, W):
    while not q1.empty():
        worp_count, x, y = q1.get()
        if S[x][y] == '/':
            continue
        S[x][y] = '/'
        q2.put((x, y))

        if (x, y) == D:
            return worp_count

        for i, j in [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)]:
            if 0 <= i < H and 0 <= j < W and S[i][j] == '.':
                q1.put((worp_count, i, j))

    if q2.empty():
        return -1

    while not q2.empty():
        x, y = q2.get()
        for i, j in [(a, b) for a in range(-2, 3) for b in range(-2, 3)]:
            if 0 <= x + i < H and 0 <= y + j < W and S[x + i][y + j] == '.':
                q1.put((worp_count + 1, x + i, y + j))

    return resolve(q1, q2, S, D, H, W)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def main():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    S = [list(input()) for _ in range(H)]
    d = [[-1 for _ in range(W)] for _ in range(H)]

    q = deque([])
    q.appendleft((0, Ch - 1, Cw - 1))

    while len(q):
        worp_count, x, y = q.popleft()

        if d[x][y] != -1:
            continue
        d[x][y] = worp_count

        for i, j in ((a, b) for a in range(-2, 3) for b in range(-2, 3)):
            nx = x + i
            ny = y + j
            if 0 <= nx < H and 0 <= ny < W and S[nx][ny] == '.':
                if i == 0 and j == 0:
                    continue
                elif abs(i) + abs(j) == 1:
                    q.appendleft((worp_count, nx, ny))
                else:
                    q.append((worp_count + 1, nx, ny))

    print(d[Dh - 1][Dw - 1])


if __name__ == "__main__":
    main()
from math import gcd, sqrt


def is_prime(n):
    flag = True
    for k in range(2, int(sqrt(n)) + 1):
        if n % k == 0:
            flag = False
            return

    if flag:
        return n


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 main():
    a, b = map(int, input().split())
    coms = make_divisors(gcd(a, b))
    # print(coms)
    ans = [is_prime(i) for i in coms]
    # print(ans)
    ans2 = [a for a in ans if a is not None]
    print(ans2)


if __name__ == "__main__":
    main()


### FIXED CODE ###

# from math import gcd, sqrt
import fractions
import math


def is_prime(n):
    flag = True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            flag = False
            return

    if flag:
        return n


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 main():
    a, b = map(int, input().split())
    coms = make_divisors(fractions.gcd(a, b))
    ans = [is_prime(i) for i in coms]
    ans2 = [a for a in ans if a is not None]
    print(len(ans2))


if __name__ == "__main__":
    main()
def gcd(a, b):
    for i in range(200):
      a, b = b, a%b
      return a if b == 0
  
K = int(input())
A = B = C = [i for i in range(1, K+1)]
cnt = sum([gcd(gcd(a,b),c) for a in A for b in B for c in C])   
print(cnt)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
K = int(input())
A = B = C = [i for i in range(1, K+1)]

L = [gcd(a,b) for a in A for b in B]

cnt = sum([gcd(l,c) for l in L for c in C])   
print(cnt)
import collections
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


X = int(input())
if X == 1:
    print("1 0")
else:
    for i in range(X):#i = B
        c = factorization(X+pow(i,5))
        flag = 0
        for j in range(len(c)):
            if c[j][1] % 5 != 0:
                flag = 1
                break
        if flag ==0:
            B = i
            A = 1
            for j in range(len(c)):
                A *= c[j][0]
            break
        c = factorization(X-pow(i,5))
        flag = 0
        for j in range(len(c)):
            if c[j][1] % 5 != 0:
                flag = 1
                break
        if flag ==0:
            B = i * -1
            A = 1
            for j in range(len(c)):
                A *= c[j][0]
            break
    print(A,B)



### FIXED CODE ###

X = int(input())
for A in range(-200,200):
    for B in range(-200,200):
        if pow(A,5)-pow(B,5)==X:
            print(A,B)
            break
    else:
        continue
    break
from sys import exit
H,W,N = [int(n) for n in input().split()]
# N = int(input())
dxy = [[0,0],[1,0],[0,1],
[-1,0],[0,-1],[1,1],
[-1,-1], [1,-1], [-1,1]]

effdic = {}
for i in range(N):
    a,b = [int(n)-1 for n in input().split()]
    for d in dxy:
        ta, tb = a+d[0], b+d[1]
        if(1 <= ta < H-1 and 1 <= tb < W-1):
            s = str(ta) + str(tb)
            if(s in effdic):
                effdic[s] += 1
            else:
                effdic[s] = 1

ans = {0:(H-2)*(W-2), 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0}
for k in effdic.keys():
    ans[effdic[k]]+=1
    ans[0]-=1
for k in ans.keys():
    print(ans[k])
# S = str(input())
# L = len(S)
# T = str(input())
# exit()


### FIXED CODE ###

from collections import defaultdict
H,W,N = [int(n) for n in input().split()]
# N = int(input())
dxy = [[0,0],[1,0],[0,1],
[-1,0],[0,-1],[1,1],
[-1,-1], [1,-1], [-1,1]]

effdic = defaultdict(int)
for i in range(N):
    a,b = [int(n)-1 for n in input().split()]
    for d in dxy:
        ta, tb = a+d[0], b+d[1]
        if(1 <= ta < H-1 and 1 <= tb < W-1):
            effdic[(ta,tb)] += 1
print((H-2)*(W-2) - len(effdic))
for i in range(1,10):
    tmp=0
    for v in effdic.values():
        if(v == i):
            tmp+=1
    print(tmp)
A,B,C = int(input())
if A+B+C >=22:
  print('bust')
else:
  print('win')

### FIXED CODE ###

A,B,C =map(int,input().split())
if A+B+C>=22:
  print('bust')
else:
  print('win')
from math import pi

r=int(input())
print("{:.7f}".format(pi*r*r),"{:.7f}".format(2*r*pi))


### FIXED CODE ###

from math import pi

r=float(input())
print("{:.7f}".format(pi*r*r),"{:.7f}".format(2*r*pi))
import fractions
n, m = map(int, input().split())
s = input()
t = input()
lcm = n * m // fractions.gcd(n, m)
sl = [""] * lcm
for i in range(len(s)):
    temp = i * lcm // n
    sl[temp] = s[i]
for i in range(len(t)):
    temp = i * lcm // m
    if sl[temp] != "" and sl[temp] != t[i]:
        print(-1)
        exit()
print(lcm)


### FIXED CODE ###

import fractions
n, m = map(int, input().split())
s = input()
t = input()
gcd = fractions.gcd(n, m)
lcm = n * m // gcd
o = lcm // gcd
for i in range(gcd):
    if s[i * lcm // m] != t[i * lcm // n]:
        print(-1)
        exit()
print(lcm)
n=list(map(int,input().strip().split()))
m=list(map(int,input().strip().split()))
for i in range(n[1],n[0]):
    if(m[i]<m[i+1]):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n=list(map(int,input().strip().split()))
m=list(map(int,input().strip().split()))
for i in range(n[0]-n[1]):
    if(m[i+n[1]]>m[i]):
        print("Yes")
    else:
        print("No")
s=int(split(input()))
a=s[0]
b=s[1]
x=a+b
y=2*a+2*b
print(x,y)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)
print(a*b,2*a+2*b)
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import copy as cp
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

n,a = imap()
x = np.array(iarr()) - a

# dp[i][和 + NA]
# 本来のSの範囲は、n*(1-a)からn*(50-a)
# 負の数はdp半以外なのでNAたすと、1*nから50*N
# 和０のときは dp[n][0+NA]
dp = np.zeros((n+1, 50*n+1)).astype(int)
dp[0][n*a] = 1

for i in range(n):
    for s in range(2*n*a+1):
        print(i,s)
        dp[i+1][s] = dp[i][s] + dp[i][s-x[i]] if s-x[i]>=0 else dp[i][s]

ans = dp[n][n*a] - 1 #実際は初期条件の０個選ぶパターンを除外
print(ans)



### FIXED CODE ###

import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import copy as cp
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

n,a = imap()
x = np.array(iarr()) - a

# dp[i][和 + NA]
# 本来のSの範囲は、1N-NAから50N-NA
# 負の数はdp範囲外なのでNAたすと、1Nから50N
# 和０のときは dp[n][0+NA]
dp = np.zeros((n+1, 50*n+100)).astype(int)
dp[0][n*a] = 1

for i in range(n):
    for s in range(50*n+1):
        dp[i+1][s] = dp[i][s] + dp[i][s-x[i]] if s-x[i]>=0 else dp[i][s]

ans = dp[n][n*a] - 1 #実際は初期条件の０個選ぶパターンを除外
print(ans)