Language: C++

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

class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};
int main() {
  int N,p[40];
  string T;
  cin>>N;
  cin>>T;
  int a=T.size();
  for(int i=0;i<pow(3,N);i++){
    for(int j;j<a;j++){
      if(T.at(j)=='S'){
        Radix r;
        p[i]=r.to(p[i],10,3);
      for(int i=0;i<p[i].size();i++){
        if(p[i].at(i)==1){
          p[i].at(i)=2;
        }
        else if(p[i].at(i)==2){
          p[i].at(i)=1;
        }
      }
  p[i]=r.to(p[i],3,10);
      }
      else if(T.at(j)=='R'){
        p[i]++;
        if(p[i]==pow(3,N)){
          p[i]=0;
        }
      }
    }
    cout<<p[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:18: error: no matching function for call to 'Radix::to(int&, int, int)'
   48 |         p[i]=r.to(p[i],10,3);
      |              ~~~~^~~~~~~~~~~
a.cc:16:15: note: candidate: 'std::string Radix::to(long long int, int)'
   16 |   std::string to(long long p, int q) {
      |               ^~
a.cc:16:15: note:   candidate expects 2 arguments, 3 provided
a.cc:27:15: note: candidate: 'std::string Radix::to(const std::string&, int, int)'
   27 |   std::string to(const std::string& t, int p, int q) {
      |               ^~
a.cc:27:37: note:   no known conversion for argument 1 from 'int' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
   27 |   std::string to(const std::string& t, int p, int q) {
      |                  ~~~~~~~~~~~~~~~~~~~^
a.cc:30:13: note: candidate: 'long long int Radix::to(const std::string&, int)'
   30 |   long long to(const std::string& t, int p) {
      |             ^~
a.cc:30:13: note:   candidate expects 2 arguments, 3 provided
a.cc:49:26: error: request for member 'size' in 'p[i]', which is of non-class type 'int'
   49 |       for(int i=0;i<p[i].size();i++){
      |                          ^~~~
a.cc:50:17: error: request for member 'at' in 'p[i]', which is of non-class type 'int'
   50 |         if(p[i].at(i)==1){
      |                 ^~
a.cc:51:16: error: request for member 'at' in 'p[i]', which is of non-class type 'int'
   51 |           p[i].at(i)=2;
      |                ^~
a.cc:53:22: error: request for member 'at' in 'p[i]', which is of non-class type 'int'
   53 |         else if(p[i].at(i)==2){
      |                      ^~
a.cc:54:16: error: request for member 'at' in 'p[i]', which is of non-class type 'int'
   54 |           p[i].at(i)=1;
      |                ^~
a.cc:57:12: error: no matching function for call to 'Radix::to(int&, int, int)'
   57 |   p[i]=r.to(p[i],3,10);
      |        ~~~~^~~~~~~~~~~
a.cc:16:15: note: candidate: 'std::string Radix::to(long long int, int)'
   16 |   std::string to(long long p, int q) {
      |               ^~
a.cc:16:15: note:   candidate expects 2 arguments, 3 provided
a.cc:27:15: note: candidate: 'std::string Radix::to(const std::string&, int, int)'
   27 |   std::string to(const std::string& t, int p, int q) {
      |               ^~
a.cc:27:37: note:   no known conversion for argument 1 from 'int' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
   27 |   std::string to(const std::string& t, int p, int q) {
      |                  ~~~~~~~~~~~~~~~~~~~^
a.cc:30:13: note: candidate: 'long long int Radix::to(const std::string&, int)'
   30 |   long long to(const std::string& t, int p) {
      |             ^~
a.cc:30:13: note:   candidate expects 2 arguments, 3 provided