akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
namespace mp = boost::multiprecision;
using i64 = int64_t;
using f80 = __float80;
using u64 = uint_fast64_t;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr u64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef pair<i64,i64> P;
typedef v(i64) vi;
typedef v(vi) vvi;
typedef v(P) vp;
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;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N, K;
  cin >> N >> K;
  vi A(N);
  cin >> A;

  vvi dp(51, vi(2, -1));

  rep(i, 1, 50){
    i64 count1 = 0, count0 = 0;
    for(auto &a:A){
      if(a & (1LL<<(49-i))) count1++;
      else count0++;
    }
    if(K&(1LL<<(49-i))){
      dp[i+1][0] = max(i64(0),dp[i][0]) * 2 + count0;
      dp[i+1][1] = max(i64(0),dp[i][0]) * 2 + count1;
      if(dp[i][1] != -1){
        chmax(dp[i+1][1], max(i64(0),dp[i][1]) * 2 + max(count0,count1));
      }
    } else {
      dp[i+1][0] = max(i64(0),dp[i][0]) * 2 + count1;
      if(dp[i][1]!=-1){
        dp[i+1][1] = max(i64(0),dp[i][1]) * 2 + max(count1,count0);
      }
    }
  }

  cout << max(dp[50][0], dp[50][1]) << "\n";
}

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

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
using ll = long long;
using P = pair<int,int>;

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

  if(a>=3200) {
    cout << s << endl;
  } else if(a<3200){
    cout << "red" << endl;
  }
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

struct evnt {
  int time;
  int dis;
  int kind;
  bool operator<(const evnt &p) const {
    return time < p.time;
  }
};

void solve()
{
  int n,q; cin>>n>>q;
  vector<evnt> e;
  for (int i=0; i<n; i++) {
    int s,t,x;
    cin>>s>>t>>x;
    e.push_back({s-x, x, 1});
    e.push_back({t-x, x, 0});
  }
  sort(e.rbegin(),e.rend());
  vector<int> ans(q, -1);
  multiset<int> s;
  for (int i=0; i<q; i++) {
    int d; cin>>d;
    while(!e.empty() && e.back().time <= d) {
      if (e.back().kind) s.insert(e.back().dis);
      else s.erase(s.find(e.back().dis));
      e.pop_back();
    }
    if (s.empty()) ans[i] = -1;
    else ans[i] = *s.lower_bound(0);
  }

  for (int i=0; i<q; i++) {
    cout << ans[i] << endl;
  }
}

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


Measured memory_bytes: 16620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll n, a, b; cin >> n >> a >> b;
    if((b-a)%2 == 0) {
        cout << (b-a) / 2 << endl;
    } else {
        cout << (b-a-1)/2+min(a, n-b+1) << endl;
    }
}


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

#define MOD 1000000007
#define PI 3.141592653589793

typedef unsigned long long ull;
typedef long long ll;
using namespace std;

