akhauriyash/Code-Regression huggingface dataset:
s=input()
t=input()
n = len(s)
m = len(t)
dp=[]
for i in range(n+1):
    dp.append([0]*(m+1))
for i in range(1,n+1):
    for j in range(1,m+1):
        if(s[i-1]==t[j-1]):
            dp[i][j] = 1 + dp[i-1][j-1]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])
ans=""
i=n
j=m
while(i>0 and j>0):
    if(dp[i][j]==dp[i-1][j]):
        i-=1
    elif(dp[i][j]==dp[i][j-1]):
        j-=1
    else:
        ans+=s[i-1]
        i-=1
        j-=1
print(ans[::-1])



Measured memory_bytes: 111708
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int n, y;
	cin >> n >> y;
	for(int i=0; i<=n; i++){
		for(int j=0; j<=n-i; j++){
			int k=n-i-j;
			if(y==10000*i+5000*j+1000*k){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static int q;
    static int n;
    static int m;
    static int[][] queries;
    static long best;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        n = in.intNext();
        m = in.intNext();
        q = in.intNext();
        queries = new int[q][4];

        for (int i = 0; i < q; i++) {
            queries[i] = in.nextIntArray(4);
        }

        int[] nums = new int[n];
        solve(0, 1, nums);
        out.println(best);

        out.close();
    }

    static void solve(int size, int val, int[] nums) {
        if (size == n) {
            long total = 0;
            for (int i = 0; i < q; i++) {
                int a = queries[i][0], b = queries[i][1], c = queries[i][2], d = queries[i][3];
                if (nums[b-1] - nums[a-1] == c) total += d;
            }
            best = Math.max(best, total);
        } else {
            for (int i = val; i <= m; i++) {
                nums[size] = i;
                solve(size + 1, i, nums);
            }
        }
    }


    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 33240
#import"bits/stdc++.h"
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;main(int N){cin>>N;int A[2*N],c[N+1]={},n,t,i;rep(i,2*N)cin>>A[i];rep(i,2*N)c[A[i]]++;if(*max_element(c,c+N+1)>N)cout<<"No";else{cout<<"Yes ";queue<int> s;rep(i,N)if(A[i]==A[N+i])s.push(i);while(!s.empty()){n=s.front(),t=N+rand()%N;s.pop();if(A[n]!=A[t]&A[t-N]!=A[n+N])swap(A[n+N],A[t]);else s.push(n);}rep(i,N)cout<<A[i+N]<<" ";}}

Measured memory_bytes: 6752
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n; cin >> n;

  ll ans = 0;
  for(ll i = 1; i*i <= n; ++i) {
      if(n%i==0) {
          ll j = n/i;
          // m = j-1
          if(j-1 > i) ans += j - 1;
      }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

class Combination:
    def __init__(self, max_n=100007, mod=mod):
        self.mod = mod
        self.fac = [0] * max_n
        self.finv = [0] * max_n
        self.inv = [0] * max_n

        self.fac[0] = 1
        self.fac[1] = 1
        self.finv[0] = 1
        self.finv[1] = 1
        self.inv[1] = 1
        for i in range(2, max_n):
            self.fac[i] = self.fac[i - 1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % self.mod
    
    def choose(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (self.finv[k] * self.finv[n - k] % self.mod) % self.mod


x, y = na()

if (x + y) % 3 != 0:
    print(0)
    exit()

n, m = -1, -1
for i in range(10 ** 6 + 7):
    if (x - i) // 2 + 2 * i == y:
        n = i
        m = (x - i) // 2
        break

if n < 0 or m < 0:
    print(0)
    exit()
c = Combination(10 ** 6 + 7)
print(c.choose(n + m, n) % mod)

Measured memory_bytes: 89036
#include <bits/stdc++.h>
using namespace std;

int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a+b>c+d)printf("Left\n");
  else if(a+b==c+d)printf("Balanced\n");
  else printf("Right\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	int A, B, K; cin >> A >> B >> K;
	int num = 1, ans, minn;
	vector<int> e;
	minn = min(A, B);
	while (true) {
		if (A % num == 0 && B % num == 0) e.push_back(num);
		if (num >= minn)break;
		++num;
	}
	cout << e[e.size() - K] << endl;
	cin >> A;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;
  
int main() {
  int N,M;
  cin >> N >> M;
  cout << N*(N-1)/2 + M*(M-1)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <cmath>
#include <string>
#define N 105
using namespace std;
int flag[N],key[N],dancing[N];
int main (){
    int a,x,ans,ma;string str("");
    while (cin>>a){
        ans=0;ma=0;
        for (int i=0;i<26;i++){
            flag[i]=0;
            key[i]=0;
            dancing[i]=0;
        }
        cin>>str;
        for (int i=0;i<a;i++){
            char x=str.at(i);
            flag[((int)x)-97]++;
            dancing[((int)x)-97]++;
        }
        for (int i=0;i<a;i++){
            char x=str.at(i);
            if (dancing[((int)x)-97]>=2){
                flag[((int)x)-97]--;
                if (flag[((int)x)-97]>0&&key[((int)x-97)]==0){
                    ma++;
                    key[((int)x)-97]++;
                }
                if (flag[((int)x)-97]==0){
                    ma--;
                }
                if (ans<ma){
                    ans=ma;
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($n, $a, $b) = split / /, <STDIN>);
my $ans = 0;
if ($a > $b) {
  $ans = 0;
} elsif ($n == 1) {
  $ans = ($a == $b)?1:0;
} else {
  $ans = ($n - 2) * ($b - $a) + 1;
}
say $ans;

Measured memory_bytes: 768
string = input()
for _ in range(int(input())):
    com = [x for x in input().split()]
    c = com[0]
    a,b = [int(com[i]) for i in range(1,3)]
    if c == 'reverse':
        string = string[:a] + string[a:b+1][::-1] + string[b+1:]
    if c == 'print':
        print(string[a:b+1])
    if c == 'replace':
        string = string[:a] + com[3] + string[b+1:]



Measured memory_bytes: 5620
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <iomanip>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)
#define rad_to_deg(rad) (((rad)/2.0/M_PI)*360.0)
typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    long double a, b, x; cin >> a >> b >> x;
    long double D = a * a * b;
    long double d = (D - x)/ ((a * a) / 2);
    cout << setprecision(10);
    if (d <= b) {
        double r = atan(d/a);
        double ans = r * (180.0 / M_PI); 
        cout << ans << endl;
    } else {
        d = (2 * x) / (a * b );
        double r = atan(b/d);
        double ans = r * (180.0 / M_PI); 
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

// DAME: また
int main() {
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    if(k==0){
        ans = pow(n, 2);
        cout << ans << endl;
        return 0;
    }
    // bを固定する
    for(int i=k+1; i<=n; i++){
        ans += (ll)(i-k)*(n/i);
        if(n%i>=k){
            // 実際に書いて見ればわかる
            ans += n%i - k + 1;
        }
    }

    cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int x;
  cin >> x;
  vector <bool> isP(100004, true);
  for (int i = 2; i <= sqrt(100004); i++) {
	  if (isP[i]) {
		  int j = 2 * i;
		  while (j <= 100004) {
			  isP[j] = false;
			  j     += i;
			}
		}
	}
  while (1) {
	  if (isP[x]) {
		  cout << x << endl;
		  break;
		}
	  x++;
	}
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void answer1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void answer2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void answer3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void answer(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}

  struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionset(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findset(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

/*
UnionFind tree(n):0~n-1を初期値としてUnionfindを定義
unionset(x,y): x が入っている集合と y が入っている集合を併合する．
findset(x,y): x と y が同じ集合に入っているかを判定する．
*/   


int main(){
  ll i, j;
  ll n, m;
  cin >> n >> m;
  ll result = 0;
  bool judge = true;
  vector<ll> p(n);
  ll x, y;
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  UnionFind tree(n+1);
  for(i=0;i<m;i++){
    cin >> x >> y;
    tree.unionset(x,y);
  }
  for(i=0;i<n;i++){
    if(tree.findset(p[i],i+1)==true){
      result++;
    }
  }

  cout << result << endl;





  return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	vector<int> a(3);
	for(int i = 0;i<3;++i)cin >> a[i];
	sort(a.begin(),a.end());
	if(a[0]+a[1]==a[2])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
vector<ll> v(1000000,1);
ll func(ll n)
{
    if(n<1000000)
        return(v[n]);
    return(1+2*func(n/2));
}
void solve()
{
    ll n;
    cin>>n;
    for(ll i=2;i<1000000;i++)
    {
        v[i]+=2*v[i/2];
    }
    if(n<1000000)
        cout<<v[n]<<endl;
    else
    {
        cout<<func(n)<<endl;
    }
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
        double l;
        cin >> l;
        printf("%.7f",(l/3) * (l/3) * (l/3))  ;
  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
     
typedef long long lo;
     
template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

#define int long long

#define GG (puts("No"), exit(0))
const int N = 3e5 + 233;
int n, m, q, pre[N], x[N], y[N], c[N], sz[N], cnt;
vector <pair <int, int> > _vec;
inline int find(int x) {
	return pre[x] == x ? x : pre[x] = find(pre[x]);
}

signed main(void) {
	read(n); read(m); read(q);
	rep (i, n) pre[i] = i;
	rep (i, q) {
		read(x[i]); read(y[i]); read(c[i]);
		#ifndef LOCAL
		++x[i]; ++y[i];
		#endif
		if (!c[i]) {
			pre[find(y[i])] = find(x[i]);
			++cnt;
		}
		else _vec.push_back(make_pair(x[i], y[i]));
	}
	if (m == n - 1) return cout << (cnt == q ? "Yes\n" : "No\n"), 0;
	for (auto k : _vec) if (find(k.first) == find(k.second)) GG;
	int cnt = 0;
	rep (i, n) cnt += pre[i] == i;
	if (cnt == 2) GG;
	int up = cnt * (cnt - 1) / 2 - (cnt - 1) + n - 1;
	int down = n;
	cout << (down <= m && m <= up ? "Yes" : "No") << "\n";
}



Measured memory_bytes: 10612
// Cut the Cake
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int w = scanner.nextInt();
			int h = scanner.nextInt();
			if ((n | w | h) == 0) {
				break;
			}
			List<Cake> list = new ArrayList<Cake>();
			list.add(new Cake(w, h));
			for (int i = 0; i < n; i++) {
				int p = scanner.nextInt() - 1;
				Cake oldCake = list.remove(p);
				int width = oldCake.width, height = oldCake.height;
				int l = width * 2 + height * 2;
				int s = scanner.nextInt() % l;
				if (s < width) {
					Cake newCake1 = new Cake(s, height);
					Cake newCake2 = new Cake(width - s, height);
					if (newCake1.width < newCake2.width) {
						list.add(newCake1);
						list.add(newCake2);
					} else {
						list.add(newCake2);
						list.add(newCake1);
					}
				} else if (s < width + height) {
					Cake newCake1 = new Cake(width, s - width);
					Cake newCake2 = new Cake(width, height + width - s);
					if (newCake1.height < newCake2.height) {
						list.add(newCake1);
						list.add(newCake2);
					} else {
						list.add(newCake2);
						list.add(newCake1);
					}
				} else if (s < width * 2 + height) {
					Cake newCake1 = new Cake(s - width + -height, height);
					Cake newCake2 = new Cake(width * 2 + height - s, height);
					if (newCake1.width < newCake2.width) {
						list.add(newCake1);
						list.add(newCake2);
					} else {
						list.add(newCake2);
						list.add(newCake1);
					}
				} else {
					Cake newCake1 = new Cake(width, s - width * 2 - height);
					Cake newCake2 = new Cake(width, l - s);
					if (newCake1.height < newCake2.height) {
						list.add(newCake1);
						list.add(newCake2);
					} else {
						list.add(newCake2);
						list.add(newCake1);
					}
				}
			}
			List<Integer> sList = new ArrayList<Integer>();
			for (Cake cake : list) {
				int s = cake.width * cake.height;
				sList.add(s);
			}
			Collections.sort(sList);
			StringBuilder sb = new StringBuilder();
			for (Integer i : sList) {
				sb.append(" ");
				sb.append(i);
			}
			sb.delete(0, 1);
			System.out.println(sb.toString());
		}
		scanner.close();
	}
}

class Cake {
	int width, height;

	Cake(int w, int h) {
		width = w;
		height = h;
	}
}

Measured memory_bytes: 45060
//    >File Name: 057C.cpp
//    > Author: Webwei

#include<bits/stdc++.h>
#define ll long long
using namespace std;

bool judge(ll x){
	int n=sqrt(x);
	for(int i=2;i<=n;i++){
		if(x%i==0)  return 0;
	}
	return 1;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin>>n;
	stringstream ss;
	string s;	
	if(judge(n))
	{

		ss<<n;
		ss>>s;
		cout<<s.size()<<"\n";
		return 0;
	}
	for(ll i=sqrt(n); ;i--){
		if(n%i==0){
			ll m=n/i;
			ss<<m;
			ss>>s;
			cout<<s.size()<<"\n";
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    cout << (n - 2) * 180 << endl;
    return 0;
}



Measured memory_bytes: 256
import numpy as np
n, k = map(int, input().split())
p = list(map(int, input().split()))

"""
各pの期待値を算出
p期待値について累積和を出す
最大部分和を出す
"""

p_ex = [0] * n

for i in range(n):
    p_ex[i] = (1 + p[i])/2
p_ruiseki = np.cumsum(p_ex)

maxsum = p_ruiseki[k-1]
for i in range(k, n):
    if maxsum < p_ruiseki[i] - p_ruiseki[i-k]:
        maxsum = p_ruiseki[i] - p_ruiseki[i-k]
print(maxsum)

# ruiseki_p = np.cumsum(p)
# maxsum = ruiseki_p[k-1]
# maxindex = -1

# for i in range(k, n):
#     if maxsum < ruiseki_p[i] - ruiseki_p[i-k]:
#         maxsum = ruiseki_p[i] - ruiseki_p[i-k]
#         maxindex = i

# # print(maxsum)
# # print(maxindex)
# # print("---------------")

# ans = 0
# div = 1
# hoge = [[]] * k

# for i in range(k):
#     div *= p[maxindex - i]
#     # print(p[maxindex - i])
#     for j in range(p[maxindex - i]):
#         hoge[i].append(j)


# # print(div)
# # print(hoge)
# print("---------------")


# for i in range(1, p[maxindex-2]+1):
#     for j in range(1, p[maxindex-1]+1):
#         for k in range(1, p[maxindex]+1):
#             ans += (i + j + k) / div
# print(ans)

# # a = [1,2]
# # b = [1,2,3,4]
# # c = [1,2,3,4,5]
# # ex = 0

# # for i in range(2):
# #     for j in range(4):
# #         for k in range(5):
# #             ex += (a[i] + b[j] + c[k])/40

# # print(ex)

Measured memory_bytes: 33924
/*
在太阳西斜的这个世界里
置身天上之森。
等这场战争结束之后
不归之人与望眼欲穿的众人
人人本着正义之名
长存不灭的过去
逐渐消逝的未来
我回来了
纵使日薄西山
即便看不到未来
此时此刻的光辉
盼君勿忘
*/

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

string s;
 
int main(){
    cin>>s;
    if(s[s.size()-1]=='s') cout<<s<<"es";
    else cout<<s<<"s";
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		if(s.endsWith("s")) {
			System.out.println(s+"es");
		}else {
			System.out.println(s+"s");
			
		}
	}
}


Measured memory_bytes: 38416
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




int main(){
    int n,k; cin>>n>>k;
    int ans=0;
    rep(i,n){
        int a; cin>>a;
        ans+=min(a,k-a)*2;
    }
    cout<< ans <<endl;
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main(){
  string s;cin>>s;
  int ssz=s.size();
  int ctr=(s[0]=='S'?1:-1);
  int res=0;
  rep(i,ssz-1){
    if(s[i+1]=='S'&&s[i]=='T'){
      if(ctr<0){
        res+=-ctr;ctr=0;
      }
      ctr++;
    }
    else{
      if(s[i+1]=='S')ctr++;
      else ctr--;
    }
  }
  cout<<res+abs(ctr)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const long long inf=0x3f3f3f3f3f3f3f3f;
long long n,s;
inline long long f(long long x,long long n) {
    long long ret=0;
    while (n) {
        ret+=n%x;
        n/=x;
    }
    return ret;
}
int main()
{
    cin>>n>>s;
    if (s>n) return cout<<-1<<endl,0;
    long long qn=sqrt(n+0.5);
    for (long long i=2;i<=qn;++i)
        if (i<=n&&f(i,n)==s) {
            cout<<i<<endl;
            return 0;
        }
    if (n==s) {
        cout<<n+1<<endl;
        return 0;
    }
    long long mmin=inf;
    for (long long i=1;i<=qn;++i)
        if ((n-s)%i==0) {
            long long b=(n-s)/i+1;
            if (1.0*b*b>n&&f(b,n)==s) mmin=min(mmin,b);
        }
    if (mmin==inf) mmin=-1;
    return cout<<mmin<<endl,0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
    int n;
    cin >> n;
    int total=0;
    vector<int> vec(n);
    rep(i,n){
        int n;
        cin >> n;
        total^=n;
        vec[i]=n;
    }
    rep(i,n){
        int k= total^vec[i];
        cout << k << endl;
    }

}

Measured memory_bytes: 3892
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
/**  '' "\n" ^ **/


typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
int INF=1e9+7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,w;
    sf(n);sf(w);
    ll a[n+1];
    ll b[n+1];
    in(i,n)
    {
        sf(a[i+1]);sf(b[i+1]);
    }
    ll dp[n+1][w+1];
    for(int i=0;i<=n;i++)
        dp[i][0]=0;
    for(int j=0;j<=w;j++)dp[0][j]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(a[i]<=j)
            {
                dp[i][j]=max(b[i]+dp[i-1][j-a[i]],dp[i-1][j]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    /*for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            cout<<dp[i][j];ps();
        }
        cout<<endl;
    }*/
    cout<<dp[n][w]<<endl;
}


Measured memory_bytes: 79104
(println
 (loop [lines (rest (line-seq (clojure.java.io/reader *in*)))
        numbers #{}]
   (if (empty? lines)
     (count numbers)
     (let [n (Long/parseLong (first lines))]
       (recur (rest lines)
              (if (contains? numbers n)
                (disj numbers n)
                (conj numbers n)))))))


Measured memory_bytes: 89932
#include <bits/stdc++.h>
using namespace std;
const long long N=100010;
long long n;
long long d[N];
long long ans,dp[N];
const long long INF=99999999999;
struct cmp
{
	bool operator()(int a,int b)
	{
		return a>b;
	}
};
void LIS()
{
	ans=1;
	dp[1]=d[1];
	for(int k=2;k<=n;k++)
		dp[k]=INF;
	for(int k=2;k<=n;k++)
		if(d[k]<=dp[ans])
			dp[++ans]=d[k];
		else
		{
			int wz=upper_bound(dp+1,dp+1+ans,d[k],cmp())-dp;
			dp[wz]=d[k];
		}
	printf("%lld\n",ans);
}
int main()
{
	scanf("%lld",&n);
	for(long long k=1;k<=n;k++)
		scanf("%lld",&d[k]);
	LIS();
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	ll N, K;
	cin >> N >> K;

	vector<ll> p(N);
	ll max_p = 0;

	for (ll i = 0; i < N; ++i)
	{
		cin >> p[i];
		max_p = max(max_p, p[i]);
	}

	vector<ll> num_sum(max_p + 1);
	vector<double> ex(max_p + 1);

	num_sum[0] = 0;
	ex[0] = 0;
	for (ll i = 1; i <= max_p; ++i)
	{
		num_sum[i] = num_sum[i - 1] + i;
		ex[i] = (double)num_sum[i] / (double)i;

		//cout << i <<": " << num_sum[i] << " " << ex[i] << endl;
	}

	vector<double> exp_list(N);
	for (ll i = 0; i < N; ++i)
	{
		exp_list[i] = ex[p[i]];
	}

	vector<double> csum(N+1);
	csum[0] = 0.0;
	for (ll i = 1; i <= N; ++i)
	{
		csum[i] = csum[i - 1] + exp_list[i - 1];
	}

	double pmax = -1.0;
	for (ll i = 0; i <= N - K; ++i)
	{
		double pp = csum[i + K] - csum[i];
		
		pmax = max(pp, pmax);
		
		//cout << i << ": " << pp << endl;
	}

	cout << pmax << endl;


	//system("pause");
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) cout << a - 1 << endl;
  else cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
typedef  pair<int, int> iPair; 
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
   
}
    
ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}
 
ll minl(ll a,ll b){
    if(a>b)return b;
    return a;
}
 
ll mod = 998244353;
 
ll mulmod(ll a, ll b,ll c){ 
    ll res = 0; 
    a = a % c; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % c;
        }
        a = (a * 2) % c; 
        b /= 2; 
    } 
    return res % c; 
}
 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
} 
 
int a[100005];
int tree[200005];
 
void build(int st,int low,int high){
    if(low==high){
        tree[st] = a[high]%2;
        return;
    }
    int mid = low+(high-low)/2;
    build(2*st,low,mid);
    build(2*st+1,mid+1,high);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
void update(int st,int start,int end,int ind,int val){
    if(start==end){
        tree[st] = val%2;
        return;
    }
    int mid = start+(end-start)/2;
    if(ind<=mid){
        update(2*st,start,mid,ind,val);
    }
    else update(2*st+1,mid+1,end,ind,val);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
int query(int st,int start,int end,int low,int high){
    if(start>high || end<low)return 0;
    int mid = start + (end-start)/2;
    if(start==low && end==high){
        return tree[st];
    }
    if(low>mid)return query(2*st+1,mid+1,end,low,high);
    if(high<=mid)return query(2*st,start,mid,low,high);
    return query(2*st,start,mid,low,mid)+query(2*st+1,mid+1,end,mid+1,high);
}

int main()
{
        ios_base::sync_with_stdio(false);
        ll a,b;
        cin >> a >> b;
        set<ll> fa,fb;
        for(ll i=1;i<=sqrtl(a);i++){
            if(a%i==0){
                fa.insert(i);
                fa.insert(a/i);
            }
        }
        for(ll i=1;i<=sqrtl(b);i++){
            if(b%i==0){
                fb.insert(i);
                fb.insert(b/i);
            }
        }
        int count = 0;
        for(auto it = fa.begin();it!=fa.end();++it){
            if(fb.find(*it)!=fb.end()){
                ll t = *it;
                int found = 0;
                for(int i=2;i<=sqrtl(t);i++){
                    if(t%i==0){
                        found = 1;
                        break;
                    }
                }
                if(!found){
                    count++;
                }
            }
        }
        cout << count << endl;
        return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<string>
using namespace std;

string code(char c)
{
	if(c=='A') return "00000";
	if(c=='B') return "00001";
	if(c=='C') return "00010";
	if(c=='D') return "00011";
	if(c=='E') return "00100";
	if(c=='F') return "00101";
	if(c=='G') return "00110";
	if(c=='H') return "00111";
	if(c=='I') return "01000";
	if(c=='J') return "01001";
	if(c=='K') return "01010";
	if(c=='L') return "01011";
	if(c=='M') return "01100";
	if(c=='N') return "01101";
	if(c=='O') return "01110";
	if(c=='P') return "01111";
	if(c=='Q') return "10000";
	if(c=='R') return "10001";
	if(c=='S') return "10010";
	if(c=='T') return "10011";
	if(c=='U') return "10100";
	if(c=='V') return "10101";
	if(c=='W') return "10110";
	if(c=='X') return "10111";
	if(c=='Y') return "11000";
	if(c=='Z') return "11001";
	if(c==' ') return "11010";
	if(c=='.') return "11011";
	if(c==',') return "11100";
	if(c=='-') return "11101";
	if(c=='\'') return "11110";
	if(c=='?') return "11111";
}

char encode(string c)
{
	if(c=="101") return ' ';
	if(c=="000000") return '\'';
	if(c=="000011") return ',';
	if(c=="10010001") return '-';
	if(c=="010001") return '.';
	if(c=="000001") return '?';
	if(c=="100101") return 'A';
	if(c=="10011010") return 'B';
	if(c=="0101") return 'C';
	if(c=="0001") return 'D';
	if(c=="110") return 'E';
	if(c=="01001") return 'F';
	if(c=="10011011") return 'G';
	if(c=="010000") return 'H';
	if(c=="0111") return 'I';
	if(c=="10011000") return 'J';
	if(c=="0110") return 'K';
	if(c=="00100") return 'L';
	if(c=="10011001") return 'M';
	if(c=="10011110") return 'N';
	if(c=="00101") return 'O';
	if(c=="111") return 'P';
	if(c=="10011111") return 'Q';
	if(c=="1000") return 'R';
	if(c=="00110") return 'S';
	if(c=="00111") return 'T';
	if(c=="10011100") return 'U';
	if(c=="10011101") return 'V';
	if(c=="000010") return 'W';
	if(c=="10010010") return 'X';
	if(c=="10010011") return 'Y';
	if(c=="10010000") return 'Z';

	return '*';
}

int main()
{
	string in;
	while(getline(cin,in)) 
	{
		string co="";
		for(int i = 0; i < in.size(); ++i)
		{
			co+=code(in[i]);
		}
		string tmp="",ans="";
		for(int i = 0; i < co.size(); ++i)
		{
			tmp+=co[i];
			if(encode(tmp)!='*')
			{
				ans+=encode(tmp);
				tmp="";
			}
		}
		cout<<ans<<endl;
	}
  return 0;
}

Measured memory_bytes: 1188
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	double ans = w / 2 * h;
	bool ok = (x == w/2 && y == h/2);
	cout << fixed << setprecision(12) << ans << " " << (ok ? "1" : "0") << endl;
	return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < n;i++)
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> cp(a);
    sort(cp.begin(),cp.end());
    int max1 = cp[n-1];
    int max2 = cp[n-2];
    rep(i,n){
        if(a[i]==max1){
            cout << max2 << endl;
        }else{
            cout << max1 << endl;
        }
    }
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long int lli;

int main()
{
	fio;
	int n;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++) cin>>h[i];
	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for(int i=2;i<n;i++)
	{
		//cout<<i<<" "<<dp[i-2]+abs(h[i-2]-h[i])<<" "<<dp[i-1]+abs(h[i-1]-h[i])<<endl;
		dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]));
	}
	cout<<dp[n-1]<<endl;
	cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int ans = 0;
  for (auto s : S) {
    if (s == '+')
      ans++;
    else if (s == '-')
      ans--;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int h[1500001]={},w[1500001]={},n,m,i,j,p[1500],k;
int main(){
  while(1){
    cin>>n>>m;if(n==0)break;
    for(i=0;i<n;i++){
      cin>>p[i];
      for(j=i,k=0;j>=0;j--)k+=p[j],h[k]++;
    }
    n=k;
    for(i=0;i<m;i++){
      cin>>p[i];
      for(j=i,k=0;j>=0;j--)k+=p[j],w[k]++;
    }
    if(k<n)k=n;
    n=0;
    for(i=1;i<=k;i++)n+=h[i]*w[i],h[i]=w[i]=0;
    cout<<n<<endl;
  }
  return 0;
}

Measured memory_bytes: 7248
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]

table = {i: [10**10]*(10**5+1) for i in range(N+1)}
table[0][0] = 0
def dp(N, V):
  for i in range(1, N+1):
    w, v = items[i-1]
    for j in range(V+1):
      table[i][j] = min(table[i-1][j-v]+w, table[i-1][j])
  for k in range(V, 0, -1):
    if table[N][k] <= W:
      return k

print(dp(N, 10**5))


Measured memory_bytes: 118768
#include <iostream>
#include <string>
#include<iomanip>
#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
/*bool isPrime(long long n) 
{ long long i;
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false;
  
    return true; 
}

long long factorial(long long n) 
{    if(n==0||n==1)
     return 1;
     else
     return n*factorial(n - 1);  
} 

long long binarySearch(long long arr[], long long l, long long r, long long x) 
{ 
    while (l <= r) { 
        long long  m = l + (r - l) / 2; 
  
        
        if (arr[m] == x) 
            return m; 
  
      
        if (arr[m] < x) 
            l = m + 1; 
  
       
        else
            r = m - 1; 
    } 
    return -1; 
} 
*/
int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a,ans;
    cin>>a;
      ans=a+(a*a)+(a*a*a);
    cout<<ans<<endl;
   
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> A(N+1),B(N+1,0);
    for (int i=0;i<N;++i) cin >> A[i+1];
    for (int i=N;i>0;--i){
        int cnt=0;
        for (int j=i*2;j<=N;j+=i) cnt^=B[j];
        B[i]=cnt^A[i];
    }
    vector<int> b;
    for (int i=1;i<=N;++i) if (B[i]){
        b.emplace_back(i);
    }
    int s=b.size();
    cout << s << endl;
    for (int i=0;i<s;++i) cout << b[i] << (i!=s-1?' ':'\n');
}

Measured memory_bytes: 3192
#include <iostream>
#include <ios>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>
#include <cassert>

using namespace std;

using i64 = long long;
using P = pair<i64, i64>;

const i64 mod = 1e9 + 7;

int main(){
    i64 h, w;
    cin >> h >> w;
    vector<vector<i64>> a(h, vector<i64>(w));
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            cin >> a[i][j];
        }
    }
    vector<vector<i64>> cnt(h, vector<i64>(w));
    vector<P> u, v;
    for(int i = 0; i < h; ++i){
        if(i % 2 == 0){
            for(int j = 0; j < w - 1; ++j){
                if(a[i][j] % 2){
                    a[i][j]--;
                    a[i][j + 1]++;
                    u.emplace_back(i, j);
                    v.emplace_back(i, j + 1);
                    cnt[i][j]++;
                }
            }
            if(i != h - 1 && a[i][w - 1] % 2){
                a[i][w - 1]--;
                a[i + 1][w - 1]++;
                u.emplace_back(i, w - 1);
                v.emplace_back(i + 1, w - 1);
            }
        }else{
            for(int j = w - 1; j >= 1; --j){
                if(a[i][j] % 2){
                    a[i][j]--;
                    a[i][j - 1]++;
                    u.emplace_back(i, j);
                    v.emplace_back(i, j - 1);
                    cnt[i][j]++;
                }
            }
            if(i != h - 1 && a[i][0] % 2){
                a[i][0]--;
                a[i + 1][0]++;
                u.emplace_back(i, 0);
                v.emplace_back(i + 1, 0);
            }
        }
        
    }
    assert(u.size() <= h * w);
    cout << u.size() << endl;
    for(int i = 0; i < u.size(); ++i){
        cout << u[i].first + 1 << " " << u[i].second + 1 << " " << v[i].first + 1 << " " << v[i].second + 1 << endl;
    }
}

Measured memory_bytes: 10044
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (auto&& e : a[i]) cin >> e;
  }
  auto res = inf<int>;
  for (int bt = 0; bt < 1 << n; ++bt) {
    int nc = 0;
    vector<int> b(m);
    for (int i = 0; i < n; ++i) {
      if (bt >> i & 1) {
        nc += c[i];
        for (int j = 0; j < m; ++j) {
          b[j] += a[i][j];
        }
      }
    }
    if (*min_element(begin(b), end(b)) >= x) {
      res = min(res, nc);
    }
  }
  if (res == inf<int>) {
    res = -1;
  }
  cout << res << '\n';
}


Measured memory_bytes: 3624
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 2000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
std::vector<bool> IsPrime;

void sieve(size_t max) {
	if (max + 1 > IsPrime.size()) {     // resizeで要素数が減らないように
		IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
	}
	IsPrime[0] = false; // 0は素数ではない
	IsPrime[1] = false; // 1は素数ではない

	for (size_t i = 2; i * i <= max; ++i) // 0からsqrt(max)まで調べる
		if (IsPrime[i]) // iが素数ならば
			for (size_t j = 2; i * j <= max; ++j) // (max以下の)iの倍数は
				IsPrime[i * j] = false;      // 素数ではない
}
int main() {
	long long ans = 0, counter = 0, maxi = -1, mini = INF, pass = 0;
	//new
	char sa;
	cin >> sa;
	cout << (char)(sa + 1) << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int main()
{
string s;
cin >> s;
if(s[s.size()-1]=='s'){s=s+"es";}
else{s=s+"s";}
cout << s <<endl;

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c;
    cout << (a - c) / (b + c) << endl;
    return 0;
}

Measured memory_bytes: 256