akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<ll> enum_div(ll n) {
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, M, K;
    cin >> N >> M >> K;

    auto solve = [&]() {
        REP(i, N + 1) {
            REP(j, M + 1) {
                if (i * (M - j) + j * (N - i) == K) return true;
            }
        }
        return false;
    };

    YESNO(solve(), "Yes", "No");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main(){
	int x,y;
	cin>>x>>y;
	if(y%2==1){//odd is not able
		cout<<"No\n";
	}else{
		if(x*2<=y&&x*4>=y){
			cout<<"Yes\n";
		}else{
			cout<<"No\n";
		}
	}


	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

vector<pair<int, string>> data;
signed main(void)
{
	while(1) {
		int n;
		cin >> n;
		if(!n) break;
		data.erase(ALL(data));
		REP(i, n) {
			string s;
			cin >> s;
			string t{s[s.size()-1]};
			data.PB({s.size()-1, t});
		}
		//for(auto i: data) {cout << i.first << " " << i.second << endl;}
		//cout << endl;
		while(data.size() > 1) {
			//cout << "size:" << data.size() << endl;
			int ma = -1, idx = 0;
			REP(i, data.size()) {
				if(ma <= data[i].first) {idx = i; ma = data[i].first;}
			}
			//cout << idx << " " << ma << endl;
			int b = idx;
			VI a;
			while(data[idx].first == ma) {a.PB(stoi(data[idx].second)); idx--;}
			//cout << idx << " " << data[idx].second << endl;

			int tmp;
			if(data[idx].second == "+") tmp = 0;
			else tmp = 1;
			for(int i: a) {
				if(data[idx].second == "+") tmp += i;
				else tmp *= i;
			}
			//cout << tmp << endl;
			data[idx].second = to_string(tmp);
			//for(auto i: data) {cout << i.first << " " << i.second << endl;}
			//cout << endl;
			data.erase(data.begin()+idx+1, data.begin()+b+1);
			//for(auto i: data) {cout << i.first << " " << i.second << endl;}
			//cout << endl;
		}
		cout << data[0].second << endl;
	}

	return 0;
}

Measured memory_bytes: 3212
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();


        if ((B-A) % 2 == 0) {
            System.out.println("Alice");
        } else {
            System.out.println("Borys");
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

ll a[51];	// バーガーの厚さ
ll p[51];	// パティの総数

ll f(int n, ll x){
	if (x == 1LL){
		return (n == 0 ? 1LL : 0LL);
	}else
	if (1LL < x && x <= a[n-1] + 1LL){
		return f(n - 1, x - 1LL);
	}else
	if (x == a[n-1] + 2LL){
		return p[n-1] + 1LL;
	}else
	if (a[n-1] + 2LL < x && x <= 2LL * a[n-1] + 2LL){
		return p[n-1] + 1LL + f(n - 1, x - a[n-1] - 2LL);
	}else
	if (x == 2LL * a[n-1] + 3LL){
		return 2LL * p[n-1] + 1LL;
	} // end if
}


int main()
{
	memset(a, 0LL, sizeof(a));
	memset(p, 0LL, sizeof(p));

	a[0] = 1LL;
	p[0] = 1LL;
	for (int i = 1; i <= 50; ++i){
		a[i] = 2LL * a[i-1] + 3LL;
		p[i] = 2LL * p[i-1] + 1LL;
	} // end for

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N; ll X; cin >> N >> X;
	
	ll res = f(N, X);
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> H(n+1, 0LL);
    REP(i,n) cin >> H[i];
    H[n]=1e18;

    bool ok = true;
    bool can = true;
    for(int i=0; i<n; i++){
        if(H[i]>H[i+1]+1){
            ok = false;
            break;
        }
        else if(H[i]==H[i+1]+1){
            if(can == false){
                ok = false;
                break;
            }
            else{
                H[i]--;
                can = false;
            }
        }
        else if(H[i]==H[i+1]){
            if(can==false){
                continue;
            }
            else{
                H[i]--;
                can = true;        
            }
        }
        else{
            H[i]--;
            can = true;
        }
    }
    // for(int i=0; i<n; i++) cout << H[i] << " ";
    // cout << endl;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)

int main() {
  string S;
  cin >> S;
  if(S == "ABC"){
    cout << "ARC" << endl;
  }
  else{
    cout << "ABC" << endl;
  }
  return 0;
}

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

string divide[4] = {"dream","dreamer","erase","eraser"};

int main() {
string S;
  cin >> S;
  
  reverse(S.begin(), S.end());
  for(int i = 0; i < 4; i++) reverse(divide[i].begin(), divide[i].end());
  
  bool can = true;
  for ( int i = 0; i < S.size();) {
    bool can2 = false;
    for (int j = 0; j < 4; j++){
      string d = divide[j];
      if (S.substr(i, d.size()) == d){
        can2 = true;
        i += d.size();
      }
    }
    if (!can2) {
      can = false;
      break;
    }
  }
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main(){
    int A,B, K, a, b;
    cin >> A >> B;

    a = A - K;
    b = B - K;

    K = (A + B) / 2;
    if((A + B) % 2 == 0){
        cout << K << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    
}

Measured memory_bytes: 256
//### In The Name Of GOD ###

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

const int MOD = 1000000007;
const int INF = 30 * 1000 + 20;
const int MAXN = 2600;
const int MLOG = 18;
const int NMAX = 60;

#define int ll
#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
#define ct(x) const_cast<const int&>(x)

signed main(){
	int x;
	cin >> x;
	int ans = 1;
	for(int i = 2; i <= x; i++){
		int ii = i*i*i;
		while(ii <= x){
			ii*=i;
		}
		ii/=i;
		if(ii <= x)
		ans = max(ans, ii);
	}
	cout << ans;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T>
ll FindErase(vector<T> &v,T tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(vector<T> &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}
array<ll,100001> v;
array<ll,100001> dif;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll t,n,k;
  auto init = v;
  cin >> t;
  rep(q,t){
    cin >> n >> k;
    v = init;
    dif = init;
    ll sum = 0;
    rep(i,n){
      cin >> v[i];
    }
    REP(i,1,n){
      dif[i] = v[i] - v[i-1];
      sum += dif[i];
    }
    sort(all(dif),greater<ll>());
    rep(i,k-1){
      sum -= dif[i];
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 5472
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
void solve(){
	ll x;
	cin >> x;
	ll cnt = 1;
	ll ans = 0;
	while (x) {
		x = x / 2;
		ans += cnt;
		cnt <<= 1ll;
	}
	cout << ans;
}
int main(){
	speed;
	int t = 1;
	//cin >> t;
	while(t--) solve();
}

Measured memory_bytes: 256
//***********************
    //*** writer : Alan Hu **
    //***********************
    #include<iostream>
    #include<vector>
    #include<string>
    #include<set>
    #include<map>
    #include<algorithm>
    #include<queue>
    #include<list>
    #include<stack>
    #include<cstdio>
    #include<fstream>
    #include<numeric>
    #include<functional>
    #include<utility>
    #include<memory>
    #include<cstring>
    #include<cmath>
    using namespace std;
     
    #define CLEAN(a,b) memset(a,b,sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
     
    typedef long long ll;
    typedef pair<int, int> pii;
     
    int main()
    {
    	ll a,b=0,c;
    	cin>>a;
    	c=a;
    	while (a>0)
    	{
    		int x=a%10;
    		b+=x;
    		a/=10;
    	}
    	if (c%b==0) cout<<"Yes"<<endl;
    	else cout<<"No"<<endl;
    	return 0;
    }

Measured memory_bytes: 256
n = int(input())
number = list(map(int, input().split()))

box = []
for i in range(n):
    if number[i] % 2 == 0:
        box.append(number[i])

for j in box:
    if j % 3 ==0:
        continue
    elif j % 5 ==0:
        continue
    else:
        print("DENIED")
        exit()
else:
    print("APPROVED") 

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <cctype>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	vector<int> n(5);
	int k;
	REP(i, 5) cin >> n[i];
	cin >> k;
	bool can = true;
	REP(i, 4) {
		REPS1(j, 4) {
			if (n[j] - n[i] > k) {
				cout << ":(" << endl;
				return 0;
			}
		}
	}
	cout << "Yay!" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

char c[8][8];
int ans;

int main() {
    ios_base::sync_with_stdio(0);
    int h, w, g; cin >> h >> w >> g;
    for (int i=0;i<h;i++) for (int j=0;j<w;j++) cin >> c[i][j];

    for (int i=0;i<(1<<h);i++) {
        for (int j=0;j<(1<<w);j++) {
            int cnt = 0;
            for (int k=0;k<h;k++) {
                for (int l=0;l<w;l++) {
                    if (c[k][l]=='#'&&((1<<k)&i)&&((1<<l)&j)) cnt++;
                }
            }
            if (cnt==g) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mod ((ll)1e9+7)
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3f
#define Ninf -0x3e3e3e3f
#define Ninfl -0x3e3e3e3e3e3e3e3f
#define maxx ((ll)1e5+5)
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
ll add(ll x, ll y) { x += y; if (x >= mod) return x-mod; return x;}
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + mod; return x;}
ll mult(ll x, ll y) { return (x * y) % mod;}
ll rev(ll x) { return expm(x, mod - 2);}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[maxx]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<maxx;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncrm(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
ll inv[maxx];   // returns the modular inverse of number
void inversify( ll m){inv[1]=1;for(int i=2;i<maxx;i++){inv[i]= m- m/i*inv[m%i]%m;}}
ll ncr(ll n,ll r,ll m){int ans=1;for (int i = 0; i < r; i++){ans=ans*(n-i)%m*inv[i+1]%m;}return ans;}
*/
signed main(){
  fast;
  //test
  {
    int n;
    cin>>n;
    vector<int> v;
    vector<int> fre(2*n);
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        if(temp>n-2)
            temp=n-1;
        v.push_back(temp);        
        fre[(i+temp)]++; 
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=(i-v[i]>=0)?fre[i-v[i]]:0;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

typedef struct edge_def {
  int from;
  int to;
  int cost;

  edge_def(int _from, int _to, int _cost) {
    from = _from;
    to   = _to;
    cost = _cost;
  }
} edge;

const int INF = INT_MAX;
const int V = 10000;
int n, t;
vector<edge> es[V];
int d[V];

void dijkstra(int s) {
  int i;
  priority_queue<PII, vector<PII>, greater<PII > > q;
  for (i=0; i<n; i++) d[i] = INF;
  d[s] = 0;
  q.push(PII(0, s));

  while (q.size()) {
    PII p = q.top();
    q.pop();
    int v = p.second;

    if (d[v] < p.first) continue;

    for (i=0; i<(int)es[v].size(); i++) {
      edge e = es[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost; 
        q.push(PII(d[e.to], e.to));
      }
    }
  }
}

int main() {
  int i, j, k;
  int u, v, c;
  for (i=0; i<V; i++) es[i].clear();

  scanf("%d ", &n);
  for (i=0; i<n; i++) {
    scanf("%d%d ", &u, &k);
    for (j=0; j<k; j++) {
      scanf("%d%d ", &v, &c);
      es[u].psb(edge(u, v, c));
    }
  }

  dijkstra(0);

  for (i=0; i<n; i++) {
    printf("%d %d\n", i, d[i]);
  }

	return 0;
}

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

void solve() {
    int n;
    cin >> n;
    vector<long long> pref(n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        long long x;
        cin >> x;

        sum += x;
        pref[i] = sum;
    }
    long long ans = 1e18;
    for (int i = 0; i < n - 1; i++) {
        long long temp = abs(sum - 2 * pref[i] + 0ll);
        ans = min(ans, temp);
    }
    cout << ans;


}


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


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

//vector…可変長、データの大きさに合わせてサイズを変える
//list…双方向リスト、要素を挿入、削除の多いとき
//forward_list
//array…固定長配列
//set…集合
//multiset
//bitset…2進数、固定長ビット列
//map…連想配列、キーと値を関連付ける
//multimap
//deque…双方向リスト
//stack…FILO, 深さ優先探索
//queue…FIFO, 幅優先探索
//priority_queue…格納された最大値から順に取り出す
//pair…二つの値を一組
//tuple…複数の値を一組

const int mod = 1e9+7;

template<typename T>
void remove(std::vector<T>& vector, char index) {
    vector.erase(vector.begin() + index);
}

template<class T>
T ma(std::vector<T> &v) {
    T maxi = 0;
    for(auto &i:v) maxi = max(maxi, i);
    return maxi;
}
template<class T>
T mi(std::vector<T> &v) {
    T mini = 0;
    for(auto &i:v) mini = min(mini, i);
    return mini;
}
template <class T>
T pow(T x, T y, T n = numeric_limits<T>::max()) {
    if(y == 0) return 1;
    if(y % 2 == 0) return pow((x * x) % n, y / 2);
    return (x * pow(x, y - 1)) % n;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    return !y ? x : gcd(x % y, y);
}

using Graph = vector<vector<int>>;

template <class T, class S>
class Edge {
  T to;  //辺の行き先
  S weight;  //辺の重み

public:
  Edge(T t, S w) : to(t), weight(w) {}
};

int ansi = 0;
ll ansl = 0;
double ansd = 0.0;

int accumul(int mul) {
  if (mul == 0) {
    return 1;
  } else {
    return mul * accumul(mul-1);
  }
}

int main() {
  int r;
  cin >> r;
  cout << 3 * pow(r, 2) << endl;
}


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

typedef struct s_pair
{
	int name;
	int num;
} t_pair;

int f(const void *a, const void *b)
{
	return((*(t_pair*)a).num - (*(t_pair*)b).num);
}
int main(void)
{
	int n;
	scanf("%d",&n);
	int *a;
	a = (int *)malloc(sizeof(int)*(n));
	t_pair *list;
	list = (t_pair *)malloc(sizeof(t_pair)*(n));
	int i = 0;

	while (i < n)
	{
		scanf("%d",&a[i]);
		list[i].name = i+1;
		list[i].num = a[i];
		i++;
	}
	qsort(list,n,sizeof(t_pair),f);
	i = 1;
	printf("%d",list[0].name);
	while (i < n)
	{
		printf(" %d",list[i].name);
		i++;
	}
	return(0);
}


Measured memory_bytes: 2172
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>
using namespace std;

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


int dp[11][1000005];

class CAllGreen {
public:
	int n, g;
	vector<pair<int, int>> arr;

	int rec(int i, int remain){
		if(i==n) return remain>0?INT_MAX:0;
		if(dp[i][remain]!=-1) return dp[i][remain];
		int res = INT_MAX;
		for(int j = 0; j<=arr[i].first; ++j){
			res = min(res, j + rec(i+1, remain-j*(i+1) - (j==arr[i].first?arr[i].second:0)));
		}
		return dp[i][remain] = res;
	}
	void solve(std::istream& in, std::ostream& out) {
		in >> n >> g;
		g /= 100;
		arr.clear();
		f(i, n){
			int p, c; in >> p >> c;
			arr.emplace_back(p, c/100);
		}
		memset(dp, -1, sizeof dp);
		out << rec(0, g);
	}
};


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	CAllGreen solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 86144
n = int(input())
h = [int(i) for i in input().split()]

if n == 1:
    print('Yes')
else:
    cnt = 0
    for i in range(1,n):
        if h[n-i] - h[n-i-1] <= -2:
            cnt = 1
            break
        elif h[n-i] - h[n-i-1] == -1:
            h[n-i-1]  -= 1

    if cnt == 0:
        print('Yes')
    else:
        print('No')

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<ll> h(n);
    ll sum=0;
    
    if(k>n) k=n;
    
    rep(i,n){
        cin>>h[i];
        sum+=h[i];
    }
    
    sort(h.begin(),h.end(),greater<ll>());
    
    rep(i,k){
        sum-=h[i];
        h[i]=0;
    }
    
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 4756
#include<iostream>
#include<cstdio>
#include <vector>
using namespace std;
int main()
{
	
	int n;
	vector<int>res;
	cin>>n;
	res.push_back(0);
	int num;
	for(int i=0;i<n;i++)
	{
		cin>>num;
		res.push_back(num);
	}
	int cnt = 1,index =res[1];
	while(1)
	{
		if(index ==2)
		{
			break;
		}
		index = res[index];
		cnt++;
		if(cnt>n)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	

	cout<<cnt<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  string a,b;cin>>a>>b;
  int an=a.size(),bn=b.size();
  double m[6]={1,1e1,1e2,1e3,1e4,1e5};
  int num=0;
  rep(i,0,bn){
    num+=(b[bn-1-i]-'0')*m[i];
  }
  rep(i,0,an){
    num+=(a[an-1-i]-'0')*m[bn+i];
  }

  for(int i=1;i<=10000;i++){
    if(i*i==num){out("Yes");return 0;}
  }
  out("No");


  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.util.Arrays.*;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int n;
	static Team[] teams;
	
	static boolean read() {
		n = sc.nextInt(); 
		if(n == 0) return false;
		
		teams = new Team[n];
		int win, lose, k; 
		String name;
		for(int i = 0; i < n; i++) {
			name = sc.next();
			win = lose = 0;
			for(int j = 0; j < n - 1; j++) {
				k = sc.nextInt();
				if(k == 0) win++;
				else if(k == 1) lose++;
			}
			teams[i] = new Team(name, win, lose);
		}
		return true;
	}
	
	static void solve() {
		sort(teams);
		for(Team t : teams) {
			System.out.println(t.name);
		}
		
	}
	
	public static void main(String[] args) {
		while(read()) {
			solve();
		}	
	}
}

class Team implements Comparable<Team>{
	String name;
	int win, lose;
	
	Team(String name, int win, int lose) {
		this.name = name;
		this.win = win;
		this.lose = lose;
	}
	
	public int compareTo(Team t) {
		int ret = t.win - this.win;
		if(ret == 0) {
			return this.lose - t.lose;
		} else {
			return ret;
		}
	}
}

Measured memory_bytes: 12000
L = input()
B = len(L)

MOD = 10**9 + 7
ans = 0
cnt = 0
for i in range(B):
    if L[i] == '1':
        ans += (pow(2, cnt, MOD) * pow(3, B-i-1, MOD))
        cnt += 1
ans += pow(2, cnt, MOD)
print(ans % MOD)

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

int main(void)
{
	int A, B, K;
	cin >> A >> B >> K;

	int ApK = A + K - 1;
	int BmK = B - K + 1;
	for(int i = A; i <= B; i++) {
		if(i <= ApK || i >= BmK) {
			cout << i << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int p,n,ans,a[123];
int main()
{
		scanf("%d",&n);
		p=n;
		for (int i=1;i<=n;++i)
		{
				scanf("%d",&a[i]);
				if (a[i]==a[i-1])
				{
						++ans;
						a[i]=++p;
				}
		}
		printf("%d\n",ans);
		return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
typedef pair<int, int> P;
int a[200000];
int l[200000];
int r[200000];
int main() {
	stack<P> S1, S2;
	int N;
	cin >> N;
	rep(i, N) cin >> a[i];
	S1.push(P(-1, -1));
	for (int i = 0; i < N; i++) {
		while (S1.top().first > a[i]) {
			S1.pop();
		}
		l[i] = i - S1.top().second;
		S1.push(P(a[i], i));
	}
	S2.push(P(-1, N));
	for (int i = N - 1; i >= 0; i--) {
		while (S2.top().first > a[i]) {
			S2.pop();
		}
		r[i] = S2.top().second - i;
		S2.push(P(a[i], i));
	}
	LL sum = 0;
	rep(i, N) {
		sum += (LL)a[i] * l[i] * r[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 4224
//
// Created by Myabu on 2020/01/01.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;


int main(void){
    long long W, H, x, y;
    cin>>W>>H>>x>>y;

    if(x * 2 == W && y * 2 == H){
        cout<<double(W)*double(H)/2.0<<" "<<1;
    }else{
        cout<<double(W)*double(H)/2.0<<" "<<0;
    }

    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
using namespace std;

int main(){
    string a;
    cin >> a;
    int index = 0;
    long long date = 0;
    for(int i = 0; i < a.length(); i++){
        if(i == 4 || i == 7){
            continue;
        }
        date = 10*date + a[i] - '0';
    }

    if(date >= 20190431){
        cout << "TBD" << endl;
        return 0;
    }else{
        cout << "Heisei" << endl;
        return 0;
    }

    return 0;
}

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

signed main(void)
{
	long long n, a, b, ans;

	cin >> n >> a >> b;
	ans = (b * (n - 1) + a)  - (a * (n - 1) + b) + 1;
	if (ans < 0)
		ans = 0;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int main()
{
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if (r <= x && x + r <= W && r <= y && y + r <= H)
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define pb push_back
#define MOD 1000000007
#define pii pair<int,int>
#define unmap unordered_map<int,int>
#define ll long long int
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n, 0);
    for (int i = 0; i < n - 1; i++)
    {
        int x;
        cin >> x;
        v[x - 1] += 1;
    }
    for (int i = 0; i < n; i++)
        cout << v[i] << "\n";



}





int main()
{


    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3920
#include <stdio.h>
#include <math.h>

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

int x[102], y[102];

int main()
{
	int n, i, t, t2;
	int d, d1, d2;
	long long d3;
	
	n = in();
	for (i = 0; i < n; i++) x[i] = in();
	for (i = 0; i < n; i++) y[i] = in();
	d = 0, d1 = 0, d2 = 0, d3 = 0;
	for (i = 0; i < n; i++) {
		t = x[i] - y[i];
		if (t < 0) t = -t;
		if (t > d) d = t;
		d1 += t;
		t2 = t*t, d2 += t2;
		d3 += t2*t;
	}
	printf("%d\n", d1);
	printf("%.8lf\n", sqrt((double)d2));
	printf("%.8lf\n", pow((double)d3, 1.0/3));
	printf("%d\n", d);
	return 0;
}






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

vector<int> c(200);
vector<vector<int>> a(200, vector<int>(200));
ll sum = 0;
bool ok = true;
ll MIN = inf;
void dfs(int now, vector<ll> sw,ll cost){
        ok = true;
        if (now == n){
                for(int i=0;i<m;i++){
                        if(sw[i]<x){
                                ok = false;
                                return;
                        }
                }
                MIN = min(MIN, cost);
                return;
        }
        
        dfs(now+1, sw,cost);
        for (int j = 0; j < m; j++){
                sw[j] += a[now][j];
        }
        cost += c[now];
        dfs(now + 1, sw,cost);
}

int main()
{
        cin >> n >> m >> x;
        vector<ll> skill(n + 100, 0);

        rep(i, 0, n){
                cin >> c[i];
                rep(j, 0, m){
                        cin >> a[i][j];
                }
        }
        ll co = 0;
        dfs(0, skill,co);

        if(ok){
                cout << MIN << endl;
        }
        else{
                cout << -1 << endl;
        }


        return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int> > dp(n, vector<int>(3));
    for(int i=0; i<n; i++) {
        for(int j=0; j<3; j++) {
            cin >> dp[i][j];
            if(i) dp[i][j] += max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]);
        }
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;
}

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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

int main()
{
    int n,m,x; cin >> n >> m >> x;
    int c[n],a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    int ans = inf;
    for(int bit = 0; bit < (1<<n); bit++){
        int cnt[m];
        int tmp = 0;
        rep(i,m) cnt[i] = 0;
        rep(i,n){
            if(bit & (1<<i)){
                rep(j,m) cnt[j] += a[i][j];
                tmp += c[i];
            }
        }
        bool ok = true;
        rep(i,m){
            if(cnt[i] < x) ok = false;
        }
        if(ok) ans = min(tmp,ans);
    }
    if(ans == inf) cout << -1;
    else cout << ans;
}

Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const int EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 30);
const double PI = acos(-1);

//解説AC

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	vi X;
	int i = 0, j = 0;
	while(true){
		if (i * A * 100 > F)break;
		j = 0;
		while(true){
			if (i * A * 100 + j * B * 100 > F)break;
			X.push_back(i *  A * 100 + j * B * 100);
			j++;
		}
		i++;
	}
	so(X);
	uni(X);
	vi Y;
	i = 0; j = 0;
	while (true) {
		if (i * C > F)break;
		j = 0;
		while (true) {
			if (i * C + j * D > F)break;
			Y.push_back(i * C + j * D);
			j++;
		}
		i++;
	}
	so(Y);
	uni(Y);
	int anss = 0;
	int answ = 0;
	double ansp = 0;
	REP(x, SZ(X)) {
		REP(y, SZ(Y)) {
			if (X[x] + Y[y] > F)break;
			if (E * (X[x] / 100) < Y[y])break;
			if ((double)Y[y] / (double)(X[x] + Y[y]) >= ansp) {
				ansp = (double)Y[y] / (double)(X[x] + Y[y]);
				anss = Y[y];
				answ = Y[y] + X[x];
			}
		}
	}
	cout << answ << " " << anss << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;

vector<int> vec;
set<int> se;
int temp;
signed main(){
    int n,m;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        se.insert(a);
    }

    cin>>m;
    rep(i,m){
        int a;
        cin>>a;
        if(se.find(a)!=se.end()){
            temp++;
        }
    }
    if(temp==m){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }



 
}


Measured memory_bytes: 12468
#include<stdio.h>
#define N 45

int main(){
  int i,n,a[N];

  a[0]=a[1]=1;
  for(i=2;i<N;i++){
    a[i]=a[i-1]+a[i-2];
  }

  scanf("%d",&n);
  printf("%d\n",a[n]);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){

 long long n,m;
 cin>>n>>m;

 int sum = m * 1900 + (n-m)*100;

 int cnt[6] = {1,2,4,8,16,32};

 cout<<sum*cnt[m]<<endl;

  return 0;
 }

Measured memory_bytes: 3632
//============================================================================
// Name        : AOJCpp.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
//#include <queue>
using namespace std;
static const int MAX = 1000000;

class process {
private:
	string name;
	int time;
public:
	void setName(string s);
	void setTime(int t);
	string getName();
	int getTime();
};
void process::setName(string s) {
	name = s;
}
void process::setTime(int i) {
	time = i;
}
string process::getName() {
	return name;
}
int process::getTime() {
	return time;
}
class queue {
private:
	int head;
	int tail;
	process q[MAX];
public:
	void initialize();
	process front();
	void pop();
	void push(process p);
	bool empty();

};
void queue::initialize() {
	head = 0;
	tail = 0;
}
process queue::front() {
	return q[head];
}
void queue::pop() {
	if(head >= MAX) {
		head = 0;
	} else {
		head++;
	}
}
void queue::push(process p) {
	q[tail] = p;
	if(tail >= MAX) {
		tail = 0;
	} else {
		tail++;
	}
}
bool queue::empty() {
	if (head == tail) {
		return true;
	}
	return false;
}


int main() {

	int n,q;
	cin >> n >> q;

	queue que;
	que.initialize();
	string name;
	int time;
	for(int i = 0; i < n; i++) {
		cin >> name;
		cin >> time;
		process p;
		p.setName(name);
		p.setTime(time);
		que.push(p);
	}
	int total = 0;
	while(!que.empty()) {
		process p = que.front();
		que.pop();
		time = p.getTime();
		if(time > q) {
			p.setTime(time - q);
			total += q;
			que.push(p);
		} else {
			total+=time;
//			p.setTime(total);
			cout << p.getName() << " " << total << endl;
		}
	}
	return 0;
}




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

const long long INF = LONG_LONG_MAX / 2;
int main(){
    using namespace std;
    priority_queue<long, vector<long>, greater<long>> a;
    priority_queue<long>c;
    vector<long long> b, ai, ci;
    long long asum = 0, csum = 0;
    int N; cin >> N;
    for (int i = 0; i < 3 * N; i++)
    {
        int j; cin >> j;
        if(i<N){
            a.push(j);
            asum += j;
        }
        else if (i<2*N) {
            b.push_back(j);
        } else {
            c.push(j);
            csum +=j;
        }
    }

    ai.push_back(asum);
    ci.push_back(csum);

    for (int i = 0; i < N; i++){
        a.push(b[i]);
        asum += b[i] - a.top(); 
        a.pop();
        ai.push_back(asum);

        c.push(b[N-1-i]);
        csum += b[N-1-i] - c.top();
        c.pop();
        ci.push_back(csum);
    }

    long long m = -INF;
    for (int i = 0; i < N+1; i++)
    {
        m = max(m, ai[i] - ci[N-i]);
    }

    cout << m << endl;
}

Measured memory_bytes: 4980
#include <stdlib.h>
#include <iostream>
#include <string>
#include <ios>     // std::left, std::right
#include <vector> // std::setw(int), std::setfill(char)
using namespace std;

int main()
{

	int a, b;
	cin >> a >> b;
	
	for (int i = b - a + 1; i < a+b; i++)
	{
		cout << i << " ";
	}
	


	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

long N, M;

void solve() {
  if (N == 1) {
    if (M == 1) {
      printf("%d\n", 1);
      return;
    } else {
      printf("%ld\n", M - 2);
      return;
    }
  }
  if (M == 1) {
    // M == 1の時はN == 1で見ているので除外
    printf("%ld\n", N - 2);
    return;
  }
  printf("%ld\n", (N - 2) * (M - 2));
}

int main() {
  scanf("%ld %ld", &N, &M);
  solve();
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define forloop(n) for(int i = 0; i < n; i++)
#define ll long long
#define mod 1000000007
long long exp(long long taban, long long us) {
    long long carpan = taban;
    long long temp = us;
    long long res = 1;
    while(temp > 0){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
ll ebob(ll a, ll b){
	if(!a)return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (((a*b)%mod)*(exp(ebob(a,b), (ll)mod-2))) % mod;
}
/*int level[100005];
int parent[100005][20];
vector<vector<int>> vec(100005);
void fonk(int cur, int dont){
	level[cur] = level[dont] + 1;
	parent[cur][0] = dont;
	for(int i = 1; i < 20; i++){
		parent[cur][i] = parent[parent[cur][i - 1]][i-1];
	}
	for(int i = 0; i < vec[cur].size(); i++){
		if(vec[cur][i] != dont) fonk(vec[cur][i], cur);
	}
}

int lca(int n1, int n2){
	int ans = -1;
	if(level[n2] > level[n1]){
		swap(n1, n2);
	}
	while(level[n1] > level[n2]){
		for(int i = 0; i < 20; i++){
			if(level[parent[n1][i]] >= level[n2]){
				n1 = parent[n1][i];
			}else break;
		}
	}
	if(n1 == n2) return n1;
	while(parent[n1][0] != parent[n2][0]){
		int tmp1, tmp2;
		for(int i = 0; i < 20; i++){
			if(parent[n1][i] != parent[n2][i]){
				tmp1 = parent[n1][i];
				tmp2 = parent[n2][i];
			}else break;
		}
		n1 = tmp1, n2 = tmp2;
	}
	return parent[n1][0];
}

int dist(int n1, int n2){
	return level[n1] + level[n2] - 2*level[lca(n1, n2)];
}*/
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b, c; cin>>a>>b>>c;
	bool c1 = a == b && a != c, c2 = a == c && a!=b, c3 = b == c && a != b;
	(c1 || c2 || c3) ? cout<<"Yes" : cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	int k,a,b;
	cin>>k>>a>>b;
	if(b/k*k<a)cout<<"NG"<<endl;
	else cout<<"OK"<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    vector<int> A(N);
    map<int, int> mp;
    REP (i, N) {
        cin >> A[i];
        mp[A[i]]++;
    }
    vector<pair<int, int>> v;
    for (auto p : mp) if (p.second >= 2) v.emplace_back(p.first, p.second);
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    if (v.size() > 0 && v[0].second >= 4) cout << v[0].first * v[0].first << endl;
    else if (v.size() > 1) cout << v[0].first * v[1].first << endl;
    else cout << 0 << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 7296
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll n,x;
  cin >> n >> x;
  vll a(n+1,0);
  rep(i,n) cin >> a[i];

  ll ans = 0;

  if(a[0] > x)
  {
    ans += a[0] - x;
    a[0] = x;
  }

  rep(i,n)
  {
    ll buf = a[i] + a[i+1];
    if(buf > x)
    {
      ll sub = buf - x;
      a[i+1] -= sub;
      ans += sub;
    }
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 1024
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i,a,b) for (int i = a; i > b; --i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)
 
#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
#define _ <<" "<<
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 	
 
//	freopen ("test.txt","r",stdin);
	ll k,x;
	cin>>k>>x;
	ll mini = -1000000;
	ll maxi =  1000000;

	mini = max(mini , x-k+1);
	maxi = min( maxi , x + k-1);

	for(int i=mini;i<=maxi;i++)
	{
		cout<<i<<" ";
	}

} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
 using namespace std;
 
 typedef long long ll;
 typedef long double ld;
 const int N = 100000;
 bool primes[N+1];
 bool similars[N+1];
 
void sieve(int n){
	vector<int> primelist;
	 for (int i = 2; i <= n; i++){
		 bool isPrime = true;
		 for (int j = 0; j < primelist.size(); j++){
			 if (primelist[j]*primelist[j] > i) break;
			 if (i % primelist[j] == 0){
				 isPrime = false;
				 break;
			 }
		 }
		 
		 if (!isPrime) continue;
		 
		 primelist.push_back(i);
		 primes[i] = true;
	 }
 } 
 
 int main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(0);
	 
	 memset(primes,false,sizeof(primes));
	 sieve(N);
	 
	 for (int i = 3; i < N; i++){
		 if (primes[i] && primes[(i+1)/2]){
			similars[i] = true;
		 }
	 }
	 
	 int sums[N+1];
	 memset(sums, 0, sizeof(sums));
	 
	 for (int i = 1; i <= N; i++){
		 sums[i] = sums[i-1]+similars[i];
	 }
	 
	 int q; cin >> q;
	 while(q--){
		 int l, r; cin >> l >> r; 
		 cout << sums[r]-sums[l-1] << endl;
	 } 
 }

Measured memory_bytes: 1408
a,b,c,x,y = map(int,input().split())
minprice = 10 ** 12
for i in range(max(x,y)+1):
         if ((2*c*i)+(max(x-i,0)*a)+(max(y-i,0)*b)) < minprice:
                  minprice = ((2*c*i)+(max(x-i,0)*a)+(max(y-i,0)*b))
print(minprice)


Measured memory_bytes: 3060