Problem:
 Score : 200 points    Problem Statement An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9 .  Determine whether N is a multiple of 9 .      Constraints  0 \leq N < 10^{200000}  N is an integer.         Input Input is given from Standard Input in the following format:  N       Output If N is a multiple of 9 , print Yes ; otherwise, print No .        Sample Input 1 123456789      Sample Output 1 Yes  The sum of these digits is 1+2+3+4+5+6+7+8+9=45 , which is a multiple of 9 , so 123456789 is a multiple of 9 .       Sample Input 2 0      Sample Output 2 Yes       Sample Input 3 31415926535897932384626433832795028841971693993751058209749445923078164062862089986280      Sample Output 3 No

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]



def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





S = S()
now = 0
for s in S:
  now += int(s)
  now %= 9
if now == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
print('Yes' if n%9==0 else 'No')

Solution (Python):
N = input()
ls = [int(x) for x in N]
s = sum(ls)
print
if s%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
print("Yes" if int(input()) % 9 == 0 else "No")

Solution (Python):
N = int(input())

if N % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
tot = 0
for c in S:
    tot += int(c)

if tot % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
A = int(input())

if A%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):


import sys
sys.setrecursionlimit(300000)

YES = "Yes"  
NO = "No"  

def solve(N: str):
    tmp = 0
    for c in N:
        tmp += int(c)
    if tmp % 9 == 0:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
num_str = input()

mod = 0

for n in num_str:
  mod += int(n)
  mod %= 9

if mod % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
print('No'if int(input())%9 else'Yes')

Solution (Python):
b=int(input())
if b%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
print('Yes' if N%9==0 else 'No')

Solution (Python):
print('Yes' if int(input())%9==0 else 'No')

Solution (Python):
n = input()
s = sum([int(i) for i in n])
if s%9==0:
    print("Yes")
else: print("No")

Solution (Python):
if int(input()) % 9 == 0 : print("Yes")
else : print("No")

Solution (Python):
print('Yes' if int(input())%9 == 0 else 'No')

Solution (Python):
print("No" if int(input())%9 else "Yes")

Solution (Python):
n = int(input())
if n%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
i = int(input())
print("Yes" if i%9 == 0 else "No")

Solution (Python):
N=int(input())
if N%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
if int(input())%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
ans = 0
for j in n:
	ans += int(j)
if ans % 9 == 0:
	print("Yes")
else:
	print("No")

Solution (Python):


from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))


def main():
	N = input()
	val = 0
	for i in N:
		val += int(i)

	if val % 9 == 0:
		print("Yes")
	else:
		print("No")

	




if __name__ == '__main__':
	main()

Solution (Python):
N = int(input())
print("Yes" if N % 9 == 0 else "No")

Solution (Python):
N = int(input())

if N % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()
print('Yes' if sum(map(int, n)) % 9 == 0 else 'No')

Solution (Python):
a = int(input())
if a % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
s=input()
ans=0
for c in s:
    ans+=int(c)
    ans%=9
if ans==0:
    print('Yes')
else:
    print('No')

Solution (Python):
print("Yes" if int(input())%9==0 else "No")

Solution (Python):
N = input()
res = 0
for i in range(len(N)):
    res += int(N[i])
if res%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
print("Yes" if N%9==0 else "No")

Solution (Python):
print('YNeos'[int(input())%9!=0::2])

Solution (Python):
N = int(input())
if N%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])

if ans % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()

tem = 0
for i in N:
    tem += int(i)

if tem % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())

if n % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n=list(map(int,list(input())))
if sum(n)%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    num = input()
    if sum(int(c) for c in num) % 9 == 0:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
N = input()
ans = 0
for n in N:
    ans += int(n) % 3
    ans %= 3

if ans == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    num = int(input())
    if num % 9 == 0:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
print("YNeos"[sum(list(map(int, list(input()))))%9!=0::2])

Solution (Python):
n = int(input())
if n%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=input()

cnt=0
for i in range(len(n)):
    cnt+=int(n[i])

if cnt%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()
print("Yes" if sum(map(int, list(n)))%9 == 0 else "No")

Solution (Python):
import numpy as np
import sys

sys.setrecursionlimit(10**8)
 
num_str = input()
 
num_list = [int(num_str[i]) for i in range(len(num_str))]
 
num_sum = sum(num_list)
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = input()
ans = 0
for i in n:
  ans += int(i)
if ans%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
import numpy as np
import sys

sys.setrecursionlimit(10**8)
 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
import numpy as np
import sys


 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
a = int(input())
print("Yes" if a%9==0 else "No")

