akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>
// #define range(x1,y1,x2,y2) (sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)))

double range(double x1, double y1, double x2, double y2)
{
    double ans;
    ans = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    return ans;
}

int main(void)
{
    double x1, x2, y1, y2;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    printf("%f\n", range(x1, y1, x2, y2));
    // printf("%f\n", sqrt( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) ) );
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int MOD=1000000007;
  int n;
  cin>>n;
  int t[n],a[n],check[n],pos_t[n],pos_a[n];
  for(int i=0;i<n;i++){
    cin>>t[i];
    check[i]=0;
  }
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  check[0]=1;
  pos_t[0]=t[0];
  for(int i=1;i<n;i++){
    if(t[i-1]<t[i]){
      check[i]=1;
    }
    pos_t[i]=t[i];
  }
  check[n-1]+=2;
  pos_a[n-1]=a[n-1];
  for(int i=n-2;i>=0;i--){
    if(a[i+1]<a[i]){
      check[i]+=2;
    }
    pos_a[i]=a[i];
  }
  ll ans=1;
  for(int i=0;i<n;i++){
    if(check[i]==0){
      ans=mod(ans*min(pos_a[i],pos_t[i]),MOD);
    }
    else if(check[i]==1){
      if(pos_t[i]<=pos_a[i])continue;
      else ans=0;
    }
    else if(check[i]==2){
      if(pos_a[i]<=pos_t[i])continue;
      else ans=0;
    }
    else{
      if(pos_a[i]==pos_t[i])continue;
      else ans=0;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2176
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, s, k, sum, ans, a[100000];
bool f;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n)
		cin >> a[i];
	sort(a, a + n);
	Mfor(i, n) {
		if (i % 2 == 1)
			ans += a[i];
		else ans -= a[i];
	}
	cout << abs(ans) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int A, B, Q;
  cin >> A >> B >> Q;
  vector<i64> as(A+2), bs(B+2);
  F0R(i, A) { cin >> as[i+1]; }
  F0R(i, B) { cin >> bs[i+1]; }
  as[0] = bs[0] = -1e12;
  as.back() = bs.back() = 1e12;
  F0R(i, Q) {
    i64 x; cin >> x;
    auto ar = lower_bound(rng(as), x), br = lower_bound(rng(bs), x);
    auto al = ar - 1, bl = br - 1;
    i64 res = min(x - min(*al, *bl), max(*ar, *br) - x);
    i64 l = *br - x, r = x - *al;
    chmin(res, min(l, r)+l+r);
    l = *ar - x; r = x - *bl;
    chmin(res, min(l, r) + l + r);
    cout << res << newl;
  }
}
#endif


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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(auto i##0_to = (t), i = decltype(t)(f); i <= i##0_to; i++)
#define uptil(f, t, i)   for(auto i##0_to = (t), i = decltype(t)(f); i <  i##0_to; i++)
#define downto(f, t, i)  for(auto i##0_to = decltype(f)(t), i = (f); i >= i##0_to; i--)
#define downtil(f, t, i) for(auto i##0_to = decltype(f)(t), i = (f); i >  i##0_to; i--)
using LD = long double;
#define double LD
#define long long long
#define LL long
#define int long
template<class T> using vec = vector<T>;
using VB = vec<bool>;   using WB = vec<VB>;
using VC = vec<char>;   using WC = vec<VC>;
using VI = vec<int>;    using WI = vec<VI>;
using VD = vec<double>; using WD = vec<VD>;
using VS = vec<string>; using WS = vec<VS>;
using PI = pair<int, int>;  using VPI = vec<PI>; using WPI = vec<VPI>;
using MI = map<int, int>;   using VMI = vec<MI>;

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define _GLIBCXX_DEBUG
    #define _LIBCPP_DEBUG 2
    #define _LIBCPP_DEBUG2 2
    #define ln << endl
    #define dd(x) cerr << #x << " = " << (x) << ", "
    #define ddd(x) cerr << #x << " = " << (x) ln
#else
    #define debug false
    #define ln << '\n'
    #define dd(x) cerr
    #define ddd(x) cerr
#endif
#define tb << '\t'
#define sp << ' '
#define db dd
#define dbg ddd

void solve();

signed main() {
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(20);

    solve();

    return 0;
}

void solve() {
// N N(A)
/* <foxy.memo-area> */
int N;cin>>N;VI A(N);times(N,Ri_0){cin>>A[Ri_0];}
/* </foxy.memo-area> */

    int p = 0, q = 0, r = 0, s = 0;
    int pqi = 0, rsi = 0;
    times(N, i) s += A[i];

    int ans = INT_MAX;
    times(N, qri) {
        uptil(pqi, qri, j) {
            int pp = p + A[j];
            int qq = q - A[j];
            if(abs(qq - pp) > abs(q - p)) {
                break;
            }
            p = pp;
            q = qq;
            pqi = j + 1;
        }
        uptil(rsi, N, j) {
            int rr = r + A[j];
            int ss = s - A[j];
            if(abs(ss - rr) > abs(s - r)) {
                break;
            }
            r = rr;
            s = ss;
            rsi = j + 1;
        }
        ans = min(ans, max({p, q, r, s}) - min({p, q, r, s}));
        cerr << pqi sp << qri sp << rsi << ": " << p sp << q sp << r sp << s tb << ans ln;

        q += A[qri];
        r -= A[qri];
    }

    cout << ans ln;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
struct NUM{
	int P,Q;
}num[5001];
bool cmp(const NUM &A,const NUM &B)
{
	if(A.P==B.P)
	{
		return A.Q<B.Q;
	}
	return A.P<B.P;
}
int n,x[51],y[51],cnt,p,q,now,ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",&x[i],&y[i]);
		for(int j=1;j<i;++j)
		{
			++cnt;
			num[cnt].P=x[i]-x[j];
			num[cnt].Q=y[i]-y[j];
			++cnt;
			num[cnt].P=x[j]-x[i];
			num[cnt].Q=y[j]-y[i];
		}
	}
	sort(num+1,num+1+cnt,cmp);
	for(int i=1;i<=cnt;++i)
	{
		if(q!=num[i].Q||p!=num[i].P)
		{
			q=num[i].Q;
			p=num[i].P;
			ans=max(now,ans);
			now=0;
		}
		++now;
	}
	ans=max(now,ans);
	printf("%d",n-ans);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace ALDS1_9C_2{
    public class Program{
        public static void Main(string[] args){
            var pq = new PriorityQueue<int>();
            var sb = new StringBuilder();

            while(true){
                var query = Console.ReadLine().Split(' ');
                if(query[0] == "insert") pq.Enqueue(-int.Parse(query[1]));
                if(query[0] == "extract") sb.AppendLine((-pq.Dequeue()).ToString());
                if(query[0] == "end") break;
            }

            Console.Write(sb);
            //---------------------------------
        }
    }

    public class PriorityQueue<T> : IEnumerable<T> where T : IComparable{
        private readonly List<T> _list = new List<T>();

        public int Count{
            get { return _list.Count; }
        }

        IEnumerator<T> IEnumerable<T>.GetEnumerator(){
            return _list.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator(){
            return _list.GetEnumerator();
        }

        public void Clear(){
            _list.Clear();
        }

        public bool Contains(T value){
            return _list.Contains(value);
        }

        public T Peek(){
            return _list[0];
        }

        public void Enqueue(T value){
            _list.Add(value);
            PushHeap();
        }

        public T Dequeue(){
            var ret = _list[0];
            _list[0] = _list[_list.Count - 1];
            _list.RemoveAt(_list.Count - 1);
            PopHeap();
            return ret;
        }

        private void PushHeap(){
            var i = _list.Count - 1;
            while(i != 0){
                var p = (i - 1) / 2;
                if(_list[i].CompareTo(_list[p]) > 0) return;

                SwapIndex(i, i = p);
            }
        }

        private void PopHeap(){
            var i = 0;
            while(true){
                var l = 2 * i + 1;
                var r = l + 1;

                var maxi = i;
                if(l < _list.Count && _list[maxi].CompareTo(_list[l]) > 0) maxi = l;
                if(r < _list.Count && _list[maxi].CompareTo(_list[r]) > 0) maxi = r;
                if(maxi == i) return;

                SwapIndex(i, i = maxi);
            }
        }

        private void SwapIndex(int left, int right){
            var tmp = _list[left];
            _list[left] = _list[right];
            _list[right] = tmp;
        }
    }
}

Measured memory_bytes: 29948
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.1415926535

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;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

int main(){
    int s, w;
    cin >> s >> w;
    if (w>=s)
        cout << "unsafe" << endl;
    else
    {
        cout << "safe" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <queue>
using namespace std;
struct rmq{
    int n;
    int l;
    int r;
};
struct two{
    int n;
    int t;
};
rmq b[1000000];
two a[1000000];
int min(int n,int m){
    if(n>m)return m;
    return n;
}
void init(int l,int r,int now){
    b[now].l=l;
    b[now].r=r;
    b[now].n=2147483647;
    if(r==l){
        a[r].t=a[l].t=now;
        return;
    }
    int mid=(l+r)/2;
    init(l,mid,now*2);
    init(mid+1,r,now*2+1);
}
void maintain(int now){
    int temp=b[now].n;
    if(b[now].r-b[now].l<2)b[now].n=min(a[b[now].l].n,a[b[now].r].n);
    else b[now].n=min(b[now*2].n,b[now*2+1].n);
    if(temp!=b[now].n)maintain(now/2);
}
int dp(int now,int l,int r){
    if(b[now].l>=l&&b[now].r<=r)return b[now].n;
    else if(b[now].l>r||b[now].r<l){
        return -1;
    }
    int a,b;
    a=dp(now*2,l,r);
    b=dp(now*2+1,l,r);
    if(a<0&&b<0)return -1;
    if(a<0)return b;
    if(b<0)return a;
    return min(dp(now*2,l,r),dp(now*2+1,l,r));
}
int main(){
    int n,q,temp,x,y;
    scanf("%d%d",&n,&q);
    for(int i=0;i<n;i++)a[i].n=2147483647;
    init(0,n-1,1);
    for(int i=0;i<q;i++){
        scanf("%d%d%d",&temp,&x,&y);
        if(temp==0){
            a[x].n=y;
            maintain(a[x].t);
        }
        else{
            printf("%d\n",dp(1,x,y));
        }
    }
}

Measured memory_bytes: 6616
#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 input(array) repi(array##_itr, array) { cin >> *(array##_itr); }
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((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;
	cin >> n;
	vector<string> s(n);
	input(s);
	ll ans = 0;
	map<char, int> dis;
	rep(i, n) { dis[s[i][0]]++; }
	vector<char> ter;
	ter.push_back('M');
	ter.push_back('A');
	ter.push_back('R');
	ter.push_back('C');
	ter.push_back('H');
	rep(i, 5) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				ans +=(ll) dis[ter[i]] * dis[ter[j]] * dis[ter[k]];
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6376
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;


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

	ll n;
	cin >> n;
	vector<ll> a(n + 1);
	rep(i, n+1)
	{
		cin >> a[i];
	}


	if (n == 0)
	{
		if (a[0] == 1)
		{
			cout << 1 << endl;
			ret;
		}
		else
		{
			cout << -1 << endl;
			ret;
		}
	}

	if (a[0] != 0)
	{
		cout << -1 << endl;
		ret;
	}

	vector<ll> v(n + 1);
	v[n] = a[n];
	for (ll i = n - 1; i > 0; i--)
	{
		v[i] = v[i + 1] + a[i];
	}
	v[0] = 1;

	ll ans = 0;
	
	for (ll i = 0; i < n; i++)
	{
		v[i + 1] = min(v[i + 1], (v[i]-a[i]) * 2);

		if (v[i + 1] < 1)
		{
			cout << -1 << endl;
			ret;
		}
	}

	for (ll i = n; i > 0; i--)
	{
		if (v[i] < a[i])
		{
			cout << -1 << endl;
			ret;
		}
		if ((v[i - 1] - a[i - 1]) * 2 < v[i])
		{
			cout << -1 << endl;
			ret;
		}
	}
	
	rep(i, n + 1)
	{
		ans += v[i];
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;


vector<int>cost,value;
int h , n;
int dp[10001][1002]; 

int recur(int ind,int w) {
    if(ind==0&&w>0)return 1e9;
    else if(ind>=0&&w<=0)return 0;

    if(dp[w][ind]!=-1)return dp[w][ind];

    int first=recur(ind,w-cost[ind-1])+value[ind-1];
    int second=recur(ind-1,w);
    return dp[w][ind]=min(first,second);
}

void show(int a,int b){
    for(int i=0;i<=a;i++) {
        for(int j=0;j<=b;++j) {
            cout<<dp[i][j]<<"  ";
        }
        cout<<endl;
    }
}

void solve(){
    cin>>h>>n;
    cost.resize(n+1);
    value.resize(n+1);
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++) {
        cin>>cost[i]>>value[i];
    }
    cout<<recur(n,h)<<endl;
}

ll res[200005];

void sec() {
    ll n,d,a;
    cin>>n>>d>>a;
    vector<pair<ll,ll>>arr(n);
    for(int i=0;i<n;i++) {
        cin>>arr[i].first>>arr[i].second;
    }
    sort(all(arr));
    int end=0;
    ll ans=0;
    for(int start=0;start<n;start++) {
        while(end<n&&arr[end].first<=arr[start].first+2*d){
            end++;
        }
        ll req=max((arr[start].second-res[start]*a+a-1)/a,0LL); 
        ans+=req;
        res[start]+=req;
        res[end]-=req;
        res[start+1]+=res[start];
    }
    cout<<ans;
}



int main(){
    fastio
    int test=1;
    while(test--)
        sec();
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;

signed main() {
    int N;
    cin >> N;
    if(N % 2 == 1) {
        cout << 0 << endl;
    }
    else {
        N = N / 2;
        int ret = 0;
        int cnt = 5;
        while(N >= cnt) {
            ret += N / cnt;
            cnt *= 5;
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
        var S = Console.ReadLine();

        var result = 0;
        switch (S)
        {
            case "SSS":
                result = 0;
                break;
            case "SSR":
            case "SRS":
            case "RSS":
            case "RSR":
                result = 1;
                break;
            case "SRR":
            case "RRS":
                result = 2;
                break;
            case "RRR":
                result = 3;
                break;
        }
        Console.WriteLine(result);
    }
}


Measured memory_bytes: 25836
#include <bits/stdc++.h>
using namespace std;
const int N=2e5;
typedef long long ll;

ll h[N];
ll n,a,b;
bool check(ll x)
{
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(h[i]-x*b<=0) continue;
        sum+=(h[i]-x*b)/(a-b);
        if((h[i]-x*b)%(a-b)!=0) sum++;
    }
    if(sum>x) return false;
    return true;
}
int main() {

    cin>>n>>a>>b;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    ll ans=INT_MAX;
    ll l=0,r=1e9;
    while(r>=l){
        ll mid=l+r>>1;
        if(check(mid)){
            ans=min(ans,mid);
            r=mid-1;
        }
        else l=mid+1;
    }
    cout<<ans<<endl;
    return 0;
}




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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n >> x;
    vector<int> arr(n);
    for(int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    sort(arr.begin(), arr.end());
    int res = 0;
    for(int i = 0; i < n; ++i) {
        if(x >= arr[i]) {
            if(i == n-1) {
                if(x == arr[i]) {
                    res++;
                }
            } else {
                res++;
            }
            x -= arr[i];
        }
    }
    cout << res << '\n';
    return 0;
}










































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

using namespace std;

int main() {

    string s;
    cin >> s;

    int sum = 0;

    for (int i = 0; i < (int)s.size(); ++i) {
        sum += (s[i] - '0');
    }

    if(sum % 9 == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

ll X, Y, A, B, C, Ans = 0;
int main(){
cin >> X >> Y >> A >> B >> C;

priority_queue<ll> R;
priority_queue<ll> G;
priority_queue<ll> T;

rep(i, 0, A){
  
  ll x;cin >> x;

  R.push(x);

}

rep(i, 0, B){
  
  ll x;cin >> x;

  G.push(x);

}

rep(i, 0, C){
  
  ll x;cin >> x;

  T.push(x);

}

rep(i, 0, X){

  T.push(R.top());R.pop();

}

rep(i, 0, Y){

  T.push(G.top());G.pop();

}

rep(i, 0, X + Y){

  Ans += T.top();T.pop();
 
}

cout << Ans;

}

Measured memory_bytes: 8936
#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 ALL(a)  (a).begin(),(a).end()
#define LL long long



int main(){
  string s;
  cin>>s;
  int size = s.size();
  LL ret=0,len=0,max=0;
  char state = '<';
  REP(i,size){
    //cerr<<ret<<" "<<len<<" "<<max<<endl;
    if(state == '<' && s[i] == '<'){
      ret+=1+len;
      len+=1;
      max+=1;
    }else if(state == '>' && s[i] == '<'){
      ret+=1;
      len=1;
      max=0;
    }else if(state == '<' && s[i] == '>'){
      max=len;
      len=1;
      if(max < len)ret+=1;
    }else if(state == '>' && s[i] == '>'){
      ret+=len;
      len+=1;
      if(max < len)ret+=1;
    }
    state = s[i];
  }
  cout<<ret<<endl;
  return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    int n = st.size();

    vi ans(n, 0);
    int cnt = 0;
    rep(i, n) {
        if (st[i] == 'R') {
            cnt++;
        } else {
            ans[i-1] += cnt/2 + cnt%2;
            ans[i] += cnt/2;
            cnt = 0;
        }
    }

    cnt = 0;
    for (int i = n-1; i >= 0; i--) {
        if (st[i] == 'L') {
            cnt++;
        } else {
            ans[i+1] += cnt/2 + cnt%2;
            ans[i] += cnt/2;
            cnt = 0;
        }
    }

    rep(i, n) {
        std::cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}


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

int main()
{

        int N;
        cin >> N;

        int H[N];
        for (int i = 0; i < N; ++i) {
                cin >> H[i];
        }


        int cnt = 0;
        while (1) {

                bool allZero = true;
                bool touch = false;

                for (int i = 0; i < N; ++i) {

                        if (H[i] != 0 && touch == false) {
                                touch = true;
                                H[i]--;
                                cnt++;
                                allZero = false;
                        }
                        else if (H[i] != 0) {
                                H[i]--;
                                allZero = false;
                        }
                        else if (touch) {
                                touch = false;
                        }
                }
                if (allZero) {
                        break;
                }


        }

        cout << cnt << endl;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int a,b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b));
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <memory.h>
using namespace std;
struct f
{
   int x,y;
};
f frilist[10000];
int main()
{
   int n,m,frifri[10000]={0},myfri[10000]={0};
   int myfrisum,myfrifrisum,ans;
   while(cin>>n>>m,n,m){
   	ans=0; myfrisum=0; myfrifrisum=0;  
  memset(frifri,0,sizeof(frifri));
   memset(myfri,0,sizeof(myfri));
   for(int i=1;i<=m;i++){
    cin>>frilist[i].x>>frilist[i].y;
    if(frilist[i].x==1) {myfri[frilist[i].y]=1;myfrisum++;}
   }
   for(int j=1;j<=n;j++){
   	for(int i=1;i<=m;i++){
   		if((myfri[j]==1)&&(frilist[i].x==j)&&(frilist[i].y!=1)) {frifri[frilist[i].y]=1;}
   		else if((myfri[j]==1)&&(frilist[i].y==j)&&(frilist[i].x!=1)) {frifri[frilist[i].x]=1;}
   	}
   }
   for(int k=1;k<=n;k++){
   	   if(frifri[k]==myfri[k]) {frifri[k]=0;}
   }
   for(int k=1;k<=n;k++){
      myfrifrisum+=frifri[k];
   }
   ans=myfrifrisum+myfrisum;
   cout<<ans<<endl;
 }
   return 0;
}

Measured memory_bytes: 1324
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{template<class U>static auto c(U v)->decltype(v.begin(),v.end(),std::true_type());static std::false_type c(...);public:const static bool value=decltype(c(std::declval<T>()))::value;};
template<class T,typename enable_if<iterable<T>::value, nullptr_t>::type=nullptr>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n,c;
    cin>>n>>c;

    vvi cost(c,vi(c));
    cin>>cost;

    vvi cnt(3, vi(c));
    REP(i,n)REP(j,n){
        int d;
        cin>>d;
        cnt[(i+j)%3][d-1]++;
    }

    int mi=INF;
    REP(x,c){
        int a=0;
        REP(i,c)if(i!=x)a+=cost[i][x]*cnt[0][i];
        REP(y,c){
            if(x==y)continue;
            int b=a;
            REP(i,c)if(i!=y)b+=cost[i][y]*cnt[1][i];
            REP(z,c){
                if(x==z || y==z)continue;
                int d=b;
                REP(i,c)if(i!=z)d+=cost[i][z]*cnt[2][i];
                chmin(mi, d);
            }
        }
    }
    cout<<mi<<endl;
}


Measured memory_bytes: 256
s = input()
st1=[]
st2=[]
st3=[]
total=0
for i in range(len(s)):
	c=s[i]
	if c=='\\':
		st1.append(i)
	elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1][0]>j:
				tmp+=st2[-1][1]
				st2.pop()
			st2.append((j,a+tmp))
			
print(total)
n = len(st2)
print(n,end='')
for i in range(n):
	print(' '+str(st2[i][1]),end='')
print()



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

// struct str{
//   int no;
//   string shi_year;
//   int ken;
//   int shi_no;
// };

// bool sort_no(const str &a,const str &b){
//   return a.no < b.no;
// }

// bool sort_shi(const str &a,const str &b){
//   return a.shi_year < b.shi_year;
// }

int main()
{
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>> v[N];
  string ans[M];
  rep(i,M){
    int p,y;
    cin >> p >> y;
    p--;
    v[p].push_back(pair<int,int> (y,i));
  }

  rep(i,N) sort(v[i].begin(),v[i].end());

  rep(i,N){
    rep(j,v[i].size()){
      std::stringstream ss;
      ss << setw(6) << setfill('0') << i+1 << setw(6) << setfill('0')<< j+1;
      ans[v[i][j].second] = ss.str();
    }
  }
  rep(i,M){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

namespace std {
	#define u(x, a, b) for(ll x = a; x < b; x++)
	#define d(x, a, b) for(ll x = a; x > b; x--)
}

typedef long long ll;
typedef long double ld;

#define MAXI 100010
#define MOD 1000000007

int main(){
	ll n;
	cin >> n;
	
	string s;
	ll cnt[4] = {0};
	u(one, 0, n){
		cin >> s;
		if(s=="AC"){cnt[0]++;}
		else if(s=="WA"){cnt[1]++;}
		else if(s=="TLE"){cnt[2]++;}
		else{cnt[3]++;}
	}
	
	cout << "AC x " << cnt[0] << endl << "WA x " << cnt[1] << endl << "TLE x " << cnt[2] << endl << "RE x " << cnt[3];
}


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

int change(string s,char c,int k){
	int ans=0;
	char g;
	if(c=='L'){
		g='R';
	}
	else{
		g='L';
	}
	
	for(int i=0;i<s.size();i++){
		if(s[i]==c){		
		while(true){
			if(k<=0||i>=s.size()){
				break;
			}
		
		if(s[i]!=c){
			k--;
			break;
		}
		
			s[i]=g;
			i++;
		}
		
	}
	}
	for(int i=0;i<s.size()-1;i++){
		if(s[i]==s[i+1]){
			ans++;
		}
	}
	
	return ans;
}
int main() {
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int out=-1e5;
	out=max(out,change(s,'R',k));
	out=max(out,change(s,'L',k));
	
cout<<out;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  int s[M],c[M];
  REP(i,M) cin >> s[i] >> c[i];
  int keta = 0;
  int ans = 999999;
  REP(now,1000){
    keta = 0;
    int tmp = now;
    bool flg = true;
    while(tmp > 0){
      tmp/=10;
      keta++;
    }
    if(now == 0) keta = 1;
    if(keta!=N) continue;
    int cnt[keta];
    tmp=now;
    REP(i,3){
      cnt[i]=tmp%10;
      tmp/=10;
    }
    REP(i,M){
      if(cnt[N-s[i]]!=c[i]){
        flg = false;
        continue;
      } 
    }
    if(flg) ans = min(now,ans);
  }
  if(ans == 999999) cout << "-1";
  else cout << ans;

  return 0;
}

Measured memory_bytes: 256
def func(a, b, cnt):
	if(a == b):
		cnt += 1
		return cnt
	cnt = 0
	return cnt

n = int(input())
cnt = 0
for i in range(n):
	a, b= list(map(int, input().strip().split()))
	cnt = func(a, b, cnt)
	if(cnt == 3):
		break

if(cnt >= 3):
	print('Yes')
else:
	print('No')

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


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

    if (b == "A") {
        cout << "T" << endl;
    }else if (b == "T") {
        cout << "A" << endl;
    }else if (b == "C") {
        cout << "G" << endl;
    }else if (b == "G") {
        cout << "C" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;

int n,m,cnt;
int val[N],fa[N],fir[N],win[N],arr[N<<1],nex[N<<1];

inline int read()
 {
 	 char c=getchar(); int x=0;
 	 for (;c<'0'||c>'9';) c=getchar();
 	 for (;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
 	 return x;
 }

inline void add(int x,int y)
 {
 	 cnt++;
 	 nex[cnt]=fir[x];
 	 fir[x]=cnt;
 	 arr[cnt]=y;
 }

void dfs1(int x)
 {
 	 win[x]=0;
 	 for (int i=fir[x];i;i=nex[i])
 	  if (arr[i]!=fa[x])
	  {
	  	 fa[arr[i]]=x;
 	  	 dfs1(arr[i]);
 	  	 if (!win[arr[i]]&&val[x]>val[arr[i]]) win[x]=1;
	  }
 }

void dfs2(int x)
 {
 	 if (fa[x]&&(!win[fa[x]])&&val[x]>val[fa[x]]) win[x]=1;
 	 for (int i=fir[x];i;i=nex[i])
 	  if (arr[i]!=fa[x])
 	   {
 		 dfs2(arr[i]);
	   }
 }

int main()
 {
 	 n=read();
 	 for (int i=1;i<=n;i++) val[i]=read();
	 for (int i=1;i<n;i++)
	  {
	  	 int x=read(),y=read();
	  	 add(x,y); add(y,x);
	  }
	 dfs1(1);  dfs2(1);
	 for (int i=1;i<=n;i++) 
	  if (win[i]) printf("%d ",i);
	 return 0;
 }

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  ll c=0;
  ll h,n;cin>>h>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll sum = 0;
  rep(i,n)sum+=a[i];
  cout<<(sum>=h ? "Yes" : "No");
  
  return 0;
}

Measured memory_bytes: 1024
N = gets.to_i
as = gets.split.map(&:to_f)
avg = as.inject(:+) / N

ans = -1
dist = 10 ** 20
as.each_with_index do |a,i |
  if dist > (a - avg).abs
    ans = i
    dist = (a - avg).abs
  end
end
puts ans

Measured memory_bytes: 1788
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int num1,num2,total = 0;
        num1 = N / 2;
        num2 = N % 2;
        total = num1 + num2;
        System.out.println(total);
	}
}

Measured memory_bytes: 35588
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n) {
    int now = a[i];
    if((now % 2) == 0) {
      if((now % 3) == 0 || (now % 5) == 0) {
        continue;
      } else {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }

  cout << "APPROVED" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long divc = b/c - (a-1)/c;
        long divd = b/d - (a-1)/d;
        long lcmcd = lcm(c,d);
        long divcd = b/lcmcd - (a-1)/lcmcd;
        System.out.println((b-a+1) - divc - divd + divcd);
    }
    
    private static long gcd(long a, long b){
        while (b > 0)
        {
            long temp = b;
            b = a % b; 
            a = temp;
        }
        return a;
    }

    private static long lcm(long a, long b){
        return a * (b / gcd(a, b));
    }
}


Measured memory_bytes: 25044
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>

using namespace std;

int main() {
	int n, a, b;

	cin >> n >> a >> b;

	if (n*a < b) {
		cout << n*a << endl;
	}
	else {
		cout << b << 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 mod = 1000000007;

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

    // for prime mod
    modint inv() const { return pow(mod-2);}
    modint& operator/=(const modint a) { return *this *= a.inv();}
    modint operator/(const modint a) const { return modint(*this) /= a;}
};
template<int Modulus>
istream& operator>>(istream& is, modint<Modulus>& a) { return is >> a.x;}
template<int Modulus>
ostream& operator<<(ostream& os, const modint<Modulus>& a) { return os << a.x;}

int main(){
    int n;
    cin >> n;
    using mint = modint<mod>;
    mint a = 10, b = 9, c = 8;
    a = a.pow(n);
    b = b.pow(n) * 2;
    c = c.pow(n);
    cout << mint(a - b + c).x;
}

Measured memory_bytes: 3668
// ABC 161-A
// 2020.4.4 bal4u

#include <stdio.h>

int main()
{
	int A, B, C, t;

	scanf("%d%d%d", &A, &B, &C);
	t = A, A = B, B = t;
	t = A, A = C, C = t;
	printf("%d %d %d\n", A, B, C);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=n-1;i>=0;i-=2)
		printf("%d ",a[i]);
	if(n%2==0)
		for(int i=0;i<n-1;i+=2)
			printf("%d ",a[i]);
	else 
		for(int i=1;i<n-1;i+=2)
				printf("%d ",a[i]);
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    string s;
    cin>>s;
    REP(i,(int)s.size()){
        if(i%2==0){
            cout<<s[i];

        }
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 576
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
vector<int> transform(int N, vector<int> A, vector<int> perm) {
	vector<int> res(N);
	for (int i = 0; i < N; ++i) {
		res[i] = A[perm[i]];
	}
	return res;
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int P, Q, M;
	cin >> P >> Q >> M;
	vector<int> A(P), B(Q);
	for (int i = 0; i < P; ++i) {
		cin >> A[i];
	}
	for (int i = 0; i < Q; ++i) {
		cin >> B[i];
	}
	vector<int> X(M), Y(M), C(M);
	for (int i = 0; i < M; ++i) {
		cin >> X[i] >> Y[i] >> C[i];
		--X[i], --Y[i];
	}
	vector<int> pa(P), pb(Q);
	for (int i = 0; i < P; ++i) {
		pa[i] = i;
	}
	for (int i = 0; i < Q; ++i) {
		pb[i] = i;
	}
	sort(pa.begin(), pa.end(), [&](int i, int j) { return A[i] < A[j]; });
	sort(pb.begin(), pb.end(), [&](int i, int j) { return B[i] < B[j]; });
	vector<int> ipa(P), ipb(Q);
	for (int i = 0; i < P; ++i) {
		ipa[pa[i]] = i;
	}
	for (int i = 0; i < Q; ++i) {
		ipb[pb[i]] = i;
	}
	A = transform(P, A, pa);
	B = transform(Q, B, pb);
	for (int i = 0; i < M; ++i) {
		X[i] = ipa[X[i]];
		Y[i] = ipb[Y[i]];
	}
	vector<vector<int> > G(P);
	for (int i = 0; i < M; ++i) {
		G[X[i]].push_back(Y[i]);
	}
	int ans = inf;
	for (int i = 0; i < P; ++i) {
		int ptr = G[i].size();
		for (int j = 0; j < G[i].size(); ++j) {
			if (G[i][j] != j) {
				ptr = j;
				break;
			}
		}
		if (ptr != Q) {
			ans = min(ans, A[i] + B[ptr]);
		}
	}
	for (int i = 0; i < M; ++i) {
		ans = min(ans, A[X[i]] + B[Y[i]] - C[i]);
	}
	cout << ans << endl;
	return 0;
}

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

#define lli long long int
#define pb push_back

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

    if (a + b + c >= 22) cout << "bust" << endl ;
    else cout << "win" << endl ;
       
    return 0;  
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef ONLINE_JUDGE
#include <custom/prettyprint.hpp>
#endif
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define pow10(n) stoll("1"+string(n,'0'))
#define dbg(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9+7; //998244353
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;
const ld PI = acos((ld)-1);
const int dx[8] = {1,0,-1,0,1,1,-1,-1}, dy[8] = {0,1,0,-1,-1,1,1,-1};
mt19937_64 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll n) { return uniform_int_distribution<ll>(0, n)(rng); }
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

void setIO(const string& s) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    int n; cin >> n;
    ll ans = 0;
    int mx = 0;
    for(int i=0, a; i<n; ++i) {
        cin >> a;
        mx = max(mx, a);
        ans += mx - a;
    }
    cout << ans << '\n';
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    llint N;
    cin >> N;
    vector<llint> a(N);
    REP(i, N) cin >> a[i];
 
    bool f = true;
    llint sum = 0;
    REP(i, N) sum += (llint)a[i];
    llint divisor = N*(N+1)/2;
    if(sum%divisor != 0) f = false;
    llint mv = sum/divisor;
    vector<llint> d(N);
    d[0] = a[0] - a[N-1] - mv;
    REP(i, N-1) d[i+1] = a[i+1] - a[i] - mv;
    REP(i, N){
        if(d[i] > 0 || d[i] % N != 0) f = false;
    }
    puts(f ? "YES" : "NO");

    return 0;
}

Measured memory_bytes: 1792