Problem:


Score : 200 points

Problem Statement

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

Determine whether N is a multiple of 9.

Constraints

0 \leq N < 10^{200000}

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

123456789

Sample Output 1

Yes

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

Sample Input 2

0

Sample Output 2

Yes

Sample Input 3

31415926535897932384626433832795028841971693993751058209749445923078164062862089986280

Sample Output 3

No



Sample input:
123456789


Sample output:
Yes

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


#####Shorten#####
def DD(arg): return defaultdict(arg)

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
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)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b: a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
tot = 0
for c in S:
    tot += int(c)

if tot % 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:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

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

def solve(N: str):
    tmp = 0
    for c in N:
        tmp += int(c)
    if tmp % 9 == 0:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

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

mod = 0

for n in num_str:
  mod += int(n)
  mod %= 9

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	N = input()
	val = 0
	for i in N:
		val += int(i)

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

	




if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if tem % 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:
def main():
    num = input()
    if sum(int(c) for c in num) % 9 == 0:
        return 'Yes'
    else:
        return 'No'


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

Submission status: Accepted

Solution code:
N = input()
ans = 0
for n in N:
    ans += int(n) % 3
    ans %= 3

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

Submission status: Accepted

Solution code:
def main():
    num = int(input())
    if num % 9 == 0:
        return 'Yes'
    else:
        return 'No'


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

Submission status: Accepted

Solution code:
print("YNeos"[sum(list(map(int, list(input()))))%9!=0::2])

Submission status: Accepted

Solution code:
n=input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
num_str = input()
 
num_list = [int(num_str[i]) for i in range(len(num_str))]
 
num_sum = sum(num_list)
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import numpy as np
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
num_str = input()

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

Submission status: Accepted

Solution code:
import numpy as np
import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
 
num_str = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,bisect
 
from sys  import stdin,stdout
 
from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right
 
from math import gcd,ceil,floor,sqrt
 
from collections import Counter,defaultdict,deque,OrderedDict
 
from queue import Queue,PriorityQueue
 
from string import ascii_lowercase
 
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7
 
def isPrime(n):
    
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True
 
 
def st():
    return list(stdin.readline().strip())
 
def inp():
    return int(stdin.readline())
 
def li():
    return list(map(int,stdin.readline().split()))
 
def mp():
    return map(int,stdin.readline().split())
 
def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)
 
 
def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)
 
                
 
 
def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime
 
def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a
 
def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n=input()
    s=sum(list(map(int,str(n))))
    if s%9==0:
        pr('Yes')
    else:
        pr('No')
 
    
 
 
 
 
for _ in range(1):
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

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

Submission status: Accepted

Solution code:
print('YNeos'[sum(int(i)for i in input())%9>0::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b


N = read()[:-1]
if sum(map(int, list(N))) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = map(int, input())
    ans = sum(n)
    if ans % 9 == 0:
        print("Yes")
    else:
        print("No")
    return 0
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
print("YNeos"[int(input())%9>0::2])

Submission status: Accepted

Solution code:
N=input()
check=0
for i in range(len(N)):
    check+=int(N[i])
    check%=9

print("Yes" if not check else "No")

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
print(int(input())%9and'No'or'Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


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


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

Submission status: Accepted

Solution code:
n = int(input())

print('YNeos'[n%9>0::2])

Submission status: Accepted

Solution code:
N=input()
a=[int(i) for i in N]
b=sum(a)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
i=N%9

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

Submission status: Accepted

Solution code:
n = input()
total = 0

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = input()
	sa = sum([int(c) for c in s])
	return 'Yes' if sa % 9 == 0 else 'No'
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:

def check(st) : 

	n = len(st) 
	digitSum = 0
	
	for i in range(0,n) : 
		digitSum = digitSum + (int)(st[i]) 

	
	return (digitSum % 9 == 0) 


st =input()

if(check(st)) : 
	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:
N = input()
ans = 0
for i in N:
    a = int(i)
    ans += a
if ans%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    z = input()
    x = int(z)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = input()

a = int(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = input()
s = 0
for i in num:
    s = (s + int(i)) % 9

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
x = N //1000
x1 = (N - x*1000)//100
x2 = (N - x*1000 - x1*100)//10
x3 = N - x*1000 - x1*100 - x2*10
sum = x+x1+x2+x3
if sum % 9 != 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N = list(input().rstrip())
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:
def main():
    n = int(input())
    if n == 0:
        print("Yes")
    elif n % 9 == 0:
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
ans = []

for i in range(len(N)):
    ans.append(N[i])


ys = map((lambda x: int(x)), ans)
Sans = sum(ys)

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

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = float('inf')


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


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


def LS(): return sys.stdin.readline().split()


def S(): return sys.stdin.readline().strip()


def IR(n): return [I() for i in range(n)]


def LIR(n): return [LI() for i in range(n)]


def SR(n): return [S() for i in range(n)]


def LSR(n): return [LS() for i in range(n)]


def SRL(n): return [list(S()) for i in range(n)]


def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


mod = 10 ** 9 + 7

n = S()
ret = 0
for i in n:
    ret += int(i)

if ret % 9:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(readline())
ans = 'Yes' if N%9 == 0 else 'No'

print(ans)

Submission status: Accepted

Solution code:
n = input()
sum = 0
for s in n[::1]:
    sum += int(s)

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

Submission status: Accepted

Solution code:
N = input()

L = len(N)
S = 0

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(read())
print('Yes' if x % 9 == 0 else 'No')

Submission status: Accepted

Solution code:
n=input()

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

Submission status: Accepted

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

Submission status: Accepted

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

# Input#
n = list(input())
# n, k = map(int, input().split())
# a = list(map(int, input().split()))
sum = 0
for i in n:
    sum += int(i)

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


# print("{}".format(ans))

Submission status: Accepted

Solution code:
from sys import stdin

num =stdin.read().strip()

lst = [int(n) for n in num]
if sum(lst) % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = sum(list(map(int,input())))

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

Submission status: Accepted

Solution code:
n = input()

sumOfDigits = 0

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

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

Submission status: Accepted

Solution code:
A = input()
A = list(A)
B = []
C = 0
for i in A:
    i = int(i)
    B.append(i)
for j in B:
    C = C + j
if C % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

N = int(input())
a = N % 9

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

Submission status: Accepted

Solution code:
num = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0) 
  
# Driver code 
x = input()
st= str(x)
  
if(check(st)) : 
    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:
numlist=list(str(input()))
a=0
i=0
while 0<=i<=len(numlist)-1:
  a+=int(numlist[i])
  i=i+1
if a%9==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

result = sum(list(map(int, str(n))))

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

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = str(input())
lists = [int(x) for x in N]
a = sum(lists)

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

a=int(n%9)

if a==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())
ans = digitSum(n)
#print(ans)

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

Submission status: Accepted

Solution code:
def digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");

Submission status: Accepted

Solution code:

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


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


def II():
    return int(input())


N = map(int, list(input())[:-1])

res = sum(N)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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