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:
# ===============================================================================================
# importing some useful libraries.
from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb  # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
# If the element is already present in the list,

# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect

# If the element is already present in the list,
# the right most position where element has to be inserted is returned

# ==============================================================================================
# fast I/O region

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


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

# inp = lambda: sys.stdin.readline().rstrip("\r\n")

# ===============================================================================================
### START ITERATE RECURSION ###
from types import GeneratorType


def iterative(f, stack=[]):
    def wrapped_func(*args, **kwargs):
        if stack: return f(*args, **kwargs)
        to = f(*args, **kwargs)
        while True:
            if type(to) is GeneratorType:
                stack.append(to)
                to = next(to)
                continue
            stack.pop()
            if not stack: break
            to = stack[-1].send(to)
        return to

    return wrapped_func


#### END ITERATE RECURSION ####

# ===============================================================================================
# some shortcuts

mod = 1000000007


def inp(): return sys.stdin.readline().rstrip("\r\n")  # for fast input

def out(var): sys.stdout.write(str(var))  # for fast output, always take string

def lis(): return list(map(int, inp().split()))

def stringlis(): return list(map(str, inp().split()))

def sep(): return map(int, inp().split())

def strsep(): return map(str, inp().split())


def zerolist(n): return [0] * n

def nextline(): out("\n")  # as stdout.write always print sring.

def testcase(t):
    for p in range(t):
        solve()

def printlist(a):
    for p in range(0, len(a)):
        out(str(a[p]) + ' ')


def solve():
    s=inp()
    a=0
    for i in s:
        a+=int(i)
    if a%9==0:
        print("Yes")
    else:
        print("No")

    
    
    
solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
N = [int(c) for c in s]
add = 0

for i in range(len(N)):
  num = N[i]
  add += num
