Harryxun/stf_run huggingface dataset:
n,Xmax=map(int,input().split())
L=list(map(int,input().split()))
x=0
count=1
while x+L[0]<=Xmax:
  count+=1
  x+=L.pop(0)
print(count)

### FIXED CODE ###

n,Xmax=map(int,input().split())
L=list(map(int,input().split()))
x=0
count=1
while x+L[0]<=Xmax:
  count+=1
  x+=L.pop(0)
  if len(L)==0:
    break
print(count)
import sys

def eat(i,candies,counter):
    s=candies[i]+candies[i-1]
    nc=max(0,s-x)
    counter+=nc
    candies[i]-=nc
    return counter

def main(n,x,candies):
    counter=0
    if candies[0]>x:
        counter=candies[0]-x
        candies[0]=x
    for i in range(1,n):
        counter=eat(i,candies,counter)
    return counter

n,x=map(int,sys.stdin.readline().strip().split())
candies=list(map(int,sys.stdin.readline().strip().split()))
print(main(n,x,candies))


### FIXED CODE ###

from collections import deque
import sys

def fnw(n,s):
    sm=deque([])
    if n<=len(s):
        for _ in range(n):
            sm.append(s.popleft())
    return sm

def jfws(s):
    # print(s)
    sm=fnw(5,s)
    # print(sm)
    if ''.join(sm)=='dream':
        sm=fnw(2,s)
        if ''.join(sm)=='er':
            if bool(s):
                if s[0]=='a':
                    s.extendleft(deque(reversed(list(sm))))
        else:
            s.extendleft(deque(reversed(list(sm))))
        return False
    elif ''.join(sm)=='erase':
        sm=fnw(1,s)
        if ''.join(sm)!='r':
            s.extendleft(sm)
        return False
    else:
        return True 

def main(s):
    while len(s)>0:
        if jfws(s):
            return 'NO'
    return 'YES'

s=deque(sys.stdin.readline().strip())
print(main(s))
X,Y = map(int,input().split())
mod = 10**9+7
if (2*X-Y) % 3 != 0 or (2*Y-X) % 3 != 0:
    print(0)
    exit(0)
x,y = (2*Y-X)//3,(2*X-Y)//3
N = x+y
K = min(x,y)
def pow(x, n, mod):
    ret = 1
    while n>0:
        if (n&1):
            ret = (ret*x) % mod
        x = (x*x) % mod
        n >>= 1
    return ret
fact = [None]*(N+1)
fact[0] = 1
for i in range(1, N+1):
    fact[i] = (fact[i-1]*i) % mod
finv = [None]*(N+1)
finv[N] = pow(fact[N], mod-2, mod)
for i in range(N, 0, -1):
    finv[i-1] = (finv[i]*i) %mod
def comb(n, k):
    return (fact[n]*finv[n-k]*finv[k]) % mod
print(comb(N,K))

### FIXED CODE ###

X,Y = map(int,input().split())
mod = 10**9+7
if (2*X-Y) % 3 != 0 or (2*Y-X) % 3 != 0:
    print(0)
    exit(0)
x,y = (2*Y-X)//3,(2*X-Y)//3
if x < 0 or y < 0:
    print(0)
    exit(0)
N = x+y
K = min(x,y)
def pow(x, n, mod):
    ret = 1
    while n>0:
        if (n&1):
            ret = (ret*x) % mod
        x = (x*x) % mod
        n >>= 1
    return ret
fact = [0]*(N+1)
fact[0] = 1
for i in range(1, N+1):
    fact[i] = (fact[i-1]*i) % mod
finv = [0]*(N+1)
finv[N] = pow(fact[N], mod-2, mod)
for i in range(N, 0, -1):
    finv[i-1] = (finv[i]*i) %mod
print((fact[x+y]*finv[x]*finv[y]) % mod)
n,k = map(int, input().split())
num = 1
for i in range(n):
    if num*2 < num+k:
        num = num*2
    else:
        num = num+k
print(num)


### FIXED CODE ###

n = int(input())
k = int(input())
num = 1
for i in range(n):
    num = min(num+k,num*2)
print(num)
//aaaaa
aaaaaa//

### FIXED CODE ###

S = input()

