akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(1e9 + 7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans % mod;
}

vector<ll> FactorialInv, Factorial;

void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    Factorial[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}


//modの値の確認をすること
int main(){
    ll n;
    cin >> n;
    vector<ll> a(26),c(26);
    rep0(i, 26){
        cin >> a[i];
        c[i] = a[i];
    }
    rep0(i, n){
        rep0(j, 26)c[i] += a[i];
        ll ans = 0,m = -INF;
        rep0(j, 26){
            ll s;
            cin >> s;
            if(chmax(m,s + c[i] - a[i]))ans = j;
        }
        pf(ans + 1);
    }
    return 0;
}



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

void fun(long long int n)
{
    string str="";  
    while(n)
    {
        char x = 'a' + n%26 - 1;
        if(n%26==0)  
        {
            str.push_back('z');
            n=(n/26)-1;
        }
        else 
        {
            str.push_back(x);
            n/=26;
        }
    }
    reverse(str.begin(), str.end());
    cout<<str;
}

int main()
{
  long long int n;	cin>>n;
  fun(n);
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll GCD(ll a, ll b) {
  if (b == 0) return a;
  else return GCD(b, a%b);
}

void Main(){

  int a,b,c;

  cin>>a>>b>>c;

  cout<< ( c%GCD(a,b)==0  ? "YES" : "NO" )<<"\n";

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


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

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


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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
// using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
#define int ll
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define pii pair<int,int>
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define MAX 3003
#define initialize(arr,elem) memset(arr,elem,sizeof(arr))
#define sz size
const int MOD = 1e9+7;

// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n, arr[MAX], dp[MAX][MAX][2],visited[MAX][MAX][2];

int solve(int i, int j, int turn){
	if (i>j) return 0;
	if (i==j && turn){
		visited[i][j][turn] = 1;
		return dp[i][j][turn] = arr[i];
	}
	if (i==j && !turn){
		visited[i][j][turn] = 1;
		return dp[i][j][turn] = -arr[i];
	}
	if (visited[i][j][turn] !=-1) return dp[i][j][turn];

	if (turn){
		dp[i][j][turn] = max(arr[i] + solve(i+1,j,turn^1),arr[j] + solve(i,j-1,turn^1));
	} 
	else{
		dp[i][j][turn] = min(solve(i+1,j,turn^1)-arr[i],solve(i,j-1,turn^1)-arr[j]);
	}
	visited[i][j][turn] = 1;
	return dp[i][j][turn];
}

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


	cin>>n;
	For(i,1,n+1) cin>>arr[i];
	initialize(visited,-1);
	initialize(dp,0);
	cout<<solve(1,n,1)<<endl;
	return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pi;

const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

int main() {
    int N;
    cin >> N;
    int L[N];
    for(int i=0;i<N;i++){
        cin >> L[i];
    }
    sort(L,L+N);
    set<string> st;
    int result = 0;
    for(int i=0;i<N-2;i++){
        bool flag = true;
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]+L[j]>L[k]){
                    //string str = to_string(L[i])+to_string(L[j])+to_string(L[k]);
                    //st.insert(str);
                    result++;

                }

            }


        }

    }

    cout << result << endl;


}




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

int f(int x, int y, int z){
	return x*x + y*y + z*z + x*y + y*z + z*x;
}

int combi(int x, int y, int z){
	int cnt = 0;
	if(x == y) cnt++;
	if(y == z) cnt++;
	if(x == z) cnt++;
	if(cnt == 0) return 6;
	if(cnt == 1) return 3;
	else return 1;
}

