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: Runtime Error

Solution code:
def isDivBy9(n): 
  
    # Base cases 
    if (n == 0 or n == 9): 
        return True
    if (n < 9): 
        return False
   
    # If n is greater than 9, 
    # then recur for [floor(n / 9) - n % 8] 
    return isDivBy9((int)(n>>3) - (int)(n&7)) 
  
n=int(input())
if(isDivBy9(n)):
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

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

    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def isDivBy9(n): 
  
    # Base cases 
    if (n == 0 or n == 9): 
        return True
    if (n < 9): 
        return False 
    return isDivBy9((int)(n>>3) - (int)(n&7)) 
  
n=int(input())
if(isDivBy9(n)):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

ans = 0
a = A.index(max(A))
l = A[a+1:]
for i in range(1,N):
    bf = A[i-1]
    af = A[i]
    if a <= i:
        ans += max(A)*len(l)-sum(l)
        break
    elif bf > af:
        ans += bf-af

print(ans)

Submission status: Runtime Error

Solution code:
def Base_10_to_9(X):
    if (int(X/9)):
        return Base_10_to_9(int(X/9))+str(X%9)
    return str(X%9)
if Base_10_to_9(int(input()))[-1] == '0':
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n= int(n/10)
if sum1%9 == 0:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

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: Runtime Error

Solution code:
N=int(input())

def sumn(N):
    if N > 0:
        return sumn(N//10) + [N%10]
    else:
        return []

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

num_str = input()

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

num_sum = sum(num_list)

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

Submission status: Runtime Error

Solution code:
# import sys
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')


def isDivBy9(n):

    if (n == 0 or n == 9):
        return True
    if (n < 9):
        return False

    return isDivBy9((int)(n >> 3) - (int)(n & 7))


n = int(input())
if (isDivBy9(n)):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
list=[]
while n>0:
     d=n%10
     n=int(n/10)
     list.append(d)
s=0
for i in range(len(list)):
     s+=list[i]
if(s%9==0):
     print("Yes")
else:
     print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
input = sys.stdin.readline

num_str = input()

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

num_sum = sum(num_list)

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

Submission status: Runtime Error

Solution code:
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')


def isDivBy9(n):

    if (n == 0 or n == 9):
        return True
    if (n < 9):
        return False

    return isDivBy9((int)(n >> 3) - (int)(n & 7))


n = int(input())
if (isDivBy9(n)):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from math import ceil
n, x, t = map(int, input().split())
print(t*ceil(n/x))

Submission status: Runtime Error

Solution code:
a = input()
s=0
s = int(a)
s = list(map(int, a))


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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()

while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    n = input()

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from functools import reduce
n = input()

sum_ = reduce(lambda x,y:int(x)+int(y),n)
if sum_%9 == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()

while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9 or M == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())

sum=0
while(1):
    sum=sum+(N%10)
    N=int(N/10)
    #print("sum")
    #print(sum)
    #print("N")
    #print(N)
    if N==0:
        break

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

Submission status: Runtime Error

Solution code:
n = input()

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

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

Submission status: Runtime Error

Solution code:
#from functools import lru_cache
import sys
import numpy as np
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: Runtime Error

Solution code:
import numpy as np
import sys
input = sys.stdin.readline

num_str = input()

num_list = np.array([int(num_str[i]) for i in range(len(num_str))])

num_sum = np.sum(num_list)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

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

    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())/9

if str(a)[-1]=='0':
  print('Yes')
else:
  print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()


while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9 or M == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

while True:
  i += N % 10
  i = i % 9
  N = int(N/10)
  if N < 10:
    i += N
    break

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from decimal import Decimal
n=int(input())
n=Decimal(n)
if n%9==0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a=int(input())/9

if str(b)[-1]=='0':
  print('Yes')
else:
  print('NO')

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

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


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

Submission status: Runtime Error

Solution code:
n = int(input())

if type(n / 9) == int:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n/=10
if sum1%9 == 0:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
sum = 0
def sumN(n):
    sum = 0
    for i in range(len(n)):
        sum += int(n[i])
    return sum
sum = sumN(n)
while sum > 10000:
    sum = sumN(sum)
if sum % 9 == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
from math import ceil

n, x, t = [int(v) for v in input().split(" ")]


print(ceil(n / x) * t)

