akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 1e5 + 5;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int N; cin >> N;
    cout << (N >= 30 ? "Yes" : "No") << '\n';
    return 0;
}


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

int compare_int(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int N, K, i;
	int H[200000];
	long ans = 0;
	scanf("%d %d", &N, &K);

	if (K >= N) {
		printf("0");
		return 0;
	}
	for (i = 0; i < N; i++) {
		scanf("%d", &H[i]);
	}

	qsort(H, N, sizeof(int), compare_int);

	for (i = 0; i < N - K; i++) {
		ans += H[i];
	}

	printf("%ld", ans);

	return 0;
}

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

int main() {
  int N, a, b, count = 0;
  bool seki[100000] = {false};

  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    for (int j = a - 1; j < b; j++) {
      seki[j] = true;
    }
  }

  for (int k = 0; k < 100000; k++) {
    if (seki[k] == true) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main() {
    while (1) {
        int n; cin >> n;
        if (n == 0) break;
        int sum = 0;
        int max, min;
        for (int i = 0; i < n; ++i) {
            int a; cin >> a;
            if (i == 0) max = min = a;
            max = max < a ? a : max;
            min = min > a ? a : min;
            sum += a;
        }
        sum -= max + min;
        cout << sum / (n - 2) << endl;
    }
    return 0;
}



Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    ll num = n;
    vec<ll> c;
    vec<ll> t(1000); rep(i,999)t[i+1] = t[i] + i+1; 
    for(ll i = 2; i*i <= num;i++){
        if(n%i == 0){
            ll e = 0;
            while(n%i == 0){
                n/=i;
                e++;
            }
            c.emplace_back(e);
        }
    }
    if(n != 1){
        c.emplace_back(1);
    }
    ll ans = 0;
    rep(i,c.size()){
        rep(j,1000){
            if(t[j] > c[i]){
                ans += j-1;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define int ll

const int md = 1000000007;
const int INF = 1<<30;


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

    int cnta = 0;
    int ans = 0;
    int i = 0;
    while(i < s.size()){
        if(s[i] != 'A') {
            cnta = 0;
            i++;
            continue;
        }
        else cnta++;

        int cntb = 0;
        if(i+2 < s.size() and s.substr(i,3) == "ABC"){
            i++;
            while(s.substr(i,2) == "BC"){
                cntb++;

                if(i + 2 >= s.size() - 1) break;
                i += 2;
            }
            ans += cnta * cntb;
        }else{
            i++;
        }
    }

    cout << ans  << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <stack>

using namespace std;

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

typedef long long LL;
typedef pair<int, int> PII;

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

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

  int sum = 0;

  if (a <= k) {
    sum += a;
    k -= a;
  } else {
    cout << k << endl;
    return 0;
  }

  if (b <= k) {
    k -= b;
  } else {
    cout << sum << endl;
    return 0;
  }

  sum -= k;

  cout << sum << endl;

  return 0;
}

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


int main() {
  ll n;
  cin >> n;
  vector<ll> a(3*n);
  rep(i, 3*n) cin >> a[i];
  sort(&a[0], &a[0]+n*3);
  
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[n + 2*i];
  }
  cout << ans << endl;
}



Measured memory_bytes: 2560
#include<iostream>
#include<cmath>
#define int long long
using namespace std;
signed main(){
    int n;
    cin >> n;
    int k = n;
    int m = 1;
    int max = n,flag=0;

    for (int i = sqrt(k); i >= 1; i--)
    {
        if (n % i == 0)
        {
            n /= i;
            m *= i;
        }
        if (m + n < max){
            max = m + n;
            flag = 1;
        }
    }

        
            //cout << n << " ";
            //cout << m * n << " ";
    if(flag==1){

            cout << max - 2 << endl;
    }else{
        cout << max - 1 << endl;
        
    }
    
    
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define lld long double
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl '\n'
template <typename T> using mxpq = priority_queue<T>;
template <typename T> using mnpq = priority_queue<T, vt<T>, greater<T>>;
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define mmss(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

const ll mod = 1e9 + 7;
const ll N = 6e4 + 6;
const ll maxN = 1e6 + 15;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

int dx[4] = { -1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// up, right, down, left
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions
//int dx[]={-2,-2,-1,1,-1,1,2,2};///Knight moves
//int dy[]={1,-1,-2,-2,2,2,-1,1};///Knight moves

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

vt<int> spf(maxN);
void spfsieve() {
	for (int i = 2; i < maxN; i += 2)
		spf[i] = 2;
	for (int i = 3; i < maxN; i += 2) {
		if (spf[i] == 0) {
			spf[i] = i;
			for (int j = 2 * i; j < maxN; j += i) {
				if (spf[j] == 0) spf[j] = i;
			}
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in4.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	spfsieve();
	ll n;
	cin >> n;
	ll ans = 0;
	for (int c = 1; c < n; ++c) {
		ll v = n - c;
		if (v == 1) {
			ans++;
			continue;
		}
		ll div = 1;
		map<ll, ll> mp;
		while (v != 1) {
			mp[spf[v]]++;
			v = v / spf[v];
		}
		for (auto it : mp) {
			div *= (it.ss + 1);
		}
		ans += (div);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 7036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> sell(n);
  vector<int> mx(n), mn(n, INT_MAX);
  int pre = 0;
  for (int i = n - 1; i >= 0; --i) {
    mx[i] = max(pre, a[i]);
    pre = mx[i];
  }
  pre = INT_MAX;
  rep(i, n) {
    mn[i] = min(pre, a[i]);
  }
  ll maxv = 0;
  rep(i, n) {
    sell[i] = mx[i] - mn[i];
    maxv = max(sell[i], maxv);
  }
  int ans = 0;
  rep(i, n) {
    if(sell[i] == maxv) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 2176
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n; cin >> n;
    long long K; cin >> K;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        int x; cin >> x;
        x--;
        a[i] = x;
    }
    vector<int> s;
    vector<int> ord(n,-1);
    int period, line;
    {
        int v = 0;
        while(ord[v] == -1){
            ord[v] = s.size();
            s.push_back(v);
            v = a[v];
        }
        period = s.size() - ord[v];
        line = ord[v];
    }
    if(K < line) cout << s[K]+1 << endl;
    else {
        K -= line;
        K %= period;
        cout << s[line+K]+1 << endl;
    }
    return 0;
}
//Saw the solution video

Measured memory_bytes: 5792
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size(), a = 0, b = 0;
    for (int i = 0; i < n; ++i)
    {
        if (s[i] == '0')
            a++;
        else
            b++;
    }
    cout << min(a, b) * 2;
}


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

int main() {
    long long n, t, cnt = 0;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> t;
        if (t % 2) cnt++;
    }
    std::cout << (cnt % 2 ? "NO" : "YES") << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author EDGE
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            String s = in.nextLine();
            if (new BigInteger(s).isProbablePrime(1))
                out.println(s);
            else
                out.println(new BigInteger(s).nextProbablePrime());
        }

    }

    static class FastReader {
        BufferedReader br;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}



Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;

ll n, p;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    p = __gcd(n, (ll)360);
    p = n * 360 / p;
    cout << p / n;
    return 0;
}


Measured memory_bytes: 3600
import sys
import math
 
while 1:
    n, x = map(int , raw_input().split())    
    if n + x == 0:
        break 
    cnt = 0
    for i in xrange(1, n+1):
        for j in xrange(i+1, n+1):
            for k in xrange(j+1, n+1):
                if i + j + k == x:
                    cnt += 1
 
    print cnt


Measured memory_bytes: 4688
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	vector<pair<int, int>> arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second ;
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i].first == arr[i].second) {
			count += 1;
		}
		else {
			if (count == 3) {
				break;
			}
			else {
				count = 0;
			}
		}
	}
	if (count >= 3) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 3636
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

int a[100000][3];
int sm[200002];
int tt[200002];

int main(void){
	int n=nextint();
	int c=nextint();
	for(int i=0; i<n ; i++){
		a[i][0]=nextint();
		a[i][1]=nextint();
		a[i][2]=nextint();
	}
	for(int i=1; i<=c ; i++){
		memset(tt, 0, sizeof(tt));
		for(int j=0; j<n ; j++){
			if(a[j][2]==i){
				tt[a[j][0]*2-1]++;
				tt[a[j][1]*2]--;
			}
		}
		for(int j=1; j<200002; j++){
			tt[j]+=tt[j-1];
		}
		for(int j=0; j<200002; j++){
			if(tt[j]>0) sm[j]++;
		}
	}
	int ans=0;
	for(int i=0; i<200002; i++){
		if(sm[i]>ans) ans=sm[i];
	}
	printf("%d\n", ans);
}


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

int main()
{
  int n;
  cin >> n;
  int sum = 0;
  int a[n];
  rep(i, n){
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  rep(i, n){
    if(sum % 10 != 0) break;
    if(a[i] % 10 == 0) continue;
    sum -= a[i];
  }
  if(sum % 10 == 0) sum = 0;
  cout << sum << endl;

       

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
struct card {
    int value;
    char ch[2];
    int order;
};
void print(struct card card1[],int num)
        {
            int count=0;
            for(int i=0;i<num;i++)
                if(i==num-1) cout<<card1[i].ch<<endl;
                else  cout<<card1[i].ch<<" ";
            for(int i=1;i<num;i++)
            {
            if(card1[i].value==card1[i-1].value && card1[i].order<card1[i-1].order) count++;}
            cout<<(count==0?"Stable":"Not stable")<<endl;
        }
void bubblesort(struct card  card1[],int num)
{   char tmp[2];
    for(int i=0;i<num;i++)
        for(int j=num-1;j>i;j--)
            if(card1[j].value<card1[j-1].value) {
                swap(card1[j].value, card1[j - 1].value);
                swap(card1[j].ch,card1[j-1].ch);
                swap(card1[j].order,card1[j-1].order);
            }
            print(card1,num);
}
void selectionsort(struct card  card1[],int num)
{
    string tmp;
    int mini=0;
    for(int i=0;i<num;i++) {
        mini = i;
        for (int j = i; j < num; j++)
            if (card1[j].value < card1[mini].value) {
                mini = j;
            }
        if (i!= mini) {
            swap(card1[i].value, card1[mini].value);
            swap(card1[i].ch,card1[mini].ch);
            swap(card1[i].order,card1[mini].order);
        }
    }
    print(card1,num);
}
void solve(struct card card1[],int num)
{
    struct card card2[num];
            for(int i=0;i<num;i++) card2[i]=card1[i];
    bubblesort(card1,num);
    selectionsort(card2,num);
}
int main()
{
    int num;
    cin>>num;
    struct card inst[num],inst2[num];
    for(int i=0;i<num;i++) {
        cin >>inst[i].ch;
        inst[i].value=inst[i].ch[1]-48;
        inst[i].order=i;
    }
    solve(inst,num);
    return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, M, A[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, N) cin >> A[i];

    priority_queue<int> que;
    rep(i, 0, N) que.push(A[i]);
    rep(i, 0, M) {
        int q = que.top();
        que.pop();
        que.push(q / 2);
    }

    ll ans = 0;
    while(!que.empty()) {
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
}

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

const double EPS = 1.0e-6;
int main(){
	int a[4], b[4];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		int hit = 0;
		int blow = 0;
		for(int i=0; i<4; i++){
			if(a[i]==b[i]) hit++;
			for(int j=0; j<4; j++){
				if(a[i]==b[j]) blow++;
			}
		}
		blow -= hit;
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) (a > b ? a - b : b - a)

int compare_f(const void *a, const void *b) {
	return (int)(*(uint32_t *)b) - (int)(*(uint32_t *)a);
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t n, m;

	scanf("%zu %zu", &n, &m);

	printf("%zu\n", (n - 1)*(m - 1));

	return 0;
}


Measured memory_bytes: 128
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
#include <list>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  u64 n;
  cin >> n;
  list< u64 > b;
  for (u64 i = 0; i < n; ++i) {
    u64 a;
    cin >> a;
    if (i%2==0) b.push_front(a);
    else b.push_back(a);
  }
  if (n%2==0) b.reverse();
  for (u64 x : b) {
    cout << x << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O2")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}
lli modInverse(lli a, lli m) 
{
    lli m0 = m; 
    lli y = 0, x = 1; 
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    {  
        lli q = a / m; 
        lli t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }  
    if (x < 0) 
       x += m0; 
    return x; 
} 
const int N=(1<<20);

int main() 
{ 
  fastio;
  lli n,a,b;
  cin>>n>>a>>b;
  lli facta=1,factb=1;
  f(i,1,a+1)facta=(i*facta)%mod;
  f(i,1,b+1)factb=(i*factb)%mod;
  lli vala=1,valb=1;
  f(i,n-a+1,n+1)vala=(i*vala)%mod;  
  f(i,n-b+1,n+1)valb=(i*valb)%mod;
  lli ans=power(2,n)-1;
  vala=vala*power(facta,mod-2);
  vala%=mod;
  valb=valb*power(factb,mod-2);
  valb%=mod;
  ans-=vala+valb;
  cout<<tmod(ans,mod)<<"\n";  
  return 0; 	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define MAXN 100005


signed main(){
    fast;
    // #ifndef ONLINE_JUDGE
    //     freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
    //     freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    // #endif
    int a, b, c;
    cin>>a>>b>>c;
    if(a==b && a==c){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long i = sc.nextLong();
        long mod = 1000000007;
        long result = 0;
        for (long k = i; k <= n + 1; k++){
            result += ((n + (n - k + 1)) * k / 2) - (k * (k - 1) / 2) + 1;
        }
        System.out.println(result % mod);
    }
}


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

using namespace std;
const int N=3e5+5;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    double cur=a[0];
    for(int i=1;i<n;i++)
    {
        cur+=a[i];
        cur/=2;
        //cout<<cur<<endl;
    }
    cout<<fixed<<setprecision(6)<<cur<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int[] a = new int[3];
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if(c == 'a') a[0] += 1;
      if(c == 'b') a[1] += 1;
      if(c == 'c') a[2] += 1;
    }
    int m = Math.min(a[0], Math.min(a[1], a[2]));
    String ans = "YES";
    for(int i = 0; i < 3; i++) {
      if((a[i] != m) && (a[i] != (m + 1))) ans = "NO";
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 24212
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define opr iterator
typedef long long ll;
using namespace std;
int main()
{
	int r,d,tmp;
	cin>>r>>d>>tmp;
	for(int i=1;i<=10;i++)
	{
		tmp=r*tmp-d;
		cout<<tmp<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  else{
    return gcd(b,(a%b));
  }
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}
 
int main(){
  int a,b;
  cin>>a>>b;
  int ans=0,x=1;
  while(a>0){
    a/=b;
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from operator import itemgetter
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]
K.sort()
K.sort(key=itemgetter(1))
#B_C = list(map(list, zip(*K)))
A.sort()

changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break
if len(changed) < N:
    changed += [0]*(N-len(changed))
#print(changed.__len__(),A.__len__())
for i in range(N):
    if changed[i] <= A[i]:
        SUM = sum(changed[:i]) + sum(A[i:])
        print(SUM)
        exit()
else:
    print(sum(changed))


Measured memory_bytes: 28620
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long

int n,q;
ll num[123456]={};
ll b[123456],c[123456];
ll s=0;

int main(){
  scanf("%d",&n);
  //int tmp;
  int a;
  for(int i=0;i<n;i++){
    scanf("%d",&a);
    num[a]++;
    s+=a;}
  scanf("%d",&q);
  //int b,c;
  for(int i=0;i<q;i++){
    scanf("%lld%lld",&b[i],&c[i]);}
  for(int i=0;i<q;i++){
    s -= b[i]*num[b[i]];
    s += c[i]*num[b[i]];
    printf("%lld\n",s);
    num[c[i]]+=num[b[i]];
    num[b[i]]=0;}

  
  
  
  
  return 0;
}


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

typedef pair<int,int> P;
typedef pair<P,P> PP;

int main(){
  int T;
  cin >> T;
  while(T--){
    PP p[100];
    int n,x,y,a[16][16];
    fill(a[0],a[16],0);
    a[0][0] = 1;
    cin >> x >> y;
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> p[i].first.first >> p[i].first.second >> p[i].second.first >> p[i].second.second;
      if(p[i].first.first > p[i].second.first) swap(p[i].first.first,p[i].second.first);
      if(p[i].first.second > p[i].second.second) swap(p[i].first.second,p[i].second.second);
    }

    for(int i=0;i<=y;i++){
      for(int j=0;j<=x;j++){
        if(i < y){
          bool f = false;
          for(int k=0;k<n;k++){
            if(p[k].first.first == j && p[k].second.first == j && p[k].first.second == i && p[k].second.second == i+1){
              f = true;
              break;
            }
          }
          if(!f) a[i+1][j] += a[i][j];
        }
        if(j < x){
          bool f = false;
          for(int k=0;k<n;k++){
            if(p[k].first.first == j && p[k].second.first == j+1 && p[k].first.second == i && p[k].second.second == i){
              f = true;
              break;
            }
          }
          if(!f) a[i][j+1] += a[i][j];
        }
      }
    }

    if(a[y][x] == 0) cout << "Miserable Hokusai!" << endl;
    else cout << a[y][x] << endl;
  }
}

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

int main(void) {
  int N;
  cin >> N;
  int b[N],x;
  bool flag=true;
  for(int i=0;i<N;i++){
    cin >> b[i];
    x=0;
    flag=true;
    while(flag){
		if(b[i]%2==0){
			b[i]/=2;
			x++;
		}else{
			flag=false;
			b[i]=x;
			//break;
		}
	}
  }
  
  x=0;
  for(int i=0;i<N;i++){
  	x+=b[i];
  }

  cout << x << endl;
  return 0;
}


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

A = []
for i in range(N):
  A.append(input())
  
B = []
for i in range(M):
  B.append(input())
  
def match(a,b):
  for i in range(M):
    for j in range(M):
      if A[a+i][b+j] != B[i][j]:
        return False  
  return True

for i in range(N-M+1):
  for j in range(N-M+1):
    if match(i,j):
      print("Yes")
      exit(0)
      
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int NumStr(string str)
{
		int n = str.size();
	int sum = 0;
	for(int i=0; i<n; i++){
		if(str[i] == 'A')sum += (pow(4.,i) * 1);
		else if(str[i] == 'C')sum += (pow(4.,i) * 2);
		else if(str[i] == 'G')sum += (pow(4.,i) * 3);
		else if(str[i] == 'T')sum += (pow(4.,i) * 4);
	}
	return sum;
}

void InsertFlag(vector<bool> &flag,string str)
{
	int num_str = NumStr(str);
	flag[num_str] = true;
}

void FindFlag(const vector<bool> &flag,string str)
{
	int num_str = NumStr(str);
	if(flag[num_str] == true)cout << "yes" << endl;
	else if(flag[num_str] == false)cout << "no" << endl;
}

int main()
{
	int n;
	cin >> n;
	vector<bool> flag;
	flag.resize(16777216);

	for(int i=0; i<n; i++){
		string command, str;
		cin >> command >> str;
		if(command == "insert")InsertFlag(flag, str);
		else if(command == "find")FindFlag(flag, str);
	}
}

Measured memory_bytes: 3116
def main():
    A, B, C = input_ints()
    K = input_ints()

    while K > 0:
        if A >= B:
            B *= 2
        elif B >= C:
            C *= 2

        K -= 1

    if A < B < C:
        print('Yes')
    else:
        print('No')


def input_ints():
    line_list = input().split()

    if len(line_list) == 1:
        return int(line_list[0])
    else:
        return map(int, line_list)


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()


Measured memory_bytes: 9128
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;
using PAIR = pair<string, int>;

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    ll ans = 0;
    //左からl個、右からr個取り出す
    for (ll l = 0; l <= min(k, n); l++)
    {
        for (ll r = 0; r <= min(k - l, n - l); r++)
        {
            ll d = k - r - l;
            // cout << "l=" << l << ",r=" << r << ",d=" << d << endl;
            vector<ll> vec;
            ll tmp = 0;
            // cout << "AAAAAAAAA" << endl;
            for (ll i = 0; i < l; i++)
            {
                vec.push_back(v[i]);
                tmp += v[i];
            }
            // cout << "AAAAAAAAA" << endl;
            for (ll i = 0; i < r; i++)
            {
                vec.push_back(v[n - 1 - i]);
                tmp += v[n - 1 - i];
            }
            // cout << "AAAAAAAAA" << endl;
            sort(vec.begin(), vec.end());
            // if (l == 2 && r == 1)
            // {
            //     for (int i = 0; i < vec.size(); i++)
            //     {
            //         cout << vec[i] << " ";
            //     }
            //     cout << endl;
            // }
            // for (int i = 0; i < vec.size(); i++)
            // {
            //     cout << vec[i] << " ";
            // }
            // cout << endl;
            ll x = vec.size();
            for (ll i = 0; i < min(d, x); i++)
            {
                if (vec[i] < 0)
                {
                    tmp -= vec[i];
                }
            }
            ans = max(ans, tmp);
            // cout << ans << endl;
        }
    }
    cout << ans << endl;

    return 0;
}

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

      

Measured memory_bytes: 3552
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<climits>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define all(v) v.begin(),v.end()
#define EPS 1e-9
const ll mod = 1000000007;
const ll OO = (ll)1e18;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); }
ll fast_power(double base, ll power){
	if (power == 1) return base;
	if (power % 2 == 0) return fast_power((base*base), power / 2);
	else return(base*fast_power((base*base), power / 2));
}
//#pragma warning (disable : 4996)
void Qalbaz()
{
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(2);
}

int main(){

	Qalbaz();

	int n;
	cin >> n;
	char x;
	int c = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		if (x == 'Y')
			c = 1;
	}
	if (c)
		cout << "Four";
	else
		cout << "Three";
	
	return 0;
}

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





int main() 
{
  ll H,W; cin>>H>>W;
  vector<string> Grid(H);
  rep(i,H)
  {
    cin>>Grid.at(i);
  }
  
  
  vector<ll> tatejiku(0);
  string hoge="";
  rep(i,W)
  {
    hoge+=".";
  }
  rep(i,H)
  {
    if(Grid.at(i)!=hoge) {tatejiku.push_back(i);}
  }
  
  
  
  vector<ll> yokojiku(0);
  rep(i,W)
  {
    rep(j,H)
    {
      if(Grid.at(j).at(i)=='#') {yokojiku.push_back(i); break;}
    }
  }
  
  
  for(auto p:tatejiku)
  {
    for(auto q:yokojiku)
    {
      cout<<Grid.at(p).at(q);
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 998244353
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

const int N = 222222;
pair<int, int> ro[N];
int stree[N << 2];
int dp[N];
int n;

void update(int i, int cl, int cr, int v, int pos) {
    if(cl > i || cr < i) {
        return;
    } else if(cl == i && cr == i) {
        stree[pos] = v;
        return;
    }
    int m = cl + cr >> 1;
    update(i, cl, m, v, pos * 2 + 1);
    update(i, m + 1, cr, v, pos * 2 + 2);
    stree[pos] = max(stree[pos * 2 + 1], stree[pos * 2 + 2]);
}

int query(int l, int r, int cl, int cr, int pos) {
    if(cl > r || cr < l) {
        return 0;
    } else if(cl >= l && cr <= r) {
        return stree[pos];
    }
    int m = cl + cr >> 1;
    int x = query(l, r, cl, m, pos * 2 + 1);
    int y = query(l, r, m + 1, cr, pos * 2 + 2);
    return max(x, y);
}

int getIndBefore(int x) {
    int lo = 1, hi = n;
    while(lo < hi) {
        int mid = lo + (hi - lo + 1) / 2;
        if(x <= ro[mid].fi) {
            hi = mid - 1;
        } else {
            lo = mid;
        }
    }
    return hi;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 1, n) {
        int x, d;
        cin >> x >> d;
        ro[i] = {x, d};
    }
    sort(ro + 1, ro + n + 1);
    rrep(i, 1, n) {
        int x = ro[i].fi, d = ro[i].se;
        int j = getIndBefore(x + d);
        int r = max(i, query(i, j, 1, n, 0));
        update(i, 1, n, r, 0);
    }
    dp[n + 1] = 1;
    rrep(i, 1, n) {
        int j = query(i, i, 1, n, 0);
        dp[i] = (dp[i + 1] + dp[j + 1]) % MOD;
    }
    cout << dp[1] << endl;
    return 0;
}


Measured memory_bytes: 9856
use std::io;
use std::cmp;


// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}



fn main() {
    let n = read_t_in_line::<i64>()[0];
    let mut minv = 1000000000000000000;
    for _ in 0..5 {
        minv = min(minv, read_t_in_line::<i64>()[0]);
    }
    let gs = (n + (minv - 1)) / minv;
    println!("{}" ,gs + 4);

}



Measured memory_bytes: 4352
N = int(input())
yen = 0
btc = 0
for _ in range(N):
    x, u = input().split()
    if u == 'JPY':
        yen += int(x)
    elif u == 'BTC':
        btc += float(x)
ans = yen + (btc * (38 * 10**4))
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

    bool ok;
    if (c - a - b >= 0) {
        ll v = c - a - b;
        ok = v * v > 4 * a * b;
    } else {
        ok = false;
    }

    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main() {
 int a[10];
 for (int i = 0; i<10; i++)
  std::cin >> a[i];
 for (int i = 0; i<3; i++)
  for (int j = i+1; j<10; j++)
   if (a[j] > a[i]) {
    int tmp = a[j];
    a[j] = a[i];
    a[i] = tmp;
   }
 for (int i = 0; i<3; i++)
  std::cout << a[i] << std::endl;
 return 0;
}

Measured memory_bytes: 3076
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

struct point{
  int b, c, d;
};

vector<vector<point>> points;
int n, m, q;

int dfs(int k, vi now, int last){
  int ret = 0;
  if(k == n){
    for(int i = 0; i < n; i++){
      for(int j = 0; j < points[i].size(); j++){
        if(now[points[i][j].b] - now[i] == points[i][j].c) ret += points[i][j].d;
      }
    }
    return ret;
  }
  for(int i = last; i <= m; i++){
    vi temp = now;
    temp.push_back(i);
    ret = max(ret, dfs(k+1, temp, i));
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  cin >> n >> m >> q;
  points = vector<vector<point>>(n);
  for(int i = 0; i < q; i++){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    points[a-1].push_back({b-1, c, d});
  }
  cout << dfs(0, vi{}, 1) << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3684
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, d) = get!(usize, usize);

    println!("{}", (n + 2 * d) / (2 * d + 1));
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 25 21:35:32 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n + 1);
    REP(i, n) std::cin >> a[i];
    Int mon = 1000, sto = 0;
    REP(i, n) {
        if (a[i] < a[i + 1]) {
            sto += mon / a[i];
            mon %= a[i];
        } else {
            mon += sto * a[i];
            sto = 0;
        }
    }
    std::cout << mon << std::endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

void solve(){
    int H, W;
    cin >> H >> W;
    vector<string> fi(H);
    REP(i,H) cin >> fi[i];
    REP(i,H) REP(j,W) if(fi[i][j] == '#'){
        bool ok = false;
        REP(d, 4){
            int nh = i + dx[d], nw = j + dy[d];
            if(nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if(fi[nh][nw] == '#') ok = true;
        }
        if(!ok){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

const long long inf = 1e9 + 7;

int main(){
	int n , k;
	cin >> n >> k;
	vector<int> h(n+1);
	for(int i = 1; i <= n; i++)cin >> h[i];
	
	vector<int> dp(100100 , inf);
	dp[0] = 0;
	dp[1] = 0;
	
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= i + k; j++){
			dp[j] = min(dp[j] , dp[i] + abs(h[i] - h[j]));
		}
	}
	
	cout << dp[n] << endl;
	
	return 0;
}
 

Measured memory_bytes: 3952