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



Sample input:
123456789


Sample output:
Yes

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = [int(c) for c in s]
c = 0
for i in range(len(a)):
  c += a[i]
  if c > 8:
    c -= 9
if c == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N = input()
sum1 = 0
for s in N:
    sum1 += int(s)
if sum1 % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

S = 0
for d in N:
    S += int(d)

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
n=input()
cnt=0
for k in n:
    cnt+=int(k)
if cnt%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
num = 0

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

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

Submission status: Accepted

Solution code:
N=list(input())
S=[int(t) for t in N]
T=sum(S)
if T%9==0:
  print("Yes")
else :
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = input()
res = 0
for x in n:
    res += int(x)
    res %= 9
print('Yes' if res == 0 else 'No')

Submission status: Accepted

Solution code:
n = input()
mod = 0
for c in n:
    mod += int(c)
    mod %= 9
if mod==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = str(input())
total = 0
for num in n:
    total += int(num)
if total % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
sn = sum(list(int(i) for i in n))
if sn%9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
A = list(input())
su=0
for i in A:
  su+=int(i)
print("Yes" if su%9==0 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


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

else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()

l=len(n)
mod=9
judge=0
for i in range(l):
    judge+=int(n[i])
    judge%=mod

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

Submission status: Accepted

Solution code:
N = input()
print('No' if sum(int(i) for i in N) % 9 else 'Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
nums = 0
for i in s:
    nums += int(i)

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
s = input()

def rec(s):
    if len(s) == 1:
        print('Yes' if s in ('0', '9') else 'No')
        sys.exit()

    acc = 0
    for c in s:
        acc += int(c)

    rec(str(acc))

print(rec(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import 
n=input()
#=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    def calcSumOfDigit(x):
        str_x = str(x)
        acc = 0
        for s in str_x:
            acc += int(s)
            acc %= 9
        return acc
    
    print("Yes" if calcSumOfDigit(N)==0 else "No")
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

Solution code:
n=list(input())
ans=0

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

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

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))

print('No' if sum(n) % 9 else 'Yes')

Submission status: Accepted

Solution code:
N = list(map(int, list(input())))

A = sum(N)

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

Submission status: Accepted

Solution code:

N = int(input())#整数

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

digit_sum = 0
strN = str(N)

for i in range(len(strN)):
    digit_sum += int(strN[i])

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

Submission status: Accepted

Solution code:
print(['No', 'Yes'][sum(map(int, list(input()))) % 9 == 0])

Submission status: Accepted

Solution code:
n = input()
rem = 0
for d in n:
  rem += int(d)
if rem % 9 == 0:
  print ("Yes")
else:
  print ("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=list(str(input()))
M=list(map(int,N))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! /usr/bin/env python3
import itertools
import numpy as np
import fractions
from itertools import combinations
from functools import reduce
from functools import lru_cache
import math
from collections import deque
import decimal
import bisect
import heapq
import sys
sys.setrecursionlimit(10**9)


YES = "Yes"  # type: str
NO = "No"  # type: str


def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def solve(N: str):
    s = 0
    for n in N:
        m = int(n)
        s += m
        s %= 9
 
    print(YES if s % 9 == 0 else NO)
    return

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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

temp = 0

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = map(int,input().split())
if (sum(a)%9==0):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline=sys.stdin.readline

N=readline().rstrip()

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

Submission status: Accepted

Solution code:
N = list(input())
NSum = 0
ans = "No"

for i in N:
  NSum += int(i)
if NSum % 9 == 0:
  ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
n=str(N)
listst=list(n)
lists=[int(str) for str in listst]
#print(lists)
A=sum(lists)
if A%9==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# Python template 
from collections import defaultdict 
import sys
import math 

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

s = input()

ans = 0

for i in s:
    ans = (ans+int(i))%9

if ans:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = str(input())
if int(N)%9 != 0: print("No")
else:
    if int(N) == 0 :print("Yes")
    else:
        sum = 0
        for ki_tu in N:
           sum += int(ki_tu)
        if sum%9 == 0: print("Yes")
        else: print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def tc():
    n = int(input())
    digsum = sum(map(int, str(n)))
    if digsum % 9:
        print('No')
    else:
        print('Yes')


tc()

Submission status: Accepted

Solution code:
def ismof9(n):
    _str = str(n)
    _sum = 0
    for ch in _str:
        _sum += int(ch)
    if _sum % 9 == 0:
        return "Yes"
    else:
        return "No"


def main():
    n = int(input())
    print(ismof9(n))

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(10000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    n = input()
    s = 0
    for i in n:
        s += int(i)
    if s%9 == 0:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
tmp=0
for i in n:
    tmp+=int(i)
    tmp%=9

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

Submission status: Accepted

Solution code:
n = int(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")

Submission status: Accepted

Solution code:
s = input()
x = 0
for c in s:
    x += int(c)
    x %= 9
print("Yes" if x == 0 else "No")

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a=int(eval("+".join(s)))
if a%9:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 176
# B - Multiple of 9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 22/08/2020

from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007

n = is1()
tot = 0
for i in n:
    tot += int(i)
if tot % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
number = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
c=0
for i in range(len(s)):
  c += int(s[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = input()

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

print(["No", "Yes"][res % 9 == 0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#import collections as col
input=sys.stdin.readline

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().rstrip().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def facto(x, y, mod):
	re = 1
	for i in range(y, x+1):
		re *= i
		re %= mod
	#print(re, file=sys.stderr)
	return re

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    #return facto(n, n-r+1, mod) * g2[r] % mod
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
NN = 10**5+10
g1 = [1, 1] # factorial
g2 = [1, 1] # factorial^(-1)
inverse = [0, 1] # tmp

def init_comb():
    for i in range( 2, NN + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )


def main():
	A,B = linput()
	M = mod
	
	res = cmb(B+1, A+1, M)
	print(res)

def solve():
	S, = linput(str)
	res = 0
	mod = 9
	
	t = int(S)%9
	
	
	sT = "No Yes".split()
	res = sT[t < 1]
	print(res)
	
	
solve()

#init_comb()
#main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#import collections as col
input=sys.stdin.readline

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().rstrip().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def facto(x, y, mod):
	re = 1
	for i in range(y, x+1):
		re *= i
		re %= mod
	#print(re, file=sys.stderr)
	return re

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    #return facto(n, n-r+1, mod) * g2[r] % mod
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
NN = 10**5+10
g1 = [1, 1] # factorial
g2 = [1, 1] # factorial^(-1)
inverse = [0, 1] # tmp

def init_comb():
    for i in range( 2, NN + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )


def main():
	A,B = linput()
	M = mod
	
	res = cmb(B+1, A+1, M)
	print(res)

def solve():
	S, = linput(str)
	res = 0
	mod = 9
	
	t = 0
	for s in S:
		t = 10*t + int(s)
		t %= mod
	
	sT = "No Yes".split()
	res = sT[t < 1]
	print(res)
	
	
solve()

#init_comb()
#main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

Solution code:
n=input()
if sum([int(c) for c in n])%9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N=input()
A=0

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

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

Submission status: Accepted

Solution code:
N = input()
total = 0
for n in N:
    total += int(n)

print(["No", "Yes"][total % 9 == 0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())

sum = 0
for dig in N:
    sum += int(dig)

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

Submission status: Accepted

Solution code:
n = map(int, (input()))
sum = 0
for i in n:
    sum += i

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

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

n = [int(i) for i in n]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = input()
ans = 0
for i in N:
    ans += int(i)
    ans = ans % 9
if ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
cur = 0

for x in n:
    cur += int(x)

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

Submission status: Accepted

Solution code:
N = input()
k = 0
for i in N:
    k += int(i)
if k%9:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Multiple of 9


def main(n):
    s = 0
    for u in list(n):
        s += int(u)
        if 8 < s:
            s = s % 9
    return s == 0


N = input().strip()
result = main(N)
if result:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n_list = list(input())

a = 0
for num_s in n_list:
    a += int(num_s)

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

Submission status: Accepted

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