akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

struct Dice{
  Dice(vector<int>& dice) : dice_(dice) {
    east_.push_back(4);    east_.push_back(2);
    east_.push_back(1);    east_.push_back(6);
    east_.push_back(5);    east_.push_back(3);
    north_.push_back(2);    north_.push_back(6);
    north_.push_back(3);    north_.push_back(4);
    north_.push_back(1);    north_.push_back(5);
    south_.push_back(5);    south_.push_back(1);
    south_.push_back(3);    south_.push_back(4);
    south_.push_back(6);    south_.push_back(2);
    west_.push_back(3);    west_.push_back(2);
    west_.push_back(6);    west_.push_back(1);
    west_.push_back(5);    west_.push_back(4);
  }

  void East(){
    vector<int> tmp(dice_);
    for(int i=0; i<6; i++)
      dice_[i] = tmp[east_[i]-1];
  }

  void North(){
    vector<int> tmp(dice_);
    for(int i=0; i<6; i++)
      dice_[i] = tmp[north_[i]-1];
  }

  void South(){
    vector<int> tmp(dice_);
    for(int i=0; i<6; i++)
      dice_[i] = tmp[south_[i]-1];
  }

  void West(){
    vector<int> tmp(dice_);
    for(int i=0; i<6; i++)
      dice_[i] = tmp[west_[i]-1];
  }

  void Ans(int x, int y){
    vector<int> tmpv;
    tmpv.push_back(1);    tmpv.push_back(2);
    tmpv.push_back(3);    tmpv.push_back(4);
    tmpv.push_back(5);    tmpv.push_back(6);
    Dice tmp(tmpv);

    if(x == 2)
      tmp.North();
    else if(x == 5)
      tmp.South();
    else if(x == 3)
      tmp.West();
    else if(x == 4)
      tmp.East();
    else if(x == 6){
      tmp.North();
      tmp.North();
    }
    while(tmp.dice_[1] != y || tmp.dice_[0] != x){
      tmp.East();
      tmp.South();
      tmp.West();
    }

    vector<int> xx = dice_;

    for(int i=0; i<6; i++){
      dice_[i] = xx[tmp.dice_[i]-1];
    }
  }

  bool operator==(const Dice& l){
    if(this->dice_ == l.dice_)
      return true;
    else
      return false;
  }

  void Print(){
    for(int i=0; i<6; i++)
      cout << dice_[i] << " ";
    cout << endl;
  }

  vector<int> dice_;
  vector<int> east_;
  vector<int> north_;
  vector<int> south_;
  vector<int> west_;
};

