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):
N = int(input())

s = str(N)
arr = list(map(int, s))
if sum(arr) % 9 == 0:
  print('Yes')
else:
  print('No')

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

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

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

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

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()
su=0
for i in n:
  su+=int(i)
if su%9==0:
  print("Yes")
else:
  print('No')

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

Solution (Python):
n = input() 

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

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

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

  
if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
ln = list(str(n))
from collections import Counter
nc = dict(Counter(ln))
s = 0
if n != 0:
    for i in range(1, 10):
        if str(i) in nc:
            s += i * nc[str(i)]
if s % 9 == 0:
    print('Yes')
else:
    print('No')

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

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


if __name__ == "__main__":
    solve()

Solution (Python):

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

Solution (Python):
N=input()
tmp=0

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


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

Solution (Python):
n = input()
def check(st) : 
    n = len(st) 
    digitSum = 0 
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i])  
    return (digitSum % 9 == 0)  
     
if(check(n)) : 
    print("Yes") 
else :  
    print("No")

Solution (Python):
def digital_root(n):
  return n if n < 10 else digital_root(sum(map(int,str(n))))
 
n = int(input())
if(digital_root(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=list(input())
NN=[int(N) for N in N]
if (sum(NN)%9==0):
    print ("Yes")
else:
    print ("No")

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

Solution (Python):
N = input()
digits = list(N)
sum = 0
for d in digits:
     sum += int(d)

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):
s=input()
ans=0;
for i in s:
  ans+=int(i)
if(ans%9==0):
	print("Yes");
else:
  print("No");

Solution (Python):
N = list(input())
num = list(map(int,N))

sum = sum(num)

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

Solution (Python):
n = int(input())
sum_num = sum(list(map(int, str(n))))

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

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

for num in n:
    s = s+int(num)

v = s%9

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

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

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

Solution (Python):
num = input()
flag1 = False
flag2 = False
if int(num) % 9 == 0:
    flag1 = True

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

Solution (Python):
n=input()

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

Solution (Python):
n=input()
sm=0
for d in n:
  sm+=int(d)
  sm=sm%9
if(sm%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(map(int, list(input()))) % 9 == 0:
    print('Yes')
else:
    print('No')

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

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

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

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

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


N = list(input())

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

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

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

Solution (Python):
N = input()

tmp = 0

for i in N:
    tmp += int(i)

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

Solution (Python):
n = input()
lst = []
for items in n:
    lst.append(items)
new_list = [int(i) for i in lst]
if sum(new_list) % 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()
c = 0
for i in list(N):
	c += int(i)
print("Yes" if c%9 == 0 else "No")

Solution (Python):

N = str(input())
L = list(N)
r = 0
for l in L:
    r = r + int(l)

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

Solution (Python):

n=int(input())
str_n=str(n)
list_n=list(str_n)
count=0
for i in range(0,len(list_n)):
    count+=int(list_n[i])
    
    
if(count%9 == 0 ):
    print("Yes")
else:
    print("No")

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

Solution (Python):
a = 0
s = input()
for c in s:
  a += int(c)

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 = 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=int(input())
result=sum(list(map(int, str(N))))
if result%3==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):
N = input()

def nine(n):
    array = list(map(int,list(n)))
    a = sum(array)
    if a % 9 == 0 :
        print('Yes')
    else :
        print('No')

nine(N)

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

n = list(input())
m = len(n)
t = 0
for i in range(m-1):
    t = (t+int(n[i]))%9

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

Solution (Python):

"""
Created on Sat Aug 22 21:40:47 2020

@author: naoki
"""

N = int(input())

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

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

if n % 9 is 0:
	print('Yes')
else:
	print('No')

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

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

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

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

Solution (Python):
N = list(input())
Ns = sum(int(i) for i in N)

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

Solution (Python):
from sys import stdin, setrecursionlimit,stdout
from collections import deque, defaultdict,Counter
from math import log2, log, ceil,sqrt
from operator import *
input = stdin.readline
setrecursionlimit(int(2e5))
def getstr(): return input()[:-1]
def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint1(): return list(map(lambda x : int(x) - 1, input().split()))
jn = lambda x,l: x.join(map(str,l))

def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp
 

def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a, a)
 

