akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double X1, Y1, X2, Y2, X3, Y3;
    cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3;
    double a = sqrt(pow(abs(X1 - X2), 2) + pow(abs(Y1 - Y2), 2));
    double b = sqrt(pow(abs(X2 - X3), 2) + pow(abs(Y2 - Y3), 2));
    double c = sqrt(pow(abs(X3 - X1), 2) + pow(abs(Y3 - Y1), 2));
    double s = (a + b + c) / 2;
    double S = sqrt(s * (s - a) * (s - b) * (s - c));
    double r = S / s;
    double m = max(a, max(b, c));
    cout << fixed << setprecision(10);
    cout << (r * m) / (2 * r + m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a, b, n;
  int i, cnt = 0;
  int s[ 1010 ], f[ 1010 ];

  scanf( "%d %d %d", &a, &b, &n );

  for( i = 0; i < n; i++ ){
    scanf( "%d %d", &s[ i ], &f[ i ] );

    if( s[ i ] <= a && a < f[ i ] || s[ i ] < b && b <= f[ i ] || a <= s[ i ] && f[ i ] <= b ){
      cnt = 1;
    }
  }

  if( cnt == 0 ) printf( "0\n" );
  else printf( "1\n" );

  return 0;

}

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

using namespace std;

int main() {
    int n;
    float rez, imp;
    cin >> n;
    if(n % 2 == 0) {
        imp = n / 2;
    }
    else imp = ( n / 2 ) + 1;
    rez = imp / n;
    cout << setprecision(11) << rez;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define endl ('\n')
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[](auto f,auto... args){return f(f,args...);};

int main(){
    lint n;
    cin>>n;
    lint ans=0;
    rep(i,n+1){
        if((i%3)&&(i%5))ans+=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int l[10] ,v1,v2;
char cc;

	while(cin >> l[0] ){
		rep2(i,1,10) cin >> cc >> l[i];
		cin >> cc >> v1 >> cc >> v2;
		int kr=0;
		rep(i,10) kr += l[i];
		double tm = kr * 1.0l / (v1 + v2);
		double km = v1 * tm;
		kr = 0;
		rep(i,10){
			kr += l[i];
			if(kr >= km){
				cout << i+1 << endl;
				break;
			}	
		}
//		printf("%f,%f kr=%d\n",tm,km,kr);
	}
	return 0;
	
	
}

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

int main() {
    string s; cin >> s;
    int n = s.size();

    constexpr int kMod = 998244353;

    vector<int> dp(n + 1, 0);
    dp[0] = 1;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += s[i] - '0';
        vector<int> nxt(n + 1, 0);
        for (int j = 0; j <= n; ++j) {
            if (dp[j] == 0) continue;
            if (sum - j > 0) (nxt[j + 1] += dp[j]) %= kMod;
            if (2 * (i + 1) - sum - (i - j) > 0) (nxt[j] += dp[j]) %= kMod;
        }
        dp = nxt;
    }
    vector<vector<int>> cnk(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i <= n; ++i) {
        cnk[i][0] = 1;
        for (int j = 1; j <= i; ++j) cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % kMod;
    }
    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        if (dp[i] == 0) continue;
        ans += 1LL * dp[i] * cnk[n][sum - i] % kMod;
        if (ans >= kMod) ans -= kMod;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 16000
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

string s;

int main(){
	cin >> s;
	int a = -1, b = -1;
	bool flg = false;
	FORI(0,s.length()-1) {
		if (s[i] == s[i + 1]) {
			a = i+1; b = i + 2;
		}
			
	}
	FORI(0, s.length() - 2) {
		if (s[i] == s[i + 2]) {
			a = i+1; b = i + 3;
		}
			
	}
	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 512
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <map>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	LL n, m;
	cin >> n >> m;
	map<LL, LL> x;
	LL sum = 0, ans = 0;
	x[0] = 1;
	for (LL i = 0; i < n; ++i) {
		LL a;
		cin >> a;
		sum = (sum + a) % m;
		ans += x[sum];
		x[sum] += 1;
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    bool con = false;
    string n;
    cin >> n;

    for(int i = 0; i < n.size(); i++)
    {
        if(n[i] == '7')
            con = true;
    }

    if(con)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 3516
import bisect

x = int(input())
six_list = [6 ** i for i in range(7)]
nine_list = [9 ** i for i in range(6)]


def six_nine(n):
    if n == 0:
        return 0
    else:
        six = six_list[bisect.bisect_right(six_list, n) - 1]
        nine = nine_list[bisect.bisect_right(nine_list, n) - 1]
        return min(n // six + six_nine(n % six), 1 + six_nine(n - nine))


print(six_nine(x))


Measured memory_bytes: 46168
#include <bits/stdc++.h>
#define INF 1000000001
using namespace std;

int main()
{
	int n;
	cin.sync_with_stdio(false);
	cin >> n;
	vector<int> dp(n + 1, INF);
	for (int i = 0, a; i < n; i++) {
		cin >> a;
		*lower_bound(dp.begin(), dp.end(), a) = a;
	}
	cout << lower_bound(dp.begin(), dp.end(), INF) - dp.begin() << endl;
	return 0;
}

Measured memory_bytes: 3368
#include<iostream>
using namespace std;
int main(void) {
	int N;

	cin >> N;

	for (int i = 0; 7 * i < 100; i++) {
		for (int j = 0; 4 * j <= 100; j++) {
			if (7 * i + 4 * j == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

void dump(ll *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

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

	int n,t,a;
	cin >> n >> t >> a;

	int h[n],ans;
	double mini=1e9,tmp;
	rep(i,n){
		cin >> h[i];
		tmp = abs(a-t+0.006*h[i]); 
		if(i==0 || tmp < mini){
			mini = tmp;
			ans = i;
		}
	}
	cout << ans+1 << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>

using namespace std;

int main() {

    int H, W;
    stringstream input;
    string out;

    while (1) {
        int A, B;
        cin >> A >> B;
        if (A == 0 && B == 0)
            break;
        input << A << " " << B << endl;
    }

    while(!input.eof()) {
        input >> H >> W;
        if (H == 0 && W == 0)
            break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i == 0 || i == H - 1) {
                    out += "#";
                    continue;
                }
                if (j == 0 || j == W - 1) {
                    out += "#";
                    continue;
                }
                out += ".";
            }
            out += "\n";
        }
        cout << out << "\n";
        out = "";
        H = 0;
        W = 0;
    }
    return 0;
}

Measured memory_bytes: 3196
n=int(input())
G=[[] for i in range(n)]
#G=[]
Q=[1]
d=[-1]*n
d[0]=0
visited=[False]*n
visited[0]=True

for i in range(n):
    arr=[int(x) for x in input().split()[2:]]
    for l in arr:
        G[i].append(l)
        #G[l-1].append(i+1)
    

kyori=0
while len(Q)!=0:
    
    #print(Q)
    #print(visited)
    v=Q.pop(0)
    
    for j in G[v-1]:
        if visited[j-1]:#次に行くところがすでに踏破済みだったら
            continue#更新しない
        else:
            d[j-1]=d[v-1]+1
            Q.append(j)
            visited[j-1]=True
for a in range(n):
    print(a+1,d[a])
    
        


Measured memory_bytes: 6732
using System;

class MyClass
{
    static void Main(string[] args)
    {
        string str = "";
        while ((str = Console.ReadLine()) != null)
        {
            string[] str2 = str.Split(' ');
            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);
            Console.WriteLine((int)Math.Floor(Math.Log10(a + b)) + 1);
        }
    }
}


Measured memory_bytes: 5668
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }

void main()
{
	auto N = RD;
	auto M = RD;

	writeln(N == M ? "Yes" : "No");
	stdout.flush;
	debug readln;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n;
	cin >> n;

	map<ll, ll> mp1, mp2;
	ll ans = 0;

	rep(i, n) {
		ll a;
		cin >> a;
		ans += mp1[i - a];
		ans += mp2[i + a];
		mp1[i + a]++;
		mp2[i - a]++;
	}

	out(ans);

	return 0;
}

Measured memory_bytes: 48980
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));
ll dp[110][2][110];
int main()
{
    cout << fixed << setprecision(30);
    string N;
    ll K;
    cin >> N >> K;
    ll n = N.size();
    dp[0][0][0] = 1; //初期値
    loop(i, n)
    {
        loop(j, K + 1)
        {
            //true->true
            dp[i + 1][1][j + 1] += dp[i][1][j] * 9;
            dp[i + 1][1][j] += dp[i][1][j];
            ll now = ctoi(N[i]);
            if (now > 0)
            {
                //false->true
                dp[i + 1][1][j + 1] += dp[i][0][j] * (now - 1);
                dp[i + 1][1][j] += dp[i][0][j];
                //false->false
                dp[i + 1][0][j + 1] += dp[i][0][j];
            }
            else
                dp[i + 1][0][j] += dp[i][0][j]; //false->false
        }
    }
    putout(dp[n][1][K] + dp[n][0][K]);
    return 0;
}


Measured memory_bytes: 3792
#include <iostream>
#include <vector>

using namespace std;

void printArray(vector<int> &a)
{
	for (int k = 0; k < a.size(); k++)
	{
		cout << a[k];
		if (k == a.size() - 1)
		{
			cout << endl;
		}
		else
		{
			cout << ' ';
		}
	}
}

void insertionSort(vector<int> &a)
{
	int j, key;
	for (int i = 1; i < a.size(); i++)
	{
		printArray(a);
		key = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > key)
		{
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = key;
	}
	printArray(a);
}

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	insertionSort(a);
	return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i, n) for(int i = 0; i < (n); ++i)
const ll mod = 1e9 + 7;

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

bool pairCompare(const P &firstElof, const P &secondElof) {
    return firstElof.second < secondElof.second;
}

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int r, l;
    l = 0;
    r = s.length() - 1;
    int ans = 0;
    while(l < r) {
        while(s[l] != 'W' or s[r] != 'R') {
            if(s[l] != 'W')
                l++;
            if(s[r] != 'R')
                r--;
            if(l >= r or r == 0 or l == s.length()) {
                break;
            }
        }
        if(l < r) {
            ans++;
            l++;
            r--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3716
#include <stdio.h>

int main(void){
	int N, x, y, M, l, i, robox, roboy, count, j, juel[21][21];
	char d;

	while (1){
		scanf("%d", &N);
		if (N == 0) break;

		for (i = 0; i < 21; i++){
			for (j = 0; j < 21; j++){
				juel[i][j] = 0;
			}
		}
		robox = 10; roboy = 10; count = 0;
		for (i = 0; i < N; i++){
			scanf("%d %d", &x, &y);
			juel[y][x] = 1;
		}

		scanf("%d", &M);
		for (i = 0; i < (M * 2); i++){
			scanf("%c %d", &d, &l);
			switch (d){
			case 'N':
				for (j = 0; j < l; j++){
					roboy++;
					if (juel[roboy][robox] == 1){
						juel[roboy][robox] = 0; count++;
					}
				}
				break;

			case 'S':
				for (j = 0; j < l; j++){
					roboy--;
					if (juel[roboy][robox] == 1){
						juel[roboy][robox] = 0; count++;
					}
				}

				break;

			case 'E':
				for (j = 0; j < l; j++){
					robox++;
					if (juel[roboy][robox] == 1){
						juel[roboy][robox] = 0; count++;
					}
				}
				break;

			case 'W':
				for (j = 0; j < l; j++){
					robox--;
					if (juel[roboy][robox] == 1){
						juel[roboy][robox] = 0; count++;
					}
				}
				break;

			default:
				break;
			}
		}
		if (count == N){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}

	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<ll , ll>m;
int main()
{
  ll n, w;
  cin >> n >> w;

  ll a[n+1];
  ll v[n+1];

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

  

  ll dp[sum+1][n+1];
 
  memset(dp , 0 , sizeof(dp));
  
  for(ll i = 1 ; i <= sum ; i++){
      dp[i][0] = 1e18;
  }
    
   /* for(ll i = 0 ; i <= sum ; i++)
   {
       for(ll j = 0 ; j <= n ; j++)
       cout << dp[i][j] << " ";
       cout << endl;
   }*/

   //cout << "--------" << endl;
  ll maxi =0 ;
  for(ll i = 1 ; i <= sum ; i++)
  {
      for(ll j = 1 ; j <= n ; j++)
      {
          //cout << i << " " << j << endl;
          if(v[j] > i)
          {
            dp[i][j]  = dp[i][j-1];
          }
          else if(v[j] <= i)
          {
            
            dp[i][j] = min(dp[i-v[j]][j-1]+a[j] , dp[i][j-1]);
            
          }

          if(dp[i][j] <= w)
          {
              maxi = max(maxi , i);
          }
      }
  }
    
  cout << maxi;

}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string s; cin >> s;
  int ans = 0;
  rep(i,s.size()){
    if(s[i] == '+') ans++;
    else ans--;
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	int c = 0, i = 10;
	while (i--)
		c += in();
	outl(c);
}


Measured memory_bytes: 2544
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int N, x;
    cin >> N >> x;
    vector<int> a(N);
    rep(i, N)
    {
        cin >> a[i];
    }
    SORT(a);
    int sum = 0;
    int ans = 0;
    rep(i, N)
    {
        if (sum + a[i] <= x)
        {
            sum += a[i];
            ans++;
        }
    }
    if (ans == N && sum != x)
        ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import math
# 1行だけ読むやつ

data = stdin.readline().rstrip().split()
N, M = int(data[0]), int(data[1])

str_data = stdin.readline().rstrip().split()
int_data = [int(i) for i in str_data]

int_data = sorted(int_data, reverse=True)
sum_data = sum(int_data)
thr = sum_data / (4 * M)

flag = True
for i in range(M):
    if int_data[i] < thr:
        flag = False

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

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value!=0>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v<T>(e,v...);}
//FUNCTION

//BELOW
void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  int DP = 1;
  vector<int> data(10000111,0);
  for (int i = 0; i < N; i++)
  {
    if( i != 0 && vec[i] == vec[i-1])continue;
    int x = vec[i];
    data[x] = data[x] + DP;

    data[x] %= MOD;
    DP = data[x];
    // DEBUG(">>",i,x,DP);
  }
  
  cout<<DP%MOD<<endl;
  
  
  return;
}
  
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 80000
A,B,C = map(int,input().split())
if A == B == C and A%2 == 0:
  print(-1)
elif A%2 == 1 or B%2 == 1 or C%2 == 1:
  print(0)
else:
  c = 0
  while A%2 == B%2 == C%2 == 0:
    A0 = A
    B0 = B
    C0 = C
    A = (B0+C0)/2
    B = (C0+A0)/2
    C = (A0+B0)/2
    c += 1
  print(c)
  


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  bool flag = false;

  if (A == B && B != C) flag = true;
  if (A == C && B != C) flag = true;
  if (C == B && A != C) flag = true;

  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
open Scanf
open Printf
open Str
open Num

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let rec comb n m =
  if n < m then num_of_int 0 else
    if m = 0 || n = m then num_of_int 1 else
      comb (n-1) (m-1) */ (num_of_int n) // (num_of_int m)
      
let () =
  let n, p = sscanf (read_line ()) "%d %d" (fun x y -> (x, y)) in
  let e = List.length (List.filter (fun x -> x mod 2 = 0) (read_list int_of_string)) in
  let o = n - e in
  let rec eloop x c =
    if x > e then c else eloop (x+1) (c +/ comb e x) in
  let en = eloop 0 (num_of_int 0) in
  let rec oloop x c =
    if x > o then c else oloop (x+2) (c +/ comb o x) in
  let on = if p = 0 then oloop 0 (num_of_int 0) else oloop 1 (num_of_int 0) in
  en */ on |> string_of_num |> print_endline


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }

class ConvexFullTrick
{
/* 
    ・最小値を求める場合(追加する直線の傾きは狭義単調減少)
        ConvexFullTrick cht;
    ・最大値を求める場合(追加する直線の傾きは狭義単調増加)
        ConvexFullTrick cht(greater<int>());
    　としたいけどなんかエラーがでる()ので
        function<bool(int,int)> comp=greater<int>();
        ConvexFullTrick cht(comp);
    　としたら動く
    ・最大値のほうはまだverifyしていません
    ・平行な直線を追加したら(広義単調減少(増加)だったら)バグります
    　(定数項の大小関係で場合分けすればできそうですが、諦めました)
*/
 private:
    vector<pair<int,int>> lines;
    function<bool(int,int)> comp;
 public:
    ConvexFullTrick(function<bool(int,int)> comp=less<int>()):comp(comp){}
    void add(int a,int b){
        pair<int,int> line(a,b);
        while(lines.size()>=2){
            pair<int,int> l1=lines[lines.size()-2];
            pair<int,int> l2=lines[lines.size()-1];
            if(check(l1,l2,line)) break;
            lines.pop_back();
        }
        lines.push_back(line);
    }
    int get(int x){
        int ng=-1,ok=lines.size()-1;
        while(ok-ng>1){
            int mid=(ng+ok)/2;
            if(comp(f(mid,x),f(mid+1,x))) ok=mid;
            else ng=mid;
        }
        return f(ok,x);
    }
    bool check(pair<int,int> l1,pair<int,int> l2,pair<int,int> l3){
        // (l1とl2の交点)<(l2とl3の交点)=>true
        int x=(l2.first-l3.first)*(l2.second-l1.second);
        int y=(l1.first-l2.first)*(l3.second-l2.second);
        return x<y;
    }
    int f(int i,int x){
        return lines[i].first*x+lines[i].second;
    }
};

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

    int N,C; cin>>N>>C;
    vector<int> h(N);
    for(int i=0;i<N;i++) cin>>h[i];
 
    vector<int> dp(N);
    dp[0]=0;
    ConvexFullTrick cht;
    cht.add(-2*h[0],dp[0]+h[0]*h[0]);
    for(int i=1;i<N;i++){
        dp[i]=cht.get(h[i])+h[i]*h[i]+C;
        cht.add(-2*h[i],dp[i]+h[i]*h[i]);
    }
    cout<<dp[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 9328
import collections

N = int(input())
balls = []
for i in range(N):
    x, y = map(int, input().split())
    balls.append((x, y))

moves = collections.defaultdict(list)
mmax = 0
vmax = None
for i in range(N):
    for j in range(i):
        x1, y1 = balls[i]
        x2, y2 = balls[j]
        if y1 > y2 or (y1 == y2 and x1 > x2):
            x1, x2 = x2, x1
            y1, y2 = y2, y1
        moves[x2-x1, y2-y1].append((j, i))
        m = len(moves[x2-x1, y2-y1])
        if m > mmax:
            mmax = m
            vmax = (x2-x1, y2-y1)

#print(mmax, vmax)
print(N - mmax)


Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, q;
int BIT[100010];

int sum(int i) {
	int s = 0;
	while (i) {
		s += BIT[i];
		i -= (i & -i);
	}
	return s;
}
void add(int i, int x) {
	while (i <= n) {
		BIT[i] += x;
		i += (i & -i);
	}
}

signed main() {
	cin >> n >> q;
	for (int i = 0; i < q; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (!a)add(b, c);
		else {
			int p = sum(b - 1), q = sum(c);
			cout << q - p << endl;
		}
	}
}


Measured memory_bytes: 3840
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			String[]s = new String[N];
			char[][] o = new char[N][10];
			
			for(int i = 0;i<N;i++) {
				s[i] = scan.next();
				o[i] =s[i].toCharArray();
				Arrays.sort(o[i]);
				s[i] = new String(o[i]);
				
			}
			
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			Arrays.sort(s);
			
			for(int i = 0;i<N;i++) {

				//System.out.println(s[i]);
			}
			
			
			
			
			
			
			
			
			long count = 1;
			long goukeikumiawase = 0;
			
			for(int i=1;i<=N-1;i++) {
				/*if(i==N-1) {
					if(s[i].equals(s[i-1])) {
						count++;
					}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
						if(count>=2) {//組み合わせが２つ以上ないとダメ
							goukeikumiawase+=combinations(count,2);
							count =1;
							}
					}
					
					if(count>=2) {
						goukeikumiawase+=combinations(count,2);
					}
				}else {*/
				
				if(s[i].equals(s[i-1])) {//同じなら
					count++;
					if(i==N-1) {
						goukeikumiawase+=combinations(count,2);
					}
				}else if(!s[i].equals(s[i-1])) {//同じじゃないなら
					if(count>=2) {//組み合わせが２つ以上ないとダメ
					goukeikumiawase+=combinations(count,2);
					count =1;
					}
				}
				}
				
				
				
				
				
			
			
			
			
			System.out.println(goukeikumiawase);
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	
	private static long combinations(long n,long k){//(0<k&&k<n) 
		if(k==n){
			return 1;
		}else if(k==1) {
			return n;
		}
			return combinations(n-1, k-1)+combinations(n-1, k);
			
		}
	
	
	
	
		

}


Measured memory_bytes: 66120
n=int(input())
SP=[list(map(str,input().split())) for __ in range(n)]
for i in range(len(SP)):
    SP[i][1] = str(SP[i][1]).zfill(3)
    SP[i].extend([i+1])

SP.sort(key=lambda x:x[1],reverse=True)
SP.sort(key=lambda x:x[0])

for s in SP:
    print(s[2])


Measured memory_bytes: 3060
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
memo_yoko = []
memo_tate = []
for i in range(h):
    if "#" in a[i]:
        memo_yoko.append(i)

for j in range(w):
    if any(a[i][j] == "#" for i in range(h)):
        memo_tate.append(j)
#print(memo_yoko)
#rint(memo_tate)
for i in memo_yoko:
    for j in memo_tate:
        print(a[i][j], end="")
    print()

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

int main() {

char T,D;
  cin>>T>>D;
  
  if(T=='H'&&D=='H'){cout<<'H'<<endl;}
  else if(T=='D'&&D=='H'){cout<<'D'<<endl;}
  else if(T=='D'&&D=='D'){cout<<'H'<<endl;}
   else if(T=='H'&&D=='D'){cout<<'D'<<endl;}
    
//cout<<ans<<endl;
}



Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n = inp()
p = inpl()
cnt = 0
for i in range(1, n+1):
    if i <= n-2:
        if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
            cnt += 1
print(cnt)

Measured memory_bytes: 3948
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n;
  rd(n);
  auto a = readln.split.to!(int[]);

  auto st = new SegmentTree(n);
  auto ai = new int[][](n);
  foreach (i; 0 .. n) {
    ai[i] = [a[i], i];
  }
  ai.sort!((l, r) => (l[0] == r[0] ? l[1] > r[1] : l[0] < r[0]));
  foreach (e; ai) {
    auto i = e[1], aa = e[0];
    auto u = st.get_max(0, i);
    st.update(i, u.val + 1, u.sum + aa);
  }
  auto ans = st.get_max(0, n);
  writeln(ans.sum);
}

class SegmentTree {
  struct Node {
    int val;
    long sum;
  }

  Node max(const Node l, const Node r) {
    if (l.val < r.val) {
      return r;
    } else if (l.val > r.val) {
      return l;
    } else {
      if (l.sum <= r.sum) {
        return r;
      } else {
        return l;
      }
    }
  }

  int n = 1;
  const auto e = Node(0, 0);
  Node[] dat;
  this(int N) {
    while (n < N)
      n *= 2;
    dat.length = n * 2 - 1;
  }

  void update(int i, int val, long sum) {
    i += n - 1;
    dat[i] = Node(val, sum);
    while (i > 0) {
      i = (i - 1) / 2;
      dat[i] = max(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }

  Node get_max(int ql, int qr) {
    return get_max(ql, qr, 0, 0, n);
  }

  Node get_max(int ql, int qr, int i, int il, int ir) {
    if (qr <= il || ir <= ql)
      return e;
    if (ql <= il && ir <= qr)
      return dat[i];
    int m = (il + ir) / 2;
    return max(get_max(ql, qr, i * 2 + 1, il, m), get_max(ql, qr, i * 2 + 2, m, ir));
  }
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}



Measured memory_bytes: 12260
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
using namespace std;


int main() {
    int a, b, ans;
    
    cin >>a>>b ;
    
    int n = a+b;
    int m = a-b;
    int k = a*b;
    
    if(n>=m && n>=k) ans = n;
    if(m>=n && m>=k) ans = m;
    if(k>=m && k>=n) ans = k;
    
    cout<<ans<<endl;
    
    return 0;
}


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


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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string s;
bool b[4];

int main () {
    cin >> s ;
    for ( int i = 0 ; i < s.size() ; i ++ ) {
        if ( s[i] == 'N' ) { b[0] = 1; }
        if ( s[i] == 'E' ) { b[1] = 1; }
        if ( s[i] == 'S' ) { b[2] = 1; }
        if ( s[i] == 'W' ) { b[3] = 1; }
    }

    //cout << b[0] << " " << b[2] << "  " << b[1] << " " << b[3] << "\n";

    //cout << ( b[0]^b[2] ) << " : " << ( b[1]^b[3] ) << "\n";

    bool ans = ( b[0]^b[2] )|( b[1]^b[3] );
    if ( !ans ) { cout << "Yes\n"; }
    else { cout << "No\n"; }

    return 0;
}


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

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 1000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

ll bin_pow(ll a, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p & 1)
            res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }
    return res;
}

int C[N + 1][N + 1];

void init_C()
{
    rep(i, 1, N + 1)
        C[0][i] = 0;
    rep(i, 0, N + 1)
        C[i][0] = 1;
    rep(i, 1, N + 1)
        rep(j, 1, i + 1)
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
}

ll fact[1000 + 1], rfact[1000 + 1];

void init()
{
    fact[0] = 1;
    rep(i, 1, 1000 + 1)
        fact[i] = (fact[i - 1] * i) % MOD;
    rep(i, 0, 1000 + 1)
        rfact[i] = bin_pow(fact[i], MOD - 2);
}

void add(int &x, int y)
{
    x += y;
    if (x >= MOD)
        x -= MOD;
}

int dp[N + 1][N + 1];

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    init();
    init_C();
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    dp[0][0] = 1;
    rep(i, 0, n + 1)
        rep(j, 0, n)
        {
            ll v = 1;
            rep(cnt, 0, (n - i) / (j + 1) + 1)
            {
                if (cnt == 0 || ((j + 1) >= a && (j + 1) <= b && cnt >= c && cnt <= d))
                    add(dp[i + (j + 1) * cnt][j + 1], 1LL * dp[i][j] * C[i + (j + 1) * cnt][i] % MOD * fact[(j + 1) * cnt] % MOD * rfact[cnt] % MOD * v % MOD);
                v = (v * rfact[j + 1]) % MOD;
            }
        }
    /*rep(i, 0, n + 1)
    {
        rep(j, 0, n + 1)
            cout << dp[i][j] << " ";
        cout << "\n";
    }*/
    cout << dp[n][n] << "\n";
    return 0;
}


Measured memory_bytes: 8064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define readi(x) scanf("%d", &x)
#define reads(s) scanf("%s", s)
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int a, b, c, x, y;
  readi(a); readi(b); readi(c); readi(x); readi(y);

  int ans = 0;
  if ( a + b > 2 * c ) {
    if ( x > y ) // Aの枚数が多い
      ans += y * 2 * c + min(a, 2 * c) * (x - y);
    else         // Bの枚数が多い
      ans += x * 2 * c + min(b, 2 * c) * (y - x);
  } else {
    ans += a * x + b * y; 
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

char lis[5] = { 'M','A','R','C','H' };
void solve() {
	map<char, int>mp;
	int N; cin >> N;
	REP(i, N) {
		string S; cin >> S;
		char c = S[0];
		mp[c]++;
	}

	int perm[5] = { 0,0,1,1,1 };
	int ans = 0;
	do {
		ll res = 1;
		REP(i, 5) {
			if (perm[i])res *= mp[lis[i]];
		}
		ans += res;
	} while (next_permutation(perm, perm + 5));;
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
N = int(input())
S = [input() for _ in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0

for s in S:
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    elif s == "RE":
        RE += 1

print("AC x ", AC)
print("WA x ", WA)
print("TLE x ", TLE)
print("RE x ",RE)

Measured memory_bytes: 16340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<800000;i++){
		if(ll(i*1.08)==n){
			cout <<i;
			return 0;
		}
	}
	cout << ":(";
	// your code goes here
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#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 leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int ans = 0;
  int n,now,next;
  cin >> n >> next;
  ans += next;
  rep(i,0,n-1){
    now = next;
    cin >> next;
    ans += max(0LL,next-now);
  }
  cout << ans << endl;
}


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


int main() {
    vector<string> V(3);
    vector<int> W(3),X(3,-1);
    for(int i=0;i<3;i++){
        cin >> V.at(i);
        W.at(i)=V.at(i).length()-1;
    }
    char ans='a';
    char D='a';
    
    while(1){
        if(D=='a'){
            X.at(0)++;
            if(X.at(0)>W.at(0)){
                ans='A';
                break;
            }
            else{
                D=V.at(0).at(X.at(0));
            }
        }
        if(D=='b'){
            X.at(1)++;
            if(X.at(1)>W.at(1)){
                ans='B';
                break;
            }
            else{
                D=V.at(1).at(X.at(1));
            }
        }
        if(D=='c'){
            X.at(2)++;
            if(X.at(2)>W.at(2)){
                ans='C';
                break;
            }
            else{
                D=V.at(2).at(X.at(2));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256