akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define lowbit(x) (x&-x)
using namespace std;

namespace IO
{
	const int S=(1<<20)+5;
	//Input Correlation
	char buf[S],*H,*T;
	inline char Get()
	{
		if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
		if(H==T) return -1;return *H++;
	}
	inline int read()
	{
		int x=0;char c=Get();
		while(!isdigit(c)) c=Get();
		while(isdigit(c)) x=x*10+c-'0',c=Get();
		return x;
	}
	//Output Correlation
	char obuf[S],*oS=obuf,*oT=oS+S-1,c,qu[55];int qr;
	inline void flush(){fwrite(obuf,1,oS-obuf,stdout);oS=obuf;}
	inline void putc(char x){*oS++ =x;if(oS==oT) flush();}
	template <class I>inline void print(I x)
	{
		if(!x) putc('0');
		if(x<0) putc('-'),x=-x;
		while(x) qu[++qr]=x%10+'0',x/=10;
		while(qr) putc(qu[qr--]);
	}
}

using namespace IO;
typedef pair<int,int> pii;
const int N=300010,M=100010;
vector<pii> obj[M];
int sum[M];
int n,m;
int bit[M];

void Add(int p,int x){for(;p<=m;p+=lowbit(p)) bit[p]+=x;}
int Sum(int p){int res=0;for(;p;p-=lowbit(p)) res+=bit[p];return res;}

