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

using namespace std;

int n;

string s,t;

char change(char c)

{

	if(c=='S')

		return 'W';

	else

		return 'S';

}

bool ok(char a,char x,char y,char b)

{

	if(x=='o'&&y=='S'&&a=='S'&&b=='S')return true;

	if(x=='o'&&y=='S'&&a=='W'&&b=='W')return true;

	if(x=='x'&&y=='S'&&a=='S'&&b=='W')return true;

	if(x=='x'&&y=='S'&&a=='W'&&b=='S')return true;

	if(x=='o'&&y=='W'&&a=='S'&&b=='W')return true;

	if(x=='o'&&y=='W'&&a=='W'&&b=='S')return true;

	if(x=='x'&&y=='W'&&a=='S'&&b=='S')return true;

	if(x=='x'&&y=='W'&&a=='W'&&b=='W')return true; 

	return false;

}

void dfs(int now)

{

	if(now==n-1)

	{

		if(ok(t[n-2],s[n-1],t[n-1],t[0])&&ok(t[n-1],s[0],t[0],t[1]))

		{

			cout<<t<<endl;

			exit(0);

		}

		return;

	}

	int bef=now-1;

	int nxt=now+1;

	if(t[now]=='S')

	{

		if(s[now]=='x')t[nxt]=change(t[bef]);

		else t[nxt]=t[bef];

	}

	else

	{

		if(s[now]=='o')t[nxt]=change(t[bef]);

		else t[nxt]=t[bef];

	}

	dfs(now+1);

}

int main()

{

	cin>>n;

	cin>>s;

	t=s;

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

	{

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

		{

			t[0]=(i==0?'S':'W');

			t[1]=(j==0?'S':'W');

			dfs(1);

		}

	}

	cout<<"-1\n";

	return 0;

}

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

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

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

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

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

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

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

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

#define maxs 220020

#define mme(i,j) memset(i,j,sizeof(i))

#define ll long long

using namespace std;

bool vis[maxs];

char s[maxs];

bool check(int x,int y,int len){

    vis[0]=x;

    vis[1]=y;

    for(int i=2;i<=len+1;i++){

        if(vis[i-1]){

            if(s[i-1]=='o') vis[i]=vis[i-2];

            else vis[i]=!vis[i-2];

        }else{

            if(s[i-1]=='o') vis[i]=!vis[i-2];

            else vis[i]=vis[i-2];

        }

    }

    if(vis[len]==vis[0]&&vis[len+1]==vis[1]){

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

            if(vis[i])

                printf("S");

            else

                printf("W");

        }

        puts("");

        return 1;

    }

    return 0;

}



int main()

{

    int n;

    while(~scanf("%d",&n)){

        scanf("%s",s);

        int len=n;

        s[len]=s[0];

        s[len+1]=s[1];

        s[len+2]='\0';

        bool fl=0;

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

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

                if(check(i,j,len) )

                   {

                       fl=1;

                        break;

                   }

            }

            if(fl) break;

        }

        if(!fl)

            puts("-1");

    }

    return 0;

}

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

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

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

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

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

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

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

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

using namespace std;



int zz[100005],n;

char dat[100005];



bool check(){

	if(!((dat[0]=='x')==zz[1]^zz[n-1]^zz[0])) return false;

	if(!((dat[n-1]=='x')==zz[n-2]^zz[n-1]^zz[0])) return false;

	return true;

}



int main(){

	scanf("%d%s",&n,dat);

	

	dat[0];

	

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

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

			zz[1]=i;

			zz[0]=j;

			for(int k=1;k<n-1;k++)

				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');

			if(check()){

				for(int k=0;k<n;k++) printf("%c",zz[k]?'W':'S');

				return 0;

			}

		}

	}

	

	printf("-1\n");

	return 0;

} 

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

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

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

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

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

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

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

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

using namespace std;

string s;

int n;

bool sp[100000];//0羊,1狼 

bool ok;

int main()

{

	cin>>n>>s;

	for(int f=0;f<2;f++)

	{

		for(int e=0;e<2;e++)

		{

			sp[0]=f;

			sp[1]=e;

			for(int l=2;l<n;l++)

			{

				if(sp[l-1])

				{

					if(s[l-1]=='x')sp[l]=sp[l-2];

					else if(s[l-1]=='o')sp[l]=1^sp[l-2];

				}

				else 

				{

					if(s[l-1]=='x')sp[l]=1^sp[l-2];

					else if(s[l-1]=='o')sp[l]=sp[l-2];

				}

			}

			if(sp[0]==1&&((s[0]=='o'&&sp[n-1]!=sp[1])||(s[0]=='x'&&sp[n-1]==sp[1])))

			{

				if(sp[n-1]==1&&((s[n-1]=='o'&&sp[n-2]!=sp[0])||(s[n-1]=='x'&&sp[n-2]==sp[0])))ok=1;

				else if(sp[n-1]==0&&((s[n-1]=='o'&&sp[n-2]==sp[0])||(s[n-1]=='x'&&sp[n-2]!=sp[0])))ok=1;

			}

			else if(sp[0]==0&&((s[0]=='o'&&sp[n-1]==sp[1])||(s[0]=='x'&&sp[n-1]!=sp[1])))

			{

				if(sp[n-1]==1&&((s[n-1]=='o'&&sp[n-2]!=sp[0])||(s[n-1]=='x'&&sp[n-2]==sp[0])))ok=1;

				else if(sp[n-1]==0&&((s[n-1]=='o'&&sp[n-2]==sp[0])||(s[n-1]=='x'&&sp[n-2]!=sp[0])))ok=1;

			}

			if(ok)

			{

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

				{

					if(sp[i])cout<<"W";

					else cout<<"S";

				}

				return 0;

			}

		}

	}

	cout<<"-1";

	return 0;

}

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

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

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

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

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

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

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

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

using namespace std;

const int M=1e6;

int a[M];

int main(){

	int n;

	string s;

	cin>>n>>s;

	s+=s;

	for(int i1=0;i1<2;i1++){

		for(int i2=0;i2<2;i2++){

			a[0]=i1;a[1]=i2;

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

				if(s[i-1]=='o'&&a[i-1]==0) a[i]=1-a[i-2];

				if(s[i-1]=='o'&&a[i-1]==1) a[i]=a[i-2];

				if(s[i-1]=='x'&&a[i-1]==0) a[i]=a[i-2];

				if(s[i-1]=='x'&&a[i-1]==1) a[i]=1-a[i-2];

			}

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

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

					cout<<(a[i]?'S':'W');

				}

				return 0;

			}

		}

	}

	cout<<-1<<endl;

	return 0;

} 

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

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

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

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

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

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

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

using namespace std;



char s[100005],ans[100005];

int n;



int main(){

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

	char tmp;

	bool f=false;

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

		if(i/2==0) ans[0]='S';

		else ans[0]='W';

		if(i%2==0) ans[1]='S';

		else ans[1]='W';

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

			tmp=s[j-1];

			if(ans[j-1]=='W') tmp='o'+'x'-tmp;

			if(tmp=='o') ans[j]=ans[j-2];

			else ans[j]='S'+'W'-ans[j-2];

		}

		if(ans[n-2]==ans[0]) tmp='o';

		else tmp='x';

		if(ans[n-1]=='W') tmp='o'+'x'-tmp;

		if(s[n-1]!=tmp) continue;

		if(ans[n-1]==ans[1]) tmp='o';

		else tmp='x';

		if(ans[0]=='W') tmp='o'+'x'-tmp;

		if(s[0]!=tmp) continue;

		f=true;

		break;

	}

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

	else printf("%s\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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");

	}

}

// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: