Problem:


Score : 200 points

Problem Statement

An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.

Determine whether N is a multiple of 9.

Constraints

0 \leq N < 10^{200000}

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

If N is a multiple of 9, print Yes; otherwise, print No.

Sample Input 1

123456789

Sample Output 1

Yes

The sum of these digits is 1+2+3+4+5+6+7+8+9=45, which is a multiple of 9, so 123456789 is a multiple of 9.

Sample Input 2

0

Sample Output 2

Yes

Sample Input 3

31415926535897932384626433832795028841971693993751058209749445923078164062862089986280

Sample Output 3

No



Sample input:
123456789


Sample output:
Yes

Submission status: Accepted

Solution code:
N = input()

res = 0
for x in N:
    res += int(x)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()


sum = 0

for s in N:
    sum += int(s)

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

Submission status: Accepted

Solution code:
def main():
    N = map(int, input())
    if sum(N) % 9 == 0:
        return "Yes"
    else:
        return "No"

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    sm = 0
    N = input()
    for c in N:
        sm = (sm + int(c)) % 9
    if (sm == 0):
        print("Yes")
    else:
        print("No")


main()

Submission status: Accepted

Solution code:
print('NYoe s'[sum([int(i) for i in input()])%9==0::2])

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

input = sys.stdin.readline


def Y():
    print("Yes")


def N():
    print("No")


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


n = S()

ans = 0
for s in list(n):
    ans += int(s)

if ans % 9 == 0:
    Y()
else:
    N()

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 range(len(n)):
    ans += int(n[i])

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

Submission status: Accepted

Solution code:
N = str(input())

x = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

s = str(a)

ls = len(s)

x = list(s)

res =0

for i in range(ls):
    res += int(x[i])

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

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

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

N=list(input().rstrip('\n'))
n = [int(x) for x in N]
if sum(n)%9==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
t = 0

for c in N:
    t += int(c)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readstr()
    c = 0
    for n in N:
        c += int(n)
    print("Yes" if not c % 9 else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    ss=readline().rstrip()
    n=0
    for s in ss:
        n+=int(s)
    #yn(1)
    if n%9 == 0:
        print("Yes")
    else:
        print("No")

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

Solution code:
N = [int(n) for n in list(input())]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

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

Submission status: Accepted

Solution code:
n=input()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()

s = 0

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

s = str(s)
s2 = 0

for n in s:
    s2 += int(n)

if s2%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:
# -*- coding: utf-8 -*-
import math
from operator import mul
from functools import reduce
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan2, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


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



if  __name__=='__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N):
    S = 'aaa'
    x = 0
    for n in N:
        x += int(n)
    print('Yes' if x % 9 == 0 else 'No')


if __name__ == '__main__':
    # S = input()
    N = input()
    # N, M = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N)

Submission status: Accepted

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

Submission status: Accepted

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

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


def solve(N: str):
    sum = 0
    for d in list(N):
        sum += int(d)

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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  # type: str
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
mod=0
for i in range(len(n)):
  a=int(n[i])
  mod+=a%9

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

Submission status: Accepted

Solution code:

n = map(int, input())

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

Submission status: Accepted

Solution code:
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


s = data()
answer = 0
for i in s:
    answer += int(i)
    answer %= 9
if answer == 0:
    out("Yes")
    exit()
out("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
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())

N = S()
A = []
for i in range(len(N)):
    A.append(int(N[i]))
ans = sum(A)
if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
"""
    Satwik_Tiwari ;) .
    21st AUGUST , 2020  - FRIDAY
"""

#===============================================================================================
#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 graph(vertex): return [[] for i in range(0,vertex+1)]
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 google(p):
    print('Case #'+str(p)+': ',end='')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(x, y, p) :
    res = 1     # Initialize result
    x = x % p  # Update x if it is more , than or equal to p
    if (x == 0) :
        return 0
    while (y > 0) :
        if ((y & 1) == 1) : # If y is odd, multiply, x with result
            res = (res * x) % p

        y = y >> 1      # y = y/2
        x = (x * x) % p
    return res
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) :
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

#===============================================================================================
# code here ;))
@iterative
def dfs(v,visited,st,new):
    new.append(st)
    visited[st] = 1
    for i in v[st]:
        if(visited[i] == 0):
            ok = yield dfs(v,visited,i,new)
    yield True


def solve():
    s = inp()
    sum = 0
    for i in range(len(s)):
        sum+=int(s[i])

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






testcase(1)
# testcase(int(inp()))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())
num = 0
for s in N:
    num += int(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

r = 0
for d in n:
    r += int(d)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(str(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=str(input())

s=0

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math 
# sys.stdin = open('input.txt', 'r')  
# sys.stdout = open('output.txt', 'w')
n = int(input())
if n % 9 == 0:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

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

    print('No') if N % 9 else print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()

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

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = s_input()

    len_n = len(n)

    count = 0

    for c in n:
        count += int(c)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = input()

S = 0
for a in N:
    A = int(a)
    S += A
    S = S % 9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N = input()
    digit_sum = 0
    for i in range(len(N)-1):
        digit_sum += int(N[i])
    if digit_sum % 9 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = str(input())

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

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

Submission status: Accepted

Solution code:
N = input()

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

print(['No','Yes'][s % 9 == 0])

Submission status: Accepted

Solution code:
n=input()
a=0
for i in range(len(n)):
    a+=int(n[i])
    a%=9
print('NYoe s'[a==0::2])

Submission status: Accepted

Solution code:
N = str(input())

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

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



# 2darray [[0] * 4 for i in range(3)]
# import itertools

Submission status: Accepted

Solution code:
N = list(input())

ans = 0

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Submission status: Accepted

Solution code:
n=int(input())
s=0
for i in str(n):
    s+=int(i)
while s>10000:
    a=0
    for i in str(s):
        a+=int(i)
    s=a
if s%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:
A = input()
S = 0
for c in A:
    S += ord(c) - ord('0')
    S %= 9

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys 
from collections import Counter,deque,defaultdict
from itertools import combinations,permutations,accumulate
from bisect import bisect_left,bisect
sys.setrecursionlimit(10**6)
INF = 10**9+7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode().rstrip()
N = len(S)
cnt = 0
for i in range(N):
    cnt += int(S[i])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()
cnt = 0
for c in N:
    cnt += int(c)

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:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
def main():
    N = str(input())
    sum = 0

    for val in N :
        sum = sum + int(val)

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




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = input()

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


main()

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:
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()
out = 0
for c in s:
    nn = int(c)
    out += nn
    out = out % 9

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