Harryxun/stf_run huggingface dataset:
def main():
    from itertools import product
    
    H, W, K = map(int, input().split())
    S = [input() for _ in range(H)]
    S_T = [[int(s[w]) for s in S] for w in range(W)]
    sumS = sum(map(sum, S_T))
    ans = (H - 1) * (W - 1)
    
    if sumS <= K:
        print(0)
    else:
        for i in product([True, False], repeat=H-1):
            cnt = sum(i)
            if cnt >= ans:
                continue
            M = [[0]]
            for j, k in enumerate(i):
                if k:
                    M.append([])
                M[-1].append(j+1)
            A = [0] * len(M)
            for s_t in S_T:
                for l, m in enumerate(M):
                    A[l] += sum(s_t[i] for i in m)
                if any(a > K for a in A):
                    cnt += 1
                    if cnt >= ans:
                        break
                    A = [sum(s_t[i] for i in m) for m in M]
                    if any(a > K for a in A):
                        cnt = ans + 1
                        break
            ans = min(cnt, ans)
        print(ans)

if __name__ == '__main__'
    main()

### FIXED CODE ###

from itertools import product

H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
S_T = [[int(s[w]) for s in S] for w in range(W)]
sumS = sum(map(sum, S_T))
ans = (H - 1) * (W - 1)

if sumS <= K:
    print(0)
else:
    for i in product([True, False], repeat=H-1):
        cnt = sum(i)
        if cnt >= ans:
            continue
        M = [[0]]
        for j, k in enumerate(i):
            if k:
                M.append([])
            M[-1].append(j+1)
        A = [0] * len(M)
        for s_t in S_T:
            for l, m in enumerate(M):
                A[l] += sum(s_t[i] for i in m)
            if any(a > K for a in A):
                cnt += 1
                if cnt >= ans:
                    break
                A = [sum(s_t[i] for i in m) for m in M]
                if any(a > K for a in A):
                    cnt = ans + 1
                    break
        ans = min(cnt, ans)
    print(ans)
c={
    'S':[1]*13,
    'H':[1]*13,
    'C':[1]*13,
    'D':[1]*13
}
n=int(input())
for i in range(n):
    a,b=input().split
    c[a][int(b)-1]=0
for i in ['S','H','C','D']:
    for j in range(13):
        if c[i][j]==1:
            print(i,j+1)




### FIXED CODE ###

c={
    'S':[1]*13,
    'H':[1]*13,
    'C':[1]*13,
    'D':[1]*13
}
n=int(input())
for i in range(n):
    a,b=input().split()
    c[a][int(b)-1]=0
for i in ['S','H','C','D']:
    for j in range(13):
        if c[i][j]==1:
            print(i,j+1)
import heapq
N = int(input()) 
V=list(map(int,input().split())) 
C= list(map(int,input().split())) 
a=[] 
for i in range(0,N): 
  if V[i]>=C[i]: 
    heapq.heappush(a,(V[i]-C[i])) 
 　else: 
    continue 
print(sum(a))

### FIXED CODE ###

N = int(input())
V=list(map(int,input().split()))
C= list(map(int,input().split()))
a=[]
for i in range(0,N):
  if V[i]>=C[i]:
    a.append(V[i]-C[i])
  else:
    continue
print(sum(a))
n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    ai = list(input())
    a.append(ai)
for i in range(m):
    bi = list(input())
    b.append(bi)

hidariue = b[0][0]
hasikouho = []
for i in range(n-m+1):
    for j in range(n-m+1):
        if a[i][j] == hidariue:
            hasikouho.append(str(i)+":"+str(j))

x = []

for v in hasikouho:
    ans = "Yes"
    i = int(v[0])
    j = int(v[2])
    for p in range(m):
        if ans == "Yes":
            for q in range(m):
                if a[i+p][j+q] != b[p][q]:
                    ans = "No"
                    break
        else:
            break
    x.append(ans)

