akhauriyash/Code-Regression huggingface dataset:
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll a[MAXn], b[MAXn];

int main()
{
    IOS();
    ll n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    for(int i = 0;i < n;)
    {
        if(s[i] == '0'){
            ll it = i;
            while(it < n  && s[it] == '0')it++;
            a[i]++;
            b[it-1] ++;
            i = it;
        }
        else i ++;
    }
    debug(123);
    ll mx = 0, it = 0, tt = 0;
    for(int i = 0;i < n;i ++)
    {
        tt += a[i];
        while(tt > k)tt -= b[it++];
        mx = max(mx, i - it + 1);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 2000
#include <iostream>
using namespace std;
using uint = unsigned int;

int main(){
	uint N;
	string S;
	cin >> N;
	cin >> S;

	uint ans = 0;
	
	for(uint i=0; i<10; i++) {
		auto itr_i = S.find(to_string(i)); 
		if(itr_i == string::npos) {
			//cout << i << endl;
			continue;
		}
		
		for(uint j=0; j<10; j++) {
			auto itr_j = S.find(to_string(j), itr_i+1); 
			if(itr_j == string::npos) {
				//cout << i << j << endl;
				continue;
			}
			
			for(uint k=0; k<10; k++) {
				auto itr_k = S.find(to_string(k), itr_j+1); 
				if(itr_k != string::npos) {
					//cout << i << j << k << endl;
					ans++;
				}
			}
		}
	}


	cout << ans;

	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 998244353;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(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;
}


void Main()
{
    LL n,s;cin>>n>>s;
    VL a(n);
    REP(i,n){
      cin>>a[i];
    }
    VVL dp(n);
    REP(i,n){
      dp[i].resize(s+1);
    }


    if(a[0]<=s){
      dp[0][a[0]] = 1;
    }
    //dp[0][0] = 1;

    FOR(i,1,n){
      REP(j,s+1){
        dp[i][j] += dp[i-1][j]*2;
        dp[i][j] %= MOD;
        
        if(j+a[i] <= s){
          if(j==0){
            dp[i][j+a[i]] += modpow(2,i);
          }
          else{
            dp[i][j+a[i]] += dp[i-1][j];
          }
          dp[i][j+a[i]] %= MOD;
        }
      }
    }

    
    cout<<dp[n-1][s]%MOD<<endl;





	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 73688
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin >> n;
    ll a[n],pushed[n];
    ll i;
    for(i=0;i<n;i++){
      cin >> a[i];
      pushed[i]=0;
    }
    i=0;
    ll cnt=0;
    while(i!=1){
      if(pushed[i]==1){
          cout << -1;
          return 0;
      }
      pushed[i]=1;
      i=a[i]-1;
      cnt++;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<ctype.h>
#define STACK 106

int main(void)
{
 
  int stack[STACK]; 
  int n=0,f=0;  
  int sum; 
 
  int k; 
  char ch;  
 /*入力*/
 while((ch=getchar())!='\n'){ 
   /*整数の場合*/
    if(isdigit(ch)){
      /*整数が続いた場合*/
      if(f){ 
        stack[n]=stack[n]*10+(ch-'0'); 
      }else{
        stack[n]=(ch-'0');
        f++;
      }
    }
    /*空白の場合*/
    if(isspace(ch)){
      if(f){ 
        n++;
        f=0;
      }
    }
    /*足し算の場合’*/
    if(ch=='+'){
     
      if(n>1){
        n--;
      }
      stack[n-1]+=stack[n];
      stack[n]=0;
    }
    /*引き算の場合*/
    if(ch=='-'){ 
      
      if(n>1){
        n--;
      }
      stack[n-1]-=stack[n];
      stack[n]=0;
    }
    /*掛け算の場合*/
    if(ch=='*'){ 
     
      if(n>1){
        n--;
      }
      stack[n-1]*=stack[n];
      stack[n]=0;
    }
   
  
}
 /*出力*/
  printf("%d\n",stack[0]);
 
  return 0;
}



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

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

template <class T, class Op = multiplies<T>>
constexpr T power(T a, long long n, Op op = Op(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  static constexpr unsigned mod = M;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
};

using mint = modular<power(10, 9) + 7>;

using mat = array<array<mint, 3>, 3>;

mat operator*(const mat& a, const mat& b) {
  mat c;
  for (int i = 0; i < 3; ++i) {
    for (int k = 0; k < 3; ++k) {
      for (int j = 0; j < 3; ++j) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  return c;
}

mat a{
  0, 1, 0,
  0, 0, 1,
  1, -2, 4
};
mat id{
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
};
mint f(int n) {
  auto v = power(a, n, multiplies<>(), id)[0];
  return v[1] + 5 * v[2];
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  for (auto&& e : x) cin >> e;
  x.push_back(n);
  for (int i = m; i--; ) {
    x[i + 1] -= x[i];
  }
  array<mint, 3> v{f(x[0]), f(x[0] + 1), f(x[0] + 2)};
  for (int i = 1; i <= m; ++i) {
    auto b = power(a, x[i], multiplies<>(), id);
    array<mint, 3> nv;
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        nv[j] += b[j][k] * v[k];
      }
      nv[j] -= v[0] * f(x[i] + j);
    }
    swap(v, nv);
  }
  cout << v[0].v << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;

int main(void) {
  int n;
  cin >> n;
  vi x(n);
  rep(i,n) cin >> x[i];
  auto a = x;
  sort(ALL(a));
  rep(i,n){
    int p = lower_bound(ALL(a),x[i])-a.begin();
    if(p>=n/2) cout << a[n/2-1] << endl;
    else cout << a[n/2] << endl;
  }
}




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

int main(){
    double l;
    double a, b, c;
    cin >> l;
    a=l/3;
    b=l/3;
    c=l/3;
    cout << fixed << setprecision(12) << a*b*c << endl;
}

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

vector<int> N;
int dp[1000000+1][2];

int dfs(int i, bool just) {
  if(i == N.size()) return just ? 0 : 1;
  if(dp[i][just] != -1) return dp[i][just];
  int res = 10;
  if(just) {
    res = min(N[i] + dfs(i + 1, true), N[i] + 1 + dfs(i + 1, false));
  } else {
    res = min(10 - N[i] + dfs(i + 1, true), 10 - N[i] - 1 + dfs(i + 1, false));
  }
  return dp[i][just] = res;
}

int main() {
  string S;
  cin >> S;
  for(auto c: S) N.emplace_back(c - '0');
  for(auto i=0; i<N.size(); ++i) dp[i][true] = dp[i][false] = -1;
  cout << min(dfs(0, true), 1 + dfs(0, false)) << endl;
}


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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int W, H, N, x[101], y[101], a[101];
	int xr, xl, yu, yl;
	
	cin >> W >> H >> N;
	
	for(int i=0; i<N; i++)
		cin >> x[i] >> y[i] >> a[i];
	
	xr = W;
	xl = 0;
	yu = H;
	yl = 0;
	
	for(int i=0; i<N; i++){
		if(a[i] == 1 && xl < x[i]){
			xl = x[i];
		}else if(a[i] == 2 && xr > x[i]){
			xr = x[i];
		}else if(a[i] == 4 && yu > y[i]){
			yu = y[i];
		}else if(a[i] == 3 && yl < y[i]){
			yl = y[i];
		}
		if(xr <= xl || yu <= yl){
			cout << 0;
			return 0;
		}
	}
	
	cout << (xr-xl)*(yu-yl);
	
	return 0;
}

Measured memory_bytes: 256
L = int(input())
l = L.bit_length()

graph = []
for i in range(l-1):
    graph.append((i+1, i+2, 0))
    graph.append((i+1, i+2, 2**(l-i-2)))

s = (1 << (l-1))
for i in reversed(range(l-1)):
    if (1 << i) & L:
        graph.append((1, l-i, s))
        s += (1 << i)

print(l, len(graph))
for a, b, c in graph:
    print(a, b, c)

Measured memory_bytes: 3064
function main(input){
    var tmp = input.split(" ");
    var X = Number(tmp[0]);
    var t = Number(tmp[1]);
    
    if(X-t>=0){
      console.log(X-t);
    }else{
      console.log(0);
    }
}

main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

const double inf = 1e9;

struct Data {
  vector<double> l, r;
  Data() : l(3, inf), r(3, -inf) {}
  void add(double x, int v) {
    v++;
    chmin(l[v], x);
    chmax(r[v], x);
  }
  vector<double> events() {
    vector<double> ts;
    rep(i, 3) rep(j, i) {
      {
        double t = (l[j] - l[i]) / (i - j);
        if (t > 0) ts.push_back(t);
      }
      {
        double t = (r[j] - r[i]) / (i - j);
        if (t > 0) ts.push_back(t);
      }
    }
    return ts;
  }
  double len(double t) {
    double nl = inf, nr = -inf;
    rep(v, 3) {
      chmin(nl, l[v]+v*t);
      chmax(nr, r[v]+v*t);
    }
    return nr - nl;
  }

  void show() {
    rep(i, 3) {
      cerr << "l = " << l[i] << ", r = " << r[i] << endl;
    }
  }
};

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

  int n;
  cin >> n;
  Data xd, yd;
  rep(i, n) {
    int x, y;
    char d;
    cin >> x >> y >> d;
    if (d == 'R') xd.add(x, +1), yd.add(y,  0);
    if (d == 'L') xd.add(x, -1), yd.add(y,  0);
    if (d == 'U') xd.add(x,  0), yd.add(y, +1);
    if (d == 'D') xd.add(x,  0), yd.add(y, -1);
  }

  vector<double> ts;
  ts.push_back(0);
  ts.push_back(inf);
  {
    auto xts = xd.events();
    ts.insert(ts.end(),xts.begin(), xts.end());
  }
  {
    auto yts = yd.events();
    ts.insert(ts.end(), yts.begin(), yts.end());
  }

  double ans = inf * inf;
  for (auto t : ts) {
    double area = xd.len(t) * yd.len(t);
    chmin(ans, area);
  }

  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF = 100000000;
int i,j,k,l,m;
ll mod=1000000007;

int main(){    
    string s;cin>>s;
    int k;cin>>k;
    map<string,int> x;//同じstringを数えないようにする
    
    vector<string> part_st;

    int n=s.size();
    if(n>5){n=5;}

    for(i=1;i<=n;i++){
        for(j=0;j<s.size()-i+1;j++){
            string t=s.substr(j,i);//j番目の後ろi文字を取り出す
            x[t]++;//count1のみpart_stにいれる
            if(x[t]==1){
                part_st.push_back(t);//長さk以下の部分列をpart_stに入れる(重複は許されないので1の時だけ)
            }
        }
    }
    
    sort(part_st.begin(),part_st.end());//長さk以下の部分列すべてをsort
    
    cout<<part_st[k-1]<<endl;
    return 0;
}

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

class UnionFind {
	vector<int> par;
	vector<int> rank;
	int find(int a) {
		return par[a] < 0 ? a : par[a] = find(par[a]);
	}
public:
	UnionFind(int n) : par(n, -1), rank(n, 1) {}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (rank[a] > rank[b]) {
			par[a] += par[b];
			par[b] = a;
		}
		else {
			par[b] += par[a];
			par[a] = b;
			if (rank[a] == rank[b]) rank[b]++;
		}
	}
	int size(int a) {
		return -par[find(a)];
	}
};

int main()
{
	ll N, M;
	cin >> N >> M;
	UnionFind uf(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		uf.unite(a, b);
	}
	ll s1 = min(uf.size(0), uf.size(1)), s2 = N - s1;
	cout << (s1 * (s1 - 1) / 2 + s2 * (s2 - 1) / 2 - M) << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main() {
	long int a[200];
	int n,cter=0;
	cin >> n;
	for (int i = 0; i < n;i++) cin >> a[i];

	while (1) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 != 0)goto EXIT;
		}
		cter++;
		for (int i = 0; i < n; i++) {

			a[i] = a[i] / 2;

		}
	
	}
EXIT:
	cout << cter << endl;


	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int INF = INT_MAX / 3;

template <size_t T>
bool prevSubset(bitset<T>& bs, const bitset<T>& mask)
{
    bs = bs.to_ulong() - 1ull;
    bs &= mask;
    return !bs.none();
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int> > graph(n, vector<int>(n, -INF));
    int sum = 0;
    for(int i=0; i<m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        graph[a][b] = graph[b][a] = c;
        sum += c;
    }

    vector<vector<int> > path(1<<n, vector<int>(n, -INF));
    path[1][0] = 0;
    for(int i=0; i<(1<<n); ++i){
        bitset<32> bs(i);
        for(int j=0; j<n; ++j){
            if(path[i][j] < 0 || !bs[j])
                continue;
            for(int k=0; k<n; ++k){
                if(graph[j][k] < 0 || bs[k])
                    continue;
                bs[k] = true;
                path[bs.to_ulong()][k] = max(path[bs.to_ulong()][k], path[i][j] + graph[j][k]);
                bs[k] = false;
            }
        }
    }

    vector<vector<int> > add(1<<n, vector<int>(n, 0));
    for(int i=0; i<(1<<n); ++i){
        bitset<32> bs(i);
        int tmp = 0;
        for(int j=0; j<n; ++j){
            for(int k=0; k<j; ++k){
                if(bs[j] && bs[k] && graph[j][k] >= 0)
                    tmp += graph[j][k];
            }
        }
        for(int j=0; j<n; ++j){
            if(bs[j])
                continue;
            add[i][j] = tmp;
            for(int k=0; k<n; ++k){
                if(bs[k] && graph[j][k] >= 0)
                    add[i][j] += graph[j][k];
            }
        }
    }

    vector<int> dp(1<<n, -INF);
    for(int i=0; i<(1<<n); ++i)
        dp[i] = path[i][n-1];
    for(int i=0; i<(1<<n); ++i){
        if(dp[i] < 0)
            continue;
        bitset<32> curr(i);
        bitset<32> mask(i ^ ((1<<n)-1));
        bitset<32> bs = mask;
        do{
            bitset<32> next = curr | bs;
            for(int j=0; j<n; ++j){
                if(curr[j])
                    dp[next.to_ulong()] = max(dp[next.to_ulong()], dp[i] + add[bs.to_ulong()][j]);
            }
        }while(prevSubset(bs, mask));
    }

    int ans = sum - dp.back();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7040
#include<stdio.h>

int main(){
int i,j,k,l,a,cnt;
while(scanf("\n%d",&a)!=EOF){
 cnt=0;
 for(i=0;i<10;i++){
 for(j=0;j<10;j++){
 for(k=0;k<10;k++){
 for(l=0;l<10;l++){

  if(i+j+k+l==a){
   cnt++;
  }
 }
 }
 }
 }
 printf("%d\n",cnt);
}
return 0;
}

Measured memory_bytes: 596
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, a;
	scanf("%d", &n);
	std::deque<int> deq;
	REP(i, 0, n){
		scanf("%d", &a);
		if(i%2) deq.push_back(a);
		else deq.push_front(a);
	}
	if(n%2) REP(i, 0, n) printf("%d ", deq[i]);
	else REP(i, 0, n) printf("%d ", deq[n-i-1]);
	return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
using namespace std;
int main() {
  int H,B,N,M,K,X,Y,Z;
  cin >> N;

  vector<int> num(N);

  int sum=0;
  int P = 0;
  int min_sum=2147483647;
  for(int i=0 ; i < N ; i++){
    cin >> num[i];
  }
  int mx = *std::max_element(num.begin(),num.end());

  for(int i=0; i <= mx; i++){
    for(int j=0; j < N; j++){
      sum += (num[j] - P)*(num[j] - P);
    }
    min_sum = min(sum,min_sum);
    sum = 0;
    P++;
  }
  //cout << mx <<" " << P << " " << min_sum << endl;
  cout << min_sum << endl;
  return(0);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String[] b = {"A","C","G","T"};
        int count = 0;
        int max = 0;
        for(int i=0; i<a.length(); i++) {
            for(int j=0; j<4; j++) {
                if(a.substring(i, i+1).equals(b[j])) {
                    count++;
                    break;
                }
                if(j==3) {
                    count = 0;
                }
            }
            if(max < count) {
                max = count;
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 21844
N = int(input())

A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))


"""
minnum以上で最小の数のindexを返す。無いときはlen(List)を返す
計算量log(len(List))

def bts(List,minnum,under=0):
    if List[0]>=minnum:
        return under
    if List[-1]<minnum:
        return len(List)+under
    i = int(len(List)/2)
    if List[i]>=minnum and List[i-1]<minnum:
        return i + under
    if List[i]<minnum:
        return bts(List[i+1:],minnum,under+i+1)
    return bts(List[:i],minnum,under)

"""

def binary_search(list, item):
    if list[0]>=item:
        return 0
    if list[-1]<item:
        return len(list)

    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess >= item and list[mid-1] < item:
            return mid
        if guess >= item:
            high = mid -1
        else:
            low = mid + 1

    return None

res = 0
for i in range(N):
    b = B[i]
    a = binary_search(A,b)
    c = N - binary_search(C,b+1)
    res += a*c

print(res)


Measured memory_bytes: 107108
//AOJ 0594
//題意：訪れる交差点を決め、通る道をできるだけ少なくする
//入力：Width Height n
//     X1 Y1
//     ・・・
//     Xn Yn
//制約：
//出力：通る道の本数の合計
//解決策：おなじ交差点に複数回通ることもある
//タイム：

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
typedef pair<int, int> P;

//2点間での最短を求める
int calc(int x1, int y1, int x2, int y2) {
    int ret = 0;
    int diffx = x2 - x1, diffy = y2 - y1;
    while(true) {
        if(!(diffx | diffy)) break; //差が0になったら終了
        //処理
        if(diffx >= 1 && diffy >= 1)        { diffx--; diffy--; }
        else if(diffx <= -1 && diffy <= -1) { diffx++; diffy++; }
        else if(diffx >= 1)                   diffx--;
        else if(diffy >= 1)                   diffy--;
        else if(diffx <= -1)                  diffx++;
        else if(diffy <= -1)                  diffy++;
        //通った道を記録
        ret++;
    }
    return(ret);
}

void solve(int n) {
    //訪れる交差点を入力
    vector<P> visit(n);
    for(int r = 0; r < n; r++) {
        cin >> visit[r].first >> visit[r].second;
    }
    //処理
    P now = visit[0];
    int sum = 0;
    for(int r = 1; r < n; r++) {
        sum += calc(now.first, now.second, visit[r].first, visit[r].second);
        now = visit[r];
    }
    //出力
    cout << sum << endl;
}

int main(void) {
    int width, height, n;
    cin >> width >> height >> n;
    solve(n);
    
    return(0);
}

Measured memory_bytes: 1204
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
struct item
{
	string str;
	int w,s;
};
item it[11];
int n;
vector<int> ans,curr;
double G,tmpg;
bool used[10];
void dfs(int x){
	int tmp =0;
	for(int i =curr.size()-1;i >=0;i--){
		if(tmp >it[curr[i]].s)return;
		tmp +=it[curr[i]].w;
	}
	if(curr.size()==n){
		if(tmpg<G){
			G =tmpg;
			ans =curr;
		}
		return;
	}
	for(int i =0;i <n;i++){
		if(!used[i]){
			used[i]=true;
			curr.push_back(i);
			tmpg +=(x*it[i].w);
			dfs(x+1);
			tmpg -=(x*it[i].w);
			curr.pop_back();
			used[i]=false;
		}
	}
	return;
}


int main(){
	while(cin>>n,n){
		for(int i =0;i <n;i++){
			cin>>it[i].str>>it[i].w>>it[i].s;
		}
		G =INF;
		tmpg = 0;
		dfs(1);
		for(int i =0;i <n;i++){
			cout <<it[ans[i]].str<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {

        Scanner in=new Scanner(System.in);

        int N = in.nextInt();
        int choice = in.nextInt();
        long ans = 0;
        
        long[][] pur = new long[N][3];
        
        long[][] sum = new long[8][N];
        
        long[] sumsum = new long[8];
        
        for(int i=0;i<N;i++){
        	pur[i][0] = in.nextLong();
        	pur[i][1] = in.nextLong();
        	pur[i][2] = in.nextLong();
        }
        
        for(int i=0;i<N;i++){
        	sum[0][i] = pur[i][0] + pur[i][1] + pur[i][2];
        	sum[1][i] = pur[i][0] + pur[i][1] - pur[i][2];
        	sum[2][i] = pur[i][0] - pur[i][1] + pur[i][2];
        	sum[3][i] = pur[i][0] - pur[i][1] - pur[i][2];
        	sum[4][i] = -pur[i][0] + pur[i][1] + pur[i][2];
        	sum[5][i] = -pur[i][0] + pur[i][1] - pur[i][2];
        	sum[6][i] = -pur[i][0] - pur[i][1] + pur[i][2];
        	sum[7][i] = -pur[i][0] - pur[i][1] - pur[i][2];
        }
        
        for(int i=0;i<8;i++)
        	Arrays.sort(sum[i]);	
        
        for(int i=0;i<8;i++){
        	for(int j=0;j<choice;j++){
        		sumsum[i] += sum[i][N-j-1];
        	}
        	if(ans<sumsum[i])
        		ans = sumsum[i];

        }
        
        System.out.println(ans);
    }

}


Measured memory_bytes: 28940
#include <stdio.h>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <limits>

using namespace std;

int main() {
  int n, c, k;
  scanf("%d %d %d", &n, &c, &k);

  vector<int> t(n);
  for (int i = 0; i < n; ++i) scanf("%d", &t[i]);

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

  t.push_back(numeric_limits<int>::max());
  int ans = 0;
  int cur = 0;
  for (int i = 1; i <= n; ++i) {
    if (t[i] - t[cur] > k || i - cur >= c) {
      ans++;
      cur = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

int t[5 * maxn], a[maxn], lazy[5 * maxn];

int doit(int a, int b) {
    return a + b;
}

void build(int start, int end, int index = 1) {
    if (start == end) {
        t[index] = 0;
        return;
    }

    int mid = start + end >> 1;
    build(start, mid, index << 1);
    build(mid + 1, end, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}

void propagate(int start, int end, int index) {
    t[index] += (end - start + 1) * lazy[index];
    if (start != end) {
        lazy[index << 1] += lazy[index];
        lazy[index << 1 | 1] += lazy[index];
    }
    lazy[index] = 0;
}

int query(int start, int end, int l, int r, int index = 1) {
    if (lazy[index] != 0)
        propagate(start, end, index);
    //Invalid range
    if (r < start or l > end)
        return 0;

    //In range
    if (l <= start and end <= r) {
        return t[index];
    }

    int mid = start + end >> 1;
    return doit(query(start, mid, l, r, index << 1), query(mid + 1, end, l, r, index << 1 | 1));
}

void pUpdate(int start, int end, int point, int val, int index = 1) {
    if (start == end) {
        t[index] += val;
        return;
    }

    int mid = start + end >> 1;
    if (point <= mid)
        pUpdate(start, mid, point, val, index << 1);
    else
        pUpdate(mid + 1, end, point, val, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}


void rangeUpdate(int start, int end, int l, int r, int val, int index) {
    if (lazy[index])
        propagate(start, end, index);
    if (l > end or r < start)
        return;

    if (l <= start and end <= r) {
        lazy[index] += val;
        propagate(start, end, index);
        return;
    }

    int mid = start + end >> 1;
    rangeUpdate(start, mid, l, r, val, index << 1);
    rangeUpdate(mid + 1, end, l, r, val, index << 1 | 1);

    t[index] = doit(t[index << 1], t[index << 1 | 1]);
}

void solve() {
    int n, q;
    cin >> n >> q;

    build(0, n - 1, 1);

    for (int i = 0; i < q; i++) {
        int a;
        cin >> a;

        if (a == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            rangeUpdate(0, n - 1, s - 1, t - 1, x, 1);
        } else {
            int s, t;
            cin >> s >> t;

            cout << query(0, n - 1, s - 1, t - 1, 1) << endl;
        }
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}



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

const int MAX_N = 3002;
ll dp[MAX_N][MAX_N][4];
ll v[MAX_N][MAX_N];
int N, M, K;

void solve()
{
	dp[0][0][0]=0, dp[0][0][1]=v[0][0];
	for(int i=0;i<N;++i)for(int j=0;j<M;++j){
		for(int k=0;k<=3;++k){
			ll cur = dp[i][j][k];
			if(i+1<N){ // down
				dp[i+1][j][0]=max(dp[i+1][j][0], cur);
				dp[i+1][j][1]=max(dp[i+1][j][1],cur+v[i+1][j]);
			}
			if(j+1<M){ //right
				dp[i][j+1][k]=max(dp[i][j+1][k],cur);
				if(k+1<=3) dp[i][j+1][k+1]=max(dp[i][j+1][k+1],cur+v[i][j+1]);
			}
		}
	}
	ll ans = 0;
	for(int i=0;i<=3;++i) ans=max(ans, dp[N-1][M-1][i]);
	cout<<ans;
}	

int main()
{
	int a, b, c;
	cin >> N >> M >> K;
	for(int i=0;i<K;++i){
		cin >> a >> b >> c;
		v[a-1][b-1]=c;
	}
	solve();
	return 0;
}

Measured memory_bytes: 355352
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define faster ios::sync_with_stdio(false)
#define ll long long int
#define sz 200005
#define mp(x,y) make_pair(x,y) 
#define pii pair<long long int,long long int>
#define tor ::iterator
#define letsgo long long  int i,j,k,q=0,t,tmp,n,flg=0,cntr=0,maxxer = 0
#define fi first
#define se second
#define be begin()
#define en end()
#define mod 1000000007
#define debug(x) cout<<" "<<x<<endl

bool comparator(pair<ll,ll> p1,pair<ll,ll> p2){
	if(p1.fi< p2.fi)
		return true;
	else if(p1.fi == p2.fi){
		return p1.se > p2.se;
	}
	else
		return false;
}
// int bin(vector <ll> b,int l,int r,int a){
// 	if(l>=r)
// 		return l;
// 	ll mid = (l+r)/2;
// 	if(b[mid]==a)
// 		return mid;
// 	else if(b[mid]<a)
// 		return bin(b,mid+1,r,a);
// 	else 
// 		return bin(b,l,mid-1,a);
// }
// int gbin(vector <ll> b , ll l,ll r,ll a){
// 	if(l>=r)
// 		return l;
// 	ll mid = (l+r)/2;
// 	if(b[mid]<=a && b[mid+1]>a)
// 		return mid;
// 	else if(b[mid]<=a)
// 		return gbin(b,mid+1,r,a);
// 	else
// 		return gbin(b,l,mid-1,a);
// }
// int lbin(vector<ll> b,ll l,ll a){
// 	if(l<=r)
// 		return l;
// 	if(b[mid] >=a && b[mid -1] < a)
// 		return mid;
// 	else if(b[mid] >=a)
// 		return lbin(b,l,mid-1,a);
// 	else 
// 		return lbin(b,mid+1,r,a);
// }
int dp[100005];
int main(){
	faster;
	letsgo; 
	cin>>n;
	vector <ll> v;

	for(i=0;i<n;i++){
		cin>>tmp;
		v.pb(tmp);
	}
	dp[0]=v[0];
	dp[1]= abs(v[1]-v[0]);
	dp[2] = abs(v[2]-v[0]);
	for(i=3;i<n;i++){
		dp[i] = min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	// for(i=0;i<n;i++){
	// 	cout<<dp[i]<<" ";
	// }
	cout<<dp[n-1];
return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
using namespace std;
int n,m;
struct point{
	int u,v,w;
	bool operator<(const point& p)const{
		return w>p.w;
	}
};
int f[1000005];
int find(int x){
	return x==f[x]?x:f[x]=find(f[x]);
}
void join(int x,int y){
	int fx=find(x);
	int fy=find(y);
	if(fx!=fy)f[fx]=fy;
}
int main(){
	cin>>n>>m;
	for(int i=0;i<=n;i++)f[i]=i;
	int u,v,w;
	priority_queue<point>q;
	while(m--){
		cin>>u>>v>>w;
		q.push({u,v,w});
	}
	int k=1;
	int res=0;
	while(k!=n){
		point p=q.top();q.pop();
		if(find(p.u)!=find(p.v)){
			join(p.u,p.v);
			res+=p.w;
			k++;
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
N,W = map(int, input().split())
dp = [0]*(W+1)
for _ in range(N):
    w,v = map(int,input().split())
    for i in range(W,-1,-1):
        if i-w < 0:
            continue
        dp[i] = max(dp[i], dp[i-w]+v)
print(max(dp))


Measured memory_bytes: 42092
def solve(X, Y, P, Q, R):
    P = sorted(P, reverse=True)[:X]
    Q = sorted(Q, reverse=True)[:Y]
    R.sort(reverse=True)
    PQ = sorted(P + Q)
    i = 0
    while i < len(R) and i < len(PQ) and R[i] > PQ[i]:
        PQ[i], R[i] = R[i], PQ[i]
        i += 1
    return sum(PQ)


if __name__ == "__main__":
    X, Y, A, B, C = tuple(map(int, input().split(" ")))
    P = list(map(int, input().split(" ")))
    Q = list(map(int, input().split(" ")))
    R = list(map(int, input().split(" ")))
    print(solve(X, Y, P, Q, R))


Measured memory_bytes: 23328
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define mod (int)1000000007
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = DBL_EPSILON;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
signed main() {
	string s;
	cin >> s;
	if (s.size() % 2) {
		puts("No");
		return 0;
	}
	rep(i, s.size() - 1) {
		if (s.substr(i, 2) != "hi") {
			puts("No");
			return 0;
		}
		i++;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
N = int(input())
p = list(map(int, input().split()))
p = [i - 1 for i in p]

cnt = 0
for i in range(N):
    if i == N - 1 and p[i] == i:
        p[i], p[i-1] = p[i-1], p[i]
        cnt += 1
    elif p[i] == i:
        p[i], p[i+1] = p[i+1], p[i]
        cnt += 1

print(cnt)


Measured memory_bytes: 20648
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
const int m=1000000000;

int main(){
	int n;
	string s;
	cin>>n>>s;
	int l=s.length();
	FOR(i,0,l){
		s[i]+=n;
		if(s[i]>'Z'){
			s[i]-='Z'-'A'+1;
		}
	}
	cout<<s<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
     
    public class Main {
    	public static void main (String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		
    		int price = 0;
    		
    		for (int i = 0; i < 30; i++) {
    			
    			price += 4 * i;
    			
    			for (int j = 0; j < 20; j++) {
    				
    				if (N == price) {
    					System.out.println("Yes");
    					return;
    				}
    				
    				price += 7;
    			
    			}
    			
    			price = 0;
    			
    		}
    		
    		System.out.println("No");
    		
    	}
    }

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;

int n, p, ans=0;

int main(){
  cin >> n;
  int minfar=INF;
  rep(i, n){
    cin >> p;
    if(minfar>=p){
      minfar=p;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    // int n = Integer.parseInt(br.readLine());
    StringBuilder build = new StringBuilder();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int id,d,c,left=0;
    Node node[] = new Node[n];
    for(int i = 0 ; i < n; i++){
      node[i] = new Node();
    }
    for(int i = 0; i<n; i++){
      // StringTokenizer token = new StringTokenizer(br.readLine());
      id = sc.nextInt();
      d = sc.nextInt();
      for(int j = 0; j<d;j++){
        c = sc.nextInt();
        if(j == 0 )node[id].left = c;
        else node[left].right_sibling = c;
        left = c;
        node[c].parent = id;
      }
    }

    for(int i = 0; i<n; i++){
      build.append("node ").append(i).append(": parent = ").append(node[i].parent).append(", depth = ").append(getDepth(i , node)).append(", ");
      if(node[i].parent == -1){
        build.append("root, [");
        PrintCildren(i,node,build);
      }
      else if(node[i].left == -1){
        build.append("leaf, [");
      }
      else {
        build.append("internal node, [");
        PrintCildren(i,node,build);
      }
      build.append("]\n");
    }
    System.out.print(build);
  }

  static int getDepth(int u, Node node[]){
    int d = 0;
    while(node[u].parent != -1){
      u = node[u].parent;
      d++;
    }
    return d;
  }

  static void PrintCildren(int u, Node node[], StringBuilder bl){
    int c = node[u].left;
    if(c!=-1){
      bl.append(c);
      c = node[c].right_sibling;
    }
    while(c != -1){
      // System.out.print(c);
      bl.append(", ").append(c);
      c = node[c].right_sibling;
    }
  }
}

class Node{
  int parent = -1;
  int left = -1;
  int right_sibling = -1;
  Node(int parent, int left, int right_sibling){
    this.parent = parent;
    this.left = left;
    this.right_sibling = right_sibling;
  }
  Node(){}

  }


Measured memory_bytes: 112864
import java.util.*;
public class Main {
     public static void main(String [] args){
      Scanner input = new Scanner(System.in);
       
      int a = input.nextInt();
      int b = input.nextInt();
      int c = input.nextInt();
    
      int arr[] = {5, 7, 5};
      
      if(arr[0]==a && arr[1]==b && arr[2]==c)
          System.out.println("YES");
      else if(arr[0]==a && arr[1]==c && arr[2]==b)
          System.out.println("YES");
      else if(arr[0]==b && arr[1]==a && arr[2]==c)
          System.out.println("YES");
      else
          System.out.println("NO");
     
     }
}


Measured memory_bytes: 27052
#include "bits/stdc++.h"
using namespace std;

#define say(obj) (cout << (obj) << endl)
#define endline (cout << endl)
#define all(container) (container).begin(), (container).end()
#define sortall(container) (sort((container).begin(), (container).end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
T getSum(std::vector<T>& v) {
	T ret = 0;
	for (T& x : v) ret += x;
	return ret;
}

template <typename T>
istream& operator >> (istream & is, vector<T> & vec) {
	for (T& x : vec) is >> x;  return is;
}

template <typename S, typename T>
istream& operator >> (istream & is, pair<S, T> & p) {
	is >> p.first >> p.second; return is;
}

istream& operator >> (istream & is, point & p) {
	is >> p.x >> p.y;          return is;
}

template <typename T>
ostream& operator << (ostream & os, const vector<T> & vec) {
	for (const T& x : vec) os << x << " "; return os;
}

template <typename T>
ostream& operator << (ostream & os, const vector<vector<T>> & mat) {
	for (const vector<T>& m : mat)
		os << m << endl; return os;
}
template <typename S, typename T>
ostream& operator << (ostream & os, const pair<S, T> & p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template <typename T>
ostream& operator << (ostream & os, const set<T> & s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream & os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream & os, const point & p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	int N;
	cin >> N;
	cout << (N - 1) / 2 << endl;

	return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++) cin>>vec.at(i);
  sort(vec.begin(), vec.end());
  int sum=1;
  for(int i=0;i<N-1;i++){
    if(vec.at(i)<vec.at(i+1)) sum++;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3580
import * as fs from 'fs';
function main(input) {
  input = input.split("\n");
  const S: string = input[0];
  const T: string = input[1];
  let ans = T.length;
  for (let i = 0; i < S.length - T.length + 1; i++) {
    let same = 0;
    for (let k = 0; k < T.length; k++) {
      if (S[i + k] === T[k]) {
        same++;
      }
    }
    if (ans > T.length - same) {
      ans = T.length - same;
    }
  }
  console.log('%s', ans);
}

main(fs.readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 32304
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <assert.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <bitset>
// #include <iostream>
// #include <iomanip>
// #include <sstream>
using namespace std;
// const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
// const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dx[] = {2, 2, -2, -2, 1, 1, -1, -1};
// const int dy[] = {-1, 1, 1, -1, 2, -2, 2, -2};
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < (int)b ; i++)
#define frr(i, a, b) for(int i = a ; i >= (int)b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false)
#define boost2 cin.tie(NULL)
#define ln puts("")
#define mems(a) memset(a, 0, sizeof(a))
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
ll on_bit(ll x, int pos) {x |= (1ll << pos); return x;}
int off_bit(int x, int pos) {x &= ~(1 << pos); return x;}
bool is_on_bit(ll x, int pos) {return ((x & (1ll << pos)) != 0);}
int flip_bit(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int on_bit_all(int x, int pos) {x = (1 << pos)-1; return x;}
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int MOD = 1e9+7;
int add(ll a, ll b){return ((a%MOD)+(b%MOD))%MOD;}
int sub(ll a, ll b){return ((a%MOD)-(b%MOD))%MOD;}
int mult(ll a, ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll powmod(ll a,ll b){ll res=1;assert(b>=0);a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

int a[1234];

int main(){
	int n;
	sf("%d",&n);
	fr(i,0,n)sf("%d",a+i);
	sort(a,a+n);
	reverse(a,a+n);
	int res=a[0]/2;
	fr(i,1,n)res+=a[i];
	pf("%d\n",res);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define endl '\n'
const int mod=1e9+7,u=1e5+5;

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

    int n,m;
    cin>>n>>m;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }   

    int dp[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            dp[i][j]=0;
        }
    }

    dp[0][1]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1][j-1]=='.'){
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }
        }
    }
    cout<<dp[n][m];

    return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  double R;
  cin>>R;
  cout<<R*2.0*3.14159265358979<<endl;
  return 0;
}


Measured memory_bytes: 3784