stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



bool a[100010],r[100010];

int n;



void solve(){

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

		if(r[i]==1){

			if(a[i]==0) a[i+1]=a[i-1];

			else a[i+1]=1-a[i-1];

		}

		else{

			if(a[i]==0) a[i+1]=1-a[i-1];

			else a[i+1]=a[i-1];

		}

	}

	int x;

	if(r[0]==1){

		if(a[0]==0) x=a[1];

		else x=1-a[1];

	}

	else{

		if(a[0]==0) x=1-a[1];

		else x=a[1];

	}

	if(a[n]==a[0]&&a[n-1]==x){

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

			if(a[i]==0) cout<<"S";

			else cout<<"W";

		}

		exit(0);

	}

}



int main(){

	cin>>n;

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

		char x;

		cin>>x;

		if(x=='o') r[i]=1;

		else r[i]=0;

	}

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=1;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=1;

	solve();

	cout<<"-1"<<endl;

	return 0;

}

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

#include<cmath>

#include<stack>

#include<queue>

#include<cstdio>

#include<vector>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

typedef long long ll;

template<class Read>void in(Read &x){

    x=0;

    int f=0;

    char ch=getchar();

    while(ch<'0'||ch>'9'){

        f|=(ch=='-');

        ch=getchar();

    }

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

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

        ch=getchar();

    }

    x=f?-x:x;

    return;

}

const int d[10][10]={{1,1},{1,-1},{-1,1},{-1,-1}};

int n,a[100005];

char s[100005];

bool check(){

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

        int l=(i==1?n:i-1);

        int r=(i==n?1:i+1);

        if(s[i]=='o'){

            if(a[i]==1&&a[l]!=a[r])return 0;

            if(a[i]==-1&&a[l]==a[r])return 0;

        }

        else{

            if(a[i]==1&&a[l]==a[r])return 0;

            if(a[i]==-1&&a[l]!=a[r])return 0;

        }

    }

    return 1;

}

int main(){

	in(n);

    scanf("%s",s+1);

    for(int ca=0;ca<4;ca++){

        a[1]=d[ca][0];

        a[2]=d[ca][1];

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

            if(a[i]==1)a[i+1]=(s[i]=='o'?a[i-1]:-a[i-1]);

            else a[i+1]=(s[i]=='x'?a[i-1]:-a[i-1]);

        }

        if(check()){

            for(int i=1;i<=n;i++)putchar((a[i]==1?'S':'W'));

            puts("");

            return 0;

        }

    }

    puts("-1");

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>



using namespace std;



int len=0;



int get_length(int x)

{

	while(x)

	{

		x/=10;

		len++;

	}

	return len;

}



int main()

{

	int a,b;

	double result,number;

	while(cin>>a>>b)

	{

		len=get_length(b);

		number=a*pow(10,len)+b;

		result=sqrt(number);

		if(abs(round(result)-result)<1e-8)

			cout<<"Yes";

		else

			cout<<"No";

	}

	return 0;

}

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

using namespace std;



int getdigit(int x){

	int t=x,ret=0;

	while(t){

		ret++;

		t/=10;

	}

	return ret;

}



int cf(int x,int z){

	int ret=1;

	for(register int i=1;i<=z;i++){

		ret*=x;

	}

	return ret;

}



int main(){

	int a,b;

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

	int t1=getdigit(b);

	int t2=cf(10,t1);

	int c=a*t2+b;

	//printf("%d %d %d\n",t1,t2,c);

	for(register int i=1;i<=1000;i++){

		if(i*i==c){

			printf("Yes");

			return 0;

		}

	}

	printf("No");

	return 0;

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

 

#define INF (1<<31)//INT_MAX/2

#define MOD 1000000007

 

using ll  = long long;

using ull = unsigned long long;

 

int main(int argc, char *argv[])

{

    std::string a, b;

    std::cin >> a >> b;



    bool flag = false;

    int num = std::stoi(a+b);

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

        if (i*i == num) {

            flag = true;

        } else {

            ;

        }

    }



    if (flag) {

        std::cout << "Yes" << std::endl;

    } else {

        std::cout << "No"  << std::endl;

    }

    return 0;

}

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



using namespace std;



#define YES cout << "YES" << endl;

#define NO  cout << "NO"  << endl;

#define Yes cout << "Yes" << endl;

#define No  cout << "No"  << endl;

 

#define INF INT_MAX

#define MOD 1000000007

#define PI  acos(-1)



using ll  = long long;

using ull = unsigned long long;

using Pii = pair<int, int>;

using Pll = pair<ll, ll>;



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



int main(int argc, char *argv[])

