stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream> 

#include <cstdio> 

#include <cstdlib> 

#include <cstring> 

#include <cmath> 

#include <algorithm> 

using namespace std; 

inline int gi() { 

    register int data = 0, w = 1;

    register char ch = 0;

    while (!isdigit(ch) && ch != '-') ch = getchar(); 

    if (ch == '-') w = -1, ch = getchar(); 

    while (isdigit(ch)) data = 10 * data + ch - '0', ch = getchar(); 

    return w * data; 

} 

const int MAX_N = 1e5 + 5; 

int N, L, a[MAX_N], f[17][MAX_N]; 



int main () { 

	N = gi(); for (int i = 1; i <= N; i++) a[i] = gi();

	L = gi(); 

	for (int i = 1; i <= N; i++) f[0][i] = upper_bound(&a[i + 1], &a[N + 1], a[i] + L) - a - 1; 

	for (int i = 1; i < 17; i++) 

		for (int j = 1; j <= N; j++) f[i][j] = f[i - 1][f[i - 1][j]]; 

	int Q = gi(); 

	while (Q--) { 

		int l = gi(), r = gi(); 

		if (l > r) swap(l, r); 

		int ans = 0; 

		for (int i = 16; ~i; i--) if (f[i][l] < r) l = f[i][l], ans |= (1 << i); 

		printf("%d\n", ans + 1); 

	} 

    return 0; 

} 

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm> 



const int MAXN = 1e5 + 1;



int n, l, q, x[MAXN];



int f[MAXN][31];

void prework() {

	for (int i = 1; i <= n; ++i) {

		int pos = std :: upper_bound(x + 1, x + n + 1, x[i] + l) - x - 1;

		f[i][0] = x[i] + l >= x[n] ? n : pos;

	}

	for (int j = 1; j <= 30; ++j) for (int i = 1; i <= n; ++i) f[i][j] = f[f[i][j - 1]][j - 1];

}



