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=int(input())
if N%9==0:
  print('Yes')
elif N%9!=0:
  print('No')

Submission status: Accepted

Solution code:
a = list(map(int, list(input())))
b = sum(a)

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

Submission status: Accepted

Solution code:
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    N=str(input())
    sum1=0
    for i in N:
        sum1 += int(i)
    
    if sum1%9 ==0:
        print("Yes")
        sys.exit()
    print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    Nstr = str(N)
    Nsl = list(Nstr)
    ans = 0

    for i in range(len(Nstr)):
        n = int(Nsl[i])
        ans += n

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

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

def solution(n):
    t = 0
    for c in n:
       t += int(c) 
    return 'No' if t % 9 else 'Yes'

n = input()
print(solution(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n_str = input()
n_len = len(n_str)
sur = 0

for i in range(n_len):
    c = n_str[i]
    c_int = int(c)
    sur += c_int
    sur %= 9

if sur:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys

N = str(input())

n = list(map(int, N))

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

Submission status: Accepted

Solution code:
N =input()
count=0
for i in N:
    count +=int(i)

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	s = [int(x) for x in input()]
	sum_s = sum(s)
	if sum_s % 9 == 0:
		print("Yes")
	else:
		print("No")

Submission status: Accepted

Solution code:
string = input()

counter = 0
for i in string:
    counter += int(i)

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n = list(input())

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

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

Submission status: Accepted

Solution code:
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
##import numpy as np
#sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
##def power(x, y):
##    if(y == 0):return 1
##    temp = power(x, int(y / 2))%mo
##    if (y % 2 == 0):return (temp * temp)%mo 
##    else:
##        if(y > 0):return (x * temp * temp)%mo 
##        else:return ((temp * temp)//x )%mo
##
for _ in range(1):
    s=sin().strip();k=0
    for i in s:
        k=(k+int(i))%9
    if(k==0):print("Yes")
    else:print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# from typing import Optional
# from typing import List
# from typing import Dict
# from typing import Tuple
# from typing import Sequence


def main():
    N = map(lambda x: int(x), list((input())))

    result = 0
    for item in N:
        result += item

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

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

Submission status: Accepted

Solution code:
N = list(map(int, input()))
N_len = len(N)
x = 0
for i in range(N_len):
    x += N[i]
if x % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
b = int(len(a))
c = int(0)

for i in range(b):
  c = c + int(a[i])
 
if c % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

abc176b_multiple_of_9()

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:
N=list(map(str,input()))
q=len(N);x=0
for i in range(q):
  x=x+int(N[i])
print("Yes" if x%9==0 else "No")

Submission status: Accepted

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

def digit_sum(s):
	ans=0
	for digit in str(s):
		ans+= int(digit)
	return ans

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

Submission status: Accepted

Solution code:
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 = input()
cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()

num = [int(N[i]) for i in range(len(N))]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

sumN = 0

for n in N:
    sumN += int(n)

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

Submission status: Accepted

Solution code:
N = int(input())
A = 0
N = str(N)
for iter in range(len(N)):
    A  += int(N[iter]) 
   

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

Submission status: Accepted

Solution code:
n = list(input())
x = 0
for i in range(len(n)):
    x += int(n[i])
if x % 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])
    i += 1

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 = str(input())
counter = 0
for n in N:
    counter += int(n)
if counter%9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

l = list(map(int, list(input().strip())))
t = 0
for i in range(len(l)):
    t += l[i]
if t % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
import bisect

import sys
input = sys.stdin.readline

def solve(s):
    ss = sum(map(int,s))
    if ss % 9 == 0:
        print('Yes')
    else:
        print('No')

            

def main():
    s = list(input().rstrip())
    solve(s)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n=list(map(int,list(input().strip())))
print('Yes') if sum(n)%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:
s = input()

a = 0
for i in range(1, 9):
    a += i * s.count(str(i)) % 9
    a %= 9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#
import math
import sys
import itertools
import numpy as np

mojiretsu = list(input())

a=0

for b in mojiretsu:
    a += int(b)
    

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
from collections import Counter

ans = 0
for k,v in Counter(n).items():
  ans += (int(k) * int(v)) % 9

ans = ans % 9

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

Submission status: Accepted

