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:
# -*- 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
    while tmp > 0:
        q = tmp // 10
        r = tmp % 10
        a.append(r)
            
        tmp = q

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

    result = 'No' 
    if sum(a) % 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())

x=[]
while N>0:
    x.append(N%10)
    N=N//10

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

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())
lst = []
while N > 0:
    lst.append(N%10)
    N //= 10
lst.reverse()

if sum(lst) %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
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = len(str(N))
sum = 0

while True:
    a = N // 10**(l-1)
    N -= 10 ** (l-1) * a
    sum += a
    l -= 1
    if l < 0:
        break
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
while 9 < N:
  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 = int(input())
dig_sum = 0
while n != 0:
    dig_sum += n % 10 
    n = n // 10
# print(dig_sum)
if dig_sum % 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 = n // 10
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
def digits_of (n): # nの桁の数字のリストを出力する関数｡ nは自然数
    digits = [] # nの桁の数字を入れるリスト
    while n != 0:
        r = n % 10 # 10で割った余り
        digits.append(r) # リストに加える
        n = n // 10 # nを10で割った整数に置き換える
    return digits

def is_multiple_of_9 (n): # nは自然数
    sum = 0 # 各桁の数字の合計をもとめる
    for i in digits_of (n):
        sum += i
    return sum % 9 == 0 # もし合計が9の倍数ならTrue, そうでないならFalse
  
n = int(input())

print('Yes' if is_multiple_of_9 (n) == True else 'No')

Submission status: Time Limit Exceeded

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

while N > 0:
    digit = N % 10
    summer += digit
    N = N // 10
if summer % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# 整数の入力
N = int(input())
s = 0

while N//10 != 0 or  N%10 !=0:
    s += N%10
    N //= 10

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

Submission status: Time Limit Exceeded

Solution code:
#from functools import lru_cache
import sys
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

n=int(reader()[0][0])
a=[]
for i in range(200001):
    a.append(n%10)
    n//=10
print('Yes' if sum(a)%9==0 else 'No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

total = 0

while N > 0:
  total = (total + N % 10) % 9
  N = N // 10
  
if total % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s=0
while n!=0:
    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=[]
while N>0:
  A.append(N%10)
  N//=10
a=(sum(A))
if a%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 = input()

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

if ans % 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 

print('Yes' if is_multiple_of_9(n) else 'No')

Submission status: Time Limit Exceeded

Solution code:
# t=int(input())
# for _ in range(t):
#     n=int(input())
#     arr=[int(x) for x in input().split()]
def sumall(n):
    sum=0
    while n:
        #print(n%10)
        sum+=n%10
        n=n//10
    #print(sum)
    return sum
    
n=int(input())
if sumall(n)%9 == 0:
    print("Yes")
else:
    print("No")
#print(t*need)

Submission status: Time Limit Exceeded

Solution code:
def sum_each_num(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    return sum

def main():
    n = int(input())
    sum = sum_each_num(n)
    if n % 9 == 0:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

Solution code:
#from functools import lru_cache
import sys
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

n=int(reader()[0][0])
a=[]
while n!=0:
    a.append(n%10)
    n//=10
print('Yes' if sum(a)%9==0 else 'No')

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
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
    while N>0:
        total += N%10
        N //= 10
    N = total
    total = 0
    while N>0:
        total += N%10
        N //= 10
    N = total
    total = 0
    while N>0:
        total += N%10
        N //= 10
        
    if total%9==0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
n_copy = n
digit_sum = 0

while(n_copy != 0):
    #print(digit_sum, n_copy%10, n_copy//10)
    digit_sum += n_copy%10
    n_copy //= 10

#print(digit_sum)

if digit_sum%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())
def is_multiple_of_nine(x):
    if x < 10:
        if x == 0 or x == 9:
            return True
        else:
            return False
    else:
        running_sum = 0
        while x:
            running_sum += x % 10
            x = x // 10
        return is_multiple_of_nine(running_sum)
    
if is_multiple_of_nine(n):
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys 
def get_string(): return sys.stdin.readline().strip() 
  
string = get_string()
n=int(string)
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:
import math
n = int(input())
list1 = []
if n == 0:
  	print("Yes")
else:
    for i in range(int(math.log10(n))+1):
        num = n%10
        n = n//10
        list1.append(num)
    if sum(list1)%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
    if(sum > 100) :
      sum = sum % 9

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

sum = 0

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

hantei = 0

while N != 0 or N < 1:
    hantei += N % 10
    N = N // 10

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

n=int(reader()[0][0])
a=[]
while n!=0:
    a.append(n%10)
    n//=10
print('Yes' if sum(a)%9==0 else 'No')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
while n > 0:
    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:
n=int(input())
s=0
while n>0:
  r=n%10
  s=s+r
  n=n//10
if s%9==0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
n = input()
sum = 0

for i in range(len(n)):
    sum += int(n[i]) * 10**(len(n) - i - 1)
  
if sum % 9 == 0:
    print("Yes")
  
else:
    print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
while n > 0:
    dig = n % 10
    s = s + dig
    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:
    a += n % 10
    n //= 10
if a % 9 == 0:
    print("Yes")
else:
    print("No")

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input(''))

