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: Time Limit Exceeded

Solution code:
n=int(input())
c=0
while n>0:
  c+=n%10
  n//=10
print("Yes" if c%9==0 else "No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input());tt=0
while(N):
    tt+=(N%10);N//=10
print("No" if tt%9 else "Yes")

Submission status: Time Limit Exceeded

Solution code:
N=int(input());tt=0
while(N):
    tt+=(N%10);N//=10
    if tt>999999999:break
print("No" if tt%9 else "Yes")

Submission status: Time Limit Exceeded

Solution code:
N=int(input());tt=0
while(N):tt+=(N%10);N//=10
print("No" if tt%9 else "Yes")

Submission status: Time Limit Exceeded

Solution code:
#codinng:utf-8

N = int(input())
count = 0

while N > 0:
    count += (N % 10000000) % 9
    N = N // 10000000

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

Submission status: Time Limit Exceeded

Solution code:
#codinng:utf-8

N = int(input())
count = 0

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

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

Submission status: Time Limit Exceeded

Solution code:
#codinng:utf-8

N = int(input())
count = 0

while N > 0:
    count += N % 10
    N = N // 10

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

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
c = 0
while(a > 0):
  c += a%10
  a = a//10
if c%9:
  print('No')
else:
  print('Yes')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = []
B = 0
while N>0:
    A.append(N%10)
    N //=10
for i in range(len(A)):
    B = B+A[i]
if B%9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = int(rl())
	tot = 0
	while n:
		n, d = divmod(n, 10)
		tot += d 
	if tot % 9 == 0:
		print("Yes")
	else:
		print("No")
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

while N > 0:
    ans += N % 10
    # ans = ans % 9
    N = N // 10
ans = ans % 9
if ans == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

while N > 0:
    ans += N % 10
    ans = ans % 9
    N = N // 10

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

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())

temp = 0

while(n > 0):
    temp += n % 10
    temp = temp % 9
    n = n // 10

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

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())

temp = 0

while(n > 0):
    temp += n % 10
    n = n // 10

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

Submission status: Time Limit Exceeded

Solution code:
N = input()

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = 0
for i in range(2*10**5):
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = 0
while N > 0:
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
count_=0
while(n!=0):
    count_+=n%10
    n=n//10
    
if count_%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[]
while(n!=0):
    l.append(n%10)
    n=n//10
    
if sum(l)%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
d=0
while n>0:
    d+=n%10
    n//=10
if d%9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n = int(input())

    #output
    l = len(str(n))

    mod = 0
    for i in range(l):
        mod += int(str(n)[i])

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

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

digit_sum = 0

while n > 0:
    digit_sum += n % 10
    n = n // 10

ans = digit_sum % 9

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

sum_N = 0

while N >= 10:
  sum_N += N % 10
  N = N //10

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

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
sum=0
while(a>0):
  t=a%10
  sum=sum+t
  a=a//10
if(sum%9==0):
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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


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

else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
m=n
a=0
for i in range(len(str(n))):
    a+=m%10

    m=m//10

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

else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
cnt = 0
while n != 0:
    cnt += n % 10
    cnt %= 9
    n //= 10
if cnt == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

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

