Harryxun/stf_run huggingface dataset:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result




N,M = input().split()

N = int(N)
M = int(M)

a = []
ans = 1

for i in range(M):
    newa = int(input())
    a.append(newa)


for k in range(M-1):
    if (a[k+1] - a[k] == 1):
        ans = 0
            
    
    
for i in range(M + 1):
    

    if (i == 0):
        dan = a[i] - 1
    elif (i == M):
        dan = N - a[i - 1] - 1
    else:
        dan = a[i] - a[i - 1] - 2

    abletwo = (dan - (dan % 2)) // 2
    now = 0

    for j in range(abletwo + 1):

        now += cmb (dan - j , j )
        #print (dan,"dan j",j,cmb (dan - j , j ))

    ans *= now
    #print (now)

ans = ans % 1000000007
print (ans)

### FIXED CODE ###


N, M = input().split()

N = int(N)
M = int(M)
a = []
c = []

for i in range(M):

    anew = int(input())
    a.append(anew)

now_a = 0
a.append(-1)
ans = 0

for i in range( N + 1 ):

    if (i == 0):
        c.append(1)
        
    elif (i == 1):

        if (a[now_a] == i):
            c.append(0)
            now_a += 1
        else:
            c.append(1)

    else:

        if (a[now_a] == i):
            c.append(0)
            now_a += 1
        else:
            c.append( c[i - 1] + c[i - 2])
        

ans = c[N] % 1000000007

print (ans)
n,k = map(int, input().split())
ans = 2*k+1
if ans > n:
  print(“NO”)
else:
  print(“YES”)


### FIXED CODE ###

n,k = map(int, input().split())
ans = 2*k-1
if n < ans:
  print('NO')
else:
  print('YES')
import sys
from math import sqrt

nyu = sys.stdin.read()
nyu = nyu.split("\n")
cheese = map(float,nyu[0].split())
cheese.sort()
supk = sqrt((cheese[0]/2)**2 + (cheese[1]/2)**2)
nyu = map(int,nyu[2:])
try:
	for k in nyu:
		if k < supk: print "OK"
		else: print "NA"
except:
	pass

### FIXED CODE ###

from math import sqrt

while True:
    inp = raw_input()
    if inp == "0 0 0": break
    cs = map(int,inp.split())
    cs.sort()
    c = sqrt(cs[0]**2 + cs[1]**2)/2

    n=int(raw_input())

    for gomi in xrange(n):
        r = int(raw_input())
        if c<r: print "OK"
        else: print "NA"
A, B, K = [int(i) for i in input().split()]
if K <= A:
    a = A-K
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)


### FIXED CODE ###

A, B, K = [int(i) for i in input().split()]
if K <= A:
    a = A-K
    b = B
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)
n=input()
print(999-((n-1)%1000))

### FIXED CODE ###

n=int(input())
print(999-((n-1)%1000))
import numpy
n,d = map(int,input().split())
a=[]
b=[]
cnt = 0
for i in range(n):
    a[i],b[i] = map(int,input().split())
    if numpy.sqrt(a[i]**2+b[i]**2)<=d:
        cnt += 1
print("{}".format(cnt))

### FIXED CODE ###

n,d = map(int,input().split())
a=[]
b=[]
cnt = 0
for i in range(n):
    c, e = map(int,input().split())
    if c**2+e**2<=d**2:
        cnt += 1
print("{}".format(cnt))
S=input()
if S==AAA or S==BBB:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

S=input()
if S=="AAA" or S=="BBB":
  print("No")
else:
  print("Yes")
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

from itertools import accumulate

A = list(accumulate(A))
B = list(accumulate(B[::-1]))[::-1]

ans = 0
for i in range(n):
  ans = max(A[i]+B[i])
print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

from itertools import accumulate

A = list(accumulate(A))
B = list(accumulate(B[::-1]))[::-1]



ans = 0
for i in range(n):
  ans = max(A[i]+B[i], ans)
print(ans)
S = input()
T = input()

min = length(T)