int main(){
  vector<int> a(6), b(6);
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  cin >> b[0] >> b[1] >> b[2] >> b[3] >> b[4] >> b[5];
  Dice dA(a), dB(b);

  bool flag = false;
  for(int i=1; i<=6; i++){
    for(int j=1; j<=6; j++){
      if(i+j != 7 && i != j){
	dB.dice_ = b;
	dB.Ans(i, j);
	if(dA == dB)
	  flag = true;
      }
      if(flag)
	break;
    }
    if(flag)
      break;
  }
  
  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1224
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#define INF (2000000000)
#define MOD (1000000007)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef pair<int, int> P;


typedef struct
{
	int tx, ty, kx, ky;
} POS;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int maze[100][100];
int X, Y;
POS f;
int d[52][52][52][52];

int search()
{
	queue<POS> que;
	
	for (int i = 0; i < 52; i++){
		for (int j = 0; j < 52; j++){
			for (int k = 0; k < 52; k++){
				for (int l = 0; l < 52; l++){
					d[i][j][k][l] = INF;
				}
			}
		}
	}
	
	que.push(f);
	d[f.tx][f.ty][f.kx][f.ky] = 0;
	
	while (que.size()){
		POS now = que.front();
		que.pop();
		
		//printf("%d %d %d %d\n", now.tx, now.ty, now.kx, now.ky);
		
		if (now.tx == now.kx && now.ty == now.ky){
			return (d[now.tx][now.ty][now.kx][now.ky]);
		}
		
		for (int i = 0; i < 4; i++){
			POS to;
			//if (maze[now.tx + dx[i]][now.ty + dy[i]] && maze[now.kx - dx[i]][now.ky - dy[i]]){
			//	continue;
			//}
			
			if (maze[now.tx + dx[i]][now.ty + dy[i]]){
				to.tx = now.tx;
				to.ty = now.ty;
			}
			else {
				to.tx = now.tx + dx[i];
				to.ty = now.ty + dy[i];
			}
			
			if (maze[now.kx - dx[i]][now.ky - dy[i]]){
				to.kx = now.kx;
				to.ky = now.ky;
			}
			else {
				to.kx = now.kx - dx[i];
				to.ky = now.ky - dy[i];
			}
			
			//to.tx = now.tx + dx[i];
			//to.ty = now.ty + dy[i];
			//to.kx = now.kx - dx[i];
			//to.ky = now.ky - dy[i];
			
			//printf("%d %d %d %d\n", to.tx, to.ty, to.kx, to.ky);
			
			if (d[to.tx][to.ty][to.kx][to.ky] == INF && d[now.tx][now.ty][now.kx][now.ky] < 99){
				que.push(to);
				d[to.tx][to.ty][to.kx][to.ky] = d[now.tx][now.ty][now.kx][now.ky] + 1;
			}
		}
	}
	
	return (-1);
}

int main()
{
	while (scanf("%d %d", &X, &Y), X + Y){
		scanf("%d %d", &f.tx, &f.ty);
		scanf("%d %d", &f.kx, &f.ky);
		
		for (int i = 0; i < 100; i++){
			for (int j = 0; j < 100; j++){
				maze[i][j] = 1;
			}
		}
		
		for (int i = 1; i <= Y; i++){
			for (int j = 1; j <= X; j++){
				scanf("%d", &maze[j][i]);
			}
		}
		
		//for (int i = 0; i <= Y + 1; i++){
		//	for (int j = 0; j <= X + 1; j++){
		//		printf("%d ", maze[j][i]);
		//	}
		//	puts("");
		//}
		
		int r = search();
		if (r != -1) printf("%d\n", r);
		else puts("NA");
	}
	
	return 0;
}

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

#define MOD 1000000007
#define N 100010

typedef double lf;
typedef long long ll;
#define int ll
typedef long double ld;
typedef unsigned long long ull;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef vector<pair<ll,ll > >vpll;
typedef vector<vll > vvll;
#define endl "\n"
#define sd(a) scanf("%d",&a)
#define sstr(a) scanf("%s",a)
#define sl(a) scanf("%lld",&a)
#define debug(a) printf("check%d\n",a)
#define clr(a) memset(a,0,sizeof(a))
#define rtn return 
#define gc getchar
#define pb push_back
#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define lp(i,b) for(ll i = ll(0); i<ll(b) ; i++) 
#define lpit(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define mid(s,e) (s+(e-s)/2)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define fast ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0);
ll ip(){
  ll x = 0; bool isNeg = false; char c;
  c = gc();
  if(c == '-')  isNeg = true , c = gc();
  for( ; c >= '0'  && c <= '9' ; c = gc()); x = (x << 1) + (x << 3) + c - '0';
  if(isNeg) x *= -1;  return x;
}
//////////////////////////////////////////// CONTAINERS FOR FUNCTIONS MENTIONED IN TEMPLATE ///////////////////////////////////
#define MAX 100005
//bool isPrime[MAX];
//int spf[MAX];
//////////////////////////////////////////// FUNCTIONS THAT NEED COMMENTED OUT CONTAINERS ////////////////////////////////////


//void prime_sieve(){ for(ll i=2 ; i*i<=MAX ; i++){ if(!isPrime[i]){ for(ll j=i*i ; j<=MAX ; j+=i)  isPrime[j] = 1;} }  }
//void spf_sieve(){ for(ll i=2 ; i<MAX ; i+=2)  spf[i] = 2;
//  for(ll i=3 ; i<MAX ; i+=2){ if(!isPrime[i]){ spf[i] = i; for(ll j=i ; (j*i)<MAX ; j+=2){ if(!isPrime[i*j])  isPrime[i*j] = true , spf[i*j] = i; } } }
//}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline ll ncr(ll n,ll r){ ll ans = 1 ; if(r > n-r) r = n-r; lp(i,r+1){ans*=(n-i) ; ans/=(i+1); } rtn ans; }
inline ll gcd(ll a,ll b){if(!a) rtn b; rtn gcd(b%a,a); }
inline ll fme(ll x,ll n){ll ans=1;x%=MOD;while(n>0){if(n&1){ ans*=x;ans%=MOD;} x*=x;x%=MOD;n>>=1;}rtn ans%MOD;}
inline bool isPalin(string &s){ int len = s.size()-1;lp(i,(len/2)+2){if(!(s[i]==s[len-i]))  rtn false;} rtn true;}
inline ll lcm(ll a,ll b){rtn (a*b)/gcd(a,b); }
inline ll fmm(ll a,ll b) {ll r=0;a%=MOD;b%=MOD;while(b>0){if(b&1){r+=a;r%=MOD;}a+=a;a%=MOD;b>>=1;}rtn r%MOD;}
inline ll sfme(ll a,ll b) {ll r=1;a%=MOD;while(b>0){if(b&1)r=fmm(r,a);a=fmm(a,a);b>>=1;}rtn r%MOD;}
inline int in(){ int NR=0; register char c=gc(); while( c < 48 || c > 57 ){c=gc();} 
  while(c>47 && c< 58){ NR = (NR << 3) + (NR << 1) + (c - 48); c=gc();} return NR;
}

ll dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
//--------------------------------TEMPLATE ENDS HERE--------------------------------------------------//

#define NMAX 100005
#define LOGNMAX 20



signed main(){
	fast;	
	
	char c;
	cin>>c;
	cout<<(char)(c+1)<<endl;

}

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

vector<int> pmul(const vector<int> &p, const vector<int> &q) {
    int n = p.size()-1;
    vector<int> ans(n+1);
    for (int i = 1; i <= n; i++) ans[i] = p[q[i]];
    return ans;
}

vector<int> ppow(vector<int> &p, int k) {
    int n = p.size()-1;
    vector<int> ans(n+1), pw = p;
    for (int i = 1; i <= n; i++) ans[i] = i;
    while (k > 0) {
        if (k % 2 != 0) ans = pmul(ans, pw);
        pw = pmul(pw, pw);
        k >>= 1;
    }
    return ans;
}

int main() {
    int n, k; cin >> n >> k;
    vector<int> p(n+1), q(n+1), P(n+1), Q(n+1);
    for (int i = 1; i <= n; i++) {
        int x; cin >> x; p[i] = x; P[x] = i;
    }
    for (int i = 1; i <= n; i++) {
        int x; cin >> x; q[i] = x; Q[x] = i;
    }
    vector<int> ans;
    if (k == 1) ans = p;
    else if (k == 2) ans = q;
    else if (k == 3) ans = pmul(q, P);
    else if (k == 4) ans = pmul(q, pmul(P, Q));
    else {
        vector<int> r(n+1), R(n+1);
        for (int i = 1; i <= n; i++) {
            r[i] = q[P[Q[p[i]]]];
            R[i] = P[q[p[Q[i]]]];
        }
        int t = (k+1)/6;
        vector<int> s = ppow(r, t), S = ppow(R, t-1);
        vector<int> u = Q;
        int res = (k + 1) % 6;
        if (res > 0) u = pmul(p, u);
        if (res > 1) u = pmul(q, u);
        if (res > 2) {
            u = pmul(P, u);
            if (res == 4) u = pmul(P, u);
            if (res == 5) u = pmul(P, pmul(Q, u));
            u = pmul(q, u);
        }
        ans = pmul(s, pmul(u, S));
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
    cout << endl;
}


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

#define NUM 110

int main(){

  int N, con = 0;

  cin>>N;

  for(int i = 1; i < N; i++){
    for(int j = i+1; j <= N; j++){
      if(i+j == N + !(N%2))continue;
      con++;
    }
  }
  cout<<con<<endl;
 for(int i = 1; i < N; i++){
    for(int j = i+1; j <= N; j++){
      //cout<<i<<" "<<j<<" "<<N+!(N%2)<<endl;
      if(i+j == N + !(N%2))continue;
      cout<<i<<" "<<j<<endl;
      con++;
    }
  }
  
	
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n, d; std::cin >> n >> d;
  auto a = std::vector<std::vector<int>>(n, std::vector<int>(d));
  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < d; j++) {
      std::cin >> a.at(i).at(j);
    }
  }
  auto square = []{
    constexpr int mx = 2000;
    std::vector<int> square(mx + 1);
    std::iota(square.begin(), square.end(), 0);
    std::for_each(square.begin(), square.end(), [](int& x){x *= x;});
    return square;
  }();
  auto is_square = [&] (int x) {
    return std::find(square.begin(), square.end(), x) != square.end();
  };
  auto check = [&] (size_t i, size_t j) {
    return is_square(std::inner_product(
      a.at(i).begin(), a.at(i).end(),
      a.at(j).begin(), 0,
      [](const int& x, const int& y){return x + y * y;},
      [](const int& x, const int& y){return x - y;}));
  };
  int ret = 0;
  for (size_t i = 0; i < n; i++) {
    for (size_t j = i + 1; j < n; j++) {
      ret += check(i, j);
    }
  }
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn find(n: i32, v: i32) -> Option<(i32, i32, i32)> {
    for a in 0..=n {
        for b in 0..=(n - a) {
            let c = n - a - b;
            if a * 10000 + b * 5000 + c * 1000 == v {
                return Some((a, b, c));
            }
        }
    }
    None
}

fn main() {
    input! {
        n: i32,
        v: i32,
    }
    let (x, y, z) = find(n, v).unwrap_or((-1, -1, -1));
    println!("{} {} {}", x, y, z)
}


Measured memory_bytes: 2112
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<string,int> P;
typedef pair<P,P> P2;
const ll INF=100000000000000001;

int main() {
	int n;
	cin>>n;
	int a1=0;
	int a4=0;
	for(int i=0;i<n;++i){
		int a;
		cin>>a;
		if(a%4==0)a4++;
		if(a%2==1)a1++;
	}
	if(a4>=n/2||a4>=a1){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
  _ <- getLine
  ws <- map read . words <$> getLine
  print $ solve ws $ sum ws

solve :: [Int] -> Int -> Int
solve []  a = a
solve (x:xs) a
  | abs a > abs (a - 2*x) = solve xs (a - 2*x)
  | otherwise = abs a


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO

    int n, k;
    cin >> n >> k;

    int div = n / k;

    cout << (div + ((n % k) != 0)) - div;

}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=0;
  REP(i,1,n) {
    ans+=max(0LL,a[i-1]-a[i]);
    a[i]=max(a[i],a[i-1]);
  }
  pr(ans);
}

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


Measured memory_bytes: 5176
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  node* prev;
  int v;
  node(){}
  node(int v):v(v){}
};
struct mstack{
  node *cur;
  mstack(){
    cur=NULL;
  }
  void push(int k){
    node *tmp=new node(k);
    tmp->prev=cur;
    cur=tmp;
  }
  void pop(){
    node *tmp=cur->prev;
    delete(cur);
    cur=tmp;
  }
  int top(){
    return cur->v;
  }
};
signed main(){
  string s;
  vector<string> v;
  while(cin>>s) v.push_back(s);
  mstack st; 
  for(int i=0;i<(int)v.size();i++){
    if(v[i][0]=='+'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l+r);
      continue;
    }
    if(v[i][0]=='-'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l-r);
      continue;
    }
    if(v[i][0]=='*'){
      int r=st.top();st.pop();
      int l=st.top();st.pop();
      st.push(l*r);
      continue;
    }
    st.push(stoi(v[i]));
  }
  cout<<st.top()<<endl;
  return 0;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
