akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

#define N 100200
const P defo = P(-INF, INF);

//head

int n;
vi G[N];
int k, val[N];
bool ok = true;
P dp[N];

P dfs(int i, int j) {
	P &res = dp[i] = defo;
	if(val[i] != -1) res = P(val[i], val[i]);
	for(int ne:G[i]) {
		if(ne == j) continue;
		P now = dfs(ne, i);
		if(res != defo and now != defo and ((res.first&1) == (now.first&1) or res.first > now.second+1 or res.second+1 < now.first)) ok = false;
		chmax(res.first, now.first-1);
		chmin(res.second, now.second+1);
	}
	return res;
}

void dfs2(int i, int j, int V) {
	int _;
	if(V-1 >= dp[i].first) _ = V-1;
	else _ = V+1;
	for(int ne:G[i]) {
		if(ne == j) continue;
		dfs2(ne, i, _);
	}
	val[i] = _;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	memset(val, -1, sizeof(val));
	cin >> n;
	rep(i, n-1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].emplace_back(b);
		G[b].emplace_back(a);
	}
	cin >> k;
	rep(i, k) {
		int v, p;
		cin >> v >> p;
		v--;
		val[v] = p;
	}
	dfs(0, -1);
	if(!ok) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	dfs2(0, -1, dp[0].first+1);
	rep(i, n) cout << val[i] << '\n';
}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N,M);
    vector<pair<ll,ll>> vec(N);
    rep(i,N){
        cin>>vec[i].first>>vec[i].second;
    }
    sort(all(vec));
    int cnt=M;
    ll ans=0;
    rep(i,N){
        if(vec[i].second<cnt){ans+=vec[i].first*vec[i].second;cnt-=vec[i].second;}
        else {ans+=cnt*vec[i].first;cnt=0;}
        if(cnt==0)break;
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int n = scanner.nextInt();
    int a = scanner.nextInt();
    int b = scanner.nextInt();

    int all = 0;

    for (int x = 1; x <= n; x++) {
      int sum = 0;

      for (String number : String.valueOf(x).split("")) {
        sum += Integer.parseInt(number);
      }


      if (a <= sum && sum <= b) {
        all += x;

      }

    }

    System.out.println(all);

    scanner.close();
  }
}


Measured memory_bytes: 33748
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	int a, b; cin >> a >> b;
	if(a > 0)
	{
		cout << "Positive" << endl;
		return;
	}
	else if (b < 0)
	{	
		if((b-a)%2) cout << "Positive" << endl;
		else cout << "Negative" << endl;
		return;
	}
	else cout << "Zero" << endl;
	return;
}

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


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005
#define L 100000
#define X 1000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail+1)%LEN;
}




P dequeue(){
  P x = Q[head];
  head = (head + 1)%LEN;
  return x;
  

}

int min(int a,int b ){return a<b?a:b;}



int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);
  if(n>L||q > X)
    return 0;
  

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    if(Q[i].t>L/2) return 0;
    
  }

  head = 1;tail = n+1;

  while(head != tail){
    u = dequeue();
    c = min(q,u.t);
    u.t -=c;
    elaps += c;
    if(u.t>0) enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  
  
  return 0;
}



Measured memory_bytes: 11884
#include <cstdio>

char s[5];

int main() {
    scanf("%s", s+1);
    if(s[1] == 'R' and s[2] == 'R' and s[3] == 'R')
        printf("3\n");
    else if(s[2] == 'R' and (s[1] == 'R' or s[3] == 'R'))
        printf("2\n");
    else if(s[1] == 'R' or s[2] == 'R' or s[3] == 'R')
        printf("1\n");
    else
        printf("0\n");
    return 0;
}

Measured memory_bytes: 1644
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int p[3];
void judge(){
  REP(j,3){
    if(p[j]==100){
      cout<<"A"<<endl;
      return;
    }
  }
  if(p[0]+p[1]>=180){
    cout<<"A"<<endl;
    return;
  }
  int sum=0;
  REP(j,3)sum+=p[j];
  if(sum>=240){
    cout<<"A"<<endl;
    return ;
  }
  if(sum>=210){
    cout<<"B"<<endl;
    return ;
  }
  if(sum>=150&&(p[0]>=80||p[1]>=80)){
    cout<<"B"<<endl;
    return ;
  }
  cout<<"C"<<endl;
}
int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    REP(i,n){
      REP(j,3)cin>>p[j];
      judge();
    }
  }

  return 0;
}

Measured memory_bytes: 0
#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 a, b;
    cin >> a >> b;
    if (a == b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 764
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

using P = pair<ll, ll>;

int main() {
  int N, K;
  while (cin >> N >> K) {
    vec<ll, 2> g(N);
    for (int i = 0; i < N; i++) {
      ll t, d;
      cin >> t >> d;
      --t;
      g[t].push_back(d);
    }
    vector<P> ps;
    for (int t = 0; t < N; t++) {
      if (g[t].empty()) continue;
      sort(g[t].rbegin(), g[t].rend());
      ps.emplace_back(g[t][0], 1);
      for (int i = 1; i < g[t].size(); i++) ps.emplace_back(g[t][i], 0);
    }
    sort(ps.rbegin(), ps.rend());
    vector<ll> seconds;
    ll X = 0, Y = 0;
    for (int i = 0; i < K; i++) {
      X += ps[i].fst;
      Y += ps[i].snd;
      if (ps[i].snd == 0) {
        seconds.push_back(ps[i].fst);
      }
    }
    ll res = X + Y * Y;
    for (int i = K; i < N && Y < K; i++) {
      if (ps[i].snd == 1) {
        ++Y;
        X += ps[i].fst;
        X -= seconds[K - Y];
        res = max(res, X + Y * Y);
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 7924
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL H[100001];
int main(){
	cin>>N;
	REP(i,N){
		cin>>H[i];
	}
	bool check=false;
	for(int i=N-1;i>=1;i--){
		if(H[i]<H[i-1]){
			H[i-1]--;
		}
		if(H[i]<H[i-1]){
			check=true;
		}
	}
	if(check){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
vector<P> prime_factorize(ll n) {
    vector<P> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


const int MAX = 200100;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    COMinit();
    int N, M; cin >> N >> M;
    vector<P> vec = prime_factorize(M);
    ll ans = 1;
    for (auto itr : vec) {
        ll tmp = COM(itr.second + N - 1, N - 1);
        ans = (ans * tmp) % MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int_max 1e18

int power(int x,int n)
{
    if(n==0)
        return 1;
    return x*power(x,n-1);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    // ll n;cin>>n;
    // while(n--)
    // {
        ll x;cin>>x;ll sum=100,ct=0;
        while(1)
        {
            if(sum>=x)break;
            sum+=sum*1/100;ct++;
        }cout<<ct;
    // }
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[300005];
ll SL[100005];
ll SR[100005];

int main() {
    ll N;
    cin >> N;

    REP(i, 3 * N) {
        cin >> A[i];
    }
    priority_queue<ll, vector<ll>, function<bool(ll, ll)>> q0([](ll a, ll b) { return a > b; });
    priority_queue<ll, vector<ll>, function<bool(ll, ll)>> q1([](ll a, ll b) { return a < b; });
    ll sl = 0, sr = 0;
    REP(i, N) {
        q0.push(A[i]);
        q1.push(A[3 * N - 1 - i]);
        sl += A[i];
        sr += A[3 * N - 1 - i];
    }
    SL[0] = sl;
    SR[N] = sr;
    REP(i, N) {
        {
            ll a = A[N + i];
            ll t = q0.top();
            if (a > t) {
                q0.pop();
                q0.push(a);
                sl += (a - t);
            }
        }
        {
            ll a = A[2 * N - 1 - i];
            ll t = q1.top();
            if (a < t) {
                q1.pop();
                q1.push(a);
                sr += (a - t);
            }
        }

        SL[i + 1] = sl;
        SR[N - 1 - i] = sr;
    }

    ll ans = -INF;
    REP(i, N + 1) {
        ans = std::max(SL[i] - SR[i], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5996
//keyence2019_b.cpp
//Sun Jan 13 20:54:09 2019

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (s=="keyence"){
		cout << "YES" << endl;
		return 0;
	}

	for (int i=0;i<s.length();i++){
		for (int j=i;j<s.length();j++){
			string temps = s;
			temps.erase(temps.begin()+i,temps.begin()+j);
			if (temps=="keyence"){
				cout << "YES" << endl;
				return 0;
			}
		}
	}


	cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  string S;
  cin>>N>>S;
  int ans=0;
  for(int i=0;i<N-1;i++){
  int sum=0;
    for(char j='a';j<='z';j++){
    bool a=false;
     bool b=false;
      for(int k=0;k<=i;k++)
        if(S.at(k)==j){
        a=true; break;
        }
      if(a){
      for(int k=i+1;k<N;k++)
        if(S.at(k)==j){
        b=true; break;
        }
       } if(b) sum++;}
  if(ans<=sum)
    ans=sum;
  
  }cout<<ans<<endl;
  
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int H,W,A,B,fac[222222];
#define mod 1000000007
int add(int x,int y){
	return (x+=y)<mod?x:x-mod;
}
int mul(int x,int y){
	return (int)((long long int)x*y%mod);
}
int pw(int x,int y){
	int r=1;
	while(1){
		if(y&1)r=mul(r,x);
		if(y>>=1)x=mul(x,x);else
			break;
	}
	return r;
}
int inv(int x){
	return pw(x,mod-2);
}
int c(int x,int y){
	--x;--y;
	return mul(fac[x+y],inv(mul(fac[x],fac[y])));
}
int main(){
	fac[0]=1;
	for(int i=1; i<222222; i++)
		fac[i] = mul(fac[i-1],i);
	scanf("%d%d%d%d",&H,&W,&A,&B);
	int res = 0;
	for(int i=B+1; i<=W; i++)
		res = add(res, mul(c(H-A,i),c(A, W-i+1)));
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 1024
ans = [0 for i in range(4)]
while True:
  sides = sorted([int(inp) for inp in input().split()])
  if sides[2] >= sides[1] + sides[0]:
    print(ans[0], ans[1], ans[2], ans[3])
    break
  if sides[2]**2 > sides[1]**2 + sides[0]**2:
    ans[3]+=1
  elif sides[2]**2 == sides[1]**2 + sides[0]**2:
    ans[1]+=1
  else:
    ans[2]+=1
  ans[0]+=1


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

int main(){
    ll N,M;
    cin>>N>>M;
    ll sum=0;
    int a[10000];
    rep(i,M){
        cin>>a[i];
        sum+=a[i];
    }
    ll ans=0;
    ans=N-sum>=0?N-sum:-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3656
n = int(input())
nums = list(map(int, input().split()))
res = 1
for i in range(n):
    if( nums[i] == 0):
        res = 0
if(res != 0):
    for i in range(n):
        res *= nums[i]
        if(res > 1000000000000000000):
            break
if res <= 1000000000000000000:
    print(res)
else:
    print(-1)

Measured memory_bytes: 21644
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    vector<int> v;
    for(int i=0;i<n;++i){
      int tmp;
      cin >> tmp;
      v.push_back(tmp);
    }
    sort(v.begin(),v.end());
    int ans=0;
    for(int i=1;i<n-1;i++){
      ans += v[i];
    }
    cout << ans / (n-2) << endl;

  }
  return 0;
}

Measured memory_bytes: 1220
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }

        sc.close();
    }
}

Measured memory_bytes: 35392
// x, a, b = gets.split.map(&:to_i)
// puts (x - a).abs < (x - b).abs ? "A" : "B"

use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    if s.is_empty() {
        None
    } else {
        s.parse::<T>().ok()
    }
}

fn main(){
    let x: i32 = read().unwrap();
    let a: i32 = read().unwrap();
    let b: i32 = read().unwrap();
    println!("{}", if (x - a).abs() < (x - b).abs() { "A" } else { "B" });
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
# define    PI                  3.14159265358979323846
 
int main()
{
    ll r;
    cin>>r;
 
    double ans = 2*PI*r;
    cout<<fixed<<setprecision(20)<<ans<<endl;
}


Measured memory_bytes: 3776
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>

#define REP(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define RREP(i,x,y) for(int i=(int)(x);i>(int)(y);i--)
#define all(x) (x).begin(),(x).end()

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;

using namespace std;

const ll MAX_N = 3 * 1000000;
ll N, A, B, K;
ll ncr[MAX_N];

const ll MOD_N = 998244353;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
    ll g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

ll modinv(ll a, ll m) {
    ll x, y;
    if (extgcd(a, m, x, y) == 1) {
        return (x + m) % m;
    } else {
        return 0;
    } // unsolvable
}

// nCr mod m = modc(n,r,m)
ll modc(ll a, ll b, ll m) {
    ll c = 1;
    REP(i, 0, b) {
        c = c * (a - i) % m;
        c = c * modinv(i + 1, m) % m;
    }
    return c;
}

void solve() {
    // K = A * a + B * b, 0 <= a,b <= N
    // answer = N C a + N C b

    ll answer = 0;

    // nCr   = (n-r+1)/r * nC(r-1)
    ncr[0] = 1;
    REP(i,1,N+1) {
        ncr[i] = ((N - i + 1) * modinv(i, MOD_N) % MOD_N) * ncr[i-1] % MOD_N;
    }

    REP(a,0,N+1) {
        if (K - A * a < 0 || (K - A * a) % B != 0) continue;

        ll b = (K - A * a) / B;

        answer += ncr[a] * ncr[b] % MOD_N;
        answer %= MOD_N;
    }

    printf("%lld\n", answer);

    return;
}

int main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> A >> B >> K;
    solve();
    return 0;
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int m;
	cin>>m;
	int a[m];
	for(int i=0;i<m;++i)
		cin>>a[i];
	long long dp[n+1];
	for(int i=0;i<m;++i)
		dp[a[i]]=-1;
	dp[0]=1LL;
	if(dp[1]!=-1)
		dp[1]=1LL;
	for(int i=2;i<=n;++i){
		if(dp[i]==-1)
			continue;
		dp[i]=0;
		if(dp[i-1]!=-1)
			dp[i]+=dp[i-1];
		if(dp[i-2]!=-1)
			dp[i]+=dp[i-2];
		dp[i]%=1000000007;
	}
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1408
N, M = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)

print(len(uf.roots())-1)

Measured memory_bytes: 12756
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            int m = sc.nextInt();
            int l = sc.nextInt();
            ArrayList<HashMap<Integer, Cost>> graph = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                graph.add(new HashMap<>());
            }
            for (int i = 0; i < m; i++) {
                int a = sc.nextInt() - 1;
                int b = sc.nextInt() - 1; 
                Cost cost = new Cost(sc.nextInt(), sc.nextInt());
                graph.get(a).put(b, cost);
                graph.get(b).put(a, cost);
            }
            int[][] dp = new int[n][l + 1];
            for (int i = 0; i < n; i++) {
                Arrays.fill(dp[i], Integer.MAX_VALUE);
            }
            search(0, 0, l, dp, graph);
            int min = Integer.MAX_VALUE;
            for (int i = 0; i <= l; i++) {
                min = Math.min(min, dp[n - 1][i]);
            }
            sb.append(min).append("\n");
        }
        System.out.print(sb);
    }
    
    static void search(int idx, int count, int remain, int[][] dp, ArrayList<HashMap<Integer, Cost>> graph) {
        if (remain < 0) {
            return;
        }
        if (dp[idx][remain] <= count) {
            return;
        }
        for (int i = remain; i >= 0 && dp[idx][i] > count; i--) {
            dp[idx][i] = count;
        }
        for (Map.Entry<Integer, Cost> entry : graph.get(idx).entrySet()) {
            int next = entry.getKey();
            Cost cost = entry.getValue();
            search(next, count, remain - cost.value, dp, graph);
            search(next, count + cost.count, remain, dp, graph);
        }
    }
    
    static class Cost {
        int count;
        int value;
        
        public Cost(int value, int count) {
            this.count = count;
            this.value = value;
        }
    }
}


Measured memory_bytes: 68096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

int M, N;
string c[500];

int main() {
    cin >> M >> N;
    for (int j = 0; j < M; ++j)  {
        cin >> c[j];
    }

    int idx[26], px[26][2], py[26][2];
    fill(idx, idx+26, 0);
    for (int j = 0; j < M; ++j) for (int k = 0; k < N; ++k) {
        if (c[j][k] != '.') {
            int a = c[j][k] - 'A';
            px[a][idx[a]] = j;
            py[a][idx[a]] = k;
            ++idx[a];
        }
    }

    int score = 0;
    bool updated = true;
    while (updated) {
        updated = false;
        for (int a = 0; a < 26; ++a) {
            if (idx[a] == 0) continue;
            int x1 = px[a][0], x2 = px[a][1], y1 = py[a][0], y2 = py[a][1];
            bool ok = true;
            if (x1 == x2) {
                ok = false;
                for (int j = min(y1, y2)+1; j < max(y1, y2); ++j) {
                    ok = true;
                    if (c[x1][j] != '.') { ok = false; break; }
                }
            } else if (y1 == y2) {
                ok = false;
                for (int j = min(x1, x2)+1; j < max(x1, x2); ++j) {
                    ok = true; if (c[j][y1] != '.') { ok = false; break; }
                }
            } else {
                int xl = min(x1, x2), yl = min(y1, y2), xh = max(x1, x2), yh = max(y1, y2); 
                char ch = a+'A';
                bool s1 = true, s2 = true, s3 = true, s4 = true;
                for (int tx = xl; tx <= xh; ++tx) {
                    if (c[tx][yl] != '.' && c[tx][yl] != ch) { s1 = false; break; }
                }
                for (int ty = yl; ty <= yh; ++ty) {
                    if (c[xl][ty] != '.' && c[xl][ty] != ch) { s2 = false; break; }
                }
                for (int tx = xl; tx <= xh; ++tx) {
                    if (c[tx][yh] != '.' && c[tx][yh] != ch) { s3 = false; break; }
                }
                for (int ty = yl; ty <= yh; ++ty) {
                    if (c[xh][ty] != '.' && c[xh][ty] != ch) { s4 = false; break; }
                }
                if ((x2-x1)*(y2-y1) > 0) {
                    ok = (s1 && s4) || (s2 && s3);
                } else {
                    ok = (s1 && s2) || (s3 && s4);
                }
            }
            if (ok) {
                score += 2;
                idx[a] = 0;
                c[x1][y1] = c[x2][y2] = '.';
                updated = true;
                continue;
            }
        }
    }
    cout << score << endl;

    return 0;
}

Measured memory_bytes: 3364
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[][] bingo = new int[3][3];

		for(int i = 0; i < 3; i++ ) {
			for(int j = 0; j < 3; j++) {
				bingo[i][j] = sc.nextInt();
			}
		}

		int counter = sc.nextInt();

		int[] dataout = new int[counter];
		for(int k = 0; k < counter; k++) {
			dataout[k] = sc.nextInt();
		}

		int[] check = new int[9];
		int data_i = 0;
		for(int i = 0; i < 3; i++ ) {
			for(int j = 0; j < 3; j++) {
				for(int k = 0; k < counter; k++) {
					check[data_i] = 0;
					if(bingo[i][j] == dataout[k]) {
						check[data_i] = bingo[i][j];
						break;
					}
				}
				data_i++;
			}
		}

		String print = "No";

		if((check[0] != 0 && check[1] != 0 && check[2] != 0) ||
			(check[0] != 0 && check[3] != 0 && check[6] != 0) ||
			(check[0] != 0 && check[4] != 0 && check[8] != 0) ||
			(check[1] != 0 && check[4] != 0 && check[7] != 0) ||
			(check[2] != 0 && check[4] != 0 && check[6] != 0) ||
			(check[2] != 0 && check[5] != 0 && check[8] != 0) ||
			(check[3] != 0 && check[4] != 0 && check[5] != 0) ||
			(check[6] != 0 && check[7] != 0 && check[8] != 0)) {
				print = "Yes";
		}
//		System.out.println(Arrays.toString(check));

		System.out.println(print);
		sc.close();
	}
}


Measured memory_bytes: 23252
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline


def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))

# mod=10**9+7
# rstrip().decode('utf-8')


def main():
	n,m=MI()
	ks=[LI() for _ in range(m)]
	s=[i[1:] for i in ks]
	p=LI()
	ans=0

	for i in range(1<<n):
		li=[0]*m
		for j in range(n):
			for k in range(m):
				if 1&i>>j:
					if j+1 in s[k]:
						li[k]=1-li[k]
		if p==li:
			ans+=1
	print(ans)










if __name__ == "__main__":
	main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  int n1 = n % 10;
  n = n / 10;
  int n2 = n % 10;
  n = n / 10;
  int n3 = n % 10;
  n = n / 10;
  int n4 = n;
 
  if (n1 == n2 && n2 == n3) {
    cout << "Yes" << endl;
  } else if (n2 == n3 && n3 == n4) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 101
#define INFTY 10000
#define BLACK 2
#define GRAY 1
#define WHITE 0

int prim(void);
int n,a[N][N];

int main(){

  int i,j;

  scanf("%d",&n);
  for(i=1; i<=n; i++){
    for(j=1; j<=n; j++){
      scanf("%d",&a[i][j]);
      if(a[i][j] == -1) a[i][j] = INFTY;
    }
  }

  printf("%d\n",prim());

  return 0;
}

int prim(){
  int i,u,v,minv,sum=0;
  int d[N],p[N],color[N];

  for(i=1; i<=n; i++){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[1] = 0;

  while(1){
    minv = INFTY;
    u = -1;
    for(i=1; i<=n; i++){
      if(minv>d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = BLACK;
    for(v=1; v<=n; v++){
      if(color[v] != BLACK && a[u][v] != INFTY) {
	if(d[v] > a[u][v]){
	  d[v] = a[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }
  for(i=1; i<=n; i++){
    if(p[i] != -1) sum += a[i][p[i]];
  }

  return sum;
}

Measured memory_bytes: 640
import sys
n,y=map(int,input().split())

if y >10000*n:
  print("-1 -1 -1")
  sys.exit()
for i in reversed(range(y//10000+1)):
  for j in reversed(range((y-i*10000)//5000+1)):
    d=10000*i+5000*j+1000*(n-i-j)
    if y==d:
      print(i,j,n-i-j)
      sys.exit()
else:
  print("-1 -1 -1")
      
    
  
  


Measured memory_bytes: 9184
k = int(input())

from collections import deque

queue = deque([1,2,3,4,5,6,7,8,9])
n = 0
while n < k:
  n += 1
  x = queue.popleft()
  if x%10 != 0:
    queue.append(x*10+x%10-1)
  queue.append(x*10+x%10)
  if x%10 != 9:
    queue.append(x*10+x%10+1)

print(x)

Measured memory_bytes: 11908
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n) {
    int a;
    cin >> a;
    mp[a]++;
  }
  int cnt = 0;
  for(auto p : mp) {
    int v = p.second;
    if(v%2==1) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 4992
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (a,p) = get!(usize, usize);
    println!("{}", (3*a+p)/2);
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
long long ans,now;
string s;
int main(){
	getline(cin,s);
	for(int i=0;i<s.size();i++)
		if(s[i]=='A')
			now++;
		else if(i<s.size()-1 && s[i]=='B' && s[i+1]=='C')
			ans+=now,i++;
		else now=0;
	cout<<ans<<endl;
	return 0;
}


//122222222222

//121212121212

//1212


Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	int N = getint();
	int A[100000];
	rep(i, N) A[i] = getint();

	set<int> ST;
	int M = sqrt(A[0]);
	for (int i = M; i >= 1; i--) {
		if (A[0] % i == 0) {
			ST.insert(i);
			ST.insert(A[0] / i);
		}
	}
	M = sqrt(A[1]);
	for (int i = M; i >= 1; i--) {
		if (A[1] % i == 0) {
			ST.insert(i);
			ST.insert(A[1] / i);
		}
	}
	for (auto itr = ST.rbegin(); itr != ST.rend(); itr++) {
		int k = 0;
		rep(i, N) {
			if (A[i] % (*itr)) k++;
			if (k > 1) break;
		}
		if (k <= 1) {
			printf("%d", *itr);
			break;
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
#define all(a) (a).begin(), (a).end()
template<typename T = int> using V = vector<T>;
template<typename T = int> using P = pair<T, T>;
using Vi = V<int>;
using Vl = V<ll>;
using Vd = V<ld>;
using VVi = V<Vi>;
using VVl = V<Vl>;
using VVd = V<Vd>;
using Pi = P<int>;
using Pl = P<ll>;
using Pd = P<ld>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); } // floor(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); } // ceil(log2(x))
inline int popcount(const ll x) { return __builtin_popcountll(x); }
inline void fail() { cout << -1 << '\n'; exit(0); }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
// const int INF  = 1<<30;
// const ll INFll = 1ll<<60;
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n, x, t; cin >> n >> x >> t;

  ll ans = (n+x-1)/x * t;
  cout << ans << '\n';
}


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N,H,W; cin >> N >> H >> W;
	cout << (N-H+1)*(N-W+1) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){

  int n; cin >> n;
  vector<int> v(n); rep(i,n){cin>>v[i];}
  sort(v.begin(),v.end());
  double ans=0;
  ans += (double)v[0]/pow(2,n-1);

  for (int i=n-1; i>=1; i--){
    ans += (double)v[n-i]/pow(2,i);
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 256
(let ((cl (list '(1 3 5 7 8 10 12)
                '(4 6 9 11)
                '(2)))
      (x (read))
      (y (read)))

  (defun judge (p lst)
    (if (null lst)
      nil
      (if (find p (car lst))
        (cons 1 (judge p (cdr lst)))
        (cons 0 (judge p (cdr lst))))))


  (format t "~A~%"
          (if (equal (judge x cl) (judge y cl))
            "Yes"
            "No")))


Measured memory_bytes: 23364
import java.util.*;

public class Main {
    static List<Integer> sosu;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        long sum = 0;
        for(long i=1;i<=T;i++){
            final long bai = (long)(T/i);
            final long cap = bai * i;
            sum += (cap+i) * (cap/i) / 2;
        }
        System.out.println(sum);
    }

}


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

char getBottom(char* w) {
	int i = 0;
	while (w[i] != 0) {
		i++;
	}
	return w[i - 1];
}

int main() {
	int n;
	int i,j;
	char w[100][11];
	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		scanf("%s",w[i]);
	}
  //重複チェック
	for (i = 0; i < (n-1); i++) {
		for (j = i+1; j < n; j++) {
			if (strcmp(w[i], w[j]) == 0) {
				printf("No\n");
				return 0;
			}
		}
	}
	for (i = 0; i < (n-1); i++) {
		if (w[i + 1][0] != getBottom(&(w[i][0]))) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");

	return 0;
}



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

int main(){
  ll n; cin >>n;
  string ans = "";
  while(n>0){
    n--;
    ans += (n%26)+'a';
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  int n;
  cin>>n;
  int ans=1e9;
  vector<int> v;
  v.push_back(1);
  for(int i=1,a=9;a<=n;a*=9,i++)v.push_back(a);
  for(int i=1,a=6;a<=n;a*=6,i++)v.push_back(a);
  int dp[100001]={};
  for(int i=1;i<=n;i++)dp[i]=1e9;
  dp[0]=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<v.size();j++){
      int ni=i+v[j];
      if(ni>n)continue;
      dp[ni]=min(dp[ni],dp[i]+1);
    }
  
  cout<<dp[n]<<endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int N, ans = 0;
	cin >> N;
	vector<int> V(N), C(N);
	for (int& i : V) cin >> i;
	for (int& i : C) cin >> i;
	for (int i = 0; i < N; i++) ans += max(0, V[i] - C[i]);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30);
#define ll long long
#define pi 3.14159265359
using namespace std;

int main()
{
    IOS;
    int x;
    int i=5;
    while(i--){
        cin>>x;
        if(x==0) return cout<<5-i,0;
    }
}


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

ll dp[101][101];

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i<=n;i++)
	{
		for(int j = 0;j<=n;j++)
		{
			dp[i][j] = 1e18;
		}
	}
	for(int i =0 ;i<=n;i++)
	{
		dp[i][i] = 0;
		dp[i][i+1] = 0;

	}
	vector<ll> r(n),c(n);
	for(int i = 0;i<n;i++)cin >> r[i] >> c[i];

	for(int i =0;i<n-1;i++)
	{
		dp[i][i+2] = r[i] * c[i] * c[i+1];
	}
	for(int haba = 3;haba<=n;haba++)
	{
		for(int i = 0;i<=n-haba;i++)
		{
			for(int j = 1;j<haba;j++)
			{
				ll now = dp[i][i+j]+dp[i+j][i+haba]+r[i]*r[i+j]*c[i+haba-1];
				//if(i==0&&haba==4)
				//{
					//cout<<';'<<i<<' '<<i+j<<' '<<i+haba<<endl;
					//cout<<dp[i][i+j]<<' '<<dp[i+j][i+haba]<<';'<<r[i]<<' '<<r[i+j]<<' '<<c[i+haba-1]<<endl;
					//cout<<' '<<now<<endl;
				//}
				dp[i][i+haba] = min(dp[i][i+haba],now);
			}
		}
	}
	//for(int i = 0;i<n-1;i++){cout<<dp[i][i+2]<<endl;}
	//cout<<dp[1][4]<<endl;
	cout<<dp[0][n]<<endl;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << 0.5 << endl;
  else
    cout << (double)(n / 2 + 1) / n << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
#include <vector>
#include <cassert>
#include <iomanip>

using namespace std;

long double dis_p(int p, vector<int> &x, vector<int> &y){
	assert(x.size() == y.size());	
	double sum = 0.0;
	for(int i = 0; i < x.size(); i++){
		int ab = abs(x[i] - y[i]);
		int ab_p = pow(ab, p);
		sum += ab_p;
	}
	return powl(sum, 1.0L / p);
}
double chebishev(vector<int> &x, vector<int> &y){
	assert(x.size() == y.size());	
	double max = 0.0;
	for(int i = 0; i < x.size(); i++){
		int ab = abs(x[i] - y[i]);
		if(max < ab){
			max = ab;
		}
	}
	return max;
}
void input(int num,vector<int> &v){
	for(int i = 0; i < num; i++){	
		int x;
		cin >> x;
		v.push_back(x);
	}
}
void output(long double num){
	cout << fixed << fixed << std::setprecision(8) << num << endl;
}
int main(int argc, char *argv[])
{
	int num;
	cin >> num;
	vector<int> x,y;
	input(num, x);
	input(num, y);
	for(int p = 1; p <= 3; p++){
		output (dis_p(p, x,y));
	}
	output (chebishev(x,y));
	return 0;
}

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

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

    int n, a, b, A, B;
    cin >> n >> a >> b;

    A = min(a,b);
    B = max(a,b);

    if((B-A-1) % 2){
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a,b;
  cin >> a >> b;
  if(a != 1 && b != 1) cout << 1 << endl;
  else if(a != 2 && b != 2) cout << 2 << endl;
  else cout << 3 << endl;
  }



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
const int N=1e5+10;
int n,a[N][3],dp[N][3];
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)
		scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
	for(register int i=1;i<=n;i++)
		for(register int j=0;j<3;j++)
			for(register int k=0;k<3;k++)
				if(j!=k)dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
	printf("%d\n",max(dp[n][0],max(dp[n][1],dp[n][2])));
	return 0;
}

Measured memory_bytes: 2560