int main() {
	
	
	int n; cin >> n;
	//int ans = 0;

	vector<int> a(2*n);

	for(int x = 1; x*x <= n; x++){
		for(int y = x; x*x + y*y + x*y <= n; y++){
			for(int z = y; x*x + y*y + z*z <= n; z++){
				a[f(x,y,z)] += combi(x,y,z);
			}
		}
	}
	
	for(int i =1; i <= n; i++){
		cout << a[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3664
void main() {
	auto N = ri;
	auto S = rs;
	int res = 0;
	int tmp = 0;
	foreach(i; S) {
		i == 'I' ? tmp++ : tmp--;
		res = max(res, tmp);
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { 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;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint fact(int n){
    if(n<=1) return 1;
    else{
        mint m = fact(n-1)*n;
        return m;
    }
}

int main(void){
    int n;
    cin >> n;

    int lp = n/3;
    mint ans = 0;
    for(int i=1;i<=lp;i++){
        int pre = n - i*3;
        //mint m = pre;
        //cout << m << endl;
        mint m = fact(pre+i-1);
        m /= fact(pre);
        m /= fact(i-1);
        //m = m.pow(i-1);
        //cout << m << endl;
        ans += m;
        //cout << "step" << i << ": " << pre << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    int n, d, a;
    vector<P> monster;
    int x, h;
    int i, j;
    int target, targetx, targeth;
    int mid;
    ll count;
    ll ans = 0;
    vector<int> damage(200010, 0);

    cin >> n >> d >> a;

    monster.emplace_back(0, 0);

    rep(i, 1, n + 1)
    {
        cin >> x >> h;
        monster.emplace_back(x, h);
    }

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

    rep(i, 1, n + 1)
    {
        damage[i] += damage[i - 1];

        if (damage[i] < monster[i].second)
        {
            target = i;
        }
        else
        {
            continue;
        }

        targetx = monster[target].first;
        targeth = monster[target].second - damage[target];

        count = (targeth + a - 1) / a;

        ans += count;

        int ok = 0, ng = n + 1;

        while (ng - ok > 1)
        {
            mid = (ok + ng) / 2;

            if (monster[mid].first <= targetx + d * 2)
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }
        damage[target] += count * a;
        damage[ng] += -count * a;
    }

    cout << ans << endl;
}

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

using ll = long long;

using tll = tuple<ll, ll, ll>;


template <unsigned int aa, unsigned int bb>
bool can_interchange(tll a, tll b){
    return -get<aa>(a) + get<bb>(a) + get<aa>(b) - get<bb>(b) > 0; }

template <unsigned int aa, unsigned int bb>
bool do_all_swaps(vector<tll>& a, vector<tll>& b){
    sort(begin(a), end(a), [](const tll& a, const tll& b){
        return -get<aa>(a) + get<bb>(a) < -get<aa>(b) + get<bb>(b); });
    sort(begin(b), end(b), [](const tll& a, const tll& b){
        return get<aa>(a) - get<bb>(a) < get<aa>(b) - get<bb>(b); });

    vector<tll> for_a, for_b;

    while(!a.empty() && !b.empty() && can_interchange<aa, bb>(a.back(), b.back())){
        for_a.push_back(b.back());
        for_b.push_back(a.back());
        a.pop_back();
        b.pop_back(); }
    a.insert(end(a), begin(for_a), end(for_a));
    b.insert(end(b), begin(for_b), end(for_b));
    return !for_a.empty(); }

template <unsigned int aa, unsigned int bb, unsigned int cc>
bool do_triple_swap(vector<tll>& a, vector<tll>& b, vector<tll>& c){
    sort(begin(a), end(a), [](const tll& a, const tll& b){
        return -get<aa>(a) + get<bb>(a) < -get<aa>(b) + get<bb>(b); });
    sort(begin(b), end(b), [](const tll& b, const tll& c){
        return -get<bb>(b) + get<cc>(b) < -get<bb>(c) + get<cc>(c); });
    sort(begin(c), end(c), [](const tll& c, const tll& a){
        return -get<cc>(c) + get<aa>(c) < -get<cc>(a) + get<aa>(a); });
    
    vector<tll> for_a, for_b, for_c;
    while(!a.empty() && !b.empty() && !c.empty() &&
        -get<aa>(a.back()) - get<bb>(b.back()) - get<cc>(c.back()) +
        get<bb>(a.back()) + get<cc>(b.back()) + get<aa>(c.back()) > 0){
        for_a.push_back(c.back());
        for_b.push_back(a.back());
        for_c.push_back(b.back());
        a.pop_back();
        b.pop_back();
        c.pop_back(); }
    a.insert(end(a), begin(for_a), end(for_a));
    b.insert(end(b), begin(for_b), end(for_b));
    c.insert(end(c), begin(for_c), end(for_c));
    return !for_a.empty(); }

        

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    ll rez = 0;

    vector<tll> X, Y, Z;

    for(ll i = 0, a, b, c; i < x; ++i){
        cin >> a >> b >> c;
        X.emplace_back(a, b, c); }

    for(ll i = 0, a, b, c; i < y; ++i){
        cin >> a >> b >> c;
        Y.emplace_back(a, b, c); }

    for(ll i = 0, a, b, c; i < z; ++i){
        cin >> a >> b >> c;
        Z.emplace_back(a, b, c); }


    bool done_something = true;
    do{
        done_something = false;
        done_something = (do_all_swaps<0, 1>(X, Y) || done_something);
        done_something = (do_all_swaps<0, 2>(X, Z) || done_something);
        done_something = (do_all_swaps<1, 2>(Y, Z) || done_something);
        done_something = (do_triple_swap<0, 1, 2>(X, Y, Z) || done_something);
        done_something = (do_triple_swap<2, 1, 0>(Z, Y, X) || done_something);
    } while(done_something);


    for(auto& x : X) rez += get<0>(x);
    for(auto& x : Y) rez += get<1>(x);
    for(auto& x : Z) rez += get<2>(x);
    

    cout << (rez) << endl;
    return 0; }


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

int main(){
	int n; cin >> n;
	vector<int> p(n);
	for(int i = 0; i < n; i++)
		cin >> p[i];
	sort(p.rbegin(), p.rend());
	int res = 0;
	for(int i = 1; i < n; i++)
		res += p[i];
	res += p[0] / 2;
	cout << res << endl;
}

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


using namespace std;

using ll = long long;

void solve() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
}

int main() {
    solve();
    return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll n,m;
  cin>>n>>m;
  vector<ll> k(m);
  vector<vector<ll>> s(m);
  rep(i,m){
    cin>>k[i];
    s[i].resize(k[i]);
    rep(j,k[i])cin>>s[i][j],s[i][j]--;
  }
  vector<ll> p(m);
  rep(i,m)cin>>p[i];

  ll ans = 0;
  rep(bi,1<<n){
    vector<ll> tmp(m);
    rep(i,m)rep(j,k[i])if((bi>>s[i][j])&1)tmp[i]^=1;
    ans += (p==tmp);
  }
  cout<<(ans)<<endl;

}

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

int main() {
	int A,B;
	cin >> A >> B;
	if(A==B) cout << "Draw";
	else if(A==1) cout << "Alice";
	else if(B==1) cout << "Bob";
	else {
		if(A > B) cout << "Alice";
		else if(A < B) cout << "Bob";
	}
	
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int min = 1000;
		for (int i = 0; i < n; i++) {
			int m = sc.nextInt();
			if (m < min) {
				min = m;
			}
			x -= m;
		}
		int div = x / min;
		System.out.println(n + div);
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    int a,b;
    int cnt=1;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    
    vector<int>hairetu;
    rep(i,n){
        hairetu.push_back(i+1);
    }
    
    
    do{
            if(hairetu == p) a = cnt;
            if(hairetu == q) b = cnt;
        cnt++;
        
    }while(next_permutation(hairetu.begin(),hairetu.end()));
    cout << abs(a-b) <<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;

int main(){
    int N , i , d;
    long long c , Sum = 0LL , Count = 0LL;
    scanf( "%d" , &N );

    for( i = 1 ; i <= N ; ++i ){
        scanf( "%d%lld" , &d , &c );
        Sum += d * c;
        Count += c; 
    }

    long long Ans = 9 * Count + Sum - 18LL;
    if( Ans % 9 == 0 ) Ans = Ans / 9LL;
    else Ans = ( Ans / 9LL ) + 1;
    printf( "%lld\n" , Ans );
    return 0;
}

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

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
  return 0;
}


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

int main()
{
	int a[3], k;
	scanf("%d%d%d%d", a, a + 1, a + 2, &k);
	std::sort(a, a + 3);
	a[2] <<= k;
	printf("%d\n", a[0] + a[1] + a[2]);

	return 0;
}

Measured memory_bytes: 256
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

n = int(input())
x = []
for i in range(n):
    ai = int(input())
    xi = []
    for j in range(ai):
        xi.append(list(map(int, input().split())))
    x.append(xi)

m = 0
for h in range(2**n - 1, -1, -1):
    is_break = False
    h = bin(h)[2:].zfill(n)
    for i, xi in enumerate(x):
        if h[i] == '0':
            continue
        for xij, yij in xi:
            if (int(h[xij - 1]) != yij):
                is_break = True
                break
        if is_break:
            break
    else:
        m = max(sum(map(int, list(h))), m)

print(m)




Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 200005;

template <class T>
void read (T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}
template <class T>
void write (T x) {
	if (x < 0) putchar('-'), write(-x);
	else if (x < 10) putchar(x + '0');
	else write(x / 10), putchar(x % 10 + '0');
}

int n, stk[N << 1], top = 0;
long long a[N << 1], b[N << 1], c[N << 1], d[N << 1];
double ans[N << 1];

int main () {
	read(n);
	for (int i = 0; i < n; i++) read(a[i]);
	for (int i = 0; i < n; i++) read(b[i]);
	for (int i = n; i < (n << 1); i++) a[i] = a[i - n], b[i] = b[i - n];

	c[0] = c[1] = 0ll;
	for (int i = 2; i < (n << 1); i++) c[i] = 2ll * (c[i - 1] + b[i - 1]) - c[i - 2]; 
	for (int i = 0; i < (n << 1); i++) d[i] = a[i] - c[i];

	for (int i = 0; i < (n << 1); i++) {
		while (top > 1) {
			long long cross = (d[i] - d[stk[top]]) * (stk[top] - stk[top - 1]) - (d[stk[top]] - d[stk[top - 1]]) * (i - stk[top]);
			if (cross >= 0) top--;
			else break;
		}
		stk[++top] = i;
	}

	for (int i = 1; i < top; i++) {
		for (int j = stk[i]; j <= stk[i + 1]; j++) {
			ans[j] = d[stk[i]] + c[j];
			ans[j] += (1.0 * d[stk[i + 1]] - 1.0 * d[stk[i]]) / (1.0 * stk[i + 1] - 1.0 * stk[i]) * (1.0 * j - 1.0 * stk[i]);
		}
	}

	double res = 0.0;
	for (int i = 0; i < n; i++) res += max(ans[i], ans[i + n]);
	res /= n;
	printf("%.12lf\n", res);
	return 0;
}

Measured memory_bytes: 20092
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - 怪文書 / Dubious Document
            int n = int.Parse(Console.ReadLine());

            var firstChars = GetCharacters();

            for (int i = 1; i < n; i++)
            {
                var chars = GetCharacters();

                var charList = firstChars.Keys.ToList();

                foreach(var c in charList)
                {
                    if (!chars.ContainsKey(c))
                    {
                        firstChars.Remove(c);
                    }
                    else
                    {
                        if (chars[c] < firstChars[c])
                        {
                            firstChars[c] = chars[c];
                        }
                    }
                }

                if (firstChars.Count == 0)
                {
                    Console.WriteLine("");
                    return;
                }
            }

            OutputCharacters(firstChars);
        }

        static void OutputCharacters(Dictionary<char,int> chars)
        {
            //[summary]解答のうち、辞書順の最小の文字列を出力

            var sortedChars = chars.OrderBy(x => x.Key);
            string result = "";

            foreach (var c in sortedChars)
            {
                string s = new string(c.Key, c.Value);
                result += s;
            }

            Console.WriteLine(result);
        }

        static Dictionary<char, int> GetCharacters()
        {
            //[summary]コンソールから文字列を読み込み、文字の種類と
            //それぞれの文字が何文字あるかの情報を返却

            var dic = new Dictionary<char, int>();

            string line = Console.ReadLine();
            var chars= line.ToCharArray();
            
            foreach (var c in chars)
            {
                if (!dic.ContainsKey(c))
                {
                    dic.Add(c, 1);
                }
                else
                {
                    dic[c]++;
                }
            }

            return dic;
        }
    }
}

Measured memory_bytes: 13268
from bisect import bisect_right
a, b = (int(x) for x in input().split())
if a <= 0 and 0 <= b: #0を含む
  print('Zero')
elif 0 < a and 0 < b: #すべて正
  print('Positive')
else: #すべて負
  print('Positive' if (b - a + 1)%2 == 0 else 'Negative')


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace algorithm
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToArray();
			int cnt = 0;
			char[] s = Console.ReadLine().ToCharArray();
			int[] ans = new int[s.Length+1];
			for(int i=0;i<s.Length-1;i++)
			{
				if (s[i] == 'A' && s[i+1] == 'C')cnt++;
				ans[i + 1] = cnt;

			}
			int[] a = new int[q[1]];
			for (int i = 0; i < q[1]; i++)
			{
				int[] tmp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToArray();
				a[i] = ans[tmp[1]-1] - ans[tmp[0]-1];
			}

			foreach (int y in a)
			{
				Console.WriteLine(y);
			}



		}
		
			
	}
}