import sys
sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    def calcSumOfDigit(x,acc=0):
        if x == 0:
            return acc
        else:
            return calcSumOfDigit(x//10,acc+x%10)
    def judge(x):
        return x % 9 == 0
    print("Yes" if judge(calcSumOfDigit(N)) else "No")
    return


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
sm = 0
while(n):
    n,digit = divmod(n, 10)
    sm += digit

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cnt = 0
while N > 0:
    cnt += N % 10
    cnt %= 9
    N //= 10
ans = 'Yes' if cnt % 9 == 0 else 'No'
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cnt = 0
while N > 0:
    cnt += N % 10
    N //= 10
ans = 'Yes' if cnt % 9 == 0 else 'No'
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
sum=0
while(n>0):
  sum+=n%10
  n=n//10
if sum%9==0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
def ismof9(n):
    s = 0
    while n:
        r = n % 10
        s += r
        n //= 10
    if s % 9 == 0:
        return "Yes"
    else:
        return "No"


def main():
    n = int(input())
    print(ismof9(n))

main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s=0
while(n>0):
  s=s+n%10;
  n=n//10
if(s%9==0):
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

a = 0
while N > 0:
  a += N % 10
  N //= 10

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

a = 0
while N > 0:
  a += N % 10
  N //= 10
  a %= 9

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = 0
while n > 0:
    mod = n % 10
    a += mod
    n = n // 10
if a % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

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

n = int(input())

str_n = str(n)

tot = 0

# for ch in str_n:
#     tot += int(ch)

while n > 0:
    tot += n % 10
    n //= 10

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

Submission status: Time Limit Exceeded

Solution code:
# Python profram to check if n is a multiple of 3 
  
# Function to check if n is a multiple of 3 
def isMultipleOf3(n): 
  
    odd_count = 0
    even_count = 0
  
    # Make no positive if + n is multiple of 3 
    # then is -n. We are doing this to avoid 
    # stack overflow in recursion 
    if(n < 0):  
        n = -n 
    if(n == 0): 
        return 1
    if(n == 1):  
        return 0
  
    while(n): 
          
        # If odd bit is set then 
        # increment odd counter  
        if(n & 1):  
            odd_count += 1
  
        # If even bit is set then 
        # increment even counter  
        if(n & 2): 
            even_count += 1
        n = n >> 2
  
    return isMultipleOf3(abs(odd_count - even_count))
num=int(input())
if (isMultipleOf3(num)):  
    print("Yes") 
else: 
    print("No")

Submission status: Time Limit Exceeded

Solution code:
a = input()

a = int(a)

b = a

b = int(b)

if a % 9 == 0:

    for i in range(a):
        b += b % pow(10, i)

else:
    print("No")
    exit()

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())


def digits_of(n):
    digits = [] 
    while n != 0:
        r = n % 10 
        digits.append(r) 
        n = n // 10  
    return digits


def is_multiple_of_9(n): 
    sum = 0  
    for i in digits_of(n):
        sum += i
    return sum % 9 == 0


if is_multiple_of_9(n):
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

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

    sum = 0
    while x > 0:
        y = x % 10
        sum = sum + y
        x = x // 10

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def digits_of(n): 
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10
    return digits

def is_multiple_of_9(n):
	sum = 0
	for i in digits_of(n):
		sum += i
	return sum % 9 == 0 

N = int(input())
if is_multiple_of_9(N) == True:
  	print("Yes\n")
else:
  	print("No\n")

Submission status: Time Limit Exceeded

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

N = int(readline())

total = 0

while N >= 1:
    total += N % 10
    N //= 10
    total %= 9

ans = 'Yes' if total == 0 else 'No'

print(ans)

Submission status: Time Limit Exceeded

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

    sum = 0
    while x > 0.5:
        y = int(x % 10)
        sum = int(sum + y)
        x = x // 10

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0

while(n>0):
    count += n%10
    count = count%9
    n = n//10

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

sumOfDigits = 0

while n != 0:
	r = n % 10
	sumOfDigits += r
	n = n // 10

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

Submission status: Time Limit Exceeded

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

# Input#
n = list(input())
# n, k = map(int, input().split())
# a = list(map(int, input().split()))

sum = 0
while len(n) > 1:
    sum += int(n.pop(0))


sum += int(n[0])
if sum % 9 == 0:
    print("Yes")
else:
    print("No")


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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0

while(n>0):
    count += n%10
    n = n//10

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum = 0

while N != 0:
    sum += (N%10)
    N //= 10

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = 0
for i in reversed(range(len(str(N)))):
  n, N = N//(10**i), N%(10**i)
  tmp += n
N = tmp 
if N%9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
N = str(input())
lists = []

for x in N:
    lists.append(int(x))
    a = sum(lists)

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
cnt = 0
while True:
    r = int(n % 10)
    n = n // 10
    cnt += r
    if n == 0:
        break