int main() {

	scanf("%d", &n);

	for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);

	scanf("%d%d", &l, &q);

	prework();

	while (q--) {

		int a, b; scanf("%d%d", &a, &b);

		if (a > b) std :: swap(a, b);

		int p = a, ans = 0;

		for (int j = 30; ~j; --j) if (f[p][j] < b) ans += (1 << j), p = f[p][j];

		printf("%d\n", ans + 1);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

 

using namespace std;

 

const int MAX_N = 100000;

const int MAX_LOG_N = 17;

 

int m[MAX_LOG_N][MAX_N];

 

int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	vector<int> x(n);

	for (int i = 0; i < n; i++) cin >> x[i];

	int L, q;

	cin >> L >> q;

	for (int i = 0; i < n; i++) {

		int nex = upper_bound(x.begin() + i, x.end(), x[i] + L) - x.begin();

		nex--;

		m[0][i] = nex;

	}

 

	for (int i = 0; i + 1 < MAX_LOG_N; i++) {

		for (int j = 0; j < n; j++) {

			if (m[i][j] == n) m[i + 1][j] = n;

			else m[i + 1][j] = m[i][m[i][j]];

		}

	}

 

	for (int i = 0; i < q; i++) {

		int a, b;

		cin >> a >> b;

		a--;

		b--;

		if (a > b) swap(a, b);

		int ng = 0, ok = n - 1;

		while (ok - ng > 1) {

			int mid = (ok + ng) / 2;

			int cur = a;

			for (int i = 0; i < MAX_LOG_N; i++) {

				if (mid & (1 << i)) cur = m[i][cur]; 

			}

			if (cur >= b) ok = mid;

			else ng = mid;

		}

		cout << ok << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <vector>

#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)



inline int read()

{

	int data = 0, w = 1; char ch = getchar();

	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();

	if (ch == '-') w = -1, ch = getchar();

	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();

	return data * w;

}



const int N(1e5 + 10), LogN(17);

int n, L, Q, A[N], f[LogN][N], stk[N], H, T;



int main()

{

	n = read(), H = 1, T = 0;

	for (int i = 1; i <= n; i++) A[i] = read();

	L = read(), Q = read(), f[0][n] = n;

	for (int i = n; i; i--)

	{

		while (H <= T && A[stk[H]] - A[i] > L) ++H;

		if (H <= T) f[0][i] = stk[H];

		stk[++T] = i;

	}

	for (int i = 1; i < LogN; i++)

		for (int j = 1; j <= n; j++) f[i][j] = f[i - 1][f[i - 1][j]];

	for (int a, b, ans; Q--; )

	{

		a = read(), b = read(), ans = 0; if (a > b) std::swap(a, b);

		for (int i = LogN - 1; ~i; i--) if (f[i][a] && f[i][a] < b)

			ans += (1 << i), a = f[i][a];

		printf("%d\n", ans + 1);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
# include <bits/stdc++.h>



# define pb push_back

# define fr first

# define sc second

# define mk make_pair



using namespace std;



const int inf = 1e9 + 7;

const int N = 1e5 + 5;



typedef long long ll;



int n, a[N], q, L, up[19][N];



int main()

{

      cin >> n;



      for(int i = 1; i <= n; i ++)

            cin >> a[i];



      cin >> L;



      for(int i = n; i >= 1; i --)

      {

            int l = i, r = n, d = a[i] + L;

            while(r - l > 1)

            {

                  int md = (l + r) >> 1;

                  if(a[md] > d)

                        r = md;

                  else

                        l = md;

            }

            if(a[r] <= d)

                  l = r;



            up[0][i] = l;

      }



      for(int i = 1; i <= 17; i ++)

            for(int j = 1; j <= n; j ++)

                  up[i][j] = up[i - 1][up[i - 1][j]];



      cin >> q;



      while(q --)

      {

            int l, r;

            cin >> l >> r;

            if(l > r) swap(l, r);

            int ans = 1;

            for(int i = 17; i >= 0; i --)

                  if(up[i][l] && up[i][l] < r)

                  {

                        ans += (1 << i);

                        l = up[i][l];

                  }



            cout << ans << endl;

      }

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <vector>

#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)



inline int read()

{

	int data = 0, w = 1; char ch = getchar();

	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();

	if (ch == '-') w = -1, ch = getchar();

	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();

	return data * w;

}



const int N(1e5 + 10), LogN(17);

int n, L, Q, A[N], f[LogN][N], stk[N], H, T;



int main()

{

	n = read(), H = 1, T = 0;

	for (int i = 1; i <= n; i++) A[i] = read();

	L = read(), Q = read(), f[0][n] = n;

	for (int i = n; i; i--)

	{

		while (H <= T && A[stk[H]] - A[i] > L) ++H;

		if (H <= T) f[0][i] = stk[H];

		stk[++T] = i;

	}

	for (int i = 1; i < LogN; i++)

		for (int j = 1; j <= n; j++) f[i][j] = f[i - 1][f[i - 1][j]];

	for (int a, b, ans; Q--; )

	{

		a = read(), b = read(), ans = 0; if (a > b) std::swap(a, b);

		for (int i = LogN - 1; ~i; i--) if (f[i][a] && f[i][a] < b)

			ans += (1 << i), a = f[i][a];

		printf("%d\n", ans + 1);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <time.h>

#include <tr1/unordered_map>

#include <tr1/unordered_set>

using namespace std::tr1;

using namespace std;

/* cau troi cho Garena nhap de con Bach */

#define FSYNC ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define fi first

#define se second

#define pb push_back

#define mp make_pair

#define int long long

#define endl '\n'

#define inf 0x3f3f3f3f

#define lb lower_bound

#define pob pop_back

#define ub upper_bound

#define ite ::iterator

#define db(x) {cout <<"#db " << x << endl;}

#define here() {cout <<"here \n";}

#define mod 1000000007

typedef pair<int,int> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

typedef vector<vi> vvi;

const int MOD = 1e9 + 7;

const int _MOD = 998244353;

const int N = 2e5 + 5;



int ST[N][20];

vi x;

int T[N];

int L,q,n;

int solve(int l,int r){

	if(l == r) return 0;

	if(r < l) swap(l,r);

	l --, r--;

	int ans = 0;

	for(int i = 17 ; i >= 0 ; i --){

		if(ST[l][i] < r){

			ans |= (1<<i);

			l = ST[l][i];

		}

	}

	return ans + 1;

}

signed main(){

	cin >> n ;

	for(int i = 0 ; i < n ; i ++){

		int u;cin >> u;x.pb(u);

	}

	cin >> L >> q;//cout << endl;

	for(int i = 0 ; i <= 19 ; i ++)

		for(int j = 0 ; j <n ; j ++)

			ST[j][i] = -1;

	for(int i = 0 ; i < n ; i ++){

		vector<int>ite it = x.begin() + i;

		ST[i][0] = ub(it,x.end(),x[i] + L) - x.begin() - 1;

		//cout << ST[i][0] << " ";

	}

	//cout << endl;

	

	for(int j = 1 ; j <= 19 ; j ++)

		for(int i = 0 ; i < n ; i ++)

			if(ST[i][j-1] != -1) ST[i][j] = ST[ST[i][j-1]][j-1];

	

	for(int i = 1 ; i <= q; i ++){

		int a,b;cin >> a >> b;

		cout << solve(a,b) << endl;

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <vector>

#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)



inline int read()

{

	int data = 0, w = 1; char ch = getchar();

	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();

	if (ch == '-') w = -1, ch = getchar();

	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();

	return data * w;

}



const int N(1e5 + 10), LogN(17);

int n, L, Q, A[N], f[LogN][N], stk[N], H, T;



int main()

{

	n = read(), H = 1, T = 0;

	for (int i = 1; i <= n; i++) A[i] = read();

	L = read(), Q = read(), f[0][n] = n;

	for (int i = n; i; i--)

	{

		while (H <= T && A[stk[H]] - A[i] > L) ++H;

		if (H <= T) f[0][i] = stk[H];

		stk[++T] = i;

	}

	for (int i = 1; i < LogN; i++)

		for (int j = 1; j <= n; j++) f[i][j] = f[i - 1][f[i - 1][j]];

	for (int a, b, ans; Q--; )

	{

		a = read(), b = read(), ans = 0; if (a > b) std::swap(a, b);

		for (int i = LogN - 1; ~i; i--) if (f[i][a] && f[i][a] < b)

			ans += (1 << i), a = f[i][a];

		printf("%d\n", ans + 1);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



const int N = 1e5 + 5;

int sparse[N][18], n, a[N], l, q;



int get (int x, int y) {

    int ans = 1;

    for (int i = 17; i >= 0; i--) {

        if (sparse[x][i] != -1 && sparse[x][i] < y) {

            x = sparse[x][i];

            ans = ans + (1 << i);

        }

    }



    return ans;

}



int main(){

    scanf("%d", &n);

    for (int i = 0; i < n; i++) scanf("%d", &a[i]);

    scanf("%d", &l);

    scanf("%d", &q);



    memset(sparse, -1, sizeof(sparse));

    for (int i = 0; i < n; i++) sparse[i][0] = upper_bound(a, a + n, a[i] + l) - a - 1;

    for (int j = 1; j < 18; j++) {

        for (int i = 0; i < n; i++) {

            if (sparse[i][j - 1] != -1) sparse[i][j] = sparse[sparse[i][j - 1]][j - 1];

        }

    }



    while (q--) {

        int x, y;

        scanf("%d %d", &x, &y);

        if (x > y) swap(x, y);

        printf("%d\n", get(x - 1, y - 1));

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <vector>

#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)



inline int read()

{

	int data = 0, w = 1; char ch = getchar();

	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();

	if (ch == '-') w = -1, ch = getchar();

	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();

	return data * w;

}



const int N(1e5 + 10), LogN(17);

int n, L, Q, A[N], f[LogN][N], stk[N], H, T;



int main()

{

	n = read(), H = 1, T = 0;

	for (int i = 1; i <= n; i++) A[i] = read();

	L = read(), Q = read(), f[0][n] = n;

	for (int i = n; i; i--)

	{

		while (H <= T && A[stk[H]] - A[i] > L) ++H;

		if (H <= T) f[0][i] = stk[H];

		stk[++T] = i;

	}

	for (int i = 1; i < LogN; i++)

		for (int j = 1; j <= n; j++) f[i][j] = f[i - 1][f[i - 1][j]];

	for (int a, b, ans; Q--; )

	{

		a = read(), b = read(), ans = 0; if (a > b) std::swap(a, b);

		for (int i = LogN - 1; ~i; i--) if (f[i][a] && f[i][a] < b)

			ans += (1 << i), a = f[i][a];

		printf("%d\n", ans + 1);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <cstring>

#include <algorithm>

#define rg register

using namespace std;

inline int read(){

	rg int x=0; 

	rg char c=getchar();

	while(c<'0'||c>'9') 

		c=getchar();

	while(c>='0'&&c<='9'){

		x=(x<<1)+(x<<3)+(c^48);

		c=getchar();

	}

	return x;

}

const int N=1e5+5;

int l,n,q,x[N],a,b;

int pre[N][20],ans;

inline int get_power(int k){

	int ans=1;

	while(k--) 

		ans<<=1;

	return ans;

}

void prework(){

	for(rg int i(0);i<n;++i)

		pre[i][0]=upper_bound(x,x+n,x[i]+l)-x-1;

	for(rg int i(1);i<20;++i)

		for(rg int j(0);j<n;++j)

			pre[j][i]=pre[pre[j][i-1]][i-1];

}

int main(){

	n=read();

	for(rg int i(0);i<n;++i)

		x[i]=read();

	l=read();

	prework();

	q=read();

	while(q--){

		a=read();

		b=read();

		ans=1;

		if(a>b)

			swap(a,b);

		--b; --a;

		while(pre[a][0]<b)

			for(rg int i(0);i<20;++i)

				if(pre[a][i]>=b){

					a=pre[a][i-1];

					ans+=get_power(i-1);

					break;

				}

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

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#define ll long long

using namespace std;

inline int read(){

	int x=0,f=1;char c=getchar();

	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}

	while (c>='0'&&c<='9') {x=(x<<1)+(x<<3)+(c^48);c=getchar();}

	return x*f;

}

const int maxn(1e5+5);

ll n,l,q;

ll s[maxn],f[maxn][35];



void swap(ll &a,ll &b){int t=a;a=b;b=t;}

void init(){

	n=read();

	for (int i(1);i<=n;++i) s[i]=read();

	l=read(),q=read();

	for (int i(1);i<=n;++i) f[i][0]=upper_bound(s+1,s+n+1,s[i]+l)-s-1;

	for (int i(1);i<=30;++i)

		for (int j(1);j<=n;++j)

			f[j][i]=f[f[j][i-1]][i-1];

}



signed main(){

	init();

	while (q--){

		int a=read(),b=read(),tot=0;

		if (a>b) swap(a,b);

		int v=a;

		for (int i=30;~i;--i){

			if (f[v][i]<b){

				tot+=1<<i;

				v=f[v][i];

			}

		}

		printf("%d\n",tot+1);

	}

	return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <algorithm>

#include <iostream>

#include <string>

#define MOD 1000000007

#define oo 987654321

#define INT long long

using namespace std;



int n, l, q, h[100010], dt[100010][20], a, b, now;



int main()

{

    scanf("%d", &n);

    for(int i = 1 ; i <= n ; i++ )

        scanf("%d", h+i);

    scanf("%d%d", &l, &q);

    for(int i = 1 ; i <= n ; i++ )

        dt[i][0] = (int)(upper_bound(h+1, h+n+1, h[i]+l)-h) - 1;

    for(int j = 1 ; j < 20 ; j++ )

        for(int i = 1 ; i <= n ; i++ )

            dt[i][j] = dt[dt[i][j-1]][j-1];

    while( q-- )

    {

        scanf("%d%d", &a, &b);

        if( a > b ) swap(a, b);

        int cnt = 0, d;

        for(int j = 19 ; j >= 0 ; j-- )

        {

            if( dt[a][j] < b )

            {

                cnt += ( 1<<j );

                a = dt[a][j];

                d = 0;

            }

            else d = j;

        }

        printf("%d\n", cnt + (1<<d));

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#define INT long long

using namespace std;

int n, q, l, h[100010], dt[20][100010];



int main()

{

    scanf("%d", &n);

    for(int i = 1 ; i <= n ; i++ ) scanf("%d", h+i);

    scanf("%d%d", &l, &q);

    for(int i = 1 ; i <= n ; i++ )

        dt[0][i] = (int)(upper_bound(h+1, h+n+1, h[i]+l) - h) - 1;

    for(int j = 1 ; j < 20 ; j++ )

        for(int i = 1 ; i <= n ; i++ )

            dt[j][i] = dt[j-1][dt[j-1][i]];

    while( q-- )

    {

        int a, b;

        scanf("%d%d", &a, &b);

        if( a > b ) swap(a,b);

        int cnt = 0, d;

        for(int i = 19 ; i >= 0 ; i-- )

        {

            if( dt[i][a] < b )

            {

                d = 0;

                a = dt[i][a];

                cnt += (1<<i);

            }

            else d = i;

        }

        printf("%d\n", cnt+(1<<d));

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;

typedef long long LL;

const double eps = 1e-10;

const int maxn = 100 + 100;

string s;

vector<int> g[30];

int main() {

#ifdef ac

    //freopen("in.txt" , "r" , stdin);

//    freopen("out.txt" , "w" , stdout);

#endif

    cin >> s;

    for(int i=0;i<s.size();++i) {

        g[s[i]-'a'].push_back(i+1);

    }

    for(int i=0;i<26;++i) {

        if(g[i].size()>1) {

            for(int j=1;j<g[i].size();++j) {

                if(g[i][j]-g[i][j-1]<=2) {

                    cout << g[i][j-1] << " " << g[i][j] << endl;

                    return 0;

                }

            }

        }

    }

    cout <<-1 <<" " << -1 << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<vector>

#include<algorithm>

#include<stack>

using namespace std;

const int maxn = 1000000 + 10;

#define INF 0x7fffffff

#define clr(x,y) memset(x,y,sizeof(x))

typedef long long ll;

#define eps 10e-10

const ll Mod = 1000000007;

char s[100000 + 10];

int n;



int main()

{

    while( ~ scanf("%s",s))

    {

        int len = strlen(s);

        int a = -1,b = -1;

        for(int i = 0; i < len - 1; i ++)

        {

            if(s[i] == s[i + 1] )

            {

                a = i + 1,b = i + 2;break;

            }

            if(s[i] == s[i + 2])

            {

                a = i + 1;b = i + 3;break;

            }

        }

        cout << a << " " << b << endl;

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <string>

using namespace std;



int main()

{

    string s;

    cin >> s;

    int a = -1,b = -1;

    for (int i = 1; i < s.size(); i ++) {

        if (s[i - 1] == s[i]) {

            a = i,b = i + 1;

            break;

        }

        if(i + 1 < s.size() && s[i - 1] == s[i + 1])

        {

            a = i,b = i + 2;

            break;

        }

    }

    cout << a << ' ' << b << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<math.h>

#include<iostream>

#include<algorithm>

#include<stack>

#include<queue>

#include<vector>

#include<set>

#include<map>

#include<string>

using namespace std;

typedef long long ll;

typedef pair<int,int>P;

const int INF=0x3f3f3f3f;

const double pi=acos(-1.0);

const double eps=1e-9;

char str[100010];

int main()

{

    scanf("%s",str);

    int len=strlen(str);

    if(len==2&&str[0]==str[1])

    {

        printf("1 2\n");

        return 0;

    }

    for(int i=0;i<len-1;i++)

    {

        if(str[i]==str[i+1]||(i+2<len&&str[i]==str[i+2]))

        {

            if(str[i]==str[i+1])

            {

                if(i+1==len-1)

                {

                    printf("%d %d\n",len-2,len);

                    return 0;

                }

                else

                {

                    printf("%d %d\n",i+1,i+3);

                    return 0;

                }

            }

            else

            {

                printf("%d %d\n",i+1,i+3);

                return 0;

            }

        }

    }

    printf("-1 -1\n");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <string>

#include <iostream>

using namespace std;



string s;

bool flag=false;



int main()

{

    cin>>s;

    for (int i = 0; i < s.size()-1; ++ i) {

        if (s[i] == s[i+1]) {

            cout << i+1 << " " << i+2 << endl;

            flag = true;

            break;

        } else if (i < s.size()-2 && s[i] == s[i+2]) {

            cout << i+1 << " " << i+3 << endl;

            flag = true;

            break;

         }

    }

    if(flag == false) cout << -1 << " " << -1 << endl;

     return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

using namespace std;





char s[100100];



int main()

{

	while(~scanf("%s",s))

	{

		int len = strlen(s);

		int n = len;

		int F= 0;

		for(int i = 0;i < len-2;i++)

		{

			if(s[i] == s[i+1])

			{

				printf("%d %d\n",i+1,i+2);

				F = 1;

				break;

			}

			if(s[i] == s[i+2])

			{

				printf("%d %d\n",i+1,i+2+1);

				F = 1;

				break;

			}

			

		}

		

		if(!F)

		{

			if(s[n-1] == s[n-2])

			{

				printf("%d %d\n",n-1,n);

				F = 1;

			}

		}

		

		if(!F)

		{

			printf("-1 -1\n");

		}

	}

/*

needed 

atcoder

Sample Output 



The string s2s3s4s5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.



Sample Input 2















*/







 return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<math.h>

#define pi acos(-1.0)

using namespace std;

int main() {

	int s = -1, e = -1;

	char str[100000+5];

	scanf("%s", str);

	int len = strlen(str);

	for(int i = 0; str[i]; i++) {

		if(str[i] == str[i + 1]) {

			s = i + 1;

			e = i + 2;

			break;

		} else if(str[i] == str[i + 2]) {

			s = i + 1;

			e = i + 3;

			break;

		}

	}

	printf("%d %d\n",s,e);	

	return 0;

}

// Fastest known solution for this problem: