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

#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

string S;
string T;
ll var = 0;

void solve(){
    if(cnt >= 100000000  && var <= ){
        cout << -1 << endl;
        exit(0);
    }
    REP(i,S.size()){
        if(S[i] == T[var]) var++;
        cnt++;
        if(var == T.size()) return;
    }
    solve();
}

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    cin >> S >> T;
    //不可能パターン
    solve();
    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:19:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
   19 |     if(cnt >= 100000000  && var <= ){
      |        ^~~
      |        int
a.cc:19:36: error: expected primary-expression before ')' token
   19 |     if(cnt >= 100000000  && var <= ){
      |                                    ^
a.cc:25:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   25 |         cnt++;
      |         ^~~
      |         int
a.cc: In function 'int main()':
a.cc:37:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

#include <iostream>
using namespace std;
const unsigned int limit{1E100};
int main() {
	string s1, s2;
	cin >> s1 >> s2;
	size_t i{0}, j{0}, k{0};
	while (i < s2.length() && j < limit) {
		if (s1[k++] == s2[i]) i++;
		if (k == s1.length()) k = 0;
		j++;
	}
	if (j < limit) cout << j << endl;
	else cout << -1 << endl;
}


Compiler output:
a.cc:3:26: error: narrowing conversion of '1.0e+100' from 'double' to 'unsigned int' [-Wnarrowing]
    3 | const unsigned int limit{1E100};
      |                          ^~~~~
Language: C++

#include <bits/stdc++.h>

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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(){
	ll MAX = 1e7;
	vector<vector<ll> > C(26);
	string s; getline(cin,s);
	string t; getline(cin,t);
	int l =  s.length();
	int T = t.length();
	REP(i,26){
	    C[i].PB(-1);
	}

	REP(i,l){
		char c = s[i];
		C[c - 'a'].PB(i);
	}

	REP(i,26){
		C[i].PB(MAX);
	}

	ll npos = -1;
	ll round = 0;

	REP(i,T){
		char c = t[i];
		int cnum = c - 'a';
		if (V.size() == 2){
			cout << -1 << endl;
			return 0;
		}

		auto It = upper_bound(C[cnum].begin(),C[cnum].end(),npos);
		if (*It < MAX){
			npos = *It;

		}else{
			npos = C[cnum][1];
			round++;
		}
	}

	cout << round * l + npos + 1 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:21: error: 'V' was not declared in this scope
   82 |                 if (V.size() == 2){
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

/*int64_t hazime(string s,string t,int a){
int s.find_first_of(t.at(a));
}

int64_t tuzuki(){}*/

int main(){
string s,t;
  cin >>s>>t;
  string ss = s+s;
  int tlong = t.size();
  int64_t ans =0;
  int64_t x =0;
  int64_t y =0;
  for(int i =0;i<tlong;i++){
    x = s.find_first_of(t.at(a),x);
    if(x>=0) ans +=x;
    else{
    ans = -1;
      break;
    }
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'a' was not declared in this scope
   20 |     x = s.find_first_of(t.at(a),x);
      |                              ^
Language: C++


        i = des[i][t[j]-'a'];
        if(i == -1)
        {
            if(des[0][t[j]-'a'] == -1)
            {
                cout << -1 << endl;
                return 0;
            }
            vueltas++;
            i = des[0][t[j]-'a'];
        }
        restar = false;
    }

    long long res = vueltas*((long long)s.size()-1) + i - restar;
    cout << res << endl;

    return 0;
}


Compiler output:
a.cc:2:9: error: 'i' does not name a type
    2 |         i = des[i][t[j]-'a'];
      |         ^
a.cc:3:9: error: expected unqualified-id before 'if'
    3 |         if(i == -1)
      |         ^~
a.cc:13:9: error: 'restar' does not name a type; did you mean 'register'?
   13 |         restar = false;
      |         ^~~~~~
      |         register
a.cc:14:5: error: expected declaration before '}' token
   14 |     }
      |     ^
a.cc:16:21: error: 'vueltas' was not declared in this scope
   16 |     long long res = vueltas*((long long)s.size()-1) + i - restar;
      |                     ^~~~~~~
a.cc:16:41: error: 's' was not declared in this scope
   16 |     long long res = vueltas*((long long)s.size()-1) + i - restar;
      |                                         ^
a.cc:16:55: error: 'i' was not declared in this scope
   16 |     long long res = vueltas*((long long)s.size()-1) + i - restar;
      |                                                       ^
a.cc:16:59: error: 'restar' was not declared in this scope
   16 |     long long res = vueltas*((long long)s.size()-1) + i - restar;
      |                                                           ^~~~~~
a.cc:17:5: error: 'cout' does not name a type
   17 |     cout << res << endl;
      |     ^~~~
a.cc:19:5: error: expected unqualified-id before 'return'
   19 |     return 0;
      |     ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

/*-------enazuma11----------------*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(),v.end()
#define inc(a,n) sort(a,a+n)
#define dec(a,n) sort(a,a+n,greater<int>() )
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define F first
#define S second
#define M 1000000007
#define sz(x) (int)x.size()
 
/* int x[]={-1,-1,0,1,1,1,0,-1};
int y[]={0,1,1,1,0,-1,-1,-1};
*/
/* int x[]={-1,0,1,0};
int y[]={0,1,0,-1};
*/
const int N=2e5+5;
ll n,q;
vector<ll> g[N];
int visited[N];

ll v[N];
void solve()
{
	string s,t;
	cin>>s>>t;
	int l1=s.size();
	int l2=t.size();
	vector<ll> v[26];
	ll in[26];
	memset(in,0,sizeof(in));
	ll i,j;
	rep(i,0,l1){
		v[s[i]-'a'].pb(i);	
	}
	ll f=0;
	rep(i,0,l2){
		if(v[t[i]-'a'].size()==0){
			//cout<<t[i]-'a'<<" ";
			cout<<-1;
			return ;
		}	
	}
	ll ans=0,pre=-1;
	ll c=0;
	rep(i,0,l2){
		ll cur=t[i]-'a';
		ll tmp=upper_bound(v[cur].begin(),v[cur].end(),pre)-v[cur].begin();
		if(tmp==v[cur].size()){
			tmp=v[cur][0];
			ans+=l1
		}
		else
		pre=v[cur][tmp];
	}
	ans+=pre+1;
	cout<<ans<<" ";
}

 
int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:58:32: error: expected ';' before '}' token
   58 |                         ans+=l1
      |                                ^
      |                                ;
   59 |                 }
      |                 ~
Language: C++

string s, t;
  cin >> s >> t;
  int n = sz(s), m = sz(t);
  vector<vector<int>> is(26);
  rep(i,n) {
    is[s[i]-'a'].push_back(i);
    is[s[i]-'a'].push_back(i+n);
  }
  ll ans = 0;
  int p = 0; // after p
  rep(i,m) {
    int c = t[i]-'a';
    if (sz(is[c]) == 0) {
      puts("-1");
      return 0;
    }
    p = *lower_bound(is[c].begin(), is[c].end(), p)+1;
    if (p >= n) {
      p -= n;
      ans += n;
    }
  }
  ans += p;
  cout << ans << endl;
  return 0;

Compiler output:
a.cc:1:1: error: 'string' does not name a type
    1 | string s, t;
      | ^~~~~~
a.cc:2:3: error: 'cin' does not name a type
    2 |   cin >> s >> t;
      |   ^~~
a.cc:3:14: error: 's' was not declared in this scope
    3 |   int n = sz(s), m = sz(t);
      |              ^
a.cc:3:11: error: 'sz' was not declared in this scope
    3 |   int n = sz(s), m = sz(t);
      |           ^~
a.cc:4:3: error: 'vector' does not name a type
    4 |   vector<vector<int>> is(26);
      |   ^~~~~~
a.cc:5:6: error: expected constructor, destructor, or type conversion before '(' token
    5 |   rep(i,n) {
      |      ^
a.cc:9:3: error: 'll' does not name a type
    9 |   ll ans = 0;
      |   ^~
a.cc:11:6: error: expected constructor, destructor, or type conversion before '(' token
   11 |   rep(i,m) {
      |      ^
a.cc:23:3: error: 'ans' does not name a type
   23 |   ans += p;
      |   ^~~
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout << ans << endl;
      |   ^~~~
a.cc:25:3: error: expected unqualified-id before 'return'
   25 |   return 0;
      |   ^~~~~~
Language: C++

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

vector<long> a[26];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    int n = (int)s.size(), m = (int)t.size();
    REP(i,n) a[s[i]-'a'].push_back(i);
    REP(i,n) a[s[i]-'a'].push_back(i + n);
    REP(i,m) {
        if(a[t[i]-'a'].empty()){
            cout << -1 << endl;
            return 0;
        }
    }


    long ans = 0, pos = 0;
    for(int i = 0; i < m; ++i) {
        int idx = t[i]-'a';
        pos = *lower_bound(a[idx].begin(), a[idx].end(), pos) + 1;
        if(pos >= n) {
            ans += n;
            pos -= n;
        }
    }

    cout << ans + pos << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'i' was not declared in this scope
   12 |     REP(i,n) a[s[i]-'a'].push_back(i);
      |         ^
a.cc:12:5: error: 'REP' was not declared in this scope
   12 |     REP(i,n) a[s[i]-'a'].push_back(i);
      |     ^~~
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <stdio.h>
using namespace std;
int main()
{
    std::string s,t;
    cin >> s >> t;
    //cout << s << endl;
    //cout << t << endl;
    long long int sum = 0; 
    int apos[s.size()][26];
    
    for(int i=0; i<s.size(); i++){
        for(int j=0; j<26; j++){
            apos[i][j] = -1;
        }
    }
    for(int i=0; i<t.size(); i++){
        int pos = tmps.find(t[i]);
        for(int j=0; j<s.size(); j++){
            std:string tmps = s.substr(j);
            if(tmps.size() <= s.size()){
                tmps = tmps + s;
            }
            //cout << "-----" << endl;
            //cout << "check: " << tmps << endl;
            if(pos != std::string::npos){
                apos[j][t[i]-97] = pos;
                //cout << t[i] << " はs[" << j << "]から" << pos << "にある" << endl;
            }
        }
    }

    int nowindex = 0;
    for(int i=0; i<t.size(); i++){
        /*
        cout << "-----" << endl;
            std::string tmps = s.substr(nowindex);
            if(tmps.size() <= s.size()){
                tmps = tmps + s;
            }
        cout << "check: " << tmps << endl;
        */
        int tmppos = apos[nowindex][t[i]-97];
        if(tmppos == -1){
            cout << "-1" << endl;
            return 0;
        }
        sum += (tmppos+1);
        nowindex = sum % s.size();
        //cout << "sum:" << sum << ", next:" << nowindex << endl;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: 'tmps' was not declared in this scope; did you mean 'tm'?
   21 |         int pos = tmps.find(t[i]);
      |                   ^~~~
      |                   tm
Language: C

#include <stdio.h>
#include <string.h>
int main() {
  char s[100001], t[100001];
  scanf("%s", s);
  scanf("%s", t);
  int n, m;
  n = strlen(s); m = strlen(t);
  ll h = (ll)n * (ll)m;
  h *= h;
  for (ll i = 0; i < h; i++) {
    int a= a + 2;
  }
  
  return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:9:3: error: unknown type name 'll'
    9 |   ll h = (ll)n * (ll)m;
      |   ^~
main.c:9:11: error: 'll' undeclared (first use in this function)
    9 |   ll h = (ll)n * (ll)m;
      |           ^~
main.c:9:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:14: error: expected ',' or ';' before 'n'
    9 |   ll h = (ll)n * (ll)m;
      |              ^
main.c:11:10: error: expected ';' before 'i'
   11 |   for (ll i = 0; i < h; i++) {
      |          ^~
      |          ;
main.c:11:18: error: 'i' undeclared (first use in this function)
   11 |   for (ll i = 0; i < h; i++) {
      |                  ^
Language: C

#include <stdio.h>
#include <string.h>
int main() {
  char s[100001], t[100001];
  scanf("%s", s);
  scanf("%s", t);
  int n, m;
  n = strlen(s); m = strlen(m);
  ll h = (ll)n * (ll)m;
  h *= h;
  for (ll i = 0; i < h; i++) {
    int a= a + 2;
  }
  
  return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:8:29: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
    8 |   n = strlen(s); m = strlen(m);
      |                             ^
      |                             |
      |                             int
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'int'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:9:3: error: unknown type name 'll'
    9 |   ll h = (ll)n * (ll)m;
      |   ^~
main.c:9:11: error: 'll' undeclared (first use in this function)
    9 |   ll h = (ll)n * (ll)m;
      |           ^~
main.c:9:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:14: error: expected ',' or ';' before 'n'
    9 |   ll h = (ll)n * (ll)m;
      |              ^
main.c:11:10: error: expected ';' before 'i'
   11 |   for (ll i = 0; i < h; i++) {
      |          ^~
      |          ;
main.c:11:18: error: 'i' undeclared (first use in this function)
   11 |   for (ll i = 0; i < h; i++) {
      |                  ^
Language: C

#include <stdio.h>
#include <string.h>
int main() {
  char s[100001], t[100001];
  int n, m;
  n = strlen(s); m = strlen(t);
  ll h = (ll)n * (ll)m;
  h *= h;
  for (ll i = 0; i < h; i++) {
    int a = 0;
    a = a + 2;
  }
  
  return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:7:3: error: unknown type name 'll'
    7 |   ll h = (ll)n * (ll)m;
      |   ^~
main.c:7:11: error: 'll' undeclared (first use in this function)
    7 |   ll h = (ll)n * (ll)m;
      |           ^~
main.c:7:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:14: error: expected ',' or ';' before 'n'
    7 |   ll h = (ll)n * (ll)m;
      |              ^
main.c:9:10: error: expected ';' before 'i'
    9 |   for (ll i = 0; i < h; i++) {
      |          ^~
      |          ;
main.c:9:18: error: 'i' undeclared (first use in this function)
    9 |   for (ll i = 0; i < h; i++) {
      |                  ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
ll alphabet[26];

int main(){
  string S,T; 
  cin >> S >> T;
  ll N = (ll) S.size(); ll M = (ll) T.size();
  for(ll i = 0; i < 26; i++){ alphabet[26] = 0;}
  for(ll i = 0; i < N; i++){ alphabet[S[i] - 'a']++;}
  
  for(ll j = 0; j < M; j++){
    if( alphabet[T[j] - 'a'] == 0){ cout << -1 << endl; return 0;}
  }
  //-1判定 以下は必ず可能
  
  vector<vector<ll>> alphabetical(26); 
  
  for(ll i = 0; i < N; i++){
    //S中で、どのアルファベットがどの位置で現れるのかを知りたい
    alphabetical[S[i] - 'a'].push_back(i);}
  // 0-indexedで格納することに注意
   
  ll ans = 0; 
  for(ll j = 0; j < M; j++){
    // T[j]をSから作る
    char c = T[j];
    
 ll itr = uppper_bound( alphabetical[c-'a'].begin(),alphabetical[c-'a'].end(),ans % N) - alphabetical[c-'a'].begin();
 
 if( itr != (ll)alphabetical[c-'a'].size()){
   ans += alphabetical[c-'a'][itr] - ( ans % N);}
 else{
   // Sをもう一つ繋げて考える必要がある
   ans += N - 1 - (ans%N) + alphabetical[c-'a'].front() + 1; }
    
  }
 
  cout << ans + 1  << endl;
                 
  
 return 0;}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: 'uppper_bound' was not declared in this scope
   31 |  ll itr = uppper_bound( alphabetical[c-'a'].begin(),alphabetical[c-'a'].end(),ans % N) - alphabetical[c-'a'].begin();
      |           ^~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

string s, t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s >> t;

  unordered_map<char, vector<int>> mp;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]].push_back(i);
  }
  bool ok = true;
  for (int i = 0; i < t.size(); i++) {
    if (mp.find(t[i]) == mp.end()) {
      ok = false;
      break;
    }
  }
  if (!ok) {
    cout << -1 << endl;
    return 0;
  }

  long l = 1;
  long ans = 0;
  long cur = -1;
  for (int i = 0; i < t.size(); i++) {
    vector<int> v = &mp[t[i]];
    auto ub = upper_bound(v.begin(), v.end(), cur);
    long idx = 0;
    if (ub == v.end()) {
      ans = l * s.size();
      l++;
      cur = -1;
      idx = v[0];
      ans = ans + idx + 1;
    } else {
      idx = *ub;
      ans = ans - (cur + 1) + idx + 1;
    }
    cur = idx;
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: conversion from 'std::unordered_map<char, std::vector<int> >::mapped_type*' {aka 'std::vector<int>*'} to non-scalar type 'std::vector<int>' requested
   46 |     vector<int> v = &mp[t[i]];
Language: C++

#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  std::string s,t;
  std::cin>>s>>t;
  bool flag=true;

  ll n=s.size(),m=t.size();

  std::vector<std::vector<ll>> itr(26);

  rep(i,0,26){
      rep(j,0,n)if((s[j]-'a')==i)itr[num].push_back(j);
  }
  
  rep(i,0,m)if(itr[t[i]-'a'].empty())flag=false;

  if(!flag){
    std::cout<<-1;
    return 0;
  }

  ll ans=itr[(ll)(t[0]-'a')][0]+1;


  ll now=ans-1;
  rep(i,1,m){
    ll next=t[i]-'a';
    auto len=std::upper_bound(all(itr[next]),now);
    if(len!=itr[next].end()){
    ans+=(*len-now);
    now=*len;
    }else{
      ans+=(n-now+itr[next][0]);
      now=itr[next][0];
    }

    //debug(now);
    //debug(ans);
  }

  std::cout<<ans;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:38: error: 'num' was not declared in this scope; did you mean 'enum'?
   43 |       rep(j,0,n)if((s[j]-'a')==i)itr[num].push_back(j);
      |                                      ^~~
      |                                      enum
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s,t;
ll f[100010][26];
int main(){
    memset(f,-1,sizeof(f));
    cin>>s>>t;
    for(int i=0;i<26;i++){
        int j;
        for(j=0;j<s.size();j++){
            if(s[j]-'a'==i)break;
        }
        if(j!=s.size()){
            f[j][i]=j;
            int k=0;
            for(k=s.size()-1;k>=0;k--){
                int a=(k+j+1+s.size())%s.size(),b=(k+j)%s.size();
                if(s[a]-'a'==i)f[b][i]=a;
                else f[b][i]=f[a][i];
            }
        }
    }
    for(int i=0;i<2;i++){
        for(int j=0;j<s.size();j++){
            cout<<f[j][i]<<" ";
        }
        cout<<endl;
    }
    ll idx=0,ans=0;
    bool flag=1;
    for(int i=0;i<s.size();i++){
        if(s[i]==t[0]){
        idx=ans=i;
        ans++;
        flag=0;
        break;
        }
    }
    if(flag){
        cout<<-1<<endl;
        return 0;
    }
    //cout<<idx<<" "<<ans<<endl;
    for(int i=1;i<t.size();i++){
        if(f[idx][t[i]-'a']==-1){
            ans=-2;
            break;
        }
        int add=((f[idx][t[i]-'a']+s.size())-idx)%s.size();
        ans+=add;
        idx=f[idx][t[i]-'a'];
        c//out<<idx<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:9: error: 'c' was not declared in this scope
   53 |         c//out<<idx<<" "<<ans<<endl;
      |         ^
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	string n,m;
 	cin >> n>>m;
 	ll start=0;
 	ll ans=0;
 	ll pos;
 	x=n.size();
 	y=m.size();
 	for (ll i = 0; i < y; i++){
 		pos=0;
 		for (ll j = 0; j < x; j++){
 			if(m[i]==n[(j+start)%x]){
 				ans+=j+1;
 				pos=j+start+1;
 				break;
 			}
 			if(j==x-1){
 				cout << -1 << endl;
 				return 0;
 			}
 		}
 		start=pos%x;
 	}
 	cout << ans << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'x' was not declared in this scope
   14 |         x=n.size();
      |         ^
a.cc:15:9: error: 'y' was not declared in this scope
   15 |         y=m.size();
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
    int n, res = 0, last = 0;
    string s, t;
    in(s, t);
    map<char, bool> flag;
    map<char, vector<int>> syutu;
    for(int i = 0; i < s.size(); i++){
        char c = s[i];
        syutu[c].pb(i);
        flag[c] = true;
    }

    for(auto& c:t){
        if(!flag[c]){
            print(-1);
            return 0;
        }
    }

    res += syutu[t[0]][0] + 1;
    last = syutu[t[0]][0];
    if(t[0] == t[1]){
        last++, res++;
    }

    for(int i = 1; i < t.size(); i++){
        char c = t[i];
        if(syutu[c][syutu[c].size() - 1] < last){
            res += s.size() - last;
            last = 0;
        }

        int left = 0, right = syutu[c].size() - 1, mid;

        while(abs(left - right) > 1){
            mid = (left + right) / 2;
            if(syutu[c][mid] > last){
                right = mid;
            }else{
                left = mid;
            }
        }
        
        int j = syutu[c][left];
        res += j - last;
        last = j;
        if(i != t.size() - 1){
            if(t[i] == t[i + 1]) last++, res++;
        }
    }
    print(res);
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'in' was not declared in this scope; did you mean 'n'?
    6 |     in(s, t);
      |     ^~
      |     n
a.cc:11:18: error: 'std::map<char, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'pb'
   11 |         syutu[c].pb(i);
      |                  ^~
a.cc:17:13: error: 'print' was not declared in this scope; did you mean 'rint'?
   17 |             print(-1);
      |             ^~~~~
      |             rint
a.cc:53:5: error: 'print' was not declared in this scope; did you mean 'rint'?
   53 |     print(res);
      |     ^~~~~
      |     rint
Language: C++

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

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

    string s,t; cin>>s>>t; vector<int> sa[26]; Int key=0; int ba=-1; bool ok=true;
    for (int i = 0; i < s.size(); i++){
        char c=s[i];
        sa[c-'a'].push_back(i);
    }
    for (int i = 0; i < t.size(); i++){
        char c=t[i];
        if(sa[c-'a'].size()==0){cout<<-1<<'\n'; exit(0);}
        vector<int>::iterator it=upper_bound(sa[c-'a'].begin(),sa[c-'a'].end(),ba);
        if(it==sa[c-'a'].end()){key++; ba=sa[c-'a'][0];}
        else ba=*it;
    }
    cout<<key*s.size()+ba+1<<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:48: error: 'Int' was not declared in this scope; did you mean 'int'?
    7 |     string s,t; cin>>s>>t; vector<int> sa[26]; Int key=0; int ba=-1; bool ok=true;
      |                                                ^~~
      |                                                int
a.cc:16:33: error: 'key' was not declared in this scope; did you mean 'key_t'?
   16 |         if(it==sa[c-'a'].end()){key++; ba=sa[c-'a'][0];}
      |                                 ^~~
      |                                 key_t
a.cc:19:11: error: 'key' was not declared in this scope; did you mean 'key_t'?
   19 |     cout<<key*s.size()+ba+1<<'\n';
      |           ^~~
      |           key_t
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    int i, j, a[27], b[27], p, q, M, m;
    int *A;
    A = malloc(sizeof(int) * 5500000);
    long long X;
    char s[200005], t[200005];
    
    X=0; p=0; q=0;
    scanf("%s", s);
    scanf("%s", t);
    
    for (i=1; i<=26; i++) {
        a[i]=0; b[i]=0;
    }
    for (i=0; i<strlen(s); i++) {
        a[s[i]-96]++;
        A[200000*(s[i]-96)+(a[s[i]-96])]=i;
        // printf("(%d, %d)\n", 200000*(s[i]-96)+(a[s[i]-96]), i);
    }
    for (i=0; i<strlen(t); i++) {
        /*
        printf("[%d]\n", i);
        for (j=1; j<=a[t[i]-96]; j++) printf("%d, ", A[200000*(t[i]-96)+(j)]);
        printf("\n");
        */
        b[t[i]-96]++;
    }
    for (i=1; i<=26; i++) {
        if (a[i]==0 && b[i]!=0) {
            printf("%d", -1);
            return 0;
        }
    };
    
    for (i=0; i<strlen(t); i++) {
        m=1000000;
        for (j=1; j<=a[t[i]-96]; j++) {
            M=0;
            if (q>=A[200000*(t[i]-96)+(j)]) M+=strlen(s);
            M+=A[200000*(t[i]-96)+(j)];
            if (M<m) m=M;
        }
        if (m>=strlen(s)) {
            p++;
        }
        q=m%strlen(s);
        printf("(%d, %d, %d)\n", i, p, q);
    }
    printf("%d", (long long)p*strlen(s)+q+1);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    8 |     A = malloc(sizeof(int) * 5500000);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |               |
      |               void*
Language: C++

#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int main()
{
    char s[100001],t[100001];
    cin>>s>>t;
    int l=strlen(t);
    int sl,tl=0,ssl=strlen(s),i=0,m=strlen(s);
    set<char>ss(t,t+l);
    set<char>ss2(s,s+ssl);
    sl=ss.size();
    set <char>::iterator it;
    set <char>::iterator it2;
    it=ss.begin();
    for(it=ss.begin();it!=ss.end();it++) {for(it2=ss2.begin();it2!=ss2.end();it2++) if(*it2==*it) tl++;}
    if(tl<sl) cout<<-1;
    else
    {
        int a=0,j=0;
        i=0;
        while(t[j])
        {
            if(t[j]==s[i]) {i++;j++;}
            else i++;
            if(i==ssl) i=0,a++;
        }
        cout<<(a*ssl+i);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'strlen' was not declared in this scope
   22 |     int l=strlen(t);
      |           ^~~~~~
a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <algorithm>
  +++ |+#include <cstring>
   13 | #define endl '\n'
a.cc:35:9: error: 'i' was not declared in this scope
   35 |         i=0;
      |         ^
Language: C++

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

int main(){
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	map<char, int> ms, mt;
	for(int i = 0; i < n; i++){
    	ms[s.at(i)]++;
    }
  bool flag = true;
  for(int i = 0; i < m; i++){
  	if(ms[t.at(i)] == 0){
    	flag = false;
    }
  }
  if(flag){
  	cout << -1 << endl;
  }
  else{
  	int count = 0;
    fot(int j = 0; j < m; j++){
  	for(int i = 0; i < n; i++){
    	if(s.at(i) == t.at(j)){
        	count++;
        }
      	else{
        	}
    
    if(count == m){
    	break;
    }
    if(i == n-1){
    	i = -1;
    }}}}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: expected primary-expression before 'int'
   23 |     fot(int j = 0; j < m; j++){
      |         ^~~
a.cc:23:20: error: 'j' was not declared in this scope
   23 |     fot(int j = 0; j < m; j++){
      |                    ^
Language: C++


#include <iostream>


#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#include <stdio.h>
#include <vector> 
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>

#include<iostream>
using namespace std;

std::vector< std::vector<int> > graph;
std::vector<int> c;


void rr(int root, int count) {
	if (count == 0){
		return;
	}
	for(const auto &a : graph[root]) {
		c[a] += count;

		rr(a, count);
	}
}

void eee(int root, int count) {
	c[root] += count;
	for (const auto &a : graph[root]) {
		eee(a, c[root]);
	}
}

int main()
{

	std::string s, t;
	cin >> s >> t;

	for (int i = 0; i < t.length(); ++i) {
		if (s.find_first_of(t[i]) == std::string::npos) {
			printf("-1\n");
			return 0;
		}
	}

	int len = s.length();
	std::string dou = s + s;
	long int cur = 0;

	const double d = std::pow(10, 100);

	for (int i = 0; i < t.length(); ++i) {

		string tmp = dou.substr((cur)%len);

		int c = tmp.find_first_of(t[i]);

		cur += c+1;
		if (((double)cur/ len) > d) {
			printf("-1\n");
			return 0;
		}
	}

	printf("%d\n", cur);


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:31: error: 'pow' is not a member of 'std'
   64 |         const double d = std::pow(10, 100);
      |                               ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#define MOD 1000000007
#define int long long
#define 1 (long long)1
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;

signed main(){
    string s,t;
    cin>>s>>t;
    int c[26]={};
    vector<int> w[26];
    for(int i=0;i<s.size();i++){
        c[s[i]-'a']++;
        w[s[i]-'a'].push_back(i);
    }
    bool can=true;
    int tc[26]={};
    for(int i=0;i<t.size();i++){
        tc[t[i]-'a']++;
    }
    int ans=0;
    for(int i=0;i<t.size();i++){
        if(c[t[i]-'a']==0){
            can=false;
            break;
        }else{
            int n=ans%s.size();
            int f=-1;
            for(int j=0;j<w[t[i]-'a'].size();j++){
                if(w[t[i]-'a'][j]>=n){
                    f=w[t[i]-'a'][j]+1;
                    break;
                }
            }
            if(f==-1){
                f=s.size()+w[t[i]-'a'][0]+1;
            }
            ans=ans/s.size()*s.size()+f;
        }
        
    }
    if(can)cout<<ans<<endl;
    else cout<<-1<<endl;
    return 0;
}


Compiler output:
a.cc:17:9: error: macro names must be identifiers
   17 | #define 1 (long long)1
      |         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int flag = 0;
  for (int i = 0; i < t.size(); i++) {
    for (int j = 0; j < s.size(); j++) {
      if (t[i] == s[j]) {
        flag += i;
        break;
      }
    }
  }

  int sum = 0;
  for (int i = 0; i < t.size(); i++) {
    sum += i;
  }

  if (sum != flag) {
    cout < -1 << endl;
    return 0;
  }

  int sikii = 0;
  int index = 0;

  int counter = 0;
  int j = 0;
  int i = 0;
  for (; i < t.size();) {
    for (; j < s.size(); j++) {
      if (t[i] == s[j]) {
        index = j + 1;
        i += 1;
        break;
      }
      if (j == s.size() - 1) {
        sikii += 1;
        j = 0;
        break;
      }
    }
    if (i == t.size()) {
      break;
    }
  }

  cout << sikii * s.size() + index << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   25 |     cout < -1 << endl;
      |            ~~~^~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, a, b) for (auto i = (a); i < (b); ++i)
using namespace std;

signed main() {
	string ss; getline(cin, ss, '\n');
	string ts; getline(cin, ts, '\n');
	int n = ss.size(), m = ts.size();

	int s[n], t[m];
	REP(i, 0, m) t[i] = ts[i] - 'a';
	REP(i, 0, n) s[i] = ss[i] - 'a';
	vector<int> freq[27];
	REP(i, 0, n) freq[s[i]].push_back(i);
	
	bool flag = 0;
	REP(i, 0, m) 
		if (freq[t[i]].empty()) {
			cout << -1;
			return;
		}

	int prev = -1;
	long long ans = 0;
	REP(i, 0, m) {
		auto it = upper_bound(freq[t[i]].begin(), freq[t[i]].end(), prev);
		if (it != freq[t[i]].end())
			prev = *it;
		else {
			++ans;
			prev = freq[t[i]][0];
		}
	}
	ans *= n;
	ans += prev + 1;
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   22 |                         return;
      |                         ^~~~~~
Language: C++

//
#include <iostream>
#include <unordered_map>
#include <algorithm>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
	string s,t;
	cin >> s;
	cin >> t;

	unordered_map<char, vector<int> > map;

	for (int i=0; i<s.size(); i++){
		auto jtr = map.find(s[i]);
		if (jtr != map.end()){
			jtr->second.push_back(i+1);
		}else{
			map[s[i]] = std::vector<int>();
			map[s[i]].push_back(i+1);
		}
	}

	// for (auto itr = map.begin(); itr != map.end(); ++itr)
	// {
	// 	for (auto jtr = itr->second.begin(); jtr != itr->second.end(); ++jtr){
	// 		cout << itr->first << *jtr;
	// 	}
	// 	cout << endl;
	// }
	// cout << endl;

	long ans = 0;
	int now = 0;
	for (int i=0; i<t.size(); i++){
		auto itr = map.find(t[i]);

		if (itr == map.end()){
			ans = -1;
			break;
			//owari
		}else{
			for (auto jus = itr->second.begin(); jus != itr->second.end(); jus++){
				if (*jus > now){
					// cout << *jus << now << endl;
					ans += *jus-now;
					now = *jus;
					// cout << ans << now << endl;
					break;
				}else{
					if (*jus == itr->second.back()){
						ans += (s.size()-now)+(itr->second[0]);
						now = itr->second[0];
					}else{
						continue;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:13:29: error: 'vector' was not declared in this scope
   13 |         unordered_map<char, vector<int> > map;
      |                             ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <algorithm>
  +++ |+#include <vector>
    5 | #include <string>
a.cc:13:39: error: template argument 2 is invalid
   13 |         unordered_map<char, vector<int> > map;
      |                                       ^
a.cc:13:39: error: template argument 5 is invalid
a.cc:13:41: error: expected unqualified-id before '>' token
   13 |         unordered_map<char, vector<int> > map;
      |                                         ^
a.cc:16:28: error: 'map' was not declared in this scope
   16 |                 auto jtr = map.find(s[i]);
      |                            ^~~
a.cc:5:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    4 | #include <algorithm>
  +++ |+#include <map>
    5 | #include <string>
a.cc:20:42: error: 'vector' is not a member of 'std'
   20 |                         map[s[i]] = std::vector<int>();
      |                                          ^~~~~~
a.cc:20:42: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:20:49: error: expected primary-expression before 'int'
   20 |                         map[s[i]] = std::vector<int>();
      |                                                 ^~~
a.cc:37:28: error: 'map' was not declared in this scope
   37 |                 auto itr = map.find(t[i]);
      |                            ^~~
a.cc:37:28: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
Language: C++

/**akshaykumar99**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+2;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;

int main()
{
    IOS();
 
    string s,t;
    cin>>s>>t;
    int i,j;
    bool a[26]={0},b[26]={0};
    vector<int>   #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt","w",stdout);
    #endif v[26];
    int ss=s.length(),tt=t.length();
    f(i,0,ss)
    {
        a[s[i]-'a']=1;
        v[s[i]-'a'].pu(i);
    }
    f(i,0,tt)
    {
      b[t[i]-'a']=1;
    }
    f(i,0,26)
    {
      if(b[i])
        if(!a[i])
        {
          cout<<-1;
          return 0;
        }
    }
    ll res=0,p=-1;
    f(i,0,tt)
    {
      
      auto z=upper_bound(all(v[t[i]-'a']),p);
            if(z!=v[t[i]-'a'].end())
            {
              p=*z;
                // cout<<*z<<'\n';//<<" "<<res;
            
            }
            else
            {
              p=-1;
              res++;
              i--;
            }
                // cout<<z;//<<" "<<res;

    }
    // cout<<p<<" "<<res;
    cout<<res*ss+p+1;

  return 0;
}

Compiler output:
a.cc:34:19: error: stray '#' in program
   34 |     vector<int>   #ifndef ONLINE_JUDGE
      |                   ^
a.cc:37:6: error: #endif without #if
   37 |     #endif v[26];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:34:27: error: expected initializer before 'ONLINE_JUDGE'
   34 |     vector<int>   #ifndef ONLINE_JUDGE
      |                           ^~~~~~~~~~~~
a.cc:42:9: error: 'v' was not declared in this scope
   42 |         v[s[i]-'a'].pu(i);
      |         ^
a.cc:61:30: error: 'v' was not declared in this scope
   61 |       auto z=upper_bound(all(v[t[i]-'a']),p);
      |                              ^
a.cc:12:16: note: in definition of macro 'all'
   12 | #define all(v) v.begin(),v.end()
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = 0; i < (a); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int n, m;
  n = s.size();
  m = t.size();
  map<char, vector<int>> mp;
  rep(i, n) {
    mp[s[i]].push_back(i);
  }
  bool flag = true;
  rep(i, m) {
    if(mp.find(t[i]) == mp.end()) flag = false;
  }
  ll ans = 0;
  int po = 0;
  if(flag) {
    rep(i, m) {
      auto it = lower_bound(all(mp[t[i]]), po);
      if(it != mp[t[i]].end()) {
        ans += *it - po;
        po = *it;
      }
      else {
        ans += (n - po) + mp[t[i]][0];
        po = mp[t[i]][0];
      }
    }
  }
  ans += 1;
  else ans = -1;
  out(ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:3: error: 'else' without a previous 'if'
   65 |   else ans = -1;
      |   ^~~~
Language: C++

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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

lli dp[i][j] // 今の場所から c までいくのにどれくらい必要？

int main() {
    string s, t;
    cin2(s, t);
    lli ans = 0;
    lli j = 0;
    REP(i, 0, t.length()) {
        lli count = 0;
        while (true) {
            if (t[i] == s[j]) {
                break;
            }
            j++;
            count++;
            if (j == s.length()) {
                ans++;
                j = 0;
            }
            if (count == s.length()+1) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << ans * s.length() + (j+1) % s.length() << endl;
}


Compiler output:
a.cc:30:8: error: 'i' was not declared in this scope
   30 | lli dp[i][j] // 今の場所から c までいくのにどれくらい必要？
      |        ^
a.cc:30:11: error: 'j' was not declared in this scope; did you mean 'jn'?
   30 | lli dp[i][j] // 今の場所から c までいくのにどれくらい必要？
      |           ^
      |           jn
a.cc:32:1: error: expected initializer before 'int'
   32 | int main() {
      | ^~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, a, b) for (auto i = (a); i < (b); ++i)
using namespace std;
#define int long long;
signed main() {
	string ss; cin >> ss;
	string ts; cin >> ts;
	long long n = ss.size(), m = ts.size();

	int s[n], t[m];
	REP(i, 0, m) t[i] = ts[i] - 'a';
	REP(i, 0, n) s[i] = ss[i] - 'a';
	vector<int> freq[27];
	REP(i, 0, n) freq[s[i]].push_back(i);
	bool flag = 0;
	REP(i, 0, m) if (freq[t[i]].empty()) flag = 1;
	if (flag) {
		cout << -1;
		return 0;
	}

	int prev = 0;
	long long ans = 0;
	REP(i, 0, m) {
		auto it = upper_bound(freq[t[i]].begin(), freq[t[i]].end(), prev);
		if (it != freq[t[i]].end())
			prev = *it;
		else {
			++ans;
			prev = freq[t[i]][0];
		}
	}

	cout << ans * n + prev + 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: declaration does not declare anything [-fpermissive]
    6 | #define int long long;
      |                  ^~~~
a.cc:12:9: note: in expansion of macro 'int'
   12 |         int s[n], t[m];
      |         ^~~
a.cc:12:13: error: 's' was not declared in this scope
   12 |         int s[n], t[m];
      |             ^
a.cc:12:19: error: 't' was not declared in this scope
   12 |         int s[n], t[m];
      |                   ^
a.cc:6:18: error: template argument 1 is invalid
    6 | #define int long long;
      |                  ^~~~
a.cc:15:16: note: in expansion of macro 'int'
   15 |         vector<int> freq[27];
      |                ^~~
a.cc:6:18: error: template argument 2 is invalid
    6 | #define int long long;
      |                  ^~~~
a.cc:15:16: note: in expansion of macro 'int'
   15 |         vector<int> freq[27];
      |                ^~~
a.cc:15:19: error: expected primary-expression before '>' token
   15 |         vector<int> freq[27];
      |                   ^
a.cc:15:21: error: 'freq' was not declared in this scope; did you mean 'free'?
   15 |         vector<int> freq[27];
      |                     ^~~~
      |                     free
a.cc:6:18: error: declaration does not declare anything [-fpermissive]
    6 | #define int long long;
      |                  ^~~~
a.cc:24:9: note: in expansion of macro 'int'
   24 |         int prev = 0;
      |         ^~~
a.cc:24:20: error: overloaded function with no contextual type information
   24 |         int prev = 0;
      |                    ^
a.cc:36:25: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator+'
   36 |         cout << ans * n + prev + 1;
      |                 ~~~~~~~~^~~~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N 100000
int A[26][N]={0}, pos[26]={0};

int  main(){
  int l, i, tmp, ex, cur, j;
  long long int loop=0;
  char s[N], t[N];
  scanf("%s", s);
  scanf("%s", t);
  l=strlen(s);
  for (i=0; i<l; i++){
    tmp=s[i]-'a';
    A[tmp][pos[tmp]]=i; pos[tmp]++;
  }

/*
  for (i=0; i<26; i++){
    printf("%d ", pos[i]);
  }
*/

  cur=-1;
  for (i=0; i<strlen(t); i++){
//    printf("%lld %d\n", loop, cur);
    tmp=t[i]-'a';
//    printf("%c\n", tmp+'a');
    ex=0;
    if (pos[tmp]==0) {
      printf("-1\n"); exit(0);
    }
    for (j=0; j<pos[tmp]; j++){
      if (A[tmp][j]>cur) {
        ex=1; cur=A[tmp][j]; break;
      }
    }
    if (ex) continue;
    cur=A[tmp][0]; loop++;
  }
  printf("%lld\n", loop*strlen(s)+cur+1);
}
~


Compiler output:
main.c:45:1: error: expected identifier or '(' before '~' token
   45 | ~
      | ^