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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

n=input().rstrip()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = input()

num = 0
for e in n:
    num += int(e)
    num %= 9

if num:
    ans = "No"
else:
    ans = "Yes"

print(ans)

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=list(map(int,list(input())))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

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

Submission status: Accepted

Solution code:
N = input()

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

if result % 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()
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:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    a = 0
    for s1 in input():
        a = (a + int(s1)) % 3

    print("Yes" if a == 0 else "No")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce


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

Submission status: Accepted

Solution code:
import math
import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=list(input())

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

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





if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

n=SI()
s=0
for c in n:s+=int(c)
if s%9:print("No")
else:print("Yes")

Submission status: Accepted

Solution code:
def examA():
    N, X, T = LI()
    ans = (1 + (N-1)//X)*T
    print(ans)
    return

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

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = input()[:-1]

su = 0

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

Submission status: Accepted

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

if S%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:
p = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
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:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

s = input()
n = len(s)
ans = 0
for si in s:
    ans = (ans+int(si))%9
if ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = input()

total = 0

for ch in n:
    num = int(ch)
    total += num

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

Submission status: Accepted

Solution code:
n = input()

check = 0

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

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

Solution code:
print('YNeos'[sum(map(int,list(input())))%9>0::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#create date: 2020-08-22 21:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():

    N = input()
    v = 0
    for c in N:
        v += int(c)
    if v % 9 == 0:
        return "Yes"
    return "No"

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

Submission status: Accepted

Solution code:
N = input()
mod9 = 0
for elem in N:
    mod9 += int(elem)
    mod9 %= 9
if mod9 == 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:i+1])
if ans%9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  if N%9==0:
    return 'Yes'
  return 'No'

# main()
print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = list(str(input()))
N = map(int, N)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# by the authority of GOD    author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    n = input().strip()
    x = 0
    for i in n:
        x += int(i)
    if x%9:
        print('No')
    else:
        print('Yes')

#Fast IO 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")
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:
N = input()
ans = 0
for i in N:
    ans += int(i)

print('Yes' if not ans % 3 else 'No')

Submission status: Accepted

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

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 = input().rstrip()
res = 0
for n in N:
    res += int(n)
    res %= 9
if res%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

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

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






if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n = sys.stdin.readline().rstrip()
	cnt = 0
	for si in n:
		cnt += int(si)
	if cnt % 9 == 0:
		print("Yes")
	else:
		print("No")
	


main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
    n = map(int, input().split())
    s9 = sum(n)
    if s9 % 9 == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = readline().strip()

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

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

    return


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N = input().rstrip()

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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = input()
print("YNeos"[sum(int(i) for i in n) % 9 > 0::2])

Submission status: Accepted

Solution code:
n = input()
ans = 0

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

Submission status: Accepted

Solution code:
s = list(input()) #sys.stdin.readlineは最後が改行

cnt=0

for ss in s:
    ss = int(ss)
    cnt+=ss
    cnt%=9

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S = sum(map(int, N))


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    n = list(input())

    res = 0
    for s in n:
        res += int(s)
        res %= 9

    print("Yes" if res == 0 else "No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
s = 0
for t in n:
    s += int(t)
print("Yes" if s%9 == 0 else "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:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = input()
    cur = 0

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0
    for c in N:
        ans += int(c)
    return 'Yes' if ans % 9 == 0 else 'No'


def main():
    N = read_str()
    print(slv(N))


if __name__ == '__main__':
    main()

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()
X=[int(s) for s in n]
if sum(X)%9==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = input()
point = 0

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

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

Submission status: Accepted

Solution code:
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 19 + 7
EPS = 10 ** -10

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections as cc
import sys
import bisect as bi
I=lambda:list(map(int,input().split()))
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:
import sys

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

    N = readline().rstrip()

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

solve()

Submission status: Accepted

Solution code:
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

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

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = input()
    k = 0
    for i in N:
        k += int(i)
        k %= 9

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    N = list(map(int, list(ns())))
    if sum(N) % 9 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
N = input().strip()
a = 0
for n in N:
    a += int(n)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()  
val = 0
for ni in n:
    val += int(ni)

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

Submission status: Accepted

Solution code:
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if n%9==0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

S = list(map(int, list(input().rstrip())))
print("Yes" if sum(S)%9 == 0 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input().strip()

total = 0
for c in N:
	total += int(c)

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

Submission status: Accepted

Solution code:
S = str(input())

ans = 0
for s in S:
    ans += int(s)

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