akhauriyash/Code-Regression huggingface dataset:
// Author : Chi
// created :
// Sawal : Practice

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <pair<int,int>, null_type, greater<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define pii         pair<ll,ll>
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define ai(a)       for(auto &i:a)cin>>i;
#define ao(a)       for(auto i:a)cout<<i<<' ';
#define TEST1       solve();
#define mod         1000000007
#define aLL(x)      x.begin(),x.end()
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
//LOVE ALGO
//Make sure you have test cases (:->)
void solve(){
    int N;
    int ans=0;
    cin>>N;
    for(int i=1;i<=1000000;i++){
        for(int j=1;i*j<N && j<=1000000;j++){
            if(N-i*j>0)
                ans++;
            else
                break;
        }
    }
    cout<<ans<<"\n";
}
int main(){
    CHI
    TEST1
    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 1055050
ll dp[50][1<<20];
bool judge[N];
ll pw[50];
main(){
    ios_base::sync_with_stdio(false);
    int n=in();
    int x[3];
    rep(i,3)x[i]=in();
    int sum=x[0]+x[1]+x[2];
    ll ans=0;
    pw[0]=1;
    rep(i,20)pw[i+1]=pw[i]*2;
    dp[0][0]=1;
    vec all;
    rep(i,1<<sum){
        if((i&(1<<(x[2]-1))&&(i&(1<<(x[2]+x[1]-1))&&(i&1<<(sum-1)))))judge[i]=1;
        else all.pb(i);
    }
    rep(i,n){
        for(auto k:all){
            if(dp[i][k]==0)continue;
            rep2(j,1,7){
                ll next=(k*pw[j]+pw[j-1])%pw[sum];
                if(!judge[next])
                dp[i+1][next]=(dp[i][k]+dp[i+1][next])%MOD;
            }
            dp[i+1][0]=(dp[i+1][0]+dp[i][k]*3)%MOD;
        }
    }
    ll p=1;
    rep(i,n){
        p=p*10ll%MOD;
    }
    rep(i,1<<sum){
        p=(p-dp[n][i]+MOD)%MOD;
    }
    cout<<p<<endl;
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>
#define wz cout<<"-----"<<endl;

const int N = 1e5 + 10, INF = 0x3f3f3f3f , MOD = 1e9 + 7;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}


void init() {

}

int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    init();
    int n,s;cin>>n>>s;
    if(s % 1000 != 0) {
        printf("-1 -1 -1\n");
    } else {
        s /= 1000;
        bool flg = false;
        for(int i = 0;i <= 20000;i++) {
            for(int j = 0;j <= 10000;j++) {
                if(i + j*5 > s) {
                    continue;
                }
                if( ((s - (i + j*5)) % 10 == 0 ) ) {
                    if(i + j + ((s - (i + j*5))/10) == n) {
                        printf("%d %d %d\n",((s - (i + j*5))/10),j,i);
                        return 0;
                    }
                }
            }
        }
        printf("-1 -1 -1\n");
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <atcoder/all> 
#define f(i,a,b) for( ll  i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter   ios::sync_with_stdio(false);cin.tie(0)

// policy-based



using namespace std;
using namespace atcoder;

typedef int ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;



 
const ll MAX = 2e5 + 100;
const ll inf = 1e9;
const ll mod = 1e9+7;

vector<pair<ii,ll> > p;
int main(){
	fastio;
	ll n,x,y;
	cin >> n;
	dsu d(n);
	f(i,0,n){
		cin >> x >> y;
		p.push_back({{x,y},i});
	}
	sort(all(p));
	priority_queue<ii,vector<ii>, greater<ii> > q;
	f(i,0,n){
	//	cout << p[i].ff.ss <<" ";
		bool go = true;
		ii aux1 = ( q.empty()? mp(0,0) :q.top() );
		while(!q.empty() ){
			ii aux = q.top();
			if(aux.ff > p[i].ff.ss) break;
			go = false;
			d.merge(p[i].ss,aux.ss);
			q.pop();
		}
		if(go) q.push({p[i].ff.ss,p[i].ss});
		else q.push(aux1);
	}
//	cout << endl;
	f(i,0,n){
		cout << d.size(d.leader(i)) << endl;
	}
	return 0;
}

Measured memory_bytes: 7200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=2e5+5;

vi v[maxn];
bool visited[maxn];
int ans[maxn];

int32_t main(){
    fast_io;
    int n,m;
    cin>>n>>m;
    for (int i = 0; i < m; ++i)
    {
        int x,y;
        cin>>x>>y;
        v[x].emplace_back(y);
        v[y].emplace_back(x);
    }
    vi curr;
    curr.emplace_back(1);
    while(!curr.empty()){
        vi comingup;
        for(const auto &it:curr){
            for(const auto &id:v[it]){
                if(visited[id]) continue;
                ans[id] = it;
                visited[id] = 1;
                comingup.emplace_back(id);
            }
        }
        curr = comingup;
    }
    show("Yes");
    fo(i,2,n){
        disp(ans[i]);
    }
    cout<<endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

ll sum() { return 0; }
template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;

void solve() {

}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif

//    int tc; cin >> tc;
//    TC(tc) solve();
	int n, a, b;
	cin >> n >> a >> b;
	OUT(min(n*a, b));

    return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

const int MOD = 1e9+7;

int ans[505][505];

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int H, W, Y, X;
    scanf("%d%d%d%d",&H,&W,&Y,&X);
    
    long s = 0;
    times(H, i) times(W, j) {
        ans[i][j] = (i % Y == Y - 1 && j % X == X - 1) ? -1-4000*(X*Y-1) : 4000;
        s += ans[i][j];
    }
    if(s > 0) {
        cout << "Yes\n";
        times(H, i) {
            times(W, j) cout << (j?" ":"") << ans[i][j]; cout ln;
        }
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
//__builtin_popcountll()
const int mx=1000005; 
int p[mx];

void sieve() 
{ 
    for(int i=0;i<mx;i++)
    p[i]=0;
    p[0] = p[1] = 1; 
    for (int i = 2; i < mx; i++) { 
        if (p[i] == 0) { 
            for (int j = i * 2; j < mx; j += i) { 
                if (p[j] == 0) { 
                    p[j] = i; 
                } 
            } 
            p[i] = i; 
        } 
    } 
} 
int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	sieve();
    	int n,i,j;
    	cin>>n;
    	int a[n];
    	int x=0;
    	map<int,int>m;
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
    		x=__gcd(x,a[i]);
		}
		
		
		if(x!=1)
		{
			cout<<"not coprime\n";
			return 0;
		}
		int f=0;
		for(i=0;i<n;i++)
		{
			x=a[i];
			while(x>1)
			{
				int y=p[x];
			    if(m.find(y)!=m.end())
			    f=1;
			    m[y]++;
				while(x%y==0)
				x=x/y;
			}
			
		}
		if(f)
		{
			cout<<"setwise coprime\n";
		}
		else
		{
			cout<<"pairwise coprime\n";
		}
		
		
    	
		
    
    	

    }

}


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

int main() {
  char c;
  cin >> c;
    if (c =='a' || c=='i' || c =='u' || c=='e' ||  c=='o' ){
      cout << "vowel";
   }
   else{
    cout <<"consonant";
   }

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

bool connected(int n, vector<int>& a, vector<int>& b)
{
    vector<bool> visited(n);
    const int m = a.size();

    function<void(int)> visit = [&](int node){
        visited[node] = true;
        for (int i = 0; i < m; i++) {
            if (a[i] == node && !visited[b[i]]) {
                visit(b[i]);
            }
            if (b[i] == node && !visited[a[i]]) {
                visit(a[i]);
            }
        }
    };
    visit(0);

    return all_of(visited.begin(),
                  visited.end(),
                  [](bool b){return b;});
}

int main()
{
    int n, m;
    cin >> n >> m;

    vector<int> a(m), b(m);
    for (int i = 0; i < m ; i++) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    int count = 0;
    for (int i = 0; i < m; i++) {
        vector<int> aa(a), bb(b);
        aa.erase(aa.begin() + i);
        bb.erase(bb.begin() + i);
        count += connected(n, aa, bb) ? 0 : 1;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	r := 0
	for i := 1; i <= n; i += 2 {
		y := 1
		for j := 3; j <= n; j += 2 {
			if i%j == 0 {
				y++
			}
		}
		if y == 8 {
			r++
		}
	}
	fmt.Println(r)
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
double abs(double x){
  return (x<0?-x:x);
}
int main(){
  int N, T, A;
  cin>>N>>T>>A;
  int H[N];
  for(int i=0; i<N; i++) cin>>H[i];
  int min_idx=0;
  for(int i=0; i<N; i++) {
    if(abs(A-(T-H[i]*0.006))<abs(A-(T-H[min_idx]*0.006)))
      min_idx=i;
  }
  cout<<min_idx+1<<endl;
  return 0;
}

Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/

bool cmp(pint a, pint b) { return a.second < b.second; }

int main() {
    ll M;
    cin>> M;
    vector<pint> A(M);
    rep(i,M){
      ll xx,yy;cin>>xx>>yy;
      A[i].first=xx-yy;
      A[i].second=xx+yy;
    }
    sort(ALL(A),cmp);
    ll res = 0;
    ll endtime = -MOD;
    rep(i,M) {
        if (A[i].first >= endtime) {
            endtime = A[i].second;
            ++res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, k, ans = 1; cin >> n >> k;
	for (int h = 1; h < n; h++) {
		ans = ans * (k - 1);
	}
	cout << ans * k << endl;
	cin >> n;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
int main() {
  string s,ans="";
  cin >> s;
  for(int i=0;i<s.size();i++){
    if (s.at(i)=='0') ans += "0";
    else if (s.at(i)=='1') ans += "1";
    else{
      if(ans.size()!=0) ans.erase(ans.size()-1,1);
    }
  }
  cout << ans <<endl;
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

ll n,ans,x,lst;

int main(){
	n=readint();
	for(int i=1;i<=n;i++){
		x=readint();
		if(lst&&x) x--,ans++;
		ans+=x/2;
		lst=x&1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val as = Array.fill(n)(sc.nextLong)
  var i = as.sum
  var min = Integer.MAX_VALUE.toLong
  as.drop(1).reverseIterator.foreach { a =>
    i -= a * 2
    if (math.abs(i) < min) min = math.abs(i)
  }
  println(min)
}

Measured memory_bytes: 70520
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int N, M; cin >> N >> M;
  vector<vector<int>> path(N);
  int u, v;
  for (int i=0; i<M; i++) {
    cin >> u >> v;
    path[u-1].push_back(v-1);
  }

  int S, T;
  cin >> S >> T; S--; T--;

  queue<tuple<int, int>> Q;
  
  int ans = -1;
  int now, dist;
  vector<bool> visited(N*3, false);
  Q.emplace(S, 0);
  visited[S] = true;
  while(Q.size() != 0){
    tie(now, dist) = Q.front(); Q.pop();
    if (now + N * (dist%3) == T){
      ans = dist/3;
      break;
    }
    for (auto next : path[now]){
      if (visited[next + N * ((dist + 1)%3)] == false){
          Q.emplace(next, dist+1);
          visited[next + N * ((dist + 1)%3)] = true;
      }
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main()
{
    int T, H, M, S;

    cin >> T;

    H = T / 3600;

    M = (T / 60) % 60;

    S = T % 60;

    cout << H << ':' << M << ':' << S << endl;

    return 0;
}


Measured memory_bytes: 3096
import fractions
N, X= map(int,input().split())
x = list(map(int,input().split()))
for i in range(N):
  x[i] = abs(X - x[i])

ans = x[0]
for i in range(1,N):
  ans = fractions.gcd(ans, x[i])
  
print(ans)

Measured memory_bytes: 16240
//
// author  : Abhishek
//
#include <bits/stdc++.h>
#include<chrono>

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll MOD = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

void print(vector<pair<ll, ll> > v) {
    ll i;
    fo(i, v.size()) {
        cout << v[i].first << " " << v[i].second << "\n";
    }
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}

ll power(ll n, ll r) {
    if (r == 0) return 1;
    if (r == 1) return n;
    if (isEven(r)) {
        ll small = power(n, r / 2);
        return (small * small) % MOD;
    } else {
        ll small = power(n, r - 1);
        return (small * n) % MOD;
    }
}

ll modInv(ll a) {
    return power(a, MOD - 2);
}

void solve() {
    ll t = 1;
//    cin >> (t);
    while (t--) {

        ll i, j, k, n, m, p, q, x, y, a, b, l, r;

        cin >> n >> k;
        vector<ll> arr;
        arr = read(n);
        sort(all(arr));
        if (k == 1) {
            cout << 0;
            return;
        }

        vector<ll> add(n, 0), sub(n, 0);

        i = k - 1;
        ll cur = 1;
        while (i < n) {
            add[i] = cur;
            i++;
            cur *= (i);
            cur %= MOD;
            cur *= modInv(i - k + 1);
            cur %= MOD;
        }

//        print(add);

        sub = add;
        reverse(all(sub));

//        print(sub);


        ll s;
        a = 0, s = 0;
        fo(i, n) {
            a += (add[i] * arr[i]) % MOD;
            a %= MOD;
        }

        fo(i, n) {
            s += (sub[i] * arr[i]) % MOD;
            s %= MOD;
        }

        cout << ((a - s) % MOD + MOD) % MOD;

    }
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    solve();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 5524
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

        int nDataSets = sc.nextInt();

        for (int i = 0; i < nDataSets; i++) {
            ArrayList<Integer> nums = new ArrayList<Integer>();
            nums.add(sc.nextInt());
            nums.add(sc.nextInt());
            nums.add(sc.nextInt());
            Collections.sort(nums);

            int a = nums.get(0);
            int b = nums.get(1);
            int c = nums.get(2);

            if (Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}

Measured memory_bytes: 33304
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
class Tree{
private:
  int n;//number of node
  int m;
  vector<vector<int>> edge;// edge does not have cost.
  vector<vector<pair<int,ll>>> edge2;// edge has cost.
  vector<ll> d;
public:  
  //*****Constructor************
  Tree(int n_){
    n = n_;
    edge.resize(n);
  }

  Tree(int n_,int m_,vector<int> a,vector<int> b){
    n = n_;
    m = m_;
    edge.resize(n);
    rep(i,m){
      edge[a[i]].push_back(b[i]);
      edge[b[i]].push_back(a[i]);
    }
  }

  Tree(int n_,int m_,vector<int> a,vector<int> b,vector<ll> c){
    n = n_;
    m = m_;
    edge2.resize(n);
    rep(i,m){
      edge2[a[i]].push_back({b[i],c[i]});
      edge2[b[i]].push_back({a[i],c[i]});
    }
  }  
  //*******************************************

  void bfs(){
    d.assign(n,-1);
    d[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
      int v = q.front();q.pop();
      for(auto w:edge2[v]){
	if(d[w.first]>=0) continue;
	d[w.first] = d[v] + w.second;
	q.push(w.first);
      }
    }
    rep(i,n){
      if(d[i]%2==0) cout << 0 << "\n";
      else cout << 1 << "\n";
    }
  }
  
};



int main()
{
  int n;cin >> n;
  vector<int> a(n-1),b(n-1);
  vector<ll> c(n-1);
  rep(i,n-1){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;b[i]--;
  }
  Tree tr(n,n-1,a,b,c);
  tr.bfs();
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e9;

int main() {
  ll x, y, z, k;
  cin >> x >> y >> z >> k;

  vector<ll> a(x), b(y), c(z);
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];

  vector<ll> subtot;
  rep(i, x) rep(j, y) subtot.push_back(a[i] + b[j]);
  sort(subtot.begin(), subtot.end(), greater<ll>());
  subtot.resize(k);

  vector<ll> tot;
  rep(i, k) rep(j, z) tot.push_back(subtot[i] + c[j]);
  sort(tot.begin(), tot.end(), greater<ll>());
  rep(i, k) cout << tot[i] << endl;
  return 0;
}


Measured memory_bytes: 43112
#include<iostream>
#include<algorithm>
using namespace std;
long memo[100][100];
long a[100],b[100];
long f(int l,int r)
{
	if(memo[l][r]>0)return memo[l][r];
	else if(l==r)return 0;
	long ans=1LL<<32;
	for(int i=l;i<r;i++)
	{
		ans=min(ans,f(l,i)+f(i+1,r)+a[l]*b[i]*a[i+1]*b[r]);
	}
	return memo[l][r]=ans;
}
main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	cout<<f(0,n-1)<<endl;
}



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

int main(void){
    int N,K;
    cin >> N >> K;
  
  	int count = 0;
  	for(int i=0;i<N;i++){
    	int temp=0;
      	cin >> temp;
      	if(temp>=K)count++;
    }
  	cout << count <<"\n";
    return 0;
}

Measured memory_bytes: 256
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
  ($line:expr, $name:ident, $t:tt) => {
    let $name = value!($line, $t);
  };
}

macro_rules! values_def {
  ($lines:expr, $n:expr, $name:ident, $t:tt) => {
    let $name = {
      let mut vec = Vec::new();
      for i in 0..$n {
        let mut next = $lines.next().unwrap().split_whitespace();
        vec.push(value!(next, $t));
      }
      vec
    };
  };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
  let mut input = String::new();
  io::stdin().read_to_string(&mut input).unwrap();
  let output = solve(input.trim().to_string());
  println!("{}", output);
}

fn solve(input: String) -> String {
  input!(input=>(n:usize){n-1;list:(@,@,i64)});
  let mut map = Vec::new();
  map.resize(n, Vec::new());
  let mut res = Vec::new();
  res.resize(n, false);
  for (a, b, c) in list {
    map[a].push((b, c % 2 == 0));
    map[b].push((a, c % 2 == 0));
  }
  f(&mut res, n + 10, &map, 0, false);
  res
    .into_iter()
    .map(|x| (if x { 1 } else { 0 }).to_string())
    .collect::<Vec<_>>()
    .join("\n")
    .to_string()
}

fn f(res: &mut Vec<bool>, old: usize, map: &Vec<Vec<(usize, bool)>>, i: usize, c: bool) {
  for &(a, w) in &map[i] {
    if a != old {
      let color = if w { c } else { !c };
      res[a] = color;
      f(res, i, map, a, color);
    }
  }
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3\n1 2 2\n2 3 1\n" => "0\n0\n1\n",
    test2: "5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n" => "1\n0\n1\n0\n1\n",
}


Measured memory_bytes: 26868
n,k = map(int, input().split())
to = [[0] * n for i in range(60)]
to[0] = list(map(int, input().split()))

# ダブリング
for i in range(n):
    to[0][i] -= 1
DOUBLING = 60
for i in range(DOUBLING-1):
    for j in range(n):
        to[i+1][j] = to[i][to[i][j]]
v = 0
for d in range(DOUBLING, -1, -1):
    l = (1 << d)
    if l <= k:
        v = to[d][v]
        k -= l

print(v + 1)

Measured memory_bytes: 186232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a[1000],b[1000],c[1000],d,n,m,x,y,k,h,w,sum,mi,ma,ans,s,t,l,r,res,tmp;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<int,int> > VP;

int main(){
    cin>>n;
    rep(i,n)cin>>c[i]>>a[i]>>b[i];
    rep(j,n-1){
        tmp=a[j];
        d(tmp);
        rep(i,j,n-1){
            if (tmp<=a[i])tmp=a[i]+c[i];
            else tmp=a[i]+(int)ceil((double)(tmp-a[i])/b[i])*b[i]+c[i];
            d(tmp);
        }
        p(tmp);
    }
    p(0);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
long long gcd(long long a,long long b)
{
    if(a%b==0) return b;
    long long c=a%b;
    return gcd(b,c);
}
int main() {
    long long a,b;
    cin>>a>>b;
    int ans=1;
    long long n;
    n=gcd(a,b);
    for(long long i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            ans++;
            while(n%i==0) n/=i;
        }
    }
    if(n>1) ans++;
    printf("%d\n",ans);
}


Measured memory_bytes: 3704
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
char all[200005];
int main()
{
    long long int t=0,ans=0,i;
    scanf("%s",all);
    for(i=0;all[i]!='\0';i++)
    {
        if(all[i]=='B') t++;
        else ans+=t;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 384
import random

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1

        if y != n - 1 and t & 1 == 0:
            return False

    return True

a = int(input())

while True:
 if is_prime(a) == 1:
  break
 a = a + 1

print(a)



Measured memory_bytes: 3316
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws Exception {

		Set<Integer> data = new HashSet<>();

		// --- input ---
		int num = Integer.parseInt(in.readLine());
		for(int i=0; i < num; i++) {
			data.add(Integer.parseInt(in.readLine()));
		}
		in.close();

		// --- resolv ---
		System.out.println(data.size());
	}
}

Measured memory_bytes: 23124
A, B, C, D = map(int, input().split())

def calc_attacks(HP, AT):
    q, mod = divmod(HP, AT)
    if mod != 0:
        q += 1
    return q
tkh = calc_attacks(A, D)
aok = calc_attacks(C, B)
if tkh >= aok:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9088
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var sum = 0;
            for(var i = 0;i<N;i++)
            {
                var tmp = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                sum += tmp[1] - tmp[0] + 1;
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
	ll n;cin>>n;
	vector<ll>a(n);
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a.rbegin(),a.rend());
	ll total=0;ll jump=1;
	for(ll i=1;i<n;i+=2){
		total+=a[i-jump];
		if(i+1<n)
		total+=a[i+1-jump];
		jump++;
	}
	cout<<total;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);	 
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 4788
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskD {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			long a = in.nextLong();
			long b = in.nextLong();
			int[] h = new int[n];
			int hmax = 0;
			for (int i = 0; i < n; i++) {
				h[i] = in.nextInt();
				hmax = Math.max(hmax, h[i]);
			}
			long l = 0;
			long r = hmax;
			while (r - l > 1) {
				long m = l + (r - l) / 2;
				if (can(n, a, b, h, m)) {
					r = m;
				} else {
					l = m;
				}
			}
			out.println(r);
		}

		private boolean can(int n, long a, long b, int[] h, long k) {
			long need = 0;
			long d = a - b;
			for (int i = 0; i < h.length; i++) {
				long x = h[i];
				x -= k * b;
				if (x <= 0) {
					continue;
				}
				need += (x + d - 1) / d;
			}
			return need <= k;
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}



Measured memory_bytes: 38764
#include <stdio.h>
#include <string.h>

#define M  1000003/* your task*/
#define L 12

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return (key % (M-1)) +1; }

int find(char str[]){
  int key,i,j;

  key = getKey(str);
  for(i=0;i<M;i++){
    j = (h1(key) +i * h2(key)) % M;
    if(H[j][0] == '\0') return 0;
    else if(strcmp(H[j],str) == 0){
      return 1;
      break;
    }
  }
}

int insert(char str[]){
  int key,i,j;

  key = getKey(str);
  for(i=0;i<M;i++){
    j = (h1(key) +i * h2(key)) % M;
    if(H[j][0] == '\0'){
      strcpy(H[j],str);
      break;
    }
  }
  return 0;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)){
        printf("yes\n");
      }    else {
        printf("no\n");
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 13508
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var u = ReadInts();
            var list = new List<int>(u);
            list.Sort();

            double now = 0;
            now = (list[0] + list[1]) / 2.0;
            for (int i = 2; i < n ; i++)
            {
                now = (now + list[i]) / 2.0;
            }
            WriteLine(now);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }

        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int n,x,q,m;
    deque<int> deq;
    cin >> n;
    rep(i,n){
        cin >> q >> m;
        if(q==0){
            cin >> x;
            if(m==0){
                deq.push_front(x);
            }else {
                deq.push_back(x);
            }
        }else if(q==1){
            cout << deq[m] << endl;
        }else{
            if(m==0){
                deq.pop_front();
            }else{
                deq.pop_back();
            }
        }
    }
}


Measured memory_bytes: 4612
ab = input().split()
a = int(ab[0])
b = int(ab[1])
cnt = a
ans = 0

while cnt <= b:
    a_str = str(cnt)
    if a_str[0] == a_str[4] and a_str[1] == a_str[3]:
        ans += 1
    cnt += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    int e,y,M,T,S,H;
    cin>>e>>y;
  
 if(e==0){if(y>=1867&&y<=1911){cout<<"M"<<y-1867<<endl;}
  if(y>=1912&&y<=1925){cout<<"T"<<y-1911<<endl;}
  if(y>=1926&&y<=1988){cout<<"S"<<y-1925<<endl;}
  if(y>=1989&&y<=2016){cout<<"H"<<y-1988<<endl;}
}
else if(e==1){cout<<1867+y<<endl;
}
else if(e==2){cout<<1911+y<<endl;
}
else if(e==3){cout<<1925+y<<endl;
}
else if(e==4){cout<<1988+y<<endl;
}
}


Measured memory_bytes: 3136
# include <iostream>
# include <vector>
# include <queue>
# include <cstring>
# include <cstdio>
# include <algorithm>
# include <cmath>
# include <cstdlib>
# include <map>
# include <set>
# define eps 1e-15
# define inf 2000000000
# define MAXN 200010
# define MOD 1000000007
using namespace std;
int vis[MAXN],head[MAXN*2],nxt[MAXN*2],to[MAXN*2],tot,n,m,d[MAXN];
queue<int> q;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		nxt[++tot] = head[u];to[tot] = v;head[u] = tot;
		nxt[++tot] = head[v];to[tot] = u;head[v] = tot;
	}
	q.push(1);
	while(!q.empty())
	{
		int u = q.front();
		vis[u] = 1;
		q.pop();
		for(int i = head[u];i;i = nxt[i])
			if(!vis[to[i]])
			{
				q.push(to[i]);
				d[to[i]] = d[u]+1;
			}
	}
	if(vis[n] && d[n] <= 2)
		puts("POSSIBLE");
	else
		puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 6912
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>  
#include<cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include<map>
#include<algorithm>
#include<functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<list>
#include<deque>
#include<climits>
#include<typeinfo>
#include<utility>
#define LEN 100005
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpc[10000][10000];

//void nCr(ll n, ll r) {
//	ll ans = 1;
//	for (int i = n; i > n - r; --i) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; ++i) {
//		ans = ans / i;
//	}
//	printf("%d",ans);
//}

ll combination(ll n, ll r) {
	if (n == r) { return dpc[n][n] = 1; }
	else if (r == 0) { return dpc[n][0] = 1; }
	else if (r == 1) { return dpc[n][1] = n; }
	else if (dpc[n][r]) { return dpc[n][r]; }
	else { return dpc[n][r] = combination(n - 1, r - 1) + combination(n - 1, r); }
}

//cout << fixed << setprecision(10);


int main() {

	int n;
	int ans = 1;
	cin >> n;
	vector<string>s(n);
	for (int i = 0;i < n;i++) { cin >> s[i]; }
	sort(s.begin(), s.end());

	for (int i = 0;i < n;i++) {
		if (i != 0) {
			if (s[i - 1] != s[i])ans++;
		}

	}

	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 9600
icase=0
if icase==0:
    n=int(input())
    t,a=map(int,input().split())
    h=list(map(int,input().split()))
    imin=0
    aimin=abs(t-h[0]*0.006-a)
    for i in range(1,n):
        ai=abs(t-h[i]*0.006-a)
        if ai<aimin:
            imin=i
            aimin=ai
    print(imin+1)

Measured memory_bytes: 3064
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    S = input()

    rem_size = len(S) - 7
    if rem_size < 0:
        print(NO)
        return

    for b in range(len(S) - rem_size + 1):
        t = S[:b] + S[b + rem_size:]
        if t == "keyence":
            print(YES)
            return
    print(NO)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3952