criyle/codenet-compile-errors huggingface dataset:
Language: C++

// can i beat Mod Love? 
#include <bits/stdc++.h>

using namespace std;
#define int long long 
#define eps 1e-8
#define SZ(a) ((int32_t)a.size())
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
typedef long long ll;
ll bin(ll x, ll n, ll MOD) {ll ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = acos(-1.0);
constexpr ll mod = 1e9+7;
constexpr int maxn = 1e6+100; // remember to calculate.
int n, c[maxn];
string s[maxn];
ll v[55][22][2], f[55][22][2], ans = l;
ll dp(int x, int y, int d){ // x 为串的编号，y 为位置， d为方向
	if(y == SZ(s[x])) return 0;
	ll &u = v[x][y][d], &v = f[x][y][d];
	if(u) return v;
	u = 1, v = linf;
	int fl = 1;
	if(!d){
		for(int j = y, k = SZ(s[x]) - 1; j < k; j++, k--){
			if(s[x][j] != s[x][k]) {
				fl = 0; break;
			}
		}
	}else{
		for(int j = y, k = 0; j > k; j--, k++){
			if(s[x][j] != s[x][k]) {
				fl = 0; break;
			}
		}
	}
	if(fl) {
		return v = 0;
	}
	for(int i = 1, j , k; i <= n; i++){ // 枚举另一方向接哪个串
		fl = 1;
		if(!d) {
			for(j = y, k = SZ(s[i]) - 1; j < SZ(s[x]) && k >= 0; j++, k--){
				if(s[x][j] != s[i][k]) {
					fl = 0;break;
				}
			}
			if(fl){
				if(k < 0) v = min(v , c[i]+dp(x , j , 0));
				else v = min(v, c[i] + dp(i , k , 1)); 
			}
		}else{
			for(j = y, k = 0; j >= 0 && k < SZ(s[i]); j--, k++){
				if(s[x][j] != s[i][k]) {
					fl = 0; break;
				}
			}
			if(fl) {
				if(j < 0) v = min(v , c[i] + dp(i , k , 0));
				else v = min(v , c[i] + dp(x , j , 1));
			}
		}
	}
	return v;
}
int32_t main()
{
	close;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> s[i] >> c[i];
	}
	for(int i = 1; i <= n; i++) {
		ans = min(ans , c[i] + dp(i , 0 , 0));
	}
	cout << (ans == linf ? -1 : ans) << endl;
	return 0;
}

Compiler output:
a.cc:18:38: error: 'l' was not declared in this scope
   18 | ll v[55][22][2], f[55][22][2], ans = l;
      |                                      ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long;
using p = pair<ll, int>;

struct E {
    int to, co;
    E(int to = 0, int co = 0) : to(to), co(co) {}
};

string rev(string s) {
    reverse(s.begin(), s.end());
    return s;
}

int main() {
    int m;
    cin >> m;
    vector<string> S(m);
    vector<int> C(m);
    rep(i, m) cin >> S[i] >> C[i];
    rep(i, m) {
        S.push_back(rev(S[i]));
        C.push_back(C[i]);
    }

    int n = 1;
    vector<vector<int>> id(m * 2);
    rep(i, m * 2) {
        int l = S[i].size();
        id[i].resize(l);
        rep(j, l) {
            id[i][j] = n++;
        }
    }

    vector<vector<E>> g(n);
    rep(i, m * 2) {
        int l = S[i].size();
        rep(j, l) {
            int v = id[i][j];
            rep(ni, m * 2) {
                if (i / m == ni / m) continue;
                int nl = S[ni].size();
                int w = min(nl, l - j);
                if (S[i].substr(j, w) != S[ni].substr(0, w)) continue;
                int u = 0;
                if (nl > w) {
                    u = id[ni][w];
                } else if (l > j + w) {
                    u = id[i][j + w];
                } else u = 0;
                g[v].emplace_back(u, C[ni]);
            }
        }
    }

    const ll INF = 1e18;
    vector<ll> dist(n, INF);
    priority_queue<p, vector<p>, greater<p>> q;
    auto push = [&](int v, ll x) {
        if (dist[v] <= x) return;
        dist[v] = x;
        q.emplace(x, v);
    };

    rep(i, m) push(id[i][0], C[i]);
    while (!q.empty()) {
        ll x = q.top().first;
        int v = q.top().second; q.pop();
        if (dist[v] != x) continue;
        for (E e : g[v]) {
            push(e.to, x + e.co);
        }
    }

    ll ans = dist[0];
    rep(i, m * 2) {
        int l = S[i].size();
        rep(j, l) {
            string t = S[i].substr(j);
            if (t == rev(t)) {
                ans = min(ans, dist[id[i][j]]);
            }
        }
    }

    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'std::string rev(std::string)':
a.cc:17:5: error: 'reverse' was not declared in this scope
   17 |     reverse(s.begin(), s.end());
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<pair<string,ll>,ll> mp,visit;
ll cost[52],flag,n;
string ar[52];
pair<string,ll> compSuff(string s1,string s2)
{
	ll i,j,f=1,k;
	i=0;
	j=s2.size()-1;
	while(i<s1.size() && j>=0)
	{
		if(s1[i]!=s2[j])
		{
			f=0;
			break;
		}
		i++;
		j--;
	}
	string str="";
	if(i==s1.size())
	{
		for(k=j;k>=0;k--)
		{
			str+=s2[k];
		}
	}
	else
	{
		for(k=i;k<s1.size();k++)
		{
			str+=s1[k];
		}
	}
	pair<string,ll> p={str,f};
	return p;
}
pair<string,ll> compPref(string s1,string s2)
{
	ll i,j,k,f=1;
	i=0;
	j=0;
	while(i<s1.size() && j<s2.size())
	{
		if(s1[i]!=s2[j])
		{
			f=0;
			break;
		}
		i++;
		j++;
	}
	string str="";
	if(i==s1.size())
	{
		for(k=j;k<s2.size();k++)
		{
			str+=s2[k];
		}
	}
	else
	{
		for(k=i;k<s1.size();k++)
		{
			str+=s1[k];
		}
	}
	pair<string,ll> p={str,f};
	return p;
}

ll rec(string str,ll side)
{
	pair<string,ll> p= {str,side};
	if(str.size()==0 || str.size()==1)
	{
		flag=1;
		return 0;
	}
	if(visit[p]==1)
		return 1e17;
	visit[p]=1;
	ll min1=1e17;
	for(ll i=1;i<=n;i++)
	{
		pair<string,ll> z;
		if(side==0)
			z=compSuff(str,ar[i]);
		else
			z=compPref(str,ar[i]);
		if(z.second==1)
		{
			if(str.size()>=ar[i].size())
				min1=min(min1,cost[i]+rec(z.first,side));
			else
				min1=min(min1,cost[i]+rec(z.first,!side));
		}
	}
	return mp[p]=min1;
}
int main()
{
	ll i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>ar[i]>>cost[i];
	}
	ll min1=1e17;
	for(i=1;i<=n;i++)
	{
		min1=min(min1,cost[i]+rec(ar[i],0));
	}
	if(flag==0)
		cout<<-1;
	else
		cout<<min1;

}