int n,m,ans;
int a[100][100],p[1001],vis[1001];
bool pd() {
	for(int i=1; i<=m; i++) {
		int ans=0;
		for(int j=1; j<=a[i][0]; j++)
			if(vis[a[i][j]])
				ans++,ans%=2;
		if(ans!=p[i]) return 0;
	}
	return 1;
}
void dfs(int x) {
	if(x==n+1) {
///		for(int i=1; i<=n; i++)
//			cout<<vis[i]<<" ";
//		cout<<endl;
		if(pd()) ans++;
		return ;
	}
	for(int i=x+1; i<=n+1; i++)
		vis[i]=1,dfs(i),vis[i]=0;
}
main() {
	n=read(),m=read();
	for(int i=1; i<=m; i++) {
		a[i][0]=read();
		for(int j=1; j<=a[i][0]; j++)
			a[i][j]=read();
	}
	for(int i=1; i<=m; i++)
		p[i]=read();
	dfs(0);
	cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define endl "\n"
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
const int N = 2e5 + 10;
const ll inf = 1e18 + 10, mod = 1e9 + 7;
int n;
pair <ll, ll> a[N];
ll ansll, anslr, ansrl, ansrr;
int main()
{
    ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("lca_rmq.in", "r", stdin);
    //freopen("lca_rmq.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i].f >> a[i].s;
    }
    sort(a + 1, a + 1 + n);
    if(n % 2)
    {
        ansll = a[(n + 1) / 2].f;
        anslr = a[(n + 1) / 2].s;
    }
    else
    {
        ansll = (a[n / 2].f + a[n / 2 + 1].f);
        anslr = (a[n / 2].s + a[n / 2 + 1].s);
    }
    for(int i = 1; i <= n; i++)swap(a[i].f, a[i].s);
    sort(a + 1, a + 1 + n);
    reverse(a + 1, a + 1 + n);
    if(n % 2)
    {
        ansrl = a[(n + 1) / 2].s;
        ansrr = a[(n + 1) / 2].f;
    }
    else
    {
        ansrl = (a[n / 2].s + a[n / 2 + 1].s);
        ansrr = (a[n / 2].f + a[n / 2 + 1].f);
    }
    if(anslr >= ansrl)cout << ansrr - ansll + 1;
    else cout << anslr - ansll + ansrr - ansrl + 2;

}

















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

