#include using namespace std; #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define lfs <= (ll)(m); i--) typedef long long ll; typedef long double ld; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>v,ll h,ll w){for(ll i=0;iv,ll h,ll w){for(ll i=0;i void debug(vectorv,ll n){cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} template void emp(map&m, T x){m.emplace(x,0).first->second++;} int main(){ cin.tie(NULL); ios_base::sync_with_stdio(false); ll res=0,res1=INF,res2=-INF,buf=0; bool judge = true; ll n;cin>>n; vector

dp(n+1,MP(INF,-1)); dp[0]=MP(0,0); rep(i,0,n){ for(ll j=1;i+j*j<=n;j++){ if(dp[i+j*j].fi>=dp[i].fi+j){ if(dp[i+j*j].fi==dp[i].fi+j){ ll x=dp[i+j*j].se; if(j%2==1){ if(jeven,odd; buf=n; while(buf!=0){ ll x=dp[buf].se; if(x%2==0)even.push_back(x); else odd.push_back(x); buf-=x*x; } sort(ALL(odd)); sort(ALL(even)); string s; //debug(odd,odd.size()); //debug(even,even.size()); rep(i,0,odd.size()){ ll x=odd[i]; rep(j,0,x){ if(j%2==0)s+='0'; else s+='1'; } } ll l=0,r=(ll)even.size()-1; while(1){ if(r