For this Question: For a given string S and a pattern P, your task is to print all the indexes where the pattern occur in the given string S.First line of input contains the string P, the next line of input contains the string S.

Constraints:-
1 <= |S| <= 500000
1 <= |P| <= 100000

Note:- String will contain only lowercase English lettersPrint all the indexes in ascending order separated by spaces where the pattern occurs in the string S. if none indexes are present then print -1.Sample Input:-
na
banana

Sample Output:-
2 4

Sample Input:-
Newton
School

Sample Output:-
-1, I have written this Solution Code: 
#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795
#define max1 1000001
#define MOD 100000000

#define read(type) readInt<type>()

#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()

void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void solve(){
string p,s;
cin>>p>>s;
vector<int> ans;
 int found = s.find(p);
    while (found != string::npos) {
        ans.EB(found);
        found = s.find(p, found + 1);
    }
if(ans.size()==0){out(-1);return;}
FOR(i,ans.size()){
out1(ans[i]);
}



}
signed main(){

    fast();
solve();
}





, In this Programming Language: C++, Now tell me if this Code is compilable or not?