void testCase() {
	int x, n;
	cin >> x >> n;
	vector<int> vals(n);
	for(int& i : vals) cin >> i;
	if(n == 0 || find(vals.begin(), vals.end(), x) == vals.end()) {
		cout << x << "\n";
		return;
	}
	sort(vals.begin(), vals.end());
	int curr = 1e5, mi = 1e5, j = 0, num = 0;
	for(int i = 0; i <= 101; i++) {
		if(j < n && i == vals[j]) {
			j++;
			continue;
		}
		curr = abs(i - x);
		if(curr < mi) {
			mi = curr;
			num = i;
		}
	}
	if(abs(num - x) > x) {
		cout << "0\n";
	} else {
		cout << num << "\n";
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int T = 1;
	//cin >> T;
	while(T--) {
		testCase();
	}
}


Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,p;
    int x,y;
    cin>>a>>b>>c>>d>>p;
    
    x=a*p;
    if(p>c){
        y=b+d*(p-c);
    }else{
        y=b;
    }
    if(x>y){
        cout<<y<<endl;
    }else{
        cout<<x<<endl;
    }
    return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPS(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
class llm{
public:
llm(ll value){this->value = (ll)value;}
ll value;
llm operator + (llm obj){return llm((this->value + (ll)(obj.value))%MOD);}
llm operator + (ll obj){return llm((this->value + obj)%MOD);}
llm operator - (llm obj){return llm(this->value - (ll)(obj.value));}
llm operator - (ll obj){return llm(this->value - obj);}
llm operator * (llm obj){return llm((this->value * (ll)(obj.value))%MOD);}
llm operator * (ll obj){return llm((this->value * obj)%MOD);}
llm operator / (llm obj){return llm(this->value / (ll)(obj.value));}
llm operator / (ll obj){return llm(this->value / obj);}
llm operator % (llm obj){return llm(this->value % (ll)(obj.value));}
llm operator % (ll obj){return llm(this->value % obj);}};
ostream& operator<<(ostream& os, llm l){os << l.value;return os;} 
llm operator+(ll a,llm l){return llm((a + l.value)%MOD);} 
llm operator*(ll a,llm l){return llm((a * l.value)%MOD);}



int main(void){
	int n;
	cin>>n;
	int a[2][100];
	int dp[2][100];

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

	dp[1][0]=dp[0][0]+a[1][0];
		for(int j=1;j<n;j++){
			dp[1][j]=max(dp[1][j-1],dp[0][j])+a[1][j];
		}
		cout<<dp[1][n-1]<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int n;
    cin >> n;

    function<int (int)> f = [=](int x) -> int{
        int ret = 0;
        while(x > 0){
            ret += (x % 10);
            x /= 10;
        }
        return ret;
    };

    cout << (n % f(n) == 0 ? "Yes" : "No") << endl;
    
    return 0;
}

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


int main(){

  int N;
  cin >> N;

  if(N % 2 == 0){
    cout << N / 2 << endl;
  }

  if(N % 2 == 1){
    cout << (N + 1) / 2 << endl;
  }
}

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

b = [0]*n 
s = [0]*(n+1)

for i in reversed(range(1,n+1)):
	for k in range(1,math.floor(n/i)+1):
		j = int(k*i)
		s[i] += b[j-1]
	if s[i]%2 != a[i-1]:
		b[i-1] += 1

L = [i+1 for i in range(n) if b[i] == 1]
print(len(L))
print(*L)

Measured memory_bytes: 19776
import sys


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


def main():
    d = ni()
    ans = 'Christmas'
    num = 25 - d
    eve = ' Eve'
    print(ans + num * eve)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vector<Pll> a;
  ll sum = 0;
  rep(i, n){
    ll m;
    cin >> m;
    a.pb(mp(m, i));
    sum += m;
  }
  ll ans = 0;
  ll mini = INF;
  sort(all(a));
  rep(i,n){
    ll x = abs(a[i].F*n - sum);
    if(x<mini){
      ans = a[i].S;
      mini = x;
    }
    else if(x==mini){
      if(a[i].S<ans){
        ans = a[i].S;
      }
    }
  }
  print(ans);
}

Measured memory_bytes: 3624
local n = io.read("*n", "*l")
local prev = io.read()
local t = {}
t[prev] = true
local ret = true
for i = 2, n do
  local str = io.read()
  if t[str] then
    ret = false
  elseif prev:sub(#prev, #prev) ~= str:sub(1, 1) then
    ret = false
  else
    t[str] = true
    prev = str
  end
end
print(ret and "Yes" or "No")


Measured memory_bytes: 760
def med(data):
    N = len(data)
    data.sort()
    if N % 2 == 0:
        median1 = N/2
        median2 = N/2 + 1
        median1 = int(median1) - 1
        median2 = int(median2) - 1
        median = (data[median1] + data[median2]) / 2
        return median
    else:
        median = (N + 1) / 2
        median = int(median) - 1
        median = data[median]
        return median

import sys
N = int(input())
lists = [int(i) for i in input().split()]
sok = sys.maxsize
list2 = [x - j - 1 for j, x in enumerate(lists)]
b = med(list2)
kanashi = 0
for xx in list2:
    kanashi += abs(xx - b)
print(int(kanashi))


Measured memory_bytes: 26020
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int n;
	char chr;
	int A;
	int card[4][14]={};




	cin>>n;
	for (int i=0;i<n;i++){
		cin>>chr>>A;

		if (chr=='S')card[0][A]=1;
		if (chr=='H')card[1][A]=1;
		if (chr=='C')card[2][A]=1;
		if (chr=='D')card[3][A]=1;
	}

	for (int i=1;i<14;i++){
		if (card[0][i]==0){
			cout<<"S "<<i<<endl;
		}
	}
	for (int i=1;i<14;i++){
		if (card[1][i]==0){
			cout<<"H "<<i<<endl;
		}
	}
	for (int i=1;i<14;i++){
		if (card[2][i]==0){
			cout<<"C "<<i<<endl;
		}
	}
	for (int i=1;i<14;i++){
		if (card[3][i]==0){
			cout<<"D "<<i<<endl;
		}
	}




	return 0;
}

Measured memory_bytes: 3108
#include<iostream>
#include<iomanip>
#include<cmath>

int main()
{
	double x, h;
	while( std::cin >> x >> h, x || h )
	{
		double t = sqrt( x * x / 4.0 + h * h );

		std::cout << std::fixed << std::setprecision( 6 ) << x * t * 2.0 + x * x << std::endl;
	}

	return 0;
}

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  int c = 0, index = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (i == 0) {
      if (s[i] != 'A') {
        p("WA");
        return 0;
      }
      continue;
    } else if (s[i] == 'C') {
      index = i;
      c++;
    } else if (!('a' <= s[i] && s[i] <= 'z')) {
      p("WA");
      return 0;
    }
  }
  if (c != 1 || !(2 <= index && index <= s.length() - 2)) {
    p("WA");
    return 0;
  }
  p("AC");
}

