Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    unsigned ll N, M, K; cin >> N >> M >> K;
    vector< unsigned ll> A(N), B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    unsigned ll a = 0, b = 0;
    unsigned ll ans = 0;
    while (K > 0) {
        if (a < N && b < M) {
            if (A[a] < B[b] && K-A[a] >= 0) {
                K-=A[a];
                ans++;
                a++;
            }
            else if (K-B[b] >= 0) {
                K-=B[b];
                ans++;
                b++;
            }
            else break;
        }
        else if (a < N) {
            if (K-A[a] >= 0) {
                K-=A[a];
                ans++;
                a++;
            }
            else break;
        }
        else if (b < M) {
            if (K-B[b] >= 0) {
                K-=B[b];
                ans++;
                b++;
            }
            else break;
        }
        else {
            break;
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: expected initializer before 'N'
   13 |     unsigned ll N, M, K; cin >> N >> M >> K;
      |                 ^
a.cc:13:33: error: 'N' was not declared in this scope
   13 |     unsigned ll N, M, K; cin >> N >> M >> K;
      |                                 ^
a.cc:13:38: error: 'M' was not declared in this scope
   13 |     unsigned ll N, M, K; cin >> N >> M >> K;
      |                                      ^
a.cc:13:43: error: 'K' was not declared in this scope
   13 |     unsigned ll N, M, K; cin >> N >> M >> K;
      |                                           ^
a.cc:17:17: error: expected initializer before 'a'
   17 |     unsigned ll a = 0, b = 0;
      |                 ^
a.cc:18:17: error: expected initializer before 'ans'
   18 |     unsigned ll ans = 0;
      |                 ^~~
a.cc:20:13: error: 'a' was not declared in this scope
   20 |         if (a < N && b < M) {
      |             ^
a.cc:20:22: error: 'b' was not declared in this scope
   20 |         if (a < N && b < M) {
      |                      ^
a.cc:23:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:28:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:36:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:44:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:53:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   53 |     cout << ans << endl;
      |             ^~~
      |             abs