for index in range( length(S)-length(T)+1 ):
  temp = 0
  for index2 in range(T):
    if T[index2] == S[index+index2]:
      temp += 1
  if temp < min:
    min = temp

print(min)

### FIXED CODE ###

S = input()
T = input()

min = len(T)

for index in range( len(S)-len(T)+1 ):
  temp = 0
  for index2 in range(len(T)):
    if T[index2] != S[index+index2]:
      temp += 1
  if temp < min:
    min = temp

print(min)
def Repsept():
    
    num = int(input())

    mod_value = 1

    count = 1

    if num % 2 != 0:

        while mod_value != 0:
            value = 7*(pow(10, count)-1)/9.
            
            mod_value = value % num
            
            if mod_value != 0:
                count = count + 1

        print(count)
        
    else:
    
        print(-1)

if __name__ == '__main__':
    Repsept()



### FIXED CODE ###

def Repsept():
    
    num = int(input())

    f=0
    n=num
    
    for i in range(10**6+1):
      if n==0:
        f=1
        print(i)
        break
      n=((n*10)+7)%num
    if f==0:
      print(-1)


if __name__ == '__main__':
    Repsept()
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
  dp[i]=a.count(i)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in a:
  dp[i]+=1

for j in range(q):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)
MN = 100000
prime = []
mem = [False] * 2 + [True] * MN
for i in range(2, MN):
  if not mem[i]:
    continue
  prime.append(i)
  for j in range(i + i, MN, i):
    mem[j] = False

while True:
  N, ans = input(), 0
  if not N:
    break

  for p in prime:
    if p > N / 2:
      break
    if mem[N - p]:
      ans += 1
  print(ans)

### FIXED CODE ###

MN = 1000000
prime = []
mem = [False] * 2 + [True] * MN
for i in range(2, MN):
  if not mem[i]:
    continue
  prime.append(i)
  for j in range(i + i, MN, i):
    mem[j] = False

while True:
  N, ans = input(), 0
  if not N:
    break

  for p in prime:
    if p > N / 2:
      break
    if mem[N - p]:
      ans += 1
  print(ans)
import sys,math
def input():
    return sys.stdin.readline()[:-1]


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

t = x/(a**2)
half = b/2
if t<half:
    a_2 = x/b
    b_2 = b
else:
    a_2 = a
    b_2 = (b-t)*2
c = (a_2**2+b_2**2)**0.5
cos1 = (a_2**2+c**2-b_2**2)/(2*a*c)
print(math.degrees(math.acos(cos1)))

### FIXED CODE ###

import sys,math
def input():
    return sys.stdin.readline()[:-1]


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

t = x/(a**2)
half = b/2
if t<half:
    a_2 = ((x/a)/b)*2
    b_2 = b
else:
    a_2 = a
    b_2 = (b-t)*2
c = (a_2**2+b_2**2)**0.5
cos1 = ((a_2**2)+(c**2)-(b_2**2))/(2*a_2*c)
print(math.degrees(math.acos(cos1)))
n = int(input())
h = list(map(lambda x: int(x), input().split(" ")))

ans = 0

for i in range(0,n):
	kari = 0
	for j in range(i,n):
		if h[j] < h[j+1]:
			break
		kari += 1
	if ans < kari:
		ans = kari

print(ans)

### FIXED CODE ###

n = int(input())
h = list(map(lambda x: int(x), input().split(" ")))

ans = 0

kari = 0
i = 0
for m in range(0,n-1):
	if h[m] >= h[m+1]:
		kari += 1
	else:
		kari = 0
	if ans < kari:
		ans = kari



print(ans)
sum = 0
if K>0:
    if A>0:
        if A>K:
            sum = sum + K
        else:
            sum = sum + A
    K = K - A
if K > 0:
    if B>0:
        K = K - B
if K > 0:
    if C>0:
        sum = sum + K * (-1)
print(sum)

### FIXED CODE ###

a, b, c, k = map(int, input().split())
ans = 0
if k <= a:
    print(k)
else:
    k -= a
    ans += a
    if k <= b:
        print(ans)
    else:
        k -= b
        ans += -1 * k
        print(ans)