res = cnt % 9
if res == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
m = int(input())

digits = []
while m != 0:
  r = m % 10
  digits.append(r)
  m = m // 10

sum = 0
for i in digits :
  sum += i

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def Mo9(n):
    n_sum = 0
    while n > 0:
        n_sum += n % 10
        n = n // 10
    if n_sum <= 10**100000:   
        return n_sum
    else:
        return Mo9(n_sum)
if Mo9(N) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0]
t = 0

for i in range(1,len(str(N)) + 1):
    x = N % (10 ** i)
    A.append(x)

for i in range(1, len(A)):
    A[i] = (A[i] - A[i - 1]) // (10 ** (i - 1))
    t += A[i]

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum = 0

while N >= 10:
  sum += N%10
  N = N//10

sum += N

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
nn = str(N)
n = len(nn)
ans = []

for i in range(n):
    waru = N % 10
    N = N // 10  
    ans.append(waru)

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

sum=0

while N>=1:
  sum+=N%10
  N=N//10
  sum=sum%9
  
if sum == 0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
lst = []
while N > 0:
  lst.append(N%10)
  N //= 10 
for i in lst:
  count += i
if count % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
a = [0,0,0,0,0,0,0,0,0,0]
a[0] = int(input())

for i in range(9):
  while a[i] != 0:
    a[i+1] += a[i] % 10
    a[i] = a[i] // 10 


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

Submission status: Time Limit Exceeded

Solution code:
if __name__ == "__main__":
    x = input()
    x = int(x)

    digits = 200000
    index = 200000

    tmp1 = []
    for i in range(digits):
        tmp2 = pow(2,index)

        if(tmp2>x):
            continue
        tmp3 = x%tmp2
        if tmp2 != 0:
            x -= tmp3*index
            tmp1.append(tmp3)
        index -= 1
    result1 = sum(tmp1)

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
cnt = 0
for i in range(200010):
    if n < 10:
        cnt += n
        break
    cnt += (n % 10)
    n = int(n // 10)
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def Mo9(n):
    n_sum = 0
    while n > 0:
        n_sum += n % 10
        n = n // 10
    if n_sum <= 10**10:   
        return n_sum
    else:
        return Mo9(n_sum)
if Mo9(N) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def Mo9(n):
    n_sum = 0
    while n > 0:
        n_sum += n % 10
        n = n // 10
    if n_sum <= 9:   
        return n_sum
    else:
        return Mo9(n_sum)
if Mo9(N) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
lst = []
while num > 0:
    lst.append(num%10)
    num //= 10
if sum(lst) % 9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [0]
count = 2
t = 0

x = N % 10
A.append(x)
while(N != x):
    x = N % (10 ** count)
    A.append(x)
    count += 1

for i in range(1, count):
    A[i] = (A[i] - A[i - 1]) // (10 ** (i - 1))
    t += A[i]

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

Submission status: Time Limit Exceeded

Solution code:
a = 0
n = int(input())
while n != 0:
  a += n % 10
  n = n // 10 

b = 0
while a != 0:
  b += a % 10
  a = a // 10 

c = 0
while b != 0:
  c += b % 10
  b = b // 10 

d = 0
while c != 0:
  d += c % 10
  c = c // 10 

e = 0
while d != 0:
  e += d % 10
  d = d // 10 


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

Submission status: Time Limit Exceeded

Solution code:
# your code goes here
def solve(n):
	odd=0;
	even=0;
	if(n==0):
		return 1;
	if(n==1):
		return 0;
	while(n):
		if(n&1):
			odd+=1;
		if(n&2):
			even+=1;
		n=n>>2;
	return solve(abs(even-odd))
n=input()
if(solve(int(n))):
	print("Yes");
else:
	print("No");

Submission status: Time Limit Exceeded

Solution code:
n = int(input(" ")) 
rev = 0
  
while(n > 0): 
    a = n % 10
    rev= rev + a 
    n = n // 10
    
    
if (rev%9==0):
    print("Yes")
else:
    print("No")
#print(rev)

Submission status: Time Limit Exceeded

Solution code:

N = int(input())
k = 0

while N > 0:
    k += N % 10
    N = N // 10

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

else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
# your code goes here
def solve(n):
	odd=0;
	even=0;
	if(n==0):
		return 1;
	if(n==1):
		return 0;
	while(n):
		if(n&1):
			odd+=1;
		if(n&2):
			even+=1;
		n=n>>2;
	return solve(abs(even-odd))
n=int(input())
if(solve(n)):
	print("Yes");
else:
	print("No");

Submission status: Time Limit Exceeded

Solution code:

def digits_of(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r) 
        n = n // 10 
    return digits

def is_multiple_of_9 (n):
    sum = 0
    for i in digits_of (n):
        sum += i
    if sum % 9 == 0:
        print("Yes")
    else:
        print("No")

def main():
    n = int(input())
    is_multiple_of_9(n)

main()

Submission status: Time Limit Exceeded

Solution code:
a = 0
n = int(input())
while n != 0:
  a += n % 10
  n = n // 10 

b = 0
while a != 0:
  b += a % 10
  a = a // 10 

c = 0
while b != 0:
  c += b % 10
  b = b // 10 

d = 0
while c != 0:
  d += c % 10
  c = c // 10 


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

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())
if N == 0:
    N = 9
logN = math.log10(N)
keta = int(logN)
sum = 0
for i in range(keta,-1,-1):
    tem =int(N/10**i)
    sum += tem
    N = N - tem*10**i

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
lst = []
while N > 0:
  lst.append(N%10)
  N //= 10 
for i in lst:
  count += i
if count % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = len(str(n))

s = 0
while n != 0:
  r = n % 10
  s = (s + r) % 9
  n = n // 10

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
N = len(str(x))
s = 0
while N != 0: 
    s =s +( x % 10) 
    N -= 1
    x = x // 10
if s % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
a = 0
n = int(input())
while n != 0:
  a += n % 10
  n = n // 10 

b = 0
while a != 0:
  b += a % 10
  a = a // 10 

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

Submission status: Time Limit Exceeded

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

def main():
    input_num = int(input())
    flag = True
    sum_num = 0

    while flag:
        chushutsu = input_num % 10
        sum_num += chushutsu
        input_num = input_num // 10
        if input_num == 0:
            flag = False

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

    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
sum=0
while n>0:
    r=n%10
    sum=sum+r
    n=n//10
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
listN=[]
i=0
k=0
while N!=0:
  k+=N%10
  N=N//10
  
if k%9==0:
  print ('Yes')
else:
  print ('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum=0
while N!=0:
    sum=(sum+N%10)%9
    N//=10
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
sum = 0 
for i in range(1,2000001):
    sum += n%(10**i)
if sum%9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

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

num_str = input()

num = int(num_str)

num_list = []
# num_list = [int(num_str[i]) for i in range(len(num_str))]

while num>0:
  num_list.append(num%10)
  num //= 10
num_list.reverse()

num_sum = sum(num_list)

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
base = 10
while n > 0:
    n,r = divmod(n,base)
    add = r
    s += add
    s %= 9
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
# B

N = int(input())
solve = []

while N > 0:
    solve.append(N % 10)
    N //= 10

ans = 0
for i in range(len(solve)):
    ans += solve[i]

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
listN=[]
i=0
k=0
while N!=0:
  k+=N%10
  k=k%9
  N=N//10
  
if k%9==0:
  print ('Yes')
else:
  print ('No')

Submission status: Time Limit Exceeded

Solution code:
a = 0
n = int(input())
while n != 0:
  a += n % 10
  n = n // 10 

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0
lst = []
while N > 0:
    lst.append(N%10)
    N //= 10 
lst.reverse()
for i in lst:
  count += i

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
for i in range(len(str(n))):
    r = n % 10
    s += r
    s %= 9
    n //= 10
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    # N,X,T = map(int,input().split())
    # A = list(map(int, input().split()))
    # print(p)
    total = 0
    for i in range(100):
        while N>0:
            total += (N%10)%9
            total %= 9
            N //= 10
        N = total
        total = 0

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
m = int(input())

def digits_of (n):
  digits = []
  while n != 0:
    r = n % 10
    digits.append(r)
    n = n // 10
  return digits

def is_multiple_of_9 (n):
  sum = 0
  for i in digits_of (n):
    sum += i
  return sum % 9 == 0

if is_multiple_of_9 (m) == True:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
def digits_of (n):
  digits = []
  while n != 0:
    r = n % 10
    digits.append(r)
    n = n // 10
  return digits

N = int(input())
S = 0
for i in digits_of(N):
  S += i

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

sum = 0

while(n >= 1):
  sum += n % 10
  n //= 10

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
cnt = 0
while n != 0:
    r = n % 10
    n = n // 10
    cnt += r
res = cnt % 9 
if res == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

re_list=[]

while n>0:
    re_list.append(n%10)
    n//=10
    
if sum(re_list)%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
listN=[]
i=0
while N!=0:
  listN.append(N%10)
  N=N//10
  i+=1
k=0
for j in range(i):
  k+=listN[j]
  k=k%9
  
if k%9==0:
  print ('Yes')
else:
  print ('No')

Submission status: Time Limit Exceeded

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, ) = [int(e) for e in lines[0].split(' ')]

    return (n, )


