akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long  
using namespace std;

inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}


const int N=1e5+5;

int n,m,fa[N],tot,al,T,ask;

struct nood
{
	int u,v,op;
};
nood e[N<<1];

inline int find(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=find(fa[x]);
}

inline void sub_tree()
{
	if(m<n-1)
		printf("No\n");
	if(ask==T) 
		printf("Yes\n");
	else printf("No\n");
	exit(0);
}

signed main()
{
	n=read();
	m=read();
	T=read();
	for ( int i=0;i<=n;i++ ) fa[i]=i;
	for ( int i=1;i<=T;i++ )
	{
		e[i]=(nood){read(),read(),read()};
		if(!e[i].op)
		{
			ask++;
			int x=find(e[i].u),y=find(e[i].v);
			if(x==y) continue;
			al++; 
			fa[x]=y;
		}
	}
	if(m<=n-1) sub_tree();
	for ( int i=1;i<=T;i++ ) 
	{
		if(e[i].op)
		{
			int x=find(e[i].u),y=find(e[i].v);
			if(x==y) return printf("No\n"),0;
		}
	}
	tot=n-al;
	int l=n,r=al+(tot*(tot-1))/2;
//	cout<<m<<" "<<r<<endl;
	if(m>=l&&m<=r) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int h[100010];
    rep(i, n) cin >> h[i];
    sort(h, h + n);
    int ans = INF;
    rep(i, n - k + 1) {
        ans = min(ans, h[k + i - 1] - h[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
from sys import exit
def log2(x):
    ans = 0
    while(x):
        x //= 2
        ans += 1
    return ans

n = int(input())
n += 1
a = list(map(int, input().split()))
cnt = 1
ans = 0
s = [0 for i in range(n)]
s[-1] = a[-1]
for i in range(n - 2, -1, -1):
    s[i] = s[i + 1] + a[i]
for i in range(n):
    cnt = cnt * 2 - a[i] * 2
    if (i + 1 < n):
        ans += min(cnt, s[i + 1])
if (cnt < 0):
    print(-1)
    exit(0)
print(ans + 1)


Measured memory_bytes: 20008
#![allow(unused_imports, unused_macros, dead_code)]
use std::f64::*;
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::io::stdout;

macro_rules! dump{
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const INF: i64 = 0x3f3f3f3f3f3f3f3f;
const MOD: i64 = 1000000007;
const NOTHING: usize = std::usize::MAX;
const DX: [usize; 4] = [1, 0, std::usize::MAX, 0];
const DY: [usize; 4] = [0, 1, 0, std::usize::MAX];

fn main() {
    let n: usize = readln();
    let mut rest: usize = 20;
    println!("0");
    rest -= 1;
    let _ = stdout().flush();
    let mut fl: String = readln();
    if fl == "Vacant" {
        return;
    }
    let mut low = 0;
    let mut high = 2 * n - 1;
    while high - low > 1 {
        if rest == 0 {
            return;
        }
        let mid = low + ((high - low) >> 1);
        println!("{}", mid % n);
        rest -= 1;
        let _ = stdout().flush();
        let fm: String = readln();
        if fm == "Vacant" {
            return;
        }
        if (mid - low) % 2 == 0 && fl == fm || (mid - low) % 2 == 1 && fl != fm {
            low = mid;
            fl = fm;
        } else {
            high = mid;
        }
    }
}

trait Read {
    fn read(s: &str) -> Self;
}

fn readln<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}


Measured memory_bytes: 4948
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/09/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = unsigned long long;

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

  int n,p; cin>>n>>p;
  ll dp[2][2] = {};
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int a; cin>>a; a%=2;
    for (int k = 0; k < 2; k++) {
      dp[i%2][k] = dp[i%2^1][k] + dp[i%2^1][(k+2-a)%2];
    }
  }
  cout << dp[n%2][p] << endl;

  return 0;
}


Measured memory_bytes: 256
n,m,p[16],s,P[16];R(c,d,r){if(c<=n){for(r=p[c]<d?1:-1;p[c]-d;p[c]+=r)R(c+1,3-p[c]*2-r),s++;R(c+1,d);}}main(i,c,t){for(;scanf("%d%d",&n,&m)*n;s=!printf("%d\n",s>m?-1:s)){for(i=3;i--;)for(scanf("%d",&t);t--;p[c]=P[c]=i)scanf("%d",&c);R(1,2);t=s;memcpy(p,P,64);R(1,s=0);s=t<s?t:s;}}

Measured memory_bytes: 408
#include<iostream>
using namespace std;
 
int main(){
    int n, m, l;
    cin >> n >> m >> l;
    int a[101][101], b[101][101];
    long int c[101][101] = {0};
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for(int j = 0; j < m; j++){
        for(int k = 0; k < l; k++){
            cin >> b[j][k];
        }
    }
    for(int i = 0; i < n; i++){
        for(int k = 0; k < l; k++){
            for(int j = 0; j < m; j++) c[i][k] += a[i][j] * b[j][k];
        }
        for(int k = 0; k < l-1; k++) cout << c[i][k] << ' ';
        cout << c[i][l-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3232
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#endif

using ll = long long;
const ll INF = 1LL << 50;


int main(void) {
	using std::cin; using std::cout; using std::endl;
	int N, M;
	cin >> N >> M;

	const int NMAX = 1000;
	const int MMAX = 2000;
	int a[MMAX], b[MMAX];
	ll c[MMAX];

	for (int i = 0; i < M; ++i) {
		cin >> a[i] >> b[i] >> c[i];
		c[i] = -c[i];
	}

	ll dist[NMAX];

	for (int i = 0; i < N; ++i) {
		dist[i] = INF;
	}

	dist[0] = 0;


	for (int loop = 0; loop < N - 1; ++loop) {
		for (int i = 0; i < M; ++i) {

			if (dist[a[i] - 1] == INF) continue;

			if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
				dist[b[i] - 1] = dist[a[i] - 1] + c[i];
			}
		}
	}

	ll ans = dist[N - 1];


	bool negative[NMAX];

	for (int i = 0; i < N; ++i) {
		negative[i] = false;
	}

	for (int loop = 0; loop < N; ++loop) {
		for (int i = 0; i < M; ++i) {
			if (dist[a[i] - 1] == INF) continue;

			if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
				dist[b[i] - 1] = dist[a[i] - 1] + c[i];
				negative[b[i] - 1] = true;
			}

			if (negative[a[i] - 1] == true) {
				negative[b[i] - 1] = true;
			}
		}
	}


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

	return 0;
}

Measured memory_bytes: 256
def main():
    from sys import stdin
    readline = stdin.readline
    H, N = map(int, readline().split())
    AB = [list(map(int, readline().split())) for _ in range(N)]

    inf = float('inf')
    dp = [inf] * (H + 1)
    dp[0] = 0
    for i in range(H):
        if dp[i] == inf:
            continue
        t1 = dp[i]
        for a, b in AB:
            t2 = i + a
            if t2 > H:
                t2 = H
            t3 = t1 + b
            if t3 < dp[t2]:
                dp[t2] = t3
    print(dp[H])


main()


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vector<int> h(n);
	REP(i,n) cin>>h[i];
	
	vector<int> dp(n);
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;++i){
		dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
	}
	
	cout<<dp[n-1]<<endl;
	return 0;
}//解答参考.

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#define MOD 1000000007
using namespace std;
int main()
{
	int n;
	int i, j;
	unsigned long ans;

	cin >> n;
	unsigned long *a = new unsigned long[n];
	unsigned long total = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		total = (total + a[i]) % MOD;
	}

	unsigned long tmp;
	unsigned long tmp2;
	ans = 0;
	for (i = 0; i < n; i++) {
		if (a[i] > total) {
			total = MOD + total - a[i];
		}
		else {
			total = total - a[i];
		}
		tmp2 = (a[i] * total)%MOD;
		ans = ans + tmp2;
		ans = ans % MOD;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5160
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    string S, T;
    cin >> S >> T;

    vector<int> sv(26, 0), st(26, 0);

    for (int i = 0; i < S.length(); i++) {
        sv[S[i] - 'a']++;
        st[T[i] - 'a']++;
    }

    sort(sv.begin(), sv.end());
    sort(st.begin(), st.end());

    for (int i = 0; i < sv.size(); i++) {
        if (sv[i] != st[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
char a[200005];

int main(){
	cin>>a;
	int x=0;
	for(int i=0;a[i]!='\0';i++)x=(x*10+a[i]-'0')%9;
	if(!x)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3820
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))

def exp(x):
    return (1+x)/2

import numpy as np
cums=np.cumsum([0] + [exp(i) for i in p])

ans=0
for i in range(n-k+1):
    ans=max(ans, cums[i+k]-cums[i])

print(ans)

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

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }
};


int main() {
    mint m;
    ll n;
    cin >> m >> n;

    mint ans = m.pow(n);

    cout << ans.x << endl;


}



Measured memory_bytes: 3112
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll n, k;
combination comb( 1010 );

int main()
{
  std::cin >> n >> k;

  mint ans = 0;

  rep( i, k+1 )
    ans += comb(k,i)*mint(i).pow(n)*((k-i)&1 ? -1 : 1);

  std::cout << ans.x << std::endl;

  return 0;
}


Measured memory_bytes: 3120
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  vector<ll> S(N+1);
  S[0] = 0;
  for (ll i=0; i<N; i++) {
    cin >> A[i];
    S[i+1] = (S[i] + A[i] - 1)%K;
  }
  map<ll, ll> mp;
  ll ans = 0;
  queue<ll> q;
  for (int j=0; j<N+1; j++) {
    ans += mp[S[j]];
    mp[S[j]]++;
    q.push(S[j]);
    while (q.size() >= K) {
      mp[q.front()]--;
      q.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 17536
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;


int main(void) {
	int n, m, i, j, k, l;
	ll p[1003][3], s, tr, ans = 0;

	cin >> n >> m;
	for (i = 0; i < n; i++) for (j = 0; j < 3; j++) {
		cin >> p[i][j];
	}

	for (i = 0; i < 8; i++) {
		vector<ll> t;
		for (j = 0; j < n; j++) {
			s = 0;
			for (k = 0; k < 3; k++) {
				if (((i >> k) & 1) == 1) s += p[j][k];
				else s -= p[j][k];
			}
			t.push_back(s);
		}
		sort(t.begin(), t.end(), greater<ll>());
		tr = 0;
		for (j = 0; j < m; j++) tr += t[j];
		ans = max(ans, tr);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
N, K = map(int, input().split())
List = list(map(int, input().split()))

price = N - 1

while True:
    flag = True
    price += 1
    price_str = str(price)
    for num in str(price_str):
        if int(num) in List:
            flag = False
            
    if flag == True:
        print(price)
        break

Measured memory_bytes: 40812
object Main extends App {
  import scala.io.StdIn._
  val n = readInt
  val bills = readLine.trim.split(' ').map(_.toLong).sorted.toList

  println(solve(bills))
  def solve(bills: List[Long]): Long = {
    def sub(rest: List[Long], upper: Long): Long = {
      rest match {
        case Nil ⇒ upper
        case h::_ if upper < h ⇒ upper
        case h::t ⇒ sub(t, upper + h)
      }
    }
    sub(bills, 1)
  }
}


Measured memory_bytes: 49028
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(n: i64);

    let mut d: Vec<i64> = vec![0];
    let mut d_clone: Vec<i64>;
    for i in 0..n {
        d_clone = d.clone();
        let a: i64;
        from_line!(a: i64);
        let mut have = false;

        for j in d_clone {
            if j == a {
                have = true;
                break;
            }
        }
        if have == false {
            d.push(a);
        }
    }

    println!("{}", d.len() - 1);
}


Measured memory_bytes: 4352
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(" ").map(String::toLong)
    fun isEven(v: Long): Boolean {
        return v % 2L == 0L
    }
    if (isEven(a) || isEven(b) || isEven(c)) {
        println(0)
    } else {
        val list = listOf(a, b, c).sorted()
        val d = list[0] * list[1]
        println(d * ((list[2] / 2) + 1) - d * (list[2] / 2))
    }
}





Measured memory_bytes: 37904
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
 
using namespace std;
 
#define N 1000000
int arr[N];
int a[N];
 
void eratosthenes(){
    REP(i,N){
        arr[i]=1;
    }
 
    for(int i=2;i<sqrt(N);i++){
        if(arr[i]){
            for(int j=0;i*(j+2)<N;j++){
                arr[i*(j+2)]=0;
            }
        }
    }
    arr[0]=0;
    arr[1]=0;
}
 
signed main(){
 
	int n,h;
	cin>>n>>h;

	int max_a=-1;
	vector<int> v;
	int count=0;

	REP(i,n){
		int a,b;
		cin>>a>>b;

		max_a=max(a,max_a);
		v.pb(b);

	}

	sort(v.rbegin(),v.rend());

	// cout<<max_a<<endl;
	// REP(i,n){
	// 	cout<<v[i]<<" ";
	// }cout<<endl;

	REP(i,n){
		if(v[i]>=max_a){
			if(h>0){
				h=h-v[i];
				count++;

				// cout<<"+"<<endl;
			}else{
				cout<<count<<endl;
				return 0;
			}
		}
	}
	// cout<<count<<endl;
	// cout<<h<<endl;
	// cout<<int(ceil(h/max_a))<<endl;
	cout<<int(ceil(double(h*1.0/max_a)))+count<<endl;
	// cout<<int(ceil(h/max_a))+count<<endl;
 
 
}

Measured memory_bytes: 892
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(){
	int i,D,N;
	scanf("%d %d",&D,&N);
	if(N<100){
		printf("%d",N);
	}
	else{
		printf("101");
	}
	for(i=0;i<D;i++){
		printf("00");
	}
	printf("\n");
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

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

		while(true){
			String s = sc.next();
			if(s.compareTo("#")==0)break;
			
			int now = 0;
			for(int i=0;i<s.length();i++){
				if(s.codePointAt(i)==48){
					if(now==0)now=1;
					else if(now==1)break;
					else if(now==2)now=1;
					else if(now==3)now=4;
					else if(now==4)now=5;
					else if(now==5)now=2;
				}else{
					if(now==0)now=2;
					else if(now==1)now=3;
					else if(now==2)break;
					else if(now==3)now=5;
					else if(now==4)now=2;
					else if(now==5)now=1;
				}
			}
			if(now==5){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
			
		}
	}
}

Measured memory_bytes: 17312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;
int H,W,K; 

int black(vvii S,int bh,int bw){
    REP(i,H){
        if(bh & (1<<i)){
            REP(k,W){
                S[i][k] = 0;
            }
        }
    }
    REP(i,W){
        if(bw & (1 << i)){
            REP(l,H){
                S[l][i] = 0;
            }
        }
    }
    int res = 0;
    REP(i,H){
        REP(k,W){
            if(S[i][k] == 1)res++;
        }
    }

    return res;
}

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    cin>>H>>W>>K;
    vector<string> C(H);
    vector<vector<int> > board(H,vector<int>(W));
    REP(i,H){
        string s; cin >>s;
        REP(k,W){
            if(s[k] == '.'){
                board[i][k] = 0;
            }
            else board[i][k] = 1;
        }
    }
    int ans = 0;
    for(int bith = 0 ; bith < pow(2,H); bith++){
        for(int bitw = 0 ; bitw < pow(2,W); bitw++){
            if(black(board,bith,bitw) == K)ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 4088
"use strict";
function Main(input) {
	input = input.split("\n");
  const person = input[1].split(" ");
  let rates = [];
  
  for(let i=0; i < 9; i++){
			rates[i] = 0;
		}
    
  for(let personCount=0; personCount < person.length; personCount++){
      let inputValue = parseInt(person[personCount], 10);
      if(1 <= inputValue && inputValue < 400){
				rates[0] = 1;
				}
			else if(400 <= inputValue && inputValue < 800){
				rates[1] = 1;
			}
			else if(800 <= inputValue && inputValue < 1200){
				rates[2] = 1;
			}
			else if(1200 <= inputValue && inputValue < 1600){
				rates[3] = 1;
			}
			else if(1600 <= inputValue && inputValue < 2000){
				rates[4] = 1;
			}
			else if(2000 <= inputValue && inputValue < 2400){
				rates[5] = 1;
			}
			else if(2400 <= inputValue && inputValue < 2800){
				rates[6] = 1;
			}
			else if(2800 <= inputValue && inputValue < 3200){
				rates[7] = 1;
			}
			else if(3200 <= inputValue && inputValue <= 4800){
				rates[8] += 1;
			}
		}
  
  let  color = 0;
  for(let colorCount=0; colorCount < 8; colorCount++){
		color += rates[colorCount];
	}
	
	let max = color + rates[8];
	let min = color;
 
	if(color === 0 && rates[8] > 0){
		min = 1;
	}
	console.log(min,max);
}

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


Measured memory_bytes: 7372
#include <iostream>
#include <vector>

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;



int memo[1001][1001];
bool checked[1001][1001];
// Levenshtein Distance
int ld(string s, string t, int si, int ti) {
  if( si == -1 && ti == -1) {
    return 0;
  }
  if( si == -1 ) {
    return ld(s, t, si, ti-1) + 1;
  } 
  if( ti == -1) {
    return ld(s, t, si-1, ti) + 1;
  }

  if( checked[si][ti] ) {
    return memo[si][ti];
  }
  checked[si][ti] = true;

  int r1 = ld(s, t, si-1, ti) + 1;  // sを一文字削除
  int r2 = ld(s, t, si, ti-1) + 1;  // tを一文字削除
  int r3 = ld(s, t, si-1, ti-1) + ( s[si] == t[ti] ? 0 : 1 ); // 最後の文字を交換して一致させる。もともと一致している場合は不要

  int res = min(r1, min(r2, r3)  );

  return memo[si][ti] = res;

}


int main() {
  ios::sync_with_stdio(false);

  string s, t;
  cin >> s >> t;

  cout << ld(s, t, s.size() - 1, t.size() - 1) << "\n";

  return 0;

}

Measured memory_bytes: 8272
class Imos:
    def __init__(self, n):
        self.B = [0] * n
        self.n = n
        from itertools import accumulate
        self.ac = accumulate

    def __call__(self, l, r):
        l, r = max(l, 0), min(r, self.n - 1)
        self.B[l] += 1
        if r + 1 != self.n:
            self.B[r + 1] -= 1

    def out(self):
        *res, = self.ac(self.B)
        self.__init__(self.n)
        return res

from collections import defaultdict
d = defaultdict(list)
imos = Imos(10 ** 5 + 1)

(N, C), *D = [[*map(int, o.split())] for o in open(0)]
for s, t, c in D:
    d[c] += (s, t),
for p in d.values():
    p.sort()
    ps, pt = p[0]
    for s, t in p[1:] + [[0,0]]:
        if pt == s:
            pt = t
        else:
            imos(ps - 1, pt - 1)
            ps, pt = s, t
print(max(imos.out()))

Measured memory_bytes: 37516
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
const int N = 1005;

int memo[2*N][N];

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
    
	int n;
	cin >> n;

	vector<int> left(n + 1), right(n + 1), a(n);
	rep(i,n)
		cin >> a[i];

	// left[0] = a[0];
	repA(i,1,n-1) {
		left[i] = __gcd(a[i - 1], left[i - 1]);
	}	

	// right[n] = a[n - 1];
	repD(i, n - 2, 0) {
		right[i] = __gcd(a[i + 1], right[i + 1]);
	}

	int mx = -inf;

	rep(i,n) {
		mx = max(mx, __gcd(left[i], right[i]));
	}
	cout << mx << '\n';
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const int N=305;
#define int long long
int n,k,p,f[305][305][305];
signed main()
{
	f[0][1][0]=1;
	scanf("%d%d%d",&n,&k,&p);
	for (int i=0;i<=n;i++)
	 for (int j=1;j<=k;j++)
	  for (int l=i;l>=0;l--)
	   if (f[i][j][l]) 
	   	{
	   		if (l)(f[i][j][l-1]+=f[i][j][l])%=p;
	   		else (f[i][j+1][i]+=f[i][j][l])%=p;
	   		(f[i+1][j][l]+=f[i][j][l]*(l+1))%=p;
	    }
	printf("%d",f[n][k+1][n]);   
}

Measured memory_bytes: 221440
list=input().split()
num=int(input())
A,B,C=int(list[0]),int(list[1]),int(list[2])

pattern=[[i,num-i] for i in range(num+1)]
temB=B
temC=C
a=0
for pt in pattern:
  B=B*(2**pt[0])
  C=C*(2**pt[1])
  
  
  if A<B<C:
    print('Yes')
    a=1
    break
   
  B=temB
  C=temC

if a!=1:
  print('No')
  
  


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int A;
    int m=100,c;
    cin>>N;
    for(int i=0;i<N;i++){
        c=0;
        cin>>A;
        while(1){
            if (A%2==1){m=min(m,c);break;}
            A=A/2;c++;
        }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXC = 17, MAXN = 301;

int c[MAXC];

int dp[MAXC + 1][MAXN];

int main()
{
	REP(MAXC) c[i] = (i+1) * (i+1);

	dp[0][0] = 1;
	REP(MAXC)rep(j,MAXN)for(int w = 0;w < MAXN;w++)
	{
		if(j + c[i] * w >= MAXN) break;

		dp[i+1][j + c[i] * w] += dp[i][j];
	}

	int	n;
	while(cin >> n && n)
	{
		cout << dp[MAXC][n] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
n, y = map(int, input().split())
 
ans =[-1, -1, -1]
for i in range(n + 1):
    for j in range(n + 1 - i):
            if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
                ans = [i, j, n - i - j]
                break
print(' '.join(map(str, ans)))

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
	int N,n;
	int a[100];
	int ans=0;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
		scanf("%d",&a[i]);
	for(int j=0;j<N;j++){
		for(int k=j+1;k<N;k++){
			ans+=a[j]*a[k];
		}	
	}
	printf("%d",ans);
	return 0;
}

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

int main() {
  int h, a;
  cin>>h>>a;
  int ans = (h+a-1)/a;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll x;
    cin >> x;
    ll ans = 0;
    ans += (x/500)*1000;
    x %= 500;
    ans += (x/5)*5;
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

inline int counter(int n);

int main(){
	std::ios::sync_with_stdio(false);
	int data[50],n,i=0;
	while(std::cin){
		std::cin >> n;
		data[i] = counter(n);
		i++;
	}
	for (int j=0;j<i-1;j++){
		std::cout << data[j] << "\n";
	}
}

inline int counter(int n){
	int count=0;
	for (int i=0;i<10;++i){
		for (int j=0;j<10;++j){
			for (int l=0;l<10;++l){
				for (int t=0;t<10;++t){
					if (i+j+l+t == n){
						count++;
					}
				}
			}
		}
	}
	return count;
}

Measured memory_bytes: 3204
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,k,sum=2;
    cin>>n>>k;
  for (int i=1;i<=n-1;i++)
  {
      if (k<sum)
        sum+=k;
      else
        sum*=2;
  }
  cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<long double> vld;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
#define sqr(a) ((a) * (a))
#define len(V) (int)V.size()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define fix(a) fixed << setprecision(a)
#define readv(x) for(auto &_ : (x)) {cin >> _;}
#define printv(x) for(auto &_ : (x)) {cout << _ << ' ';} cout << endl
#define EPS 1e-6
#define MAXN 100047


void solve(){
	string s; cin >> s;
	
	FOR(i, (int)'a', (int)'z'+1){
		if(s.find((char)(i)) == -1){
			cout << (char)i << endl;
			return;
		}
	}
	
	cout << "None\n";
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	solve();
	
	return 0;
}


Measured memory_bytes: 3772
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 110, X = 510, mod = 1e9 + 7;

void add(int& x, int y) {
	x += y;
	if (x >= mod) {
		x -= mod;
	}
}

int mul(ll x, int y) {
	return (x * y) % mod;
}

int l[N], dp[N][N][X];

int main() {
	fast_cin();
	int n, x;
	cin >> n >> x;
	for (int i = 1; i <= n; ++i) {
		cin >> l[i];
	}
	sort(l + 1, l + 1 + n, greater<int>());
	dp[0][0][0] = 1;
	for (int i = 0; i < n; ++i) {
		for (int k = 0; k * l[i] <= x and k <= i; ++k) {
			for (int sum = 0; sum <= x; ++sum) {
				int cur = dp[i][k][sum];
				if (!cur) {
					continue;
				}
				if (sum + l[i + 1] <= x) {
					add(dp[i + 1][k + 1][sum + l[i + 1]], cur);
				}
				add(dp[i + 1][k][sum], mul(cur, sum - k * (l[i + 1] - 1)));
				for (int y = 0; y < l[i + 1] - 1 and sum + y <= x; ++y) {
					add(dp[i + 1][k][sum + y + 1], mul(cur, 2 * k));
					add(dp[i + 1][k - 1][sum + y], mul(cur, mul(l[i + 1] - y - 1, k * (k - 1))));
				}
			}
		}
	}
	int ans = 0, fact = 1;
	for (int k = 1; k <= n; ++k) {
		fact = mul(fact, k);
		add(ans, mul(fact, dp[n][k][x]));
	}
	cout << ans << endl;
}

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

int min(int A,int B){
    return A<B?A:B;
}

int main(void){
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int p,x=0,y=0,z=0;
    for (int i=0; i<n; i++){
        scanf("%d",&p);
        if (p<=a){
            x++;
        } else if (p<=b){
            y++;
        } else {
            z++;
        }
    }
    printf("%d\n",min(min(x,y),z));
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;
 
ll apple(ll n) {
	ll p = sqrt(n);
	ll k;
	ll t;
	bool flag = false;
 
	while (!flag) {
		if (n % p == 0) {
			k = n / p + p;
			t = n / p;
			flag = true;
		}
		else p--;
	}
	return k;
}
 
int main() {
	ll n;
	cin >> n;
	cout << apple(n) - 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#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>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  int n, l;
  cin >> n >> l;
  int r = n + l - 1;
  int ans = 0;
  for (int i = l; i <= r; i++) ans += i;
  if (r < 0) ans -= r;
  if (l > 0) ans -= l;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
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 main(){
      string s; cin>>s;
      string ans="";
      ans+=s[0];
      ans+=s[1];
      ans+=s[2];
      cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int n,m;
	cin >> n >> m;
	priority_queue<int> q;
	rep(i,n){
		int a;
		cin >> a;
		q.push(a);
	}

	rep(i,m){
		int a = q.top()/2;q.pop();
		q.push(a);
	}

	ll ans = 0;
	rep(i,n){
		ans += q.top();q.pop();
	}
	cout << ans << endl;

  return 0;
}


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

int main(){
  int N;
  int64_t M;
  cin >> N >> M;
  vector<int64_t> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  vector<int64_t> sum(N+1, 0);
  for(int i=1; i<=N; i++){
    sum.at(i)= data.at(N-i)+ sum.at(i-1);
  }

  int64_t ans= 0;
  int64_t ok= data.at(0)+ data.at(0);
  int64_t ng= data.at(N-1)+ data.at(N-1)+ 1;
  while(ng-ok > 1){
    int64_t mid= (ng+ok) >> 1;
    int64_t cnt_geq = 0;
    for(auto &pow:data){
      auto itr_geq= lower_bound(data.begin(), data.end(), mid- pow);
      cnt_geq+= distance(itr_geq, data.end());
    }

    if(cnt_geq >= M){
      ok= mid;
    }
    else{// cnt_geq < M
      ng= mid;
    }
  }

  int64_t cnt_g= 0;
  for(auto &pow:data){
    auto itr_g= upper_bound(data.begin(), data.end(), ok- pow);
    int idx= distance(itr_g, data.end());
    ans+= pow*idx + sum.at(idx);
    cnt_g+= idx;
  }
  ans+= ok*(M-cnt_g);

  cout << ans << endl;
}

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

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    int maxOfL = 1, minOfR = n;
    for (int i=0; i<m; i++) {
        int l, r;
        cin >> l >> r;
        maxOfL = max(maxOfL, l);
        minOfR = min(minOfR, r);
    }
    cout << max(minOfR-maxOfL+1, 0) << endl;
}

Measured memory_bytes: 256