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:
x = str(input())
p=0
for i in range(len(x)):
    p += int(x[i])
if p%9==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = sum(int(d) for d in input())
a = ['No', 'Yes'][num % 9 == 0]
print(a)

Submission status: Accepted

Solution code:
t = 0
for x in map(int, list(input())):
    t += x

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

Submission status: Accepted

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

a = sum(N)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
p = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

x = 0
for i in range(1, 9):
    x += i * N.count(str(i))

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for num in N:
    count += num

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

Submission status: Accepted

Solution code:
N = int(input())

l = str(N)
A = list(map(int, l))
a = sum(A)
  
if a % 9 == 0:
  print("Yes")

else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n= input()
nn=len(n)

sum=0
for i in range(0,nn):
  aa=float(n[i])
  sum+=aa

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n  = str(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:
#a,b,c=map(int,input().split())
n=int(input())
if n%9==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
from sys import stdin

N = stdin.readline().rstrip()
S = [int(s) for s in list(N)]
if sum(S) % 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])
    cnt = cnt % 9
if cnt % 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()
sum = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
X=N%9
if X==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:
def resolve():
    n = str(input())
    s = sum(list(map(int, n)))
    if s % 9 == 0:
        print('Yes')
    else:
        print('No')

resolve()

Submission status: Accepted

Solution code:
def main():
    n = input()

    s = 0

    while n:
        s += int(n[-1])
        n = n[:-1]
    
    if s%9==0:
        print('Yes')
    else:
        print('No')
        
if __name__=='__main__':
    main()

Submission status: Accepted

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

N_len = len(N)
N_sum = 0


for i in range(N_len):
    N_sum += int(N[i])

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

print(ans)

Submission status: Accepted