int main(void)
{
        int i,n,m;
        char s[51],t[51];

        scanf("%s%s",s,t);
        n=strlen(s);
        m=strlen(t);

        for(i=0;i<m;i++)
                printf("%c%c",s[i],t[i]);
        if(n-m==1)printf("%c\n",s[n-1]);
        else printf("\n");
        return 0;
}


Measured memory_bytes: 1720
import sys,math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	print(math.ceil(N/2))

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>

double tr(int q);

int main(void){
  int q;
  while(1){
    scanf("%d",&q);
    if(q==-1)break;
    printf("%lf\n",tr(q));
  }
  return 0;
}

double tr(int q){
  double x=q*1.0/2;
  while(fabs(x*x*x-q)>=0.00001*q){
    x=x-(x*x*x-q)/(3.0*x*x);
  }
  return x;
}



Measured memory_bytes: 2136
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    
    rep(i,n) {
        int ans = 1;
        int y,m,d;
        cin >> y >> m >> d;

        if(y%3 == 0) {
            ans += 20 - d;
            REP(j,m+1,11) {
                ans += 20;
            }
        }
        else {
            if(m%2 == 0) ans += 19 - d;
            else ans += 20 - d;

            REP(j,m+1,11) {
                if(j%2 == 0) ans += 19;
                else ans += 20;
            }
        }

        REP(j,y+1,1000) {
            if(j%3 == 0) ans += 10*20;
            else ans += 5*19 + 5*20;
        }
        
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (b); i >= (a); i--)
#define xx first
#define yy second
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int N = 200010;
const int maxn = 1e9+7;
map<int,int>m;
set<int>s;
int a[N];
int main()
{
    int n;
    scanf("%d",&n);
    rep(i,1,n){scanf("%d",&a[i]);m[a[i]]++;s.insert(a[i]);}
    ll ans = 0;
    sort(a+1,a+1+n);
    per(i,1,n)
    {
        ll now = a[i];
        for(ll j=1024*1ll*1024*1024;j>=1;j/=2)
        {
            ll next=j-now;
            if(next<0)continue;
            if(s.find(next)!=s.end() && s.find(now)!=s.end() && (now!=next || (now==next&&m[now]>=2)))
            {
                m[next]--;m[now]--;
                if(m[next]==0)s.erase(next);
                if(m[now]==0)s.erase(now);
                ans++;
        
            }
            //printf("%lld %lld %d %d\n",now,next,m[now],m[next]);
        }
        
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 19712
import java.util.*;

/*
説明
*/
public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int count = 0;

        count += n * (n-1) / 2;
        count += m * (m-1) / 2;

        System.out.println(count);
    }
}

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