Compiler output:
a.cc: In function 'long long int rec(std::string, long long int)':
a.cc:82:12: error: reference to 'visit' is ambiguous
   82 |         if(visit[p]==1)
      |            ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:28: note:                 'std::map<std::pair<std::__cxx11::basic_string<char>, long long int>, long long int> visit'
    4 | map<pair<string,ll>,ll> mp,visit;
      |                            ^~~~~
a.cc:84:9: error: reference to 'visit' is ambiguous
   84 |         visit[p]=1;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:28: note:                 'std::map<std::pair<std::__cxx11::basic_string<char>, long long int>, long long int> visit'
    4 | map<pair<string,ll>,ll> mp,visit;
      |                            ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
#define int ll
ll n, cost[55], ans = LLINF;
string str[55][2];
map<string, ll> memo[2];

ll dp(string s, int p) { // p = 0 means prefix
	string s2 = s;
	reverse(all(s2));
	if (s == s2) return 0;
	
	if (memo[p].find(s) != memo[p].end()) return memo[p][s];
	memo[p][s] = LLINF;
	int f = (p+1)%2;
	
	FOR(i, 1, n) {
		bool ok = 1;
		FOR(j, 0, min(s.size(), str[i][f].size())-1) if (s[j] != str[i][f][j]) ok = 0;
		if (!ok) continue;
		
		if (s.size() > str[i][f].size()) {
			string nxt = "";
			FOR(j, str[i][f].size(), s.size()-1) nxt += s[j];
			memo[p][s] = min(memo[p][s], dp(nxt, p) + cost[i]);
		} else {
			string nxt = "";
			FOR(j, s.size(), str[i][f].size()-1) nxt += str[i][f][j];
			memo[p][s] = min(memo[p][s], dp(nxt, f) + cost[i]);
		}
	}
	return memo[p][s] = res;
}

int32_t main() {
	fastio; cin >> n;
	FOR(i, 1, n) {
		cin >> str[i][0] >> cost[i];
		str[i][1] = str[i][0];
		reverse(all(str[i][1]));
	}
	FOR(i, 1, n) ans = min(ans, dp(str[i][0], 0) + cost[i]);
	cout << (ans == LLINF ? -1 : ans);
}


Compiler output:
a.cc: In function 'll dp(std::string, ll)':
a.cc:53:29: error: 'res' was not declared in this scope
   53 |         return memo[p][s] = res;
      |                             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