n = int(input())
in_list = []
for i in range(n):
    in_list.append(list(map(int, input().split())))

matrices = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    inp = in_list[i]
    u = inp[0]
    k = inp[1]
    for j in range(k):
        m = inp[j+2]
        matrices[i][m-1] = 1

for i in range(n):
    s = ""
    for m in matrices[i]:
        s += str(m) + " "
    print(s)


### FIXED CODE ###

n = int(input())
in_list = []
for i in range(n):
    in_list.append(list(map(int, input().split())))

matrices = [["0" for _ in range(n)] for _ in range(n)]

for i in range(n):
    inp = in_list[i]
    u = inp[0]
    k = inp[1]
    for j in range(k):
        m = inp[j+2]
        matrices[i][m-1] = "1"

for i in range(n):
    print(" ".join(matrices[i]))
import collections
n = int(input())
v = list(map(int,input().split()))

out=0
ki,gu=[], []
for i in range(n):
    if i%2==0:
        ki.append(v[i])
    else:
        gu.append(v[i])
# print('ki,gu:',ki,gu)

if len(set(v)) ==1:  #1種類
    out=len(v)//2

else:
    kiC, guC = collections.Counter(ki), collections.Counter(gu)
    kiI, guI = list(kiC.keys()), list(guC.keys())
    kiV, guV = list(kiC.values()), list(guC.values())
    if max(kiC.values()) == max(guC.values()):
        kiV, guV = sorted(kiV), sorted(guV)
        out = min(len(ki) - kiV[-1] +  len(gu) - guV[-2], len(ki) - kiV[-2] + len(gu) - guV[-1] )
    # print(kiC,kiV, guC,guV
    else:
        out+=len(ki) - max(kiV)
        out+=len(gu) - max(guV)

print(out)

### FIXED CODE ###

import collections
n = int(input())
v = list(map(int,input().split()))

out=0
ki,gu=[], []
for i in range(n):
    if i%2==0:
        ki.append(v[i])
    else:
        gu.append(v[i])
# print('ki,gu:',ki,gu)

if len(set(v)) ==1:  #1種類
    out=len(v)//2

else:
    kiC, guC = collections.Counter(ki), collections.Counter(gu)
    kiI, guI = list(kiC.keys()), list(guC.keys())
    kiV, guV = list(kiC.values()), list(guC.values())
    if max(kiC, key=kiC.get) == max(guC, key=guC.get):
        kiV, guV = sorted(kiV), sorted(guV)
        out = min(len(ki) - kiV[-1] +  len(gu) - guV[-2], len(ki) - kiV[-2] + len(gu) - guV[-1] )
    # print(kiC,kiV, guC,guV
    else:
        out+=len(ki) - max(kiV)
        out+=len(gu) - max(guV)

print(out)
k = int(input())
n = k+1

A = [0]*n
A[0] = (n-1)+n*k
print(n)
print(*A)


### FIXED CODE ###

k = int(input())
n = 50

q, r = divmod(k, n)
A = [n-1]*n
for i in range(n):
    A[i] += q

for i in range(r):
    A[i] += n+1
    for j in range(n):
        A[j] -= 1

print(n)
print(*A)
from itertools import product

H, W, K = map(int, input().split())

C = [list(input()) for _ in range(H)]

ans = 0

for row_bit in product(range(2), repeat = H):
    for col_bit in product(range(2), repeat = W):
        cnt = 0
        for row in range(H):
            for col in range(W):
                if c[row][col] == '#' and (row_bit[row] and col_bit[col]):
                    cnt += 1
            if cnt = K:
                ans += 1
print(ans)

### FIXED CODE ###

from itertools import product

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if c[row][col] == "#" and (row_bit[row] and col_bit[col]):
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for k in range(n)]
 
count=0
 
for i in range(n):
  absum=0
  for j in range(m):
    absum +=a[i][j]*b[j]
   
  ans=absum+c
  if ans>0:
    count+=1
      
print(count)

### FIXED CODE ###