if add % 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 = ans%9
if (ans == 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 = input()
check = 0
for i in N:
  check += int(i)
if check % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = input()
    n_list = []

    for n in N:
        n_list.append(int(n))

    n_sum = sum(n_list)

    ans = 'Yes' if n_sum % 9 == 0 else 'No'

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = list(input())

nums = [int(s) for s in l]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

Solution code:
x = input()
s = 0

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

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

Submission status: Accepted

Solution code:
N = input()

sum = 0

for i in range(10):
    sum += N.count(str(i)) * 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:
s = list(map(int, input()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum = 0
num = input()

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = list(input().rstrip())
    ans = 0
    for n in N:
        ans += int(n)
    if ans%9 == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N=map(int,input())
    
    add = sum(list(N))
    if add%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 math
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from numba import jit
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
import time
 
def main():
    N = input()
    sum = 0
    for n in N:
        sum+=int(n)
    print("Yes" if sum%9==0 else "No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
##B - Multiple of 9
N = int(input())
if N % 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:
s = sum(int(i) for i in input())
if s % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def resolve(in_):
    _N = next(in_).strip()
    N = map(int, _N)
    s = sum(N)
    return 'Yes' if s % 9 == 0 else 'No'


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

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 = 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()
total = 0
for i in range(10):
    total += n.count(str(i)) * i
if total % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = input()

ls = list(n)

wa = 0
for i in range(len(ls)):
    wa += int(ls[i])


print('Yes') if wa % 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 % 3 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

res = 0

for e in n:
    res += int(e)

if res % 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):
    B = [0]

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

        B.append(T)

    A = B[len(N)] - B[0]

    if A % 9 ==0:
        return print(YES)
    else:
        return print(NO)


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

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

print("Yes") if(num % 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 = int(input())
if s%9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc176/tasks/abc176_b
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())

array = list(map(int, s))

a = sum(array)

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 = int(input())
sumOfN = sum(int(i) for i in list(str(n)))
print("No" if sumOfN%9 else "Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str=input()
l=len(str)
n=0
while l>0:
    n=n+int(str[l-1])
    l=l-1
if n%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:
print('YNeos'[int(input())%9>0::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
cur = 0

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

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

Submission status: Accepted

Solution code:
from sys import stdin



test = list(stdin.readline().rstrip())
 
result=0
 
for i in test:
  result = result + int(i)
 
if (result % 9) == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce

print("Yes" if reduce(lambda a, b: (a+b)%9, map(int, input()), 0) == 0 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

test = list(stdin.readline().rstrip())
 
result=0
 
for i in test:
  result = result + int(i)
 
if (result % 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:
from sys import stdin
import math

test = list(stdin.readline().rstrip())

result=0

for i in test:
  result = result + int(i)

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

Submission status: Accepted

Solution code:
import math
n = sum([int(x) for x in str(input()).split()])

a, b = divmod(n, 9)

print("No" if b else "Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
sum = 0
for x in s:
    sum += int(x)

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

Submission status: Accepted

Solution code:
n=input()
al=len(n)
ans=0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nstr=input()
keta=len(nstr)
wa=0
for i in range(keta):
    wa+=int(nstr[i])

ans="No"
if wa%9==0:
    ans="Yes"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def mult(n):
    res = 0 
    for i in n:
        res += int(i)

    if res%9 != 0:
        return "No"
    return "Yes"

n = input()
print(mult(n))

Submission status: Accepted

Solution code:
print('Yes' if int(input()) % 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:
def multipleOf9(n)-> str:
  if (n % 9) == 0:
    return 'Yes'
  return 'No'

if __name__ == "__main__":
  num = list(map(int, input().split()))
  print(multipleOf9(num[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()
N_list = []
for i in N:
    N_list.append(int(i))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

d = 0
while True:
    d += n // 10
    n -= d*10

    if n < 10:
        d += n
        break

if not d % 9:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
 
N=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

s = 0
for d in N:
    s += ord(d) - ord('0')
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = str(input())

count = 0
for v in list(n):
    count += int(v)

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

Submission status: Accepted

Solution code:
import sys
import math

n = str(sys.stdin.readlines()[0])

tot = 0
for dig in n[0:-1]:
    # print(dig)
    tot += int(dig)

if tot % 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:
import math

num = input()

l = len(num)

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

ans = k % 9

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

else:
    print("No")

Submission status: Accepted

Solution code:
o = ['No','Yes']
f = 0
N = str(input())
p = sum(list(map(int,N)))
r = p % 9

if r == 0:
    f = 1
else:
    f = 0

print(o[f])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np 

s_ = input()
s = np.array([int(s_[i]) for i in range(len(s_))])
k = 0
for n in s:
    k += n
if k % 9 ==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, os.path

if(os.path.exists('input.txt')):
    sys.stdin = open('input.txt',"r")
    sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def II(): 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 solve():
    sum=0
    lst = list(input())
    for _ in range(len(lst)):
        sum+=int(lst[_])
    if sum%9==0:
        print("Yes")
    else:
        print("No")
solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=sum(map(int,str(input())))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sn = input()

n = 0

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



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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
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:
print('YNeos'[sum(map(int,input().split()))%9!=0::2])

Submission status: Accepted

Solution code:
n = input()
total = sum(list(map(int, n)))
while True:
    if int(n) == 0:
        print('Yes')
        break
    if len(str(total)) != 1:
        total = sum(list(map(int, str(total))))
    elif total == 9:
        print('Yes')
        break
    else:
        print('No')
        break

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()
check = 0

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

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

Submission status: Accepted

Solution code:
N = int (input ())

#while (N>8):
#    N -= 9
#
#if (N == 0):
#    print("Yes")
#else:
#    print("No")

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
if int(input()) % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
sum_ = sum(list(map(int,input())))
if sum_ % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())
s = []
for i in list(n):
    s.append(i)
t = list(map(int,s))
ans = sum(t)
if ans%9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x = input().split()
sum = 0

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

Submission status: Accepted

Solution code:
a = str(input())
b = []
c = 0
for i in range(len(a)):
    b.append(int(a[i]))
if sum(b) % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B
N = str(input())

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

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


# #A
# N, X, T = map(int, input().split())

# print(T * (N//X if N % X == 0 else N//X+1))

Submission status: Accepted

Solution code:
def main():
    numList = list(map(int,input()))
    s = sum(numList)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
N = input()

# 数値を文字列に変換
# １文字ずつ数値化し配列にする。
array = list(map(int, N))
# 各桁の和計算と判定
if sum(array) % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

total = sum(num_list)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())
A = 0

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

Submission status: Accepted

Solution code:
N = input()
digit_sum = 0
for i in range(len(N)):
    digit_sum += int(N[i])
if digit_sum % 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
print("YNeos"[ans!=0::2])

Submission status: Accepted

Solution code:
inputStr = input()
array = [int(i) for i in inputStr]
sum = 0

for num in array:
    sum += num

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

Submission status: Accepted

Solution code:
def solve(string):
    return "Yes" if sum(map(int, list(string))) % 9 == 0 else "No"


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
N = input()

tmp = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#codinng:utf-8

N = int(input())
count = 0

while N > 0:
    count += (N % (10 ** 100)) % 9
    N = N // (10 ** 100)

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

Submission status: Accepted

Solution code:
N = input()
check = 0

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

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

Submission status: Accepted

Solution code:
N = input()

if int(N) < 10:
    if int(N) == 9:
        print('Yes')
    elif int(N) == 0:
        print('Yes')
    else:
        print('No')
elif int(N) >= 10:
    l = [int(n) for n in list(N)]
    a = sum(l)
    if a % 9 == 0:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
def main():
    s=sum(map(int,input()))
    print('No' if s%9 else 'Yes')
main()

Submission status: Accepted

Solution code:
n = input()

list = []

for i in range(len(n)):
    list.append(int(n[i]))


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