using namespace std;

int main(void) {

		
	int n;
	long long T;
	cin >> n >> T;
	long long ans = T;

	long long prec;
	long long t;
	for(int i = 0; i < n; i++) {
		cin >> t;
		if(i) {
			ans += min(T, t - prec);
		}
		prec = t;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1000000000;

int V, E;
int dist[20][20];

int dp[20][(1<<20)+1];
int main() {
    cin >> V >> E;
    for (int i = 0; i < V; i++)
    {
        for (int j = 0; j < V; j++)
        {
            dist[i][j] = INF;
        }
    }
    for (int i = 0; i < E; i++)
    {
        int s, t, d;
        cin >> s >> t >> d;
        dist[s][t] = d;
    }

    for(int i = 0; i < V; i++) for(int j = 0; j < (1<<V); j++) dp[i][j] = INF;
    dp[0][0] = 0;

    for (int i = 0; i < (1<<V); i++)
    {
        for (int j = 0; j < V; j++)
        {
            if((i >> j) & 1) continue;
            for (int k = 0; k < V; k++)
            {
                dp[j][i | (1<<j)] = min(dp[j][i | (1<<j)], dp[k][i] + dist[k][j]);
            }
        }
    }

    if(dp[0][(1<<V) - 1] == INF) cout << "-1" << endl;
    else cout << dp[0][(1<<V) - 1] << endl;
}


Measured memory_bytes: 5084
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
int dp[maxn][4];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,0,sizeof dp);
    ll n;
    cin>>n;
    int vet[maxn][4];
    dp[0][1]=0;
    dp[0][2]=0;
    dp[0][3]=0;
    rep(i,1,n+1){
        rep(j,1,4){
            cin>>vet[i][j];
        }
    }
    rep(i,1,n+1){
        dp[i][1]=max(dp[i-1][2]+vet[i][1],dp[i-1][3]+vet[i][1]);
        dp[i][2]=max(dp[i-1][1]+vet[i][2],dp[i-1][3]+vet[i][2]);
        dp[i][3]=max(dp[i-1][1]+vet[i][3],dp[i-1][2]+vet[i][3]);
    }
    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<'\n';
    return 0;   
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main(){
  int a1,a2,a3,b1,b2,b3;
  cin>>a1>>b1;
  cin>>a2>>b2;
  cin>>a3>>b3;

  int city[5]={0,0,0,0,0};
  city[a1]=city[a1]+1;
  city[a2]=city[a2]+1;
  city[a3]=city[a3]+1;
  city[b1]=city[b1]+1;
  city[b2]=city[b2]+1;
  city[b3]=city[b3]+1;

  if(city[1]==3||city[2]==3||city[3]==3||city[4]==3){
    cout<<"NO"<<endl;
  }else{
    cout<<"YES"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
t_list = [0] * n
x_list = [0] * n
y_list = [0] * n
for i in range(n):
    t_list[i], x_list[i],y_list[i] = map(int, input().split())

prev_t, prev_x, prev_y = 0, 0, 0
for i in range(n):
    t, x, y = t_list[i], x_list[i], y_list[i]
    diff_t = t - prev_t
    diff_x = abs(x - prev_x)
    diff_y = abs(y - prev_y)
    remaining_t = diff_t - (diff_x + diff_y)
    if (remaining_t < 0) or (remaining_t % 2 != 0):
        print("No")
        exit()
    prev_t = t
    prev_x = x
    prev_y = y

print("Yes")


Measured memory_bytes: 11732
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    string s;
    ll H, W;
    cin >> H >> W;
    //vector<vector<int>> data(3, vector<int>(4));
    //初期値0
    //vector<int> data(i, 0);
    if (H==1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }

    if (H*W % 2 == 0) {
        cout << (H*W)/2 << endl;
    } else {
        cout << (H*W)/2+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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


int main() {
	int n;
	string s;
	cin >> n >> s;
	int x = 0;
	vector<int> res;
	res.push_back(0);
	rep(i, n) {
		if (s[i] == 'I') x++;
		else x--;
		res.push_back(x);

	}
	sort(res.begin(), res.end());
	int a = res.size()-1;
	cout << res[a] << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    ll N,M;
    cin >> N >> M;
    
    vector<priority_queue<ll>> que(8);
    for(int i=0;i<N;i++){
        ll a,b,c;
        cin >> a >> b >> c;
        int cm[2]={1,-1};
        int ct=0;
        for(int s=0;s<2;s++){
            for(int u=0;u<2;u++){
                for(int v=0;v<2;v++){
                    que[ct].push(cm[s]*a+cm[u]*b+cm[v]*c);
                    ct++;
                }
            }
        }
    }
    vector<ll> ans(8);
    for(int i=0;i<M;i++){
        for(int j=0;j<8;j++){
            ll tmp=que[j].top();que[j].pop();
            ans[j]+=tmp;
        }
    }
    ll anst=ans[0];
    for(int i=0;i<8;i++){
        anst=max(anst,ans[i]);
    }
    cout << anst << endl;
}

Measured memory_bytes: 892
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);(i)++)
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int A[2][110];
    int aa[2][112];
    int ans[111];
    
    rep(i,2){
        rep(j,N) cin >> A[i][j];
    }
    if (N == 1){
        cout << A[0][0] + A[1][0] << endl;
        return 0;
    }
    rep(i,2){
        rep(j,N+1) aa[i][j] = 0;
    }
    rep(i,2){
        rep(j,N+1){
            if (j == 0) continue;
            else aa[i][j] += aa[i][j-1] + A[i][j-1];
        }
    }
  //rep(i,N+1) cout << aa[1][i] << endl;
    rep(i,N+1){
        ans[i] = aa[0][i] + aa[1][N] - aa[1][i-1];
        //cout << aa[1][N] << endl;
    }
    int max_ans = ans[0];
    rep(i,N) max_ans = max(max_ans,ans[i]);
    cout << max_ans << endl;
    return 0;
}

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

int main(void)
{
	char str[81];
	size_t len;    
	size_t i;     
	scanf( "%s", str );

	len = strlen( str ); 
	for(i=0; i<len; ++i)
	{
		printf( "%c", str[len - i - 1] );
	}
	printf( "\n" );
	return 0;
}

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

int main() {
  int n,l;
  cin>>n>>l;
  
  int pie=0;
  
  if(l>0){
  	for(int i=1;i<n;i++){
    	pie+=l+i;
    }
  }
  
  else if(l<=0&&n+l>0){
  	for(int i=0;i<n;i++){
    	pie+=l+i;
    }
  }
  
  else{
  	for(int i=0;i<n-1;i++){
    	pie+=l+i;
    }
  }
  
  cout<<pie<<endl;
	
}

Measured memory_bytes: 256
import Control.Monad

type Matrix = [[Int]]
type Vector = [Int]

(|*) :: Matrix -> Vector -> Vector
m |* v = [sum $ zipWith (*) mi v | mi <- m]

getList :: Read a => IO [a]
getList = fmap (map read . words) getLine

main = do
  [m, n] <- getList
  mat <- replicateM m getList
  vec <- replicateM n readLn
  mapM_ putStrLn $ map show $ mat |* vec

Measured memory_bytes: 7420
n = int(input())
s = [0, 0, 0, 0]

for i in range(n):
  tmp = input()
  if tmp == "AC":
    s[0] += 1
  elif tmp == "WA":
    s[1] += 1
  elif tmp == "TLE":
    s[2] += 1
  elif tmp == "RE":
    s[3] += 1

print("AC x {}".format(s[0]))
print("WA x {}".format(s[1]))
print("TLE x {}".format(s[2]))
print("RE x {}".format(s[3]))

Measured memory_bytes: 9212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        final long MOD = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s1 = in.next();
            String s2 = in.next();

            long ans = 1;
            for (int i = 0; i < n; i++) {
                if (s1.charAt(i) == s2.charAt(i)) {
                    if (i == 0) {
                        ans = (ans * 3) % MOD;
                    } else if (s1.charAt(i - 1) == s2.charAt(i - 1)) {
                        ans = (ans * 2) % MOD;
                    }
                } else {
                    if (i == 0) {
                        ans = (ans * 6) % MOD;
                    } else if (s1.charAt(i) == s1.charAt(i - 1)) {
                        continue;
                    } else if (s1.charAt(i - 1) == s2.charAt(i - 1)) {
                        ans = (ans * 2) % MOD;
                    } else {
                        ans = (ans * 3) % MOD;
                    }
                }
            }

            out.println(ans);
        }

    }
}



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