if "Yes" in x:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    ai = list(input())
    a.append(ai)
for i in range(m):
    bi = list(input())
    b.append(bi)

hidariue = b[0][0]
hasikouho = []
for i in range(n-m+1):
    for j in range(n-m+1):
        if a[i][j] == hidariue:
            hasikouho.append([i,j])

x = []

for v in hasikouho:
    ans = "Yes"
    i = int(v[0])
    j = int(v[1])
    for p in range(m):
        if ans == "Yes":
            for q in range(m):
                if a[i+p][j+q] != b[p][q]:
                    ans = "No"
                    break
        else:
            break
    x.append(ans)

if "Yes" in x:
    print("Yes")
else:
    print("No")
n = int(input())
a = list(map(int,input().split()))

ttl = a[0]
cst = 0

if a[0]>0:
    flg = 1

elif a[0]<0:
    flg = -1

for i in range(1,n):
    ttl += a[i]
    

    if ttl*flg < 0:
        flg *= -1
    else:
        if flg > 0:
            memo = abs(ttl)+1
            ttl -= memo
            cst += memo
        elif flg < 0:
            memo = abs(ttl)+1
            ttl += memo
            cst += memo
        flg *= -1
    


ttl = a[0]
cst2 = 0

if a[0]>0:
    flg = -1
    cst2 += abs(ttl)+1
    ttl += 0-ttl-1 

elif a[0]<0:
    flg = 1
    cst2 += abs(ttl)+1
    ttl += 0-ttl+1 

for i in range(1,n):
    ttl += a[i]
    

    if ttl*flg < 0:
        flg *= -1
    else:
        if flg > 0:
            memo = abs(ttl)+1
            ttl -= memo
            cst2 += memo
        elif flg < 0:
            memo = abs(ttl)+1
            ttl += memo
            cst2 += memo
        flg *= -1
    print(cst2," ",ttl)





### FIXED CODE ###

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

def wh(cst,ttl,flg):
    for i in range(n):
        ttl += a[i]

        if ttl*flg < 0:
            flg *= -1
        else:
            if flg > 0:
                memo = abs(ttl)+1
                ttl -= memo
                cst += memo
            elif flg < 0:
                memo = abs(ttl)+1
                ttl += memo
                cst += memo
            flg *= -1

        
    return cst




ttl = 0
cst = 0



cst = wh(cst,ttl,1)
ttl = 0
cst2 = 0
cst2 = wh(cst2,ttl,-1)
   

print(min(cst,cst2))
a, b, c, d = map(int, input().split(""))
m = 100*a+10*b+c
n = 100*b+10*c+d
if m%111 == 0 or n%111 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
l = [int(s[i]) for i in range(4)]
a, b, c, d = map(int, l)
m = 100*a+10*b+c
n = 100*b+10*c+d
if m%111 == 0 or n%111 == 0:
  print("Yes")
else:
  print("No")
import sys
input = sys.stdin.readline
q = int(input())