def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return res 
 

def upper_bound(a, x, lo=0):
    hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo
 



def maxSlidingWindow(nums,k):
    windowSum,maxSum = 0,0
    windowSum = sum(nums[:k])
    for end in range(k,len(nums)):
        windowSum += nums[end]-nums[end - k]
        maxSum = max(maxSum,windowSum)
    return maxSum



def twoSum(nums, target):
        left = 0
        right = len(nums)-1
        while left <= right:
            if nums[left]+nums[right] == target:
                return [left,right]
            elif nums[left]+nums[right] < target:
                left +=  1
            else:
                right -= 1
        return 



def prefix(arr):
    a = map(add,arr.insert(0,0))
    return a











def primefs(n):
    
    primes = {}
    while(n%2 == 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    
    
    return primes
 

def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 
 

def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b
 






 

def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;
 
 


def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x
 

def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime



def binsearch(a, l, r, x):
    while l <= r:
        mid = l + (r-1)//2
        if a[mid]:
            return mid
        elif a[mid] > x:
            l = mid-1
        else:
            r = mid+1
    return -1






graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000
 
 
def bfs(d, v):
    q = []
    q.append(v)
    visited[v] = 1
    while len(q) != 0:
        x = q[0]
        q.pop(0)
        for i in d[x]:
            if visited[i] != 1:
                visited[i] = 1
                q.append(i)
        print(x)
 
 
def make_graph(e):
    d = {}
    for i in range(e):
        x, y = mi()
        if x not in d:
            d[x] = [y]
        else:
            d[x].append(y)
        if y not in d:
            d[y] = [x]
        else:
            d[y].append(x)
    return d
 
 
def gr2(n):
    d = defaultdict(list)
    for i in range(n):
        x, y = mi()
        d[x].append(y)
    return d
 
 
def connected_components(graph):
    seen = set()
 
    def dfs(v):
        vs = set([v])
        component = []
        while vs:
            v = vs.pop()
            seen.add(v)
            vs |= set(graph[v]) - seen
            component.append(v)
        return component
 
    ans = []
    for v in graph:
        if v not in seen:
            d = dfs(v)
            ans.append(d)
    return ans


 

MAXN = int(1e6 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    
 

spf = [0 for i in range(MAXN)] 
spf_sieve() 
def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    
    
 




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

MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');
y, n = "Yes", "No"
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12,
       'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24,
       'z': 25}






def solve():
    x = getint()
    if x == 0:
        print(y)
    else:
        c = 0
        for i in str(x):
            c += int(i)
        if c%9 == 0:
            print(y)
        else:
            print(n)

if __name__ == "__main__":
    
    
    
    
    
    solve()

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

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

else:
	print("No")

Solution (Python):
n = input()

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

if total % 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):
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= int(input()) 
if N % 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 = input( )
result = sum(list(map(int, str(n))))

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

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

Solution (Python):
lst = list(input())
total = sum([int(i) for i in lst])
if total % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
s=input()
l=[]
sm=0
arr=["0","1","2","3","4","5","6","7","8","9"]
for i in range(0,10):
  l.append(s.count(arr[i]))
for i in range(0,10):
    a=int(l[i])
    sm=sm+(a*i)
if sm%9==0:
  print("Yes")
else:
  print("No")

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

Solution (Python):
import sys

def total(f):
    t = 0
    while True:
        s = f.read(1)
        if s:
            c = ord(s[0]) - 48
            if 0 <= c <= 9:
                t += c
                continue
        break
    return t

t = total(sys.stdin)
print('Yes' if t % 9 == 0 else 'No')

Solution (Python):
n=str(input())
l=len(n)

while int(n)>9:
    nn=list(n)
    nbox=list(map(int,nn))
    n=str(sum(nbox))
if int(n)==9:
    print('Yes')
elif int(n)==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()
S = 0
for s in N:
    S += int(s)
YesNo = lambda tf: print('Yes') if tf else print('No')
YesNo(S % 9 == 0)

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

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

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = str(input())

c = 0
for i in range(len(N)):
    c += int(N[i])
    c %= 9

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

Solution (Python):
N = input()