ans = 0
for i in range(len(S)//2):
  if S[i] != S[len(S)-i-1]: ans += 1
print (ans)
n = int(input())
p = list(map(int,input().split()))    
p2 = sorted(p)   

if p == p2:
    print('YES')
else:
    for i in range(1,n-1):
        if p[i] == p2[n-i]:
            p3 = p.remove(p[i],p[n-1])
            p4 = sorted(p3)
            if p3 == p4:
                print('YES')
            else:
                print('NO')
        else:
            print('NO')

### FIXED CODE ###

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

for i in range(n):
    a[i] = p[i]-sorted(p)[i]
    if a[i] != 0:
        b += 1

if sum(a) == 0 and (b == 2 or b == 0):
    print('YES')
else:
    print('NO')
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][1] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

main()


### FIXED CODE ###

def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][0] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

main()
import fractions:
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
from collections import deque
 
 
def solve(N, K, ABs):
     if N == 1:
        return K

    Ds = [0 for _ in range(N + 1)]
    Ws = {i: [] for i in range(N + 1)}
    for a, b in ABs:
        Ws[a].append(b)
        Ws[b].append(a)
 
    Ds[1] = K
 
    s = Ws[1][0]
    Ds[s] = K - 1
 
    queue = deque()
    queue.append(1)
    queue.append(s)
 
    while queue:
        s = queue.popleft()
        k = K - 2
        for w in Ws[s]:
            if Ds[w] == 0:
                Ds[w] = k
                k -= 1
                queue.append(w)
    ans = 1
    for i in range(1, N + 1):
        if Ds[i] <= 0:
            return 0
        ans *= Ds[i]
        ans %= 1000000007
    return (ans % 1000000007)
 
if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    print(solve(N, K, ABs))

### FIXED CODE ###

from collections import deque


def solve(N, K, ABs):
    if N == 1:
        return K

    Ds = [-1 for _ in range(N + 1)]
    Ws = {i: [] for i in range(N + 1)}
    for a, b in ABs:
        Ws[a].append(b)
        Ws[b].append(a)

    for i in range(1, N + 1):
        if Ds[i] == -1:
            Ds[i] = K

            if Ws[i]:
                s = Ws[i][0]
                Ds[s] = K - 1

                queue = deque()
                queue.append(i)
                queue.append(s)

                while queue:
                    s = queue.popleft()
                    k = K - 2
                    for w in Ws[s]:
                        if Ds[w] == -1:
                            Ds[w] = k
                            k -= 1
                            queue.append(w)

    ans = 1
    for i in range(1, N + 1):
        if Ds[i] <= 0:
            return 0
        ans *= Ds[i]
        ans %= 1000000007
    return ans % 1000000007

if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    print(solve(N, K, ABs))
N=int(input())
a=list(map(int, input().split()))
l = [i for i in range(1,N+1)]
c=0
for i in range(N):
  for j in range(N):
    if l[0]==a[j]:
      del l[0]
      c+=1
if len(l)==N:
  print(-1)
  exit()
print(c)

### FIXED CODE ###

N=int(input())
a=list(map(int, input().split()))
S=1
c=0
for j in range(N):
  if S==a[j]:
    S+=1
  elif S!=a[j]:
    c+=1
if c==N:
  print(-1)
  exit()
print(c)
s= str(input().strip())
K= int(input().strip())
parts = []
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        flg = 0
        if j-i > K:
            break
        parts.append(s[i:j])
v = sorted(parts)
vv = [v[0]]
tmp = v[0]
for k in range(1,len(v)):
    if v[k]!=tmp:
        vv.append(v[k])
        tmp = v[k]
    if len(vv)==K:
        break
        
print(vv[K])

### FIXED CODE ###

s= str(input().strip())
K= int(input().strip())
parts = []
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        flg = 0
        if j-i > K:
            break
        parts.append(s[i:j])
v = sorted(parts)
vv = [v[0]]
tmp = v[0]
for k in range(1,len(v)):
    if v[k]!=tmp:
        vv.append(v[k])
        tmp = v[k]
    if len(vv)==K:
        break
        
print(vv[K-1])
n=int(input())
a=list(map(int,input().split()))

from math import gcd
from itertools import combinations as cmb

par=[i for i in range(n)]

def root(i):
    if par[i]==i:
        return i
    else:
        r=root(par[i])
        par[i]=r
        return r

def unite(x,y):
    rx=root(x)
    ry=root(y)
    if rx!=ry:
        par[rx]=ry

co=False
set=a[0]
setok=False
for i,j in cmb(range(n),2):
    if i==0:
        set=gcd(set,a[j])
        if setok&set==1:
            print("setwise coprime")
            exit()
    if root(i)!=root(j):
        g=gcd(a[i],a[j])
        if g==1:
            co=True
            unite(i,j)
        else:
            setok=True
            if co:
                print("setwise coprime")
                exit()

if setok:print("not coprime")
else:print("pairwise coprime")