l = len(str(n))
s = 0
for i in range(l):
    j=10**(l-i-1)
    y = n//j
    n -= y*j
    s+=y

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

sum = 0
while len(n) > 1:
    sum += int(n[0])
    n = n[1:]

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


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

Submission status: Time Limit Exceeded

Solution code:
import sys

n = int(input())
ans = 0
while n>0:
    ans += n%10
    n = n//10
    
#print(ans)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

tmp = 0
while N != 0:
    tmp += N % 10
    tmp %= 9
    N //= 10

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

Submission status: Time Limit Exceeded

Solution code:
def judge(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10
    return digits
def main(n):
    sum = 0
    for i in judge(n):
        sum += i
    if sum % 9 == 0:
      print("Yes")
    else:
      print("No")
if __name__=='__main__':
    N = int(input())
    main(N)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def total(n):
    total = 0
    for i in range(len(str(n))):
        total += int(str(n)[i])
        if i == len(str(n)):
            if len(str(total)) > 10**5:
                total(total)
    
    return total

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

Submission status: Time Limit Exceeded

Solution code:
def digits_of (n): # nの桁の数字のリストを出力する関数｡ nは自然数
    digits = [] # nの桁の数字を入れるリスト
    while n != 0:
        r = n % 10 # 10で割った余り
        digits.append(r) # リストに加える
        n = n // 10 # nを10で割った整数に置き換える
    return digits
def is_multiple_of_9 (n): # nは自然数
    sum = 0 # 各桁の数字の合計をもとめる
    for i in digits_of (n):
        sum += i
    return sum % 9 == 0 

n=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))

MOD = 10**9 + 7


def main():
	# ans_ = []
	# ans_.append(ans)
	# print(("\n").join(map(str, ans_)))
	n = int(input())
	s = 0
	while n:
		s += n%10
		s %= 9
		n //= 10
	print("YNeos"[s!=0::2])






if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import math
N = int(input())
sum = 0;
for n in range(0,len(str(N))):
  sum = sum + (N % 10)
  N = N // 10
if sum % 9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

a=0
while N>=1:
    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())
tmp = 0
while n > 0:
    tmp += (n % 10)
    n = n // 10
if tmp % 9 == 0:
    ans = 'Yes'
else:
    ans ='No'
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def findSumOfDigits(n):
    sum = 0
    while (n > 0):
        sum += n % 10
        n //= 10
    return sum

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

S = 0
for i in range(1, 200000):
    S += n % 10
    if n // 10  == 0:
        break
    else:
        n //= 10

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    sum = 0
    while True:
        amari = N % 10
        sum += amari
        N = N//10
        if N == 0:
            break

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

main()

Submission status: Time Limit Exceeded

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

hantei = 0

while N != 0:
    hantei += N % 10
    N = N // 10

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
i = int(input())
list = []
while i > 0:
    list.append(i%10)
    i //= 10
list.reverse()

SUM = sum(list)

if SUM % 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(''))

l = len(str(n))
s = 0
for i in range(len(str(n))):
    j = l-i-1
    y = n//10**j
    n -= y*10**j
    s+=y

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
def total(n):
    total = 0
    for i in range(len(str(n))):
        total += int(str(n)[i])
        if i == len(str(n)):
            total(total)
    
    return total

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

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
def getSum(n):
    s = 0
    while (n != 0):
        s = s + (n % 10)
        n = n // 10
    return s
c = getSum(a)
if c % 9 == 0 :
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lenN = len(str(N))
sumN = 0
for i in range(lenN):
  sumN += (N%10)
  N = N//10

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
keta = len(str(n))
s = 0
base = 10**(keta-1)
while base > 0:
    r,n = divmod(n,base)
    s += r
    base //= 10
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

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

n = int(input())

total = 0
while n:
    total += (n % 10)
    n //= 10

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

Submission status: Time Limit Exceeded

Solution code:
n = input()

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

if total % 9 == 0:
	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): 
    r = 0 
    for i in digits_of (n):
        r += i
    return r % 9 == 0 

