For this Question: You must have solved the problem 'Tribonacci Numbers'. Now its time for Tribonacci strings.
Given three strings T[1] = "p", T[2] = "q", T[3] = "r", 
String T[i] = T[i-1] + T[i-2] + T[i-3]
Find the character at K'th index in string T[N] (assuming 1-indexing)
Solve for Q independent queriesFirst line of input contains a single integer Q
Q lines follow, each containing two space separated numbers N and K
1 <= Q <= 10^5
1 <= N <= 60
1 <= K <= 10^16Print Q lines, each containing the character at K-th index of string T[N].
If K exceeds the length of string, print xSample Input 1:
3
6 2
6 8
6 12

Sample Output 1:
q
p
x

Explanation:
T[1] = p
T[2] = q
T[3] = r
T[4] = rqp
T[5] = rqprq
T[6] = rqprqrqpr, I have written this Solution Code: #include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif 
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];

char rec(int n, int k){
	if(k > a[n])
		return 'x';
	if(n == 1)	return 'p';
	if(n == 2)	return 'q';
	if(n == 3)	return 'r';
	if(k <= a[n-1])	return rec(n-1, k);
	k -= a[n-1];
	if(k <= a[n-2])	return rec(n-2, k);
	k -= a[n-2];
	return rec(n-3, k);
}

signed main() {
	IOS;
	clock_t start = clock();
	int t;	cin >> t;
	a[1] = a[2] = a[3] = 1;
	for(int i = 4; i <= 60; i++)
		a[i] = a[i-1] + a[i-2] + a[i-3];
	while(t--){
		int n, k;	cin >> n >> k;
		cout << rec(n, k) << endl;
	}
	cerr << (double)(clock() - start)*1000/CLOCKS_PER_SEC << " ms" << endl;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?