p=1000003

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % p
    elif y % 2 == 0 : return power(x, y//2)**2 % p
    else            : return power(x, y//2)**2 * x % p
    
factorial_list=[1 for i in range(p)]
for i in range(1,p):
    factorial_list[i]=factorial_list[i-1]*i%p
    
inv_list=[1 for i in range(p)]
inv_list[-1]=factorial_list[-1]
for i in range(p-1,1,-1):
    inv_list[i-1]=inv_list[i]*i%p
    
for i in range(q):
    x,d,n=(int(i) for i in input().split())
    if d==0:
        ans=power(d,p-2)
        print(ans)
    elif x<=p*d<=x+(n-1)*d:
        print(0)
    else:
        x=x*power(d,p-2)%p
        ans=factorial_list[x+n-1]*inv_list[x-1]*power(d,n)
        print(ans%p)
        

### FIXED CODE ###

import sys
input = sys.stdin.readline
q = int(input())

p=1000003

flist=[1 for i in range(p)]
for i in range(1,p):
    flist[i]=flist[i-1]*i%p

for i in range(q):
  x,d,n=(int(i) for i in input().split())
  if d==0:
    ans=pow(x,n,p)
  else:
    x=x*pow(d,p-2,p)%p    
    if p<=x+n-1:
      ans=0
    else:
      ans=pow(d,n,p)*flist[x+n-1]*pow(flist[x-1],p-2,p)%p
  print(ans%p)
n,m = map(int,input().split())
s = []
c = []
while True:
  try:
    tmp = list(map(int,input().split()))
    s.append(tmp[0])
    c.append(tmp[1])
  except EOFError:
    break
  
for i in range(10**(n-1)-1,10**n):
  cnt =0
  tmp = str(i)
  for _ in range(len(c)):
    if tmp[s[_]-1]==str(c[_]):
      cnt +=1
  if cnt == len(c):
    print(i)
    exit()
print("-1")

### FIXED CODE ###

n,m = map(int,input().split())
s = []
c = []
while True:
  try:
    tmp = list(map(int,input().split()))
    s.append(tmp[0])
    c.append(tmp[1])
  except EOFError:
    break
if n == 1 and all(i == 0 for i in c):
  print(0)
  exit()
for i in range(10**(n-1),10**n):
  cnt =0
  tmp = str(i)
  for _ in range(len(c)):
    if tmp[s[_]-1]==str(c[_]):
      cnt +=1
  if cnt == len(c):
    print(i)
    exit()
print("-1")
a , b = map(int, input(),split())
Value = a*b

if Value%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a , b = map(int, input().split())
Value = a*b

if Value%2 == 0:
    print("Even")
else:
    print("Odd")
A=int(input())
X=int(input())

if X<A:
    print(0)
else:
    print(10)

### FIXED CODE ###

X,A=map(int, input().split())

if X<A:
    print(0)
else:
    print(10)
A,B =map(int,input())
if A-B == 0:
    print(A,"==",B)
elif A >= B:
    print(A,">",B)
else:
    print(A,"<",B)


### FIXED CODE ###

A,B =map(int,input().split())
if A-B == 0:
    print("a == b")
elif A >= B:
    print("a > b")
else:
    print("a < b")
n=input()
a=int(n[-1])
if a==2 or a==4 or a==5 or a ==7 or a==9:
  print('hon')
elif a==0 or a==1 or a==6 a==8:
  print('pon')
else:
  print('bon')

### FIXED CODE ###

n=input()
a=int(n[-1])
if a==2 or a==4 or a==5 or a ==7 or a==9:
  print('hon')
elif a==0 or a==1 or a==6 or a==8:
  print('pon')
else:
  print('bon')
n = [0]*3
for i in range(len(n)):
  n[i] = input()

n[0], n[1] = n[1], n[0]
n[0], n[2] = n[2], n[0]

print(n[0], n[1], n[2])

### FIXED CODE ###

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

a,b = b,a
a,c = c,a

print(a, b, c)
#firsts we declare string s and k, if character s is at most with char k, it will print char s, no change
#if s i more than k it
#time cpmlexity 0(1)


k = int(input())
s= input()

str = s

#if same, no change
if lens(s) == k:
                         print(s)

else:
         print (str[0:k] +"...")


### FIXED CODE ###

# Take both input K & S, then compare the length of S with K and assign it to length
# If the length is <= K print all
# And if length is >K print some of the character

K = int(input())
S = input()

x = 0

length = len(S)

if length <= K:
    print(S)
else:
    while x < K:
        print(S[x], end=(""))
        x += 1
    print("...")
N, A = map(int,input().split())
X = list(map(int,input().split()))

X = [int(x) - A for x in input().split()]
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1

for i in range(N):
  for j in range(50, 100*N+1-50):
    dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print(dp[N][50*N] - 1)


### FIXED CODE ###

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

X = [int(x) - A for x in input().split()]
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1

for i in range(N):
  for j in range(50, 100*N+1-50):
    dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print(dp[N][50*N] - 1)
S =str(input())
if len(S) % 2 == 1:
    a = 1
    b = int((len(S) - 1) / 2)
    while True:
        if S[b] == S[b + a] and S[b] == S[b - a]:
            a = a + 1
        else:
            break
    c = a + b
    print(c)
else:
    d = 1
    e = int(len(S) / 2 - 1)
    f = S[e]
    while True:
        if S[e + 1] == f:
            d = d + 1
            if S[e - d] == f and S[e + d + 1] == f:
                d = d + 1
            else:
                break
        else:
            break
    g = d + e
    print(g)

### FIXED CODE ###

S =str(input())
if len(S) % 2 == 1:
    a = 1
    b = int((len(S) - 1) / 2)
    while True:
        if b - a < 0:
            break
        if S[b] == S[b + a] and S[b] == S[b - a]:
            a = a + 1
        else:
            break
    c = a + b
    print(c)
else:
    d = 0
    e = int(len(S) / 2 - 1)
    f = S[e]
    if S[e + 1] == f:
        d = d + 1
    while True:
        if e - d < 0:
            break
        if S[e - d] == f and S[e + d + 1] == f:
            d = d + 1
        else:
            break
    g = d + e + 1
    print(g)
from fractions import gcd
n,k=map(int,input().split())
g=0
for a in map(int,input().split()):
    if(k==a):
        print("POSSIBLE")
        return
    g=gcd(g,a)

print("POSSIBLE" if(k%g==0) else "IMPOSSIBLE")

### FIXED CODE ###

from fractions import gcd
n,k=map(int,input().split())
g=0
m=0
for a in map(int,input().split()):
    g=gcd(g,a)
    m=max(m,a)

print("POSSIBLE" if(k%g==0 and k<=m) else "IMPOSSIBLE")
|AB|,|BC|,|CA|= map(int,input().split())
print(|AB|*|BC|/2)

### FIXED CODE ###

x,y,z= map(int,input().split())
print(int(x*y/2))
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
ret=float("inf")
print(min([abs(l[i]-l[i+k]) for i in range(n-k)]))

### FIXED CODE ###

n,k=map(int,input().split())
l=sorted([int(input()) for i in range(n)])
print(min([abs(l[i]-l[i+k-1]) for i in range(n-k+1)]))
N=int(input())
a=[int(x) for x in input().split()]
b=a
t=-1
s=0
while s==0:
  for i in range(N):
    if b[i]%2!=0:
      s=1
    b[i]=b[i]/2
    print(b)
  t=t+1
  print(t)
    
print(t)


### FIXED CODE ###

x=input()
X=list('{}'.format(x))
a=[]
for i in range(len(X)):
    a.append(int(X[i]))
A=sum(a)
print(A)
s = input()
t = input()
bool = 0
list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in list:
  if s+i==t:
    print("Yes")
    bool+=1
    break
if bool=0:
  print("No")

### FIXED CODE ###

s = input()
t = input()
bool = 0
list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in list:
  if s+i==t:
    print("Yes")
    bool+=1
    break
if bool==0:
  print("No")
X,Y = map(int, input().split())


count = 0

def dfs(x,y):
    global count
    if x==X and y==Y:
        count = count + 1
        return
    if x<0 or y<0 or x>=X or y>=Y:
        return
    
    dfs(x+1, y+2)
    dfs(x+2, y+1)

    return

dfs(0,0)
print(count%(10**9+7))

### FIXED CODE ###

X,Y = map(int, input().split())

if (X+Y)%3!=0:
    print(0)
    exit()

def mcomb(n, k):
    fac = [0] * (n + 1)
    fac[0] = 1
    for i in range(1, n + 1):
        fac[i] = fac[i - 1] * i % 1000000007


    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], 1000000005, 1000000007) * pow(fac[k], 1000000005, 1000000007) % 1000000007

