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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    string s, t, ss;
    cin >> s >> t;
    ss = s + s;
    ll n = s.size(), m = t.size();
    vll pos(26,INT_MAX);
    for (int i = 0; i < n; i++)
    {
        for(char c = 'a';c<='z';c++)
        {
            if(s[i]==c)
            chmin(pos[c-'a'],i);
        }
    }
    bool ok=true;
    for (size_t i = 0; i < m; i++)
    {
        if(pos[t[i]-'a']==INT_MAX)
        {
            cout<<-1;
            return 0;
        }
    }
    ll ans = 0;
    ll now=0;
    for (size_t i = 0; i < m; i++)
    {
        if(now>pos[t[i]-'a'])
        {
            ans += n-now;
            now=0;
        }
        ans += pos[t[i]-'a'] - now;
        now=pos[t[i]-'a'];
    }
    cout<<ans+1;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:18: error: no matching function for call to 'chmin(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int&)'
   73 |             chmin(pos[c-'a'],i);
      |             ~~~~~^~~~~~~~~~~~~~
a.cc:33:6: note: candidate: 'template<class T> bool chmin(T&, const T&)'
   33 | bool chmin(T &a, const T &b)
      |      ^~~~~
a.cc:33:6: note:   template argument deduction/substitution failed:
a.cc:73:18: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'int')
   73 |             chmin(pos[c-'a'],i);
      |             ~~~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll occur[26];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    string t;
    cin>>s;
    cin>>t;
    vector<ll>alpha[26];
    for(ll i=0;i<s.length();i++)
    {
        occur[s[i]-'a']=1;
        alpha[s[i]-'a'].push_back(i);
    }
    for(ll i=0;i<26;i++)
    {
        if(alpha[i].size()>0)
        {
            ll n=alpha[i].size();
            last=n;
            while(alpha[i].size()<200000)
            {
                for(ll j=0;j<n;j++)
                {
                    alpha[i].push_back(alpha[i][last-n]+s.size());
                    last++;
                    if(alpha[i].size()>200000)
                        break;
                }
            }
        }
    }
    ll flag=1;
    for(ll i=0;i<t.length();i++)
    {
        if(occur[t[i]-'a']==0)
        {
            flag=0;
        }
    }
    if(flag==0)
    {
        cout<<"-1";
        return 0;
    }
    ll ans=-1;
    for(ll i=0;i<t.size();i++)
    {
        auto it=upper_bound((alpha[t[i]-'a']).begin(),(alpha[t[i]-'a']).end(),ans);
        if(it==(alpha[t[i]-'a']).end())
        {
            cout<<"-1";
            return 0;
        }
        else
        {
            ans=*it;
        }
    }
    cout<<ans+1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'last' was not declared in this scope
   23 |             last=n;
      |             ^~~~
Language: C++

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

