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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    list<int> lst;
    auto itr = lst.end();
    int x, d;
    for (int i = 0; i < q; ++i) {
        int query;
        cin >> query;
        switch (query) {
            case 0:
                cin >> x;
                itr = lst.insert(itr, x);
                break;
            case 1:
                cin >> d;
                for (int i = 0; i < abs(d); ++i) (d > 0 ? itr++ : itr--);
                break;
            case 2:
                itr = lst.erase(itr);
                break;
        }
    }
    for (auto a : lst) cout << a << endl;
    return 0;
}




Measured memory_bytes: 18672
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
 cin>>s>>t;
  if(s[0]==t[2] && s[1]==t[1] && s[2]==t[0])
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  
  return 0;
}

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

int main() {
	int a,b,c;
  	cin>>a>>b>>c;
  	if(b-a==c-b) cout<<"YES"<<endl;
  	else cout<<"NO"<<endl;
}

Measured memory_bytes: 3628
/**Bismillahir Rahmanir Raheem
    Author:Refat(BSMRSTU)**/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 1e5 + 5;
const int M = 1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);

    int test=1;
    ll n,sum=0;
    ///scanf("%d",&test);
    for(int cs=1; cs<=test; cs++) {
        scanf("%lld",&n);
        for(int i=1; i<=n; i++) {
            for(int j=1; j<=n; j++) {
                for(int k=1; k<=n; k++) {
                    sum+=(__gcd(__gcd(i,j),k));
                }
            }
        }
        printf("%lld\n",sum);
    }
    return 0;
}



Measured memory_bytes: 3812
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >> E;
  int x = C*60+D-(A*60+B);
  cout << x-E << endl;
}

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

int main(){
  int N;
  cin >> N;
  double ans=0;
  for (int i = 0; i < N; i++) {
    double x;
    string u;
    cin >> x >> u;
    if(u=="BTC") ans+=x*380000.0;
    else ans+= x;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
a,b,c = map(int, input().split())

if a%2==1 or b%2==1 or c%2 ==1:
    print(0)
elif a==b==c:
    print(-1)
else:
    ans=0
    while a%2==0 and b%2==0 and c%2==0:
        x = (b+c)//2
        y = (a+c)//2
        z = (a+b)//2
        a=x
        b=y
        c=z
        ans+=1
    print(ans)

Measured memory_bytes: 3064
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
T=[]
result=-(D*(D+1)//2)*sum(C)
last=[0 for i in range(26)]

#初期解の算出
for i in range(D):
    change=[S[i][j]+(i-last[j]+1)*(D-i)*C[j] for j in range(26)]
    t=change.index(max(change))
    print(t+1)
    T.append(t+1)
    result+=S[i][t]+(i-last[t]+1)*(D-i)*C[t]
    last[t]=i+1

Measured memory_bytes: 9392
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  for(int i = 0; i < h; i++) {
    string tmp;
    cin >> tmp;
    for(int j = 0; j < w; j++) {
      s[i][j] = tmp[j];
    }
  }
  vector<vector<int>> row(h, vector<int>(w, 0)), col(h, vector<int>(w, 0));
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++){
      int cnt = 0;
      int k = j;
      if(s[i][k] == '.') {
        while(k < w && s[i][k] == '.'){
          k++;
          cnt++;
        }
        k--;
        while(k >= j) {
          row[i][k] = cnt;
          k--;
        }
        j += cnt;
      }
    }
  }

  for(int i = 0; i < w; i++) {
    for(int j = 0; j < h; j++){
      int cnt = 0;
      int k = j;
      if(s[k][i] == '.') {
        while(k < h && s[k][i] == '.'){
          k++;
          cnt++;
        }
        k--;
        while(k >= j) {
          col[k][i] = cnt;
          k--;
        }
        j += cnt;
      }
    }
  }
  int maxi = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#'){
        continue;
      }
      maxi = max(maxi, row[i][j] + col[i][j]);
    }
  }
  
  cout << maxi - 1 << '\n';
  return 0;
}

Measured memory_bytes: 35712
A = []
for _ in range(3):
    A.append(input().split())

N = int(input())
for _ in range(N):
    b = input()

    flag = False
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                A[i][j] = "-1"
                flag = True
                break
        if flag:
            break