H,W = map(int,input().split())

h,w = map(int,input().split())

print((H-h)*(W-w))
memo = {}

def starsFib(n,a):
    if n == 1:
        return 1
    elif n == 2:
        return 2

    elif n in a:
        return 0
    else:
        memo[n] = starsFib(n-1,a) + starsFib(n-2,a)
        return memo[n]

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

    all = starsFib(n,a)

    ans = all % 1000000007

    print(ans)

if __name__ == '__main__':
    run()


### FIXED CODE ###

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

mod = 10**9+7
dp = [-1]*(n+1)
dp[0] = 1
dp[1] = 1

for i in a:
    dp[i] = 0

for i in range(2, n+1):
    if dp[i] < 0:
        dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[n])
k = int(input())
if k%2 =0:
  print((k/2)**2)
else:
  print(((k+1)/2)*((k-1)/2))

### FIXED CODE ###

k = int(input())
if k%2 ==0:
  print((k//2)*(k//2))
else:
  print(((k+1)//2)*((k-1)//2))
a, b = map(int, input().split())
x_min = max(int(100/8 * a), int(100/10 * b))
x_max = min(int(100/8 * (a+1)), int(100/10 * (b+1)))
if int(100/8 * a) < int(100/10 * (b+1) and int(100/10 * b) < int(100/8 * (a+1)):
    print(x_min)
else:
    print(-1)


### FIXED CODE ###

a, b = map(int, input().split())
ass = 1 if ((100/8 * (a+1))-int(100/8 * (a+1))) else 0
asss = 1 if ((100/8 * a)-int(100/8 * a)) else 0
bss = 1 if ((100/10 * (b+1))-int(100/10 * (b+1))) else 0
bsss = 1 if ((100/10 * b)-int(100/10 * b)) else 0
As = set(range(int(100/8 * a)+asss, int(100/8 * (a+1))+ ass))
Bs = set(range(int(100/10 * b)+bsss, int(100/10 * (b+1))+bss))
if As & Bs:
    print(min(As&Bs))
else:
    print(-1)
n,m = map(int,input().split())
if (n*m)%2 ==0:
          print("Even")
else:
          print(Odd)

### FIXED CODE ###

n,m = map(int,input().split())
if (n*m)%2 ==0:
          print("Even")
else:
          print("Odd")
A=input()
B=input()
print(6-A+B)

### FIXED CODE ###

a=int(input())
b=int(input())
print(6-a-b)
k=int(input())
if k=25:
  print("Christmas")


### FIXED CODE ###

k=int(input())
if k==25:
  print("Christmas")
if k==24:
  print("Christmas Eve")
if k==23:
  print("Christmas Eve Eve")
if k==22:
  print("Christmas Eve Eve Eve")
N,A,B=map(int,input().split())
ab='u'*A+'r'*B
S=ab*1000
S4ans=S[:N-1]
print(S4ans.count('u'))

### FIXED CODE ###

N,A,B=map(int,input().split())
full=N//(A+B)
rest=N%(A+B)
if rest <=A:
    print(full*A+rest)
    exit()
else:
    print(full*A+A)
    exit()
a = int(input())
s = input()

if >= 3200:
  print(s)
else:
  print('red')

### FIXED CODE ###

a = int(input())
s = input()
 
if a >= 3200:
  print(s)
else:
  print('red')
from scipy.special import comb

N = int(input())
temp = input().split()
A = {}
for i in range(0, N):
    A[i] = temp[i]

B = {}
for i in range(0, N):
    if not(A[i] in B.keys()):
        B[A[i]] = 1
    else:
        B[A[i]] += 1 

for i in range(0, N):
    B[A[i]] -= 1
    S = 0    
    for value2 in B.values():
        S = S + comb(int(value2), 2, exact=True)
    print(S)
    B[A[i]] += 1

### FIXED CODE ###

from scipy.misc import comb

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

B = {}
for i in range(0, N):
    if not(A[i] in B.keys()):
        B[A[i]] = 1
    else:
        B[A[i]] += 1 

S = 0
for value2 in B.values():
    S = S + comb(int(value2), 2, exact=True)

S0 = 0
for i in range(0, N):
    S0 = S - (comb(int(B[A[i]]), 2, exact=True) - comb(int(B[A[i]])-1, 2, exact=True))
    print(S0)
N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = sum(a)

if sum > N:
  print(-1)
else:
  print(N-sum)

### FIXED CODE ###

N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = 0
# sum = sum(a)
for item in a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)
b = list(map(int, input().split()))
codes = [list(map(int, input().split())) for _ in range(N)]

res = 0
for code in codes:
    s = C    
    for i in range(M):
        s += (code[i] * b[i])
    if s > 0:
        res += 1

print(res)


### FIXED CODE ###

N, M, C = map(int, input().split())
b = list(map(int, input().split()))
codes = [list(map(int, input().split())) for _ in range(N)]

res = 0
for code in codes:
    s = C
    
    for i in range(M):
        s += (code[i] * b[i])

    if s > 0:
        res += 1

print(res)
n,k = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
print(sum(li[:k])

### FIXED CODE ###

n,k = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
print(sum(li[:k]))
#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(N + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(2,N+1):
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
for i in range(dp[N]-1):
    b=-1
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] == k-1:
            b=max(b,a)
    k-=1
    n-=Cost[b]
    buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)
print("".join(map(str,buf)))







### FIXED CODE ###

#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(10**4 + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(2,N+1):
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
for i in range(dp[N]-1):
    b=-1
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] == k-1:
            b=max(b,a)
    k-=1
    n-=Cost[b]
    buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)   
print("".join(map(str,buf)))
A=chr(input())
print(chr(B+1))

### FIXED CODE ###

A=ord(input())
print(chr(A+1))
N = input()
K = input()
mod = N%K
if mod=0:
  print"0"
else:
  print"1"


### FIXED CODE ###

N, K = map(int, input().split())
if N%K == 0:
  print(0)
else:
  print(1)
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N, X = map(int,(input().split()))
x = list(map(int,input().split()))
x_min = min(x)

x_0 = [x_- x_min for x_ in x]

ans = gcd_list(x_0)

if N==1:
    ans = abs(x[0] - X)

print(ans)

### FIXED CODE ###

import fractions as math

N, X = map(int,(input().split()))
x = list(map(int,input().split()))
x.append(X)
x_min = min(x)

x_0 = [x_- x_min for x_ in x]

gcd = x_0[0]
for x_0_ in x_0:
    gcd = math.gcd(gcd,x_0_)

print(gcd)
n = int(input())

lastch = ''
answer = 'No'
words = []

for i in range(n):
    word = input()[0:-1]
    words.append(word)
    if lastch == word[0] and i != 0:
        answer = 'Yes'
    else:
        answer = 'No'
    lastch = word[-1]

print('Yes' if len(words) == len(set(words)) and answer == 'Yes' else 'No')


### FIXED CODE ###

n = int(input())

lastch = ''
answer = 'Yes'
words = []
for i in range(n):
    word = list(input())
    words.append(''.join(word))
    if lastch != word[0] and i != 0:
        answer = 'No'
    lastch = word[-1]

if len(set(words)) != len(words):
    answer = 'No'

print(answer)
import sys
A, B, K = map(int, input().split())
box = list(range(A, B+1))
if K >= 2*len(box):
    box.sort()
    print(box)
    sys.exit()
box.sort()
res = set()
for i in range(K):
    res.add(box[i])
box.reverse()
for i in range(K):
    res.add(box[i])
res = list(res)
res.sort()
print(res)

### FIXED CODE ###

A, B, K = map(int, input().split())
L = [A+i for i in range(K) if A+i <= B]
R = [B-i for i in range(K) if B-i >= A]
S = set(L+R)
S = sorted(S)
for v in S:
    print(v)
W, a, b = map(int, input().split())

if a + W < b:
    print(b - a - W)
elif a + W == b:
    print(0)
elif (b < a + W) & (a < b):
    print(0)
elif a == b:
    print(0)
elif b < a:
    print(0)
elif a == b + W:
    print(0)
elif b + W < a:
    print(a - b - W)
else:
    pass


### FIXED CODE ###

a, b = map(str, input().split())

if a == b:
    print("H")
elif not a == b:
    print("D")
n=input()
satis=[]
 
for i in range(n):
	satis.append(map(int,input().split()))
 
#n=3
#satis=[10, 40, 70, 20, 50, 80, 30, 60, 90]
 
tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
   print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))