### FIXED CODE ###


# A以下の数がN個与えられる。全て素因数分解せよ。
class SpeedPrime:
    # a以下の各数の最小の素因数を記録
    def __init__(self, a):
        self.d = [i for i in range(a+1)]

        i=2
        while i*i<=a:
            if self.d[i]==i:
                j=i*i
                while j<=a:
                    if self.d[j]==j:
                        self.d[j]=i
                    j+=i
            i+=1

    # nを高速素因数分解
    def fac(self, n):
        ret = dict()
        while n!=1:
            prime=self.d[n]
            if prime in ret:
                ret[prime]+=1
            else:
                ret[prime]=1
            n=n//prime
        return ret

import math
from functools import reduce
def gcd(numbers):
    return reduce(math.gcd, numbers)

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

sp=SpeedPrime(max(a))

d=set()
pc=True
for i in a:
    prime=sp.fac(i)
    for k in prime.keys():
        if k in d:
            pc=False
            break
        else:
            d.add(k)

if pc:
    print("pairwise coprime")
    exit()

g=gcd(a)
if g==1:
    print("setwise coprime")
else:
    print("not coprime")
N = int(input())
Hs = list(map(int, input().split()))

prev = Hs[0]
flag = True
for i in range(1,len(Hs)):
    if Hs[i] <prev:
	flag = False
	break
    elif Hs[i] == prev:
	prev = Hs[i]
    else:
	prev = Hs[i]-1
if flag:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

N = int(input())
Hs = list(map(int, input().split()))
 
prev = Hs[0]
flag = True
for i in range(1,len(Hs)):
    if Hs[i] <prev:
      flag = False
      break
    elif Hs[i] == prev:
      prev = Hs[i]
    else:
      prev = Hs[i]-1
if flag:
    print("Yes")
else:
    print("No")
n,x=map(int,input().split())
a=list(map(int,input().split() for i in range(n)))
a_sort=sorted(a)
count=0
sum=0
for i in a_sort:
    if sum+i<=x:
        sum=sum+i
        count+=1
    else:
        break
print(count)


### FIXED CODE ###

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

count=0
if x==sum(a):
    print(n)
elif x>sum(a):
    print(n-1)
else:
    for i in range(n):
        if x>=a[i]:
            count+=1
            x-=a[i]
        else:
            break
    print(count)
# B - One Clue
def main():
    count = int(input())
    data = []
    for i in range(count):
        data.append(''.join(sorted(str(input()))))
    unique = list(set(data))
    sameCount = [0 for i in range(len(unique))]
    for j in range(len(unique)):
        for k in range(count):
            if unique[j] == data[k]:
                sameCount[j] = 1 + sameCount[j]

    print(sum(list(range(sameCount[0]))) + sum(list(range(sameCount[1]))))
        

if __name__ == "__main__":
    main()

### FIXED CODE ###

# C - Green Bin
def main():
    count = 0
    dictCount = {}
    for i in [input() for i in range(int(input()))]:
        strInput = ''.join(sorted([c for c in i]))
        if strInput in dictCount:
            count += dictCount[strInput]
            dictCount[strInput] += 1
        else:
            dictCount[strInput] = 1
    print(count)

if __name__ == "__main__":
    main()
A,B=map(int,input().split())
n=(B-1)/(A-1)

if n>=1:
    if n==int(n):
        output=n
    else :
       output=int(n)+1
else :pass

print(output)   

### FIXED CODE ###

A,B=map(int,input().split())
n=(B-1)/(A-1)
if n>=1:
    if n==int(n):
        output=int(n)
    else :
        output=int(n)+1
elif n<1 and n>0:
    output=1
else:
    output=0
print(output)
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(H: int, W: int, S: "List[str]"):
    d = [[0] * W for _ in range(H)]
    for y in range(H):
        x = 0
        while x < W:
            while x < W and S[y][x] == "#":
                x += 1
            xstt = x
            while x < W and S[y][x] == ".":
                x += 1
            xend = x
            for x2 in range(xstt, xend):
                d[y][x2] += xend - xstt
    for x in range(H):
        y = 0
        while y < H:
            while y < H and S[y][x] == "#":
                y += 1
            ystt = y
            while y < H and S[y][x] == ".":
                y += 1
            yend = y
            for y2 in range(ystt, yend):
                d[y2][x] += yend - ystt

    print(max(max(r) for r in d) - 1)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(H: int, W: int, S: "List[str]"):
    d = [[0] * W for _ in range(H)]
    for y in range(H):
        x = 0
        while x < W:
            while x < W and S[y][x] == "#":
                x += 1
            xstt = x
            while x < W and S[y][x] == ".":
                x += 1
            xend = x
            for x2 in range(xstt, xend):
                d[y][x2] += xend - xstt
    for x in range(W):
        y = 0
        while y < H:
            while y < H and S[y][x] == "#":
                y += 1
            ystt = y
            while y < H and S[y][x] == ".":
                y += 1
            yend = y
            for y2 in range(ystt, yend):
                d[y2][x] += yend - ystt

    print(max(max(r) for r in d) - 1)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)