Measured memory_bytes: 256
A, B = map(int,input().split())

if(A == 1 and B == 1):
  print("Draw")
  exit()
elif(A == 1):
  print("Alice")
  exit()
elif(B == 1):
  print("Bob")
  exit()
elif(A > B):
  print("Alice")
elif(A < B):
  print("Bob")
else:
  print("Draw")

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int sum(int n) {
    int ret = 0;
    while(n > 0){
        ret += n%10;
        n /= 10;
    }
    return ret;
}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    string s = "No";
    if(n%sum(n) == 0) s = "Yes";
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll ans=0;
	cin >>n;
	vector<ll>as(n);
	rep(i,n){
		cin>>as[i];
	}
	rep(i,n){
		ans+=as[i]/2;
		as[i]%=2;
		if(i!=n-1 and as[i+1]>=1 and as[i]>=1 ){
			ans++;
			as[i+1]--;
			as[i]--;

		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  string a,b,c;
  int d,e;
  
  cin>>a>>b;
  cin>>d>>e;
  cin>>c;
  
  if(c==a)
    cout<<d-1<<' '<<e;
  else 
    cout<<d<<' '<<e-1;
  
  return 0;
}

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

int main(){
    int n;
    int L[100];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> L[i];
    }
    int ans=0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            if(L[i]==L[j]) continue;
            for(int k=j+1; k<n; k++){
                if(L[i]==L[k]||L[j]==L[k]) continue;
                if(L[i]+L[j]>L[k] && L[j]+L[k]>L[i] && L[k]+L[i]>L[j]){
                    ans++;
                } 
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3536
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def f(n, x):
    if n == -1:
        return 0

    return n // x + 1


def main():
    a, b, x = li_input()

    print(f(b, x) - f(a - 1, x))


main()


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

int binary_indexed_tree_size;
vector<long> binary_indexed_tree;

void item_plus_1(int point){
    for(int i = point + 1; i <= binary_indexed_tree_size; i += (i & -i)){
        binary_indexed_tree[i]++;
    }
}

long range_sum(int right){
    long ans = 0;
    for(int i = right + 1; i >= 1; i -= (i & -i)){
        ans += binary_indexed_tree[i];
    }
    return ans;
}

struct sorted_item{
    int number;
    long value;
    
    bool operator <(const sorted_item &another) const{
        if(value != another.value){
            return value < another.value;
        }else{
            return number < another.number;
        }
    }
};

int main(){
    int N;
    long K;
    cin >> N >> K;
    long nums[N];
    for(int i = 0; i < N; i++){
        long num;
        cin >> num;
        nums[i] = num - K;
    }
    sorted_item nums_cumulative_sum[N + 1];
    nums_cumulative_sum[0] = {0, 0};
    for(int i = 0; i < N; i++){
        nums_cumulative_sum[i + 1] = {i + 1, nums_cumulative_sum[i].value + nums[i]};
    }
    sort(nums_cumulative_sum, nums_cumulative_sum + N + 1);
    for(int i = 0; i <= N; i++){
    }
    binary_indexed_tree.resize(N + 2);
    binary_indexed_tree_size = N + 1;
    fill(binary_indexed_tree.begin(), binary_indexed_tree.end(), 0);
    long ans = 0;
    for(int i = 0; i <= N; i++){
        ans += range_sum(nums_cumulative_sum[i].number);
        item_plus_1(nums_cumulative_sum[i].number);
    }
    cout << ans << endl;
}


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

using ll = long long;

const int N = 200005;
const ll M = ll(1e9) + 7;

ll n, a, b, c, fa[N], fi[N], r;

ll pw(ll x, ll i){
	ll r = 1;
	for(; i; i /= 2, x = x * x % M) if(i & 1) r = r * x % M;
	return r;
}

ll inv(ll x){ return pw(x, M - 2); }

int main(){
	scanf("%lld%lld%lld%lld", &n, &a, &b, &c);
	a = a * inv(100 - c) % M;
	b = b * inv(100 - c) % M;
	fa[0] = fi[0] = 1;
	for(int i = 1; i <= 2 * n; i++){
		fa[i] = fa[i - 1] * i % M;
		fi[i] = inv(fa[i]);
	}
	for(ll k = n; k <= 2 * n - 1; k++){
		ll p = (pw(a, n) * pw(b, k - n) + pw(b, n) * pw(a, k - n)) % M;
		ll q = fa[k - 1] % M * fi[n - 1] % M * fi[k - n] % M;
		r = (r + p * q % M * k) % M;
		//printf("%lld : %lld %lld\n", k, p, q);
	}
	printf("%lld\n", 100 * inv(100 - c) % M * r % M);
}

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

int main(){
  string s;
  for(int i=0;i<3;i++){
    char a;
    cin >> a;
    if(a=='1') s+='9';
    else if(a=='9') s+='1';
    else s+=a;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int ans[1000000];
int cnt[505];
int mm[1000005];

signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
	if(fopen("INPUT.txt","r"))
	{
	freopen ("INPUT.txt" , "r" , stdin);
	freopen ("OUTPUT.txt" , "w" , stdout);
	}
#endif  

	int n;
	cin>>n;
	int x[n+1];
	for(int i=1;i<=n;i++)
		cin>>x[i];
	set<pair<int,pair<int,int> > >s;
	set<pair<int,pair<int,int> > >d;
	for(int i=1;i<=n;i++)
	{
		mm[x[i]]=i;
		ans[x[i]]=i;
		if(i>1)
			s.insert({x[i],{i-1,i}});
		if(i<n)
			d.insert({-x[i],{n-i,i}});
	}
	int ini=1;
	while (ini<=n*n)
	{
		if(ans[ini])
		{
			ini++;
			continue;
		}
		if(s.empty())
			break;
		pair<int,pair<int,int> > j=*s.begin();
		ans[ini++]=j.second.second;
		s.erase(j);
		j.second.first--;
		if(j.second.first)
			s.insert(j);
	}

	ini=n*n;
	while (ini>=1)
	{
		if(ans[ini])
		{
			ini--;
			continue;
		}
		if(d.empty())
			break;
		pair<int,pair<int,int> > j=*d.begin();
		ans[ini--]=j.second.second;
		d.erase(j);
		j.second.first--;
		if(j.second.first)
			d.insert(j);
	}

	bool flag=true;
	for(int i=1;i<=n*n;i++)
	{
		cnt[ans[i]]++;
		if(mm[i])	
		{
			if(cnt[ans[i]]!=mm[i])
			{
				flag=false;
				break;
			}
		}
	}
	if(flag)
	{
		cout<<"Yes\n";
		for(int i=1;i<=n*n;i++)
			cout<<ans[i]<<" ";
	}
	else
	{
		cout<<"No";
	}
	

}


Measured memory_bytes: 6784
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	int ans = min(a, b) + min(c, d);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    N, M = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(M)]

    uf = UnionFind(N)

    for ab in AB:
        uf.union(ab[0]-1, ab[1]-1)

    ans = 0
    for i in range(N):
        if uf.size(i) > ans:
            ans = uf.size(i)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 50344
N = int(input())
le = list(map(int, input().split()))


# print(le)

count = 0
bool = 0

while(1):
    for i in range(0,N):
        if le[i]%2 != 0:
            bool = 1
            break
        le[i] = le[i]/2
    if bool == 1:
        break
    count += 1

print(count)
        


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

struct Edge{ ll src, dest; };

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &g, ll from, ll to) {
	g[from].push_back((Edge){from, to});
}

ll scc(Graph &graph, vector<ll> &cmp) {
	ll V = graph.size();
	vector<vector<ll>> g(V), rg(V);
	vector<ll> vs;
	vector<bool> used(V, false);
	cmp.resize(V);
	REP(i,V) {
		for (Edge e: graph[i]) {
			g[i].push_back(e.dest);
			rg[e.dest].push_back(i);
		}
	}
	function<void(ll)> dfs = [&g, &vs, &used, &dfs](ll v) {
		used[v] = true;
		for (ll i: g[v]) if (!used[i]) dfs(i);
		vs.push_back(v);
	};
	function<void(ll,ll)> rdfs = [&rg, &cmp, &used, &rdfs](ll v, ll k) {
		used[v] = true; cmp[v] = k;
		for (ll i: rg[v]) if (!used[i]) rdfs(i, k);
	};
	REP(v,V) if (!used[v]) dfs(v);
	used = vector<bool>(V, false);
	reverse(ALL(vs));
	ll k = 0;
	for (ll i: vs) if (!used[i]) rdfs(i, k++);
	return k;
}

vector<vector<ll>> buildGraph(const Graph &g, const vector<ll> &cmp, ll K) {
	ll V = g.size();
	vector<set<ll>> s(K);
	vector<vector<ll>> res(K);
	REP(i,V) for (Edge e: g[i]) s[cmp[i]].insert(cmp[e.dest]);
	REP(i,K) for (ll j: s[i]) if (i != j) res[i].push_back(j);
	return res;
}

ll dfs(ll pos, ll par, const vector<vector<ll>> &g) {
	ll ret=1;
	REP(i,g[pos].size()) {
		if(g[pos][i]!=par) {
			ret*=dfs(g[pos][i],pos,g);
			ret%=MOD;
		}
	}
	return (ret+1)%MOD;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin>>n>>m;
	Graph g(n);
	REP(i,m) {
		ll s,d;
		cin>>s>>d;
		s--; d--;
		add_edge(g,s,d);
	}
	vector<ll> cmp;
	ll k=scc(g,cmp);
	vector<vector<ll>> _g=buildGraph(g,cmp,k);
	vector<ll> root;
	REP(i,_g.size()) if(_g[i].empty()) root.pb(i);
	REP(i,_g.size()) REP(j,_g[i].size()) _g[_g[i][j]].pb(i);
	ll ans=1;
	REP(i,root.size()) {
		ans*=dfs(root[i],-1,_g);
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3436
from collections import Counter


n = int(input())
v = list(map(int, input().split()))
odd_cnt = Counter(v[0::2]).most_common() + ([(0, 0)])
even_cnt = Counter(v[1::2]).most_common() + ([(0, 0)])
if odd_cnt[0][0] != even_cnt[0][0]:
    ans = n - odd_cnt[0][1] - even_cnt[0][1]
else:
    ans = min(n - odd_cnt[1][1] - even_cnt[0][1], n - odd_cnt[0][1] - even_cnt[1][1])
print(ans)


Measured memory_bytes: 20572
using System;
class Program {
    static void Main (string[] args) {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        if (a > b) {
            Console.WriteLine("".PadRight(a, input[1][0]));
        } else {
            Console.WriteLine("".PadRight(b, input[0][0]));
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;

  int count = 0;
  for (int i = a; i < b + 1; ++i) {
    string s = to_string(i);
    string tmp = s;
    reverse(s.begin(), s.end());
    if (tmp == s) count++;
  }
  cout << count << endl;
}

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

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


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

using namespace std;

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 
#define INF (1LL<<50)
#define MOD 1000000007

lli dp[100100];

signed main(){

	lli n,m;
	cin>>n>>m;
	for(lli i=0;i<m;i++){
		lli l,r;
		cin>>l>>r;
		l--,r--;
		dp[l]++;
		dp[r+1]--;
	}
	for(lli i=0;i<100100;i++){
		dp[i+1] +=dp[i];
	}

	lli ans=0;
	for(lli i=0;i<100100;i++){
		if(dp[i]==m)ans++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1024
/*
 * a.cpp
 *
 *  Created on: 2019/06/08
 *      Author: MEIP-users
 */




#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1e9+10)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main() {
	int n, m;
	cin >> n >> m;
	int z;
	if(n%2 == 1){
		z = (n+1) / 2;
	}else{
		z = n/2;
	}
	int r = z;
	int l = 1;
	int cnt = 0;
	while(1){
		cout << l << " " << r << endl;
		cnt++;
		if(cnt == m){
			return 0;
		}
		r--;
		l++;
		if(l >= r){
			break;
		}
	}
	r = n;
	if(n%2 == 0){
		r = n-1;
	}
	l = z + 1;
	while(1){
		cout << l <<" " << r << endl;
		cnt++;
		if(cnt == m){
			return 0;
		}
		r--;
		l++;
	}

	return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 998244353;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> d(n);
    for(i = 0;i < n;++i){
        cin >> d.at(i);
    }
    if(d.at(0) != 0){
        cout << 0 << endl;
        return 0;
    }
    sort(all(d));
    vector<pair<ll,ll>> a;
    ll ans = 1;
    ll num = 0;
    ll cnt = 0;
    for(i = 0;i < n;++i){
        if(d.at(i) == num) ++cnt;
        else{
            a.emplace_back(num, cnt);
            num = d.at(i);
            cnt = 1;
        }
    }
    a.emplace_back(num, cnt);
    if(a.at(0).second != 1){
        cout << 0 << endl;
        return 0;
    }
    for(i = 0;i < a.size();++i){
        if(a.at(i).first != i){
            cout << 0 << endl;
            return 0;
        }
    }
    for(i = 1;i < a.size();++i){
        ans *= pow_mod(a.at(i-1).second, a.at(i).second, MOD);
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define MOD 1000000007
#define int long long
#define vi vector<long long int>
#define pb push_back
#define rep(i,a,n) for (int i=(a);i<(n);++i)
using namespace __gnu_pbds;
using namespace std;
// its godfather
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int>vec;
long long power(long long a, long long b, long long m)
{
   long long res = 1;
   while (b > 0)
   {
      if (b & 1)
         res = res * a % m;
      a = a * a % m;
      b >>= 1;
   }
   return res;
}
signed main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(0);

#ifndef ONLINE_JUDGE
   if (fopen("INPUT.txt", "r"))
   {
      freopen("INPUT.txt", "r", stdin);
      freopen("OUTPUT.txt", "w", stdout);
   }
#endif
   int t;
   // cin>>t;
   t=1;
   while(t-->0){
      int x,n;
      cin>>x>>n;
      set<int>arr;
      for(int i=0;i<n;i++){
         int g;
         cin>>g;
         arr.insert(g);
      }
      int ans;
      for(int i=0;true;i++){
         int z=x-i;
         if(arr.count(z)==0){
            ans=z;
            break;
         } z=x+i;
         if(arr.count(z)==0){
            ans=z;
            break;
         }
      }
      cout<<ans<<endl;
   }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int main(){
    string s,t;
    cin>>s>>t;
    int ans=1e9;
    rep(si,s.size()){
        if(si+t.size() >s.size()) continue;
        int cnt=0;
        rep(i,t.size()){
            if(s.at(si+i) != t.at(i)) cnt++;
        }
        ans=min(ans,cnt);
    }
        cout<<ans<<endl;
}


Measured memory_bytes: 3632
/*********** Template Starts Here ***********/

/*************** Shadman Taqi ***************/
#include<bits/stdc++.h>
using namespace std;

#define MAX 500
#define ll long long
#define ull unsigned long long
#define ___   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define f(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = b; i >= a; i--)
#define debug(x) cout << #x << " " << x << endl;
#define in(x) cin>>x;
#define out(x) cout<<x;
#define gap cout<<" ";
#define nl cout<<endl;
#define cs(x) cout<<"Case "<<x<<": ";
/*********** Template Ends Here ***********/
/** ################################## Code starts here ################################### **/

int main()
{
    ___
    ll H,T=0,M=1;
    in(H)
    while(H>0)
    {
        T+=M;
        H/=2;
        M*=2;
    }
    out(T)
    return 0;
}
/** ################################## Happy Coding ################################### **/


Measured memory_bytes: 256
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
F_list = list(map(int, input().split()))

A_list_min = sorted(A_list)
F_list_max = sorted(F_list, reverse=True)

first_OK = 10**12

def is_ok(arg):
    check_cnt = 0
    return_flag = 0
    for i in range(N):
        temp = A_list_min[i] - arg//F_list_max[i]
        if temp > 0:
            check_cnt += A_list_min[i] - arg//F_list_max[i]
    if check_cnt <= K:
        return_flag = 1
    else:
        return_flag = 0
    return return_flag

def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

print(bisect(-1, first_OK))

Measured memory_bytes: 113828
#include <cstdio>
#include <algorithm>

using namespace std;

int n,k;
int c[100001];

int main(){
	while(scanf("%d%d",&n,&k), n != 0){
		for(int i = 0; i < k; i++){
			scanf("%d",&c[i]);
		}
		sort(c,c+k);
		c[n] = 100000000;
		
		int mx = 1;
		if(c[0] == 0){
			int st = 0;
			int tmp = 0;
			int pos = 1;
			for(int i = 1; i <= n; i++){
				if (c[pos] == i){
					pos++;
				}
				else{ // c[pos] > i
					st = tmp;
					tmp = i;
				}
				mx = i - st > mx ? i - st : mx;
			}
		}
		else{
			int st = 0;
			int pos = 0;
			for(int i = 1; i <= n; i++){
				if (c[pos] == i){
					pos++;
				}
				else{ // c[pos] > i
					st = i;
				}
				mx = i - st > mx ? i - st : mx;
			}
		}
		printf("%d\n",mx);
	}
	return 0;
}



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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  string w; cin >> w;
  transform(w.begin(),w.end(),w.begin(),::tolower);
  int r=0;
  while(1) {
    string s; cin >> s;
    if (s=="END_OF_TEXT") break;
    transform(s.begin(),s.end(),s.begin(),::tolower);
    int pos = s.find(w);
    //if (pos != string::npos) r++;
    if (w == s) r++;
  }
  cout << r << endl;
}



Measured memory_bytes: 3168
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	fastio();
	ld n;
	cin>>n;
	cout<<fixed<<setprecision(12);
	cout<<(n*n*n)/27<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
namespace IO
{
	template <typename T> inline void read(T &x)
	{
		int f = 1; x = 0; char c = getchar();
		for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
		for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
		x *= f;
	}

	template <typename T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }
	template <typename T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }

	template <typename T> inline void write(T x)
	{
		if (x < 0) putchar('-'), x = -x;
		if (x > 9) write(x / 10);
		putchar(x % 10 + '0');
	}
	template <typename T> inline void writesp(T x) { write(x); putchar(' '); }
	template <typename T> inline void writeln(T x) { write(x); putchar('\n'); }
}
using namespace IO;
ll n, a, b, c, d;
map <ll, ll> f;
inline ll solve(ll n)
{
	if (n == 0) return 0;
	if (n == 1) return d;
	if (f.count(n)) return f[n];
	ll ret = LONG_LONG_MAX / 2;
	if (ret / d > n) ret = d * n;
	
	if (n % 2 == 0) chkmin(ret, solve(n / 2) + a);
	if (n % 3 == 0) chkmin(ret, solve(n / 3) + b);
	if (n % 5 == 0) chkmin(ret, solve(n / 5) + c);
	
	if (n % 2 == 1) chkmin(ret, a + d + min(solve(n / 2), solve(n / 2 + 1)));
	
	if (n % 3 == 1) chkmin(ret, b + min(1 * d + solve(n / 3), 2 * d + solve(n / 3 + 1)));
	if (n % 3 == 2) chkmin(ret, b + min(2 * d + solve(n / 3), 1 * d + solve(n / 3 + 1)));
	
	if (n % 5 == 1) chkmin(ret, c + min(1 * d + solve(n / 5), 4 * d + solve(n / 5 + 1)));
	if (n % 5 == 2) chkmin(ret, c + min(2 * d + solve(n / 5), 3 * d + solve(n / 5 + 1)));
	if (n % 5 == 3) chkmin(ret, c + min(3 * d + solve(n / 5), 2 * d + solve(n / 5 + 1)));
	if (n % 5 == 4) chkmin(ret, c + min(4 * d + solve(n / 5), 1 * d + solve(n / 5 + 1)));
	
	return f[n] = ret;
}
inline void doit()
{
	read(n); read(a); read(b); read(c); read(d);
	writeln(solve(n));
}
int main(){
	int T;
	read(T);
	while (T--) {
		f.clear();
		doit();
	}
  return 0;
}

Measured memory_bytes: 4384
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long H;
        H = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(H);
    }
}

class Solver {
    public void solve(long H) {
        long i = 0;
        while (H > 0) {
            i++;
            H /= 2;
        }

        System.out.println((long) (Math.pow(2, i) - 1));
    }
}



Measured memory_bytes: 21972
import java.util.*;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int min = Integer.MAX_VALUE;
		
		for(int i = 1; i<=N; i++) {
			int x = sc.nextInt();
			min = Math.min(min, Integer.lowestOneBit(x));
		}
		
		System.out.println((int)(Math.log(min)/Math.log(2)));
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const long double PI = acos(-1.0);
inline void my_io() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cout << fixed << setprecision(15);
}
int N;
vector<vector<int>>v;
bool pairCompare(const vector<int>& firstElof, vector<int>& secondElof)
{
	
		return secondElof[2]<firstElof[2];
	
	
		
	
}
int f(int cx, int cy, int x, int y, int h) {//Hを求める
	return h + abs(x - cx) + abs(y - cy);

}
signed main() {
	my_io();
	cin >> N;
	for (int i = 0; i < N; i++) {
		int x, y, h;
		cin >> x >> y >> h;
		v.push_back({ x,y,h });
	}
	sort(v.begin(), v.end(), pairCompare);
	for (int cx = 0; cx <= 100; cx++) {
		for (int cy = 0; cy <= 100; cy++) {
			bool ch = true;
			int H;
			for (int i = 0; i < N; i++) {
				
				if (v[i][2] == 0 ) {
				
					if (1 <= H && H <= abs(v[i][0] - cx) + abs(v[i][1] - cy)) {
						continue;
					}
					else {
						ch = false;
					}
				}
				else if (v[i][2] != 0) {
					if (i == 0) H = f(cx, cy, v[i][0], v[i][1], v[i][2]);
					else {
						if (H == f(cx, cy, v[i][0], v[i][1], v[i][2])) {
							continue;
						}
						else {
							ch = false;
						}
					}
				}

			}
			if (ch == true) {
				cout << cx << " " << cy << " " << H << endl;
				return 0;
			}
		}
	}
	return 0;
}


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

#define for0(i, n) for (long long  i = 0; i < n; i++) 
#define for1(i, n) for (long long  i = 1; i <= n; i++) 
#define forc(i, l, r) for (long long  i = l; i <= r; ++i) 
#define forr0(i, n) for (long long  i = n - 1; i >= 0; i--) 
#define forr1(i, n) for (long long  i = n; i >= 1; i--) 

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

#define all(x) (x).begin(), (x).end() 
#define rall(x) (x).rbegin, (x).rend() 

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef long long int lli;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

const ll N = 1e5 + 200;
const ll mod = 1e9 + 7;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    ll i,j,k,n;
    cin>>n>>k;
    ll a[N],dp[N];
    for0(i,n) cin>>a[i];
    for0(i,N) dp[i]=1e15;
    dp[0]=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<=i+k;j++)
        {
            dp[j]=min(dp[j],dp[i]+(ll)abs(a[j]-a[i]));
        }
    }
    // for0(i,n) cout<<dp[i]<<" ";
    cout<<dp[n-1]<<endl;
    
    return 0;
}



