Problem:


Score : 200 points

Problem Statement

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

Determine whether N is a multiple of 9.

Constraints

0 \leq N < 10^{200000}

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

123456789

Sample Output 1

Yes

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

Sample Input 2

0

Sample Output 2

Yes

Sample Input 3

31415926535897932384626433832795028841971693993751058209749445923078164062862089986280

Sample Output 3

No



Sample input:
123456789


Sample output:
Yes

Submission status: Accepted

Solution code:
A = input()
s = 0

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = input()

res = 0
for v in n:
    res += int(v)

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

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

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    s = input()

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
N=input()
tmp=0
for s in N:
    tmp += int(s)
if tmp%9==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    N = input()
    modsum = 0
    for c in N:
        modsum = (modsum + int(c)) % 9
    if modsum % 9 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from math import ceil
def input(): return sys.stdin.readline().strip()

def main():
    n = input()
    val = 0
    for c in n:
        val += int(c)
    if val % 9 == 0:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

ans = 0
for n in N:
    ans += int(n)

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

else:
    print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = input()
    S = list(str(N))

    sm = 0
    for s in S:
        n = int(s)
        sm += n

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    if sum(int(s) for s in S) % 9 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if sum(int(d) for d in S) % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
num = input()
s = 0

for ch in num:
  s += ord(ch) - ord('0')

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

v = 0
for i in N:
    v += int(i)
    v %= 9

if v:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:



import os
import sys
from io import BytesIO, IOBase

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")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

s = ri()
summ = 0
for i in s:
    summ+=int(i)
if summ%9 == 0:
    Yes()
else:
    No()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

N = input()[:-1]
now = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = list(map(int, list(input())[: -1]))
res = 0
for x in N: res = (res + x) % 9
if res == 0: print("Yes")
else: print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = input()
res = 0
for v in N:
    res += int(v)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

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")

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

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


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y
from math import ceil

for _ in range(int(input()) if not True else 1):
    #n = int(input())
    s = input()
    if sum(int(k) for k in s) % 9 == 0:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
N = input()
a = 0
for n in N:
    a += int(n)
    a %= 9

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

Submission status: Accepted

Solution code:
N=input()
mod=0
for c in N:
    mod+=int(c)%9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = list(map(int, input()))
    res = 0
    for i in n:
        res += i
        res %= 9
    if res == 0:
        print("Yes")
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = input()

tmp = 0
for n in N:
	tmp += int(n)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    S = input()
    count = 0
    for c in S:
        count += int(c)
    if count % 9 == 0:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ns()
s = 0
for c in n:
    s += ord(c)-ord("0")
if s % 9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline
s = input()
ans = 0
for i in range(len(s)):
    ans = (ans + int(s[i])) % 9

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
print("Yes" if sum(map(int, input())) % 9 == 0 else "No")

Submission status: Accepted

Solution code:
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = input()
    sm = 0
    for i in n:
        sm += int(i)
        sm %= 9

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

    return None

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
ad = 0
for n in N:
    ad += int(n)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

n=input()
tmp=0
for x in n:
    tmp+=int(x)
YesNo(tmp%9==0)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


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

    N = input().rstrip('\n')
    S = 0
    for n in N:
        S = (S + int(n))%9
    if S:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

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

Submission status: Runtime Error

Solution code:
n = input()

n_list = list(n)
ans = sum(n_list)

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

Submission status: Runtime Error

Solution code:
import math

n = int(input())
ans = 0

while n:
    ans = ans + (n % 10)
    n = math.floor(n / 10)

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

Submission status: Runtime Error

Solution code:
n = input()


def solve1(n: int) -> str:
    k = 0
    for i in range(len(n)):
        k += int(n[i])

    if k % 9 == 0:
        return "Yes"
    else:
        return "No"


def solve2(n: int) -> str:
    if n % 9 == 0:
        return "Yes"
    else:
        return "No"


solve2(n)

Submission status: Runtime Error

Solution code:
if __name__=='__main__':
    N = int(input())
        #pc, pr = map(int, input().split())
        #N = list(map(int,input().split()))
	print("Yes" if N%9 ==0 else "No")

Submission status: Runtime Error

Solution code:
if __name__=='__main__':
    for i in range(int(input())):
        N = int(input())
        #pc, pr = map(int, input().split())
        #N = list(map(int,input().split()))
        print("Yes" if N%9 ==0 else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=input()
ans=0
for i in a:
  ans = (ans+int(i))%9
print(["Yes","No"][ans])

Submission status: Runtime Error

Solution code:

n = int(input())

ans = 0

while n != 0:
    ans += n % 10
    n = int(n/10)

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

Submission status: Runtime Error

Solution code:
#B問題
n = int(input())

# ある整数に対し、各桁の和を与える

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

Submission status: Runtime Error

Solution code:
#B問題
n = int(input())
# ある整数に対し、各桁の和を与える

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

ans = findSumOfDigits(n) % 9 

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

Submission status: Runtime Error

Solution code:
N = input()
for i in range(10):
  cnt += i * N.count(str(i))
print("Yes" if cnt % 9 == 0 else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = input()
for i in range(5):

    alist = list(map(int,x))
    result = sum(alist)
    x = str(result

if result%9 == 0 :
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    string s; cin >> s;
    int n = 0;
    for(char c : s){
        n += c - '0';
        n %= 9;
    }

    if(n%9 == 0) yes();
    else no();
    
    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Submission status: Runtime Error

Solution code:
s = input()

def digitsum(n):
    for i in n:
        ni = int(i)
        res += ni
    return res 

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

Submission status: Runtime Error

Solution code:
n = int(input())
lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 # 10の位を1の位に繰り下げ

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

else:
    print('No')

Submission status: Runtime Error

Solution code:
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1
          L_list=[i,j,k]
          print(L_list)
print(score)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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)

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

ans %= 9

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

Submission status: Runtime Error

Solution code:
n = str(input())

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

Submission status: Runtime Error

Solution code:
n = str(input())

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

Submission status: Runtime Error

Solution code:
N = input()

N = str(N)

sum = 0
for i in range(0, len(N)):
  sum += N[i]

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

Submission status: Runtime Error

Solution code:
N = input(int())

N = str(N)

sum = 0
for i in len(N):
  sum += N[i]

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

Submission status: Runtime Error

Solution code:
n = input()
n2 = int(n)
sum = 0
import math

import resource;
import random
# 再帰回数上弦を100000回に設定
sys.setrecursionlimit(100000)
# スタックサイズを無制限に設定
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))

for _ in range(len(n)):
  mod = n2 % 10
  sum += mod
  n2 = math.floor(n2/10)

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

Submission status: Runtime Error

Solution code:
n = input()
n2 = int(n)
sum = 0
import math

for _ in range(len(n)):
  mod = n2 % 10
  sum += mod
  n2 = math.floor(n2/10)

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

Submission status: Runtime Error

Solution code:
def decisum(n):
    if n == 0:
        return 0
    else:
        return n%10 + decisum(n//10)

n = int(input()) 

ans = not (decisum(n)%9)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

N = map(int, input().split())

ans = True if N % 9 == 0 else False

print("Yes" if ans else "Np")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
ifn%9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
from sys import stdin
input = stdin.readline
N=str(input())
NN=0
for i in range(len(N)):
    NN=NN+int(N[i])
  
if NN%9==0:print('Yes')
else:print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)