Language: C++

#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
struct Team{
  int id;
  int point;
  int showed;
};
int H=0;
void swap(int *a,int *b){
  int tmp;
  tmp=*a;
  *a=*b;
  *b=tmp;
}
void maxHeapify(int i,Team* team){
  int l,r,largest;
  l=2*i;
  r=2*i+1;

  if(l<=H&&team[l].point>team[i].point){
    largest=l;
  }
  else if(team[l].point==team[i].point){
    if(team[l].id<team[i].id){
      largest=l;
    }
  }
  else largest=i;
  if (r<=H&&team[r].point>team[largest].point){
    largest=r;
  }
  else if(team[r].point==team[largest].point){
    if(team[r].id<team[largest].id){
      largest=r;
    }
  }
  if(largest!=i){
    swap(team[i],team[largest]);
    maxHeapify(largest,team);
  }
}
int search(int id,int n,Team* team){
  for(int i=1;i<=n;i++){
    if(team[i].id==id){
      return i;
    }
  }
}
void IncreaseKey(int id,int key,int n,Team* team){
  int t=search(id,n);
  team[t].point+=key;
  if(key<0){
    maxHeapify(search(id,n,team));
  }
  else{
    while(t>1&&team[t/2].point<team[t].point){
      swap(team[t],team[t/2]);
      t=t/2;
    }
  }
}
void insert(int id,Team* team){
  H++;
  team[H].id=id;
  team[H].point=0;
  team[H].showed=0;
}
void show_top(Team* team,int n){
  int top=1;
  int top_id=team[top].id;
  for(int i=1;i<=n;i++){
    if(team[i].showed>team[top].showed) top_id=team[i].id,top=i;
    else if(team[i].showed==team[top].showed){
      if(team[i].id<team[top].id){
	top_id=team[i].id,top=i;
      }
    }
  }
  printf("%d\n",top_id);
}
  
int main(){
  int n,r,l;
  scanf("%d%d%d",&n,&r,&l);
  Team team[n];
  int d[r];
  int t[r];
  int x[r];
  for(int i=1;i<=n;i++){
    insert(i);
  }
  for(int i=0;i<r;i++){
    scanf("%d%d%d",&d[i],&t[i],&x[i]);
  }
  for(int i=0;i<r;i++){
    if(i==0){
      team[search(1,n)].showed+=t[0];
    }
    IncreaseKey(d[i],x[i],n);
    if(i<r-1){
      team[1].showed+=t[i+1]-t[i];
    }
    else{
      team[1].showed+=l-t[r-1];
    }
  }
  return 0;
}
  

Compiler output:
a.cc: In function 'void IncreaseKey(int, int, int, Team*)':
a.cc:52:15: error: no matching function for call to 'search(int&, int&)'
   52 |   int t=search(id,n);
      |         ~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
 2332 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note:   candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
 4090 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
 4184 |     search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
  112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note:   candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
  117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note:   candidate expects 5 arguments, 2 provided
a.cc:44:5: note: candidate: 'int search(int, int, Team*)'
   44 | int search(int id,int n,Team* team){
      |     ^~~~~~
a.cc:44:5: note:   candidate expects 3 arguments, 2 provided
a.cc:55:15: error: too few arguments to function 'void maxHeapify(int, Team*)'
   55 |     maxHeapify(search(id,n,team));
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:17:6: note: declared here
   17 | void maxHeapify(int i,Team* team){
      |      ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:92:11: error: too few arguments to function 'void insert(int, Team*)'
   92 |     insert(i);
      |     ~~~~~~^~~
a.cc:64:6: note: declared here
   64 | void insert(int id,Team* team){
      |      ^~~~~~
a.cc:99:18: error: no matching function for call to 'search(int, int&)'
   99 |       team[search(1,n)].showed+=t[0];
      |            ~~~~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
 2332 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note:   candidate expects 5 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
 4090 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
 4184 |     search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
  112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note:   candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
  117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note:   candidate expects 5 arguments, 2 provided
a.cc:44:5: note: candidate: 'int search(int, int, Team*)'
   44 | int search(int id,int n,Team* team){
      |     ^~~~~~
a.cc:44:5: note:   candidate expects 3 arguments, 2 provided
a.cc:101:16: error: too few arguments to function 'void IncreaseKey(int, int, int, Team*)'
  101 |     IncreaseKey(d[i],x[i],n);
      |     ~~~~~~~~~~~^~~~~~~~~~~~~
a.cc:51:6: note: declared here
   51 | void IncreaseKey(int id,int key,int n,Team* team){
      |      ^~~~~~~~~~~
a.cc: In function 'int search(int, int, Team*)':
a.cc:50:1: warning: control reaches end of non-void function [-Wreturn-type]
   50 | }
      | ^