### FIXED CODE ###

n=int(input())
satis=[]

for i in range(n):
  A=list(map(int,input().split()))
  satis.extend(A)

tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
  print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))
N,M=map(int,input().split())
A=[int(input()) for __ in range(M)]
ans=[0]*N

if 1 in A:
    ans[0]=0
    ans[1]=1
else:
    ans[0]=1
    ans[1]=2

for n in range(N):
    if n>1:
        if n+1 in A and n in A:
            print(0)
            break
        elif n+1 in A:
            ans[n]=0
        else:
            ans[n]=ans[n-1]+ans[n-2]
            ans[n] %= 10**9+7
else:
    print(ans[N-1])


### FIXED CODE ###

N,M=map(int,input().split())
A=set([int(input()) for __ in range(M)])
ans=[0]*(N+1)
ans[0] = 1

if 1 in A:
    ans[1]=0
else:
    ans[1]=1

for n in range(N+1):
    if n>1:
        if n-1 in A and n in A:
            print(0)
            break
        elif n in A:
            ans[n]=0
        else:
            ans[n]=(ans[n-1]+ans[n-2]) % 1000000007
else:
    print(ans[N])
N=int(input())
a=list(map(int, input().split()))
Flag=True

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    if N!=3:
      for i in range(0,N-2):
        if Flag==True:
          if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
            Flag=False
            break  
      if Flag==True:
        print("Yes")
      else:
        print("No")
    else:
      if bin(a[0] ^ a[2]) == bin(a[1]):
        print("Yes")
      else:
        print("No")
  else:
    print("No")    