Measured memory_bytes: 18880
/******************** Beginning of Template **************************/
/************ ALL HEADER FILE ***********/
//#include<bits/stdc++.h>
#include <iostream>
using namespace std;

/************************************ ALL DEFINE ****************************************************/
#define FORS(i, j, k, step) for (int i=j; i<k; i+=step)
#define FOR(i, j, k) for (int i=j; i<k; i++)
#define RFORS(i, j, k, step) for (int i=j; i>=k; i-=step)
#define RFOR(i, j, k, step) for(int i=j; i>=k; i--)
#define REP(i, k) for(int i = (0); i < (k); i++ )
#define RREP(i, k) for(int i = j; i >= (k); i-- )

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define RESET(a, b) memset(a, b, sizeof(a))
#define INF (int)MAX_INT
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007
#define fango using
#define ganteng namespace
#define sekali std

/*********************************Debug DEFINE  ********************************/
#define TESTING
//#define FILE_INPUT
//#define FILE_OUTPUT
/*********************************END of Debug DEFINE  ********************************/

#ifdef TESTING
#define VALUE(x) cout << ">>>> The value of " << #x << " is " << x << "<<<<" << endl
#define NEWLINE cout << "---------------------------------------------" << endl
#define DUMP_STR cout << ">>>>FANGO IS THE MOST HANDSOME MANKIND IN THE ENTIRE WORLD<<<<" << endl;
#define DUMP_CHAR cout << " YO ";
#endif //TESTING_ON_CONSOLE



