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

import sys

# import re
import math
import collections
# import decimal
import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = list(input())
    target = ["A", "B", "C"]
    next = ["B", "C", "A"]

    idx = 0
    ans = 0
    while len(s) - 3 >= idx:
        flg = True
        for i in range(3):
            if s[idx + i] != target[i]:
                flg = False
                break

        if flg:
            for i in range(3):
                s[idx + i] = next[i]
            idx = max(0, idx - 1)
            ans += 1
            continue
        else:
            idx += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = list(input())
    target = ["A", "B", "C"]
    next = ["B", "C"]

    idx = 0
    ans = 0
    a_cnt = 0

    while len(s) - 3 >= idx:
        if [s[idx], s[idx + 1], s[idx + 2]] == target:
            ans += a_cnt
            ans += 1
            a_cnt += 1

            idx += 3
            while len(s) - 3 >= idx:
                if [s[idx], s[idx + 1], s[idx + 2]] == target:
                    ans += a_cnt + 1
                    idx += 3
                    a_cnt += 1
                else:
                    break

            while len(s) - 2 >= idx:
                if [s[idx], s[idx + 1]] == next:
                    ans += a_cnt
                    idx += 2
                else:
                    break

        elif s[idx] != "A":
            a_cnt = 0
            idx += 1
        elif s[idx] == "A":
            a_cnt += 1
            idx += 1

    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
s=0
for i in range(q):
    if T[i] in S:
        s+=1
print(s)


### FIXED CODE ###

n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
s=0
S.append(10**10)
for i in range(q):
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if S[m]>T[i]:
            r=m
        else:
            l=m
    if S[l]==T[i]:
        s+=1    
print(s)
### BUGGY CODE ###

N = int(input())
S = [input() for _ in range(N)]

ans = 0
for i in range(N):
    ans += 1
    s = S[i]
    for j in range(i):
        if s == S[j]:
            ans -= 1
            break
print(ans)

### FIXED CODE ###

N = int(input())
rewards = set()
for _ in range(N):
    rewards.add(input())
print(len(rewards))
### BUGGY CODE ###

a, b, c, k = map(int, input().split())
li_card = []
for i in range(a):
  li_card.append(1)
for i in range(b):
  li_card.append(0)
for i in range(c):
  li_card.append(-1)

li_select = li_card[0:k]

print(sum(li_select))

### FIXED CODE ###

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

if a >= k:
  a = k
  b = 0
  c = 0
if a < k and a+b >= k:
  c = 0
if a+b < k:
  c = k - a - b
  
sum_a = 1 * a
sum_c = -1 * c
  
print(sum_a + sum_c)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys

N,M=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()

L=[]    #答えの集合
i=N
end=False
for _ in range(N):
    if end: break
    for m in range(M,-1,-1):
        #print m,i+m
        if 0<=i-m and S[i-m]=="0":
            L.append(m)
            i-=m
            if i==0: end=True
            break
        
if i!=0:
    print -1
else:
    print " ".join(map(str,L[::-1]))


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N,M=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()

L=[]    #答えの集合
for _ in range(N):
    for m in range(M,0,-1):
        if 0<=N-m and S[N-m]=="0":
            L.append(m)
            N-=m
            break
    else:
        break
        
if N!=0:
    print -1
else:
    print " ".join(map(str,L[::-1]))
### BUGGY CODE ###

import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())

for i in range(Q):
    B, C = map(int, input().split())
    if B not in A:
        print(np.sum(A))
    else:
        A = np.where(A==B, C, A)              
        print(np.sum(A))

### FIXED CODE ###

from collections import Counter as cnt
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = sum(A)
D = cnt(A)

for i in range(Q):
    B, C = map(int, input().split())
    S = S+(C-B)*D[B]
    print(S)
    D[C] += D[B]
    D[B] = 0
### BUGGY CODE ###

H, W, *SS = open(0).read().split()
H, W = int(H), int(W)

R = [[0]*(W) for _ in [0]*(H)]
C = [[0]*(W) for _ in [0]*(H)]

for i, S in enumerate(SS):
    cnt = 0
    pre = S[0]
    for j, s in enumerate(S):
        if s == '.':
            cnt += 1
        else:
            if pre == '.':
                for k in range(1, cnt+1):
                    R[i][j-k] = cnt
                cnt = 0
        pre = s
    if pre == '.':
        for k in range(1, cnt+1):
            R[i][-k] = cnt

