stablegradients/pie-gem5-pairs huggingface dataset:
// 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.284031936718641x):
#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<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.222885021300027x):
#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 <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.286520146953904x):
#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<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.225491647251423x):
#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 <cstring>

#include <map>

using namespace std;

int main()

{

    char s[100000 + 10];

    cin>>s;



    if(strlen(s) == 2){

        if(s[0] == s[1]) cout<<1<<" "<<2<<endl;

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

        return 0;

    }



    bool ok = false;

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

        map<char, int> m;

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

            m[s[i + j]]++;

            if(m[s[i + j]] > 1) ok = true;

        }

        if(ok){

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

            return 0;

        }

    }



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



    return 0;

}


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

using namespace std;

int main()

{

	string s;

	cin>>s;

	int flag=0;

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

	{

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

		{

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

			flag=1;

			break;

		}

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

		{

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

			flag=1;

			break; 

		}

	}

	if(flag==0)

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

	return 0;

}

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

#include <algorithm>

#include  <iostream>

#include   <ctype.h>

#include   <cstring>

#include   <fstream>

#include    <cstdio>

#include    <vector>

#include    <string>

#include     <cmath>

#include     <deque>

#include     <stack>

#include     <queue>

#include      <list>

#include       <set>

#include       <map>

#define INF 0X7FFFFFFF

#define PI acos(-1.0)

typedef long long ll;

using namespace std;

const int N = 1e6;

inline int getint()

{

	int w = 0, q = 0;

	char c = getchar();

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

	if (c == '-') q = 1, c = getchar();

	while (c >= '0'&&c <= '9') w = w * 10 + c - '0', c = getchar();

	return q ? -w : w;

}

string s;

int main() {

	cin >> s;

	int a = -1, b = -1;

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

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

			a = i + 1;

			b = i + 2;

			break;

		}

		if (i + 2 < s.size() && 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.287908571225573x):
#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<cstdlib>

#include<algorithm>

#include<queue>

#include<vector>

#include<stack>

#include<map>

#include<set>

#include<cmath>

#include<cctype>

#include<ctime>



using namespace std;



int main()

{

    int flag=0;

    char s[100005];

    scanf("%s",s);

    for(int i=0;i<strlen(s);i++)

    {

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

        {

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

            flag=1;

            break;

        }

        else if(i<strlen(s)-1&&s[i]==s[i+2])

        {

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

            flag=1;

            break;

        }

    }

    if(!flag) printf("-1 -1\n");

    return 0;    

}

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

using namespace std;

#include<cstring>

#include<cstdio> 

char s[1010000];

int gs[1010];

int pre[1010];

int main()

{

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

	{

		int len=strlen(s);

		memset(gs,0,sizeof(gs));

		memset(pre,0,sizeof(pre));

		int l=-1,r=-1;

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

		{

			if (gs[s[i]]!=0)

			{

				if (i-pre[s[i]]<=2)

				{

					l=pre[s[i]]+1;

					r=i+1;

					break;

				}

			}

			gs[s[i]]++;

			pre[s[i]]=i;

		}

		cout<<l<<" "<<r<<endl;

	}

	return 0;

}

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

#include<cstring>

#include<set>

using namespace std;



const int M=1e5+10;

char a[M];



int main(){

    while(scanf("%s",a)!=EOF){

        getchar();

        int flag=0;

        for(int i=1;a[i];i++){

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

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

                 flag=1;

                break;

            }

            else

                if(a[i-1]==a[i+1]){

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

                    flag=1;

                    break;

                }

        }

        if(!flag)

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

    }

    return 0;

}


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

#include<cstring>

#include<set>

using namespace std;



const int M=1e5+10;

char a[M];



int main(){

    while(scanf("%s",a)!=EOF){

        getchar();

        int flag=0;

        for(int i=1;a[i];i++){

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

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

                 flag=1;

                break;

            }

            else

                if(a[i-1]==a[i+1]){

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

                    flag=1;

                    break;

                }

        }

        if(!flag)

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

    }

    return 0;

}


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

using namespace std;

char s[100010];

int a[100010][30];

int main()

{

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

	{

		bool p=false;

		int l=strlen(s),i;

		if(l==2)

		{

			if(s[0]==s[1])

			{

				printf("1 2\n");

				continue;

			}

		}

		else

		for(i=2;i<l;i++)

		{

			if(s[i]==s[i-1]||s[i]==s[i-2])

			{

				p=true;

				break;

			}

		}

		if(p)

		{

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

		}

		else

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

	}

	return 0;

}

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

#include<queue>

#include<utility>

#include<stack>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

const int maxn = 1e5 + 5;

char str[maxn];

int main() {

	int s = -1, e = -1;

	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;

		}

	}

	cout << s << ' ' << e << '\n';

	return 0;

}


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

using namespace std;



char s[100017];



void solve(){

    int len=strlen(s);

    if(len<2){

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

        return ;

    }

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

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

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

            return ;

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

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

            return ;

        }

    }

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

        return ;

}



int main(){

    memset(s,0,sizeof(s));

    scanf("%s",s);

    solve();

    return 0;

}


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

#include <string>



using namespace std;



int main() {

    char buf[131072];

    scanf("%s", buf);

    string s(buf);

    size_t ub=s.length();

    s += '$';



    for (size_t i=0; i<ub; ++i)

        for (size_t j=1; j<=2; ++j)

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

                printf("%llu %llu\n", i+1, i+j+1);

                return 0;

            }



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

    return 0;

}


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

#include <cstring>