int main()
{
	int l,r;
	n=read();m=read();
	for(int i=1;i<=n;i++)
	{
		l=read();r=read();
		obj[r-l+1].push_back(pii(l,r));
	}
	for(int i=m;i>=1;i--)
		sum[i]=sum[i+1]+obj[i].size();
	int pl=0;
	for(int i=1;i<=m;i++)
	{
		int ans=sum[i+1];
		while(pl<i)
		{
			pl++;
			for(int j=0;j<obj[pl].size();j++)
			{
				Add(obj[pl][j].first,1);
				Add(obj[pl][j].second+1,-1);
			}
		}
		for(int j=i;j<=m;j+=i) ans+=Sum(j);
		print(ans);putc('\n');
	}
	flush();
	return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,ans=0;
	cin>>n;
	vi vs(n);
	for(int &x:vs) cin>>x;
	for(int i=0;i<n;++i){
		for(int j=i+1;j<n;++j){
			ans+=(vs[i]*vs[j]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

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

Measured memory_bytes: 256
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r=0,d=0,x=0;
    cin>>r>>d>>x;
    for(int i=0;i<10;++i)
    {
        x*=r;
        x-=d;
        cout<<x<<endl;
    }
}

Measured memory_bytes: 256
//BECAUSE ONE TRUTH PREVAILS
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
int main() {

    LL N,K;
    cin>>N>>K;
    vector<LL> arr(N);
    for(auto &it:arr)
    {
        cin>>it;
    }
    sort(arr.begin(),arr.end());
    LL ans=0;
    for(LL i=0;i<min(K,N);i++)
    {
        ans+=arr[i];
    }
    cout<<ans;

}


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

using namespace std;

typedef long long ll;

int main()
{
    ll A, B, N; cin >> A >> B >> N;

    ll x = min(N, B - 1);

    ll Ans = (A * x) / B - A * (x / B);

    cout << Ans << endl;
}


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

██╗    ██╗██████╗ ██╗████████╗████████╗███████╗███╗   ██╗    ██████╗ ██╗   ██╗
██║    ██║██╔══██╗██║╚══██╔══╝╚══██╔══╝██╔════╝████╗  ██║    ██╔══██╗╚██╗ ██╔╝
██║ █╗ ██║██████╔╝██║   ██║      ██║   █████╗  ██╔██╗ ██║    ██████╔╝ ╚████╔╝
██║███╗██║██╔══██╗██║   ██║      ██║   ██╔══╝  ██║╚██╗██║    ██╔══██╗  ╚██╔╝
╚███╔███╔╝██║  ██║██║   ██║      ██║   ███████╗██║ ╚████║    ██████╔╝   ██║
 ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝   ╚═╝      ╚═╝   ╚══════╝╚═╝  ╚═══╝    ╚═════╝    ╚═╝

     ███╗   ███╗   ██╗██████╗ ██████╗  █████╗ ██╗  ██╗██╗███╗   ███╗
     ████╗ ████║   ██║██╔══██╗██╔══██╗██╔══██╗██║  ██║██║████╗ ████║
     ██╔████╔██║   ██║██████╔╝██████╔╝███████║███████║██║██╔████╔██║
     ██║╚██╔╝██║   ██║██╔══██╗██╔══██╗██╔══██║██╔══██║██║██║╚██╔╝██║
     ██║ ╚═╝ ██║██╗██║██████╔╝██║  ██║██║  ██║██║  ██║██║██║ ╚═╝ ██║
     ╚═╝     ╚═╝╚═╝╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝     ╚═╝
*/
#define speed  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(n) for(int i=0;i<n;i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define E "\n"
#define all(e) e.begin(),e.end()
#define F first
#define S second
#define pi (acos(-1))
#define rad(x) ((x*pi)/(ld)(180))
#define perc(x) fixed<<setprecision(x)
/*****
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define vec(a,b) ((b) - (a))
#define rot(p,angle) (p)*polar((double)(1),angle)
#define rot2(p,angle,a) ((p)-(a)) *(polar((ld)(1),angle)+ (a))
#define x real()
#define y imag()
*****/
typedef long long int ll; typedef unsigned long long ull; typedef long double ld;typedef complex<ld> point; typedef tuple<double,double,double> line;
ll gcd(ll x,ll y){if(!y)return x; return gcd(y,x%y);};   ll lcm(ll x,ll y){return (x*y)/__gcd(x,y);}

int main(){ speed;

int n,k; cin>>n>>k;
int arr[n];

FOR(n)cin>>arr[i];

int ans[n];

ans[0]=0;

ans[1]= abs(arr[0]-arr[1]);

for(int i=2;i<n;i++)
{
    ans[i]=1e9;
    for(int j=i-1;j>=max(0,i-k);j--)
    ans[i]=min(ans[j]+abs(arr[i]-arr[j]),ans[i]);
}

cout<<ans[n-1];


return 0;}


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

const long long MOD = 1000000007;

using ll = long long;

void solve(long long N, std::vector<long long> A){
    map<int ,ll> mp;
    map<int, ll> cnt;
    vector<ll> frac = {0, 1, 2, 6};
    ll ans = 1;
    for(int i = 0;i < N;i++){
        cnt[A[i]]++;
        if(cnt[A[i]] >= 4){
            cout<<0<<endl;
            return;
        }
        if(A[i] == 0){
            mp[A[i]]++;
        }else{
            mp[A[i]]++;
            ans *= mp[A[i]-1];
            ans %= MOD;
            mp[A[i]-1]--;
            mp[A[i]-1] = max(mp[A[i]-1], 0LL);
        }
    }
    ll s = (cnt[0] >= 2 ? 2 : 1);
    cout<<(ans % MOD * 3 % MOD * s % MOD  % MOD)%MOD<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 13568
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int i, j, k;
  int MaxNum = 0;
  int DesideNum = 0;
  int Count = 0;
  while(1){
    Count = 0;
    scanf("%d %d", &MaxNum, &DesideNum);
    if(MaxNum == 0 && DesideNum == 0){break;}
    for(i = 1 ; i <= MaxNum ; ++i){
      for(j = 1 ; j <= MaxNum ; ++j){
        if(i != j){
          for(k = 1 ; k <= MaxNum ; ++k){
            if(k != i && k != j){
              if(i + j + k == DesideNum){
                Count += 1;
              }
            }
          }
        }
      }
    }
    printf("%d\n", Count/6);
  }
  return 0;
}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
#include <boost/math/constants/constants.hpp>
using namespace std;
namespace rng {
    using namespace boost::range;
    using namespace boost::adaptors;
}

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

using boost::irange;
using boost::math::double_constants::pi;
using i64 = int64_t;
constexpr char nl = '\n';
auto yesno(bool b) { return b ? "Yes" : "No"; }

template<class T> istream& operator>>(istream& in, vector<T>& vs) { for (T& v :vs) in >> v; return in; }
template<class T> ostream& operator<<(ostream& out, const vector<T>& vs) { for (size_t i = 0; i < vs.size(); ++i) { if(i) { out << ' '; } out << vs[i]; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const T& v) { cout << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cout << nl; for (const auto& v : m) { trace_(v); cout << nl; } }
template<class T> void trace_(const char* s, const T& v) { cout << s << "="; trace_(v); cout << nl; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cout << *s; } cout << "="; trace_(v); trace_(s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    long double a, b, x, rad;
    cin >> a >> b >> x;
    if (a * a * b < 2 * x) {
        rad = atan(2 * (b / a - x / (a * a * a)));
    } else {
        rad = pi / 2 - atan(2 * x / (a * b * b));
    }
    cout << rad * 180 / pi << nl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 1e5+5;
char s[10];
int main()
{
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i++)
	{
		if(s[i]=='A'&&s[i+1]=='C') {
			cout<<"Yes";return 0;
		}
	}
	cout<<"No";return 0;
 } 

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if (a >= c) {
		printf("0\n");
	}
	else if (a + b < c) {
		printf("NA\n");
	}
	else {
		printf("%d\n", c - a);
	}
	return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>

using namespace std;

int main(void){

  int h,w,n;
  cin>>h;
  cin>>w;
  cin>>n;
  //cout << h << w << n << endl;
  vector<pair<int,int> > pos(0);
  //vector<pair<int,int> > d(n);
  for(int i=0;i<n;i++){
    //cin >> pos[i].first;
    //cin >> pos[i].second;
    int x,y;
    //cin >> pos[i].second;
    cin >> x;
    cin >> y;
    if(x>=y) pos.push_back(make_pair(x,y));
    //cin >> pos[i].first;
    //d[i].first=pos[i].second;
    //d[i].second=pos[i].first;
    //cout << pos[i].first << "," << pos[i].second << endl;
  }
  if(n==0){
    cout << h << endl;
    return 0;
  }
  sort(pos.begin(),pos.end());
  //sort(d.begin(),d.end());

  for(int i=0;i<pos.size();i++){
    //cout << pos[i].first << "," << pos[i].second << endl;
  }

  int x=1,y=1;
  int ans=h;
  for(auto c:pos){
    if(c.first - x > c.second -y){
      ans=c.first -1;
      break;
    }
    else if(c.first -x == c.second -y){
      x=c.first;
      y=c.second-1;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
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 int INF = 1<<30;
const ll LINF = 1LL<<58;
const ll mod = 1000000007;

struct edge{
    int from, to, cost;
};
vector<edge> G;

int main(){
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            int c;
            cin >> c;
            G.pb({j, i, c});
        }
    }
    int d[10];
    for(int i = 0; i < 10; i++) d[i] = INF;
    d[1] = 0;
    for(int i = 0; i < 10; i++){
        for(int v = 0; v < 10; v++){
            for(auto e: G){
                if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                    d[e.to] = d[e.from] + e.cost;
                }
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < h*w; i++){
        int a;
        cin >> a;
        if(a == -1) continue;
        ans += d[a];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a;i<b;i++)
const int inf=2e6;
#define maxx 16
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;


int main(){
    FASTIO;
    int k,a,b;
    cin>>k>>a>>b;
    REP(i,a,b+1){
      if(i%k==0){
        cout<<"OK";
        return 0;
      }
    }
    cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll x; cin>>x;
    ll res=0;
    res+=1000*(x/500);
    res+=5*((x%500)/5);
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  int n,m;
  cin >> n >> m;

  vector<int> a(m);
  REP(i,m) cin >> a[i];
  
  sort(a.begin(),a.end());

  vector<int> tmp;
  REP(i,m-1) tmp.pb(a[i+1]-a[i]);

  sort(tmp.begin(),tmp.end());

  int ans = 0;

  REP(i,m-n) ans += tmp[i];

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N;
  cin >> N;
  int sum = 0; //各桁の和
  int x;
  int Nx = N; //N自体の値を変化させないため
  
  while(1){  //10^8までだから0~7
    x = Nx % 10;  //1桁目の数字を抽出
    sum += x;  //和に一桁目を足す
    Nx /= 10;  //繰り下げでループ
    if (Nx == 0)
      break;
  }
  
  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main(){
    string arr[4] = { "Sunny" , "Cloudy" , "Rainy" , "Sunny" };

    string s;
    cin >> s;

    for ( int i = 0; i < 3; ++i ){
        if ( s == arr[i] ){
            cout << arr[i + 1];
        }
    }
    return  0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), ans = 0, a;
    
    for(int i=0; i<N; i++) {
      a= sc.nextInt() -1;
      ans += a;
    }
    
    System.out.println(ans);
  }    
}


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


void solve(long long N, long long X, std::vector<long long> L){
  long long acc = 0;
  long long count = 0;

  for(long long i = 0; i < N; i++){
    if(acc + L[i] > X) {
      break;
    }

    acc += L[i];
    count++;
  }

  cout << count+1 << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long X;
  scanf("%lld",&X);
  std::vector<long long> L(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&L[i]);
  }
    solve(N, X, std::move(L));
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG

ll dp[3005][3005][5];
  ll m[3005][3005];
int main(){
  int r,c,k;
  cin >> r >> c >> k;
  
  rep(i,r+1){
    rep(j,c+1){
      rep(p,5){
        dp[i][j][p]=0;
        m[i][j]=0;
      }
    }
  }
  rep(i,k){
    int a,b;
    ll x;
    cin >>a>>b>>x;
    m[a][b]=x;
  }
  rep(i,r){
    rep(j,c){
      dp[i+1][j+1][0]=max(dp[i][j+1][4],dp[i+1][j][0]);
      for(int p=1;p<4;p++)
        dp[i+1][j+1][p+1]=max(dp[i][j+1][4]+m[i+1][j+1],max(dp[i+1][j][p]+m[i+1][j+1],dp[i+1][j][p+1]));
    }
  }
  cout << dp[r][c][4] << endl;
}


Measured memory_bytes: 426252
#include<bits/stdc++.h>
#define reg(i,a,b) for(int i=a;i<b;i++)
#define reh(i,a,b) for(int i=a;i>=b;i--)
#define in(x) scanf("%d",&x)
#define fro freopen("D:\\testdata.in", "r", stdin)
#define il inline
using namespace std;
typedef long long ll;
const int mx=1e5+10;
char flag;
stack<char>s;
int ans;
int main() {
	string str;
	cin>>str;
	int len=str.length();

	reg (i,0,len) {
	    if (s.empty()) {//null
	        s.push(str[i]);
	        flag=str[i];
	    }else{
			if (str[i]==flag) {
			    s.push(str[i]);
			} else {
			    s.pop();
			    ans++;
			}
	    }
	}
	printf("%d",ans*2);
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<vector>
using namespace std;
typedef long long ll; 
int main(void)
{
	ll n,k,ans=0;
	scanf("%lld%lld",&n,&k);
	while(n>0)
	{
		n/=k;
		ans++;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define MOD (1000000007l)

using namespace std;

/*
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
*/

long g(long num, long depth) {
  long rec = 0;
  if ((num >> depth) > 0) {
    rec = g(num, depth + 1);
  }
  long current;
  if (depth == 0) {
    long tmp = num % 4;
    if (tmp == 0) current = 0;
    if (tmp == 1) current = 1;
    if (tmp == 2) current = 1;
    if (tmp == 3) current = 0;
  } else {
    long a = 2l << depth;
    long b = 1l << depth;
    long tmp = num % a;
    if (tmp < b) current = 0;
    else {
      tmp -= b;
      tmp %= 2;
      if (tmp == 0) current = 1;
      else current = 0;
    }
  }
  return (rec << 1) + current;
}

int main(void) {
  long A, B;
  cin >> A >> B;
  long tmpA = 0; 
  if (A > 1) tmpA = g(A-1, 0);
  long tmpB = g(B, 0);

/*
  cout << "g(A-1, 0): " << g(A-1, 0) << endl;;
  cout << "g(B, 0): " << g(B, 0) << endl;;

  for (long i = 0; i < 20; i++) {
    cout << "g(" << i << ", 0): " << g(i, 0) << endl;
  }
*/

  cout << (tmpA ^ tmpB) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int n;
string S;
string KIHBR = "KIHBR"; 
int c[4] = {0,3,4,5};
vector<string> V;

int main() {
  INCANT;
  cin >> S;
  n = S.size();
  rep(i, 1<<4) {
    queue<int> que;
    rep(j, 4) {
      int mask = 1 << j;
      if (i & mask) que.push(c[j]);
    }
    string T = "";
    rep(j, 6) {
      if (!que.empty() && j==que.front()) {
        T.push_back('A');
        que.pop();
      }
      if (j<5) T.push_back(KIHBR[j]);
    }
    if (S==T) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	if(n<=599){
		cout << 8;
	}
	else if(n<=799){
		cout << 7;
	}
	else if(n<=999){
		cout << 6;
	}
	else if(n<=1199){
		cout << 5;
	}
	else if(n<=1399){
		cout << 4;
	}
	else if(n<=1599){
		cout << 3;
	}
	else if(n<=1799){
		cout << 2;
	}
	else{
		cout << 1;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3632
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val datX = readLine.split(" ").map(_.toInt).head
    val datFX = datX.toString.split("").filterNot(_ == "").map(_.toInt).sum
    val ans = datX % datFX == 0
    println(if(ans) "Yes" else "No")
  }
}


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

long kaijo(long n){
  long ret=1;
  for(int i=1;i<=n;i++){
    ret*=i;
  }
  return ret;
}

long com(long n,long r){
  long ans=kaijo(n)/kaijo(r)/kaijo(n-r);
  return ans;
}

int main(){
  int N;

  cin>>N;
  vector<long> a(100);

if(N<=9){
  cout<<0<<endl;
  return 0;
}

for(int i=2;i<=N;i++){
  int m=i;
  for(int j=2;j<=sqrt(i);j++){
    while(m%j==0){
      a[j]++;
      m/=j;
    }
  }
  if(m>1) a[m]++;
}
for(int i=1;i<=N;i++){
//cout<<a[i]<<endl;
}
int f4=0,f2=0,f74=0,f24=0,f14=0;
for(int i=0;i<=N;i++){
  if(a[i]>=74) f74++;
  if(a[i]>=24) f24++;
  if(a[i]>=14) f14++;
  if(a[i]>=4) f4++;
  if(a[i]<4&&a[i]>=2) f2++;
}


long ans=0;

// 1*75
ans+=f74;

// 3*25
ans+=f24*(f4+f2-1);

// 5*15
ans+= f14*(f4-1);

// 3*5*5
if(f4>=3) ans+= f4*com(f4-1,2);
ans+= f2*com(f4,2);


cout<<ans<<endl;


}


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

using namespace std;

int main()
{
    int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin>>n;
    cout<<arr[n-1]<<endl;
}


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

int main(){
	string s;
  	cin >> s;
  
  	if(s=="A")cout << 'T'<< endl;
  	if(s=="T")cout << 'A'<< endl;
  	if(s=="C")cout << 'G'<< endl;
   	if(s=="G")cout << 'C'<< endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);

    ll cnt = 0;

    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] < 0)
            cnt++;
    }

    for (ll i = 0; i < n; i++)
    {
        if (a[i] < 0)
            a[i] *= -1;
    }
    
    if (cnt % 2 == 1)
    {
        sort(ALL(a));
        a[0] *= -1;
    }

    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4048
N, K = map(int, input().split())
li = [0]*(K+1)

out = 0
mod = 10**9+7

for i in range(K, 0, -1):
  li[i] = pow(K//i, N, mod) 
  for j in range(i*2, K+1, i):
    li[i] -= li[j]
  out += li[i] * i
print(out%mod)

Measured memory_bytes: 68980
#include<stdio.h>
#include<string.h>
 
int main(){
int i,j,l, k[6],s[6], n[6], n2[6];
char c;
 
 for (i = 0; i<6; i++){
   scanf("%d", &s[i]);
   n[i] = i;
 }
 for (i = 0; i<6; i++){
   scanf("%d", &k[i]);
 }
 for (j = 0; j < 5000; j++){
   if (j%6<3&&j%5==4){
     n2[0] = n[1]; 
     n2[1] = n[5]; 
     n2[3] = n[3]; 
     n2[4] = n[0]; 
     n2[2] = n[2]; 
     n2[5] = n[4];
   }
   else {
     n2[0] = n[3]; 
     n2[1] = n[1]; 
     n2[3] = n[5]; 
     n2[4] = n[4]; 
     n2[2] = n[0]; 
     n2[5] = n[2];
   }
   for (i = 0; i < 6; i++){
     n[i] = n2[i];
   }
   for (l = 0; l < 6; l++){
     if (s[l] != k[n[l]])break;
                  
   }
   if (l == 6){ printf("Yes\n"); break; }
 }
 if (j == 5000)printf("No\n");
 return 0;
}



Measured memory_bytes: 2700
// {{{ include
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
// }}}

using namespace std;

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

inline int in(){int x;scanf("%d",&x);return x;}

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

int M, N;
int caves[1024][1024];
int sieve[MAX_M + 1] = {1, 1};
int X[MAX_M], Y[MAX_M];

void make_spiral(int x, int y, int start=1, int d=0, int len=0)
{
  if (start > M) return;
  int L = len / 2 + 1;
  for (int i = 0; i < L; i++){
    caves[y][x] = start + i;
    X[start + i] = x;
    Y[start + i] = y;
    y += dy[d];
    x += dx[d];
  }
  make_spiral(x, y, start + L, (d + 1) % 4, len + 1);
}

int memo_count[1024][1024];
int memo_max[1024][1024];

P dfs(int x, int y){
  int v = caves[y][x];
  if (v == -1 || v > M) return P(0, 0);
  if (memo_count[y][x] != -1) return P(memo_count[y][x], memo_max[y][x]);
  int p = !sieve[v];
  P ret = max({dfs(x + 1, y + 1), dfs(x, y + 1), dfs(x - 1, y + 1)});
  ret.first += p;
  if (p && ret.first == 1) ret.second = v;
  memo_count[y][x] = ret.first;
  memo_max[y][x] = ret.second;
  return ret;
}

int main()
{
  for (int i = 2; i * i <= MAX_M; i++){
    if (sieve[i]) continue;
    for (int j = i * i; j <= MAX_M; j += i){
      sieve[j] = 1;
    }
  }

  while (M = in(), N = in()){
    memset(caves, -1, sizeof(caves));
    memset(memo_count, -1, sizeof(memo_count));
    memset(memo_max, -1, sizeof(memo_max));
    make_spiral(512, 512);
    P ans = dfs(X[N], Y[N]);
    printf("%d %d\n", ans.first, ans.second);
  }

  return 0;
}

Measured memory_bytes: 25292
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);

int __inf_ignore(){
	int t = inf<int>;
	return t;
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

const string YES = "Yes";
const string NO = "No";
Int N;
vector<Int> A;
vector<Int> B;

void solve(){
	vector<pair<Int,Int> > v;
	REP(i,N)v.push_back({B[i],A[i]});
	sort(ALL(v));
	Int t = 0;
	for(auto &&p:v){
		t += p.second;
		if(t > p.first){
			cout<<NO<<endl;
			return;
		}
	}
	cout<<YES<<endl;
}

//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N;
    A.assign(N,Int());
    B.assign(N,Int());
    for(int i = 0 ; i < N ; i++){
        cin >> A[i];
        cin >> B[i];
    }
	solve();
	return 0;
}

//}}}



Measured memory_bytes: 9584
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int r, D, x2000;
	cin >> r >> D >> x2000;

	int prev = x2000;
	for (int ii = 0; ii < 10; ++ii){
		int ans = r * prev - D;
		cout << ans << endl;
		prev = ans;
	}

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

const int N = 190;
const int ANS = 17;

int dp[ANS][N][N][N];
int wr[N][N];

int n, m;

void relax(int i1, int i2, int j, int to) {
    dp[to][i1][i2][j] = -1;
    {
        int l = i1;
        int r = i2 - 1;
        if (i1 < i2 && wr[i1][i2 - 1] != -1 && wr[i1 + 1][i2] != -1) {
            l = max(l, wr[i1][i2 - 1]);
            r = min(r, wr[i1 + 1][i2]);
        }
        for (int mid = l; mid <= r; mid++) {
            int f = dp[to - 1][i1][mid][j];
            int s = dp[to - 1][mid  + 1][i2][j];
            if (dp[to][i1][i2][j] < min(f, s)) {
                dp[to][i1][i2][j] = min(f, s);
                wr[i1][i2] = mid;
            }
        }
    }
    {
        int len = dp[to - 1][i1][i2][j];
        if (j + len == m) {
            dp[to][i1][i2][j] = max(dp[to][i1][i2][j], len);
        } else {
            dp[to][i1][i2][j] = max(dp[to][i1][i2][j], len + dp[to - 1][i1][i2][j + len]);
        }
    }
}

int ps[N][N];
int a[N][N];

void init() {
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            ps[i][j] = ps[i - 1][j] + ps[i][j - 1] - ps[i - 1][j - 1] + a[i - 1][j - 1];
        }
    }
    auto ok = [&](int i1, int i2, int j, int len) {
        i2++;
        int s = ps[i2][j + len] - ps[i1][j + len] - ps[i2][j] + ps[i1][j];
        int rs = (i2 - i1) * len;
        return s == rs || s == 0;
    };
    for (int i1 = 0; i1 < n; i1++) {
        for (int i2 = i1; i2 < n; i2++) {
            for (int j = 0; j < m; j++) {
                for (int len = 0; j + len <= m; len++) {
                    if (ok(i1, i2, j, len)) dp[0][i1][i2][j] = len;
                }
            }
        }
    }
}

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

    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            char c;
            cin >> c;
            a[i][j] = (c == '#');
            // a[i][j] = rand() & 1;
        }
    }
    init();
    for (int to = 1; to < ANS; to++) {
        for (int j = 0; j < m; j++) {
            for (int i1 = 0; i1 < n; i1++) {
                for (int i2 = i1; i2 < n; i2++) {
                    wr[i1][i2] = -1;
                }
            }
            for (int i1 = n - 1; i1 >= 0; i1--) {
                for (int i2 = i1; i2 < n; i2++) {
                    relax(i1, i2, j, to);
                    if (i1 < i2) assert(wr[i1][i2] != -1);
                }
            }
        }   
    }
    for (int to = 0; to < ANS; to++) {
        if (dp[to][0][n - 1][0] == m) {
            cout << to << endl;
            return 0;
        }
    }
}   


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(a<=b){
    rep(i,b) cout<<a;
  }
  else{
    rep(i,a) cout<<b;
  }
  cout<<endl;
   return 0;
}


Measured memory_bytes: 256
N = int(input())
Mylist = []
ANSlist = []
for i in range(N):
    a, b = map(int, input().split())
    Mylist.append([a,b])

for i in range(N):
    for j in range(i,N):
        length = ((abs(Mylist[i][1]-Mylist[j][1]))**2 + (abs(Mylist[i][0]-Mylist[j][0]))**2)**(1/2)
        ANSlist.append(length)

way = N*(N-1)
anotherway = 2*(N-1)
print(anotherway*sum(ANSlist)/way)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int A[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m>>a>>b;
	cout<<(b==1)<<'\n';
	
	
	return 0;
}


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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> pq;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        pq.push(a);
    }
    for (int i = 0; i < M; i++) {
        int a = pq.top();
        pq.pop();
        pq.push(a / 2);
    }
    long long ans = 0;
    while (!pq.empty()) {
        int a = pq.top();
        pq.pop();
        ans += a;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int n, m;
int bit[3];

// Hc(A,B,C) :=
//  - minCup ??? C -> Hc(A,B,C-{minCup})
//  - minCup ??? B -> Ha(A,B-{minCup},C)+1+Hc(A???(B-{minCup}???C,0,0)
//  - minCup ??? A -> Hc(A-{minCup},B,C)+1+Ha(0,0,(A-{minCup}???B???C))+1+Hc((A-{minCup})???B???C,0,0)
// Ha(A,B,C) == Hc(C,B,A)

int solve(int A, int B, int C) {
  if(A == 0 && B == 0) return 0;
  if(C&1) return solve(A>>1, B>>1, C>>1);
  if(B&1) return solve(C>>1, B>>1, A>>1) + solve((A|B|C)>>1, 0, 0) + 1;
  if(A&1) return solve(A>>1, B>>1, C>>1) + 2*(solve((A|B|C)>>1, 0, 0)+1);
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> n >> m, n) {
    rep(i, 3) {
      bit[i] = 0;
      int k; cin >> k;
      rep(j, k) {
	int c; cin >> c; --c;
	bit[i] |= 1<<c;
      }
    }
    int ans = min(solve(bit[0], bit[1], bit[2]),
		  solve(bit[2], bit[1], bit[0]));
    cout << (ans > m ? -1 : ans) << endl;
  }

  return 0;
}

Measured memory_bytes: 3092
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def isEqual(s, t):
    if s == t or t == '?':
        return True
    return False

def main():
    ans = []
    s = input().strip()
    t = input().strip()
    for i in range(len(s) - len(t)+1):
        k = i
        w = i
        flag = True
        for j in range(len(t)):
            if not isEqual(t[j], s[k]):
                flag = False
                break
            k += 1
        if flag:
            q = list(s)
            q[w:w+(len(t))] = t
            q = ''.join(q)
            q = q.replace('?', 'a')
            ans.append(q)
    if len(ans) == 0:
        print('UNRESTORABLE')
    else:
        print(sorted(ans)[0])

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n,m;
	cin>>n>>m;
	double arr[n];
	double x,y,z;
	x=0;
	for(int a=0;a<n;a++)
	{
		cin>>arr[a];
		x+=arr[a];
	}
	x=x/(4*m);
	y=0;
	for(int a=0;a<n;a++)
	{
		if(arr[a]>=x)
		y++;
	}
	if(y>=m)
	cout<<"Yes";
	else 
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {

	Scanner std = new Scanner(System.in);


	//List<Integer> list = new ArrayList<>();
	//int N = std.nextInt();
	//int K = std.nextInt();
	String S = std.next();

	if(S.charAt(0) == S.charAt(1) || S.charAt(1) == S.charAt(2) || S.charAt(2) == S.charAt(3)) {
		System.out.println("Bad");
	}

	else {
	System.out.println("Good");
	}

	  }


	}