{

    cin.tie(0);

    ios::sync_with_stdio(false);



    string a, b;

    cin >> a >> b;

    

    ll c = stol(a+b);

    rep (i, 1000) {

        if (i*i == c) {

            Yes;

            return 0;

        }

    }



    No;

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include <vector>

#include <map>

using namespace std;

long long Read() {

	long long 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*10+c-'0',c=getchar();

	return x*f;

}

int main() {

	int n,a,b,s=0;

	a=Read(),b=Read();

	n=b;

	while(b) {

		s++;

		b/=10;

	}

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

		a*=10;

		

	}

	n+=a;

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

		if(i*i==n) {

			cout<<"Yes";

			return 0;

		}

	}

	cout<<"No";

	return 0;

}

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

#include<cmath>

#include<string>

#include<iostream>



using namespace std;



string a, b, c;



int work(int sum) {

	for (int i = 1; i * i <= sum; i++) {

		if (i * i == sum) {

			return 1;

		}

	}

	return 0;

}



int main() {

	cin >> a;

	cin >> b;

	c = a + b;

	int len = c.size();

	int sum = 0;

	for (int i = len - 1; i >= 0; i--) {

		sum += (c[i] - '0') * pow(10, len - i - 1);

	}

	if (work(sum)) {

		printf("Yes\n");

	}

	else {

		printf("No\n");

	}

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include <vector>

#include <map>

using namespace std;

long long Read() {

	long long 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*10+c-'0',c=getchar();

	return x*f;

}

int main() {

	int n,a,b,s=0;

	a=Read(),b=Read();

	n=b;

	while(b) {

		s++;

		b/=10;

	}

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

		a*=10;

		

	}

	n+=a;

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

		if(i*i==n) {

			cout<<"Yes";

			return 0;

		}

	}

	cout<<"No";

	return 0;

}

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

using namespace std;

int a,b,c,len;

int main()

{

    cin>>a>>b;c=b;

    while(c){

        c/=10,len++;

    }

    a=a*pow(10,len)+b;

    if(sqrt(a)==floor(sqrt(a)))cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include <vector>

#include <map>

using namespace std;

long long Read() {

	long long 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*10+c-'0',c=getchar();

	return x*f;

}

int main() {

	int n,a,b,s=0;

	a=Read(),b=Read();

	n=b;

	while(b) {

		s++;

		b/=10;

	}

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

		a*=10;

		

	}

	n+=a;

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

		if(i*i==n) {

			cout<<"Yes";

			return 0;

		}

	}

	cout<<"No";

	return 0;

}

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

using namespace std;



int main(){

    int a,b,cnt=1;

  	cin>>a>>b;

    while(cnt*10<=b)

        cnt*=10;

    a=a*cnt*10+b;

    for(int i=0;i*i<=a;i++)

        if(i*i==a) { cout<<"Yes"<<endl; return 0; }

    cout<<"No"<<endl;

  	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include <vector>

#include <map>

using namespace std;

long long Read() {

	long long 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*10+c-'0',c=getchar();

	return x*f;

}

int main() {

	int n,a,b,s=0;

	a=Read(),b=Read();

	n=b;

	while(b) {

		s++;

		b/=10;

	}

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

		a*=10;

		

	}

	n+=a;

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

		if(i*i==n) {

			cout<<"Yes";

			return 0;

		}

	}

	cout<<"No";

	return 0;

}

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

#include<cstdio>

using namespace std;

int a,b,c,len;

int main()

{

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

    c=b;

    while(c>0)

    {

        c/=10;

        len++;

}

    a=a*pow(10,len)+b; 

    if(sqrt(a)==floor(sqrt(a)))printf("Yes");

    else printf("No");

}
// Slower C++ solution:
#include<cstdio>

#include<cmath>

#include<string>

#include<iostream>



using namespace std;



string a, b, c;



int work(int sum) {

	for (int i = 1; i * i <= sum; i++) {

		if (i * i == sum) {

			return 1;

		}

	}

	return 0;

}



int main() {

	cin >> a;

	cin >> b;

	c = a + b;

	int len = c.size();

	int sum = 0;

	for (int i = len - 1; i >= 0; i--) {

		sum += (c[i] - '0') * pow(10, len - i - 1);

	}

	if (work(sum)) {

		printf("Yes\n");

	}

	else {

		printf("No\n");

	}

}

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

#include<cstdio>

using namespace std;

int a,b,c,len;

int main()