Solution code:
s=list(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 = int(input())
StrN = str(N)
ans = 0
for i in StrN:
  ans += int(i)

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

Submission status: Accepted

Solution code:
str_n = input()

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

Submission status: Accepted

Solution code:
N = input()
N_list = [int(i) for i in N]

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

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= list(map(int,input()))
if sum(n) %9==0:
    r="Yes"
else: r = "No"
print(r)
# print(sum(n))

Submission status: Accepted

Solution code:
from sys import exit, stdin

# import copy
# from collections import deque,Counter
# import numpy as np
# input = stdin.readline


N = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
sum_of_n = 0
for digit in str(n):
    sum_of_n += int(digit)
    

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    if n%9 == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
AtCoder :: Beginner Contest 176 :: B - Multiple of 9 
https://atcoder.jp/contests/abc176/tasks/abc176_b
"""
import sys


def main():
    """Main program."""
    N = [int(i) for i in sys.stdin.readline().strip()]
    if sum(N) % 9 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

# 整数 N が 9 の倍数であることと、N を十進法で表したときの各桁の数の和が 
# 9 の倍数であることは同値です。
# N が 9 の倍数であるか判定してください。

n = I()
s = 0

n_list = list(str(n))

for i in n_list:
    s = s + int(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def main():

    n = str(input().strip())

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

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

main()

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 = list(input())
Ni = [int(i) for i in N]

t = 0

for i in Ni:
  t += i

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:
def main():
#    N, X, T = map(int, input().split())
    N = input()

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

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

Submission status: Accepted

Solution code:
n = str(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 = input()
ans = 0
for s in n:
    ans += int(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum = 0
for num in str(input()):
  sum += int(num)

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

Submission status: Accepted

Solution code:
'''بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'''
#codeforces
gi = lambda : list(map(int,input().split()))
if sum(list(map(int, list(input())))) % 9:
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
num = input()

sum=0

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

if sum%9==0:
    ans='Yes'
else:
    ans='No'

print(ans)

Submission status: Accepted

Solution code:
N = list(map(int,input()))
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:
s = 0
for x in input():
  s = (s + int(x)) % 9
print('YNeos'[s>0::2])

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a = rr()
b = 0
for i in a:
  b += int(i)
  b = b%9
if b == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin
import math

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ns()

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

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
s = str(n)
array = list(map(int, s))
ans=sum(array)

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

Submission status: Accepted

Solution code:
s = input()
ans = 0
for c in s:
  c = int(c)
  ans = (ans +c )%9

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

Submission status: Accepted

Solution code:
import numpy as np

N = input().rstrip()
L = [int(N[i]) for i in range(len(N))]
M = np.array(L)
sum_M = np.sum(M)

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
num = str(n)
list_num = list(num)
l = [int(s) for s in list_num]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*N, = input()
if sum(map(int, N)) % 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=int(input())
if n%9:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
N = input()

l = len(N)

sum = 0
for i in range(l):
    sum += int(N[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
s = list(n)
sum = 0
for a in s:
    sum += int(a)
    sum %= 9

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def resolve():
    target = input()
    target_sum = sum([int(i) for i in target])
    if target_sum%9 == 0:
        print('Yes')
    else:
        print('No')
resolve()

Submission status: Accepted

Solution code:
n = input()
print('Yes' if sum([int(k) for k in n]) % 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:
n=input()

ln=len(n)
sum=0
for i in range(ln):
    a=int(n[i])
    sum+=a

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

Submission status: Accepted

Solution code:
import math
#n,x,t = map(int,input().split())
n = input()
array = list(map(int,n))
sum_9 = sum(array)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def main():
    N = input()

    answer = 0

    for c in N:
        answer = (answer + int(c)) % 9

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
  N = [int(x) for x in list(input())]

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

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
n = str(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:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


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

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 = input()
n = len(N)

sum = 0
for item in range(n):
  sum += int(N[item])

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

Submission status: Accepted

Solution code:
N = int(input()) #iを取得し、intに値を入れる

s = str(N)
lists = []
for i in range(len(s)):
    lists.append(int(s[i]))
goukei = sum(lists)
if goukei%9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = str(input()) 

ans = 0
for i in range(len(n)):
    ans = ans + int(n[i])
if ans%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()
M = sum(int(n) for n in N)
if M % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()

AAA = map(int, list(N))

BBB = sum(AAA)

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

Submission status: Accepted

Solution code:
import math

n = list(input())

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

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

Submission status: Accepted

Solution code:
n=int(input())

n=str(n)
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().strip()

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

Submission status: Accepted

Solution code:
N = int(input())

temp = 0
for x in str(N):
    temp += int(x)

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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
#a,b,c = list(map(int,input().split()))
 
a = list(input().rstrip())

ans = 0

for dig in a:
  ans += int(dig)
  
#print(ans)
  
if ans % 9 ==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S=input()
L=len(S)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    answer = solve(N)
    print(answer)


def solve(N):
    digits = (int(char) for char in str(N))

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


if __name__ == "__main__":
    main()

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()
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:
# -*- coding: utf-8 -*-
 
N = input()

sum_digit = 0
for i in range( len(N) ):
  temp = N[i]
  #print(temp)
  sum_digit += int(temp)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

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

Submission status: Accepted

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

if i%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()

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

Submission status: Accepted

Solution code:
n = list(map(int,input()))
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:
import sys
N = str(input())

a = 0
for i in N:
    a += int(i)
    a = 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()
s = [char for char in N]
sum_ = 0
for char in s:
    sum_ += int(char)
if sum_ % 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:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

total = sum(array)

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

Submission status: Accepted

Solution code:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    n=int(input())
    arr=list(str(n))
    ans=0
    for i in range(len(arr)):
        ans+=int(arr[i])
        ans%=9
    ans%=9
    if ans==0:
        print("Yes")
    else:
        print("No")

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()

Submission status: Accepted

Solution code:
s = [int(x) for x in input().split()]
if sum(s) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

sum_nine()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3
N = int(input())
ans = 0
for i in str(N):
    ans += int(i)
if ans % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
listA=list(map(ｓｔｒ,input()))
sum=0
for i in range(len(listA)):
  sum=sum+int(listA[i])
  
if sum%9==0:
  print("Yes")

else:
  print("No")

Submission status: Accepted

Solution code:
N = str(input())
s = 0
for i in N:
  I = int(i)
  s += 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 = input()
num = 0
for o in n:
    num += int(o)
if num%9==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

num = int(input())

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

Submission status: Accepted

Solution code:
N = list(input())

count = 0
for val in N:
    count += int(val)

result = 'Yes' if count % 9 == 0 else 'No'

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
num = list(map(int,(list(input()))))

ans = np.sum(num)

if(ans%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()
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()

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

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

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = input()
result = 0
for c in N:
    result = (int(c) + result) % 9

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

Submission status: Accepted

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