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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# print('input >>')
N = input()

gokei = sum([int(n) for n in N])

# print('-----output-----')
if gokei % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

n = input().strip()
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 i in range(len(n)):
  cnt+=int(n[i])
if cnt%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):
    a = 0
    for n in N:
        a+=int(n)
        a%=9
    if a==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:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = list(input())[:-1]
n = len(N)
b = 0
for i in range(n):
    s = N[i]
    a = int(s)
    b += a
    b %= 9
if b % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


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

Submission status: Accepted

Solution code:
import sys
import math
N = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
N = int(input())

str_N = str(N)

tmp = 0

for n in str_N:
    tmp += int(n)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
sum=0
for i in n:
    sum+=ord(i)-ord('0')
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
N = input()
amari = 0
for i in N:
    amari += int(i) % 9
    if amari >= 9:
        amari %= 9

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

Submission status: Accepted

Solution code:
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase


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

"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""



def inpt():
    return [int(k) for k in input().split()]


def main():
    n=input()
    val=0
    for i in n:
        val*=10
        val+=int(i)
        val%=9
    if(val):
        print('No')
    else:
        print('Yes')


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()

Submission status: Accepted

Solution code:
#b
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:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
n = str(n)
res = 0
for elem in n:
    res += int(elem)
if res % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
total = 0
for c in input():
    total += int(c)
print(['No', 'Yes'][total % 9 == 0])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    s = list(input().strip())
    ans = 0
    for i in range(len(s)):
        ans += int(s[i])
    if ans % 9 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

digit_sum = 0

for c in S:
    digit_sum += int(c)

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

Submission status: Accepted

Solution code:
'''
Created on 2020/08/22

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=pin()[:-1]
  N=list(map(int,N))
  if sum(N)%9==0:
    print("Yes")
  else:
    print("No")
  return 
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


nums = list(map(int, (list(input()))))
# print(nums)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

Submission status: Accepted

Solution code:
N = input()

ans = 0

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
    ans = ans%9
if ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = input()

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

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

Submission status: Accepted

Solution code:
# abc176=b.py
N = input()
ans = 0
for i in N:
    n = int(i)
    ans+=n
    ans %= 9
if ans %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 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

sum = 0
for i in range(len(S)):
    sum += int(S[i])

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = S()
    n = list(n)
    n = list(map(int,n))
    s = sum(n)
    if s%9 == 0:
        print("Yes")
    else:
        print("No")
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
result = sum(list(map(int, str(n))))
if result%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:
import math
n=input()
g=0
for i in n:
  g=g+int(i)
if g%9==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = list(input())
    su = 0
    for d in S:
      su += int(d)

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

v = 0
for c in s:
    v += int(c)
    v %= 9

if v == 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:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

N=int(input())

string = str(N)
ans = 0

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

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

Submission status: Accepted

Solution code:
def main():
    N = list( map( int, list( input())))
    nine = sum(N)
    if nine%9 == 0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys

n = stdin.readline().rstrip()
num = 0
for el in n:
    num += int(el)
if num % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = input()
res = 0

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

Submission status: Accepted

Solution code:
N = list(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:
#!/usr/bin/env python
# coding: utf-8

# In[6]:


N = input()


# In[7]:


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


# In[ ]:

Submission status: Accepted

Solution code:
def main():
    N = input()
    ans = 0
    for ch in N:
        ans += int(ch)

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


if __name__ == "__main__":
    main()

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

L = len(N)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
SUM = sum([int(N[i]) for i in range(len(N))])
if SUM%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])
    ans%=9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = SS()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = SI()
    x = 0
    for i in N:
        x += int(i)
    if x % 9:
        print('No')
    else:
        print('Yes')



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S=list(input())
d=[int(s) for s in S]
ans=0
for i in range(len(S)):
    ans+=d[i]
if ans%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:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
n=list(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:
n = input()
r = 0
for c in n:
  r += int(c)
if r % 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:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = input()
    s = sum(int(c) for c in n)
    if s % 9 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import ceil
from collections import defaultdict as dd
import sys
input=sys.stdin.readline
#n=int(input())
n=input().split()[0]
su=0
for i in n:
    su=(su+int(i))%9
if(su==0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N=str(input())
x=0
ans="No"
for i in range(len(N)):
    x+=int(N[i])
    x=x%9
if x==0:
    ans="Yes"
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 = str(input())
tmp = 0
for i in N:
    tmp += int(i)

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

Submission status: Accepted

Solution code:
from math import *

s=input()

val=0
for i in s:
	val=val+int(i)

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

Submission status: Accepted

Solution code:
n=list(input())
cnt=0
for i in n:
    cnt+=int(i)
print("Yes" if cnt%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()
count=0
for n in N:
    count+=int(n)
print('YNeos'[count%9>0::2])

Submission status: Accepted

Solution code:

import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return map(lambda x: x + d, A)
def ldec(A, d=1): return map(lambda x: x - d, A)

N = s1()

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

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = input()
    if sum(int(c) for c in N)%9 == 0:
        return 'Yes'
    return 'No'


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

total = 0
for s in n:
    v = int(s)
    total += v

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

Submission status: Accepted

Solution code:
a = input()

s = 0
for x in a:
    s += int(x)
    s %= 9

if s == 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])

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def solve():
    S = input()
    total = 0
    for s in S:
        total += int(s)

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

N = input()


def main():
    s = sum([int(x) for x in N])
    if s % 9 == 0:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
strN = input().rstrip()

s = 0
for Ni in strN:
    Ni = int(Ni)
    s += Ni
    s %= 9

if s == 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])
    
if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = str(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
sum_n = 0
for ni in n:
    sum_n = (sum_n + int(ni)) % 9
if sum_n == 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])
print("Yes") if a%9 == 0 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 main():
    n = input()
    s = 0
    for i in n:
        s = (s + int(i)) % 9
    print('Yes') if s % 9 == 0 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 = sum(list(map(int, input().split())))

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

str_n = str(n)

tot = 0

for ch in str_n:
    tot += int(ch)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=input()
mod=9
ans=0

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