Measured memory_bytes: 5176
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
    int n; cin >> n;
    int max_l = 0, sum = 0;
    vector<int> l(n);

    for (int i = 0; i < n; i++) {
        cin >> l[i];
        sum += l[i];
        max_l = max(max_l, l[i]);
    }

    if (sum - max_l > max_l) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
} 


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

int main(void){
  double stack[128];
  int n,i;
  char str[128],*adr;
  //int l;
  while(fgets(str,sizeof(str),stdin)!=NULL){
    adr=strtok(str," \n");
    n=0;
    for(i=0;i<128;i++) stack[i]=0;
    //l=strlen(adr);
    //printf("%s\n",adr);
    while(adr!=NULL){
      //printf("%s\n",adr);
      if(strcmp(adr,"+")==0){
	stack[n-2]+=stack[n-1];
	n--;
      }else if(strcmp(adr,"-")==0){
	stack[n-2]-=stack[n-1];
	n--;
      }else if(strcmp(adr,"*")==0){
	stack[n-2]*=stack[n-1];
	n--;
      }else if(strcmp(adr,"/")==0){
	stack[n-2]/=stack[n-1];
	n--;
      }else{
	stack[n]=atof(adr);
      //printf("%s\n",adr);
	n++;
    }
      //printf("%f\n",stack[n-1]);
      adr=strtok(NULL," \n");
    }
    printf("%f\n",stack[0]);
  }
  return 0;
}

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

