Language: C++


#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
#define d9_7 1000000007
int main(void){
  int x,y,z,k;
  cin >> x>>y>>z>>k;
  vector<ll> a(x,0);
  vector<ll> b(y,0);
  vector<ll> c(z,0);
  rep(i,x){
    cin >> a[i];
  }
  rep(i,y){
    cin >> b[i];
  }
  rep(i,z){
    cin >> c[i];
  }
  sort(a.begin(),a.end(),greater<ll>());
  sort(b.begin(),b.end(),greater<ll>());
  sort(c.begin(),c.end(),greater<ll>());
  //rep(i,z)cout<<c[i]<<endl;
  /*int nowa=0,nowb=0,nowc=0;
  rep(i,k){
    cout<<a[nowa]+b[nowb]+c[nowc]<<endl;
    if((nowa!=x-1)&&(a[nowa+1]>b[nowb+1] && a[nowa+1]>c[nowc+1] && nowa<x-1 || nowc==z-1&&a[nowa+1]>b[nowb+1] || nowb==y-1 && a[nowa+1]>c[nowc+1] || nowb==y-1 && nowc==z-1)){
      nowa++;
    }else if((b[nowb+1]>c[nowc+1] && nowb < y-1 || nowc==z-1)&&(nowb!=y-1)){
      nowb++;
    }else{
      nowc++;
    }
  }*/
  vector<ll> cost;
  for(int nowa,x){
    for(int nowb,y){
      cost.insert(a[nowa]+b[nowb]);
    }
  }
  /*for(auto itr=cost.begin();itr!=cost.end();++itr){
    cout<<*itr<<endl;
  }*/
  /*multiset<ll,greater<ll>> cost2;
  rep(nowc,z){
    int cnt=0;
    for(auto itr=cost.begin();cnt<k&&itr!=cost.end();++itr){
      cost2.insert(c[nowc]+*itr);
      cnt++;
    }
  }
  int cc=0;
  for(auto itr=cost2.begin();cc<k&&itr!=cost2.end();++itr){
    cout<<*itr<<endl;
    cc++;
  }*/
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:17: error: expected ';' before ')' token
   52 |   for(int nowa,x){
      |                 ^
      |                 ;
a.cc:52:17: error: expected primary-expression before ')' token
a.cc:52:17: error: expected ';' before ')' token
   52 |   for(int nowa,x){
      |                 ^
      |                 ;
a.cc:53:19: error: expected ';' before ')' token
   53 |     for(int nowb,y){
      |                   ^
      |                   ;
a.cc:53:19: error: expected primary-expression before ')' token
a.cc:53:19: error: expected ';' before ')' token
   53 |     for(int nowb,y){
      |                   ^
      |                   ;
a.cc:54:18: error: no matching function for call to 'std::vector<long long int>::insert(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   54 |       cost.insert(a[nowa]+b[nowb]);
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = long long int; _Alloc = std::allocator<long long int>]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:133:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; size_type = long unsigned int; value_type = long long int]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 1 provided