N = (-1*X+2*Y)//3
M = (2*X-Y)//3
print(mcomb(N+M, N)%(10**9+7))
a,b,c=map(int, input())
print(c,a,b)

### FIXED CODE ###

a,b,c = map(int,input().split())

print(c,a,b)
import math


def inputIntList():
    return [int(s) for s in input().split()]


def inputInt():
    return int(input())


def main():
    N = inputInt()
    A = inputIntList()

    pattern = [0] * N
    pattern[0] = 3

    ret = 1
    for a in A:
        ret *= pattern[a]
        pattern[a] -= 1
        pattern[a + 1] += 1
        # print(pattern)
    return ret


if __name__ == "__main__":
    print(main())


### FIXED CODE ###

import math


def inputIntList():
    return [int(s) for s in input().split()]


def inputInt():
    return int(input())


def main():
    N = inputInt()
    A = inputIntList()

    pattern = [0 for _ in range(N + 1)]
    pattern[0] = 3

    ret = 1
    for a in A:
        ret *= pattern[a]
        pattern[a] -= 1
        pattern[a + 1] += 1
        # print(pattern)
    return ret % 1000000007


if __name__ == "__main__":
    print(main())
s = int()
t = int()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
print(c)

### FIXED CODE ###

s = input()
t = input()
c=0
if s[0]==t[0]:
  c = c + 1

