Language: C++

#include<iostream>
#include<map>
#include<string>
#include<algorithm>

int main(){
  int i;
  int n;
  map<string, int> p;
  cin >> n;
  int num;
  string name;
  map<string, int>::iterator it;
  for(i = 0; i < n; i++){
    cin >> name >> num;
    if(p.find(name) != p.end()) p[name] += num;
    else p[name] = num;
  }

  for(i=1; i<=5; i++){
    it = p.begin;
    while( it != p.end()){
      if(p->first.size() = i){
	count << p->first << " " << p->second << endl;
      }
      it++;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'map' was not declared in this scope
    9 |   map<string, int> p;
      |   ^~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:9:7: error: 'string' was not declared in this scope
    9 |   map<string, int> p;
      |       ^~~~~~
a.cc:9:7: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:9:15: error: expected primary-expression before 'int'
    9 |   map<string, int> p;
      |               ^~~
a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |   cin >> n;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:9: error: expected ';' before 'name'
   12 |   string name;
      |         ^~~~~
      |         ;
a.cc:13:15: error: expected primary-expression before 'int'
   13 |   map<string, int>::iterator it;
      |               ^~~
a.cc:15:12: error: 'name' was not declared in this scope
   15 |     cin >> name >> num;
      |            ^~~~
a.cc:16:8: error: 'p' was not declared in this scope
   16 |     if(p.find(name) != p.end()) p[name] += num;
      |        ^
a.cc:21:5: error: 'it' was not declared in this scope; did you mean 'i'?
   21 |     it = p.begin;
      |     ^~
      |     i
a.cc:21:10: error: 'p' was not declared in this scope
   21 |     it = p.begin;
      |          ^
a.cc:24:9: error: 'count' was not declared in this scope; did you mean 'std::count'?
   24 |         count << p->first << " " << p->second << endl;
      |         ^~~~~
      |         std::count
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:24:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 |         count << p->first << " " << p->second << endl;
      |                                                  ^~~~
      |                                                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~