Language: C++

#include <iostream>
using namespace std;
#define mod 1e9 + 7


//This is power function which gives us x^y % mod 

int power(int x , int y , int mod){
 
  // Base Case
  if(y == 0) return 1 ;
  
  int p= power(x , y/2)%mod ;
  p = (p * p) % mod ;
  
  if(y & 1){
    p = (x * p) % mod ;
  }
  
  return p ;
}

// This Function give us Inverse of factorial of n .

Inversefactorial(int n ){
  
  // Base case
  if(n <= 0) return 0 ;
  
  int fact=1;
  
  for(int i=1 ; i <= n ; i++){
    fact=(fact * i) % mod ;
  }
  
  return power(fact , mod-2 , mod); 
}


//This Function return factorial n % mod 
int factorial(int n){
  
  // Base case
  if(n <= 0) return 0 ;
  
  int fact=1;
  
  for(int i=1 ; i <= n ; i++){
    fact=(fact * i) % mod ;
  }
  return fact ;
}
int nck ( int n , int k ){
  
 // The value of nCk is n! / (( n- k)! * k!) 
  
  return (((factorial(n) * Inversefactorial(k)) % mod) * Inversefactorial(n - k)) % mod;
}

// Return the total number of ways reach (n , m) from (0 , 0)
int TotalWays(int n , int m){
  
  // Case I : If (n+m)%3!=0 then answer is 0.
  
  if((n + m) % 3 != 0) return 0;
  
  /*Case II : Form the equation x + 2y = n and 2x + y == m , find the value of 
    		x and y and if x < 0 or y < 0 the our answer is zero
  */
  
  int x = n - (n + m) / 3;
  int y = m - (n + m) / 3;
  
  if(x < 0 || y < 0)
    return 0;
  
  //Case III : choose y moves from ( x + y ) moves 
  
  return nck (x + y , y) ;
  
}

int main() {
	int n , m ;
  cin>> n >> m ;
  
  	cout<<TotalWays(n , m)<<endl;
  
    return 0;
}


Compiler output:
a.cc:3:13: error: expected ',' or '...' before numeric constant
    3 | #define mod 1e9 + 7
      |             ^~~
a.cc:8:31: note: in expansion of macro 'mod'
    8 | int power(int x , int y , int mod){
      |                               ^~~
a.cc: In function 'int power(int, int, int)':
a.cc:13:15: error: too few arguments to function 'int power(int, int, int)'
   13 |   int p= power(x , y/2)%mod ;
      |          ~~~~~^~~~~~~~~
a.cc:8:5: note: declared here
    8 | int power(int x , int y , int mod){
      |     ^~~~~
a.cc:14:15: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   14 |   p = (p * p) % mod ;
      |       ~~~~~~~ ^
      |          |
      |          int
a.cc:17:17: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   17 |     p = (x * p) % mod ;
      |         ~~~~~~~ ^
      |            |
      |            int
a.cc: At global scope:
a.cc:25:1: error: ISO C++ forbids declaration of 'Inversefactorial' with no type [-fpermissive]
   25 | Inversefactorial(int n ){
      | ^~~~~~~~~~~~~~~~
a.cc: In function 'int Inversefactorial(int)':
a.cc:33:21: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   33 |     fact=(fact * i) % mod ;
      |          ~~~~~~~~~~ ^
      |                |
      |                int
a.cc: In function 'int factorial(int)':
a.cc:49:21: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   49 |     fact=(fact * i) % mod ;
      |          ~~~~~~~~~~ ^
      |                |
      |                int
a.cc: In function 'int nck(int, int)':
a.cc:57:49: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   57 |   return (((factorial(n) * Inversefactorial(k)) % mod) * Inversefactorial(n - k)) % mod;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      |                          |
      |                          int