if s[1]==t[1]:
  c = c + 1

if s[2]==t[2]:
  c = c + 1
  
print(c)
import math
a,b,x = [int(i) for i in input().split()]

if x <= (a**2*b)/2:
    height = x/(a*b)*2
    #余弦定理
    c = b**2 + height**2 - 2*b*height*math.cos(math.radians(90))
    h2 = b*height / math.sqrt(c)
    theta = math.degrees(math.asin(h2/height))
    print(theta)
else:
    square = a**2*b-(a**2*b - x)*2
    triangle = (a**2*b-x)
    ratio = square/triangle/2 + 1
    d = b/ratio
    height = triangle/(a*d)*2
    c = d**2 + height**2 - 2*d*height*math.cos(math.radians(90))
    h2 = d*height / math.sqrt(c)
    theta = math.degrees(math.asin(h2/height))
    print(theta)


### FIXED CODE ###

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

if x <= (a**2*b)/2:
    height = x/(a*b)*2
    #余弦定理
    c = b**2 + height**2 - 2*b*height*math.cos(math.radians(90))
    h2 = b*height / math.sqrt(c)
    theta = math.degrees(math.asin(h2/height))
    print(theta)
elif x < (a**2*b):
    square = a**2*b-(a**2*b - x)*2
    triangle = (a**2*b-x)
    ratio = square/triangle/2 + 1
    d = b/ratio
    height = triangle/(a*d)*2
    c = d**2 + height**2 - 2*d*height*math.cos(math.radians(90))
    h2 = d*height / math.sqrt(c)
    theta = math.degrees(math.asin(h2/height))
    print(theta)
else:
    print(0)
import math

# D - Maximum Average Sets
# 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d

# N:商品の数　A個以上B個以下の範囲で選ぶ
N, A, B = map(int, input().split())
# C：最大価値組み合わせ総数
C = 0

# 商品価値をリストに入れる
V = [int(value) for value in input().split()]
# 商品価値が高い順に並び替え
V.sort(reverse=True)

# 商品価値が高いものから出来るだけ少なく（＝A個）選ぶのが最も平均価値が高くなる
S = V[0:A]
ave = sum(S) / A
print(ave)

Vs = V.count(min(S)) # A個選んだ中で最も低い価値を持つ商品は、もともとの商品リストの中にいくつあるか
Ss = S.count(min(S)) # A個選んだ時中で最も低い価値を持つ商品はいくつあるか

