Language: C++

//Tsundoku
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    unsigned long long N,M,K;
    cin >> N >> M >> K;
    vector<int> A(N);
    vector<int> accA(N+1,0);
    //stack<int>A;
    
    // 累積和をつくる
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        accA[i+1] = accA[i] + A[i];
    }
    vector<int> B(M);
    vector<int> accB(M+1,0);
    //stack<int> B;
    for (int j = 0; j < M; j++) {
        cin >> B[j];
        accB[j+1] = accB[j] + B[j];
    }

    for (int i = 0; i <= N; i++) {
        //cout << "accA[i]=" << accA[i] << endl;
    }
    for (int i = 0; i <= M; i++) {
        //cout << "accB[i]=" << accB[i] << endl;
    }

    unsigned long long ans = 0;
    for (int i = 1; i <= N; i++) {
        //cout << "i=" << i << endl;
        long long tmp = K - accA[i];
        if (tmp < 0) {
            break;
        }
        //cout << "tmp=" << tmp << endl;
        long long result = 0;
        long long l,r;
        l = 0;
        r = M;
        while (r>l) {
            long long mid = l + (r-l) / 2;
            //cout << "mid=" << mid << endl;
            if (tmp >= accB[mid]) {
                l = mid + 1;
                //cout << "l=" << l << endl;
                //cout << "r=" << r << endl;
            }
            else {
                r = mid - 1;
                //cout << "l=" << l << endl;
                //cout << "r=" << r << endl;
            }        
        }
        result = i + l;
        //cout << "result=" << result << endl;
        ans = max(ans,result);
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:18: error: no matching function for call to 'max(long long unsigned int&, long long int&)'
   74 |         ans = max(ans,result);
      |               ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:74:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long long int')
   74 |         ans = max(ans,result);
      |               ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:10:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:74:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   74 |         ans = max(ans,result);
      |               ~~~^~~~~~~~~~~~