if __name__ == '__main__':
    main()
from collections import deque

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

for i in range(1, len(A)):
    A[i] += A[i-1]
for i in range(1, len(B)):
    B[i] += B[i-1]

indexB = len(B) - 1
best = 0
for i in range(len(A)):
    time = A[i]
    if time > K:
        break
    else:
        while(indexB >= 0 and time + B[indexB] > K):
            indexB -= 1
        count = i+1 + indexB+1
        if indexB < len(B)-1:
        indexB += 1
    if (best < count):
        best = count
print(best)

### FIXED CODE ###

from bisect import bisect
from collections import deque

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

for i in range(1, len(A)):
    A[i] += A[i-1]
for i in range(1, len(B)):
    B[i] += B[i-1]
A.insert(0, 0)
indexB = len(B) - 1
results = [0]
for i in range(len(A)):
    time = A[i]
    if time > K:
        break
    enable_for_b = K - time
    results.append(i + bisect(B, enable_for_b))

print(max(results))
a, b = int(input()).split()
sum = a * b
sumto = sum % 2
if sumto == 1:
  response = 'Odd'
else:
  response = 'Even'
  return response

### FIXED CODE ###

a, b = map(int, input().split())
seki = a * b
sekito = seki % 2
if sekito == 1:
  response = 'Odd'
else :
  response = 'Even'
