Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

n = int(input())

from collections import defaultdict
d = defaultdict(list)

for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = [int(x) for x in input().split()]
        d[i].append((x - 1, y))
ans = 0
for k in range(2**n):
    res = 0
    j = bin(k)[2:].zfill(n)
    for i in range(n):
        if j[i] == "0":
            continue
        flag = 1
        for x, y in d[i]:
            if int(j[x]) != int(y):
                flag = 0
                break
        res += 1
    if flag:
        ans = max(ans, res)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
S = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    temp = []
    for _ in range(A):
        temp.append([str(x) for x in input().split()])
        S[i] = temp
ans = 0
for i in range(2 ** N - 1, -1,-1):
    biti = list(bin(i)[2:].zfill(N))
    flag = 0
    for j in range(N):
        if biti[j] == "1":
            for k in S[j]:
                if biti[int(k[0])-1] != k[1]:
                    flag = 1
                    break
        if flag:
            break
    if not flag:    
        biti = np.array(biti)
        ans = max(ans, np.count_nonzero(biti == "1"))
print(ans)
N, M = map(int,input().split())
G = [[] for k in range(N)]

for k in range(M):
    u, v = map(int,input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)

S, T = map(int,input().split())
S -= 1
T -= 1

D1 = [200000 for k in range(N)]
D1[S] = 0
def dfs1(now, dist):
    for tsugi in G[now]:
        if D1[tsugi] > dist + 1:
            D1[tsugi] = dist + 1
            dfs1(tsugi, dist+1)

D2 = [200000 for k in range(N)]
D2[T] = 0
def dfs2(now, dist):
    for tsugi in G[now]:
        if D2[tsugi] > dist + 1:
            D2[tsugi] = dist + 1
            dfs2(tsugi, dist+1)

dfs1(S,0)
dfs2(T,0)

if D1[T] == 200000:
    print(-1)
    exit(0)