flag = False
if A[0][0] == A[1][1] == A[2][2] or A[2][0] == A[1][1] == A[0][2]:
    flag = True

for i in range(3):
    if A[0][i] == A[1][i] == A[2][i]:
        flag = True
        break
    elif A[i][0] == A[i][1] == A[i][2]:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bitset>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    const auto primes = [] {
        vector<int> r;
        bitset<300'000> b;
        auto t = b;
        t.set();
        t[0] = false;
        t[1] = false;
        int i = 0;
        while (true) {
            bool done = false;
            while (!t[i]) {
                ++i;
                if (i % 7 != 1 && i % 7 != 6) {
                    t[i] = false;
                    continue;
                }
                if (i == t.size()) {
                    done = true;
                    break;
                }
            }
            if (done) {
                break;
            }

            b[i] = true;
            r.push_back(i);
            for (int j = i; j < t.size(); j += i) {
                t[j] = false;
            }
        }
        return r;
    }();

    while (true) {
        int n;
        cin >> n;
        if (n == 1) {
            return 0;
        }

        vector<int> r;
        for (auto i : primes) {
            if (n % i == 0) {
                r.push_back(i);
            }
        }

        cout << n << ':';
        for (auto i : r) {
            cout << ' ' << i;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(int (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(int (i)=(a)-1;(i)>=(b);(i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define VI vector<int>
#define VII vector<VI>
#define VL vector<LL>
#define VLL vector<VL>
#define VD vector<double>
#define VDD vector<VD>
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<LL,LL>
#define VPII vector<PII>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define FORE(a,b) for(auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9;
const int MOD=INF+7;
#define int LL

const int NUM = (50*50)+1;
int N,A;
VI x;
LL dp[51][51][NUM]={0};

signed main(void){
    cin >> N >> A;
    x=VI(N);
    REP(i,N){
        cin >> x[i];
    }
    dp[0][0][0]=1;
    //先頭からi個の内，j個選んだ組み合わせで総和kが何通りか
    REP(i,N){
        REP(j,N){
            REP(k,NUM){
                dp[i+1][j][k]+=dp[i][j][k]; //x[i]を候補に追加して使用しなかった場合
                dp[i+1][j+1][k+x[i]]+=dp[i][j][k]; //x[i]を候補に追加して使用した場合
            }
        }
    }
    LL ans=0;
    //先頭からN個のうち，ave==(i*A)/i==A
    FOR(i,1,N+1){
        ans+=dp[N][i][i*A];
    }
    cout << ans << endl;
}


Measured memory_bytes: 50048
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> price(N);
    int c;
    for (int i = 0; i < N; i++) {
        cin >> price[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> c;
        price[i] -= c;
    }

    int M = 0;
    for (int i = 0; i < N; i++) {
        M = max(M, M + price[i]);
    }
    cout << M << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int s = 1 << n;
    vector<int> a(s);
    rep(i, 0, s) cin >> a[i];
    int ans = 0;
    rep(b, 1, s){
        int p = -1, q = -1;
        for(int x = b;; x = (x - 1) & b){
            if(a[x] >= p){
                q = p;
                p = a[x];
            }else chmax(q, a[x]);
            if(x == 0) break;
        }
        chmax(ans, p + q);
        cout << ans << endl;
    }
}

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

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


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

typedef pair<ll, ll> P;

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

    mint operator-() const { return mint(-x); }

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

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

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

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

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

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

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

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

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

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

int main() {

    int n;
    cin >> n;
    vector<ll> numbers(n);
    rep(i, n)cin >> numbers[i];


    vector<ll> zeros(61, 0), ones(61, 0);

    for (ll a : numbers) {

        for (int i = 0; i <= 60; i++) {
            int b = a % 2;
            if (b) ones[i]++;
            else zeros[i]++;
            a /= 2;
        }

    }

    vector<ll> conb(61, 0);
    rep(i, 61) conb[i] = zeros[i] * ones[i];

    mint ans = 0;
    rep(i, 61) {
        mint now = mint(2).pow(i) * conb[i];
        ans += now;
    }
    cout << ans.x << endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    string n ;
    cin >> n ;
    if (n == "A"){
        cout << "T" ;
    }
    if (n == "C"){
        cout << "G" ;
    }
    if (n == "G"){
        cout << "C" ;
    }
    if (n == "T"){
        cout << "A" ;
    }
    return 0;
}


Measured memory_bytes: 3520
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll H, W;
ll ans;

void solve() {
	cin >> H >> W;

	if (H == 1 || W == 1) {
		cout << 1 << endl;
		return;
	}

	ans = (H - H % 2) * (W - W % 2);
	ans /= 2;
	if (H % 2 == 1) ans += W / 2;
	if (W % 2 == 1) ans += H / 2;
	if (H % 2 == 1 && W % 2 == 1) ans++;
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 1000000007;

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long Div(long long a, long long b, long long m) {
	return (a * modpow(b, m - 2, m)) % m;
}

long long fact[1 << 19], inv[1 << 19];

void init() {
	fact[0] = 1;
	for (int i = 1; i <= 500000; i++) fact[i] = (1LL * i * fact[i - 1] % mod);
	for (int i = 0; i <= 500000; i++) inv[i] = Div(1, fact[i], mod);
}

long long ncr(long long n, long long r) {
	if (n < r || r < 0) return 0;
	return (fact[n] * inv[r] % mod) * inv[n - r] % mod;
}

long long N, K, sum;

int main() {
	cin >> N >> K; init();
	for (int i = 0; i <= N - 1; i++) {
		if (i > K) continue;
		long long V1 = ncr(N, i);
		long long V2 = ncr(N - 1, i);
		sum += (V1 * V2 % mod);
	}
	cout << sum % mod << endl;
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, n, s) for (int i = s; i < n; i++)
using namespace std;
const double PI = acos(-1);
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    for (int i = n - 1; i >= 0; i--)
    {
        if (i != 0)
        {
            cout << a[i] << " ";
        }
        else
        {
            cout << a[i] << endl;
        }
    }
   // system("pause");
    return 0;
}


Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],b[100005],ans; 
int main(){
	cin>>n;
	for(int i=1;i<=n+1;i++) cin>>a[i],ans+=a[i];
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		if(b[i]<=a[i]) a[i]-=b[i];
		else 
		{
			b[i]-=a[i],a[i]=0;
			if(a[i+1]<=b[i]) a[i+1]=0;
			else a[i+1]-=b[i];
		}
	}
	for(int i=1;i<=n+1;i++) ans-=a[i];
	cout<<ans;
	return 0;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u32 a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}


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


int main() {
    int a[4];
    string input;
    cin >> input;
    for(int i=0; i<4; i++) {
        a[i] = input[i]-'0';
    }

    for(int bit=0; bit < (1<<3); bit++) {
        int sum = a[0];
        string s;
        s += (char)('0' + a[0]);
        for(int i=0; i<3; i++) {
            if(bit & (1<<i)) {
                sum += a[i+1];
                s += '+';
                s += (char)('0' + a[i+1]);
            }
            else {
                sum -= a[i+1];
                s += '-';
                s += (char)('0' + a[i+1]);
            }
        }
        if (sum == 7) {
            cout << s << "=7" << endl;
            return 0;
        }
    }

    return 0;
}



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

#define ABS(X) ((X)<0?-(X):(X))
#define SGN(X) ((X)?(X)<0?-1:1:0)
  
int main(void){
  int a,b;
  
  cin >> a >> b;
//  cout << a*b << endl;
  if (SGN(a)!=SGN(b)&&a&&b){
    cout << ABS(a+b)+1 << endl;
  } else if (a<b){
    cout << b-a << endl;
  } else {
    cout << a-b+(!!a)+(!!b) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if (p[i-1] < p[i] and p[i] < p[i+1]) \
        or (p[i-1] > p[i] and p[i] > p[i+1]):
        ans += 1
print(ans)

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

int main(){
    string s, t, u;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    cin >> u;
    if(s == u){
        cout << a-1 << ' ' << b << endl;
    }
    else{
        cout << a << ' ' << b-1 << endl;
    }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
signed main(){
    fast;
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[225816];
vector<int> ans;

void solve(int p, bool rev = false){
	if(!p){
		return;
	}
	--p;
	if(!rev){
		ans.push_back(a[p]);
	}
	solve(p,!rev);
	if(rev){
		ans.push_back(a[p]);
	}
}

int main(void){
	int n,i;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	solve(n);
	for(i=0; i<n; ++i){
		cout << ((i)?" ":"") << ans[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 5364
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A, B = il()
    print(min(B, N*A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3832
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


string s;
int n;
int A[6];
int B[6];
char T[8][6];

void solve() {
    for ( int i = 0; i < 8; ++ i ) {
        for ( int j = 0; j < 5; ++ j ) {
            T[i][j] = '*';
        }
        T[i][5] = '\0';
    }
    for ( int i = 0; i < 5; ++ i ) {
        T[2][i] = '=';
    }

    for ( int i = 0; i < n; ++ i ) {
        int k = s[i] - '0';
        if ( k >= 5 ) A[i] = 0;
        else A[i] = 1;
        B[i] = k % 5;
    }

    for ( int i = 0; i < n; ++ i ) {
        T[A[i]][i] = ' ';
        T[3+B[i]][i] = ' ';
    }
}

void output() {
    for ( int i = 0; i < 8; ++ i ) {
        cout << T[i] << endl;
    }
}

string addPrefix( string s ) {
    while ( s.size() < 5 ) {
        s = "0" + s;
    }
    return s;
}

int main() {
    bool flag = true;
    while ( cin >> s ) {
        if ( ! flag ) cout << endl;
        flag = false;
        s = addPrefix(s);
        n = s.size();
        solve();
        output();
    }
    return 0;
}

Measured memory_bytes: 904
#include <stdio.h>
int m,f,r;
int main(){
  for(;;){
    scanf(" %d %d %d",&m,&f,&r);
    if(m==-1&&f==-1&&r==-1){
      return 0;
    } else if(m==-1||f==-1){
      printf("F\n");
    } else if(m+f>=80){
      printf("A\n");
    } else if(m+f>=65){
      printf("B\n");
    } else if(m+f>=50){
      printf("C\n");
    } else if(m+f>=30&&r>=50){
      printf("C\n");
    } else if(m+f>=30){
      printf("D\n");
    } else {
      printf("F\n");
    }
  }
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

   
   ll a,b,c,d;
   cin>>a>>b>>c>>d;

   ll ans1 = a*c;
   ll ans2 = a*d;
   ll ans3 = b*c;
   ll ans4 = b*d;

   cout<<max({ans1,ans2,ans3,ans4})<<endl;;
  

  
}


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

using namespace std;

struct line {
    long long m,b;
    line() {}
    line(long long _, long long __) {
        m = _, b = __;
    }
    long long get(long long x) {
        return m * x + b;
    }
};
 
struct cht {
    vector<line> trick;
    int pos;
    cht() { pos = 0;}
    bool irrelevant(line l1, line l2, line l3) {
        return (double)(l3.b - (double)l1.b) * (double)(l1.m - l2.m) <= (double)(l2.b - l1.b) * ((double)l1.m - l3.m);
    }
    
    void add(line l) {
        while(trick.size() >= 2 
          and irrelevant(trick[trick.size() - 2], trick[trick.size() - 1], l))
            trick.pop_back();
        trick.push_back(l);
    }
 
    long long query(long long x) {
        if(pos >= (int)trick.size()) pos = trick.size() - 1;
        while(pos + 1 < (int)trick.size() and trick[pos + 1].get(x) < trick[pos].get(x))
            pos++;
        return trick[pos].get(x);
    }
};
  
int n;
long long c;
long long h[1000010];

int main() {
    scanf("%d %lld", &n, &c);

    for (int i = 0; i < n; ++i)
        scanf("%lld", h + i);
    
    cht dp;
    
    dp.add(line(-2 * h[0], h[0] * h[0]));

    long long cur = 0;
    for (int i = 1; i < n; ++i) {
        cur = dp.query(h[i]) + h[i] * h[i] + c;
        dp.add(line(-2*h[i], h[i] * h[i] + cur));
    }
    cout << cur << "\n";

    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  for(int i=0; i<n; i++) {
    if(s.at(i) != t.at(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k;
    cin >> n >> k;
    ll h[n];
    rep(i,n) cin >> h[i];
    ll dp[n+k];
    rep(i, n+k) dp[i] = longinf;
    dp[0] = 0;
    rep(i,n) rep(j,k+1)
    {
        if (i+j >= n) continue;
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i] - h[i+j]));
    }
    cout << dp[n-1] << endl;
    // rep(i,n)
    // {
    //     cout << dp[i] << endl;
    // }
}


Measured memory_bytes: 1792
#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 _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

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

const int MAXN = 105;

int n;
int a[MAXN];

int main(){
    n = 3;
    REP(i, n)
        cin >> a[i];

    sort(a, a + n);

    int sol = 0;
    FOR(i, 1, n)
        sol += a[i] - a[i - 1];

    cout << sol;
}


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

using namespace std;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

void sub()
{
    const auto N(cin2var<size_t>());
    const auto As(cin2vec<int64_t>(N));
    double sum = 0;
    for (const auto& a : As) {
        sum += 1 / static_cast<double>(a);
    }
    const double ans = 1 / sum;
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    sub();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int r,i;
    scanf("%d",&r);
    if(r>=1 && r<=1998)
    {
        if(r>=1 && r<=999)
        {
            printf("ABC\n");
        }
        else if(r>=1000 && r<=1998)
        {
            printf("ABD\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

bool isPrime(int n){
  for(int i=2;(long)i*i<=n;i++){
    if(n%i==0)return false;
  }
  return n!=1;
}

int main(){
    
  int a,d,i,n,j,y;
  
  while(cin>>a>>d>>n,a||d||n){
    i=j=0;
      while(i<n){
          y=a+j*d;
         
          if( isPrime(y)){
	    i++;
	  }
	  j++;
      }
      cout<<y<<endl;
  }

  return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<utility>

typedef long long ll;

using namespace std;

int main() {
    int A,B;
    cin >> A >> B;
    if (A < 1 || A > 9 || B < 1 || B > 9){
        cout << -1;
    }
    else {
        cout << A*B;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vi a(n), b(n);
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];
        sum += a[i];
    }
    ll res = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] > b[i])
        {
            res = max(res, sum - b[i]);
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 384
// AOJ CGL_2_D Distance
// 2018.5.2 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct { double x, y; } PP;
typedef struct { PP s, e; } SEG, LINE;

#define INF			1e8
#define EPS			1e-8
#define EQ(a,b)		(fabs((a)-(b))<EPS)
#define PPeQ(a,b)	(EQ(a.x,b.x)&&EQ(a.y,b.y))

int dcmp(double x) { if (fabs(x) < EPS) return 0; return x <= 0 ? -1 : 1; }
PP vset(double x, double y) { PP r; r.x = x, r.y = y; return r; }
PP vadd(PP p1, PP p2) { PP r; r.x = p1.x + p2.x, r.y = p1.y + p2.y; return r; }
PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
PP vsmul(PP p, double k) { PP r; r.x = p.x * k, r.y = p.y * k; return r; }
PP vmul(PP p1, PP p2) { PP r;
	r.x = p1.x * p2.x - p1.y * p2.y, r.y = p1.x * p2.y + p1.y * p2.x; return r; }
double vabs(PP a) { return hypot(a.x, a.y); }
double dist(PP p1, PP p2) {	return hypot(p1.x-p2.x, p1.y-p2.y); };
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }
PP dir(SEG s) { return vsub(s.e, s.s); }

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int ccw(PP p0, PP p1, PP p2)
{
	PP a, b;
	double t;

	a = vsub(p1, p0), b = vsub(p2, p0), t = cross(a, b);
	if (t >  EPS) return 1;	if (t < -EPS) return -1;
	if (dot(a, b) < -EPS) return 2;	if (norm(a) < norm(b)) return -2;
	return 0;
}

int is_intersectSS(SEG s1, SEG s2)
{
	return ccw(s1.s, s1.e, s2.s) * ccw(s1.s, s1.e, s2.e) <= 0 &&
		   ccw(s2.s, s2.e, s1.s) * ccw(s2.s, s2.e, s1.e) <= 0;
}

double distanceLP(SEG s, PP p)
{
	return fabs(cross(vsub(s.e, s.s), vsub(p, s.s)) / vabs(vsub(s.e, s.s)));
}

double distanceSP(SEG s, PP p)
{
	if (dot(vsub(s.e, s.s), vsub(p, s.s)) < 0) return vabs(vsub(p, s.s));
	if (dot(vsub(s.s, s.e), vsub(p, s.e)) < 0) return vabs(vsub(p, s.e));
	return distanceLP(s, p);
}

double distanceSS(SEG s1, SEG s2)
{
	double r, x;
	if (is_intersectSS(s1, s2)) return 0;
	r = distanceSP(s1, s2.s);
	x = distanceSP(s1, s2.e); if (x < r) r = x;
	x = distanceSP(s2, s1.s); if (x < r) r = x;
	x = distanceSP(s2, s1.e); if (x < r) r = x;
	return r;
}

int main()
{
	int q, x, y;
	PP p0, p1, p2, p3;
	SEG s1, s2;

	q = in();
	while (q--) {
		x = in(), y = in(), p0 = vset(x, y);
		x = in(), y = in(), p1 = vset(x, y);
		x = in(), y = in(), p2 = vset(x, y);
		x = in(), y = in(), p3 = vset(x, y);
		s1.s = p0, s1.e = p1;
		s2.s = p2, s2.e = p3;
		printf("%.10lf\n", distanceSS(s1, s2));
	}
	return 0;
}



Measured memory_bytes: 2128
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<string> divider = {"dream", "dreamer", "erase", "eraser"};
    reverse(s.begin(), s.end());
    for (auto&& d : divider) reverse(d.begin(), d.end());

    size_t index = 0;
    bool enable = true;

    while (enable) {
        if (index == s.size()) break;
        for (const auto& d : divider) {
            if (s.substr(index, d.size()) == d) {
                index += d.size();
                enable = true;
                break;
            }
            else {
                enable = false;
            }
        }
    }

    cout << (enable ? "YES" : "NO") << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 512
N, K = map(int,input().split())
# a_list = []
b_dict = {}

for i in range(N):
    a, b = map(int,input().split())
    if a in b_dict:
        b_dict[a] += b
    else:
        b_dict[a] = b
        
a_list = list(b_dict.keys())
a_list.sort()


for a in a_list:
    K -= b_dict[a]
    if K <= 0:
        break

print(a)

Measured memory_bytes: 50136
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  int n,g;
  cin>>n>>g;
  
  vector<int> p(n);
  vector<int> q(n);
  vector<bool> r(n,true);
  rep(i,n){
    cin>>p[i]>>q[i];
  }

//——————————————bit全探索——————————————
  ll ans=1000000000000;
  rep(i, (1<<n)){
    ll sum=0;
    ll mon=0;
    rep(j,n){
      if(i & (1<<j)){
      sum+=p[j]*(j+1)*100+q[j];
      mon+=p[j];
      r[j]=false;
      }
    }
    if(sum>=g) {
      ans=min(ans,mon);
    }
    else {
      int noko=-1;
      ll dame=false;
      for(int j=n-1;j>=0;j--){
        if(r[j]) {
          noko=j;
          break;
        }
        if(j==0) {
          dame=true;
        }
      }
      if(sum+p[noko]*(noko+1)*100+q[noko]<g || dame) {
        dame=false;
        continue;
      }
      else mon+=(g-sum+(noko+1)*100-1)/((noko+1)*100);
      ans=min(ans,mon);
    }
    rep(j,n){
      r[j]=true;
    }
  }

  cout << ans << endl;

//——————————————————————————————————————

}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N;
	cin >> N;

	vector <ll> A(N);
	for (ll ii = 0; ii < N; ++ii){
		cin >> A[ii];
	}
	A.push_back(0);

	ll m = 1000;
	ll s = 0;
	for (ll ii = 0; ii < N; ++ii){
		m += s*A[ii];
		s = 0;
		if (A[ii] < A[ii+1]){
			s = m / A[ii];
			m -= s*A[ii];
		}
	}

	cout << m << "\n";

	return 0;
}


Measured memory_bytes: 3640
N, M = map(int, input().split())

#四つ角：4回
#辺上：6回
#内側：9回
if N==1 and M==1:
    print(1)
elif N == 1 or M ==1:
    #端：2回
    #その他：3回
    print(max(N-2,M-2))
else:
    print((N-2)*(M-2))


Measured memory_bytes: 9100
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <climits>
#include <vector>
#include <algorithm>

using namespace std;

const int MAX_N = 500000;
char dat[MAX_N + 1];

int afterChar[MAX_N][27]; // 26 is empty
int jumpTable[MAX_N][20];

int main() {
  scanf("%s", dat);
  int n = strlen(dat);
  for (int i = n - 1; i >= 0; i--) {
    int cur = dat[i] - 'a';
    for (int c = 0; c < 27; c++) {
      afterChar[i][c] = -1;
    }
    afterChar[i][cur] = i + 1;
    for (int c = cur + 1; c <= 26; c++) {
      int merged = afterChar[i][c - 1];
      if (merged < 0 || merged >= n)
        break;
      afterChar[i][c] = afterChar[merged][c-1];
    }
    for (int c = 0; c < cur; c++) {
      int merged = afterChar[i][26];
      if (0 <= merged && merged < n) {
        afterChar[i][c] = afterChar[merged][c];
      }
    }
  }
  for (int i = 0; i < n; i++)
    jumpTable[i][0] = afterChar[i][26];
  for (int sz = 1; sz < 20; sz++) {
    for (int i = 0; i < n; i++) {
      int merged = jumpTable[i][sz - 1];
      if (merged >= 0 && merged < n) {
        jumpTable[i][sz] = jumpTable[merged][sz - 1];
      }
      else {
        jumpTable[i][sz] = -1;
      }
    }
  }
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    for (int sz = 19; sz >= 0; sz--) {
      int next = jumpTable[l][sz];
      if (next == -1 || next > r) continue;
      l = next;
      if (l == r) break;
    }
    puts((l == r) ? "Yes" : "No");
  }
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    for (int i = 0; i < P.size(); i++) {
        cin >> P[i];
        P[i] --;
    }   
    for (int i = 0; i < Q.size(); i++) {
        cin >> Q[i];
        Q[i] --;
    }

    int count1 = -1;
    int count2 = -1;

    do {
        count1 ++; 
    } while (next_permutation(P.begin(), P.end()));

    do {
        count2 ++;
    } while (next_permutation(Q.begin(), Q.end())); 

    int permutation = 1;
    for (int i = 1; i <= N; i++) {
        permutation *= i;
    }

    int a = permutation - count1;
    int b = permutation - count2;

    cout <<  abs(a-b) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	 vector<int> a;

	 for (int i = 0; i < 3; i++) {
	 	int t;
	 	cin >> t;
	 	a.push_back(t);
	 }
	 sort(a.begin(), a.end());

	 int c1 = abs(a[0] - a[1]);
	 int c2 = abs(a[1] - a[2]);

	 cout << c1 + c2 << endl;
	return 0;
}

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

int		main()
{
	int A, B, C, K, sum = 0;

	// S = (char *)malloc(sizeof(char) * 12);
	// N = (char *)malloc(sizeof(char) * 12);
	scanf("%d %d %d %d\n", &A, &B, &C, &K);
	if (K <= A)
		sum = K;
	else if (K <= (A + B))
		sum = A;
	else
	{
		K -= A + B;
		sum = A - K;
	}
	printf("%d\n", sum);
	return (0);
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin >> a >> b >> c;
    if((4*a*b < (c-a-b)*(c-a-b)) && c>a+b) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}

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

using namespace std;
using namespace std::chrono;

using Int  = int_fast64_t;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

template <typename T>
int get_hours(const T& chrono)
{
    return duration_cast<hours>(chrono).count() % 24;
}

template <typename T>
int get_minutes(const T& chrono)
{
    return duration_cast<minutes>(chrono).count() % 60;
}

template <typename T>
int get_seconds(const T& chrono)
{
    return duration_cast<seconds>(chrono).count() % 60;
}

void sub()
{
    const auto N = 3;
    for (auto i = 0u; i < N; ++i) {
        const auto Ss(cin2vec<Int>(3));
        const auto Es(cin2vec<Int>(3));
        const auto tp_s(hours(Ss[0]) + minutes(Ss[1]) + seconds(Ss[2]));
        const auto tp_e(hours(Es[0]) + minutes(Es[1]) + seconds(Es[2]));
        const auto d(tp_e - tp_s);
        cout << get_hours(d) << ' ' << get_minutes(d) << ' ' << get_seconds(d) << endl;
    }
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}


Measured memory_bytes: 3196
#include<iostream>
using namespace std;
#define MAX 100000
#define SENTINEL 20000000

struct Card{
    char suit;
    int value;
};

Card L[MAX/2+2], R[MAX/2+2];

void merge(Card A[], int n, int left, int mid, int right){
    int i,j,k;
    int n1 = mid - left;
    int n2 = right-mid;
    for(i=0; i<n1; i++) L[i] = A[left+i];
    for(i=0; i<n2; i++) R[i] = A[mid+i];
    L[n1].value = R[n2].value = SENTINEL;
    i = j = 0;
    for(k = left; k<right; k++){
        if(L[i].value <= R[j].value){
            A[k] = L[i++];
        }else{
            A[k] = R[j++];
        }
    }
}

void mergeSort(Card A[], int n, int left, int right){
    int mid;
    if(left+1<right){
        mid = (right+left)/2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int partition(Card A[], int n, int p, int r){
    int i,j;
    Card t,x;
    x = A[r];
    i = p-1;
    for(j=p; j<r; j++){
        if (A[j].value <= x.value) {
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    t = A[i+1];
    A[i+1] = A[r];
    A[r] = t;
    return i+1;
}

void quickSort(Card A[], int n, int p, int r){
    int q;
    if(p<r){
        q = partition(A,n,p,r);
        quickSort(A,n,p,q-1);
        quickSort(A,n,q+1,r);
    }
}

int main() {
    int n,v;
    Card A[MAX], B[MAX];
    char S[10];
    int stable = 1;
    
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> S >> v;
        A[i].suit = B[i].suit = S[0];
        A[i].value = B[i].value = v;
    }
    
    mergeSort(A,n,0,n);
    quickSort(B,n,0,n-1);
    
    for(int i=0; i<n; i++){
        if(A[i].suit != B[i].suit) stable = 0;
    }
    
    if(stable==1) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    for(int i=0; i<n; i++){
        cout << B[i].suit << " " << B[i].value << endl;
    }
    
    return 0;
}

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

int main(){
	int n,m,l;
	cin >> n >> m >> l;
	vector<vector<long long>> A(n+1,vector<long long>(m+1)),B(m+1,vector<long long>(l+1)),C(n+1,vector<long long>(l+1));
	int i,j,k;
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}
	for(i = 0; i < m; i++){
		for(j = 0; j < l; j++){
			cin >> B[i][j];
		}
	}
	for(i = 0; i < n; i++){
		for(j = 0; j < l; j++){
			C[i][j] = 0;
		}
	}	
	for(i = 0; i < n; i++){
		for(j = 0; j < l; j++){
			for(k = 0; k < m; k++){
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}
	for(i = 0; i < n; i++){
		for(j = 0; j < l-1; j++){
			cout << C[i][j] << " ";
		}
		cout << C[i][j] << endl;
	}
	return 0;
}

Measured memory_bytes: 3256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll d, t, s;
    cin >> d >> t >> s;
    bool ans = t*s >= d;
    cout << (ans ? "Yes" : "No") << endl;
    return;
}

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

Measured memory_bytes: 3632
l = []
for i in range(3):
  n1, n2, n3 = map(str, input().split())
  l.append(int(n1))
  l.append(int(n2))
  l.append(int(n3))

n = int(input())
for i in range(n):
  num = int(input())
  if num in l:
    l[l.index(num)] = 0
    
if l[0]==0 and l[1]==0 and l[2]==0:
  print('Yes')
elif l[3]==0 and l[4]==0 and l[5]==0:
  print('Yes')
elif l[6]==0 and l[7]==0 and l[8]==0:
  print('Yes')
elif l[0]==0 and l[3]==0 and l[6]==0:
  print('Yes')
elif l[1]==0 and l[4]==0 and l[7]==0:
  print('Yes')
elif l[2]==0 and l[5]==0 and l[8]==0:
  print('Yes')
elif l[0]==0 and l[4]==0 and l[8]==0:
  print('Yes')
elif l[2]==0 and l[4]==0 and l[6]==0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064