Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>

#define rep(i, n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<ll, ll> P;

bool prime(int n) {
    int cnt = 0;
    for (int i = 1; i <= sqrt(n); i++) {
        if (n % i == 0)cnt++;
    }
    if (cnt != 1)return false;
    else return n != 1;
}

ll gcd(ll x, ll y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    return x * y / gcd(x, y);
}

ll mod_pow(ll x, ll n, ll mod) {
    ll bit = 1;
    while (n) {
        if (n & 1)bit = bit * x % mod;
        x = x * x % mod;
        n /= 2;
    }
    return bit;
}

ll C(ll a, ll b) {
    ll x = 1, y = 1;
    rep(i, b) {
        x = x * (a - i) % inf;
        y = y * (b - i) % inf;
    }
    rep(i, inf) {
        if (x == y * i % inf) {
            return i;
        }
    }
}

P a[3333];
ll dp[3333][6666];

signed main() {
    ll n, w;
    cin >> n >> w;
    rep(i, n)cin >> a[i].first >> a[i].second;
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
        for (ll j = 0; j < 6666; j++) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j <= w - 1)dp[i + 1][j + a[i].first] = max(dp[i][j] + a[i].second, dp[i][j + a[i].first]);
        }#include <bits/stdc++.h>
        using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
        typedef long long ll;
        typedef pair<int, int> P;
        typedef priority_queue<int> pque;
        int gcd(int a,int b){return b?gcd(b,a%b):a;};
        int lcm(int a,int b){return a*b/gcd(a,b);};
        int mod(int a,int b){return (a+b-1)/b;};
        int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
        template<typename A, size_t N, typename T>
        void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
        template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
        template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

        ll comb(int a, int b) {
            ll m = 1, c = 1;
            for(ll i = 0; i < b; i++) {
                c *= a - i;
                m *= i + 1;
            }
            return c / m;
        }

        signed main() {
            cin.tie(0);
            cout.tie(0);
            ios::sync_with_stdio(false);

            int x, y;
            cin >> x >> y;
            if((x + y) % 3 != 0) {
                cout << 0 << endl;
                return 0;
            }

            int m, n;
            m = (2 * y - x) / 3;
            n = (x - m) / 2;

            if(m < 0 || n < 0) {
                cout << 0 << endl;
            } else {
                cout << comb(n + m, n) % 1000000007 << endl;
            }
            return 0;
        }

    }
    ll ans, p = -11;
    for (int i = 0; i < 6666; i++) {
        ans = max(p, dp[n][i]);
        if (p < dp[n][i])p = dp[n][i];
    }
    cout << ans << endl;
    ggr
}

Compiler output:
a.cc:74:10: error: stray '#' in program
   74 |         }#include <bits/stdc++.h>
      |          ^
a.cc:78:9: warning: "rep" redefined
   78 | #define rep(i,n) for(int (i)=0;i<(n);i++)
      |         ^~~
a.cc:12:9: note: this is the location of the previous definition
   12 | #define rep(i, n)for(ll i=0;i<n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:74:11: error: 'include' was not declared in this scope
   74 |         }#include <bits/stdc++.h>
      |           ^~~~~~~
a.cc:74:20: error: 'bits' was not declared in this scope
   74 |         }#include <bits/stdc++.h>
      |                    ^~~~
a.cc:74:25: error: 'stdc' was not declared in this scope; did you mean 'std'?
   74 |         }#include <bits/stdc++.h>
      |                         ^~~~
      |                         std
a.cc:75:9: error: expected primary-expression before 'using'
   75 |         using namespace std;
      |         ^~~~~
a.cc:76:9: error: '#pragma GCC optimize' is not allowed inside functions
   76 | #pragma GCC optimize("Ofast")
      |         ^~~
a.cc:13:12: error: 'long long long' is too long for GCC
   13 | #define ll long long
      |            ^~~~
a.cc:88:27: note: in expansion of macro 'll'
   88 |         typedef long long ll;
      |                           ^~
a.cc:13:17: error: 'long long long' is too long for GCC
   13 | #define ll long long
      |                 ^~~~
a.cc:88:27: note: in expansion of macro 'll'
   88 |         typedef long long ll;
      |                           ^~
a.cc:13:17: error: declaration does not declare anything [-fpermissive]
   13 | #define ll long long
      |                 ^~~~
a.cc:88:27: note: in expansion of macro 'll'
   88 |         typedef long long ll;
      |                           ^~
a.cc:91:29: error: a function-definition is not allowed here before '{' token
   91 |         int gcd(int a,int b){return b?gcd(b,a%b):a;};
      |                             ^
a.cc:92:29: error: a function-definition is not allowed here before '{' token
   92 |         int lcm(int a,int b){return a*b/gcd(a,b);};
      |                             ^
a.cc:93:29: error: a function-definition is not allowed here before '{' token
   93 |         int mod(int a,int b){return (a+b-1)/b;};
      |                             ^
a.cc:95:9: error: a template declaration cannot appear at block scope
   95 |         template<typename A, size_t N, typename T>
      |         ^~~~~~~~
a.cc:98:9: error: a template declaration cannot appear at block scope
   98 |         template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};
      |         ^~~~~~~~
a.cc:100:31: error: a function-definition is not allowed here before '{' token
  100 |         ll comb(int a, int b) {
      |                               ^
a.cc:109:20: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  109 |         signed main() {
      |                    ^~
a.cc:109:20: note: remove parentheses to default-initialize a variable
  109 |         signed main() {
      |                    ^~
      |                    --
a.cc:109:20: note: or replace parentheses with braces to value-initialize a variable
a.cc:109:23: error: a function-definition is not allowed here before '{' token
  109 |         signed main() {
      |                       ^
a.cc: In function 'long long int C(long long int, long long int)':
a.cc:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^