if D1[T]%3 == 0:
    print(D1[T]//3)
elif D1[T]%3 == 1:
    ans = 100000
    for k in range(N):
        if D2[k]%3 == 2:
            ans = min(1+(D1[T]+D2[k])//3,ans)
    if ans == 100000:
        print(-1)
    else:
        print(ans)
elif D1[T]%3 == 2:
    ans = 100000
    for k in range(N):
        if D2[k]%3 == 1:
            ans = min(1+(D1[T]+D2[k])//3,ans)
    if ans == 100000:
        print(-1)
    else:
        print(ans)


### FIXED CODE ###

import sys
from collections import deque
def main():
    INF = float("inf")
    input = sys.stdin.readline
    N, M = map(int,input().split())
    G = [[] for k in range(N)]
    for k in range(M):
        u, v = map(int,input().split())
        u -= 1
        v -= 1
        G[u] += [v]
    S, T = map(int,input().split())
    S -= 1
    T -= 1
    D = [[INF,INF,INF] for k in range(N)]
    D[S][0] = 0
    Q = deque([[S,0]])
    while len(Q) > 0:
        t = Q.popleft()
        ima = t[0]
        k = t[1]
        for tsugi in G[ima]:
            if D[tsugi][(k+1)%3] != INF:
                pass
            else:
                D[tsugi][(k+1)%3] = D[ima][k] + 1
                Q.append([tsugi,(k+1)%3])
    if D[T][0] == INF or D[T][0]%3 != 0:
        print(-1)
    else:
        print(D[T][0]//3)

if __name__ == '__main__':
    main()
k = int(input())
a,b = [input() for i in range(2)]
if (b-a+1 >= k):
  print("OK")
else:
  print("NG")

### FIXED CODE ###

k = int(input())
a,b = map(int,input().split())
if ((b//k)*k >= a):
  print("OK")
else:
  print("NG")
a,b,n=map(int,raw_input().split())
f=min(n,b-1)
print int((f*a)/b)

### FIXED CODE ###

a,b,n=map(int,raw_input().split())
f=min(n,b-1)
print int((f*a)/b)
import numpy as np
 
def convert(L):
    dp = np.zeros((L.shape[0],L.shape[1]), dtype='int')
    for i in range(L.shape[0]):
        l=L[i]
        for j in range(L.shape[1]):
            if l[j]:
                if j == 0:
                    dp[i][j] = 1
                else:
                    dp[i][j] = dp[i][j-1] + 1
            else:
                dp[i][j] = 0
    return dp
H,W=map(int,input().split())
L= np.zeros((H,W),dtype='bool')
for i in range(H):
    L[i]=list(map(lambda x: False if x=="#" else True,list(input()) ))
 
ans = convert(L) #+ np.fliplr(convert(np.fliplr(L))) + convert(L.T).T + np.flipud(convert(np.flipud(L).T).T) - 3
print(np.max(ans))

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
temp = np.array([list(input()) for _ in range(H)])
# 周りに壁を、0,1化
map = np.zeros((H+2,W+2),dtype=np.int32)
map[1:-1,1:-1][temp == '.'] = 1

# x軸正方向の集計
def F():
  x = map.copy()
  for row in range(1,H+1):
    zero_idx = np.nonzero(x[row]==0)[0]
    x[row, zero_idx[1:]] = 1-np.diff(zero_idx) # cumsumで求められるように変形
  x = x.cumsum(axis = 1)
  return x

# y軸
def G():
  x = map.T.copy()
  for row in range(1,W+1):
    zero_idx = np.nonzero(x[row]==0)[0]
    x[row, zero_idx[1:]] = 1-np.diff(zero_idx) # cumsumで求められるように変形
  x = x.cumsum(axis = 1)
  return x.T

answer = np.zeros_like(map)
# x軸
answer += F()
# 逆順
map = map[:,::-1]
answer += F()[:,::-1]
map = map[:,::-1]

# y軸
answer += G()
# 逆順
map = map[::-1,:]
answer += G()[::-1,:]

answer = np.max(answer) - 3
print(answer)
(a, b) = [int(x) for x in input().split()]

di = a // b
m = a % b
df = a / b

print(dl, m, df)

### FIXED CODE ###

(a, b) = [int(x) for x in input().split()]

di = a // b
m = a % b
df = a / b

print('{0} {1} {2:.8f}'.format(di, m, df))
N = int(input())
W = list(map(int, input().split()))
 
def calc_sum(W, T):
  S1 = sum(W[:T])
  S2 = sum(W[T:])
  return S1, S2
 
def calc_abs(S1, S2):
  return abs(S1-S2)
  
min_ = 1000
for i in range(len(W)):
  S1, S1 = calc_sum(W, i)
  j = calc_abs(S1, S2)
  if j < min_:
    min_ = j
    
print(min_)

### FIXED CODE ###

N = int(input())
W = list(map(int, input().split()))
 
def calc_sum(W, T):
  S1 = sum(W[:T])
  S2 = sum(W[T:])
  return S1, S2
 
def calc_abs(S1, S2):
  return abs(S1-S2)
  
min_ = 1000
for i in range(len(W)):
  S1, S2 = calc_sum(W, i)
  j = calc_abs(S1, S2)
  if j < min_:
    min_ = j
    
print(min_)
S = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_dict.keys():
  if S_dict[s] != 2:
    res = 'No'
print(res)


### FIXED CODE ###

S = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_cnt.keys():
  if S_cnt[s] != 2:
    res = 'No'
print(res)
S = input()

len = 0

ans = []
for ch in S:
    if ch in 'ACGT':
        len = len +1
    else:
        ans.append(len)
        len = 0
        

if len(ans) == 0:
    print(0)
else:
    print(max(ans))

### FIXED CODE ###

S = input()
ACGT = ["A","C","G","T"]

ans = 0 
ans_lis = [0]

for i in range(len(S)):
    if S[i] in ACGT:
        ans = ans + 1 
        if i == (len(S)-1):
            ans_lis.append(ans)
    elif S[i] not in ACGT:
        ans_lis.append(ans)
        ans = 0 

print(max(ans_lis))
Ls = list(map(int, input().split()))
    Ls.sort()

    # O(N^2 * logN)の全探索で解く
    ans = 0
    for a_i in range(N):
        for b_i in range(a_i+1, N):
            c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
            if c_i > b_i:
                ans += c_i - b_i - 1
            else:
                pass

    print(ans)

### FIXED CODE ###

import bisect

def solve():
    N = int(input())
    Ls = list(map(int, input().split()))
    Ls.sort()

    # O(N^2 * logN)の全探索で解く
    ans = 0
    for a_i in range(N):
        for b_i in range(a_i+1, N):
            c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
            if c_i > b_i:
                ans += c_i - b_i - 1
            else:
                pass

    print(ans)

if __name__ == "__main__":
    solve()
a,b=map(int,input().split())
def cumsum(n):
  if n==1:
    return 1
  else:
    return cumsum(n-1)+n
print(cumsum(b-a)-b)

### FIXED CODE ###

a,b=map(int,input().split())
def cumsum(n):
  return sum([i for i in range(n+1)])
print(cumsum(b-a)-b)
n,r=map(int,input().split())
if n>=10:
  print(r)
else:
  print(r+100*(10-k))

### FIXED CODE ###

n,r=map(int,input().split())
if n>=10:
  print(r)
else:
  print(r+100*(10-n))
m = int(input())
L = []
for _ in range(m):
    L.append(list(map(int, input().split())))

short = []
additional = 0
for elm in L:
    additional += (elm[1] - 1)
    total = elm[0] * elm[1]
    if total > 9:
        if total % 9 == 0:
            additional += (total // 9) - 1
        else:
            additional += total // 9
        # additional += (total - 1) // 9
    if total > 9:
        if total % ９==０：
            res = 9
        else:
            res = total % 9
    else:
        res = total
    short.append(res)

prev = 0
additional += len(short) - 1
for elm in short:
    prev = prev + elm
    if prev > 9:
        prev -= 9
        additional += 1

print(additional)



### FIXED CODE ###

m = int(input())
L = []
for _ in range(m):
    L.append(list(map(int, input().split())))

short = []
additional = 0
for elm in L:
    additional += (elm[1] - 1)
    total = elm[0] * elm[1]
    if total > 9:
        if total % 9 == 0:
            additional += (total // 9) - 1
        else:
            additional += total // 9
        # additional += (total - 1) // 9
    if total > 9:
        if total % 9 == 0:
            res = 9
        else:
            res = total % 9
    else:
        res = total
    short.append(res)

prev = 0
additional += len(short) - 1
for elm in short:
    prev = prev + elm
    if prev > 9:
        prev -= 9
        additional += 1

print(additional)
a = input().split("\n")
array =  list(map(int, a[1].split()))
print(min(array), max(array), sum(array))


### FIXED CODE ###

input()
array = list(map(int, input().split()))
print(min(array), max(array), sum(array))
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
out = new[a_pos:(z_pos+1)]
print(out)


### FIXED CODE ###

sample = input()
#new = list(sample)
#if "A" in new:
a_pos = sample.index('A')
#if "Z" in new:
z_pos = sample.rfind('Z')
print(z_pos-a_pos+1)
def main():
    import numpy as np
    s = list(reversed(input()))
    mod = 10**9+7
    memo = np.zeros(13, dtype=np.int64)
    m13 = [(10**i) % 13 for i in range(12)]
    npa13 = np.array([i * np.arange(10) % 13 for i in range(12)])
    memo[0] = 1
    for j, i in enumerate(s):
        memo2 = np.zeros(13, dtype=np.int64)
        a = m13[j % 12]
        if i == "?":
            for l in npa13[a]:
                memo2[l:] += memo[:13-l]
                memo2[:l] += memo[13-l:]
            memo = memo2 % mod
        else:
            l = a*int(i) % 13
            memo = np.append(memo[:13-l],memo[13-l:]) % mod
    print(int(memo[5]))


main()

### FIXED CODE ###

s=list(reversed(input()))
mod=10**9+7
memo=[0 for _ in [0]*13]
m13=[(10**i)%13 for i in range(12)]
memo[0]=1
for i in range(len(s)):
    memo2=[0 for _ in [0]*13]
    a=m13[i%12]
    if s[i]=="?":
        list_=[0,1,2,3,4,5,6,7,8,9]
    else:
        list_=[int(s[i])]
    list_=[(a*j)%13 for j in list_]
    for l in list_:
        for j in range(13):
            memo2[(l+j)%13]+=memo[j]
    memo=[j%mod for j in memo2]
print(memo[5])
a = [0 for i in range(26)]
w = []
while 1:
    s = input()
    if s == "-1":
        break
    w.append(s)
for i in w:
    for j in i:
        if j.isalnum():
            c = ord(j.lower())
            a[c-97] += 1
for i in range(26):
    print(chr(i+97) + " : " + str(a[i]))

### FIXED CODE ###

import sys
cnts = {}
for line in sys.stdin:
    for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
  
for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))
from fractions import gcd

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

L = (N * M) // gcd(N, M)
# L = int((N * M) / gcd(N, M))

L1 = [1]
L2 = [1]
for i in range(1, N):
    t = i * (L // N) + 1
    L1.append(t)

for i in range(1, M):
    t = i * (L // M) + 1
    L2.append(t)

LS = [None] * L
for i, li in enumerate(L1):
    ind = li-1
    LS[ind] = S[i]

ans = True
for i, li in enumerate(L2):
    ind = li-1
    if LS[ind] is not None:
        if LS[ind] != T[i]:
            ans = False

if ans:
    print(L)
else:
    print(-1)


# print(L1)
# print(L2)
# print(LS)

### FIXED CODE ###

from fractions import gcd

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

L = (N * M) // gcd(N, M)

L1 = [0]
L2 = [0]

from collections import Counter
c = Counter()

for i in range(1, N):
    t = i * (L // N) + 1
    L1.append(t-1)

for i in range(1, M):
    t = i * (L // M) + 1
    L2.append(t-1)


d = {}
for i, li in enumerate(L1):
    d[li] = S[i]

# print(d)

ans = True

for i, li in enumerate(L2):
    if not d.get(li):
        continue
    if d[li] != T[i]:
        ans = False

# print(L1)
# print(L2)
# print(common)
# print(dic)

if ans:
    print(L)
else:
    print(-1)
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

def gcd(a, b):
    while a:
        a, b = b, a % b
    return b
#solve
def solve():
    n, k = LI()
    a = LI()
    if k in a:
        print("POSSIBLE")
        return
    if max(a) < k:
        print("IMPOSSIBLE")
        return
    g = a[0]
    for ai in a:
        g = gcd(g, ai)
    if k % g != 0:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
    return


#main
if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
#solve
def solve():
    n, k = LI()
    a = LI()
    if k in a:
        print("POSSIBLE")
        return
    if max(a) < k:
        print("IMPOSSIBLE")
        return
    g = a[0]
    for ai in a:
        g = gcd(g, ai)
    if k % g != 0:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
    return


#main
if __name__ == '__main__':
    solve()
n = int(input())
A = list(map(int, input().split()))
ans = 1
MOD = 1000000007
c = [0, 0, 0]
for a in A:
    cnt = c.count(a)
    ans *= cnt
    ans %= MOD
    c[c.index(a)] += 1
print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = 1
MOD = 1000000007
c = [0, 0, 0]
for a in A:
    cnt = c.count(a)
    if cnt == 0:
        print(0)
        exit()
    ans *= cnt
    ans %= MOD
    c[c.index(a)] += 1
print(ans)
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = MAP()
gcd = math.gcd(a,b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(gcd)
print(len(set(prime))+1)

### FIXED CODE ###

import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = MAP()
gcd = fractions.gcd(a,b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(gcd)
print(len(set(prime))+1)
s=input()
count = 0 
if s[0] == 1:
    count += '1'
elif s[1] == 1:
    count += '1'
elif s[2] == 1:
    count += '1'
else:
    count = 0
    print(count('1'))

### FIXED CODE ###

s = input()
count = 0 
if s[0] == '1':
    count += 1
if s[1] == '1':
    count += 1
if s[2] == '1':
    count += 1
print(count)
import collections

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
ans = 0
t=cnt.most_common()
if len(t) <= k:
    print(0)
    exit()
if 
for i in range(k):
    ans += t[i][1]
print(n - ans)

### FIXED CODE ###

import collections

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
ans = 0
t=cnt.most_common()
if len(t) <= k:
    print(0)
    exit()

for i in range(k):
    ans += t[i][1]
print(n - ans)
import sys
N,Q = map(int,input().split())
if N > Q:
    max = N
else:
    max = Q
if 1 > max or max > 2*10^5:
    sys.exit()
s = input()
if s.islower() or len(s) != N:
    sys.exit()
mass_list,mond_list = [mass for mass in s],['1' for hoge in range(len(s))]
for i in range(Q):
    index_list = []
    index_num = 0
    t,d = input().split()
    if t.islower():
        sys.exit()
    if d == 'R':
        d = 1
    elif d == 'L':
        d = -1
    else:
        sys.exit()
    for mass in mass_list:
        if mass == t:
            index_list.append(index_num)
        index_num += 1
    if d == 1:
        index_list.reverse()
    for index_num in index_list:
        if mons_list[index_num] > 0:
            if 0 > index_num+d or index_num+d > N-1:
                next
            else:
                mons_list[index_num+d] += mons_list[index_num]
            mons_list[index_num] = 0
print(sum(mons_list))

### FIXED CODE ###

N,Q = map(int,input().split())
S = '_'+input()+'_'
td = [input().split() for _ in range(Q)]
R = N+1
L = 0
for i in range(Q-1,-1,-1):
    t,d = td[i]
    if t == S[R-1] and d == 'R':
        R -= 1
    elif t == S[R] and d == 'L':
        R += 1
    if t == S[L+1] and d == 'L':
        L += 1
    elif t == S[L] and d == 'R':
        L -= 1
print(max(0,R-L-1))
import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
A = tuple(zip(*[iter(A)] * M))

# 各スポーツに参加している人数
p = [0] * (M + 1)
# 人iはn番目に好きなスポーツに参加している
sports = [0] * (N + 1)
answer = []


def solve(s, n, p, sports):
    # nは開催しているスポーツの数
    # sは新たに開催をやめるスポーツ
    p[s] = 0
    if n == M:
        for i in A:
            p[i[0]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = [idx for idx, i in enumerate(p) if i == p_max]
        for i in cancel:
            solve(i, n - 1, p, sports)
    elif n == 1:
        pass
    else:
        for i in range(1, N + 1):
            if A[i - 1][sports[i]] == s:
                sports[i] += 1
                p[A[i - 1][sports[i]]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = [idx for idx, i in enumerate(p) if i == p_max]
        for i in cancel:
            solve(i, n - 1, p, sports)


solve(0, M, p, sports)
print(min(answer))


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
A = list(map(list, map(reversed, zip(*[iter(A)] * M))))

# 各スポーツに参加している人数
p = [0] * (M + 1)
canceled = set()
answer = []


def solve(s, n):
    # nは開催しているスポーツの数
    # sは新たに開催をやめるスポーツ
    if n == 1:
        answer.append(N)
    elif n == M:
        for i in A:
            p[i[-1]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1)
    else:
        canceled.add(s)
        p[s] = 0
        for i in range(N):
            if A[i][-1] in canceled:
                while A[i][-1] in canceled:
                    A[i].pop()
                p[A[i][-1]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1)


solve(0, M)
print(min(answer))
import sys


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

sys.setrecursionlimit(N+2)
dp = [float('inf')] * N
dp[0] = 0


def rec(i):

    if dp[i] < float('inf'):
        return dp[i]

    res = float('inf')
    for j in range(1, K+1):
        if i >= j:
            res = min(res, rec(i - j) + abs(h[i] - h[i - j]))

    dp[i] = res
    return res


print(rec(N-1))


### FIXED CODE ###

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

dp = [float('inf') for _ in range(N)]
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i - j >= 0:
            if dp[i - j] + abs(h[i] - h[i - j]) < dp[i]:
                dp[i] = dp[i - j] + abs(h[i] - h[i - j])
print(dp[N-1])
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
mod = 10**9 + 7

# n = int(input())
h, n = map(int, input().split())
# a = list(map(int, input().split()))
a, b = [0] * n, [0] * n

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

dp = [-1] * (h+1)
dp[0] = [0]


for i in range(n):
    for j in range(h):
        dp[min(j+a[i], h)] = min(dp[min(j+a[i], h)], dp[j] + b[i])


print(dp[h])

### FIXED CODE ###

# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

# n = int(input())
h, n = map(int, input().split())
# a = list(map(int, input().split()))
a, b = [0] * n, [0] * n

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

dp = [10**9+7] * (h+1)
dp[0] = 0

for i in range(n):

    for j in range(h):

        dp[min(j+a[i], h)] = min(dp[min(j+a[i],h)], dp[j]+b[i])


print(dp[h])
total=0
s=0
i=0
try:
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
except:
 result=s/i+0.5 
 print(total)
 if isinstance(result,float):
    print(round(result))
 else:
    print(result)

### FIXED CODE ###

while True:
 try:
   a,b,c=map(float,input().split(','))
   bmi=b/c**2
   if bmi>=25:
     print(int(a))
 except:
  break
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	if (n%1000 == 111 || n%1000 == 222 || n%1000 == 333 || n%1000 == 444 || n%1000 == 555 || n%1000 == 666 || n%1000 == 777 || n%1000 == 888 || n%1000 == 999){
		cout << "Yes" << endl;
    }
	else if (n/10 == 111 || n/10 == 222 || n/10 == 333 || n/10 == 444 || n/10 == 555 || n/10 == 666 ||n/10 == 777 || n/10 == 888 || n/10 == 999){
		cout << "Yes" << endl;
    }
	else{
		cout << "No" << endl;
    }
}

### FIXED CODE ###

n = str(input())
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
	print("Yes")
else:
	print("No")