if min(S) == max(S): # もしもA個選んだ中の商品価値が全て同じだったら
    i = A
    while i <= B and V[-i] == min(S):
        C = C + math.factorial(Vs) // ( math.factorial(Vs - i) * math.factorial(i))
        i += 1
    

else: # 商品価値が均一でなかったのなら
    # nCk = n! /( (n-k)! * k! )に基づきCを計算
    C = math.factorial(Vs) // (math.factorial(Vs - Ss) * math.factorial(Ss) )

print(C)


    


### FIXED CODE ###

# 元ソースコード：http://abc057.contest.atcoder.jp/submissions/1183710
# 初心者の実験用です

import math
N,A,B = map(int,input().split())
V = list(map(int,input().split()))
V.sort()
S = V[-A:]
avgmax = sum(S) / A
print(avgmax)
 
Vs = V.count(min(S))
Ss = S.count(min(S))
if min(S) != max(S):
	C = math.factorial(Vs) // (math.factorial(Vs -Ss) * math.factorial(Ss))
	print(C)
else:
	i = A
	C = 0
	while i <= B and V[-i] == min(S):
		c = math.factorial(Vs) // (math.factorial(Vs -i) * math.factorial(i))
		C = C + c
		i = i + 1
	print(C)
import collections as cl
mod = 10**9+7

def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return k
    else:
        return False

def Topo_sort(x,y):
    co = cl.Counter(n for m in x.values() for n in m)
    S = cl.deque([i for i in range(y) if co[i] == 0])
    while S:
        n = S.popleft()
        yield n
        for i in x[n]:
            co[i] -= 1
            if co[i] <= 0:
                S.append(i)
    ```
    if sum(co.values()) != 0:
        print(1)
        exit()
    else:
        print(0)
        exit()
    ```
    #閉路検出(1が存在,0が存在しない)
# g = cl.dafaultdict(set)に有向グラフを作成し(g[~] != ~ ,yはノード数) リストが帰ってくる





























### FIXED CODE ###

import collections as cl
def l(): #intのlist
    return list(map(int,input().split()))
def onem(): #Nとかの取得
    return int(input())
n = onem()

on = []
de = cl.deque()
ppp = [n-1 for i in range(n)]
for i in range(n):
    k = l()
    for j in range(n-1):
        k[j] -= 1
    k.reverse()
    de.append([k[0],i])
    on.append(cl.deque(k))


co = 1
ddd = cl.deque()
de.append([-1,-1])
ppppp = [1 for i in range(n)]
cl = ppppp[:]
while de:
    kkk = de.popleft()
    if kkk[0] == -1 and kkk[1] == -1:
        if sum(cl) == n:
            co = -1
            break
        if len(de) == 0:
            break
        de.append([-1,-1])
        co += 1
        cl = ppppp[:]

    elif ppp[kkk[0]] != 0 and on[kkk[0]][0] == kkk[1] and cl[kkk[0]] and cl[kkk[1]]:
        cl[kkk[0]] = 0
        cl[kkk[1]] = 0
        on[kkk[0]].popleft()
        on[kkk[1]].popleft()
        ppp[kkk[0]] -= 1
        ppp[kkk[1]] -= 1
        if ppp[kkk[1]] != 0 != 0 and ppp[kkk[0]] != 0 and on[kkk[1]][0] == kkk[0] and on[kkk[0]][0] == kkk[1]:
            de.append([on[kkk[1]][0],kkk[1]])
        else:
            if len(on[kkk[1]]) != 0:
                de.append([on[kkk[1]][0],kkk[1]])
            if len(on[kkk[0]]) != 0:
                de.append([on[kkk[0]][0],kkk[0]])


print(co)
import itertools

R, G, B, N = [int(x) for x in input().split()]
#RGB = sorted([R, G, B], reverse=True)
RGB = [R, G, B]