Solution (Python):
if int(input())%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
if int(input())%9:
    print("No")
else:
    print("Yes")

Solution (Python):
print('Yes' if sum(int(x) for x in input()) % 9==0 else 'No')

Solution (Python):
if int(input())%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
print("YNeos"[int(input())%9!=0::2])

Solution (Python):
import sys,bisect
 
from sys  import stdin,stdout
 
from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right
 
from math import gcd,ceil,floor,sqrt
 
from collections import Counter,defaultdict,deque,OrderedDict
 
from queue import Queue,PriorityQueue
 
from string import ascii_lowercase
 
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7
 
def isPrime(n):
    
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True
 
 
def st():
    return list(stdin.readline().strip())
 
def inp():
    return int(stdin.readline())
 
def li():
    return list(map(int,stdin.readline().split()))
 
def mp():
    return map(int,stdin.readline().split())
 
def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)
 
 
def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)
 
                
 
 
def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime
 
def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a
 
def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n=input()
    s=sum(list(map(int,str(n))))
    if s%9==0:
        pr('Yes')
    else:
        pr('No')
 
    
 
 
 
 
for _ in range(1):
    solve()

Solution (Python):
N = int(input())
if N % 9 == 0:
    print("Yes")
else : 
    print("No")

Solution (Python):
def main():
    n = int(input())
    

    if n%9==0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  

print('Yes' if sum(LI2()) % 9 == 0 else 'No')

Solution (Python):
N = input()

A = 0
for i in range(len(N)):
  A += int(N[i])
if A % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
print("No" if int(input())%9 else "Yes")

Solution (Python):
N = input()
a = 0
for i in N:
    a += int(i)
print("Yes" if a%9==0 else "No")

Solution (Python):
n = int(input())
if n%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
if n%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = input()
arr = list(map(int, n))
if sum(arr)%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
print('YNeos'[sum(int(i)for i in input())%9>0::2])

Solution (Python):
print(("No","Yes")[int(input()) % 9 == 0])

Solution (Python):
print('Yes' if int(input()) % 9 == 0 else 'No')

Solution (Python):
N = input()
ans = 0
for n in N:
  ans = (ans + int(n)) % 9
if ans :
  print("No")
else:
  print("Yes")

Solution (Python):
n = int(input())

if n % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):

import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline



n = int(input())
print("Yes" if n%9==0 else "No")

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from functools import reduce
from math import gcd


def lcm(a, b):
    
    g = gcd(a, b)
    return a // g * b


N = read()[:-1]
if sum(map(int, list(N))) % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = map(int, input())
    ans = sum(n)
    if ans % 9 == 0:
        print("Yes")
    else:
        print("No")
    return 0
if __name__ == "__main__":
    solve()

Solution (Python):
print("YNeos"[int(input())%9>0::2])

Solution (Python):
N = int(input())
if N % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N=input()
check=0
for i in range(len(N)):
    check+=int(N[i])
    check%=9

print("Yes" if not check else "No")

Solution (Python):
N = input()

sum_N = 0
for n in N:
    sum_N += int(n)
if sum_N % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
print(int(input())%9and'No'or'Yes')

Solution (Python):
print(int(input())%9and'No'or'Yes')

Solution (Python):
n = input()
cnt = 0
for a in n:
    cnt += int(a)
if cnt%9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()
a = sum(list(map(int, str(N))))
if a % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())


def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)


resu = digitSum(n) % 9
if resu == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())

print('YNeos'[n%9>0::2])

Solution (Python):
N=input()
a=[int(i) for i in N]
b=sum(a)

if b%9==0:
	print("Yes")
else:
	print("No")

Solution (Python):
a= int(input())
mod = a%9
if mod==0:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
i=N%9

if i==0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()
total = 0

for i in range(len(n)):
  total += int(n[i])
if total % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007



def main():
	
	
	s = input()
	sa = sum([int(c) for c in s])
	return 'Yes' if sa % 9 == 0 else 'No'
	
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):

def check(st) : 

	n = len(st) 
	digitSum = 0
	
	for i in range(0,n) : 
		digitSum = digitSum + (int)(st[i]) 

	
	return (digitSum % 9 == 0) 


st =input()

if(check(st)) : 
	print("Yes") 
else : 
	print("No")

Solution (Python):
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")

Solution (Python):
N = input()
ans = 0
for i in N:
    a = int(i)
    ans += a
if ans%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
str = int(input())
mod = str%9
if mod==0:
	print('Yes')
else:
  print('No')

Solution (Python):
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
a = input()

a = int(a)

if a % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
if n%9==0: print("Yes")
else: print("No")