Submission status: Runtime Error

Solution code:
def run(x):
    '''

    '''


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

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


if __name__ == '__main__':
    x = int(input())
    run(x)

Submission status: Runtime Error

Solution code:
def ans(n): 
    if (n == 0 or n == 9): 
        return True
    if (n < 9): 
        return False
  
    return ans((int)(n>>3) - (int)(n&7)) 
  
n = input()
print('Yes' if ans(int(n)) else 'No')

Submission status: Runtime Error

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

while True:
  i += N % 10
  i = i % 9
  N = int(N/10)
  if N == 0:
    break

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

Submission status: Runtime Error

Solution code:
N = input()
N_len = len(N)
num = 0

for i in range(N_len):
  num += int(N(i))
  
if (num % 9 == 0):
  print("yes")
else:
  print("no")

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
x = int(input())
import math
answer = 0
while x >= 10:
    answer += x%10
    x = math.floor(x/10)
answer += x
if answer % 9 == 0:
    print('Yes')
elif answer == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
num = 0

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

Submission status: Runtime Error

Solution code:

import sys
input = sys.stdin.readline

n=input()

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

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

Submission status: Runtime Error

Solution code:
a=input()
b=int(a)/9
if str(b)[-1]=='0':
  print('Yes')
else:
  print('NO')

Submission status: Runtime Error

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

while True:
  i += int(N % 10)
  N = int(N/10)
  if N == 0:
    break

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

N = int(input())

cnt = 0
while(N>0):
  cnt += N%10
  N = int(N/10)
  #print(N)

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

Submission status: Runtime Error

Solution code:
import math
t = int(input())
sum =0
while t>0:
    sum += t%10
    t = int(t/10)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

while True:
  i += N % 10
  N = int(N/10)
  if N == 0:
    break

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from math import *

n, x, t = input().split(" ")


print(ceil(n / x) * t)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

S=input()
L=len(S)

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq
import numpy as np
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: Runtime Error

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: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
 
#a,b,c = list(map(int,input().split()))
 
a = list(input())

ans = 0

for dig in a:
  ans += int(dig)
  
if ans % 9 ==0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
#include <cstdio>
#include <cstring>

const int MAX = 2e5+10;
char s[MAX];

int main(){
    scanf("%s", s);
    int len = strlen(s);
    int sum = 0;
    for (int i = 0; i < len; i++) sum += s[i] - '0';
    if (sum==0 || sum%9==0) puts("Yes");
    else puts("No");
    return 0;
}

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    s = 0
    while n != 0:
        s += n%10
        n =int(n/10)
    if s%9==0:
        print('Yes')
    else:
        print('No')
        
if __name__=='__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
ans = 0
while N:
    ans += int(N[:-1])
    ans = ans % 9
    N = N[:-1]
if ans == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import numpy as np

N = str(input())
array = np.array(list(map(int, s)))

s = np.sum(array)
if s % 9 == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline

def main(n):
	summ = 0
	for i in n:
		summ += int(i)
	if summ % 9 == 0: return "Yes"
	else: return "No"
	

n = input()
print(main(n))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
j = 10
r = 0
for i in range(200002):
  r = r + n%j
  j = j*10

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

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i = x;i<n;i++)
#define loopr(i,x,n) for(ll i = n-1;i>=x;i--)
#define S(v) sort(v.begin(), v.end());
#define ff first
#define ss second
map<ll,bool> empty;


int main()
{		
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll t = 1;
	// cin>>t;
	while(t--){
		string s;
		cin>>s;
		ll sum = 0;
		loop(i,0,s.size()){
			sum += int(s[i] -48);
			sum = sum%9;
		}
		cout<<(sum%9 == 0?"Yes":"No");
	}
}
/*

1 5 4 1 2 2 4

*/

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a = rr()
b = 0
for　i in a:
  b += int(i)
  b = b%9
if b == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

import sys
input=sys.stdin.readline

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def f(S):
    if S=="":
        return 0
    else:
        return f(S[:-1])+int(S[-1])

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

Submission status: Runtime Error

Solution code:
N = Int(input())
print("Yes" if N % 9 == 0 else "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:
n=input()
s=0
for i in range(n):
  s+=int(n[i])
if(s%9==0):
  print("Yes")
else:
  print("No")