akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;
constexpr char newl = '\n';

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define F first
//#define S second
#define debug(x) cout << #x << ": " << x << '\n';

#if 1

template<typename F>
struct FixPoint : F {
  FixPoint(F&& f) :F(forward<F>(f)) {}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const {
    return F::operator()(*this, forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f) {
  return FixPoint<F>{forward<F>(f)};
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cout << std::fixed << std::setprecision(15);

  int N;
  cin >> N;
  vector<int> A(3, 0);
  F0R(i, N) {
    int a;
    cin >> a;
    A[--a]++;
  }

  vector<vector<vector<double>>> dp(A[0]+A[1]+A[2]+1,
    vector<vector<double>>(A[1]+A[2]+1, vector<double>(A[2]+1, -1)));
  dp[0][0][0] = 0;

  MFP([&](auto dfs, int d1, int d2, int d3)->double {

    if (dp[d1][d2][d3] >= 0) return dp[d1][d2][d3];

    //cout << d1 << ' ' << d2 << ' ' << d3 << newl;

    vector<pair<double, double>> results;

    int samples = d1 + d2 + d3;
    if (d1 > 0) {
      results.emplace_back((double)d1 / N, (double)N / samples + dfs(d1 - 1, d2, d3));
    }
    if (d2 > 0) {
      results.emplace_back((double)d2 / N, (double)N / samples + dfs(d1 + 1, d2 - 1, d3));
    }
    if (d3 > 0) {
      results.emplace_back((double)d3 / N, (double)N / samples + dfs(d1, d2 + 1, d3 - 1));
    }

    if (results.size() == 1) {
      //debug(results[0].second);
      return dp[d1][d2][d3] = results[0].second;
    }
    else {
      assert(results.size() > 0);

      double result = 0, sum = 0;
      for (auto p : results) {
        sum += p.first;
      }
      for (auto p : results) {
        //cout << p.first << ' ' << p.second << newl;
        result += p.first * p.second / sum;
      }
      //debug(result);
      return dp[d1][d2][d3] = result;
    }

  })(A[0], A[1], A[2]);

  cout << dp[A[0]][A[1]][A[2]];
}
#endif


Measured memory_bytes: 216960
#include <iostream>

using namespace std;

int main(){
  char newnum[8] = {0,1,2,3,5,7,8,9};
  long input_num;

  int count_num;
  while(cin >> input_num && input_num != 0){
    //    output_num = 0;
    count_num = 0;
  long output_num[13]={0};
    while(input_num != 0){
      output_num[count_num] = newnum[input_num % 8];
      input_num /= 8;
      //      cout << output_num << " " ;
      count_num++;
    }
    for(int j=count_num;j>0;j--){
      output_num[j-1] += output_num[j] * 10;
      //      cout << output_num[j] << " ";
    }

    cout << output_num[0];
    cout << endl;
  }

}

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

typedef vector<int> vi;
#define ll long long
#define PI 3.14159265359
#define x first
#define y second
#define point pair<int,int>
#define clr(x, val)	memset((x), (val), sizeof(x))

//you don't know math, unless you can do math!
string s,t;
int dp[3009][3009];
int solve(int i, int j){
    if(i == s.length() || j == t.length())
        return 0;

    int &ret = dp[i][j];
    if(ret != -1)
        return ret;

    if(s[i] == t[j])
        return ret = 1 + solve(i + 1, j + 1);

    return ret = max(solve(i + 1, j), solve(i, j + 1));
}

void trace(int i, int j){
    if(i == s.length() || j == t.length())
        return;
    if(s[i] == t[j]){
        cout<<s[i];
        trace(i + 1, j + 1);
        return;
    }

    int ch1 = solve(i, j + 1);
    int ch2 = solve(i + 1, j);

    int optimal = solve(i, j);
    if(optimal == ch1)
        trace(i, j + 1);
    else
        trace(i + 1, j);
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    clr(dp, -1);
    cin>>s>>t;
    int ans = solve(0, 0);
    trace(0, 0);
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> dp(n);
    fill(dp.begin(), dp.end(), 0x3f3f3f3f);
    dp[0] = 0;
    for (int i = 0; i < a.size() - 1; i++) {
        if (i <= a.size() - 2) {
            dp[i+2] = min(dp[i+2], dp[i] + abs(a[i] - a[i+2]));
        }
        dp[i+1] = min(dp[i+1], dp[i] + abs(a[i] - a[i+1]));
    }
    cout << dp.back();
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
const long long inf=1e18;
struct edge{
    int u,v,w;
    void read(){
        scanf("%d%d%d",&u,&v,&w);
    }
};
long long d[2505];
int n,m,p;
void dfs(int nod,vector<int> *a,bool *vis){
    vis[nod]=true;
    for(auto i:a[nod]){
        if(!vis[i]){
            dfs(i,a,vis);
        }
    }
    return ;
}
bool vis[2][2502];
vector<int> a[2][maxn];


int main(){
    scanf("%d%d%d",&n,&m,&p);
    vector<edge> e(m);
    for(int i=0;i<m;i++){
    e[i].read();
    e[i].w=p-e[i].w;
    a[0][e[i].u].push_back(e[i].v);
    a[1][e[i].v].push_back(e[i].u);
    }
    for(int i=1;i<=n;i++)
        d[i]=inf;
    d[1]=0LL;
    dfs(1,a[0],vis[0]);
    dfs(n,a[1],vis[1]);
    for(int i=1;i<=n;i++){
        for(auto j:e){
            d[j.v]=min(d[j.v],d[j.u]+j.w);
        }
    }
    for(auto j:e){
        if(d[j.v]>d[j.u]+j.w&&vis[0][j.v]&&vis[1][j.v]){
            return !printf("-1");
        }
    }
    printf("%lld\n",max(0LL,-d[n]));
}


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

int main() {
	int a,b,c,d,e;
  	cin>>a>>b>>c>>d>>e;
  	
  	
  	cout<<15-a-b-c-d-e<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    using P = pair<int, int>;
    const vector<int> di = { -1, 0, 1, 0 };
    const vector<int> dj = { 0, 1, 0, -1 };

    int h, w, si, sj, gi, gj;
    cin(h); cin(w); cin(si); cin(sj); cin(gi); cin(gj);
    --si; --sj; --gi; --gj;

    vector<vector<bool>> board(h, vector<bool>(w, false));
    rep2(i, h) rep2(j, w) {
        char temp;
        cin(temp);

        board[i][j] = temp == '.';
    }

    deque<P> dq;

    const int INF = 1e9;
    vector<vector<int>> dist(h, vector<int>(w, INF));

    dist[si][sj] = 0;
    dq.emplace_front(si, sj);

    while (!dq.empty()) {
        int i = dq.front().first;
        int j = dq.front().second;
        dq.pop_front();

        int d = dist[i][j];

        rep2(k, 4) {
            int ni = i + di[k];
            int nj = j + dj[k];

            if (ni < 0 || h <= ni || nj < 0 || w <= nj) continue;
            if (!board[ni][nj]) continue;
            if (dist[ni][nj] <= d) continue;

            dist[ni][nj] = d;
            dq.emplace_front(ni, nj);
        }

        erep3(k, -2, 2) erep3(l, -2, 2) {
            int ni = i + k;
            int nj = j + l;

            if (ni < 0 || h <= ni || nj < 0 || w <= nj) continue;
            if (!board[ni][nj]) continue;
            if (dist[ni][nj] <= d) continue;

            dist[ni][nj] = d + 1;
            dq.emplace_back(ni, nj);
        }
    }

    if (dist[gi][gj] == INF) {
        print(-1);
    } else {
        print(dist[gi][gj]);
    }
    return 0;
}

Measured memory_bytes: 8168
import math

D = int(input())
c = list(map(int, input().split()))
S = []
for i in range(D):
    S.append(list(map(int, input().split())))

nocontest = [1 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c[j] * nocontest[j] * s[j]
    #print(contest)
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for j in range(26):
        if j == ans:
            nocontest[j] = 1
        else:
            nocontest[j] *= 2
    #print(nocontest)

Measured memory_bytes: 9336
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A1 = Integer.parseInt(sc.next());
        int A2 = Integer.parseInt(sc.next());
        int A3 = Integer.parseInt(sc.next());

        if (A1 + A2 + A3 >= 22) {
            System.out.println("bust");
        } else {
            System.out.println("win");
        }
    }
}

Measured memory_bytes: 22228
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

def intersection(p, q, eps = 10**-7):
    x1, y1, r1 = p
    x2, y2, r2 = q
    X = x2 - x1; Y = y2 - y1
    d = X**2 + Y**2
    c1 = r1**2; c2 = r2**2

    rc = (d + c1 - c2) / 2
    rs = d * c1 - rc ** 2
    
    if rs < eps: return list()
    
    rs **= .5
    p1x = x1 + (rc * X + rs * Y) / d
    p1y = y1 + (rc * Y - rs * X) / d
    p2x = x1 + (rc * X + rs * Y) / d
    p2y = y1 + (rc * Y + rs * X) / d
    return [(p1x, p1y), (p2x, p2y)]

eps = 10**-7
n,k = nm()
if k == 1: print(0); exit(0)
niku = [tuple(nm()) for _ in range(n)]
l = [c*(x**2+y**2)**.5 for x,y,c in niku]
l.sort()
hi = l[k-1]
lo = 0
for _ in range(50):
  mid = (hi+lo)/2
  l = [(x,y,mid/c) for x,y,c in niku]
  p = [(x,y) for x,y,c in niku]
  for i in range(n-1):
    for j in range(i+1,n):
      p.extend(intersection(l[i], l[j]))
  for x,y in p:
    f = sum((v-x)**2 + (w-y)**2 <= r**2 + eps for v,w,r in l)
    if f >= k:
      hi = mid
      break
  else:
    lo = mid
print(hi)

Measured memory_bytes: 60124
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    int n, k;
    cin >> n >> k;
    vector<lld> v(n);
    rep(i, n)
    {
        int t;
        cin >> t;
        v[i] = ((lld)(t * (t + 1) / 2)) / (lld)t;
    }
    lld ans = -1;
    lld cur = 0;
    rep(i, k)
    {
        cur += v[i];
    }
    ans = cur;
    rep(i, k, n)
    {
        cur -= v[i - k];
        cur += v[i];
        ans = max(ans, cur);
    }
    cout << fixed << setprecision(20) << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=998244353;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=(1<<14)+5,M=205;
int r[N],rt[2][N<<1],lim,d,ilim;
void NTT(int *A,int ty){
    fp(i,0,lim-1)if(i<r[i])swap(A[i],A[r[i]]);
    for(R int mid=1;mid<lim;mid<<=1)
        for(R int j=0,t;j<lim;j+=(mid<<1))
            fp(k,0,mid-1)
                A[j+k+mid]=dec(A[j+k],t=mul(rt[ty][mid+k],A[j+k+mid])),
                A[j+k]=add(A[j+k],t);
    if(!ty)fp(i,0,lim-1)A[i]=mul(A[i],ilim);
}
int coef[N],fac[N],ifac[N],f[N],g[N],n,m,res;
inline int C(R int n,R int m){return m>n?0:1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
void init(int n=10000){
    fp(i,1,(1<<d)-1)r[i]=(r[i>>1]>>1)|((i&1)<<(d-1));
    for(R int t=(P-1)>>1,i=1,x,y;i<lim;i<<=1,t>>=1){
        x=ksm(3,t),y=ksm(332748118,t),rt[0][i]=rt[1][i]=1;
        fp(k,1,i-1)
            rt[1][i+k]=mul(rt[1][i+k-1],x),
            rt[0][i+k]=mul(rt[0][i+k-1],y);
    }
	fac[0]=ifac[0]=1;fp(i,1,n)fac[i]=mul(fac[i-1],i);
	ifac[n]=ksm(fac[n],P-2);fd(i,n-1,1)ifac[i]=mul(ifac[i+1],i+1);
	coef[0]=0;fp(i,1,lim>>1)coef[i]=ifac[i+2];
	NTT(coef,1);
}
void calc(){
	fp(i,0,n)g[i]=mul(f[i],ifac[i]);fp(i,n+1,lim-1)g[i]=0;
	NTT(g,1);
	fp(i,0,lim-1)g[i]=mul(g[i],coef[i]);
	NTT(g,0);
	fp(i,0,n)f[i]=add(mul(g[i],fac[i+2]),mul(f[i],(i*(i+1)>>1)+1));
//	puts("qwq");
//	fp(i,0,n)printf("%d ",f[i]);
//	puts("");
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	lim=1,d=0;while(lim<=(n<<1))lim<<=1,++d;
	ilim=ksm(lim,P-2);
	init();
	f[0]=1;
//	fp(i,0,n)f[i]=1;
	fp(i,1,m)calc();
	fp(i,0,n)upd(res,mul(C(n,i),f[i]));
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 640
H, N = map(int, input().split())
X = []
for _ in range(N):
    a, b = map(int, input().split())
    X.append((a, b))

Y = [0] + [1<<30] * H
for i in range(H):
    for a, b in X:
        j = min(i+a, H)
        Y[j] = min(Y[j], Y[i] + b)

print(Y[-1])

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> t chmax(t&a,u b){if(a<b)a=b; return a;};
template<class t, class u> t chmin(t&a,u b){if(a>b)a=b; return a;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll N, M;
vll c, s;

bool check1(ll X){
  ll tmp = 0;
  ll X_copy = X;
  while(X_copy>0){
    tmp++;
    X_copy/=10;
  }

  if(tmp==N) return true;
  if(N==1 && tmp==0) return true;
  return false;
}

bool check2(ll X){
  REP(i,M){
    ll X_copy = X;
    REP(j,s[i]) X_copy /= 10;
    if(X_copy%10 != c[i]) return false;
  }
  return true;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N,M);
  c.resize(M);
  s.resize(M);
  REP(i,M) IN(s[i], c[i]);
  REP(i,M) s[i] = N-s[i];

  REP(i,1000){
    if(check1(i) && check2(i)){
      OUT(i);
      return 0;
    }
  }
  OUT(-1);

  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

ts=[0]*n
for indices in range(n),reversed(range(n)):
  t=0
  for i in indices:
    if a[i]==0: t=float("inf")
    if a[i]<0: t=min(t,-a[i])
    if a[i]>0: ts[i]=max(ts[i],min(a[i],t))
    t-=1
print(sum(ts))

Measured memory_bytes: 21584
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
*   创 建 者： badcw
*   创建日期： 2019/12/28
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 1e5+50;
const int mod = 1e9+7;
ll qp(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template <class T>
inline bool scan(T& ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return 0; // EOF
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

//template <class T>
//inline void out(T x) {
//    if (x > 9) out(x / 10);
//    putchar(x % 10 + '0');
//}

ll n, a, b;
int main(int argc, char* argv[]) {
    cin >> n >> a >> b;
    if (a > b) swap(a, b);
    if ((a + b) & 1) {
        ll rest = 0;
        {
            ll at = a, bt = b;
            ll res = at;
            bt = bt - res;
            res += (bt - 1) / 2;
            rest = res;
        }
        {
            ll at = a, bt = b;
            ll res = n - bt + 1;
            at = at + res;
            res += (n - at) / 2;
            rest = min(rest, res);
        }
        printf("%lld\n", rest);
    } else printf("%lld\n", (b - a) / 2);
    return 0;
}

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

ll gcd(ll a, ll b) { 
	if(a<b) std::swap(a, b);//これ加えました なぜかTLEになると思われる
	return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int f(int x) {
  int res = 0;
  while (x%2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}

int main() {//https://atcoder.jp/contests/abc150/submissions/9408616
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  // a -> a'
  rep(i,n) {
    if (a[i]%2 == 1) {
      cout << 0 << endl;
      return 0;
    }
    a[i] /= 2;
  }

  // a' -> a''
  int t = f(a[0]);
  rep(i,n) {
    if (f(a[i]) != t) {
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t; // a[i] /= 2^t
  }
  m >>= t;

  ll l = 1;
  rep(i,n) {
    l = lcm(l, a[i]);
    if (l > m) {
      cout << 0 << endl;
      return 0;
    }
  }

  m /= l;
  int ans = (m+1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3736
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;



int main(){
	int n;
	cin >> n;
	ll x = 1, y = 1,a,b;
	FORI(0,n) {
		cin >> a >> b;
		ll mul = max((a + x - 1) / a, (b + y - 1) / b);
		x = a*mul; y = b*mul;
	}

	cout << x+y << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var b string
	var ret string

	fmt.Scan(&b)

	switch b[0] {
	case 'A':
		ret = "T"
	case 'C':
		ret = "G"
	case 'T':
		ret = "A"
	case 'G':
		ret = "C"
	}

	fmt.Println(ret)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1000000007;
int dp[111][256];
int p[256];
//AGCT
int main(void) {
    int n; scanf("%d",&n);
    if (n==3) {printf("61\n"); return 0; }
    for (int j=0;j<256;j++) p[j]=1;
    for (int j=0;j<4;j++)
        p[16+4*j+2]=p[16*j+6]=p[64*j+6]=p[64*j+9]=p[64*j+18]=p[24+j]=p[36+j]=p[72+j]=0;
    for (int j=0;j<256;j++) dp[4][j]=p[j];
    for (int i=5;i<=n;i++) {
        for (int j=0;j<256;j++) if (p[j]) {
            for (int k=j/4;k<256;k+=64) {
                dp[i][j] = (dp[i][j] + dp[i-1][k]) % mod;
            }
        }
    }
    int ans=0;
    for (int j=0;j<256;j++) ans = (ans+dp[n][j]) % mod;
    printf("%d\n",ans);
    return 0;
}


//AGC ACG GAC
//012 021 102
//AGXC AXGC
//01X2 0X12


Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
  
string s;
cin>>s;

deque<char> deq;

int k=s.size();

rep(i,k) deq.push_back(s[i]);

sort(deq.begin(),deq.end());

deq.erase(unique(deq.begin(),deq.end()),deq.end());

int m=deq.size();

string t="abcdefghijklmnopqrstuvwxyz";

int x,y=0;

for(int i=0;i<26;++i){
x=0;
for(int j=0;j<m;++j){
if(t[i]==deq[j]){++x;}
}
if(x==0){cout<<t[i]<<endl; ++y;break;}
}

if(y==0){cout<<"None"<<endl;}

}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int ans[50004];

int main(void){
    int i, j;
    int n, m;
    int *c;
    int x;

    scanf("%d %d", &n, &m);
    c=calloc(m, sizeof(int));

    for(i=0;i<m;i++){
        scanf("%d", &c[i]);
    }

    memset(ans, 200000, sizeof(ans));
    ans[0]=0;

    for(i=0;i<m;i++){
        for(j=0;j+c[i]<=n;j++){
            x=ans[j]+1;
            if(x<ans[j+c[i]])ans[j+c[i]]=x;
        }
    }

    printf("%d\n", ans[n]);
}


Measured memory_bytes: 2108
/* COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define MOD 998244353
#define debug(x) cout << #x << " = " << x << "\n"

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

void solve()
{
    //code here.
    int n;
    string s;
    cin >> n;
    cin >> s;
    int countw = 0;
    int countr = 0;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'W')
        {
            countw++;
        }
        else
        {
            countr++;
        }
    }
    for (int i = 0; i < countr; i++)
    {
        if (s[i] == 'W')
        {
            count++;
        }
    }
    cout << count;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll T = 1;
    //cin >> T; // If only one test case then you can comment this line out.

    while (T--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3768
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;

struct edge
{
	int a,b;
	LL w;
	edge(int A=0,int B=0,LL W=0)
	{
		a=A;
		b=B;
		w=W;
	}
};

bool operator<(edge a,edge b)
{
	return a.w<b.w;
}



int n,m;
int parent[100005],cnt[100005],bad[100005],ans;
LL sum[100005];
vector<edge> p;

int getParent(int v)
{
	if(parent[v]==v)
		return v;
	return parent[v]=getParent(parent[v]);
}

void dsu(int a,int b)
{
	a=getParent(a);
	b=getParent(b);
	if(a==b)
		return;
	if(cnt[a]<cnt[b])
		swap(a,b);
	sum[a]+=sum[b];
	cnt[a]+=cnt[b];
	bad[a]+=bad[b];
	parent[b]=a;
}

int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		parent[i]=i;
		cnt[i]=1;
		scanf("%lld",sum+i);
	}
	while(m--)
	{
		p.PB(edge());
		scanf("%d%d%lld",&p.back().a,&p.back().b,&p.back().w);
	}

	sort(all(p));
	for(int i=0;i<p.size();i++)
	{
		if(getParent(p[i].a)==getParent(p[i].b))
		{
			if(sum[getParent(p[i].a)]<p[i].w)
				bad[getParent(p[i].a)]++;
		}
		else
		{
			if( sum[getParent(p[i].a)] + sum[getParent(p[i].b)] >= p[i].w)
			{
				bad[getParent(p[i].a)]=0;
				bad[getParent(p[i].b)]=0;
			}
			else
				bad[getParent(p[i].a)]++;			
			dsu(p[i].a,p[i].b);
		}
		
	}

	for(int i=2;i<=n;i++)
		dsu(i,1);
	cout<<bad[getParent(1)]<<endl;
	return 0;
}
 
/*





*/

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

vector<set<int>> ki;
vector<ll> counter;

void f(int v, ll pc, int pv) {
    counter[v] += pc;
    for (auto c : ki[v]) {
        if (c != pv)
            f(c, counter[v], v);
    }
}

int main() {
    fastio;
    ll N,Q;
    cin >> N >> Q;
    ki.resize(N);
    counter.resize(N);
    rep(i,N-1) {
        int a,b;
        cin >> a >> b;
        --a; --b;
        ki.at(a).insert(b);
        ki.at(b).insert(a);
    }
    rep(i,Q) {
        int p,x;
        cin >> p >> x;
        --p;
        counter[p] += x;
    }
    f(0, 0, -1);
    rep(i,N)
        cout << counter[i] << " ";
    cout << endl;
}


Measured memory_bytes: 42228
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

template <class operator_monoid> class dual_segment_tree{
public:
	typedef typename operator_monoid::underlying_type underlying_type;
	typedef typename operator_monoid::value_type value_type;
	size_t n;
	vector<underlying_type> v;
	vector<value_type> w;
	underlying_type e = operator_monoid::unit();
	dual_segment_tree(size_t size){
		n = 1;
		while(n < size) n <<= 1;
		v.resize(2*n, e);
		w.resize(size, operator_monoid::default_value());
	}
	dual_segment_tree(vector<value_type> _w){
		size_t size = w.size();
		n = 1;
		while(n < size) n <<= 1;
		v.resize(2*n, e);
		w(_w);
	}
	void range_operate(underlying_type f, size_t a, size_t b, size_t k, size_t l, size_t r){
		if(r <= a || b <= l) return;
		if(a <= l && r <= b) v[k] = operator_monoid::compose(f, v[k]);
		else{
			if(2*k < v.size())
				v[2*k] = operator_monoid::compose(v[k], v[2*k]);
			if(2*k+1 < v.size())
				v[2*k+1] = operator_monoid::compose(v[k], v[2*k+1]);
			v[k] = operator_monoid::unit();
			range_operate(f, a, b, 2*k, l, (l+r+1)/2);
			range_operate(f, a, b, 2*k+1, (l+r+1)/2, r);
		}
	}
	void range_operate(underlying_type f, size_t a, size_t b){
		range_operate(f, a, b, 1, 0, n);
	}
	value_type point_get(size_t i){
		range_operate(e, i, i+1, 1, 0, n);
		return operator_monoid::operate(v[i+n], w[i]);
	}
};
struct assign_operator_monoid{
	using underlying_type = pair<bool, Int>;
	using value_type = Int;
	static underlying_type unit(){
		return pair<bool, int>(true, 0);
	}
	static underlying_type compose(underlying_type l, underlying_type r){
		if(l == unit()) return r;
		return l;
	}
	static value_type default_value(){
		return 0;
	}
	static value_type operate(underlying_type f, value_type x){
		return f.first ? x : f.second;
	}
};
struct add_operator_monoid{
	using underlying_type = Int;
	using value_type = Int;
	static underlying_type unit(){
		return 0;
	}
	static underlying_type compose(underlying_type l, underlying_type r){
		return l + r;
	}
	static value_type default_value(){
		return 0;
	}
	static value_type operate(underlying_type f, value_type x){
		return f + x;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n, d, a; cin >> n >> d >> a;
	using P = pair<Int, Int>;
	vector<P> v(n);
	for(Int i=0; i<n; ++i)
		cin >> v[i].first >> v[i].second;
	sort(v.begin(), v.end());
	dual_segment_tree<add_operator_monoid> dst(n);
	Int ans = 0;
	for(Int i=0; i<n; ++i){
		Int r = upper_bound(v.begin(), v.end(), P(v[i].first + 2*d, (Int)(1e9+1))) - 1 - v.begin();
		Int l = lower_bound(v.begin(), v.end(), P(v[r].first - 2*d, (Int)0)) - v.begin();
		Int m = (max((Int)0, v[i].second - dst.point_get(i)*a) + a - 1) / a;
		ans += m;
		dst.range_operate(m, l, r+1);
//		cout << i << " " << ans << " " << r << "\n";
//		cout << "dst\n";
//		for(int j=0; j<n; ++j)
//			cout << j << " " << dst.point_get(j) << "\n";
	}
	cout << ans << "\n";
}

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

int a[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int k; cin >> k;
    cout << a[k-1] << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int minIndex2 = 32;
		for(int i = 0 ; i < N ; i ++){
			int A = sc.nextInt();
			int index2 = 0 ;
			
			while(A % 2 == 0){
				A = A /2 ;
				index2 ++ ;
			}
			if(minIndex2 > index2){
				minIndex2 = index2;
			}
		}
		System.out.println(minIndex2);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n,i,j,v,k;
  int A[100]={};
  cin>>n;
  for(i=0;i<n;i++){
    cin>>A[i];
  }
  for(k=0;k<n-1;k++){
    cout<<A[k]<<" ";
  }
  cout<<A[k]<<endl;
  for(i=1;i<n;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    for(k=0;k<n-1;k++){
      cout<<A[k]<<" ";
    }
    cout<<A[k]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3116
#include <iostream>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	for(int i = 0; i < N; ++i)
	{
		int x, y, b, p;
		cin >> x >> y >> b >> p;
		int normal = x * b + y * p;
		int memo[7][7];
		for(int i = 0; i < 7; ++i)
		{
			for(int j = 0; j < 7; ++j)
			{
				memo[i][j] = 9999999;
			}
		}
		for(int i = 5; i < 7; ++i)
		{
			for(int j = 2; j < 7; ++j)
			{
				memo[i][j] = (x * i + y * j) * 0.8;
			}
		}
		int min_price = 99999999;
		if(b <= 5)
		{
			min_price = memo[5][max(2, p)];
		}
		else if(b == 6)
		{
			min_price = memo[6][max(2, p)];
		}
		if(min_price > normal)
		{
			min_price = normal;
		}
		cout << min_price << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] t = new int[n];
        for (int i = 0; i < n; i++) {
            t[i] = in.nextInt();
        }

        int m = in.nextInt();

        for (int i = 0; i < m; i++) {
            int p = in.nextInt();
            int x = in.nextInt();

            int sum = 0;
            for (int j = 0; j < n; j++) {
                if (j + 1 == p) {
                    sum += x;
                } else {
                    sum += t[j];
                }
            }
            System.out.println(sum);
        }
    }

}


Measured memory_bytes: 36248
#include <bits/stdc++.h>
#define INF 1.0e9
using namespace std;
typedef long long ll;

typedef pair<int, int> P;
int N, M;
const int MAX_NM = 1.0e5;
vector<P> vec[MAX_NM];
string ans[MAX_NM];

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int p, y;
        cin >> p >> y;
        vec[p-1].push_back(make_pair(y, i));
    }
    for (int i = 0; i < N; i++) {
        sort(begin(vec[i]), end(vec[i]));
        for(int j = 0; j < vec[i].size(); j++){
            P cur = vec[i][j];
            string str_p = to_string(i+1);
            string str_j = to_string(j+1);
            for(int k = 0; k < 6 - str_p.size(); k++) {
                ans[cur.second] += '0';
            }
            ans[cur.second] += str_p;
            for(int k = 0; k < 6-str_j.size(); k++) {
                ans[cur.second] += '0';
            }
            ans[cur.second] += str_j;
        }
    }
    for (int i = 0; i < M; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12416
/*
  || Shree Ganeshay Namah ||

     || Jai Shree Ram ||
  || Nabh Sparsham Diptam ||
*/
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define mod 1000000007
#define block 180
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f1 first
#define s1 second
int jai_shree_ram()
{
    return 1;
}
int shree_ganeshay_namah()
{
    return 1;
}
ll power(ll x,ll y)
{
    ll r=1;
    while(y>0)
    {
        if(y%2!=0)
            r=r*x;
        x=x*x;
        y=y/2;
    }
    return r;
}
ll ncr(ll n,ll k)
{

    ll c[k+1];
    memset(c,0,sizeof(c));
    c[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=min(i,k);j>0;j--)
            c[j]=c[j]+c[j-1];
    }
    return c[k];
}

bool prime[500001];
void sieve()
{
    ll i,j;
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(i=2;i<=sqrt(100001);i++)
    {
        if(prime[i])
        {
            for(j=i*i;j<=100001;j=j+i)
                prime[j]=false;
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i,j,f=0;
    string s,t;
    cin>>s>>t;
    for(i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
            f++;
    }
    cout<<f;
    return 0;

}


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


int main() {
  int N, X, ans = 0, D = 0, L;
  cin >> N >> X;
  for (int i = 0; D <= X; i++) {
    cin >> L;
    D += L;
    ans++;
    if(i == N) break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};


int main() {
    ll n; cin >> n;
    REP(i,1,10){
        REP(j,1,10){
            if(i*j==n){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
}


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n;
main() {
  file("lala");
  ios;
  cin >> n;
  cout << n + n * n + n * n * n;
  return 0;
}
/**

*/


Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define pi 3.14159265358979323846
#define ll long long
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a == b && b == c){
    cout << "Yes\n";
    return 0;
  }
  int e = a - c;
  if(e < 0){
    e = e * (-1);
  }
  if(d >= e){
    cout << "Yes\n";
    return 0;
  }
  int f = a - b, g = b - c;
  if(f < 0){
    f = f * (-1);
  }
  if(g < 0){
    g = g * (-1);
  }
  if(d >= f && d >= g){
    cout << "Yes\n";
    return 0;
  }
  cout << "No\n";
}
  

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;
int helper(int N);
int main(){
    int n;
    cin >> n;
    for(int N=1;N<=n;N++){
        cout << helper(N) << endl;
    }

    return 0;
}



int helper(int N){
    int cnt=0;

    for(int x=1;x<=58;x++){
        for(int y=x;y<=100;y++){
            if(x*x+y*y+x*y > N){break;}
            for(int z=y;z<=100;z++){
                int tmp = x*x + y*y + z*z + x*y + y*z + z*x;
                if(tmp == N){
                    if(x == y && y == z){
                        cnt += 1;
                    }else if(x == y || y == z || z == x){
                        cnt += 3;
                    }else{
                        cnt += 6;
                    }
                }else if (tmp > N){
                  break;
                }
            }
        }
    }
    return cnt;

}


Measured memory_bytes: 3556
#include "bits/stdc++.h"
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

struct UnionFindTree {
    vector<int> parent, rank;
    int operator [](int x) { return find(x); }
    void build(int n) { parent.assign(n, -1); rank.assign(n, 0); }
    int find(int x) { return parent[x] < 0 ? x : (parent[x] = find(parent[x])); }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -parent[find(x)]; }
    bool unite(int x, int y) {
        if ((x = find(x)) == (y = find(y))) return 0;
        rank[x] = max(rank[x], rank[y] + 1); parent[x] += parent[y]; parent[y] = x; return 1;
    }
    bool uniteByRank(int x, int y) {
        if ((x = find(x)) == (y = find(y))) return 0;
        else if (rank[x] < rank[y]) swap(x, y);
        else if (rank[x] == rank[y]) rank[x]++;
        parent[x] += parent[y]; parent[y] = x; return 1;
    }
    bool uniteBySize(int x, int y) {
        if ((x = find(x)) == (y = find(y))) return 0;
        else if (size(x) < size(y)) swap(x, y);
        rank[x] = max(rank[x], rank[y] + 1); parent[x] += parent[y]; parent[y] = x; return 1;
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    rep(i, N) cin >> a[i];

    UnionFindTree uf;
    uf.build(N);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        uf.uniteByRank(x, y);
    }

    vector<pair<int, int>> p(N);
    rep(i, N) p[i] = { uf[i], i };
    sort(all(p));

    vv<int> group;
    for (int i = 0, j; i < N; i = j) {
        group.push_back(vector<int>());

        for (j = i; j < N; ++j) {
            if (p[j].first == p[i].first) {
                group.back().push_back(a[p[j].second]);
            }
            else break;
        }

        sort(all(group.back()));
    }

    int K = group.size();
    if (K == 1) {
    write(0);
    return 0;
    }
    else if (N < 2 * K - 2) {
        write("Impossible");
        return 0;
    }

    ll ans = 0;
    vector<int> tmp;
    for (auto&& g : group) {
        ans += g.front();
        for (int i = 1; i < (int)g.size(); ++i) {
            tmp.push_back(g[i]);
        }
    }
    sort(all(tmp));
    rep(i, K - 2) {
        ans += tmp[i];
    }
    write(ans);
}

Measured memory_bytes: 8756
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
 
public class Main {
	public void exec() throws IOException {
        InputUtil in = new InputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int min=200000,max=1,maxRtDiff=-1000000000;
        boolean first = true;
        for(int rt: in.nextInt(new int[n])){
        	if(first) {
        		min = rt;
        		max = 1;
        		first = false;
        	}else{
            	if(max < rt) {
            		max = rt;
            	}
        		int rtDiff = max - min;
        		if(maxRtDiff < rtDiff) {
        			maxRtDiff = rtDiff;
        		}
            	if(rt < min) {
            		min = rt;
            		max = 1;
            	}
        	}
        }
        out.println(maxRtDiff);
        out.flush();
    }

    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
}


/**
 * --------------------------------------------------
 * Input Utility
 * --------------------------------------------------
 */
class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 50000;
	
	//Fields
	protected InputStream in;
	private char[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private BufferedReader br = null;
	
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}
	protected void initBuf(int bufsiz) {buf = new char[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && br.ready()) {
			max = br.read(buf);
			ptr = 0;
		}
	}
	//Number Input Reader/Parser
	private boolean isNum(char b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(char b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		char c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

Measured memory_bytes: 28936
import java.util.*;

public class Main{
    public static void main(String[] args){
        int w, h, x, y, r;
        Scanner s = new Scanner(System.in);
        w = s.nextInt();
        h = s.nextInt();
        x = s.nextInt();
        y = s.nextInt();
        r = s.nextInt();
        if ((x<r) || (y<r) || (x+r>w) || (y+r>h)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}



Measured memory_bytes: 26388
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <typeinfo>
#include <stdlib.h>
#include <stack>
#include <queue>
#include <type_traits>

#define ll long long
#define ld long double

using namespace std;

bool is_num(char input){
	std::vector<char> num_vec={'0','1','2','3','4','5','6','7','8','9'};
	for(int i=0; i<10; i++){
		if(input == num_vec[i]){
			return true;
		}
	}
	return false;
}


int main(){
  int a,b;
  string s;

  cin >> a >> b;
  cin >> s;

  for(int i=0; i<a; i++){
  	if(!is_num(s[i])){
  		cout << "No" << endl;
  		return 0;
  	}
  }
  if(s[a] != '-'){
  	cout << "No" << endl;
  	return 0;
  }
  for(int i=a+1; i<a+b+1; i++){
  	if(!is_num(s[i])){
  		cout << "No" << endl;
  		return 0;
  	}
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 256