for j in range(W):
    cnt = 0
    pre = SS[0][j]
    for i in range(H):
        s = SS[i][j]
        if s == '.':
            cnt += 1
        else:
            if pre == '.':
                for k in range(1, cnt+1):
                    C[i-k][j] = cnt
                cnt = 0
        pre = s
    if pre == '.':
        for k in range(1, cnt+1):
            C[-k][j] = cnt

ans = 0
for i in range(H):
    for j in range(W):
        if R[i][j] and C[i][j]:
            area = R[i][j]+C[i][j]-1
            if ans < area:
                ans = area
print(ans)

### FIXED CODE ###

H, W, *SS = open(0).read().split()
H, W = int(H), int(W)

R = [[0]*(W) for _ in [0]*(H)]
C = [[0]*(W) for _ in [0]*(H)]

for i, S in enumerate(SS):
    cnt = 0
    pre = S[0]
    for j, s in enumerate(S):
        if s == '.':
            cnt += 1
        else:
            if pre == '.':
                for k in range(1, cnt+1):
                    R[i][j-k] = cnt
                cnt = 0
        pre = s
    if pre == '.':
        for k in range(1, cnt+1):
            R[i][-k] = cnt

for j in range(W):
    cnt = 0
    pre = SS[0][j]
    for i in range(H):
        s = SS[i][j]
        if s == '.':
            cnt += 1
        else:
            if pre == '.':
                for k in range(1, cnt+1):
                    C[i-k][j] = cnt
                cnt = 0
        pre = s
    if pre == '.':
        for k in range(1, cnt+1):
            C[-k][j] = cnt

ans = 0
for i in range(H):
    for j in range(W):
        if R[i][j] and C[i][j]:
            area = R[i][j]+C[i][j]-1
            if ans < area:
                ans = area
print(ans)
### BUGGY CODE ###

import heapq

tmp = list(map(int, input().split()))
n = tmp[0]
m = tmp[1]
a = list(map(int, input().split()))

ha = []
for i in range(n):
  heapq.heappush(ha, a[i])

for j in range(m):
  tmp = list(map(int, input().split()))
  b = tmp[0]
  c = tmp[1]

  for k in range(b):
    if ha[0] < c:
      heapq.heappop(ha)
      heapq.heappush(ha, c)
    else:
      break

print(sum(ha))  

### FIXED CODE ###

import heapq

tmp = list(map(int, input().split()))
n = tmp[0]
m = tmp[1]
a = list(map(int, input().split()))

heapq.heapify(a)

cb = []
for j in range(m):
  tmp = list(map(int, input().split()))
  cb.append((tmp[1], tmp[0]))
cb.sort(reverse=True)

for j in range(m):
  if cb[j][0] < a[0]:
    break
  for k in range(cb[j][1]):
    if a[0] < cb[j][0]:
      heapq.heappop(a)
      heapq.heappush(a, cb[j][0])
    else:
      break

print(sum(a))
### BUGGY CODE ###

#D
from collections import deque
from heapq import heappush, heappop
n,q=map(int,input().split())
data=[[] for i in range(n+1)]
counter=deque([0]*(n+1))
for i in range(n-1):
    a,b=map(int,input().split())
    data[a].append(b)
    data[b].append(a)
for i in range(q):
    p,x=map(int,input().split())
    counter[p]+=x
h=[1]
done=[0]*(n+1)
while h:
    a=heappop(h)
    for i in range(len(data[a])):
        if done[data[a][i]]==1:
            continue
        counter[data[a][i]]+=counter[a]
        heappush(h,data[a][i])
    done[a]=1
counter.popleft()
print(*counter)

### FIXED CODE ###

#D
n,q=map(int,input().split())
data=[[] for i in range(n+1)]
counter=[0]*(n+1)
for i in range(n-1):
    a,b=map(int,input().split())
    data[a].append(b)
    data[b].append(a)
for i in range(q):
    p,x=map(int,input().split())
    counter[p]+=x
h=[1]
done=[0]*(n+1)
while h:
    a=h.pop()
    for l in data[a]:
        if done[l]==0:
            counter[l]+=counter[a]
            h.append(l)
    done[a]=1
print(*counter[1:])
### BUGGY CODE ###

N = int(input())
A =[int(input()) for _ in range(N)]

for i in range(N):
    B = A[:i] + A[i+1:]
    print(max(B))

### FIXED CODE ###

N = int(input())
A =[int(input()) for _ in range(N)]