constexpr ll INF = 1LL << 61;
typedef vector<ll> Array;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	ll n;
	cin >> n;
	vector s(2, vector<string>(n));//元の文字列と反転した文字列
	Array cost(n);
	REP(i, n)cin >> s[0][i] >> cost[i];
	REP(i, n)s[1][i] = s[0][i], reverse(all(s[1][i]));

	//ダイクストラ
	using T = tuple<ll, string, bool>;//コスト、文字列、反転しているかどうか
	map<pair<string, ll>, ll> mp;
	priority_queue<T, vector<T>, greater<T>> que;
	auto push = [&](ll c, string v, ll f) {
		if (mp.count({ v,f }) == 0 || mp[{v, f}] > c)que.push({ c,v,f }), mp[{v, f}] = c;
	};
	ll ans = INF;
	auto pcheck = [&](string& s) {
		REP(i, s.size() / 2)if (s[i] != s[s.size() - 1 - i])return false;
		return true;
	};
	REP(i, n) push(cost[i], s[0][i], 1);
	while (que.size()) {
		auto [c, v, flip] = que.top();
		que.pop();
		if (mp[{v, flip}] < c || ans <= c)continue;
		if (pcheck(v) == true) {
			chmin(ans, c);
			continue;
		}
		REP(i, n) {
			auto check = [&](string a, string b)->string {
				if (a.size() < b.size())swap(a, b);
				REP(i, b.size())if (a[i] != b[i])return "!";
				return a.substr(b.size());
			};
			auto ret = check(v, s[flip][i]);
			if (ret == "!")continue;
			push(c + cost[i], ret, flip ^ (v.size() <= s[flip[i].size()));
		}
	}
	if (ans == INF)cout << -1 << "\n";
	else cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:45: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   21 |         REP(i, n)s[1][i] = s[0][i], reverse(all(s[1][i]));
      |                                             ^~~
      |                                             std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:52:74: error: invalid types 'std::tuple_element<2, std::tuple<long long int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool> >::type {aka bool}[long long int]' for array subscript
   52 |                         push(c + cost[i], ret, flip ^ (v.size() <= s[flip[i].size()));
      |                                                                          ^
a.cc:52:84: error: expected ']' before ')' token
   52 |                         push(c + cost[i], ret, flip ^ (v.size() <= s[flip[i].size()));
      |                                                                                    ^
      |                                                                                    ]
Language: C++

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

#define LL long long

const int MOD = 1e9 + 7;
const LL INF = 1e18 + 9;
const int MX = 1e5 + 5;

int n;
vector<string> inp;
vector<LL> cost;

bool isPalindrome(string &s) {
	int l = s.size();
	for(int i=0;i<l;i++) {
		if(s[i] != s[l-1-i])
			return false;
	}
	return true;
}

vector<string> getNextState(string &s1, string &s2) {
	vector<string> ret;

	int l1 = s1.size();
	int l2 = s2.size();
	int l = min(l1,l2);
	for(int i=0;i<l;i++) {
		if(s1[i] != s2[l2-1-i]) {
			return ret;
		}
	}
	if(l1 == l2) {
		ret.push_back("");
		ret.push_back("");
	}	
	else if(l1 > l2) {
		string tmp = s1.substr(l2);
		ret.push_back(tmp);
		ret.push_back("");
	}
	 else {
		string tmp = s2.substr(0, l2-l1);
		ret.push_back("");
		ret.push_back(tmp);
	}
	return ret;
} 

map<pair<string, string>, LL > cache;

LL solve(string &pre, string &suff) {
	if(isPalindrome(pre + suff)) {
		return 0;
	}

	if(cache.find({pre,suff}) != cache.end()) {
		return cache[{pre,suff}];
	}

	LL ret = INF;

	for(int i=0;i<n;i++) {
		vector<string> cand;
		if(pre.size() > 0) {
			cand = getNextState(pre, inp[i]);
		} else {
			cand = getNextState(inp[i], suff);
		}

		if(cand.size() == 0) {
			continue;
		}

		ret = min(ret, cost[i] + solve(cand[0], cand[1]));
	}

	cache[{pre, suff}] = ret;
	return ret;
}

int main() {
	cin >> n;
	inp.resize(n);
	cost.resize(n);
	for(int i=0;i<n;i++) {
		cin >> inp[i] >> cost[i];
	}

	LL ans = INF;
	for(int i=0;i<n;i++) {
      	string suff = "";
		ans = min(ans, cost[i] + solve(inp[i], suff));
	}
	if(ans == INF) {
		cout << -1 << endl;
		return 0;
	}
	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'long long int solve(std::string&, std::string&)':
a.cc:54:29: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   54 |         if(isPalindrome(pre + suff)) {
      |                         ~~~~^~~~~~
a.cc:14:27: note:   initializing argument 1 of 'bool isPalindrome(std::string&)'
   14 | bool isPalindrome(string &s) {
      |                   ~~~~~~~~^
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<Queue>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 50 + 5;
const ll linf = 0x3f3f3f3f3f3f3f3f;

bool check(const string &s)
{
	for(int i=0; i<(int)s.size()-i-1; ++i)
		if(s[i] != s[(int)s.size()-i-1]) return 0;
	return 1;
}

string s[MAXN];
int c[MAXN];

typedef pair<ll, pair<bool,string> > State;

ll ans = linf;
map<pair<bool,string>, ll> dis;
priority_queue<State,vector<State>,greater<State> > q;

inline void push(const bool x, const string &s, ll d){ dis[make_pair(x,s)]=d; q.push(make_pair(d, make_pair(x,s)));}

inline void gao(const string &s,const string &t, ll d)
{
	if(d>=ans) return;
	for(int i=0; i<(int)s.size() && i<(int)t.size(); ++i)
		if(s[i] != t[(int)t.size()-i-1]) return;
	if((int)s.size() == (int)t.size()){ ans = min(ans, d); return;}
	
	string now = s.size() > t.size()? s.substr(t.size()): t.substr(0,t.size()-s.size());
	if(check(now)){ ans = min(ans, d); return;}
	
	bool x = !(s.size() > t.size());
	pair<bool, string> u = make_pair(x,now);
	
	map<pair<bool, string>,ll>::iterator it = dis.find(u);
	if(it!=dis.end() && it -> second <= d) return;
	
	dis[u] = d;
	q.push(make_pair(d,u));
}

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i)
		cin>>s[i]>>c[i];
	
	for(int i=1; i<=n; ++i)
	{
		if(check(s[i])) ans = min(ans, (ll)c[i]);
		else push(0, s[i], c[i]);
	}
	
	while(!q.empty())
	{
		State uu = q.top(); q.pop();
		if(dis[uu.second] != uu.first) continue;
		pair<bool,string> &u = uu.second;
		
		for(int i=1; i<=n; ++i)
		{
			if(u.first == 0)
				gao(u.second, s[i], uu.first + c[i]);
			else
				gao(s[i], u.second, uu.first + c[i]);
		}
	}
	
	if(ans == linf) printf("-1");
	else printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc:6:9: fatal error: Queue: No such file or directory
    6 | #include<Queue>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)\
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 61;
constexpr long double EPS = 1e-10;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	ll n;
	cin >> n;
	vector s(2, vector<string>(n));//元の文字列と反転した文字列
	Array cost(n);
	REP(i, n)cin >> s[0][i] >> cost[i];
	REP(i, n)s[1][i] = s[0][i], reverse(all(s[1][i]));

	//ダイクストラ
	using T = tuple<ll, string, bool>;//コスト、文字列、反転しているかどうか
	map<pair<string, ll>, ll> mp;
	priority_queue<T, vector<T>, greater<T>> que;
	auto push = [&](ll c, string v, ll f) {
		if (mp.count({ v,f }) == 0 || mp[{v, f}] > c)que.push({ c,v,f }), mp[{v, f}] = c;
	};
	ll ans = INF;
	auto pcheck = [&](string& s) {
		REP(i, s.size() / 2)if (s[i] != s[s.size() - 1 - i])return false;
		return true;
	};
	REP(i, n) if(pcheck(s[0][i]) == true)chmin(ans, cost[i]);
	REP(i, n) push(cost[i], s[0][i], 1);
	while (que.size()) {
		auto [c, v, flip] = que.top();
		que.pop();
		if (mp[{v, flip}] < c || ans <= c)continue;
		if (pcheck(v) == true) {
			chmin(ans, c);
			continue;
		}
		REP(i, n) {
			auto check = [&](string a, string b)->string {
				REP(i, min(a.size(), b.size()))if (a[i] != b[i])return "!";
				if (a.size() == b.size())return "";
				else if (a.size() > b.size())return a.substr(b.size());
				else return b.substr(a.size());
			};
			auto ret = check(v, s[flip][i]);
			if (ret == "!")continue;
			else if (ret.size() <= 1)chmin(ans, c + cost[i]);
			else if (v.size() > s[flip][i].size())push(c + cost[i], ret, flip);
			else push(c + cost[i], ret, flip ^ 1);
		}
	}
	if (ans == INF)cout << -1 << "\n";
	else cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc:6:16: error: '#' is not followed by a macro parameter
    6 | #define REP(i,n) rep(i,0,n)\
      |                ^
a.cc: In function 'int main()':
a.cc:28:13: error: 'i' was not declared in this scope
   28 |         REP(i, n)cin >> s[0][i] >> cost[i];
      |             ^
a.cc:28:9: error: 'REP' was not declared in this scope
   28 |         REP(i, n)cin >> s[0][i] >> cost[i];
      |         ^~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};

struct e{
    string s;
    ll cost;
};

bool ispa(string s){
    int n = s.size();
    for(int i=0;i<n;i++){
        if(s[i] != s[n-1-i]){
            return false;
        }
    }
    return 1;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n;
    cin>>n;
    string s[n],rev[n];
    ll a[n];
    map<string, ll> used[2];
    for(int i=0;i<n;i++){
        cin>>s[i]>>a[i];
        if(used[0].count(s[i]))chmin(used[0][s[i]], a[i]);
        else used[0][s[i]] = a[i]; 
        rev[i] = s[i];
        reverse(rev[i].begin(),rev[i].end());
        if(used[1].count(rev[i]))chmin(used[1][rev[i]], a[i]);
        else used[1][rev[i]] = a[i];
    }
    ll ans = 1e18;
    queue<e> q;
    for(int i=0;i<n;i++){
        q.push((e){s[i],a[i]});
    }
    map<string,vector<e>> mp[2];
    for(int i=0;i<n;i++){
        string now, rnow;
        for(int j=0;j<s[i].size();j++){
            now += s[i][j];
            rnow += rev[i][j];
            mp[0][now].push_back((e){s[i].substr(j+1), a[i]});
            mp[1][rnow].push_back((e){rev[i].substr(j+1), a[i]});
        }
    }
    map<string,ll> visited[2];
    while(q.size()){
        e p = q.front();
        q.pop();
        bool x = p.rev;
        string str = p.s;
        if(visited[x].count(str) && visited[x][str] <= p.cost)continue;
        visited[x][str] = p.cost;
        if(ispa(str)){
            chmin(ans, p.cost);
            continue;
        }
        // check mp[x^1][str] -> x^1
        int nx = x^1;
        if(mp[nx].count(str)){
            for(e i:mp[nx][str]){
                q.push((e){i.s, p.cost + i.cost, nx});
            }
        }
        string now = "";
        // check mp[c^1][str[0:i]] -> x
        for(int j=0;j<p.s.size()-1;j++){
            now += p.s[j];
            if(used[nx].count(now)){
                q.push((e){p.s.substr(j+1), p.cost + used[nx][now], x});
                
            }
        }
    }
    if(ans > 1e17)ans = -1;
    cout << ans << endl;
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:62:20: error: 'struct e' has no member named 'rev'
   62 |         bool x = p.rev;
      |                    ^~~
a.cc:74:52: error: too many initializers for 'e'
   74 |                 q.push((e){i.s, p.cost + i.cost, nx});
      |                                                    ^
a.cc:82:70: error: too many initializers for 'e'
   82 |                 q.push((e){p.s.substr(j+1), p.cost + used[nx][now], x});
      |                                                                      ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int n;
vector<string> v;
map<string,int> rev;
map<string,int> cost;
map<string,int> headm;
map<string,int> tailm;

string Rev(const string&s){
  string t;
  for(int i = (int)s.size()-1; i >= 0; --i)t += s[i];
  return t;
}

ll Rec(const string&hd,int d){
  if(d > 100)return 1001001001;
  if(hd.size() <= 1)return 0;
  ll tmp = 1001001001001001001;
  string t = "";
  for(int i = 0; i < (int)hd.size(); ++i){
    t += hd[i];
    if(rev.count(t) > 0){
      tmp = min(tmp,Rec(hd.substr(i+1),d+1)+cost[v[i]]);
    }
  }
  if(tailm.count(hd)){
    int idx = tailm[hd];
    tmp = min(tmp,Rec(Rev(v[idx].substr(hd.size())),d+1)+cost[v[idx]]);
  }
  return tmp;
}

int main(){
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    rev.emplace(Rev(v[i]),i);
    cin >> cost[v[i]];
    string tmp;
    for(int j = 0; j < (int)v[i].size(); ++j){
      tmp += v[i][j];
      headm[tmp] = i;
    }
    tmp = "";
    for(int j = (int)v[i].size()-1; j >= 0; --j){
      tmp += v[i][j];
      tailm[tmp] = i; 
    }
  }
  ll ans = 1001001001001001001;
  for(auto e:v){
    ans = min(ans,Rec(e)+cost[e],0);

  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:22: error: too few arguments to function 'll Rec(const std::string&, int)'
   89 |     ans = min(ans,Rec(e)+cost[e],0);
      |                   ~~~^~~
a.cc:51:4: note: declared here
   51 | ll Rec(const string&hd,int d){
      |    ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int n;
vector<string> v;
map<string,int> rev;
map<string,int> cost;
map<string,int> headm;
map<string,int> tailm;

string Rev(const string&s){
  string t;
  for(int i = (int)s.size()-1; i >= 0; --i)t += s[i];
  return t;
}

ll Rec(const string&hd,int d){
  if(d > 100)return 1001001001;
  if(hd.size() <= 1)return 0;
  ll tmp = 1001001001001001001;
  string t = "";
  for(int i = 0; i < (int)hd.size(); ++i){
    t += hd[i];
    if(rev.count(t) > 0){
      tmp = min(tmp,Rec(hd.substr(i+1))+cost[v[i]],d+1);
    }
  }
  if(tailm.count(hd)){
    int idx = tailm[hd];
    tmp = min(tmp,Rec(Rev(v[idx].substr(hd.size())))+cost[v[idx]],d+1);
  }
  return tmp;
}

int main(){
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    rev.emplace(Rev(v[i]),i);
    cin >> cost[v[i]];
    string tmp;
    for(int j = 0; j < (int)v[i].size(); ++j){
      tmp += v[i][j];
      headm[tmp] = i;
    }
    tmp = "";
    for(int j = (int)v[i].size()-1; j >= 0; --j){
      tmp += v[i][j];
      tailm[tmp] = i; 
    }
  }
  ll ans = 1001001001001001001;
  for(auto e:v){
    ans = min(ans,Rec(e)+cost[e],0);

  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'll Rec(const std::string&, int)':
a.cc:59:24: error: too few arguments to function 'll Rec(const std::string&, int)'
   59 |       tmp = min(tmp,Rec(hd.substr(i+1))+cost[v[i]],d+1);
      |                     ~~~^~~~~~~~~~~~~~~~
a.cc:51:4: note: declared here
   51 | ll Rec(const string&hd,int d){
      |    ^~~
a.cc:64:22: error: too few arguments to function 'll Rec(const std::string&, int)'
   64 |     tmp = min(tmp,Rec(Rev(v[idx].substr(hd.size())))+cost[v[idx]],d+1);
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:51:4: note: declared here
   51 | ll Rec(const string&hd,int d){
      |    ^~~
a.cc: In function 'int main()':
a.cc:89:22: error: too few arguments to function 'll Rec(const std::string&, int)'
   89 |     ans = min(ans,Rec(e)+cost[e],0);
      |                   ~~~^~~
a.cc:51:4: note: declared here
   51 | ll Rec(const string&hd,int d){
      |    ^~~
Language: C++

#include <iostream>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
#define N_MAX 100
#define input(d) cin >> d;
#define inputs(n,d) for(int i=0;i<n;i++) {cin >> d[i];}
#define inputxy(n,x,y) for(int i=0;i<n;i++) {cin >> x[i] >> y[i];}
#define output(d) cout << d << endl;
#define outputs(n,d) for(int i=0;i<n;i++) {cout << d[i] << endl;}
#define outputxy(n,x,y) for(int i=0;i<n;i++) {cout << x[i] << y[i] << endl;}
#define f0(i,n) for(int i=0;i<n;i++)
#define f(i,a,b) for(int i=a;i<b;i++)
#define l long
#define ll long long
#define s string

int main(){
    ll x,k,d[50],f=0,ff=0,ans=0;
    string a[50];
    input(x);
    for(int i=0;i<x;i++){
        cin >> a[i] >> d[i];
    }

    for(int i=0;i<x;i++){
        for(int j=0;j<x;j++){
            ll t = ans
            if(ans>d[i]+d[j]{
                ans=d[i]+d[j];
                string rb = reverse(a[j]);
                string r = a[i] + rb;
                int i=0,j=a.length()-1;
                while(i<j){
                    if(a[i]!=a[j]){
                       ans-=t;
                  }
                }
            }
            
        }
    }
    output(ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: expected ',' or ';' before 'if'
   30 |             if(ans>d[i]+d[j]{
      |             ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
class str
{
	public:
		int cost;
		string st;	
};
vector<str> s;
bool isp(string x)
{
	string x1=x;
	reverse(x.begin(),x.end());
	if(x1==x) return 1;
	return 0;
}
int p(int a,int b)
{
	string as=s[a].st,bs=s[b].st;
	bool ca[26]={0},cb[26]={0};
	int s1=0,s2=0;
	for(int i=0;i<a.size();i++) ca[as[i]-'a']=1;
	for(int i=0;i<b.size();i++) cb[bs[i]-'a']=1;
	for(int i=0;i<26;i++) if(ca[i]==1) s1++;
	for(int i=0;i<26;i++) if(cb[i]==1) s2++;
	if(s1<s2) return INT_MAX-2;
	string as_=as;
	reverse(as_.begin(),as_.end());
	bool f=0;
	for(int i=0;i<as.size();i++)
	{
		for(int len=1;len+i<=as.size();len++)
		{
			string sub=as_.substr(i,len);
			if(sub==bs) f=1;
		}
	}
	if(!f) return INT_MAX-2;
	for(int i=0;;i++)
	{
		string toisp;
		toisp=as;
		for(int j=0;j<i;j++) toisp+=bs;
		if(isp(toisp)==1) return s[a].cost+s[b].cost*i;
		toisp="";
		for(int j=0;j<i;j++) toisp+=bs;
		toisp+=as;
		if(isp(toisp)==1) return s[a].cost+s[b].cost*i;
	}
}
int solve()
{
	int min=INT_MAX-10;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int x=min(p(i,j),p(j,i));
			if(x<min)
			{
				min=x;
			}
		}
	}
	if(min==INT_MAX) return -1;
	return min;
}
int main()
{
	cin>>n;
	s.resize(n+1);
	for(int i=0;i<n;i++) cin>>s[i].st>>s[i].cost;
	s[n].st="",s[n].cost=0;
	cout<<solve();
	return 0;
}

Compiler output:
a.cc: In function 'int p(int, int)':
a.cc:23:25: error: request for member 'size' in 'a', which is of non-class type 'int'
   23 |         for(int i=0;i<a.size();i++) ca[as[i]-'a']=1;
      |                         ^~~~
a.cc:24:25: error: request for member 'size' in 'b', which is of non-class type 'int'
   24 |         for(int i=0;i<b.size();i++) cb[bs[i]-'a']=1;
      |                         ^~~~
a.cc: In function 'int solve()':
a.cc:59:34: error: 'min' cannot be used as a function
   59 |                         int x=min(p(i,j),p(j,i));
      |                               ~~~^~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
struct Trie{
    int next[26];
    int cnt;
    int type;
}T[1001005];
int dp[100005][26],val[1000005];
int le;
void Insert(string s){
    int p=0,len=s.size();
    for (int i=len-1;i>=0;i--){
        int r=s[i]-'a';
        if(T[p].next[r]<=0){
            T[le].type=r;
            T[p].next[r]=le++;
        }
        p=T[p].next[r];
        T[p].cnt++;  
    }
	val[p]++;
}
void dfs(int x){
	for(int i=0,v;i<26;i++){
		v=T[x].next[i];
		if(v<=0) continue;
		dfs(v);
		val[x]+=val[v];
		for(int j=0;j<26;j++){
			dp[x][j]+=dp[v][j];
		}
	}
	dp[x][T[x].type]=val[x];
}
long long ans,xx;
void query(string s){
    int p=0,len=s.size();
    xx=0;
    for (int i=len-1;i>=1;i--) {
        int r=s[i]-'a';
        if(T[p].next[r]<=0) {
            return 0;
        }
        p=T[p].next[r];
    }
   	for(int i=0,v;i<26;i++){
   		v=T[p].next[i];
   		if(v<=0) continue;
   		xx+=dp[v][s[0]-'a'];
	}
	ans+=xx;
}
string s[1000005];
int n;
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    le=1;
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>s[i];
    	Insert(s[i]);
	}
	dfs(0);
    for(int i=1;i<=n;i++){
    	query(s[i]);
	}
	cout<<ans-n;
	return 0;
}

Compiler output:
a.cc: In function 'void query(std::string)':
a.cc:43:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
   43 |             return 0;
      |                    ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>P;
map<P,int>mp;
int main(){
    int n;
    cin>>n;
    while(n--){
        int cnt2=0,cnt5=0;
        ld x;
        cin>>x;
        ll t=ll(x*(ld)*1000000000.000000000);
        while(t%2==0)t/=2,cnt2++;
        while(t%5==0)t/=5,cnt5++;
        mp[make_pair(cnt2,cnt5)]++;
    }
    ll ans=1;
    for(auto&v:mp){
        for(auto&u:mp){
            if(v.first.first+u.first.first>=18&&v.first.second+u.first.second>=18){
                if(v==u){
                    ans+=1ll*v.second*(v.second-1);
                }
                else ans+=1ll*v.second*u.second;
            }
        }
    }
    cout<<ans/2<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: invalid type argument of unary '*' (have 'double')
   15 |         ll t=ll(x*(ld)*1000000000.000000000);
      |                       ^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

vector<ll> num;
ll ans = 0;
map<pair<ll,ll>,ll> p;

void fun(ll n){
    if(n == 0){
        if(num[0]+num[2] >= 18 && num[1]+num[3] >= 18){
            ans += p[make_pair(num[0],num[1])]*p[make_pair(num[2],num[3])];
        }
        //cout << ans << endl;
        return;
    }
    for(ll i = 0; i < 20; i++){
        num.push_back(i);
        fun(n-1);
        num.pop_back();
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    ll n;
    cin >> n;
    vector<double> a(n);
    vector<ll> b(n);
    ll m = 0;
    for(ll i = 0; i < n; i++) cin >> a[i];
    for(ll i = 0; i < n; i++){
        if(floor(a[i]) == a[i]) m++;
        b[i] = a[i]*1e9;
    }

    auto pf = [&](ll n,ll k){
        ll ret = 0;
        while(n%k == 0) ret++, n /= k;
        return min(ret,18);
    };

    

    for(ll i = 0; i < n; i++){
        p[make_pair(pf(b[i],2),pf(b[i],5))]++;
    }


    fun(4);

    cout << (ans-m)/2 << endl;

    






    return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:44:19: error: no matching function for call to 'min(ll&, int)'
   44 |         return min(ret,18);
      |                ~~~^~~~~~~~
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:44:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   44 |         return min(ret,18);
      |                ~~~^~~~~~~~
/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:44:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   44 |         return min(ret,18);
      |                ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  	printf("%d\n",inv_mod(2,29));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:23: error: 'inv_mod' was not declared in this scope
    5 |         printf("%d\n",inv_mod(2,29));
      |                       ^~~~~~~
Language: C++

#include <bits/stdc++.h>

int main()
	using namespace std;
	int n;
	cin >> n;
	vector <double> v(n);
	for (auto &x : v){
      	cin >> x;
    }
	int ans = 0;
	for (int i = 0; i < n - 1; i++){
      	for (int j = i + 1; j < n; j++){
        	if (!(v[i]*v[i] - (int)(v[i]*v[j]))){
            	++ans;	
            }
        }
    }
	cout << ans;
	return 0;
}


Compiler output:
a.cc:4:9: error: expected initializer before 'using'
    4 |         using namespace std;
      |         ^~~~~
a.cc:6:9: error: 'cin' does not name a type
    6 |         cin >> n;
      |         ^~~
a.cc:7:9: error: 'vector' does not name a type
    7 |         vector <double> v(n);
      |         ^~~~~~
a.cc:8:9: error: expected unqualified-id before 'for'
    8 |         for (auto &x : v){
      |         ^~~
a.cc:12:9: error: expected unqualified-id before 'for'
   12 |         for (int i = 0; i < n - 1; i++){
      |         ^~~
a.cc:12:25: error: 'i' does not name a type
   12 |         for (int i = 0; i < n - 1; i++){
      |                         ^
a.cc:12:36: error: 'i' does not name a type
   12 |         for (int i = 0; i < n - 1; i++){
      |                                    ^
a.cc:19:9: error: 'cout' does not name a type
   19 |         cout << ans;
      |         ^~~~
a.cc:20:9: error: expected unqualified-id before 'return'
   20 |         return 0;
      |         ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

#include <bits/stdc+..h>

int main(){
	using namespace std;
	int n;
	cin >> n;
	vector <double> v(n);
	for (auto &x : v){
      	cin >> x;
    }
	int ans = 0;
	for (int i = 0; i < n - 1; i++){
      	for (int j = i + 1; j < n; j++){
        	if (!(v[i]*v[i] - (int)(v[i]*v[j]))){
            	++ans;	
            }
        }
    }
	cout << ans;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: bits/stdc+..h: No such file or directory
    1 | #include <bits/stdc+..h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc+..h>

int main()
	using namespace std;
	int n;
	cin >> n;
	vector <double> v(n);
	for (auto &x : v){
      	cin >> x;
    }
	int ans = 0;
	for (int i = 0; i < n - 1; i++){
      	for (int j = i + 1; j < n; j++){
        	if (!(v[i]*v[i] - (int)(v[i]*v[j]))){
            	++ans;	
            }
        }
    }
	cout << ans;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc+..h: No such file or directory
    1 | #include <bits/stdc+..h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;
    vector<double> A(N);
    rep(i,N)cin>>A.at(i);

    vec_int Abig(N);
    rep(i,N)Abig.at(i) = (int)(A.at(i)*pow(10,9));


    vector<vector<int>> aa(19,vector<int>(19,0));

    rep(i,N){
        int index2 = 0;
        int Anum = Abig.at(i);
        while(true){
            if(Anum%2==0){
                Anum = Anum/2;
                index2++;
                continue;
            }else{
                break;
            }
        }
        int index5 = 0;
        int Anum2 = Abig.at(i);
        while(true){
            if(Anum2%5==0){
                Anum2 = Anum2/5;
                index5++;
                continue;
            }else{
                break;
            }
        }
        if(index2>18)index2=18
        if(index5>18)index5=18
        aa.at(index2).at(index5) +=1;
    }
    int tot_num = 0;
    for(int num2=0;num2<19;num2++){
    for(int num5=0;num5<19;num5++){
        int temp = aa.at(num2).at(num5);

        int ind = 0;
        for(int i =18-num2;i<19;i++){
        for(int j =18-num5;j<19;j++){
            if(num2==9&&num5==9&&i==9&&j==9)continue;
            ind += aa.at(i).at(j);
        }
        }
        tot_num += ind*temp;

    }
    }
    cout<<tot_num/2<<endl;




    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:31: error: expected ';' before 'if'
   49 |         if(index2>18)index2=18
      |                               ^
      |                               ;
   50 |         if(index5>18)index5=18
      |         ~~
Language: C++

//整数論の問題は整数に直して考える

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define itn int
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

ll rui(ll a,ll n){
  ll ans=1;
  while(n>0){
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

ll rui2(ll x){
  ll ans=0;
  while(x%2==0){
    x/=2;
    ans++;
  }
  return ans;
}

ll rui5(ll x){
  ll ans=0;
  while(x%5==0){
    x/=5;
    ans++;
  }
  return ans;
}

int main(){
  itn n; cin >> n;
  double r;
  vector<ll> a(n);
  rep(i,n){
    cin >> r;
    a[i]=llround(x*1e9);
  }
  ll ints=0;
  set<pii> st25;
  map<pll,ll> mp;
  rep(i,n){
    ll cnt5=rui5(a[i]);
    ll cnt2=rui2(a[i]);
    if(cnt2>=9&&cnt5>=9) ints++;
    st25.insert(pii(cnt2,cnt5));
    mp[pll(cnt2,cnt5)]++;
  }
  ll ans=0;
  for(auto a:st25){
    for(auto b:st25){
      if(a.first+b.first>=18&&a.second+b.second>=18) ans+=mp[a]*mp[b];
    }
  }
  ans=(ans-ints)/2;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:18: error: 'x' was not declared in this scope
   58 |     a[i]=llround(x*1e9);
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(x,i,e) for(int x=i; x<e; x++)
#define int long long int
signed main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	double a[n];
	int b[n];
	int c5[n],c2[n];
	FOR(i,0,n)
	{
		c5[i]=0;
		c2[i]=0;
	}
	FOR(i,0,n)
	{
		cin>>a[i];
		f=true;
		b[i]=llround(a[i]*1000000000);
		while((b[i]%2==0))
		{
			c2[i]++;
			b[i]=b[i]/2;
		}
		while(b[i]%5==0)
		{
			c5[i]++;
			b[i]=b[i]/5;
		}
	}
	int ans=0;
	FOR(i,0,n)
	{
		FOR(j,i+1,n)
		{
			if(((c2[i]+c2[j])>=18) and ((c5[i]+c5[j])>=18)) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'f' was not declared in this scope
   24 |                 f=true;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(x,i,e) for(int x=i; x<e; x++)
#define int long long int
signed main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	double a[n];
	int b[n];
	int c5[n],c2[n];
	FOR(i,0,n)
	{
		c5[i]=0;
		c2[i]=0;
	}
	FOR(i,0,n)
	{
		cin>>a[i];
		f=true;
		b[i]=llround(a[i]*1000000000);
		while((b[i]%2==0))
		{
			c2[i]++;
		}
		while(b[i]%5==0)
		{
			c5[i]++;
		}
	}
	int ans=0;
	FOR(i,0,n)
	{
		FOR(j,i+1,n)
		{
			if(((c2[i]+c2[j])>=18) and ((c5[i]+c5[j])>=18)) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'f' was not declared in this scope
   24 |                 f=true;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mk make_pair
#define lld  double
int main(){
    ll n;
    cin>>n;
    vector<lld> arr(n);
    for(ll i=0;i<n;i++){
        cin>>arr[i];
    }
    
    ll ans=0;
    for(ll i=0;i<n-1;i++){
        for(ll j=i+1;j<n;j++){
            if(lld(arr[i]*arr[j])==ll(arr[i]*arr[j]))
              ans++;
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long int
      |            ^~~~
a.cc:18:36: note: in expansion of macro 'll'
   18 |             if(lld(arr[i]*arr[j])==ll(arr[i]*arr[j]))
      |                                    ^~
a.cc:18:36: error: expected ')' before 'long'
   18 |             if(lld(arr[i]*arr[j])==ll(arr[i]*arr[j]))
      |               ~                    ^
      |                                    )
Language: C++

#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int myMin(vector<int> vect) {
    try {
        sort(vect.begin(), vect.end());
        return *vect.begin();
    }
    catch (int e) {
        exit(e);
    }
}


int myMax(vector<int> vect) {
    try {
        sort(vect.begin(), vect.end());
        return *vect.end();
    }
    catch (int e) {
        exit(e);
    }
}

int main() {
    int n;
    cin >> n;
    int ans = 0;
    long double arr[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            int val = (int) (arr[i] * arr[j]);
            if (arr[i] * arr[j] == val) {
                ans++;
            }
        }
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int myMin(std::vector<int>)':
a.cc:8:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |         sort(vect.begin(), vect.end());
      |         ^~~~
      |         short
a.cc: In function 'int myMax(std::vector<int>)':
a.cc:19:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |         sort(vect.begin(), vect.end());
      |         ^~~~
      |         short