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:

import glob
import os

bn = os.path.basename(__file__).split('.')[0]
dn = os.path.dirname(__file__).split('/')

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = dn[len(dn)-2] + '\\' + dn[len(dn)-1] + '\\' + bn

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        N = self.input_data()

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

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



solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

Solution code:
s = str(input())

n = len(s)

c = 0
for i in range(n):
    c += int(s[i])

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

Submission status: Accepted

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

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

main()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

t = n[0]
for i in range(1,len(n)): t += "+" + n[i]
if int(n)%9 == 0 and eval(t)%9 == 0: print("Yes")
else: print("No")

Submission status: Accepted

Solution code:
N = input()

chk= 0
for s in N:
    chk += int(s)

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

Submission status: Accepted

Solution code:
from functools import reduce
from operator import add
N = map(int, list(input()))
ans = reduce(add, N)
print("Yes" if ans%9==0 else "No")

Submission status: Accepted

Solution code:
#coding: utf-8
from collections import defaultdict
import sys

N = input()

s  = 0

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

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

Submission status: Accepted

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

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

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

    else :
        print("No")


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n=input()

num=0
for i in range(len(n)):

    num += int(n[i])

if num%9 == 0:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S = str(input())

Sum = 0

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

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

Solution code:
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(("No","Yes")[Number % 9 == 0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
Ns = sum([int(i) for i in s])

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

Submission status: Accepted

Solution code:
n = str(input())
l = len(n)
c = 0

for i in range(l):
    c = c + int(n[i])

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
S = str(input())

A = [int(s) for s in S]

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

Submission status: Accepted

Solution code:
A = input()

sum = 0
for a in A:
  sum += int(a)

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

def check(S):
    if int(S) < 10:
        return int(S) % 9 == 0 
    else:
        return check(str(sum(map(int, S))))
print('Yes' if check(S) else 'No')

Submission status: Accepted

Solution code:
# 2020/08/22
# AtCoder Beginner Contest 176 - B

# Input
n = input()
nlen = len(n)

# Calc
nsum = 0
for i in range(nlen):
    nsum = nsum + int(n[i])

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

# Output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

a = 0

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

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

Submission status: Accepted

Solution code:
n = input()
keta = len(n)
ans = 0
for i in n:
    ans += int(i)

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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

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

Submission status: Accepted

Solution code:
def ok (s):
    if len(s) == 1:
        if s == '0' or s == '9':
            return 'Yes'
        else:
            return 'No'
    return ok(str(sum(map(int, s))))

print(ok(input()))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


n = input()

r = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input().strip()
d = sum([int(v) for v in N])

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

Submission status: Accepted

Solution code:
N = input()
ans = 0
while N:
    ans += int(N[-1])
    ans = ans % 9
    N = N[:-1]
if ans == 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])
    s %= 9
if s == 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 = list(input())
sam = 0
for n in N:
  sam += int(n)
if sam%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:
sum=0
i=list(input())
for j in i:
    sum+=int(j)
if sum%9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

def dsum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(s) for s in input()]
print('Yes' if sum(l) % 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:
# B - Multiple of 9
N = input()
L = len(N)
ans = 0
for i in range(L):
    ans += int(N[i])
if ans%9==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N=int(input())
#A="a"
#N,X,T=map(int,input().split())
#ans=math.floor(N/X)


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8
import sys
def input():
    return sys.stdin.readline()[:-1]
"""
整数 Nが9の倍数であることと、Nを十進法で表したときの各桁の数の和が9の倍数であることは同値です。
Nが9の倍数であるか判定してください。
"""
N = int(input())
N = str(N)
v = 0
for n in N:
    v += int(n)
if v%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = input()

a= 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
sum = 0

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

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)

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

Submission status: Accepted

Solution code:
N_str = input()

sum_digits = 0
for N_digit in N_str:
    sum_digits += int(N_digit)
    sum_digits %= 9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    M = len(N)

    tot = 0

    for i in range(M):
        tot += int(N[i])
        tot %= 9

    if tot == 0:
        res = 'Yes'
    else:
        res = 'No'

    print(res)



main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
S = [int(s) for s in input()]
ans = 'No'

if sum(S) % 9 == 0:
    ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:

s = input()

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

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

Submission status: Accepted

Solution code:
N = input()

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

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

Submission status: Accepted

Solution code:
import numpy as np

N = str(input())
array = np.array(list(map(int, N)))

s = np.sum(array)
if s % 9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
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()
keta_sum = sum([int(s) for s in N])

if keta_sum % 9==0:
    print('Yes')
    exit()
print('No')

Submission status: Accepted

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

sn = input()
ans = 0 



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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
# cook your dish here
s=input()
num=0
for i in s:
    num+=int(i)
    
if num%9==0:
    print('Yes')
    
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
s = 0
for n in map(int, list(input())):
    s += n

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

Submission status: Accepted

Solution code:
N = input()

total = sum(int(x) for x in N)

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
num = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = input()
t = 0
for i in range(len(n)):
    t += int(n[i])
    t = t % 9
if t == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
from math import ceil

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = S()
    sum_ = 0
    for i in n:
        sum_ += int(i)
    # print(sum_ // 9)
    if (sum_ % 9) == 0:
        print('Yes')
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
##a = int(stdin.readline().rstrip())
##b, c = [int(x) for x in stdin.readline().rstrip().split()]
##s = stdin.readline().rstrip()
##a = list(set(b))  重複を削除
##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]
##a = [[0] * 2 for _ in range(n)]  a[0,0]
##v = [s[i: i+2] for i in range(0, len(s), 2)]
##  s="12345678" を v=["12","34","56","78"] にするイメージ
##s = "".join(list)リストを文字列に変換[""]は区切り文字
##a.sort(key=itemgetter(1))リストをソートできるよ(from operator import itemgetterが必要)
##sort_p = sorted(p) 昇順ソート

# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
import random
import bisect
import copy
# stdin = open("sample.txt")


MOD = int(1e9+7)
INF = float('inf')
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def keta(kazu): # 入力されたintを桁ごとに分解，リストで出力
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): # 最小公倍数
    return reduce(math.gcd, numbers)

def combination(m,n): # mCn
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): # nの素因数分解の結果を辞書で出力 fuct(24) → {2: 3, 3: 1}
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr
    
def main():
    a = int(stdin.readline().rstrip())
    if a % 9 == 0:
        print("Yes")
    else:
        print("No")
                
main()

Submission status: Accepted

Solution code:
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = [int(c) for c in s]


ans = 0
for num in a:
  ans += num
  if ans >= 9:
    ans -= 9

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
l = len(n)
ref = 0

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

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

Submission status: Accepted

Solution code:
N = input()

list_num = list(N)

A = [int(s) for s in list_num]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
c = 0
d = 0
for i in range(len(s)):
    c += int(s[i])

c = str(c) 
for i in range(len(c)):
    d += int(c[i])

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

Submission status: Accepted

Solution code:
N = list(str(input()))

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

Submission status: Accepted

Solution code:
N = list(input())

n = [int(i) for i in N]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# abc176 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """123456789"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """31415926535897932384626433832795028841971693993751058209749445923078164062862089986280"""
        output = """No"""
        self.assertIO(input, output)


def resolve():
    N = input()

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = list(map(int, input()))

    s = 0
    for num in n:
        s += num
        s %= 9

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    l = str(n)
    l = [int(i) for i in list(l)]
    s = sum(l)
    if s % 9 == 0:
        print("Yes")
    else:
        print("No")
    return




n = RN()
solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(map(int,input()))
m = sum(n)
if m%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 = str(input())
s = 0

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

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