Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl;
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   " << endl;
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N), B(M);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<M; i++) cin >> B[i];

    vector<ll> wa_a(N+2), wa_b(M+2);
    wa_a[0] = 0;
    wa_b[0] = 0;

    for(int i=1; i<N+1; i++) wa_a[i] = wa_a[i-1] + A[i-1];
    for(int i=1; i<M+1; i++) wa_b[i] = wa_b[i-1] + B[i-1];
    wa_a[N+1] = 3e16;
    wa_b[M+1] = 3e16;
    // cout << " wa_a: " ;print_vec(wa_a);
    // cout << " wa_b: " ;print_vec(wa_b);
 
    ll ans = 0;
    for(int i=0; i<=N; i++){
      ll time = K - wa_a[i]; //Aからi冊読むので残りtime時間Bから読める
      if(time < 0) continue;
      auto iter = upper_bound(wa_b.begin(), wa_b.end(), time);
      auto index = iter - wa_b.begin()-1;
      ans = max(ans, i + index);
      //cout << " i:" << i << " index: " << index << endl;
    }

    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:16: error: no matching function for call to 'max(ll&, long int)'
   52 |       ans = max(ans, i + index);
      |             ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:52:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   52 |       ans = max(ans, i + index);
      |             ~~~^~~~~~~~~~~~~~~~
/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:
/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:52:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   52 |       ans = max(ans, i + index);
      |             ~~~^~~~~~~~~~~~~~~~