def solve(n, ):

    
    a = []
    tmp = n
    total = 0
    while tmp > 0:
        #q = tmp // 10
        #r = tmp % 10
        (q, r) = divmod(tmp, 10)
        #a.append(r)
        total = total + r
            
        tmp = q

    a.reverse()
    if debug:
        log("a=%s" % a)

    result = 'No' 
    #if sum(a) % 9 == 0:
    if total % 9 == 0:
        result = 'Yes'


    return result 


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum=0
while N:
    sum=(sum+N%10)%9
    N//=10
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
N = len(str(x))
L = []
while N != 0: 
    L.append( x % 10 )
    N -= 1
    x = x // 10
if sum(L) % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    # N,X,T = map(int,input().split())
    # A = list(map(int, input().split()))
    # print(p)
    total = 0
    for i in range(10):
        while N>0:
            total += (N%10)%9
            total %= 9
            N //= 10
        N = total
        total = 0

    if N%9==0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def digits (n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10 
    return digits

def check (n):
    sum = 0
    for i in digits (n):
        sum += i
    return sum % 9 == 0

n = int(input())
result = check(n)

if result == True:
    result = "Yes"
else:
    result = "No"
print(result)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum = 0

while N > 0:
    sum = sum + (N%10)
    N //= 10

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum=0
while N:
    sum+=N%10
    N//=10
    sum%=9
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def digit_sum(n):
    # 各桁の和を求める
    # 計算量: O(logN)
    ans = 0
    while n > 0:
        ans += n % 10
        n //= 10
    return ans
s = digit_sum(n)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
tot=0
while(n>0):
    dig=n%10
    tot=tot+dig
    n=n//10

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

Submission status: Time Limit Exceeded

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, ) = [int(e) for e in lines[0].split(' ')]

    return (n, )


def solve(n, ):

    
    a = []
    tmp = n
    total = 0
    while tmp > 0:
        q = tmp // 10
        r = tmp % 10
        #a.append(r)
        total = total + r
            
        tmp = q

    a.reverse()
    if debug:
        log("a=%s" % a)

    result = 'No' 
    #if sum(a) % 9 == 0:
    if total % 9 == 0:
        result = 'Yes'


    return result 


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum=0
while N:
    sum+=N%10
    N//=10
if sum%9==0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
check=0
while(n!=0):
	check+=n%10
	n=n//10
if(check%9==0):
	print('Yes')
else:
	print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
N_sum = 0
while N > 0:
    N_sum += N % 10
    N = N // 10
if N_sum % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

S = 0
for i in range(200001):
    S += n % 10
    n //= 10
    if n == 0:
        break

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

Submission status: Time Limit Exceeded

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