int main(){
    string s,t;
    cin >> s >> t;
    G st(26,vector<int>(0));
    vector<int> num(26,0);
    int n=s.size();
    rp(i,n){
        st[s[i]-'a'].push_back(i);
        num[s[i]-'a']++;
    }
    int m=t.size();
    int pos=-1;
    int strs=0;
    rp(i,m){
        int ch=t[i]-'a';
        if(num[ch]==0){
            cout << -1 << endl;
            return 0;
        }
        if(st[ch].back()<=pos){
            pos=st[ch][0];
            strs++;
            continue;
        }
        auto it=upper_bound(st[ch].begin(),st[ch].end(),pos);
        pos=*it;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:34:6: error: expected '}' at end of input
   34 |     }
      |      ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

ll MAX = 100005;

ll sidx[26][MAX];

int main() {
	string s, t;
	cin >> s >> t;

	// vector<vector<ll>> sidx(26, vector <ll> ());
	for (ll ii = 0; ii < s.size(); ++ii){
		ll tmp = s[ii] - 'a';
		sidx[tmp].push_back(ii);
	}

	vector <ll> tidx(t.size(), 0);
	vector <ll> sitr(26, 0);
	for (ll ii = 0; ii < t.size(); ++ii){
		ll tmp = t[ii] - 'a';
		if (sidx[tmp].size()==0){
			cout << -1 << "\n";
			return 0;
		}
		tidx[ii] = sidx[tmp][sitr[tmp]];
		if (sidx[tmp].size() > sitr[tmp]+1){
			sitr[tmp]++;
		} else if (sidx[tmp].size() == sitr[tmp]+1) {
			sitr[tmp] = 0;
		}
	}

	for (ll ii = 0; ii < t.size(); ++ii){
		cout << tidx[ii] << endl;
	}

	ll cnt = 1;
	for (ll ii = 0; ii < t.size() - 1; ++ii){
		if (tidx[ii] >= tidx[ii+1]){
			cnt++;
		}
	}

	ll ans = s.size() * cnt - (s.size() - tidx[t.size()-1]) + 1;

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc:10:13: error: size of array 'sidx' is not an integral constant-expression
   10 | ll sidx[26][MAX];
      |             ^~~
a.cc: In function 'int main()':
a.cc:19:27: error: request for member 'push_back' in 'sidx[tmp]', which is of non-class type 'long long int [1]'
   19 |                 sidx[tmp].push_back(ii);
      |                           ^~~~~~~~~
a.cc:26:31: error: request for member 'size' in 'sidx[tmp]', which is of non-class type 'long long int [1]'
   26 |                 if (sidx[tmp].size()==0){
      |                               ^~~~
a.cc:31:31: error: request for member 'size' in 'sidx[tmp]', which is of non-class type 'long long int [1]'
   31 |                 if (sidx[tmp].size() > sitr[tmp]+1){
      |                               ^~~~
a.cc:33:38: error: request for member 'size' in 'sidx[tmp]', which is of non-class type 'long long int [1]'
   33 |                 } else if (sidx[tmp].size() == sitr[tmp]+1) {
      |                                      ^~~~
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

cont ll MAX = 100005;

ll sidx[26][MAX];

int main() {
	string s, t;
	cin >> s >> t;

	// vector<vector<ll>> sidx(26, vector <ll> ());
	for (ll ii = 0; ii < s.size(); ++ii){
		ll tmp = s[ii] - 'a';
		sidx[tmp].push_back(ii);
	}

	vector <ll> tidx(t.size(), 0);
	vector <ll> sitr(26, 0);
	for (ll ii = 0; ii < t.size(); ++ii){
		ll tmp = t[ii] - 'a';
		if (sidx[tmp].size()==0){
			cout << -1 << "\n";
			return 0;
		}
		tidx[ii] = sidx[tmp][sitr[tmp]];
		if (sidx[tmp].size() > sitr[tmp]+1){
			sitr[tmp]++;
		} else if (sidx[tmp].size() == sitr[tmp]+1) {
			sitr[tmp] = 0;
		}
	}

	for (ll ii = 0; ii < t.size(); ++ii){
		cout << tidx[ii] << endl;
	}

	ll cnt = 1;
	for (ll ii = 0; ii < t.size() - 1; ++ii){
		if (tidx[ii] >= tidx[ii+1]){
			cnt++;
		}
	}

	ll ans = s.size() * cnt - (s.size() - tidx[t.size()-1]) + 1;

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc:8:1: error: 'cont' does not name a type; did you mean 'const'?
    8 | cont ll MAX = 100005;
      | ^~~~
      | const
a.cc:10:13: error: 'MAX' was not declared in this scope
   10 | ll sidx[26][MAX];
      |             ^~~
a.cc: In function 'int main()':
a.cc:19:17: error: 'sidx' was not declared in this scope
   19 |                 sidx[tmp].push_back(ii);
      |                 ^~~~
a.cc:26:21: error: 'sidx' was not declared in this scope; did you mean 'tidx'?
   26 |                 if (sidx[tmp].size()==0){
      |                     ^~~~
      |                     tidx
a.cc:30:28: error: 'sidx' was not declared in this scope; did you mean 'tidx'?
   30 |                 tidx[ii] = sidx[tmp][sitr[tmp]];
      |                            ^~~~
      |                            tidx
Language: C++

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

int main(){
  long long a = 0;
  string s, t; cin >> s >> t; s += s;
  vector<vector<int>> m(26), v(26, vector<int>((int)s.size(), -1));
  rep(i, s.size()) m[s[i]-'a'].push_back(i);
  rep(i, 26){
    if(m[i].size() == 0) continue;
    else rep(j, (int)s.size()/2) v[i][j] = upper_bound(m[i].begin(), m[i].end(), j)-m[i].begin()-j;
  }
  rep(i, t.size()){
    if(m[t[i]-'a']].size() == 0){
      a = -1; break;
    }
    else if(i == 0 && s[0] == t[i]) continue;
    else a += v[t[i]-'a'][a%((int)s.size()/2)];
  }
  cout << a << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected ')' before ']' token
   15 |     if(m[t[i]-'a']].size() == 0){
      |       ~           ^
      |                   )
a.cc:15:19: error: could not convert 'm.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)(((int)t.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))) - 97)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool'
   15 |     if(m[t[i]-'a']].size() == 0){
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
a.cc:15:19: error: expected primary-expression before ']' token
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

int main() {
    string s,t;
    cin>>s>>t;
    vvi pl(26,vl(0));
    for (int i=0;i<int(s.size());i++){
        int num=s[i]-'a';
        pl[num].push_back(i);
    }
    ll ans=0;
    ll now=0;
    ll c=0;
    int b=1;
    for (int i=0;i<int(t.size());i++){
        int num=t[i]-'a';
        if (pl[num].size()==0){
            b=0;
            break;
        }
        else{
            int num1=pl[num].size();
            if (pl[num][num1-1]<=now){
                now=pl[num][0];
                c+=1;
            }
            else{
                auto index=lower_bound(all(pl[num]),now)-pl[num].begin();
                now=pl[num][index];
            }
        }
    }
    ll ss=ll(s.size());
    if (b==0){
        cout<<-1<<endl;
    }
    else{
        cout<<c*ss+now+1<<endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: 'vl' was not declared in this scope; did you mean 'pl'?
   26 |     vvi pl(26,vl(0));
      |               ^~
      |               pl
Language: C++

#include <bits/stdc++.h

using namespace std;
using i64 = long long;

int main()
{
    string s, t;
    cin >> s >> t;

    vector<vector<int>> index(26);
    string ss = s + s; // 二周分
    for (int i = 0; i < ss.size(); i++)
        index[ss[i] - 'a'].push_back(i);

    int now_ix = 0;
    i64 length = 1;
    for (auto &&c : t)
    {
        if (index[c - 'a'].empty())
        {
            length = -1;
            break;
        }
        int next_ix = *lower_bound(index[c - 'a'].begin(), index[c - 'a'].end(), now_ix + 1);
        length += next_ix - now_ix;
        now_ix = next_ix % s.size();
    }

    cout << length << endl;

    return 0;
}

Compiler output:
a.cc:1:24: error: missing terminating > character
    1 | #include <bits/stdc++.h
      |                        ^
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;
char s[100005];
char t[100005];
int index[100005][27];
bool vis1[27],vis2[27];
int main(){
	scanf("%s",s+1);
	scanf("%s",t+1);
	int lens=strlen(s+1);
	int lent=strlen(t+1);
	for(int i=1;i<=lens;i++)
		vis1[s[i]-'a']=1;
	for(int i=1;i<=lent;i++)
		vis2[t[i]-'a']=1;
	for(int i=0;i<26;i++)
		if(vis2[i]&&(!vis1[i])){
			printf("-1\n");
			return 0;
		}
	
	for(int i=lens;i>=1;i--){
		for(int j=0;j<26;j++)
			index[i][j]=index[i+1][j];
		index[i][s[i]-'a']=i;
	}
	int num=0,now=1;
	for(int i=1;i<=lent;i++){
		if(now>lens||!index[now][t[i]-'a']){
			now=1;
			num++;
		}
		now=index[now][t[i]-'a']+1;
	}
	now--;
	printf("%lld\n",(long long)num*(long long)lens+(long long)now);
	return 0;
}

Compiler output:
a.cc:6:21: error: 'int index [100005][27]' redeclared as different kind of entity
    6 | int index[100005][27];
      |                     ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:25:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   25 |                         index[i][j]=index[i+1][j];
      |                              ^
a.cc:25:42: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   25 |                         index[i][j]=index[i+1][j];
      |                                          ^
a.cc:26:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |                 index[i][s[i]-'a']=i;
      |                      ^
a.cc:30:36: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   30 |                 if(now>lens||!index[now][t[i]-'a']){
      |                                    ^
a.cc:34:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   34 |                 now=index[now][t[i]-'a']+1;
      |                          ^
Language: C++

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

int main(){
    string s,t;
    cin >> s >> t;
    //string ss = s + s;
    //vector<vector<int>> DP(26,vector<int>(s.size()));
    set<int> memo[26];
    int n = s.size();
    rep(i,n){
        memo[ss[i] - 'a'].insert(i);    
    }
    rep(i,n){
        memo[ss[i] - 'a'].insert(i+n);    
    }
    /*rep(i,ss.size()){
        memo[ss[i] - 'a'].insert(i);        
    }*/
    int cur = 0;
    //int p = 0;
    ll ans = 0;
    //cout << "aaa"<<endl;
    int nt = t.size();
    int ns = s.size();

    rep(i,nt){
        auto itr = lower_bound(memo[t[i]-'a'].begin(), memo[t[i]-'a'].end(), cur);// - memo[t[i] - '0'].begin();
        if(itr == memo[t[i] -'a'].end()){
            cout << -1 << endl;
            return 0;
        }else{
            cur = *itr+1;
            if(cur >= ns){
                cur -= ns;
                ans += ns;
            }

        }
    }
    ans += cur;
    cout << ans << endl;
    /*
    vector<vector<int>> DP();
    map<char,int> ms,mt;
    rep(i,s.size()){ 
        ms[s[i]]++;
    }
    rep(i,t.size()){ 
        mt[t[i]]++;
    }
    rep(i,t.size()){
        if(ms[t[i]] <= 0){
            cout << -1 << endl;
            return 0;
        }
    }
    int Mq = 0;
    //int rr = 0;
    rep(i,t.size()){
        int q = (mt[t[i]])/ ms[t[i]];
        //int r = (mt[t[i]])% ms[t[i]];
        Mq = max(Mq, q);
        /*if(qq < q){
            qq = q;
            rr = r;
        }*//*
        //int nneed = max(nneed, (mt[t[i]] + ms[t[i]] - 1 )/ ms[t[i]]);
    }
    //Mq++;
    map<char,int> memo; 
    rep(i,t.size()){
        int q = (mt[t[i]])/ ms[t[i]];
        if(Mq == q){
            int r = (mt[t[i]])% ms[t[i]];
            memo[t[i]] = max(memo[t[i]], r);
        }
    }
    int tmp = -1;
    rep(i,t.size()){
        memo[t[i]]--;
        if(memo[t[i]] <= 0){
            tmp = i+1;
        }
    }
  //  if(Mq != 1){
    cout << Mq*t.size() + tmp << endl;
//        return 0;*/


}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'ss' was not declared in this scope; did you mean 's'?
   16 |         memo[ss[i] - 'a'].insert(i);
      |              ^~
      |              s
a.cc:19:14: error: 'ss' was not declared in this scope; did you mean 's'?
   19 |         memo[ss[i] - 'a'].insert(i+n);
      |              ^~
      |              s
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001001;
const int NMAX=8;
const int mod = 1000000007;



int main()
{
  string s,t;
  cin>>s>>t;
  vector<vector<ll>> a(30);
  int n=s.size();
  rep(i,n){
    char c_now=s[i];
    a[c_now-'a'].push_back(i);

  }
  ll ans=0;
  ll now=0;
  rep(i,t.size()){
    int c=t[i]-'a';

    if (a[c].size()==0){
      ans=-1;break;
    }

    else{
      int idx=*lower_bound(a[c].begin(),a[c].end(),now)+1;
      if (idx>=s.size()) {
        now=a[c][0];ans+=s.size();
    }
    else{
      now=*idx;
    //  cout<<now<<endl;
    }

  }



}
if (ans==-1)cout<<ans;
else{
  ans+=now;
  cout<<ans;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: invalid type argument of unary '*' (have 'int')
   39 |       now=*idx;
      |           ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long int INF = 1e16;

int main(){
  string s,t;
  
  cin >> s >> t;
 
  int find[200010][26];
  
  for(int i=0;i<26;i++){
    
    find[2*s.size()][i]=INF;
  }
  
  for(int i=2*s.size()-1;i>=0;i--){
    
    for(int j=0;j<26;j++){
      
      find[i][j]=find[i+1][j];
    }
    
    find[i][s[i]-'a']=i+1;
  }
  
  ll ans=0;
  
  for(int i=0;i<t.size();i++){
    
    if(find[ans % s.size()][t[i]-'a']==INF){
      
      cout << -1 << endl;
      
      return 0;
    }
    
    ans += find[ans % s.size()][t[i]-'a']-(ans % a);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: warning: overflow in conversion from 'long long int' to 'int' changes value from '10000000000000000' to '1874919424' [-Woverflow]
   15 |     find[2*s.size()][i]=INF;
      |                         ^~~
a.cc:39:50: error: 'a' was not declared in this scope
   39 |     ans += find[ans % s.size()][t[i]-'a']-(ans % a);
      |                                                  ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    string S, T;
    cin >> S >> T;
    
    const int NO_OF_ALPHABETS = 26;
    vector <vector <int> > locations(NO_OF_ALPHABETS);
    for(int i = 0; i < S.size(); i++)
    {
        locations[S[i] - 'a'].push_back(i);
    }
    
    int no_of_concatenations = 1, matched_prefix = -1;
    for(int i = 0; i < T.size(); i++)
    {
        if(locations[T[i] - 'a'].size() == 0)
        {
            cout << "-1\n";
            
            return 0;
        }
        
        auto it = upper_bound(locations[T[i] - 'a'].begin(), locations[T[i] - 'a'].end(), matched_prefix);
        
        if(it == locations[T[i] - 'a'].end())
        {
            no_of_concatenations++;
            
            matched_prefix = locations[T[i] - 'a'][0];
        }
        else
        {
            matched_prefix = *it;
        }
    }
    
    long long final_length = (no_of_concatenations - 1)*1LL*S.size() + (matched_prefix + 1);
    cout << final_length << "\n";
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'upper_bound' was not declared in this scope
   28 |         auto it = upper_bound(locations[T[i] - 'a'].begin(), locations[T[i] - 'a'].end(), matched_prefix);
      |                   ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
#define N            1e9+7;
using namespace std;
ll t;
char str[100005];
char s[100005];
vector<ll>v[30];
int main()
{
    ll a,b,c,d,e,f=0,g,h,i,j;
    gets(str);
    gets(s);
    b=1;
    d=0;
    c=0;
    f=0;
    for(i=0; i<30; i++)
        v[i].clear();
    g=strlen(str);
    for(i=0; i<g; i++)
    {
        v[str[i]-'a'].push_back(i);
        //cout<<i<<endl;
    }
    /*for(i=0;i<26;i++)
    {
        for(j=0;j<v[i].size();j++)
        {
            cout<<v[i][j]<<' ';
        }
        cout<<endl;
    }*/
    h=strlen(s);
    for(i=0; i<h; i++)
    {
        c=s[i]-'a';
        if(v[c].size()==0)
        {
            b=-1;
            break;
        }
        e=lower_bound(v[c].begin(),v[c].end(),f)-v[c].begin();
        if(e>=v[c].size())
        {
            b++;
            f=v[c][0]+1;
            //cout<<v[c][0]<<endl;
        }
        else
        {
            f=v[c][e]+1;
            //cout<<v[c][0]<<endl;
        }
        //cout<<f<<endl;
    }
    if(b!=-1){
    b=(b-1)*g;
    cout<<b+f<<endl;}
    else cout<<"-1"<<endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   14 |     gets(str);
      |     ^~~~
      |     getw
Language: C++

#include<bits/stdc++.h>

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

using namespace std;

int main(){
  string s, t;cin>>s>>t;
  map<char, int>sm;
  rep(i, s.size())sm[s[i]]++;
  bool f=true;
  rep(i, t.size())if(sm[t[i]]==0)f=false;
  if(!f){ cout<<-1;return 0; }

  map<char, vector<ll>> sc;
  rep(i, s.size()){
    sc[s[i]].push_back(i+1);
  }

  ll s_count=0, s_index=0;
  rep(i, t.size()){
    // もし今見ている文字の位置情報を格納した配列の最後の値よりも
    // sの中を進んでいるインデックスが大きければ、次の連結されたsへ移動する
    if(s_index >= sc[t[i]][sc[t[i]].size()-1]){
      s_count++;
      s_index=0;
    }

    // get value from it
    s_index = *upper_bound(c_asc[t[i]]rr.begin(), sc[t[i]].end(), s_index);
  }

  cout<<s.size()*s_count+s_index;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: 'c_asc' was not declared in this scope
   31 |     s_index = *upper_bound(c_asc[t[i]]rr.begin(), sc[t[i]].end(), s_index);
      |                            ^~~~~
Language: C++

#include<bits/stdc++.h>

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

using namespace std;

int main(){
  string s, t;cin>>s>>t;
  map<char, int>sm;
  rep(i, s.size())sm[s[i]]++;
  bool f=true;
  rep(i, t.size())if(sm[t[i]]==0)f=false;
  if(!f){ cout<<-1;return 0; }

  map<char, vector<ll>> sc;
  rep(i, s.size()){
    sc[s[i]].push_back(i+1);
  }

  ll s_count=0, s_index=0;
  rep(i, t.size()){
//cout<<t[i]<<':'<<s_count<<' '<<s_index<<endl;
    // もし今見ている文字の位置情報を格納した配列の最後の値よりも
    // sの中を進んでいるインデックスが大きければ、次の連結されたsへ移動する
    if(s_index >= sc[t[i]][c_arr.size()-1]){
      s_count++;
      s_index=0;
    }

    rep(j, sc[t[i]].size()){
      // sの中で見ているインデックスよりも文字の位置情報を格納した配列に大きい数値があれば、それを新しいs_indexにする
      if(sc[t[i]][j]>s_index){
        s_index = sc[t[i]][j];
        break;
      }
    }
  }

  cout<<s.size()*s_count+s_index;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: 'c_arr' was not declared in this scope
   26 |     if(s_index >= sc[t[i]][c_arr.size()-1]){
      |                            ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};


int main(){
  string s,t; cin >> s >> t;
  vvi C(26);
  int n = sz(s);
  rep(i, n) C[s[i] - 'a'].pb(i);
  rep(i, n) C[s[i] - 'a'].pb(i+n);

  ll ans = 0;
  int p = -1;
  rep(i,t.size()) {
    int c = t[i] - 'a';
    if(C[c].empty){
      cout << -1 << endl;
      return 0;
    }
    p = *upper_bound(all(C[c]),p);
    if(p > n){
      p -= n;
      ans += n;
    }
  }

  cout << ans+p+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:18: error: cannot convert 'std::vector<int>::empty' from type 'bool (std::vector<int>::)() const noexcept' to type 'bool'
  104 |     if(C[c].empty){
      |                  ^
Language: C++

#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 123456;
char s[MAXN], t[MAXN];
vector<int> idx[87];

int main() {
    scanf("%s", s + 1);
    scanf("%s", t + 1);
    int ns = strlen(s + 1);
    int nt = strlen(t + 1);
    for (int i = 1; i <= ns; i++) {
        int cur = s[i] - 'a';
        idx[cur].push_back(i);
    }
    LL ans = 0, cur_idx = 0;
    for (int i = 1; i <= nt; i++) {
        int cur = t[i] - 'a';
        if (idx[cur].empty()) return !printf("-1\n");
        auto it = upper_bound(idx[cur].begin(), idx[cur].end(), cur_idx) - idx[cur].begin();
        //printf("i = %d tmp = %d\n", i, tmp);
        if (tmp == (int)idx[cur].size()) {
           ans += (ns - cur_idx);
           cur_idx = idx[cur].front();
           ans += cur_idx;
        } else {
           ans += (idx[cur][tmp] - cur_idx);
           cur_idx = idx[cur][tmp];
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   39 |         if (tmp == (int)idx[cur].size()) {
      |             ^~~
      |             tm
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-2, -1};
int dx[4] = {-1, -2};

string s;
string t;
set<ll> idx[26];

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> s >> t;
	rep(i,0,sz(s)) {
		idx[s[i]-'a'].insert(i);
	}
	ll p = 0;
	ll q = 0;
	rep(i,0,sz(t)) {
		set<int>& cand = idx[t[i]-'a'];
		if(cand.empty()) {
			cout << -1 << endl;
			return 0;
		}
		auto it = cand.lower_bound(q);
		if(it == cand.end()) {
			p++;
			q = *(cand.begin());
		} else {
			q = *it;
		}
	}
	cout << (ll)p*sz(s)+q+1 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:46: error: invalid initialization of reference of type 'std::set<int>&' from expression of type 'std::set<long long int>'
   39 |                 set<int>& cand = idx[t[i]-'a'];
      |                                  ~~~~~~~~~~~~^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   18 |     if(dic[c].size==0){
      |                   ()
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string S,T;cin>>S>>T;
  
  long ans=0;
  int id=0;
  string tmp=S;
  for(int i=0;i<T.length();i++){
    while(1){
      if(id>=S.length())){cout<<-1;return 0;}
      if(tmp[id]==T[i]){
        tmp=tmp.substr(id+1)+tmp.substr(0,id+1);
        id=0;
        ans++;
        break;
      }
      id++;
      ans++;
    }
  }
  cout<<ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: expected primary-expression before ')' token
   11 |       if(id>=S.length())){cout<<-1;return 0;}
      |                         ^
Language: C++

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

int main{
  
  string s, t;
  cin >> s >> t;
  
  int res;
  int alpStock[26];
  int alpStock_num = 0;
  
  for(int i=0; i<t.size(); ++i){
    
    for(int j=0; j<26; ++j){
      if(t[i] == alpStock[j]){
        goto nextloop;
      }
      else{
        alpStock[alpStock_num] = t[i];
        ++ alpStock_num;
      }
    }
    
    bool checkAlp = 0;
    for(int j=0; j<s.size(); ++j){
      if(t[i] == s[j]){
        checkAlp == 1;
        break;
      }
    }
    if(checkAlp == 0){
      res = -1;
      break;
    }
    
    nextloop:
  }
  
}

Compiler output:
a.cc:4:5: error: cannot declare '::main' to be a global variable
    4 | int main{
      |     ^~~~
a.cc:6:10: error: expected primary-expression before 's'
    6 |   string s, t;
      |          ^
a.cc:6:10: error: expected '}' before 's'
a.cc:4:9: note: to match this '{'
    4 | int main{
      |         ^
a.cc:7:3: error: 'cin' does not name a type
    7 |   cin >> s >> t;
      |   ^~~
a.cc:13:3: error: expected unqualified-id before 'for'
   13 |   for(int i=0; i<t.size(); ++i){
      |   ^~~
a.cc:13:16: error: 'i' does not name a type
   13 |   for(int i=0; i<t.size(); ++i){
      |                ^
a.cc:13:28: error: expected unqualified-id before '++' token
   13 |   for(int i=0; i<t.size(); ++i){
      |                            ^~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//[i文字目][alphabet]
int nex[201010][26];
int main()
{
	string s,t;
	cin >> s;
	cin >> t;

    int A = s.size();

    string s2 = s + s;

    for(int j = 0; j < 26; ++j)
    {
        nex[2*A][j] = s2.size();
    }

    for(int i = s2.size() - 1; i >= 0; --i)
    {
        for(int j = 0; j < 26; ++j)
        {
            //1文字前の(後ろからだから後)の情報をもらう
            nex[i][j] = nex[i+1][j];
        }
        //今回の分(位置なので+1)
        nex[i][s[i] - 'a'] = i + 1;
    }

    //nex[0] - nex[s*2 -1]までのoffsetが完成

    ll res = 0;
    for(auto c: T)
    {
        //数値に変換
        c -= 'a';
        //xはsのあまり
        int x = res % A;
        //s中にないアルファベットなら
        if(nex[x][c] == s2.size())
        {
            cout << -1 << endl;
            return 0;
        }
        res += nex[x][c] - x;
    }

    cout << res << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:17: error: 'T' was not declared in this scope
   49 |     for(auto c: T)
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<long long>;
using vvi=vector<vector<long long>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000009;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}

int main(){
  vvi v(26);
  string s,t;cin>>s>>t;
  int n=s.size(),m=t.size();
  rep(i,n){
    v[s[i]-'a'].push_back(i);
    v[s[i]-'a'].push_back(i+n);
  }
  rep(i,m){
    if(v[t[i]-'a']
}


Compiler output:
a.cc:11:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:11:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:12:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:12:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:23:19: error: expected ')' before '}' token
   23 |     if(v[t[i]-'a']
      |       ~           ^
      |                   )
   24 | }
      | ~                  
a.cc:24:1: error: could not convert 'v.std::vector<std::vector<long long int> >::operator[](((std::vector<std::vector<long long int> >::size_type)(((int)t.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))) - 97)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} to 'bool'
   24 | }
      | ^
      | |
      | __gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type {aka std::vector<long long int>}
a.cc:24:1: error: expected primary-expression before '}' token
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

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

int main(){
  string s,t;
  cin>>s>>t;
  int n=sz(s),m=sm(t);
  vector<vector<int>>is(26);
  rep(i,n)is[s[i]-'a'].push_back(i);
  rep(i,n)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: In function 'int main()':
a.cc:10:17: error: 'sm' was not declared in this scope; did you mean 'm'?
   10 |   int n=sz(s),m=sm(t);
      |                 ^~
      |                 m
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <algorithm>

int main()
{
    std::string s, t;
    std::cin >> s >> t;

    int n = s.length(), m = t.length();

    std::vector< std::vector<int> > vec(30);
    for (int i = 0; i < n; ++i)
    {
        vec[s[i] - 'a'].push_back(i);
    }

    for (int j = 0; j < m; ++j)
    {
        if (vec[t[j] - 'a'].size() == 0)
        {
            std::cout << -1;
            return 0;
        }
    }

    int period = 0;
    int curPoint = -1;
    int c, lowerPoint;
    for (int j = 0; j < m; ++j)
    {
        c = t[j] - 'a';
        lowerPoint = std::upper_bound(vec[c].begin(), vec[c].end(), curPoint) - vec[c].begin();
        if (lowerPoint == vec[c].size())
        {
            ++period;
            curPoint = vec[c][0];
        }
        else
        {
            curPoint = vec[c][lowerPoint];
        }
    }

    std::cout << period * 1LL * n + curPoint + 1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'vector' is not a member of 'std'
   13 |     std::vector< std::vector<int> > vec(30);
      |          ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | #include <algorithm>
a.cc:13:23: error: 'vector' is not a member of 'std'
   13 |     std::vector< std::vector<int> > vec(30);
      |                       ^~~~~~
a.cc:13:23: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:13:30: error: expected primary-expression before 'int'
   13 |     std::vector< std::vector<int> > vec(30);
      |                              ^~~
a.cc:16:9: error: 'vec' was not declared in this scope
   16 |         vec[s[i] - 'a'].push_back(i);
      |         ^~~
a.cc:21:13: error: 'vec' was not declared in this scope
   21 |         if (vec[t[j] - 'a'].size() == 0)
      |             ^~~
a.cc:34:39: error: 'vec' was not declared in this scope
   34 |         lowerPoint = std::upper_bound(vec[c].begin(), vec[c].end(), curPoint) - vec[c].begin();
      |                                       ^~~
Language: C++

#include <stdio.h>
#include <vector>
#include <iostream>
typedef long long ll;

using namespace std;

int main() {
    string s, t;
    int i;
    vector <int> table[26];
    cin >> s >> t;
    
    for (i=0;i<s.size();i++){
        table[s[i] - 'a'].push_back(i + 1);
    }

    ll ans = 0, pre=0;
    for (i=0;i<t.size();i++){
        ll idx = t[i] - 'a';
        if (table[idx].size() == 0){
            cout << -1 << endl;
            return 0;
        }
        auto p = *upper_bound(table[idx].begin(), table[idx].end(), pre);
        if (p == *table[idx].end()){
            p = *table[idx].begin();
            ans += s.size();
        }
        ans += p - pre;
        pre = p;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: 'upper_bound' was not declared in this scope
   25 |         auto p = *upper_bound(table[idx].begin(), table[idx].end(), pre);
      |                   ^~~~~~~~~~~
Language: C++

#include <stdio.h>
#include <vector>
#include <iostream>
typedef long long ll;

using namespace std;

int main() {
    string s, t;
    int i;
    vector <int> table[26];
    cin >> s >> t;
    
    for (i=0;i<s.size();i++){
        table[s[i] - 'a'].push_back(i + 1);
    }
    
    ll ans = 0, pre=0, p;
    for (i=0;i<t.size();i++){
        int idx = t[i] - 'a';
        if (table[idx].size() == 0){
            cout << -1 << endl;
            return 0;
        }
        p = *upper_bound(table[idx].begin(), table[idx].end(), pre);
        
        if (p == 0){
            p = *upper_bound(table[idx].begin(), table[idx].end(), 0);
            ans += s.size() - pre;
            pre = 0;
        }
        ans += p - pre;
        pre = p;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'upper_bound' was not declared in this scope
   25 |         p = *upper_bound(table[idx].begin(), table[idx].end(), pre);
      |              ^~~~~~~~~~~
Language: Java

import java.util.Scanner;
import java.util.Arrays;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String _s = sc.next();
    char[] t = sc.next().toCharArray();
    _s += _s;
    char[] s = _s.toCharArray();
    int N = s.length;
    int M = t.length;
    for(int i = 0; i < N; i++){
      s[i] -= 'a';
    }
    for(int i = 0; i < M; i++){
      t[i] -= 'a';
    }
    for(int i = 0; i < N; i++){
      que.get(s[i]).add(i);
    }
    int[][] map = new int[N][26];
    for(int[] is : map){
      Arrays.fill(is, Integer.MAX_VALUE / 3);
    }
    for(int i = 0; i < N; i++){
      map[i][s[i]] = 0;
    }
    for(int i = 0; i < 26; i++){
      for(int j = N - 1; j >= 0; j--){
        map[j][i] = Math.min(map[j][i], map[(j + 1) % N][i] + 1);
      }
    }
    
    for(int i = 0; i < 26; i++){
      for(int j = 0; j < N; j++){
        if(map[j][i] == 0){
          map[j][i] = map[(j + 1) % N][i] + 1;
        }
      }
    }
    
    long ans = 0;
    int idx = N/2 - 1;
    if(map[N/2 - 1][t[0]] > Integer.MAX_VALUE / 5){
      System.out.println(-1);
      return;
    }
    ans += map[N/2 - 1][t[0]];
    idx += map[N/2 - 1][t[0]];
    idx %= N/2;
    for(int i = 1; i < M; i++){
      if(map[idx][t[i]] > Integer.MAX_VALUE / 5){
        System.out.println(-1);
        return;
      }
      ans += map[idx][t[i]];
      idx += map[idx][t[i]];
      idx %= N/2;
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:20: error: cannot find symbol
      que.get(s[i]).add(i);
      ^
  symbol:   variable que
  location: class Main
1 error
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int N = s.length();
    int M = t.length();
    int[] at = new int[26];
    Arrays.fill(at, N + 1);
    for(int i = N - 1; i >= 0; i--){
      at[s.charAt(i) - 'a'] = i + 1;
    }
    boolean[] isTurn = new boolean[M];
    for(int i = 0; i < M - 1; i++){
      if(at[t.charAt(i) - 'a'] == N + 1){
        System.out.println(-1);
        return;
      }
      if(at[t.charAt(i) - 'a'] >= at[t.cahrAt(i + 1) - 'a']){
        isTurn[i + 1] = true;
      }
    }
    if(at[t.charAt(M - 1) - 'a'] == N + 1){
      System.out.println(-1);
      return;
    }
    long ans = 0;
    ans += at[t.charAt(0) - 'a'];
    for(int i = 1; i < M; i++){
      if(!isTurn[i]){
        ans += at[t.charAt(i) - 'a'] - at[t.cahrAt(i - 1) - 'a'];
      } else {
        ans += N + at[t.cahrAt(i) - 'a'];
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:21: error: cannot find symbol
      if(at[t.charAt(i) - 'a'] >= at[t.cahrAt(i + 1) - 'a']){
                                      ^
  symbol:   method cahrAt(int)
  location: variable t of type String
Main.java:33: error: cannot find symbol
        ans += at[t.charAt(i) - 'a'] - at[t.cahrAt(i - 1) - 'a'];
                                           ^
  symbol:   method cahrAt(int)
  location: variable t of type String
Main.java:35: error: cannot find symbol
        ans += N + at[t.cahrAt(i) - 'a'];
                       ^
  symbol:   method cahrAt(int)
  location: variable t of type String
3 errors
Language: Java

import jav.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int N = s.length();
    int M = t.length();
    int[] at = new int[26];
    Arrays.fill(at, N + 1);
    for(int i = N - 1; i >= 0; i--){
      at[s.charAt(i) - 'a'] = i + 1;
    }
    boolean[] isTurn = new boolean[M];
    for(int i = 0; i < M - 1; i++){
      if(at[t.charAt(i) - 'a'] == N + 1){
        System.out.println(-1);
        return;
      }
      if(at[t.charAt(i) - 'a'] >= at[t.cahrAt(i + 1) - 'a']){
        isTurn[i + 1] = true;
      }
    }
    if(at[t.charAt(M - 1) - 'a'] == N + 1){
      System.out.println(-1);
      return;
    }
    long ans = 0;
    ans += at[t.charAt(0) - 'a'];
    for(int i = 1; i < M; i++){
      if(!isTurn[i]){
        ans += at[t.charAt(i) - 'a'] - at[t.cahrAt(i - 1) - 'a'];
      } else {
        ans += N + at[t.cahrAt(i) - 'a'];
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:1: error: package jav.util does not exist
import jav.util.*;
^
Main.java:5: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
Main.java:11: error: cannot find symbol
    Arrays.fill(at, N + 1);
    ^
  symbol:   variable Arrays
  location: class Main
Main.java:21: error: cannot find symbol
      if(at[t.charAt(i) - 'a'] >= at[t.cahrAt(i + 1) - 'a']){
                                      ^
  symbol:   method cahrAt(int)
  location: variable t of type String
Main.java:33: error: cannot find symbol
        ans += at[t.charAt(i) - 'a'] - at[t.cahrAt(i - 1) - 'a'];
                                           ^
  symbol:   method cahrAt(int)
  location: variable t of type String
Main.java:35: error: cannot find symbol
        ans += N + at[t.cahrAt(i) - 'a'];
                       ^
  symbol:   method cahrAt(int)
  location: variable t of type String
7 errors
Language: Java

import jav.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int N = s.length();
    int M = t.length();
    int[] at = new int[26];
    Arrays.fill(at, N + 1)
    for(int i = N - 1; i >= 0; i--){
      at[s.charAt(i) - 'a'] = i + 1;
    }
    boolean[] isTurn = new boolean[M];
    for(int i = 0; i < M - 1; i++){
      if(at[t.charAt(i) - 'a'] == N + 1){
        System.out.println(-1);
        return;
      }
      if(at[t.charAt(i) - 'a'] >= at[t.cahrAt(i + 1) - 'a']){
        isTurn[i + 1] = true;
      }
    }
    if(at[t.charAt(M - 1) - 'a'] == N + 1){
      System.out.println(-1);
      return;
    }
    long ans = 0;
    ans += at[t.charAt(0) - 'a'];
    for(int i = 1; i < M; i++){
      if(!isTurn[i]){
        ans += at[t.charAt(i) - 'a'] - at[t.cahrAt(i - 1) - 'a'];
      } else {
        ans += N + at[t.cahrAt(i) - 'a'];
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:11: error: ';' expected
    Arrays.fill(at, N + 1)
                          ^
1 error