Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<utility>
using namespace std;
#define maxn 100005
typedef pair<string,int> P;
int n,t;
string name;
int cost;
queue<P> q;
queue<P> ans;
int time=0;
void Solve()
{
    while(!q.empty())
    {
        P p=q.front();
        P pp;
        if(p.second>t)
        {
            pp.first=p.first;
            pp.second=p.second-t;
            q.push(pp);
            q.pop();
            time+=t;
        }
        else
        {
            time+=p.second;
            ans.push(make_pair(p.first,time));
            q.pop();
        }

    }
}
int main()
{
    P sp;
    while(cin>>n>>t)
    {
        time=0;
        for(int i=0;i<n;i++)
        {
            cin>>name>>cost;
            q.push(make_pair(name,cost));
        }

        Solve();

        while(!ans.empty())
        {
            cout<<ans.front().first<<" "<<ans.front().second<<endl;
            ans.pop();
        }

    }
    return 0;
}

Compiler output:
a.cc:14:5: error: 'int time' redeclared as different kind of entity
   14 | int time=0;
      |     ^~~~
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:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void Solve()':
a.cc:27:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |             time+=t;
      |             ~~~~^~~
a.cc:27:17: error: assignment of read-only location 'time'
a.cc:31:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |             time+=p.second;
      |             ~~~~^~~~~~~~~~
a.cc:31:17: error: assignment of read-only location 'time'
a.cc:32:21: error: no matching function for call to 'std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::push(std::pair<std::__cxx11::basic_string<char>, long int (*)(long int*) noexcept>)'
   32 |             ans.push(make_pair(p.first,time));
      |             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Sequence = std::deque<std::pair<std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<std::__cxx11::basic_string<char>, int> > >; value_type = std::pair<std::__cxx11::basic_string<char>, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, long int (*)(long int*) noexcept>' to 'const std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::value_type&' {aka 'const std::pair<std::__cxx11::basic_string<char>, int>&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Sequence = std::deque<std::pair<std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<std::__cxx11::basic_string<char>, int> > >; value_type = std::pair<std::__cxx11::basic_string<char>, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, long int (*)(long int*) noexcept>' to 'std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::value_type&&' {aka 'std::pair<std::__cxx11::basic_string<char>, int>&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:43:13: error: assignment of function 'time_t time(time_t*)'
   43 |         time=0;
      |         ~~~~^~