{

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

    c=b;

    while(c>0)

    {

        c/=10;

        len++;

}

    a=a*pow(10,len)+b; 

    if(sqrt(a)==floor(sqrt(a)))printf("Yes");

    else printf("No");

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

using namespace std;

int a,b,c,len;

int main()

{

    cin>>a>>b;c=b;

    while(c){

        c/=10,len++;

    }

    a=a*pow(10,len)+b;

    if(sqrt(a)==floor(sqrt(a)))cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}

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

#include<cstdio>

using namespace std;

int a,b,c,len;

int main()

{

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

    c=b;

    while(c>0)

    {

        c/=10;

        len++;

}

    a=a*pow(10,len)+b; 

    if(sqrt(a)==floor(sqrt(a)))printf("Yes");

    else printf("No");

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(){

    int a,b,cnt=1;

  	cin>>a>>b;

    while(cnt*10<=b)

        cnt*=10;

    a=a*cnt*10+b;

    for(int i=0;i*i<=a;i++)

        if(i*i==a) { cout<<"Yes"<<endl; return 0; }

    cout<<"No"<<endl;

  	return 0;

}


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

#include<cstdio>

using namespace std;

int a,b,c,len;

int main()

{

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

    c=b;

    while(c>0)

    {

        c/=10;

        len++;

}

    a=a*pow(10,len)+b; 

    if(sqrt(a)==floor(sqrt(a)))printf("Yes");

    else printf("No");

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include <vector>

#include <map>

using namespace std;

long long Read() {

	long long 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*10+c-'0',c=getchar();

	return x*f;

}

int main() {

	int n,a,b,s=0;

	a=Read(),b=Read();

	n=b;

	while(b) {

		s++;

		b/=10;

	}

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

		a*=10;

		

	}

	n+=a;

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

		if(i*i==n) {

			cout<<"Yes";

			return 0;

		}

	}

	cout<<"No";

	return 0;

}

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

using namespace std;

int main()

{

    string s,st,sr;

    int a=0,i;

    cin>>s>>st;

    sr=s+st;

    for (i=0;i<sr.length();i++)

    a=a*10+sr[i]-49+1;

    if (sqrt(a)==float(sqrt(a))) cout<<"Yes";

    else cout<<"No";

    cout<<endl;

    return 0;

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

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

using namespace std;

typedef long long ll;





int main() {



    string a, b;

    cin >> a >> b;

    string n = a + b;

    int num = atoi(n.c_str());

    for (ll i = 1; i < 1000000; ++i) {

        if (i * i == num) {

            cout << "Yes" << endl;

            return 0;

        }

    }

    cout << "No" << endl;

    return 0;

}

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

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

using namespace std;

typedef long long ll;





int main() {



    string a, b;

    cin >> a >> b;

    int num = stoi(a + b);

    for (ll i = 1; i < 1000; ++i) {

        if (i * i == num) {

            cout << "Yes" << endl;

            return 0;

        }

    }

    cout << "No" << endl;

    return 0;

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

using namespace std;

using ll = long long;



int main()

{

	cin.sync_with_stdio(false);

	int n, d, x;

	cin >> n >> d >> x;

	vector<vector<ll>> p(d, vector<ll>(n));

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

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

			cin >> p[i][j];

		}

	}

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

		vector<ll> dp(100001, -1);

		dp[x] = x;

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

			for (int k = 0; k <= 100000 - p[i][j]; k++) {

				if (dp[k] >= p[i - 1][j]) {

					dp[k + p[i][j] - p[i - 1][j]] = max(dp[k + p[i][j] - p[i - 1][j]], dp[k] - p[i - 1][j]);

				}

			}

		}

		int ma = 0;

		for (int k = 0; k <= 100000; k++) {

			if (dp[k] >= 0) {

				ma = k;

			}

		}

		x = ma;

	}

	cout << x << endl;

	return 0;

}

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

#include <iostream>

#include <set>

#include <algorithm>

#include <map>

#include <string>

#include <cmath>

#include <tuple>

#include <queue>



using namespace std;

typedef long long ll;

typedef pair<ll,ll> P; 

typedef tuple<ll,ll,ll> T;



int main(){

	ll n,d,x;

	cin >> n >> d >> x;

	vector<vector<ll>> p(d,vector<ll>(n));

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

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

			cin >> p[i][j];

	}

	ll ans=x;

	for(int t=0;t<d-1;t++){

		vector<ll> dp(ans+1); //dp[before]=after

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

			for(int now=0;now+p[t][i]<=ans;now++){

				dp[now+p[t][i]] = max(dp[now] + p[t+1][i] , dp[now+p[t][i]]);

			}

		}

		ll next=0;

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

			next=max(dp[i]+ans-i, next);

		}

		ans=next;

	}

	cout << ans << endl;

	return 0;

}
// Slower C++ solution:
/*------------------------------------------------------------------------------------------------|

| %%%%%%%%%%%%%%%%%%%%%%%%%MD.ASANURJAMAL ANOWAR HOSSAIN ANU%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%COMPUTER SCIENCE AND ENGINEERING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%ISLAMIC UNIVERSITY KUSHTIA%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%BANGLADESH%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

|-------------------------------------------------------------------------------------------------*/