def main():
  N = int(input())
  print("Yes" if is_multiple_of_9(N) else "No")

main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = []
while 1:
    A.append(N%10)
    N = N//10
    if N <= 0:
        break

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

l = len(str(N))
a = 0

for i in range(l):
  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())
nn = n
sum = 0
while nn > 0:
    sum += nn % 10
    nn = nn // 10
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
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
    while N>0:
        total += (N%10)%9
        total %= 9
        N //= 10
    if total%9==0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

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:
def is_nine(x):
    res = 0
    while x > 0:
        t = x % 10
        res += t
        x //= 10
    return res

if __name__ == '__main__':
    N = int(input())
    e = is_nine(N)
    if (e % 9 == 0):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
while n:
    d = n%10
    n = n//10
    s += d
if s%9 == 0:
    print("Yes")
else:
    print("No")
#a = list(map(int,input().split()))
#n,k,t = map(int,input().split())

Submission status: Time Limit Exceeded

Solution code:

import sys
input = sys.stdin.readline

n=int(input())

def digsum(n):
    res = 0
    while n > 0 :
        res += n%10
 #       res +=1
        n =n// 10
    return res

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

Submission status: Time Limit Exceeded

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

N = int(readline())

digit_total = 0

while N >= 1:
    pop = N % 10
    N //= 10
    digit_total += pop

ans = 'Yes' if digit_total % 9 == 0 else 'No'

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = []
while 1:
    A.append(N%10)
    N = N//10
    if N == 0:
        break

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

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

Submission status: Time Limit Exceeded

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

while N!=0:
  tmp += N % 10
  N=N//10
  
if tmp % 9 == 0:
  ans="Yes"
else:
  ans="No"
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
#
import math
import sys
import itertools
import numpy as np

n =int(input())

a=0

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())
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:
N = int(input())
num = 0

while(N != 0):
    num += N % 10
    N = N // 10
if num % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
keta = len(str(n))
s = 0
for i in range(keta-1,-1,-1):
    r,n = divmod(n,10**i)
    s += r
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n= input()

def digit_sum(s):
	ans=0
	for digit in s:
		ans+= int(s)
	return ans

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

Submission status: Time Limit Exceeded

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

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:
ss=0
n=int(input())
while n>0:
	ss+=n%10
	n=n//10
	ss%=9 
if ss==0:
	print("Yes")
else:
	print("No")

Submission status: Time Limit Exceeded

Solution code:
def readinput():
    n=int(input())
    return n

def main(n):
    sum=0
    while(n>0):
        sum+=n%10
        n=n//10
    if sum%9==0:
        return 'Yes'
    else:
        return 'No'

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

s = 0

for i in range(len(str(n))):
    s += n % 10
    n //= 10
    s %= 9

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

Submission status: Time Limit Exceeded

Solution code:

n=int(input())

def digsum(n):
    res = 0
    while n > 0 :
        res += n%10
 #       res +=1
        n =n// 10
    return res

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

Submission status: Time Limit Exceeded

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

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())
k=0
while n>0:
    k+=n%10
    n//=10
if k%9==0:
    print("Yes")
else:
    print('No')

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 >= 1:
    ans += N % 10
    ans = ans % 9
    N = N // 10
if ans == 0:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

total = 0

while N > 0:
  total += N % 10
  N = N // 10
  
if total % 9 == 0:
  print("Yes")
else:
  print("No")

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

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

main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

n = str(input())

ans = 0
count = 1
for i in reversed(n):
    ans += count*int(i)
    ans = ans % 9
    count *= 10
if ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

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

    N = int(input())
    # N,X,T = map(int,input().split())
    # p = list(map(int, input().split()))
    # print(p)
    total = 0
    while N>0:
        total += N%10
        N //= 10
    if total%9==0:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def dsum(n):
    wa = 0
    while n > 0:
        wa += n % 10
        n //= 10
    return wa


n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict,deque
import math
def main():
    n = input()
    tmp = 0
    for i in range(len(n)):
        tmp += int(n)
        tmp%=9 
    if(tmp%9==0):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int( input() )

ans = 0

while n != 0:
    ans += n % 10
    n = n // 10

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

Submission status: Time Limit Exceeded

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

N = input()
cnt = 0

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict,deque
import math
def main():
    n = input()
    tmp = 0
    for i in range(len(n)):
        tmp += int(n)
    if(tmp%9==0):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7

n=int(data())
s=0
while n:
    s+=n%10
    n//=10
print("Yes" if s%9==0 else "No")

Submission status: Time Limit Exceeded

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

N = input()
cnt = 0

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

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