public class Main {
	static int[] mountains = new int[10];
	static Scanner sc = new Scanner(System.in);


	public static void main(String[] args) {

		//10?????\?????????????????\??????
		for(int count = 0; count < 10; count++) {
			mountains[count] = sc.nextInt();
		}

		//???????????????
		Arrays.sort(mountains);

		//??¨?????????
		System.out.println(mountains[9]);
		System.out.println(mountains[8]);
		System.out.println(mountains[7]);

	}

}

Measured memory_bytes: 26208
#include<stdio.h>

int main(){
  int n, i, ans=0, cnt=0;
  char res[3];

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s", res);
    if(res[0]==65){
      cnt++;
    }else{
      cnt--;
    }

    if(cnt<0){
      ans=1;
    }
  }

  if(cnt) ans=1;

  if(ans){
    printf("NO\n");
  }else{
    printf("YES\n");
  }
  
  return 0;
}

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

int main() {
	
	//vector<int> a(n);
	//cout << "test" << endl;

	cin.tie(0);
	ios::sync_with_stdio(false);


	int n;

	cin >> n;
	//cout << "test" << endl;
	
	int ans=0;
	

	rep(i,n){//1-n
		int c=0;
		int j=i+1;
		while(j!=0){
			j/=10;
			c++;
		}
		if(c%2){
			ans++;
		}
	}
	
	cout << ans << "\n";
	
	
	return 0;

    }

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