#include <algorithm>

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <string>

#include <cmath>

#include <list>

#include <map>

#include <fstream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <bitset>

#include <cctype>

#include <vector>

#include <complex>

#include <ctime>

#include <deque>

#include <memory>

#include <utility>



#define S(a) scanf("%d",&a)

#define SL(a) scanf("%ld",&a)

#define S2(a,b) scanf("%d%d",&a,&b)

#define SL2(a,b) scanf("%ld%ld",&a,&b)

#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define SL3(a,b,c) scanf("%ld%ld%ld",&a,&b,&c)

#define SLL(a) scanf("%lld",&a)

#define SLL2(a,b) scanf("%lld%lld",&a,&b)

#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)

#define SS(a) scanf("%s",a)

#define SC(a) scanf("%c",&a)

#define SD(a) scanf("%lf",&a)

#define P(a) printf("%d",a)

#define PL(a) printf("%ld",a)

#define PLL(a) printf("%lld",a)

#define PD(a) printf("%lf",a)

#define PC(a) printf("%c",a)

#define PS(a) printf("%s",a)

#define CS(kk) printf("Case %ld: ",kk++)

#define NL(kk) printf("\n")

#define PI 3.14159265358979323846264338327950

#define eps 1e-9

#define MAX(a,b) (a>b?a:b)

#define MIN(a,b) (a<b?a:b)



using namespace std;



long long gcd(long long  a,long long b)

{

while(b>0)

{

a=a%b;

a=a^b;

b=b^a;

a=a^b;

}

return a;

}



long long lcm(long a,long long b)

{

    long long x=(a*b)/gcd(a,b);

    return x;

}

int main()

{

    long long i,ii,l,p,s,n,ll;

    long long a,b,c;

    //cin>>n;

    while(cin>>a>>b)

    {

     l=gcd(a,b);

     ll=lcm(a,b);

     cout<<l<<" "<<ll<<endl;

    }

 return 0;

}

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

int main()

{

    long long a,b,c;

    while(~scanf("%lld%lld",&a,&b))

    {

        long long x=a,y=b;

        c=a%b;

        while(c)

        {

            a=b;

            b=c;

            c=a%b;

        }

        printf("%lld %lld\n",b,x*y/b);

    }

    return 0;

}
// Slower C++ solution:
/*------------------------------------------------------------------------------------------------|

| %%%%%%%%%%%%%%%%%%%%%%%%%MD.ASANURJAMAL ANOWAR HOSSAIN ANU%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%COMPUTER SCIENCE AND ENGINEERING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%ISLAMIC UNIVERSITY KUSHTIA%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%BANGLADESH%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

|-------------------------------------------------------------------------------------------------*/

#include <algorithm>

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <string>

#include <cmath>

#include <list>

#include <map>

#include <fstream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <bitset>

#include <cctype>

#include <vector>

#include <complex>

#include <ctime>

#include <deque>

#include <memory>

#include <utility>



#define S(a) scanf("%d",&a)

#define SL(a) scanf("%ld",&a)

#define S2(a,b) scanf("%d%d",&a,&b)

#define SL2(a,b) scanf("%ld%ld",&a,&b)

#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define SL3(a,b,c) scanf("%ld%ld%ld",&a,&b,&c)

#define SLL(a) scanf("%lld",&a)

#define SLL2(a,b) scanf("%lld%lld",&a,&b)

#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)

#define SS(a) scanf("%s",a)

#define SC(a) scanf("%c",&a)

#define SD(a) scanf("%lf",&a)

#define P(a) printf("%d",a)

#define PL(a) printf("%ld",a)

#define PLL(a) printf("%lld",a)

#define PD(a) printf("%lf",a)

#define PC(a) printf("%c",a)

#define PS(a) printf("%s",a)

#define CS(kk) printf("Case %ld: ",kk++)

#define NL(kk) printf("\n")

#define PI 3.14159265358979323846264338327950

#define eps 1e-9

#define MAX(a,b) (a>b?a:b)

#define MIN(a,b) (a<b?a:b)



using namespace std;



long long gcd(long long  a,long long b)