/************************************ END OF DEFINE ****************************************************/

/************************************ ALL TYPEDEF ****************************************************/
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef long long int32;
typedef unsigned long long uint32;
typedef long long int int64;
typedef unsigned long long int uint64;



/************************************ ALL DEFINE ****************************************************/

/************************************ END OF PREHEADER ***********************************************/



void solve() {

	string s;
	cin >> s;
	int count = 0;

	int i = 0;
	int j = s.size() - 1;

	while (i < j) {
		if (s[i] != s[j]) {
			count++;
		}
		i++;
		j--;
	}

	cout << count;
}

int main() {

#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);

	int TC = 1;
	//cin >> TC;

	while (TC--) {

		solve();
	}
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 55 + 10;
#define fi first
#define se second
#define pb push_back
int n,m;
struct uzi{
  int s,t,i;
}p[N];
vector<int>v[N];
vector<int>g[N][N];
int b[51][51],pre[N];
void dfs(int x,int y){
  pre[x]=y;
  for(auto k:v[x])if(k!=y){
      dfs(k,x);
    }
}
bitset<50>li[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  for(int i=1;i<n;i++){
    int s,t;
    cin>>s>>t;
    v[s].pb(t);
    v[t].pb(s);
    b[s][t]=b[t][s]=i;
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++)pre[j]=0;
    dfs(i,0);
    for(int j=1;j<=n;j++){
      int now=pre[j];
      while(now){
        g[i][j].pb(now);
        now=pre[now];
      }
    }
  }
  cin>>m;
  LL ans=1ll<<n-1;
  // cout<<ans<<endl;
  for(int i=0;i<m;i++){
    cin>>p[i].s>>p[i].t;
    int S=p[i].s,t=p[i].t;
    for(auto z:g[S][t]){
      li[i].set(b[t][z]-1);
      //if(i==2)cout<<t<<' '<<z<<endl;
      t=z;
    }
  }
  for(int i=1;i<1<<m;i++){
    vector<int>x;

    for(int j=0;j<m;j++){
      if(1<<j&i) {
        x.pb(j);
      }
    }
    int y=__builtin_popcount(i)&1?-1:1;
    set<int>s;
    for(int j=1;j<n;j++)s.insert(j);
    bitset<50>ggx;ggx.reset();
    for(auto k:x){
      ggx|=li[k];
    }
    ans+=y*(1ll<<(n-1-ggx.count()));
    //cout<<i<<' '<<y*(1<<n-s.size()-1)<<endl;
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=acos(-1.0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;cin>>n;
    ll v[n+1];
    fill(v,v+n+1,0);
    rep(j,2,n+1){
        ll nn=j;
        for(int i=2;i*i<=nn;i++){
            
        ll sum=0;
        while(nn%i==0){
            sum++;
            nn/=i;
        }
            v[i]+=sum;
    }
        if(nn!=1)v[nn]++;
    }
            
   // if(n!=1)v.push_back(1);
    ll ans=1;
    rep(i,0,n+1){
        ans*=(v[i]+1);
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long LL;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = (LL)INF * INF;

string s[50];
int t[50];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	FOR(i, 0, n)
		cin >> s[i] >> t[i];
	string x;
	cin >> x;
	int ans = 0;
	RFOR(i, n, 0)
	{
		if(s[i] == x)
			break;
		ans += t[i];
	}
	cout << ans << "\n";
	return 0;
}


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

int N, W;
int w[101];
long long v[101];
long long dp[101][100001];

void solve(){
	for(int i = N-1; i >= 0; i--){
		for(int j = 0; j <= W; j++){
			if(j < w[i]){
				dp[i][j] = dp[i+1][j];
			}
			else{
				dp[i][j] = max(dp[i+1][j], dp[i+1][j-w[i]] + v[i]);
			}
		}
	}
	cout << dp[0][W] << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> W;
	for(int i = 0; i < N; i++)
		cin >> w[i] >> v[i];
	solve();
	return 0;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(5);
  for (int i=0; i<5; i++){
    cin >> a[i];
  }
  int k;
  cin >> k;
  sort(a.begin(),a.end());
  if (a[4]-a[0] <= k){
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

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

#define pb push_back
#define MAX 100005
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

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

string s,t;
int dp[3005][3005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s>>t;
    for(int i = 0; i<3005; ++i)
        dp[0][i]=dp[i][0]=0;
    for(int i = 1; i<=s.size(); ++i){
        char x = s[i-1];
        for(int j = 1; j<=t.size(); j++){
            char y = t[j-1];
            if(x==y)
                dp[i][j] = dp[i-1][j-1]+1;
            else{
                dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
            }
        }
    }
    int i = s.size(), j = t.size();
    vector<char> ans(dp[i][j]);
    int act = dp[i][j]-1;
    while(i&&j){
        char x = s[i-1], y = t[j-1];
        if(x==y){
            ans[act]=x;
            i--,j--,act--;
        }
        else if(dp[i][j]==dp[i][j-1])j--;
        else i--;
    }
    for(int i =0 ; i<ans.size(); ++i)
        cout<<ans[i];
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=2010;
char s[N][N];
int w[N][N],a[N][N],b[N][N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,m,Q;
    cin>>n>>m>>Q;
    for(int i=1;i<=n;i++) {
	scanf("%s",s[i]+1);
	for(int j=1;j<=m;j++) s[i][j]-='0';
    }
    for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++) {
	    w[i][j]=w[i-1][j]+w[i][j-1]-w[i-1][j-1]+s[i][j];
	    a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+(s[i][j]&s[i][j+1]);
	    b[i][j]=b[i-1][j]+b[i][j-1]-b[i-1][j-1]+(s[i][j]&s[i+1][j]);
	}
    while(Q--) {
	int x=gi(),y=gi(),X=gi(),Y=gi();
	int A=w[X][Y]-w[x-1][Y]-w[X][y-1]+w[x-1][y-1],
	    B=a[X][Y-1]-a[x-1][Y-1]-a[X][y-1]+a[x-1][y-1],
	    C=b[X-1][Y]-b[x-1][Y]-b[X-1][y-1]+b[x-1][y-1];
	printf("%d\n",A-B-C);
    }
    return 0;
}

Measured memory_bytes: 53120
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
long long read()
{
	long long f=1,x=0; char c=getchar();
	while (c>'9'||c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0' && c<='9') {x=x*10+c-'0'; c=getchar();}
	return x*f;
}
long long gcd(long long A,long long B)
{
	if (A%B==0) return B;
	return gcd(B,A%B);
}
long long ANS;
long long A,B,N,S;
int main()
{
	N=read();S=read();
	for (int i=2; i<=N; i++) {
		A=read();
		S=S/gcd(S,A)*A;
	}
	printf("%lld\n",S);
	return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

struct RL {
    int pos, r, l;
    RL(int r = 0, int l = 0) : pos(0), r(r), l(l) {}

    int get_l() { return r / 2 + (l + 1) / 2; }
    int get_r() { return (r + 1) / 2 + l / 2; }
};

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

    string s;
    cin >> s;

    vi ans(s.size(), 0);
    int rpos = -1, rcnt = 0, lcnt = 0;
    bool r = true;

    rep(i, 0, s.size()) {
        if (r) {
            if (s[i] == 'R') {
                ++rcnt;
            } else {
                rpos = i - 1;
                r = false;
                ++lcnt;
            }
        } else {
            if (s[i] == 'L') {
                ++lcnt;
            } else {
                ans[rpos] = (rcnt + 1) / 2 + lcnt / 2;
                ans[rpos + 1] = rcnt / 2 + (lcnt + 1) / 2;
                r = true;
                rcnt = 1;
                lcnt = 0;
            }
        }

        if (i == (int)s.size() - 1) {
            ans[rpos] = (rcnt + 1) / 2 + lcnt / 2;
            ans[rpos + 1] = rcnt / 2 + (lcnt + 1) / 2;
        }
    }

    rep(i, 0, s.size()) { cout << ans[i] << " "; }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9+7;

//-------------------------<MATH>-------------------------------------------------------//
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;
ll c = (a * b)%mod;
//cout << a << " " << b << endl;
return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(5e5 + 5)] , inv_fac[(int)(5e5 + 5)];
void precomp_factorial(int M){fac[0] = 1;for(int i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(int i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int lo[(int)(1e3 + 6)];
void sieve(int M){for(int i = 2 ; i < M ; i++){ if(lo[i]) continue; for(int j = i ; j < M ; j += i)lo[j] = i;}}
int max_expo_prime_n_fac(ll N , int prime){int ress = 0;while(N){ress += (N/prime);N /= prime;}return ress;}
//-------------------------</MATH>-------------------------------------------------------//

//-------------------------<STRING>-------------------------------------------------------//
string get_prefix(string x , int MAX){return x.substr(0 , min((int)x.size() , MAX));}
string get_suffix(string x,int MAX){int dn=1;for(int i=x.size()-1;i>=0;i--){if(dn==MAX)return x.substr(i);dn++;}return x;}
string convert_to_binary(int x,int len) {string ans=""; while(x){if(x&1){ans='1'+ans;}
    else{ans ='0'+ans;}x/=2;}int k = ans.size();while(k < len){ans = '0' + ans;k++;}return ans;}
//-------------------------</STRING>-------------------------------------------------------//

ull llrand() {ull r = 0;for(int i = 0; i < 5; ++i){r = (r << 15)|(rand() & 0x7FFF);}return r & 0xFFFFFFFFFFFFFFFFULL;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
const int M = 60;

int divisors[12345678];

void pre(){
     for(int i = 2; i <= 1e7; i++){
         divisors[i] += 2;
             for(int j = 2*i; j <= 1e7; j += i){
                 divisors[j]++;
             }
     }

}
int main(){

    pre();
    int n;
    cin >> n;
    ll sum = 1LL;
    for(ll i = 2LL;  i <= n; i++){
         sum += i*divisors[i];
    }
    cout << sum;
    
}






Measured memory_bytes: 42688
#include<iostream>
#include<cstdio>
#include<iomanip>

using namespace std;

const int MAX_N = 100;

int N;
double A[MAX_N+1];

void solve() {
    double bunbo = 0.0;
    for (int i=0; i < N; i++) {
        bunbo += (double)(1.0 / A[i]); 
    }
    double ans = (double)(1.0 / bunbo);
    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int A[3];
  	cin >> A[0] >> A[1] >> A[2];

  	sort(A, A+3);

  	if(A[0]==A[2]){
  		cout << "No" <<endl;
  	}else if(A[0]==A[1] || A[1]==A[2]){
  		cout << "Yes" <<endl;
  	}else{
  		cout << "No" <<endl;
  	}

    
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int n,a[100]={0};
   cin >> n;
   for(int i = 0; i < n; i++){
       cin >> a[i];
   }
   for(int i = n-1; i >= 0; i--){
   cout<<a[i];
   if(i>0){
     cout<<" ";
   }
  } 
   cout<<endl;
}


Measured memory_bytes: 3060
#include <stdio.h>

#define N 100
#define MAX_COST 2001

void prim(int);

int graph[N][N], seen[N], cost=0       ;

int main(){
  int n, a, b;
  scanf("%d",&n);
  for(a = 0; a < n; a++){
    for(b = 0; b < n; b++){
      scanf("%d",&graph[a][b]);
    }
    seen[a] = 0;
  }
 
  prim(n);
  printf("%d\n",cost);
  return 0;
}

void prim(int n){
  int a, b, mincost=MAX_COST, x, y;
  y = n-1;
  seen[0] = 2;
  while(1){
    mincost = MAX_COST;
    for(a = 0; a < n; a++){
      if(seen[a] != 2) continue;
      for(b = 0; b < n; b++){
	if(graph[a][b] != -1 && seen[b] != 2){
	  if(mincost > graph[a][b]){
	    mincost = graph[a][b];
	    x = b;
	  }
	}
      }
    }
    cost += mincost;
    seen[x] = 2;
    y--;
    if(y == 0) break;
  }
  
}



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

 ll i,j,k;
    ll n;
ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

void f(ll rest, string s,ll maxnum)
{
    if(rest==0)
    {
         cout <<s  << endl;
    }else
    {

        for(ll i=0; i<=maxnum+1; i++) 
        {
            f(rest-1,s+char('a'+i),max(maxnum,i));
            //  cout<<char('a'+n)<<endl;
        }
    }
}
int main() {
   ll i,j,k;
    ll n;
    string r;
    cin >> n;
    // cout<<char('a'+n)<<endl;
   f(n,"",-1);
}


Measured memory_bytes: 1536
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    _n: usize,
    p: i64,
    s: chars,
  }
  let s: Vec<_> = s.into_iter().map(|c| c as i64 - '0' as i64).collect();
  let ans = if p == 2 || p == 5 {
    let mut ans = 0;
    for (i, &x) in s.iter().enumerate() {
      if x % p == 0 {
        ans += i as i64 + 1;
      }
    }
    ans
  } else {
    use std::collections::BTreeMap;
    let mut popl = BTreeMap::new();
    let mut pow = 1;
    let mut sum = 0;
    popl.insert(0, 1);
    for &x in s.iter().rev() {
      sum = (sum + x * pow) % p;
      pow = pow * 10 % p;
      *popl.entry(sum).or_insert(0) += 1;
    }
    popl.values().map(|&a| a * (a - 1) / 2).sum()
  };

  puts!("{}\n", ans);
}


Measured memory_bytes: 6396
#include <stdio.h>

int kCard_MaxValue(int a[],int n,int k){
	int res = -1, sum, i, j;

	for(i = 0;i < n - k + 1;i++){
		sum = 1;
		for(j = 0;j < k;j++){
			sum = sum * a[i + j];
		}
		
		if(sum > res){
			res = sum;
		}
	}
	return res;
}

void swap(int *a,int *b){
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int main(void){
	int i, j, n, k, ckd, ck, a[100], ans;
	while(1){
		scanf("%d%d",&n,&k);
		ans = -1;
		if(n == 0 && k == 0){
			break;
		}
		for(i = 0;i < n;i++){
			scanf("%d",&a[i]);
		}
		ckd = kCard_MaxValue(a,n,k);

		for(i = 0;i < n;i++){
			for(j = 0;j < n;j++){
				swap(&a[i],&a[j]);
				ck = kCard_MaxValue(a,n,k);
				if(ck - ckd > ans){
					ans = ck - ckd;
				}
				swap(&a[i],&a[j]);
			}
		}
		if(ans == -1){
			printf("NO GAME\n");
		}else{
			printf("%d\n",ans);
		}

	}

	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
const int N = 205;
typedef long long ll;
struct node
{
    int a;
    int b;
} p[N],q[N];
int vis[N];
bool cmp(node x,node y)
{
    if(x.a!=y.a)
        return x.a<y.a;
    else
        return x.b<y.b;
}

int main()
{
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        scanf("%d%d",&p[i].a,&p[i].b);
    for(int i=1; i<=n; i++)
        scanf("%d%d",&q[i].a,&q[i].b);
    memset(vis,0,sizeof(vis));
    sort(p+1,p+n+1,cmp);
    sort(q+1,q+n+1,cmp);
    int cnt=0;
    //贪心用最小的q去装最大的p
    for(int j=1; j<=n; j++)
    {
        int mid=-1,flag=0;
        for(int i=1; i<=n; i++)
        {
            if(!vis[i]&&p[i].a<q[j].a&&p[i].b<q[j].b)   //先保证存在
            {
                flag++;
                if(flag==1)
                    mid=i;
                else if(p[i].b>p[mid].b)
                    mid=i;
            }
        }
        if(mid>0)
        {
            vis[mid]=1;
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 256