acc = 0
for i in N:
    i = ord(i) - ord('0')
    acc += i
    acc %= 9
if acc % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):

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

main()

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

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

Solution (Python):


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

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

if __name__ == "__main__":
    main()

Solution (Python):
N =int(input())
lst = []

N = str(N)

list_num = list(N)

N = [int(s) for s in list_num]
ans = sum(N)

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

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

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

Solution (Python):
n = input()

lis = list(n)
s = 0
for i in lis:
    s += int(i)

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

Solution (Python):

N=input()

tmp=0
for s in N:
  tmp+=int(s)

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

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

if N % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Solution (Python):
N = input()

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

Solution (Python):
def isMultiple9(X):
    count = 0
    for i in X:
        count += int(i)
    
    return 'Yes' if count % 9 == 0 else 'No'

X = str(input())
print(isMultiple9(X))

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

Solution (Python):
s=input();
sum=0;
for i in range(len(s)):
  sum=sum+int(s[i])
if(sum%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) 
  

st = input()
  
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):
n = int(input())

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

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

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

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

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

Solution (Python):
number=input()
sum=0
for i in number:
    sum=sum+int(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 digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

a = int(input())
b = digitSum(a)
if a % 9 == 0:
  if b % 9 == 0:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Solution (Python):
N=input()
n=list(N)
N_int =[int(i) for i in n]

Multi=0
i=0
l=len(N)

for i in range(l):
	Multi=Multi+N_int[i]
	i=i+1

mod = Multi % 9

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

Solution (Python):
def nine():
    N=int(input())
    if N%9 != 0:
        return "No"
    else:
        t=(i for i in str(N))
        sum=0
        for i in t:
            sum+=int(i)
        if sum%9 == 0:
            return "Yes"

print(nine())

Solution (Python):
N = sum(int(i) for i in list(input()))

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

Solution (Python):
def resolve():
	N = input()
	x = 0
	for i in N:
		x += int(i)
	if x%9==0:
		print('Yes')
	else:
		print('No')
resolve()

Solution (Python):

numberString = input()
sumNumber = 0


for i in range(len(numberString)):
  sumNumber += int(numberString[i])
  
  

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

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

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

Solution (Python):
if sum([int(i) for i in list(input())]) % 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=int(input())
if N%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()

if sum(list(int(digit) for digit in N))%9 == 0:
    print('Yes')
else:
    print('No')

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

Solution (Python):
from functools import reduce
N = reduce(lambda x,y:int(x)+int(y), "0"+input())
if not N%9:
  print("Yes")
else:
  print("No")

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

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




def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))




def main():
	n=RD()
	x=0

	for i in n:
		x+=int(i)
		x%=9

	ans="No"
	if x==0:
		ans="Yes"

	print(ans)





if __name__ == "__main__":
	main()

Solution (Python):
n=input()


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

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

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

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

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

Solution (Python):
N=input()
ans=0

for i in N:
    ans=ans+int(i)

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

print("No")

Solution (Python):
N = int(input())
result = 'No'

if N % 9 == 0 and sum(list(map(int, list(str(N))))) % 9 == 0:
      result = 'Yes'

print(result)

Solution (Python):
N = int(input())
array = list(N.__str__())

t = []
for i in range(0, len(array)):
    if int(array[i]) % 9 != 0:
        t.append(int(array[i]))

if sum(t) % 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):
num=int(input())
sum=0
for i in str(num):
    sum+=int(i)
if sum%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
S = input().strip()

cnt = 0
for c in S:
    cnt += int(c)

if (cnt % 9 == 0):
    print("Yes")

else:
    print("No")

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

Solution (Python):

N = list(input())
k = 0

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

if k % 9 == 0:
    print("Yes")

else:
    print("No")

Solution (Python):
def main() :
	n = list(int(j) for j in input().strip())
	s = sum(n)
	if s % 9 == 0 : print("Yes")
	else : print("No")

if __name__ == '__main__' :
	main()

Solution (Python):
def digit_sum(n):
    n_lst = list( str(n) )
    n_sum = 0
    for i in range( len(n_lst) ):
        n_sum += int( n_lst[i] )
    return n_sum