cnt = 0
r_range = N//RGB[0]+1
for i in range(N//RGB[0]+1):
    g_range = (N - RGB[0]*i)//RGB[1]+1
    for j in range(g_range):
        rem = N - (RGB[0]*i) - (RGB[1]*j)
        if rem >= 0:
            num = rem // RGB[2]
            if rem == 0 or rem % (RGB[2]*num) == 0:
                cnt += 1
print(cnt)

### FIXED CODE ###

#  B
import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = [R, G, B]

cnt = 0
for i in range(N//R+1):
    g_range = (N - RGB[0]*i)//RGB[1]
    for j in range((N-R*i)//G+1):
        if R*i + G*j > N:
            continue
        rem = N - R*i - G*j
        if rem % B == 0: 
            cnt += 1
print(cnt)
import re
 
if re.match(r'^(hi)+$',S):
  print('Yes')

else:
  print('No')

### FIXED CODE ###

import re

S = input() 

if re.match(r'^(hi)+$',S):
  print('Yes')

else:
  print('No')
N,M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        t=[k[j:j*m] for k in a[i:i+m]]
        if t==B:
            print('Yes')
            exit()
print('No')


### FIXED CODE ###

A,B=map(int, input().split())
if A==1:
    A=14
if B==1:
    B=14
if A>B:
    print('Alice')
elif A==B:
    print('Draw')
else:
    print('Bob')
H = int(input())

s = 1
count = 0
while H > 0:
	count += n
	H //= 2
	s *= 2

print(count)


### FIXED CODE ###

H = int(input())

s = 1
count = 0
while H > 0:
	count += s
	H //= 2
	s *= 2

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

if(m==1):
    print(0)

else:
    li_X.sort()

    li_X_delta = []
    for i in range(len(li_X)-1):
        li_X_delta.append(li_X[i+1]-li_X[i])

    li_X_delta_sorted_rev = sorted(li_X_delta, reverse=True)
    path_ignorable = []
    cnt = 0

    for i in range(n-1):
        path_ignorable.append(li_X_delta.index(li_X_delta_sorted_rev[cnt]))
        cnt += 1
    # ignore path from li_X[i] to li_X[i+1] for i in path_ignorable
    
    ans = 0
    for i in range(len(li_X_delta)):
        if(i in path_ignorable):
            continue
        ans += li_X_delta[i]
    print(ans)

### FIXED CODE ###

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

li_X.sort()
li_X_delta = []
for i in range(len(li_X)-1):
    li_X_delta.append(li_X[i+1]-li_X[i])
li_X_delta.sort(reverse=True)
cnt = 0

ans = li_X[-1] - li_X[0]
for i in range(min(n-1, len(li_X_delta))):
    ans -= li_X_delta[i]
print(ans)
s = input()

if s == "ABC":
  ans = "ARC"
else:
  ans = "ABC"
  
 print(ans)


### FIXED CODE ###

s = input()

if s == "ABC":
  ans = "ARC"
else:
  ans = "ABC"
  
print(ans)
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]

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

for i in range(1, N+1):
    for j in range(H+1):
        a, b = ab[i-1]
        if j < a:
            dp[j] = min([dp[0]+b, dp[j]])
        else:
            dp[j] = min([dp[j-a]+b, dp[j]])
print(dp[N][H])


### FIXED CODE ###

H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]

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

for i in range(1, N+1):
    for j in range(H+1):
        a, b = ab[i-1]
        if j < a:
            dp[j] = min([dp[0]+b, dp[j]])
        else:
            dp[j] = min([dp[j-a]+b, dp[j]])
print(dp[H])
import math import sqrt
a, b = input().split()
if sqrt(int(a+b)) % 1 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b=map(int,input().split())
if (a)%2 == 0:
  print("Even")
elif (b)%2 == 0:
	print("Even")
else:
  print("Odd")