Submission details
Task:Tulkki
Sender:Karjalanp11rakka
Submission time:2025-10-28 17:34:47 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'void read(int)':
input/code.cpp:10:61: error: 'format' was not declared in this scope
   10 | #define I(T, X)T X;if(r[i]) g >> X; else {cin >> X; l[i] += format(" {} ", X);}
      |                                                             ^~~~~~
input/code.cpp:13:5: note: in expansion of macro 'I'
   13 |     I(string, f);
      |     ^
input/code.cpp:10:61: error: 'format' was not declared in this scope
   10 | #define I(T, X)T X;if(r[i]) g >> X; else {cin >> X; l[i] += format(" {} ", X);}
      |                                                             ^~~~~~
input/code.cpp:21:7: note: in expansion of macro 'I'
   21 |       I(char, x);
      |       ^
input/code.cpp:10:61: error: 'format' was not declared in this scope
   10 | #define I(T, X)T X;if(r[i]) g >> X; else {cin >> X; l[i] += format(" {} ", X);}
      |                                                             ^~~~~~
input/code.cpp:26:7: note: in expansion of macro 'I'
   26 |       I(c...

Code

#include <bits/stdc++.h>
using namespace std;
int t[26] = {};
vector<string> l;
vector<int> r;
void read(int i)
{
  istringstream g;
  if(l[i].size()) g = istringstream(l[i]);
#define I(T, X)T X;if(r[i]) g >> X; else {cin >> X; l[i] += format(" {} ", X);}
  while(true)
  {
    I(string, f);
    if(f == ")")
    {
      r[i] = 1;
      return;
    }
    if(f == "PRINT")
    {
      I(char, x);
      cout << t[x - 'A'] << " " << flush;
    }
    else if(f == "INCREASE")
    {
      I(char, x);
      t[x - 'A'] += 1;
    }
    else if(f == "CLEAR")
    {
      I(char, x);
      t[x - 'A'] = 0;
    }
    if(f == "REPEAT")
    {
      I(char, x);
      I(string, ti);
      I(string, st);
      for(int k = t[x - 'A']; k > 0; --k)
        read(i + 1);
    }
  }
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  l.resize(1000);
  r.resize(1000);
  read(0);
  return 0;
}