stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 8.608066860610064x):
//#pragma GCC optimize(2)

//#pragma GCC optimize(3)

#include <bits/stdc++.h>

#define N 100005

//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1 == p2)?EOF:*p1++)

using namespace std ;

//char buf[(1 << 22)] , *p1 = buf , *p2 = buf ;

inline int read ()

{

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

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

    while (c >= '0' && c <= '9'){ x = x * 10 + c - '0' ; c = getchar () ; }

    return x * f ;

}



int n , a[N] , l , q , f[N][33] , ans ;

int main ()

{

//    freopen (".in" , "r" , stdin) ; freopen (".out" , "w" , stdout) ;

	n = read () ;

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

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

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

	{

		f[i][0] = upper_bound (a + 1 , a + n + 1 , a[i] + l) - a - 1 ;

	}

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

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

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

	while (q --> 0)

	{

		int x = read () , y = read () ;

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

		int tmp = x ;

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

		{

			if (f[tmp][i] < y)

			{

				ans += (1 << i) ;

				tmp = f[tmp][i] ;

			}

		}

		cout << ans + 1 << "\n" ;

		ans = 0 ;

	}

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 8.601049095587726x):
#include <bits/stdc++.h>

#define ll long long 

using namespace std;

const int maxn=110000;

ll a[maxn];

int n;

ll l;

ll q;

int f[maxn][35]={};

inline void init()

{

  scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",a+i); scanf("%d%d",&l,&q);

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

  {

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

    f[i][0]=x;

  }

  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()

{

	init();

	while(q--)

    {

      ll a,b;

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

      if(a>b)

        swap(a,b);

      int ans=0;

      int cur=a;

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

	    if(f[cur][i]<b)

	    {

	      ans+=1<<i;

	      cur=f[cur][i];

	    }

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

    }

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 8.572310461921822x):
#include<bits/stdc++.h>

#define ll long long

#define swap(x,y) {x^=y,y^=x,x^=y;}

using namespace std;

const int maxn=2e5+10;

int N,L,f[maxn][35],t,Q,x[maxn];

inline long long read()

{

    long long s=0,f=1; char ch; for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;

    for(;ch>='0'&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+ch-'0'; return s*f;

}

void Work_preparing()

{

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

    {

        f[i][0]=upper_bound(x+1,x+N+1,1LL*(x[i]+L))-x-1;

        //printf("He can reach %d ,from %d in a day.\n",x[pos],x[i]);

    }

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

    {

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

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

    }

}

ll solve(int l,int r)

{

    ll ans=0;

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

    {

        if(f[l][i]<r) ans+=(1<<i),l=f[l][i];

    }

    return ans+1;

}

void Input()

{

    N=read(); t=(int)(log(N)/log(2));

    for(int i=1;i<=N;++i) x[i]=read();

    L=read(); Work_preparing(); Q=read();

    while(Q--)

    {

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

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

        printf("%lld\n", solve(a,b));

    }

}

int main()

{

    Input(); return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 8.56242861511745x):
#include<bits/stdc++.h>

using namespace std;

int n;

int l;

int q;

int a[100001];

int s;

int b;

int f[100001][33];

int main(){

    cin>>n;

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

    cin>>l>>q;

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

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

    	if(a[i]+l>=a[n]) f[i][0]=n;

    	else f[i][0]=x;

    }

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

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

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

    while(q--){

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

		int i=1;

		int ans=0;

		if(s>b) s^=b^=s^=b;

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

			if(f[s][i]<b)

				ans+=(1<<i),

				s=f[s][i];

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

	}

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 8.597891380553499x):
#include <bits/stdc++.h>

using namespace std;



#define MX 100050

int x[MX];

int f[18][MX];



int main() {

	int n, L, q;

	scanf("%d", &n);

	for(int i = 0; i < n; i++) scanf("%d", x + i);

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

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

		int p = upper_bound(x, x + n, x[i] + L) - x; p--;

		f[0][i] = p;

	}

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

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

	while(q--) {

		int s, t; scanf("%d%d", &s, &t); s--; t--;

		if(s > t) swap(s, t);

		int res = 0;

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

			if(f[i][s] < t) s = f[i][s], res ^= 1 << i;

		}

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

	}

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.117623454773665x):
#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));

    }

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.117388354194407x):
#include <cstdio>

#include <algorithm>

#include <string>



using namespace std;



int n, l, q, 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, cnt = 0, d;

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

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

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

        {

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

            {

                cnt += (1<<i);

                a = dt[i][a];

                d = 0;

            }

            else d = i;

        }

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

    }

    return 0;

}
// Slower C++ solution:


#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.284898834011611x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.275066388565373x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.26948517309739x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.20850659309677x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.271966533372893x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 5.211106043093892x):
#include"stdio.h"

#include"cstdio"

#include"algorithm"

#include"string.h"

using namespace std;

const int max_n=1e5+10;

char A[max_n];

int main()

{

	while(scanf("%s",A)!=EOF)

	{

		int l=-2,r=-2,i,n=strlen(A);

		for(i=0;i<n-1;i++)

		{

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

			{

				l=i;r=i+1;

				break;

			}

			else if(A[i]==A[i+2]&&i+2<n)

			{

				l=i;r=i+2;

				break;

			}

		}

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

	}

}
// Slower C++ solution:


#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.299488148067011x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.289628559502417x):
#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;

}