const long long INF = 1LL << 60;

struct Edge {
    int from, to;
    long long cost;
};

int main() {
    int N, M;
    cin >> N >> M;
    vector<Edge> E(M);
    for (int i = 0; i < M; i++) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        a--; b--;
        c *= -1;
        E[i] = Edge{a, b, c};
    }

    vector<long long> dist(N, INF);
    dist[0] = 0;

    for (int i = 0; i < N - 1; i++) {
        for (int j = 0; j < M; j++) {
            Edge e = E[j];
            if (dist[e.from] == INF) continue;

            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }

    long long res = dist[N - 1];

    vector<bool> negative(N, false);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            Edge e = E[j];
            if (dist[e.from] == INF) continue;

            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                negative[e.to] = true;
            }
            if (negative[e.from]) {
                negative[e.to] = true;
            }
        }
    }

    if (negative[N - 1]) {
        cout << "inf" << endl;
    } else {
        cout << -res << endl;
    }

    return 0;
}



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

int main(){
  int n,k,s;
  cin >> n >> k >> s;
  int a = s+1;
  if(a > 1000000000){
    a = 1;
  }
  rep(i,k) cout << s << " ";
  for(int i = k; i < n; i++) cout << a << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	char in[15];
	bool ok[15];
	while(~scanf("%s",in)){
		int l=strlen(in),ans=-1,combo=0;
		F(i,0,l) ok[i]=(in[i]=='A'||in[i]=='T'||in[i]=='C'||in[i]=='G');
		F(i,0,l){
			if(!ok[i]){
				if(combo>ans) ans=combo;
				combo=0;
			}else combo++;
		}
		if(combo>ans) ans=combo;
		printf("%d\n",ans);
	}
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N = ii()
D = [ii() for _ in range(N)]

D = sorted(D)

cnt = 1
for i in range(1, N):
    if D[i] > D[i-1]:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
# import sys
# input = sys.stdin.readline

def main():
    # input
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    ans = 0
    for num, i in enumerate(v):
        if num<2:
            ans += i/2**(n-1)
        else:
            ans += i/2**(n-num)

    # calc
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38420
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[100007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, -1, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
         
        if (prime[p] == -1) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = p; 
        } 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

//to calculate p1^x  *  p2^x2  *p3^x3 ----------
//i.e. prime factorization and store pi and xi in vector 
vector<pair<ll, ll>> pFactor;

void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if (count) 
        pFactor.pb({2,count}); 
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            pFactor.pb({i,count});
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        pFactor.pb({n,1}); 
} 



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
   int l, r, d;
   cin>>l>>r>>d;
   int ans=0;
   lp(l, r+1){
       if(i%d==0){
           ans++;
       }
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
/* 大文字を小文字に変換 */
char toupr(char c);
/* 小文字を大文字に変換 */
char tolower(char c);
 
int main() {
	string a,b,c;
	cin >> a >> b >>c;
	cout << toupr(a[0])   << toupr(b[0]) << toupr(c[0]) << endl;
}
char tolower(char c) {return (c + 0x20);}
char toupr(char c) {return (c - 0x20);}



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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int n; cin>>n;
  vi x(n);
  rep(i,0,n) cin>>x[i];
  lli ans = 0;
  rep(i,0,n) ans += x[i];
  ans /= n;
  lli fans = MOD * 1LL * MOD;
  rep(k,ans-2,ans+2) {
    lli sum = 0;
    rep(i,0,n) sum += (x[i]-k)*1LL*(x[i]-k);
    fans = min(fans, sum);
  }
  cout<<fans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {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;}
inline int readint() {
	char c = getchar(); int w = 1; int x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 3) + (x << 1) + (c ^ '0'), c = getchar();
	x *= w;
	return x;
}
inline ll readll() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 3) + (x << 1) + (c ^ '0'), c = getchar();
	x *= w;
	return x;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
