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: Wrong Answer

Solution code:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    n=int(input())
    arr=list(str(n))
    ans=0
    for i in range(len(arr)):
        ans+=int(arr[i])
        ans%=9
    ans%=9
    if ans==0:
        print("Yes")
    else:
        print("N0")

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()

Submission status: Wrong Answer

Solution code:
N = int(input())

temp = 0
for x in str(N):
    temp += int(x)

if temp%9==0:
    ans = "yes"
else:
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
li  =   lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw  =   lambda : sys.stdin.readline().strip().split()
ni  =   lambda : int(sys.stdin.readline().strip())
nsi =   lambda : sys.stdin.readline().strip()

from collections import defaultdict as df
import math
n=ni()
if(n==0):
    sum=0
elif(n%9==0):
    sum=9
else:
    sum=n%9

if(sum%9==0):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
eachSum = 0

for i in range(len(N)):
    eachSum += int(N[i]) // 9

if eachSum // 9 == 0: print("Yes")
else: print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

s = str(n)
val = 0

for letter in s:
    val += int(letter)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

sum = 0

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    n=int(input())
    arr=list(str(n))
    ans=0
    for i in range(len(arr)):
        ans+=int(arr[i])
    if ans%9==0:
        print("YES")
    else:
        print("NO")

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()

Submission status: Wrong Answer

Solution code:
def sum_nine(a: int):
    a = sum(map(int, str(a)))
    if a % 9 == 0:
        print("Yes")
    else:
        print(False)

Submission status: Wrong Answer

Solution code:
n = input()

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

print('YES' if (s % 9) == 0 else 'NO')

Submission status: Wrong Answer

Solution code:
x=int(input())
if x%9==0:
	print("YES")
else:
	print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
def getSum(n):
    s = 0
    while (n != 0):
        s = s + (n % 10)
        n = n // 10
    return s
print(getSum(a))

Submission status: Wrong Answer

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

def main():
    N = readline().rstrip()
    ans = 0
    for n in N:
        ans += int(n)
    print('Yes' if ans % 9 == 0 else 'No')

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0
for i in range(len(n)):
    count += int(n[i])
    count %= 9
if count == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# t=int(input())
# for _ in range(t):
#     n=int(input())
#     arr=[int(x) for x in input().split()]
n=int(input())
if n%9 == 0:
    print("YES")
else:
    print("NO")
#print(t*need)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

def main():
  N = input()
  N_sum = 0
  
  if N == str(0):
    print("No")
    exit()
  
  for i in N:
    N_sum += int(i)
    
  if N_sum % 9 == 0:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
a=list(input())
cnt=0
for i in a:
  b=int(i)
  cnt=(cnt+b)//9
if cnt==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

x = sum(list(map(int, input().split())))

if x%9==0:
	print("YES")
else:
	print("NO")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = input()

a = 0
for n in N:
    a += int(n)
    
if a % 9 == 0:
    ans = "Yse"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
ans = 0
for i in a:
  	ans+=int(i)
if ans%9==0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
n=input()
lst=list(n)
s=0
for i in lst:
    s+=int(i)
if s%9==0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:

def main():
  N = input()
  N_sum = 0
  
  if N == str(0):
    print("No")
    exit()
  
  for i in N:
    N_sum += int(i)
    
  if N_sum // 9 == 0:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
import sys

N = str(input())

n = list(map(int, N))

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

Submission status: Wrong Answer

Solution code:
n = input()
if n == '0' :
    print('Yes')
    exit()
s = 0
for i in range(len(n)) :
    s += 1
    s%=9

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = map(int, list(input()))
    ret = 0
    for i in n:
        ret += i
        ret %= 9
    if ret == 0:
        print("Yes")
    else:
        print("no")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    n=int(input())
    arr=list(str(n))
    ans=0
    for i in range(len(arr)):
        ans+=int(arr[i])
        ans=ans%9
    ans=ans%9
    if ans==0:
        print("YES")
    else:
        print("NO")

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()

Submission status: Wrong Answer

Solution code:
n=input()
k=len(n)
rem=0
for i in range(k):
    rem+=pow(10,i,9)
    rem%=9
if rem==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
from operator import mul
from functools import reduce
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


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


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


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


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = S()
sum_ = 0
for n in N:
    sum_ += int(n)
if (sum_ % 9 == 0):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
"""
    Satwik_Tiwari ;) .
    21st AUGUST , 2020  - FRIDAY
"""

#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase

from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
#If the element is already present in the list,
# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect
#If the element is already present in the list,
# the right most position where element has to be inserted is returned

#==============================================================================================
#fast I/O region
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

# inp = lambda: sys.stdin.readline().rstrip("\r\n")