Solution (Python):
n = int(input())

if n % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
if sum(list(map(int,input()))) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
num = input()
s = 0
for i in num:
    s = (s + int(i)) % 9

print("Yes") if s == 0 else print("No")

Solution (Python):
s=input()
m=0
for i in s:
  m+=int(i)
if(m%9==0):
  print("Yes")
else:
  print("No")

Solution (Python):
a=str(input())
count=0
for i in range(0,len(a)):
    count+=int(a[i])
if count%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
max = N % 9
if max == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
  hui = sum(list(map(int, str(input()))))
  
  if hui%9 == 0:
    print("Yes")
  else:
    print("No")
main()

Solution (Python):
n = input()
n_9 = 0
for i in range(len(n)):
  n_9 += int(n[i])

if n_9 % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
x = N //1000
x1 = (N - x*1000)//100
x2 = (N - x*1000 - x1*100)//10
x3 = N - x*1000 - x1*100 - x2*10
sum = x+x1+x2+x3
if sum % 9 != 0:
    print("No")
else:
    print("Yes")

Solution (Python):
N = list(input().rstrip())
sum = 0
 
for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
if N%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
    n = int(input())
    if n == 0:
        print("Yes")
    elif n % 9 == 0:
        print("Yes")
    else:
        print("No")

main()

Solution (Python):
n = int(input())
result = sum(list(map(int, str(n))))
if result % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = input()
sum_ = 0

for i in n:
    sum_ += int(i)

if sum_ % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
num = input()
sum = 0

for i in num :
    sum+= int(i)
if ( sum % 9 == 0 ) :
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
result = sum(list(map(int, str(N))))
if  result % 9 == 0:
  	print("Yes\n")
else:
  	print("No\n")

Solution (Python):
n=list(map(int,input()))
cnt=0
for i in range(len(n)):
 cnt+=n[i]
if cnt%9==0:
 print("Yes")
else:
 print("No")

Solution (Python):
N = input()
ans = []

for i in range(len(N)):
    ans.append(N[i])


ys = map((lambda x: int(x)), ans)
Sans = sum(ys)

if Sans % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s = str(input())

array = list(map(int,s))
if(sum(array)%9==0):
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
print('Yes' if n % 9 == 0 else 'No')

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = float('inf')


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


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


def LS(): return sys.stdin.readline().split()


def S(): return sys.stdin.readline().strip()


def IR(n): return [I() for i in range(n)]


def LIR(n): return [LI() for i in range(n)]


def SR(n): return [S() for i in range(n)]


def LSR(n): return [LS() for i in range(n)]


def SRL(n): return [list(S()) for i in range(n)]


def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


mod = 10 ** 9 + 7

n = S()
ret = 0
for i in n:
    ret += int(i)

if ret % 9:
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input())
if N % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
x = int(input())
print('Yes' if x % 9 == 0 else 'No')

Solution (Python):
import sys
readline = sys.stdin.buffer.readline

N = int(readline())
ans = 'Yes' if N%9 == 0 else 'No'

print(ans)

Solution (Python):
n = input()
sum = 0
for s in n[::1]:
    sum += int(s)

if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()

L = len(N)
S = 0

for i in range(L):
    S += int(N[i])

if S % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())

if(n%9 == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(read())
print('Yes' if x % 9 == 0 else 'No')

Solution (Python):
n=input()

a=list(n)
b=0
for i in a:
    b+=int(i)
if b%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
num = input()
if sum([int(line) for line in num])%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):



n = list(input())


sum = 0
for i in n:
    sum += int(i)

if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
from sys import stdin

num =stdin.read().strip()

lst = [int(n) for n in num]
if sum(lst) % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = str(input())
r = 0
for x in n:
    r += int(x)