Solution code:
n=input()
l=list(n)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
assert N >= 0 and N <= 1e200000
if sum([int(c) for c in str(N)]) % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())

n = list(n)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
x = 0
for num in a:
  if num != "9" and num != "0":
    x += int(num)
    
if x%9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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:
s = input()
sum=0
for i in s:
    sum+=int(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

if c%9==0 :
    print('Yes')
else :
    print('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:
from collections import Counter
s = input()
dic = Counter(s)
res = 0
for i in range(1,10):
    res += i*dic.get(str(i), 0)
if res%9 > 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N=str(int(input()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if sum % 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=input()

nine = 0
for i in n:
    nine += int(i);

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

Submission status: Accepted

Solution code:
n = input()

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

if sum_val % 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 = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
ns = [int(x) for x in N]

total = 0
for n in ns:
    total += n

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = list(str(a))
ans = 0
for i in b:
    ans += int(i)

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

Submission status: Accepted

Solution code:
nn = str(input())
sum = 0
for i in range(len(nn)):
    sum += int(nn[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

def main():
    n = int(input())
    n_sum = digitSum(n)
    if n_sum%9==0:
        print('Yes')
    else:
        print('No')
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())

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

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

Submission status: Accepted

Solution code:
L=list(input())
M=[]
for i in range(len(L)):
	M.append(int(L[i]))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

x = 0

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

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

Submission status: Accepted

Solution code:
s = input()
num = 0

for i in range(len(s)):
  num = (num+int(s[i]))%9

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INPUT()

    l = [int(s) for s in N]
    print("Yes" if sum(l)%9 == 0 else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
strN = str(N)
number = 0

for s in strN:
    number += int(s)

if number % 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 = int(input())
n_sum = 0
def Sum(n):
    s = str(n)
    arr = list(map(int, s))
    return sum(arr)

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

Submission status: Accepted

Solution code:
def f(n):
    str_n = str(n)
    tmp = 0
    for i in range(len(str_n)):
        tmp += int(str_n[i])
    if tmp%9==0:
        return True
    else:
        return False
        
n = int(input())
if f(n):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X  =  input().strip()  ;
t = 0 ;
for r in X : 
	t += int ( r ) ;

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

Submission status: Accepted

Solution code:
N = str(input())
rem = 0

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

Submission status: Accepted

Solution code:
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:
a = int(input())
if a%9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

N_list = [int(s) for s in str(N)]

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

Submission status: Accepted

Solution code:
N=str(input())
s=0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
c=0
for n in N:
  c+=int(n)
if c%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:
print(["No", "Yes"][sum(int(c) for c in input()) % 9 == 0])

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=input()
res=0
for i in n:
    a=int(i)
    res+=a
if res%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
#if l[i] == l[j]: continue
n = input()
ans = 0

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理
s = str(N)
l = list(map(int, s))
ans = str()
if sum(l) % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

# 結果出力
print(ans)

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

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

b = digitSum(N)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

#print(ans)

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

Submission status: Accepted

Solution code:
n = input()

def main():
    nn = n.replace("9","")
    nn = n.replace("0","")
    s =  0
    for t in nn:
        s += int(t)
    
    if s % 9 == 0:
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
in_nums = input()

total = 0
for s in in_nums:
    total += int(s)

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

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=list(ns())
keta=0
for i in range(len(N)):
    keta+=int(N[i])

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

Submission status: Accepted

Solution code:
n = input()
sum = 0

for i in range(len(n)):
    sum += int(n[i])
    while sum >= 10:
        tmp = sum - 10
        sum = tmp + 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in str(N):
    count +=int(i)

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = [int(c) for c in s]

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

Submission status: Accepted

Solution code:
n = list(input())

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

Submission status: Accepted

Solution code:
a = input()
tot = 0
for i in range(len(a)):
    tot += int(a[i:i+1])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = input()
n = list(n)
sm = 0
for i in range(len(n)):
    sm += int(n[i])
if sm % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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


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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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 = list(input())
n = [int(x) for x in n]
if sum(n) % 9 == 0:
  print("Yes")
else:
  print("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:
def readinput():
    n=input()
    return n

def main(n):
    sum=0
    j=len(n)-1
    while(j>=0):
        sum+=int(n[j])
        j-=1
    if sum%9==0:
        return 'Yes'
    else:
        return 'No'

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