else:
  print("No")

### FIXED CODE ###

from collections import Counter,OrderedDict

N=int(input())
a=list(map(int,input().split()))
d=OrderedDict(Counter(a))
e=list(d)
e.sort()

if len(d)>3:
    ans="No"
else:
    ans="No"
    if len(d)==1:
        if e[0]==0:
            ans="Yes"
    elif len(d)==2:
        if N%3==0:
            if e[0]==0 and d[0]==N//3 and d[e[1]]==2*N//3:
                ans="Yes"
    else:
        if N%3==0:
            if d[e[0]]==d[e[1]]==d[e[2]]:
                if e[0]^e[1]^e[2]==0:
                    ans="Yes"
                   
print(ans)
def isPalindrome(s):
  return s == s[::-1]

s = input()
n = len(s)
return isPalindrome(s) and isPalindrome(s[:n//2+1]) and isPalindrome(s[n//2+2:])

### FIXED CODE ###

def isPalindrome(s):
  return s == s[::-1]
 
s = input()
n = len(s)
res =  isPalindrome(s) and isPalindrome(s[:n//2]) and isPalindrome(s[n//2+1:])
print("Yes" if res else "No")
import heapq

mod = 998244353

def dfs(v: int, child) -> int:
  res = 1
  for u in child[v]:
    res = res * dfs(u, child) % mod
  return res + 1

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort()
child = [[] for _ in range(n)]

root = []
for i in range(n-1, -1, -1):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      child[i].append(r[1])
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
for r in root:
  count = count * dfs(r[1], child) % mod
print(count)

### FIXED CODE ###

import heapq

mod = 998244353

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort(reverse=True)
parent = list(range(n))

root = []
for i in range(n):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      parent[r[1]] = i
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
dp = [1] * n
for i in range(n):
  p = parent[i]
  if p == i:
    count = count * (dp[i] + 1) % mod
  else:
    dp[p] = dp[p] * (dp[i] + 1) % mod
print(count)