B = sorted(A)
M, m = B[N-1], B[N-2]

for i in A:
    if i == M:
        print(m)
    else:
        print(M)
### BUGGY CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10 ** 6)

class UnionFind():
	def __init__(self, size):
		self.table = [-1 for _ in range(size)]
		self.size = [1 for _ in range(size)]

	def find(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self.find(self.table[x])
			return self.table[x]

	def unite(self, x, y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] > self.table[s2]:
				self.table[s2] = s1
				self.table[s1] -= 1
				self.size[s1] += self.size[s2]
				self.size[s2] = 0
			else:
				self.table[s1] = s2
				self.table[s2] -= 1
				self.size[s2] += self.size[s1]
				self.size[s1] = 0

		return

	def get_size(self, x):
		return self.size[self.find(x)]

n, m, k = map(int, input().split())
uf = UnionFind(n)

friend = [[] for _ in range(n)]
for _ in range(m):
	a, b = map(int, input().split())
	friend[a-1].append(b-1)
	friend[b-1].append(a-1)
	uf.unite(a-1, b-1)

block = [[] for _ in range(n)]
for _ in range(k):
	a, b = map(int, input().split())
	block[a-1].append(b-1)
	block[b-1].append(a-1)

ans = []
for i in range(n):
	res = uf.get_size(i) - 1 - len(friend[i])
	for v in block[i]:
		if uf.find(i) == uf.find(v):
			res -= 1
	ans.append(res)

print(*ans)

### FIXED CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10 ** 6)

class UnionFind():
	def __init__(self, size):
		self.table = [-1 for _ in range(size)]
		self.size = [1 for _ in range(size)]

	def find(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self.find(self.table[x])
			return self.table[x]

	def unite(self, x, y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] > self.table[s2]:
				self.table[s2] = s1
				self.table[s1] -= 1
				self.size[s1] += self.size[s2]
				self.size[s2] = 0
			else:
				self.table[s1] = s2
				self.table[s2] -= 1
				self.size[s2] += self.size[s1]
				self.size[s1] = 0

		return

	def get_size(self, x):
		return self.size[self.find(x)]

n, m, k = map(int, input().split())
uf = UnionFind(n)

friend = [[] for _ in range(n)]
for _ in range(m):
	a, b = map(int, input().split())
	friend[a-1].append(b-1)
	friend[b-1].append(a-1)
	uf.unite(a-1, b-1)

block = [[] for _ in range(n)]
for _ in range(k):
	a, b = map(int, input().split())
	block[a-1].append(b-1)
	block[b-1].append(a-1)

ans = []
for i in range(n):
	res = uf.get_size(i) - 1 - len(friend[i])
	for v in block[i]:
		if uf.find(i) == uf.find(v):
			res -= 1
	ans.append(res)

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

N,Q = map(int,input().split())
S = str(input())

for _ in range(Q):
    l,r = map(int,input().split())
    flag = 0
    cnt = 0
    for i in range(l-1,r):
        if S[i] == "A":
            flag = 1
            continue
        if S[i] == "C" and flag == 1:
            cnt += 1
            flag = 0
            continue
        if S[i] == "C" and flag == 0:
            continue
    print(cnt)


### FIXED CODE ###

N,Q = map(int,input().split())
s = input()
t = [0]
ans = []
for i in range(N):
    if s[i:i+2] == "AC":
        t.append(t[i] + 1)
    else:
        t.append(t[i])
for i in range(Q):
    l,r = map(int,input().split())
    ans.append(t[r-1]-t[l-1])
for i in ans:
    print(i)
### BUGGY CODE ###

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

def unique(arry):
  for item in arry:
    if arry.count(item) > 1:
      return False
  return True

if unique(A):
  print("YES")
else:
  print("NO")


### FIXED CODE ###

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

def distinct(arry):
  x = set(arry)
  if len(A) != len(x):
    return False
  return True

if distinct(A):
  print("YES")
else:
  print("NO")
### BUGGY CODE ###

N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break

### FIXED CODE ###

def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()
### BUGGY CODE ###

def main():
    import sys
    n, k, *a = map(int, sys.stdin.read().split())
    a = [0] + a
    check = [0] * (n + 1)
    check[1] = 1

    i = 0
    nw = 1
    path = [1]
    while 1:
        nx = a[nw]
        i += 1
        if i == k:
            print(nx)
            break
        if check[nx]:
            j = path.index(nx)
            d = j + (k - i) % (i - j)
            print(path[d])
            break
        path = path + [nx]
        check[nx] = 1
        nw = nx


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, k, *a = map(int, open(0).read().split())
    a = [0] + a
    root = [1]
    visited = [False for _ in range(n+1)]
    nx = 1
    visited[1] = True

    step = 0
    while True:
        step += 1
        now = nx
        nx = a[now]
        if step == k:
            print(nx)
            break
        if visited[nx]:
            end = step
            start = root.index(nx)
            d = end - start
            r = k - step
            index = start + r % d
            print(root[index])
            break

        visited[nx] = True
        root.append(nx)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
a = [int(item) for item in input().split()] + [0]

ans = 0
for i in range(1, n):
  j = 0
  xor = a[i+j-1]
  while not xor & a[i+j] and i+j < n:
    xor ^= a[i+j]
    j += 1
    ans += 1
    
print(ans + n)


### FIXED CODE ###

n = int(input())
a = [int(item) for item in input().split()] + [0]

ans = 0
s = 0
j = 0
for i in range(n):
  while not s & a[j] and j < n:
    s += a[j]
    j += 1
  ans += j - i
  s -= a[i]
    
print(ans)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = [A[x]+B[y] for x in range(X) for y in range(Y)]
AB.sort(reverse=True)
AB = AB[:K]
XY = len(AB)
ABC = [AB[xy]+C[z] for xy in range(XY) for z in range(Z)]
ABC.sort(reverse=True)
for k in range(K):
    print(ABC[k])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
*A, = sorted(map(int, input().split()), reverse=True)
*B, = sorted(map(int, input().split()), reverse=True)
*C, = sorted(map(int, input().split()), reverse=True)
AB = [A[x] + B[y] for y in range(Y) for x in range(X)]
AB.sort(reverse=True)
AB = AB[:K]
ABC = [AB[x] + C[z] for z in range(Z) for x in range(len(AB))]
ABC.sort(reverse=True)
for k in range(K):
    print(ABC[k])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()

    ans = 1
    index = 0
    while index < N:
        ans *= A[index]
        index += 1

    if ans <= 10**18:
        print(ans)
    else:
        print(-1)


# oj t -c "pypy3 main.py"
# acc s main.py -- --guess-python-interpreter pypy
main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()

    ans = 1
    index = 0
    A_set = set(A)
    if 0 in A_set:
        print(0)
        return
    while index < N:
        ans *= A[index]
        index += 1
        if ans > 10**18:
            break

    if ans <= 10**18:
        print(ans)
    else:
        print(-1)


# oj t -c "pypy3 main.py"
# acc s main.py -- --guess-python-interpreter pypy
main()
### BUGGY CODE ###

N, X, M = map(int, input().split())
ans = X
ALL = []
rou = False
for i in range(N-1):
    X = pow(X, 2, M)
    if X in ALL:
        num = ALL.index(X)
        now = i
        rou = True
        break
    ALL.append(X)
    ans += X
if rou :
    roupe = now - num 
    nokori = N - now -2
    print(sum(ALL[num:])*(nokori//roupe) + ans + sum(ALL[num:num + nokori%roupe + 1]))
else:
    print(ans)

### FIXED CODE ###

N, X, M = map(int, input().split())
ans = X
ALL_cal = [False] * M
ALL = []
rou = False
for i in range(N-1):
    X = pow(X, 2, M)
    if ALL_cal[X]:
        num = ALL_cal[X]
        now = i
        rou = True
        break
    ALL.append(X)
    ALL_cal[X] = i
    ans += X
if rou :
    roupe = now - num 
    nokori = N - now - 1
    print(sum(ALL[num:])*(nokori//roupe) + ans + sum(ALL[num:num + nokori%roupe]))
else:
    print(ans)
### BUGGY CODE ###

def main():
    count = int(input())

    imps = []
    for n in range(count):
        imps.append(input())

    db = []
    for imp in imps:
        command = imp.split(' ')
        if command[0] == 'insert':
            db.append(command[1])
        elif command[0] == 'find':
            if command[1] in db:
                print('yes')
            else:
                print('no')


main()

### FIXED CODE ###

import sys


def main():
    _ = int(input())

    imps = sys.stdin.readlines()

    db = {}
    for imp in imps:
        c, k = imp.split(' ')
        if c == 'insert':
            db[k] = 0
        elif k in db:
            print('yes')
        else:
            print('no')


main()
### BUGGY CODE ###

from collections import defaultdict
from collections import deque
import sys
sys.setrecursionlimit(10**6)

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

graph = defaultdict(deque)

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

arr = [0] * (n + 1)
for i in range(q):
    p, x = map(int, input().split())
    arr[p] += x


def solve(graph, arr):
    curr, root = 1, -1

    def dfs(curr, root):
        stack = graph[curr]

        while stack:
            leaf = stack.pop()
            if leaf == root:
                continue
            arr[leaf] += arr[curr]
            dfs(leaf, curr)

        return arr

    return dfs(curr, root)


ans = solve(graph, arr)

print(*ans[1:])

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

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

graph = defaultdict(set)

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

arr = [0] * (n + 1)

for i in range(q):
    p, x = map(int, input().split())
    arr[p] += x


def solve():
    stack = [1]
    visited = [True] * 2 + [False] * (n - 1)

    while stack:
        curr = stack.pop()
        for leaf in graph[curr]:
            if visited[leaf]:
                continue
            stack.append(leaf)
            visited[leaf] = True
            arr[leaf] += arr[curr]

    return arr


arr = solve()

print(*arr[1:])
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
ar = []
for i in range(n):
  l = list(input())
  l.sort()
  ar.append("".join(l).__hash__())


count = 0
for i in range(n):
  count = count + ar[i+1:].count(ar[i])

print(count)



### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())

# スペース区切りの整数の入力
ar = []
for i in range(N):
  l = list(input())
  l.sort()
  ar.append("".join(l).__hash__())

# 数を数える
list = {}
for i in ar:
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1
  
count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))

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

K, S = map(int, input().split())
count = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x + y + z == S:
        count = count + 1
print(count)

### FIXED CODE ###

K,S=map(int, input().split())
count = 0
for x in range(min([K+1,S+1])):
  for y in range(min([K+1,S+1-x])):
    if S-x-y<=K:
      count = count + 1
print(count)
### BUGGY CODE ###

import itertools

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

aa = [0] + list(itertools.accumulate(A))
bb = [0] + list(itertools.accumulate(B))

ans = 0
for i in range(N+1):
    tmp_K = K-aa[i]
    if tmp_K == 0:
        ans = max(ans, i)
    elif tmp_K < 0:
        continue

    if tmp_K >= bb[-1]:
        ans = max(ans, i+M)
        continue

    mn = 0
    mx = M
    while True:
        if mn == mx:
            if tmp_K >= bb[mn]:
                ans = max(ans, i+mn)
            break

        mid = (mn+mx//2)
        if bb[mid] <= tmp_K:
            if mn == mid:
                mn = mid+1
            else:
                mn = mid

        else:
            if mx == mid:
                mx = mid-1
            else:
                mx = mid
            if i+mx <= ans:
                break
print(ans)


### FIXED CODE ###

import itertools
import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

aa = [0] + list(itertools.accumulate(A))
bb = [0] + list(itertools.accumulate(B))

ans = bisect.bisect_left(aa, K)-1
ans = max(ans, bisect.bisect_left(bb, K)-1)

for i in reversed(range(N+1)):
    tmp_K = K-aa[i]
    if tmp_K == 0:
        ans = max(ans, i)
    elif tmp_K < 0:
        continue

    if i + M <= ans:
        continue

    if tmp_K >= bb[-1]:
        ans = max(ans, i+M)
        continue

    ans = max(ans, bisect.bisect_left(bb, tmp_K)-1+i)
print(ans)
### BUGGY CODE ###

N = int(input())
S = 0
while N > 0:
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

N = int(input())
if N%9 ==0:
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

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

bit = ['0' for _ in range(41)]
while a <= b:
    val = bin(a)[2:]
    for i in range(1, len(val)+1):
        if val[-i] == '1' and bit[-i] == '0': bit[-i] = '1'
        elif val[-i] == '1' and bit[-i] == '1': bit[-i] = '0'
    a += 1
print(int(''.join(bit), 2))

### FIXED CODE ###

a, b = map(int, input().split())
if a%2 == b%2: # 3, 4, 5  => 3^1 / 4, 5, 6 => 1^6
    k = (b-a)//2
    print(b^(k%2) if a%2==0 else a^(k%2))
elif a%2 == 0 and b%2 == 1: # 4, 5, 6, 7 => 1^1
    print(((b-a+1)//2)%2)
elif a%2 == 1 and b%2 ==0: # 3, 4, 5, 6 => 3^1^6
    print(a^b^((b-a-1)//2)%2)