Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define all(co) begin(co), end(co)

int main() {
	int m,t,p,r;
while (cin >> m >> t >> p >> r && m) {
	vector<vector<int>> v(t, vector<int>(p));
	rep(i, r) {
		int m, t, p, j; cin >> m >> t >> p >> j;
		t--;
		if (j == 0) {
			if(v[t][p] == 0) v[t][p] = m;
			else v[t][p] = m + -v[t][p] * 20;
		}
		else v[t]--;
	}
	map<int, vector<int>> rank;
	rep(i, t) {
		int s = -accumulate(all(v[i]), 0);
		if(rank.count(s)) rank.push_back(i + 1);
		else rank.insert(s, vector<int>{i+1});
	}
	for(auto it = rank.begin(); it != --rank.end(); it++) {
		rep(i, it->size() - 1) cout << it->at(i) << '=';
		cout << it->back();
		cout << ',';
	}
	{
		auto it = --rank.end();
		rep(i, it->size() - 1) cout << it->at(i) << '=';
		cout << it->back();
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   19 |                 else v[t]--;
a.cc:24:40: error: 'class std::map<int, std::vector<int> >' has no member named 'push_back'
   24 |                 if(rank.count(s)) rank.push_back(i + 1);
      |                                        ^~~~~~~~~
a.cc:25:33: error: no matching function for call to 'std::map<int, std::vector<int> >::insert(int&, std::vector<int>)'
   25 |                 else rank.insert(s, vector<int>{i+1});
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:847:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Val>, _Pair>::value), std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator, bool> > std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]'
  847 |         insert(_Pair&& __x)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_map.h:847:9: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:924:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Val>, _Pair>::value), typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, _Pair&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]'
  924 |         insert(const_iterator __position, _Pair&& __x)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_map.h:924:9: note:   template argument deduction/substitution failed:
a.cc:25:34: note:   cannot convert 's' (type 'int') to type 'std::map<int, std::vector<int> >::const_iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::const_iterator'}
   25 |                 else rank.insert(s, vector<int>{i+1});
      |                                  ^
/usr/include/c++/14/bits/stl_map.h:942:9: note: candidate: 'template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]'
  942 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_map.h:942:9: note:   template argument deduction/substitution failed:
a.cc:25:33: note:   deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
   25 |                 else rank.insert(s, vector<int>{i+1});
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_map.h:661:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type std::map<_Key, _Tp, _Compare, _Alloc>::insert(node_type&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; insert_return_type = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::insert_return_type; node_type = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::node_type]'
  661 |       insert(node_type&& __nh)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_map.h:661:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:666:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, node_type&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; iterator = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::iterator; const_iterator = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::const_iterator; node_type = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::node_type]'
  666 |       insert(const_iterator __hint, node_type&& __nh)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_map.h:666:29: note:   no known conversion for argument 1 from 'int' to 'std::map<int, std::vector<int> >::const_iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::const_iterator'}
  666 |       insert(const_iterator __hint, node_type&& __nh)
      |              ~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_map.h:834:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other = std::allocator<std::pair<const int, std::vector<int> > >; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const int, std::vector<int> > >, std::pair<const int, std::vector<int> > >::rebind<std::pair<const int, std::vector<int> > >; typename _Allocator::value_type = std::pair<const int, std::vector<int> >; value_type = std::pair<const int, std::vector<int> >]'
  834 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_map.h:834:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:841:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(value_type&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other = std::allocator<std::pair<const int, std::vector<int> > >; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const int, std::vector<int> > >, std::pair<const int, std::vector<int> > >::rebind<std::pair<const int, std::vector<int> > >; typename _Allocator::value_type = std::pair<const int, std::vector<int> >; value_type = std::pair<const int, std::vector<int> >]'
  841 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_map.h:841:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:879:7: note: candidate: 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Val> >) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]'
  879 |       insert(std::initializer_list<value_type> __list)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_map.h:879:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:909:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; iterator = std::_Rb_tree<int, std::pair<const int, std::vector<int> >, std::_Select1st<std::pair<const int, std::vector<int> > >, std::less<int>, std::allocator<std::pair<const int, std::vector<int> > > >::iterator; const_iterator = std::_Rb_tree<int, std::pair<const