Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <math.h>
#include <bitset>
using namespace std;
typedef pair<int,int> P;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-9;
const int N = 1e9 + 5;

struct Node
{
    string name;
    int prio;
    int clock;
    bool isworking;
    Node(){}
    Node(string s, int p, int t){name = s; prio = p; clock = t; isworking = false;}
    bool operator<(const Node &p) const
    {
        if(prio == p.prio && clock == p.clock)
            return name < p.name;
        if(prio == p.prio)
            return clock > p.clock;
        return prio > p.prio;
    }
};
set<Node> acm;
map<string,int> mp;
int n,m;
string na,sign;
int pri,clock;
int main()
{
    std::ios_base::sync_with_stdio(false);
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        cin>>na>>pri;
        acm.insert(Node(na, pri, 0));
        cout<<i<<endl;
    }
    int down = acm.size()/5, i = 0;
    cout<<acm.size()<<endl;
    vector<Node> yyy;
    yyy.clear();
    for(set<Node>::iterator it = acm.begin(); i < down && it != acm.end(); i++)
    {
        cout<<"come"<<endl;
        Node tmp = *it;
        tmp.isworking = true;
        yyy.push_back(tmp);
        acm.erase(it++);
    }
    for(int i = 0; i < yyy.size(); i++)
    {
        cout<<yyy[i].isworking<<endl;
        acm.insert(yyy[i]);
    }
    yyy.clear();
    cin>>m;
    clock = 1;
    int f = 0;
    while(m--)
    {
        cin>>sign>>na;
        if(mp.count(na)) f = 1;
        mp[na] = 1;
        if(sign == "+")
        {
            cin>>pri;
            acm.insert(Node(na, pri, clock++));
            int down = acm.size()/5;
            int flag = 0, flag1 = 0;
            i = 0;
            string out = "";
            set<Node>::iterator it;
            for(it = acm.begin(); i < down && it != acm.end(); i++)
            {
                if((*it).name == na)
                    flag = 1;
                else if((*it).isworking == false)
                {
                    flag1 = 1;
                    out = it->name;
                }
                Node tmp = *it;
                tmp.isworking = true;
                acm.erase(it++);
                yyy.push_back(tmp);
            }
            for(int i = 0; i < yyy.size(); i++)
                acm.insert(yyy[i]);
            yyy.clear();
            if(flag)
            {
                cout<<na<<" is working hard now.\n";
            }
            else
                cout<<na<<" is not working now.\n";
            if(flag1)
            {
                cout<<out<<" is working hard now.\n";
            }
            if(it->isworking == true)
            {
                Node tmp = *it;
                tmp.isworking = false;
                acm.erase(it++);
                acm.insert(tmp);
                //it->isworking = false;
                cout<<tmp.name<<" is not working now.\n";
            }
        }
        else
        {
            for(set<Node>::iterator it = acm.begin(); it != acm.end(); it++)
            {
                if(it->name == na)
                {
                    acm.erase(it);
                    break;
                }
            }
            //acm.erase(it);
            int down = acm.size()/5;
            i = 0;
            int flag = 0;
            string out ="";
            set<Node>::iterator it = acm.begin();
            yyy.clear();
            for(it = acm.begin(); i < down && it != acm.end(); i++)
            {
                if(it->isworking == false)
                {
                    flag = 1;
                    Node tmp = *it;
                    out = tmp.name;
                    tmp.isworking = true;
                    acm.erase(it++);
                    yyy.push_back(tmp);
                    //acm.insert(tmp);
                }
                else
                    it++;
            }
            for(int i = 0; i < yyy.size(); i++)
                acm.insert(yyy[i]);
            yyy.clear();
            if(flag)
            {
                cout<<out<<" is working hard now.\n";
            }
            flag = 0;
            if(it->isworking == true)
            {
                flag = 1;
                Node tmp = *it;
                out = tmp.name;
                tmp.isworking = false;
                acm.insert(tmp);
                acm.erase(it++);
            }
            if(flag)
                cout<<out<<" is not working now.\n";
        }
    }
    return 0;
}

Compiler output:
a.cc:43:9: error: 'int clock' redeclared as different kind of entity
   43 | int pri,clock;
      |         ^~~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 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/time.h:72:16: note: previous declaration 'clock_t clock()'
   72 | extern clock_t clock (void) __THROW;
      |                ^~~~~
a.cc: In function 'int main()':
a.cc:73:11: error: assignment of function 'clock_t clock()'
   73 |     clock = 1;
      |     ~~~~~~^~~
a.cc:83:38: warning: ISO C++ forbids incrementing a pointer of type 'clock_t (*)() noexcept' {aka 'long int (*)() noexcept'} [-Wpointer-arith]
   83 |             acm.insert(Node(na, pri, clock++));
      |                                      ^~~~~
a.cc:83:43: error: lvalue required as increment operand
   83 |             acm.insert(Node(na, pri, clock++));
      |                                           ^~