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

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pci pair<char,int>
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a)*((b)/gcd(a,b))
#define popcount(x) __builtin_popcount(x)

const ll mod = 1e9+7;


// Call by reference is used in x
template<typename T, typename U>
static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}

// call by reference is used in x
template<typename T, typename U>
static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}


template<typename T> void scan(T &x)
{
    x = 0;
    bool neg = 0;
    register T c = getchar();

    if (c == '-')
        neg = 1, c = getchar();

    while ((c < 48) || (c > 57))
        c = getchar();

    for ( ; c < 48||c > 57 ; c = getchar());

    for ( ; c > 47 && c < 58; c = getchar() )
        x= (x << 3) + ( x << 1 ) + ( c & 15 );

    if (neg) x *= -1;
}

template<typename T> void print(T n)
{
    bool neg = 0;

    if (n < 0)
        n *= -1, neg = 1;

    char snum[65];
    int i = 0;
    do
    {
        snum[i++] = n % 10 + '0';
        n /= 10;
    }

    while (n);
    --i;

    if (neg)
        putchar('-');

    while (i >= 0)
        putchar(snum[i--]);

    putchar('\n');
}

using namespace std;

void dfs(int v)
{

}
void build(int ind,int low,int high)  // Build Segment Tree
{

}
int query(int ind,int low,int high,int l,int r)  //Query for Segment Tree
{

}
int main()
{
 	string s;cin>>s;
 	int l=s.length();
 	int sum=0;
 	for(int i=0;i<l;i++)
 	{
 		sum+=s[i];
	 }
	 if(sum==0) cout<<"Yes";
	 else if(sum%9==0) cout<<"Yes";
	 else cout<<"No";
 	
 	


return 0;
}