Language: C++

#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;

char ans;
int a;
string st;
long long int getnum() {
	long long int  anum=0;
	while (1) {
		if (isdigit(st[a])) {
			anum *= 10;
			anum += st[a]-'0';
			a++;
		}
		else {
			return anum;
		}
	}
}
string getst() {
	string ast;
	while (1) {
		if (a == st.size())return ast;
		if ('A'<=st[a]&&st[a]<='Z') {
			ast += st[a];
			a++;
		}
		else {
			return ast;
		}
	}
}
string getans(const long long int repeatnum,const int targetnum) {
	string nst;
	while (1) {
		if (a == st.size())return  nst;
		if (st[a] == '(') {
			a++;
			nst+=getans(repeatnum, targetnum - nst.size());
		}
		else if (isdigit(st[a])) {
			long long int num=getnum();
			string plusst;
			if (st[a] == '(') {
				a++;
				plusst= (getans(min(1000000000000,repeatnum*num), targetnum - nst.size()*repeatnum));
			}
			else {
				plusst = st[a];
				a++;
			}
			
			for (int i = 0; i < num; ++i) {
				nst += plusst;
			}
			if ((nst.size())*repeatnum > targetnum) {
				ans = nst[targetnum % nst.size()];
				throw(0);
			}
		}
		else if (st[a] == ')') {
			a++;
			return nst;
		}
		else {
			string plusst = getst();
			nst += plusst;
			if ((nst.size())*repeatnum > targetnum) {
				ans = nst[targetnum % nst.size()];
				throw(0);
			}
		}
	}
}

int main() {
	while (1) {
		a = 0;
		ans = '0';
		int n;
		cin >> st >> n;
		if (st == "0")break;
		try {
			getans(1, n);
		}
		catch (...) {

		}
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'std::string getans(long long int, int)':
a.cc:47:52: error: no matching function for call to 'min(long int, long long int)'
   47 |                                 plusst= (getans(min(1000000000000,repeatnum*num), targetnum - nst.size()*repeatnum));
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:47:52: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   47 |                                 plusst= (getans(min(1000000000000,repeatnum*num), targetnum - nst.size()*repeatnum));
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:47:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   47 |                                 plusst= (getans(min(1000000000000,repeatnum*num), targetnum - nst.size()*repeatnum));
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~