n1 = input()
if digit_sum(n1)%9==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())
if digitSum(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

N = read().rstrip()

x = sum(x - ord('0') for x in N)
print('Yes' if x % 9 == 0 else 'No')

Solution (Python):
a = str(input())
num = int(a)


sub = int(10**(len(a))-1)
if (num-sub)%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = map(str, input())
l = [i for i in N]

num = 0

for i in range(len(l)):
  num += int(l[i])

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

Solution (Python):
n = input()
ans = ["No" for _ in range(9)]
ans[0] = "Yes"
t = 0
for c in n:
    t += int(c)
    t %= 9
print(ans[t])

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

Solution (Python):
from functools import reduce
def main():
    Ns = map(int, input())
    
    result = reduce(lambda a, b : (a + b) % 9, Ns)

    if result == 0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Solution (Python):
l = list(map(int,input().split()))
a=1
for i in l:
    a*=i
if(a%9 == 0):
    print("Yes")
else:
    print("No")

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

l_N = [int(s) for s in N]

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

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

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

Solution (Python):
N = list(input())
N = [int(x) for x in N]

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

Solution (Python):




import sys

readline = sys.stdin.buffer.readline
iimr = lambda: map(int, sys.stdin.buffer.readline().rstrip().split())


def debug(*x):
    print(*x, file=sys.stderr)


class atcoder():
    def __init__(self):
        pass

    def çözmek(self):
        N = input()

        res = []    
        res.append(self.関数(N))
        if res[0] % 9:
            print("No")
        else: 
            print("Yes")
    
    def 関数(self, n):
        gr = len(n)
        wa = 0
        for i in range(gr):
            wa += int(n[i])
        
        return wa

if __name__ == "__main__":
    ima = atcoder()
    ima.çözmek()

Solution (Python):
def main():
  a = 0
  b = 0
  a = int(input())
  b = a%9
  if b==0:
    print("Yes")
  else :
    print("No")
    
if __name__ == '__main__':
    main()

Solution (Python):
n = input()

num = 0

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


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

Solution (Python):
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = input().strip()
    res = 0
    for n in N:
        res += int(n)
        res %= 9
    print("Yes" if res == 0 else "No")


if __name__ == "__main__":
    main()

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

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

Solution (Python):
N=list(str(input()))
sum=0
for i in range(len(N)):
    sum=(sum+int(N[i]))%9
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):
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())
print("Yes") if n % 9 == 0 else print("No")

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

N = int(input())

sum = digitSum(N)

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

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

Solution (Python):


def main():
    input_num = input()
    sum_num = 0

    for i in range(len(input_num)):
        chushutsu = int(input_num[i])
        sum_num += chushutsu
    
    if sum_num % 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):
import sys
import numba
from numba import jit

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

@jit
def main(n):
  wa = 0
  for i in n:
    wa += int(i)
  if wa%9 == 0:
    return 'Yes'
  else:
    return 'No'

n= readline().split()
print(main(n))

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

Nsize = len(N)
for k in range(Nsize):
    N[k] = int(N[k])
Nsum = sum(N)

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

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

if(count % 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):
def sum_digits_string(str1):
    sum_digit = 0
    for x in str1:
        if x.isdigit() == True:
            z = int(x)
            sum_digit = sum_digit + z

    return sum_digit
     
n=input()
if sum_digits_string(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 = list(map(int,input()))

s = sum(n)

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

Solution (Python):
n = input()
s = str(n)
l = len(s)
ans = 0
for i in range(l+1):
    ans += int(s[-i]) 
p = ans-(int(s[-l]))
if p%9 == 0:
    print("Yes")
    exit()
print("No")

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

Solution (Python):
ans = 0

for i in input().split():
    ans += int(i)

print("No" if ans%9 else "Yes")

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

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


Nlist = list(str(N))

keep = list(map(int,Nlist))


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

Solution (Python):
Nlis = list(map(int,input()))

Nsum = sum(Nlis)

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

Solution (Python):
def nineJoke(val):
  if (val % 9 == 0):
    return 'Yes'
  else:
    return 'No'
  
def userInput():
  a = int(input())
  return nineJoke(a)
  
print(userInput())

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