Measured memory_bytes: 23892
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll x=0;
    for(ll i=0;i<n;i++)
      {
          cin>>a[i];
          x=x^a[i];
      }
    
    for(ll i=0;i<n;i++)
     {
         ll t=x^a[i];
         cout<<t<<" ";
     }
    
    
    return 0;
}


Measured memory_bytes: 5124
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int md=998244353;
int N,M,i,inv[1000005],jc[1000005],rjc[1000005],ans;
int C(int n,int m)
{
	return 1ll*jc[n]*rjc[m]%md*rjc[n-m]%md;
}
int main()
{
	inv[1]=1;
	for(i=2;i<=1000000;++i)
		inv[i]=1ll*inv[md%i]*(md-md/i)%md;
	jc[0]=rjc[0]=1;
	for(i=1;i<=1000000;++i)
		jc[i]=1ll*jc[i-1]*i%md,rjc[i]=1ll*rjc[i-1]*inv[i]%md;
	scanf("%d%d",&N,&M);
	if(N<M)
		swap(N,M);
	ans=N;
	for(i=1;i<=M;++i)
		ans=(ans+1ll*inv[2]*jc[N]%md*rjc[i]%md*jc[M]%md*rjc[i]%md*rjc[N+M]%md*jc[2*i]%md*C(N-i+M-i,M-i)%md)%md;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 11904
n = int(input())

a = list(map(lambda x: int(x) - 1, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

res = 0
last = -100
for e in a:
    res += b[e]
    if e - last == 1:
        res += c[last]
    last = e 

print(res)


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
char mp[55][55];
bool vis[55][55];
int h,w;
int hir[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
struct node
{
    int x,y,step;
}s1,s2,s3;
queue<node>Q;
int bfs()
{
    memset(vis,false,sizeof(vis));
    s1.x=0,s1.y=0,s1.step=0;
    Q.push(s1);
    vis[s1.x][s1.y]=true;
    while(!Q.empty())
    {
        s2=Q.front();
        Q.pop();
        if(s2.x==h-1&&s2.y==w-1)
            return s2.step;
        for(int i=0;i<4;i++)
        {
            s3.x=s2.x+hir[i][0];
            s3.y=s2.y+hir[i][1];
            s3.step=s2.step+1;
            if(s3.x<0||s3.y<0||s3.x>=h||s3.y>=w)
                continue;
            if(mp[s3.x][s3.y]=='#')
                continue;
            if(vis[s3.x][s3.y])
                continue;
            Q.push(s3);
            vis[s3.x][s3.y]=true;
        }
    }
    if(Q.empty())
        return -1;
}
int main()
{
    scanf("%d%d",&h,&w);
    int p=0,q,i,j;
    for(int i=0;i<h;i++)
    {
        scanf("%s",mp[i]);
        for(int j=0;j<w;j++)
        {
            if(mp[i][j]=='#')
                p++;
        }
    }
    q=h*w-bfs()-p-1;
    if(bfs()!=-1)
    printf("%d\n",q);
    else
    printf("-1\n");
    return 0;
}

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

using namespace std;
using ll = long long;

ll powmod(ll a, ll x, ll MOD) {
  // calculates a^x mod MOD in logarithmic time.
  ll res = 1;
  while (x > 0) {
    if (x % 2 != 0) {
      res = (res * a) % MOD;
    }
    a = (a * a) % MOD;
    x /= 2;
  }
  return res;
}

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

  string s;
  cin >> s;
  ll n = s.size();

  // 左からi+1文字目以降の数字をtiとし、
  // 各tiを調べて2019で割った時の余りが合計でいくつあるかを記録する
  map<int, ll> m;

  int t = 0;
  m[0]++;
  for (ll i = n - 1; i >= 0; i--) {
    t += powmod(10, n - 1 - i, 2019) * (s[i] - '0');
    t %= 2019;
    m[t]++;
  }

  ll ans = 0;
  for (auto [k, v] : m) {
    ans += (v * (v - 1)) / 2;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3788
#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>
#include <stack>
#include <set>
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)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
ll nCr(ll n, ll r){
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
  ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
  return ret;
}

int main(void){
  int n;cin>>n;
  cout<<n*n*n<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int max = 0;
		String text = sc.next();
		for (int i = text.length() - 1; i > 0; i-- ) {
			if (i % 2 != 0) {
				continue;
			} else {
				String a = text.substring(0, i / 2);
				String b = text.substring(i / 2, i);
				if (a.equals(b)) {
					max = i;
					break;
				}
			}
		}
		
		System.out.println(max);
	}

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

signed main(void){
    int N,a;
    vector<int> A,B;
    cin >> N;
    REP(i,N){
        cin >> a;
        A.push_back(a);
        cin >> a;
        B.push_back(a);
    }
    
    vector<int> C=A,D=B;
    sort(C.begin(),C.end());
    sort(D.begin(),D.end());
    
    int m,M;
    if(N%2==1){
        m=C[N/2];
        M=D[N/2];
    }else{
        m=C[(N-1)/2]+C[N/2];
        M=D[(N-1)/2]+D[N/2];
    }
    //cout << m MM M;
    int Ans = M-m+1;
    cout << Ans << endl;
    
    
    return 0;
}




Measured memory_bytes: 9480