{

while(b>0)

{

a=a%b;

a=a^b;

b=b^a;

a=a^b;

}

return a;

}



long long lcm(long a,long long b)

{

    long long x=(a*b)/gcd(a,b);

    return x;

}

int main()

{

    long long i,ii,l,p,s,n,ll;

    long long a,b,c;

    //cin>>n;

    while(cin>>a>>b)

    {

     l=gcd(a,b);

     ll=lcm(a,b);

     cout<<l<<" "<<ll<<endl;

    }

 return 0;

}

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

#include<math.h>

long long int g_c_d(long long int a,long long int b);

int main()

{

    long long int lcm,gcd,a,b,product;

    while(scanf("%lld %lld",&a,&b)==2)

    {

        gcd=g_c_d(a,b);

        product=a*b;

        lcm=product/gcd;

        printf("%lld %lld\n",gcd,lcm);

    }

    return(0);

}

long long int g_c_d(long long int a,long long int b)

{

    long long int r;

    if((a%b)==0)

    {

        return(b);

    }

    else

    {

        r=a%b;

        return(g_c_d(b,r));

    }

}
// Slower C++ solution:
/*------------------------------------------------------------------------------------------------|

| %%%%%%%%%%%%%%%%%%%%%%%%%MD.ASANURJAMAL ANOWAR HOSSAIN ANU%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%COMPUTER SCIENCE AND ENGINEERING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%ISLAMIC UNIVERSITY KUSHTIA%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

| %%%%%%%%%%%%%%%%%%%%%%%%%BANGLADESH%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |

|-------------------------------------------------------------------------------------------------*/

#include <algorithm>

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <string>

#include <cmath>

#include <list>

#include <map>

#include <fstream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <bitset>

#include <cctype>

#include <vector>

#include <complex>

#include <ctime>

#include <deque>

#include <memory>

#include <utility>



#define S(a) scanf("%d",&a)

#define SL(a) scanf("%ld",&a)

#define S2(a,b) scanf("%d%d",&a,&b)

#define SL2(a,b) scanf("%ld%ld",&a,&b)

#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define SL3(a,b,c) scanf("%ld%ld%ld",&a,&b,&c)

#define SLL(a) scanf("%lld",&a)

#define SLL2(a,b) scanf("%lld%lld",&a,&b)

#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)

#define SS(a) scanf("%s",a)

#define SC(a) scanf("%c",&a)

#define SD(a) scanf("%lf",&a)

#define P(a) printf("%d",a)

#define PL(a) printf("%ld",a)

#define PLL(a) printf("%lld",a)

#define PD(a) printf("%lf",a)

#define PC(a) printf("%c",a)

#define PS(a) printf("%s",a)

#define CS(kk) printf("Case %ld: ",kk++)

#define NL(kk) printf("\n")

#define PI 3.14159265358979323846264338327950

#define eps 1e-9

#define MAX(a,b) (a>b?a:b)

#define MIN(a,b) (a<b?a:b)



using namespace std;



long long gcd(long long  a,long long b)

{

while(b>0)

{

a=a%b;

a=a^b;

b=b^a;

a=a^b;

}

return a;

}



long long lcm(long a,long long b)

{

    long long x=(a*b)/gcd(a,b);

    return x;

}

int main()

{

    long long i,ii,l,p,s,n,ll;

    long long a,b,c;

    //cin>>n;

    while(cin>>a>>b)

    {

     l=gcd(a,b);

     ll=lcm(a,b);

     cout<<l<<" "<<ll<<endl;

    }

 return 0;

}

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

#define LL long long

LL GCD(LL a,LL b)

{

    return b==0?a:GCD(b,a%b);

}

int main()

{

    LL a,b;

    while(scanf("%lld%lld",&a,&b)!=EOF)

    {

        LL c=GCD(a,b);

        printf("%lld %lld\n",c,a/c*b);

    }

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

long long GCD(long long a,long long b)

{

    if(a==0&&b==0)

        return 0;

    if(a==0) return 1;

    if(b==0) return a;

    else return GCD(b,a%b);

}

int main()

{

    long long x,y;

    while(cin>>x>>y)

    {

        long long ans1=GCD(x,y);

        long long ans2=(x*y)/ans1;

        cout<<ans1<<" "<<ans2<<"\n";

    }

	return 0;

}

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

#define LL long long

LL GCD(LL a,LL b)

{

    return b==0?a:GCD(b,a%b);

}

int main()

{

    LL a,b;

    while(scanf("%lld%lld",&a,&b)!=EOF)

    {

        LL c=GCD(a,b);

        printf("%lld %lld\n",c,a/c*b);

    }

    return 0;

}