struct node{int x,y;};
int h,w,k,xx1,yy1,x2,y2;
bool ok(int x,int y){
	if(x<=h&&x>=1&&y<=w&&y>=1)return true;
	else return false;
}
queue<node>Q;
int main(){
	cin>>h>>w>>k;
	char g[h+1][w+1];
	int vis[h+1][w+1],step[h+1][w+1];
	memset(vis,0,sizeof(vis));
	memset(step,0,sizeof(step));
	cin>>xx1>>yy1>>x2>>y2;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>g[i][j];
		}
	}
	node a,b;
	a.x=xx1,a.y=yy1;
	step[xx1][yy1]=0;
	vis[xx1][yy1]=1;
	Q.push(a);
	int ans=bql;
	while(!Q.empty()){
		a=Q.front();
		Q.pop();
		if(a.x==x2&&a.y==y2){
			ans=min(ans,step[x2][y2]);
		}
		for(int i=0;i<4;i++){
			for(int j=1;j<=k;j++){
				b.x=dx[i]*j+a.x;
				b.y=dy[i]*j+a.y;
				if(ok(b.x,b.y)==0||(step[b.x][b.y]<=step[a.x][a.y]&&step[b.x][b.y]))break;
				else{
					if(g[b.x][b.y]=='@')break;
					if(g[b.x][b.y]=='.'&&!vis[b.x][b.y]){
						vis[b.x][b.y]=1;
						step[b.x][b.y]=step[a.x][a.y]+1;
						Q.push(b);
					}
				}
			}
		}
	}
	if(ans==bql)cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}
/* stuff to remember
	* int overflow, array bounds
	* special cases (n=1? n=0?)
	* do something instead of nothing and stay organized
	* USE STATIC ARRAYS
	* DEFINING ARRAYS BEFORE main()
	* DO NOT DEFINE ARRAYS IN main()
	* USE INT INSTEAD OF LL,NOTICE THE MLE
*/

Measured memory_bytes: 20168
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [ list(map(int,input().split())) for _ in range(N) ]
 
ans = 0
for a in A:
  s = 0
  for i in range(M):
    s += a[i] * B[i]
  ans += 1 if s+C > 0 else 0
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main(void) {
	int n;
	double x[20], sum = 0;
	char u[200][200];
	int i, j, k;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%lf %s", &x[i], u[i]);
	}
	for (i = 0; i < n; i++) {
		if (strcmp(u[i], "JPY") == 0) {
			sum += x[i];
		}
		else {
			sum += x[i]*380000;
		}
		//printf("i==%d sum==%lf\n", i, sum);
	}

	printf("%.4lf\n", sum);
	return 0;
}

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

#define mp make_pair
#define pb push_back
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) repm(i, 1, n)
#define mod 1000000000+7

int main(){
    int p, q, r; cin >> p >> q >> r;

    cout << min({p+q, q+r, r+p}) << endl;

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    N = int(lines.pop(0))
    A = list(map(int, lines.pop(0).split(' ')))
    A.insert(0,0)
    A.append(0)
    cost = 0
    for i in range(N + 1):
        cost += abs(A[i] - A[i+1])

    for i in range(N):
        tcost = cost - abs(A[i] - A[i+1]) - abs(A[i+1] - A[i+2]) + abs(A[i] - A[i+2])
        print(tcost)
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 14176