#===============================================================================================
### START ITERATE RECURSION ###
from types import GeneratorType
def iterative(f, stack=[]):
  def wrapped_func(*args, **kwargs):
    if stack: return f(*args, **kwargs)
    to = f(*args, **kwargs)
    while True:
      if type(to) is GeneratorType:
        stack.append(to)
        to = next(to)
        continue
      stack.pop()
      if not stack: break
      to = stack[-1].send(to)
    return to
  return wrapped_func
#### END ITERATE RECURSION ####

#===============================================================================================
#some shortcuts

mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def out(var): sys.stdout.write(str(var))  #for fast output, always take string
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
# def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n")  #as stdout.write always print sring.
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def google(p):
    print('Case #'+str(p)+': ',end='')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(x, y, p) :
    res = 1     # Initialize result
    x = x % p  # Update x if it is more , than or equal to p
    if (x == 0) :
        return 0
    while (y > 0) :
        if ((y & 1) == 1) : # If y is odd, multiply, x with result
            res = (res * x) % p

        y = y >> 1      # y = y/2
        x = (x * x) % p
    return res
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) :
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

#===============================================================================================
# code here ;))
@iterative
def dfs(v,visited,st,new):
    new.append(st)
    visited[st] = 1
    for i in v[st]:
        if(visited[i] == 0):
            ok = yield dfs(v,visited,i,new)
    yield True


def solve():
    s = inp()
    sum = 0
    for i in range(len(s)):
        sum+=int(s[i])

    if(sum%9==0):
        print('YES')
    else:
        print('NO')






testcase(1)
# testcase(int(inp()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

if N%9==0:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
n = input()
s = 0
for i in n:
    s+=int(i)
if s%9==0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s=input()
su=0
for i in range(len(s)):
	su+=int(s[i])
print("YNeos"[su%9::2])

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!


n = input()

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
X=0
for i in range(20000000):
    X=X+N%10
    N=N//10
    if N<1:
        break

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
X=[]
for i in range(20000000):
    X.append(N%10)
    N=N//10
    if N<1:
        break
sumX=sum(X)
if sumX%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 += (n % 10)
    n //= 10
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    s = 0
    while N:
        s += N%10
        s %= 9
        N //= 10
    if s%9 == 0:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    s = 0
    while N:
        s += N%10
        N //= 10
    if s%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 //= 10

if ans % 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
    n //= 10

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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
    sum %= 9
    N //= 10
if(sum==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())
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:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = 0

for i in range(len(n)):
    ans += (m % 10)
    m //= 10

ans %= 9

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

Submission status: Time Limit Exceeded

Solution code:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = m

while(len(n) != 1):
    n = str(ans)
    m = ans
    ans = 0
    for i in range(len(n)):
        ans += (m % 10)
        m //= 10

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = 0

while (True):
    a += n % 10
    n = n // 10
    if n == 0:
        break

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
while True:
    n, m = divmod(n, 10)
    s += m * 10
    if n <= 0:
        break
print('Yes' if s % 9 == 0 else 'No')

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=0
while N>=1:
    S+=N%10
    N=N//10

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

Submission status: Time Limit Exceeded

Solution code:

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

Submission status: Time Limit Exceeded

Solution code:
# 176 B
N = int(input())
length = len(str(N))
nine = 0
for i in range(1, length+1, 1):
    nine += (N % (10**i))/(10**(i-1))
    N -= N % (10**i)
    
print('Yes') if nine % 9 == 0 else print('No')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = str(N)
a = list(n)

count = 0

for i in range(len(a)):
  count = count + int(a[i]) % (10**(i+1))

if count % 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=input()
sum=0

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

Submission status: Time Limit Exceeded

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

for i in range(len(str(n))-1,-1,-1):
  ans = ans + n//10**i
  n = n%10**i

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

Submission status: Time Limit Exceeded

Solution code:
'''
Problem Link - https://atcoder.jp/contests/abc176/tasks/abc176_b
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

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

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

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

def get_array(): return list(map(int, stdin.readline().split()))
 
def get_ints(): return map(int, stdin.readline().split())

def get_int(): return int(stdin.readline())

def get_input(): return stdin.readline().strip()

def main():
	N = get_int()
	Sum = 0
	while N>0:
		rem = N%10
		Sum += rem*10
		N //= 10
	if Sum%9==0:stdout.write('Yes\n')
	else:stdout.write('No\n')

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

result = 0

while n != 0:
    q = n // 10
    mod = n % 10

    result += mod
    n = q

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
su = 0

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

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

if su % 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))):
    s = s + int(str(n)[i])

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

while n>0:
  lst.append(n%10)
  n //= 10

lst.reverse()

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