using namespace std;



int main() {

    char s[131072]={};

    scanf("%s", s);

    size_t ub=strlen(s);

    s[ub] = '$';



    for (size_t i=0; i<ub; ++i)

        for (size_t j=1; j<=2; ++j)

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

                printf("%llu %llu\n", i+1, i+j+1);

                return 0;

            }



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

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

string s;

int main() {

	cin >> s;

	int l = -1, r = -1;

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

		if(s[i - 1] == s[i]) l = i, r = i + 1;

	}

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

		if(s[i - 2] == s[i]) l = i - 1, r = i + 1;

	}

	cout << l << ' ' << r << endl;

	return 0;

}

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

char s[100009];

int main() {

	scanf("%s", s);

	int l = -1, r = -1;

	for(int i = 1; s[i]; i++) if(s[i - 1] == s[i]) l = i, r = i + 1;

	for(int i = 2; s[i]; i++) if(s[i - 2] == s[i]) l = i - 1, r = i + 1;

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

	return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <cstring>

#include <vector>

#include <list>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <algorithm>

#include <iterator>

#include <bitset>

#include <ctime>

#include<complex>

using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL)INF;



const int MAX = 1000 * 100 + 47;



int Y[MAX];

int X[MAX];

int W[MAX];

int t, l;



int getD(int x, int y, int d)

{

	if (d == 2) swap(x, y);

	if (x <= y) return y - x;

	return y + l - x;

}



int main()

{

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

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

	ios::sync_with_stdio(false); cin.tie(0);

	int n;

	cin >> n >> l >> t;

	FOR(i, 0, n)

	{

		cin >> X[i] >> W[i];

	}



	FOR(i, 0, n)

	{

		if (W[i] == 1)

		{

			Y[i] = (X[i] + t) % l;

			//Y[i] = MP((X[i] + t) % l, W[i]);

		}

		else

		{

			Y[i] = (X[i] - t % l + l) % l;

			//Y[i] = MP((X[i] - t % l + l) % l, W[i]);

		}

	}



	int cnt = 0;

	FOR(i, 1, n)

	{

		if (W[i] == W[0]) continue;

		int d = getD(X[0], X[i], W[0]);

		int c = (2 * t - d) / l;

		//if ((2 * t - d) % l == 0) c--;

		//if (c == -1) c = n - 1;

		if (d <= 2 * t) c++;

		c = c % n;

		cnt = (c + cnt) % n;

	}



	if (W[0] == 2) cnt = n - cnt;

	int y = Y[0];

	sort(Y, Y + n);

	int ind = lower_bound(Y, Y + n, y) - Y;

	if (ind + 1 < n && Y[ind] == Y[ind + 1])

	{

		if (W[0] == 1) ind++;

	}



	ind = (ind - cnt + n) % n;

	FOR(i, 0, n)

	{

		if (ind == n) ind = 0;



		cout << Y[ind] << "\n";

		ind++;

	}

}


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

#include<algorithm>

using namespace std;

const int MAXN=(int)1e5+10;

int N,L,T,X,W;int a[MAXN],m;

int main (){

    scanf ("%d%d%d",&N,&L,&T);

    for (int tp=N-1;tp>=0;tp--){

        scanf ("%d%d",&X,&W);

        if (W==2) W=-1;

        int tpp=X+T*W;

        a[N-1-tp]=((tpp%L)+L)%L;

        m+=tpp/L;if (tpp%L<0)m--;

    }m=((m%N)+N)%N;sort(a,a+N);

    for (int i=m;i<N;i++){

        printf("%d\n",a[i]);

    }for (int i=0;i<m;i++){

        printf("%d\n",a[i]);

    }return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define xx first

#define yy second

#define mp make_pair

#define pb push_back

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

#define copy( x, y ) memcpy( x, y, sizeof x )

using namespace std;

 

typedef long long LL;

typedef pair < int, int > pa;

 

const int MAXN = 100010;

 

int n, x[MAXN], a[MAXN], w[MAXN], L, T;

LL cur;

 

int main()

{

#ifdef wxh010910

	freopen( "data.in", "r", stdin );

#endif

	scanf( "%d%d%d", &n, &L, &T );

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

	{

		scanf( "%d%d", &a[ i ], &w[ i ] );

		if( w[ i ] == 1 )

		{

			x[ i ] = ( a[ i ] + T ) % L;

			cur += ( a[ i ] + T ) / L;

		}

		else

		{

			x[ i ] = ( a[ i ] - T ) % L;

			cur += ( a[ i ] - T ) / L;

			if( x[ i ] < 0 ) x[ i ] += L, cur--;

		}

	}

	cur = ( cur % n + n ) % n;

	sort( x, x + n );

	for( int i = cur ; i < n ; i++ ) printf( "%d\n", x[ i ] );

	for( int i = 0 ; i < cur ; i++ ) printf( "%d\n", x[ i ] );

}


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

#include <algorithm>

using namespace std;

#define N 100010

int n,l,t,cnt,a[N],w[N];

int main(){

	scanf("%d%d%d",&n,&l,&t);

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

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

		int now=a[i];

		if(w[i]==2) w[i]=-1;

		a[i]+=t*w[i];

		cnt+=a[i]/l;

		if(a[i]%l<0) cnt--;

		a[i]=(a[i]%l+l)%l;

	}

	sort(a+1,a+n+1);

	cnt=(cnt%n+n)%n;

	for(int i=1;i<=n;++i) printf("%d\n",a[(i+cnt-1)%n+1]);

	return 0;

}