print(response)
import math
A,B=map(int,input().split())
print(A*B//math.gcd(A,B))

### FIXED CODE ###

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
def lcm(a,b):
  return a*b//gcd(a,b)

num=list(map(int,input().split()))
A=num[0]
B=num[1]
S=lcm(A,B)
print(S)
W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H

for _ in range(N):
    X, Y, A = map(int, input().split())
    x.append(X)
    y.append(Y)
    a.append(A)

for i in range(len(x)):
    if a[i]==1 and x[i] > w[0]:
        for j in range(x[i]):
            if j in w: w.remove(j)
    if a[i]==2 and x[i] < w[-1]:
        for j in reversed(range(x[i]+1,w[-1]+1)):
            if j in w: w.remove(j)
    if a[i]==3 and y[i] > h[0]:
        for j in range(y[i]):
            if j in h: h.remove(j)
    if a[i]==4 and y[i] < h[-1]:
        for j in reversed(range(y[i]+1,h[-1]+1)):
            if j in h: h.remove(j)

if len(w)==0 or len(h)==0:
    print(0)
else:
    S_f = (w[-1]-w[0]) * (h[-1]-h[0])
    print(S_f)


### FIXED CODE ###

W,H,N=map(int,input().split())
x=[]
y=[]
a=[]
w=[i for i in range(W+1)]
h=[i for i in range(H+1)]
S=W*H

for _ in range(N):
    X, Y, A = map(int, input().split())
    x.append(X)
    y.append(Y)
    a.append(A)

for i in range(len(x)):
    if a[i]==1 and len(w)!=0:
        for j in range(x[i]):
            if j in w: w.remove(j)
    if a[i]==2 and len(w)!=0:
        for j in reversed(range(x[i]+1,w[-1]+1)):
            if j in w: w.remove(j)
    if a[i]==3 and len(h)!=0:
        for j in range(y[i]):
            if j in h: h.remove(j)
    if a[i]==4 and len(h)!=0:
        for j in reversed(range(y[i]+1,h[-1]+1)):
            if j in h: h.remove(j)
if len(w)==0 or len(h)==0:
    print(0)
else:
    S_f = (w[-1]-w[0]) * (h[-1]-h[0])
    print(S_f)
import numpy as np
 
N = int(input())
A = [0] * N
B = [0] * N
C = [[] for _ in range(N) ]
takahashi = []
aoki = []
 
for i in range(N):
  A[i], B[i] = map(int,input().split())
 
D = np.array(A) + np.array(B)

for i in range(N):
  C[i] = [i, D[i]]
  
C = sorted(C, key=lambda x:x[1])
 
while len(C) > 0:
  tmp_max = C[-1][0]
  takahashi.append(A[tmp_max])
  A.pop(tmp_max)
  B.pop(tmp_max)
  C.pop(tmp_max)
 
  if len(C)>0 :
    tmp_max = C[-1][0]
    aoki.append(B[tmp_max])
    A.pop(tmp_max)
    B.pop(tmp_max)
    C.pop(tmp_max)
 
print(sum(takahashi)-sum(aoki))

### FIXED CODE ###

#%%
import time

import numpy as np

N = int(input())
A = [0] * N
B = [0] * N
C = [[] for _ in range(N) ]
takahashi = []
aoki = []

start = time.time()

for i in range(N):
  A[i], B[i] = map(int,input().split())


D = np.array(A) + np.array(B)
for i in range(N):
  C[i] = [i, D[i]]


elapsed_time = time.time() - start
#print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
start = time.time()

C = sorted(C, key=lambda x:x[1])


elapsed_time = time.time() - start
#print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
start = time.time()


if N %2 == 0 :
  for i in range(1,N,2):
    tmp_max = C[-i][0]
    takahashi.append(A[tmp_max])
    tmp_max = C[-i-1][0]
    aoki.append(B[tmp_max])

elif N %2 != 0 :
  for i in range(1,N-1,2):
    tmp_max = C[-i][0]
    takahashi.append(A[tmp_max])
    tmp_max = C[-i-1][0]
    aoki.append(B[tmp_max])
  tmp_max = C[-N][0]
  takahashi.append(A[tmp_max])

print(sum(takahashi)-sum(aoki))

elapsed_time = time.time() - start
#print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
import sys
print('Yes' if set(sys.stdin.read().strip()) >= 2 else 'No')

### FIXED CODE ###

import sys
print('Yes' if len(set(sys.stdin.read().strip())) >= 2 else 'No')
w, h = map(int, raw_input().split())
print w * h, w * 2 + h * 2

### FIXED CODE ###

w, h = map(int, input().split())
print(w * h, w * 2 + h * 2)
import sys
readline = sys.stdin.readline

N = int(readline())

A = [None] * N
for i in range(N):
  A[i] = list(map(int,readline().split()))
  
# まずワーシャルフロイド表を作る
# ワーシャルフロイド表より大きな数値が元の表にあったら、最短距離の表ではないので-1
# 最短距離の表になっているのであれば、
# A[1][3]に行くときにA[1][2] + A[2][3]となるのであれば、
# A[1][3]のほうだけansに記録していく

import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import csgraph_from_dense
A = np.array(A)
G = csgraph_from_dense(A, null_value=0)
w = floyd_warshall(G)

for i in range(N):
  for j in range(N):
    if A[i][j] > w[i][j]:
      print(-1)
      exit(0)

ans = 0
for a in A:
  ans += sum(a)
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      if i == k or k == j or i == j:
        continue
      if A[i][k] + A[k][j] == A[i][j]:
        ans -= A[i][j]
        
print(ans // 2)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

N = int(readline())

A = [None] * N
for i in range(N):
  A[i] = list(map(int,readline().split()))
  
# まずワーシャルフロイド表を作る
# ワーシャルフロイド表より大きな数値が元の表にあったら、最短距離の表ではないので-1
# 最短距離の表になっているのであれば、
# A[1][3]に行くときにA[1][2] + A[2][3]となるのであれば、
# A[1][3]のほうだけansに記録していく

import copy
newA = copy.deepcopy(A)

for k in range(N):
  for i in range(N):
    for j in range(N):
      if i == k or k == j or i == j:
        continue
      if A[i][k] + A[k][j] < A[i][j]:
        print(-1)
        exit(0)
      elif A[i][k] + A[k][j] == A[i][j]:
        # A[i][j]の道路は不要
        newA[i][j] = 0

ans = 0
for a in newA:
  ans += sum(a)
print(ans // 2)
n, k = map(int, input().split())
snk = [-1] * (n + 1)
for j in range(k):
	d = input()
	list = map(int, input().split())
    for i in range(d):
        snk[list[i]] = 0
for j in range(n):
    if snk[j] == -1:
        ans += 1
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
snk = [-1] * (n+1)
ans = 0
for j in range(k):
	d = int(input())
	lis = list(input().split())
	for i in range(d):
		y = int(lis[i])
		snk[y] = 0
for j in range(n):
    if snk[j+1] == -1:
        ans += 1
print(ans)
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
a= int(input())
if digitsum(a) % 9 == 0:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
N = int(input())
if digitSum(N) % 9 == 0:
    print("Yes")
else:
    print("No")