if(r%9 == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
x = sum(list(map(int,input())))

if x%9==0:
	print("Yes")
else:
	print("No")

Solution (Python):
N=int(input())
if N%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()

sumOfDigits = 0

for i in n:
	sumOfDigits += int(i)

if sumOfDigits % 9 == 0:
	print("Yes")
else:
	print("No")

Solution (Python):
A = input()
A = list(A)
B = []
C = 0
for i in A:
    i = int(i)
    B.append(i)
for j in B:
    C = C + j
if C % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()

count = 0
for x in N:
  count += int(x)
  
if count % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
a = N % 9

if a == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
if N % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
num = input()

def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

if digitSum(num) % 9 == 0:
	print("Yes")
else:
	print("No")

Solution (Python):
x = input()
s = 0
for i in range(len(x)):
  s += int(x[i])
  
if s % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
def check(st) : 
  
    
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    
    
    return (digitSum % 9 == 0) 
  

x = input()
st= str(x)
  
if(check(st)) : 
    print("Yes") 
else :  
    print("No")

Solution (Python):
N = input()

a = 0
for i in range(len(N)):
    a += int(N[i])

if a % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
numlist=list(str(input()))
a=0
i=0
while 0<=i<=len(numlist)-1:
  a+=int(numlist[i])
  i=i+1
if a%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
n = list(n)
sum = 0
for i in range(len(n)):
  sum += int(n[i])

if sum % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = sum(list(map(int, list(input()))))
print('Yes' if n % 9 == 0 else 'No')

Solution (Python):
N = input()
M = N
tmp = 0
for i in range(len(N)):
  n, M = int(M[0]), M[1:]
  tmp += n
if tmp%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
print("Yes" if sum(map(int,list(input())))%9==0 else "No")

Solution (Python):
n = int(input())

result = sum(list(map(int, str(n))))

if result % 9 == 0:
    print('Yes')

else:
    print('No')

Solution (Python):
n = int(input())

result = sum(list(map(int, str(n))))

if result % 9 == 0:
    print('Yes')

else:
    print('No')

Solution (Python):
n = int(input())
a = sum(list(map(int,str(n))))
if a%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys

def main():

	N = int(input())
	
	if N%9 == 0 :
		print("Yes")
	else:
		print("No")
		

if __name__ == "__main__":
    main()

Solution (Python):
A = int(input())
sumA = sum(int(digit) for digit in str(A))
if sumA%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=input() 
l=[] 
for i in range(len(str(n))): 
  l.append(int(n[i])) 
if((sum(l)%9)==0): 
  print("Yes") 
else: 
  print("No")

Solution (Python):
n = input()
count = 0
for i in n:
    i = int(i)
    count += i

if count % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
num=input()
sum=0
for i in range(len(num)):
  sum=sum+int(num[i])

if sum%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = input()
S = 0
for i in N:
  S += int(i)
  S %= 9
if S:
  print("No")
else:
  print("Yes")

Solution (Python):
N = input()

if N == "0":
  print("Yes")
else:
  target = sum(list(map(int, N)))
  if (target % 9) == 0:
    print("Yes")
  else:
    print("No")

Solution (Python):
x = list(map(int,str(input())))
t = 0
for i in range(len(x)):
    t = t + x[i]
if t % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = str(input())
lists = [int(x) for x in N]
a = sum(lists)

if  a % 9 == 0:
        print('Yes')
else:
        print('No')

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n = str(input())
cnt = 0
for i in n:
    cnt += int(i)
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()
sum_of_digits = 0
for digit in str(N):
    sum_of_digits += int(digit)
if sum_of_digits % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())

a=int(n%9)

if a==0:
   print("Yes")
else:
  print("No")

Solution (Python):
def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

n = int(input())
ans = digitSum(n)


if ans%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
def digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");

Solution (Python):

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


N = map(int, list(input())[:-1])

res = sum(N)

if res % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
sum = 0
for i in str(n):
    sum += int(i)
if sum % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):

N = input()
if int(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s = input()
sum = 0
for a in s:
    sum = (sum + ord(a) - ord('0'))%9
    
if sum: print("No")
else: print("Yes")

Solution (Python):
n = sum(map(int, list(input().rstrip())))
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()
arr = list(map(int, list(n)))
if sum(arr) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
if N % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
strings = input()
sum = 0
for i in range(len(strings)):
    sum += int(strings[i])
if sum % 9  == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()

tmp = 0

for i in range(len(n)):
    tmp += int(n[i])
    tmp %= 9

if tmp % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
str = input()
chars = list(str)
total = 0
for i in range(len(chars)):
    total += int(chars[i])
if total % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
print('No' if int(input()) % 9 else 'Yes')

Solution (Python):
N = input()
modulo9 = 0
for c in N:
    modulo9 += int(c)
    modulo9 %= 9

if(modulo9 == 0):
    print('Yes')
else:
    print('No')

Solution (Python):
n=input()
t=len(n)
z=0
for i in range(t):
  
  z=z+int(n[i])

if z%9 ==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n=input()
x=sum([int(n[i]) for i in range(len(n))])
if x%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n=input()
a=0
for i in range(len(n)):
  a+=int(n[i])
if a%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
N=sum(list(map(int,(list(input())))))
if N % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = list(map(int, input()))
if sum(n)%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n=input()
l=[]
for _ in n:
  l.append(int(_))
if sum(l)%9==0:
  print('Yes')
else:
  print('No')