int data[5 * int(1e5) + 10];
void update(int x, int d) {
    for ( ; x < 5 * int(1e5) + 10; x += (x & (-x)) ) data[x] += d;
}
int sum(int x) {
    int result = 0;
    for ( ; 0 < x; x -= (x & (-x)) ) result += data[x];
    return result;
}
int rangesum(int l, int r) { // [l, r]
    return sum(r) - sum(l-1);
}

using namespace std;

int N, nQ;
vector<int> Query[5 * int(1e5) + 10], Qid[5 * int(1e5) + 10];

vector<int> c;

void solve() {
    cin >> N >> nQ;
    c.resize(N + 1);
    for (int i = 1; i <= N; i++) cin >> c[i];

    for (int i = 1; i <= nQ; i++) {
        int l, r;
        cin >> l >> r;
        l, r;
        Query[l].push_back(r);
        Qid[l].push_back(i - 1);
    }

    vector<int> lastSeen (5 * int(1e5) + 10, 0);
    vector<int> answer (nQ);
    for (int L = N; L > 0; L--) {
        if (lastSeen[c[L]] == 0); 
        else update(lastSeen[c[L]], -1);
        
        lastSeen[c[L]] = L;
        update(L, 1);

        for (int iq = 0; iq < (int) Query[L].size(); iq++) {
            answer[Qid[L][iq]] = rangesum(L, Query[L][iq]);
        }
    }

    for (int a : answer) {
        cout << a << '\n';
    }
}

int main() {
    ios::sync_with_stdio(0);
    solve();
}

Measured memory_bytes: 52968