akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,d;
  cin >> n >> d;
  int ans = 0;
  rep(i,n) {
    ll x,y;cin >> x >> y;
    if(sqrt(x*x+y*y) <= d) ans++;
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 3676
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int a,b,c,d,e,f;
        double temp1,temp2;
        double x,y;
        while(s.hasNext()){
            a=s.nextInt();
            b=s.nextInt();
            c=s.nextInt();
            d=s.nextInt();
            e=s.nextInt();
            f=s.nextInt();
            temp1=a*e-b*d;
            temp2=c*e-b*f;
            x=temp2/temp1;
            if(x==0)
                x=0;
            y=(c-a*x)/b;
            System.out.printf("%1.3f %1.3f\n",x,y);
        }
    }
}

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

#define ll long long
const int MOD = 1e9 + 7;

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    vector < vector < char > > g(a, vector < char >(b));
    vector < vector < int > > dp(a, vector < int >(b, 0));
    dp[0][0] = 1;
    for(int i = 0; i < a; i++){
        for(int j = 0; j < b; j++){
            cin>>g[i][j];
        }
    }
    for(int i = 0; i < a; i++){
        for(int j = 0; j < b; j++){
            if(g[i][j] == '#')
                continue;
            if(i - 1 >= 0) dp[i][j] = (dp[i - 1][j] + dp[i][j]) % MOD;
            if(j - 1 >= 0) dp[i][j] = (dp[i][j - 1] + dp[i][j]) % MOD;
        }
    }
    printf("%d\n", dp[a-1][b-1]);
    return 0;
}

Measured memory_bytes: 5248
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	int cnt = 0;
	vi vis(30, 0);
	rep(i, n){
		char c;
		cin >> c;
		vis[c - 'A']++;
		if(vis[c - 'A'] == 1) cnt++;
	}
	if(cnt == 4) cout << "Four" << endl;
	else cout << "Three" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int flag = 0;
  for(int i=a; i<=10000;i=i+a){
    if(i%b==c){
      flag = 1;
      cout << "YES"<<endl;
      break;
    }
  }
    if(flag==0) cout <<"NO"<<endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
lr = []
for _ in range(k):
    l, r = map(int, input().split())
    lr.append((l, r))
mod = 998244353
dp = [0]*(2*n+1)
dp[0] = 1
dp[1] = -1
now = 1
for i in range(n-1):
    for l, r in lr:
        dp[i+l] += now
        dp[i+r+1] -= now
    now += dp[i+1]
    now %= mod
print(now)

Measured memory_bytes: 70868
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=200005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
char str[max_n];
void rs(string& s){scanf(" %s",str);s=str;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n;
ll k;
int a[max_n];
bool vis[max_n];
int main(){
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",a+i);
    vector<int> v;
    int now=1;
    while(!vis[now]){
        v.push_back(now);
        vis[now]=true;
        now=a[now];
    }
    int x=0;
    for(int i=0;i<v.size();i++)if(v[i]==now)x=i;
    int l=v.size()-x;
    if(k<x)printf("%d\n",v[k]);
    else{
        k-=x;
        printf("%d\n",v[k%l+x]);
    }
    return 0;
}

Measured memory_bytes: 5320
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



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

  ll a;
  string s;
  cin >> a >> s;

  cout << ((a>=3200) ? s : "red") << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vr vector
#define pb push_back

 int main()
 {

 string s;
 cin>>s;
 if(s=="AAA" || s=="BBB")
    cout<<"No";
else
    cout<<"Yes";


cout<<endl;



    return 0;
}





Measured memory_bytes: 256
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ALDS1_1-B
?????§??¬?´???°

??????????????¶??° x, y ?????\?????¨???????????????????????§??¬?´???°????±???????????????°????????????????????????????????????

???????????´??° x ??¨ y ???????????????x ?? d ??¨ y ?? d ??????????????¨?????? 0 ??¨?????? d ??????????????§???????????????x ??¨ y ????????§??¬?´???°???Greatest Common Divisor?????¨?¨?????????????????????°???35 ??¨14 ????????§??¬?´???° gcd (35, 14) ??? 7 ??¨???????????????????????????35 ????´???°{1, 5, 7, 35}???14 ????´???° {1, 2, 7, 14} ?????¬?´???° {1, 7} ????????§?????¨???????????????
??\???

x ??¨ y ?????????????????????????????§??????????????????????????????
??????

?????§??¬?´???°???????????????????????????????????????
??¶?´?

    1 ??? x, y ??? 109

?????????

??´??° x, y ???????????????x ??\ y ????????° x ??¨ y ????????§??¬?´???°??? y ??¨ x % y ????????§??¬?´???°???????????????????????§ x % y ??? x ??? y ??§?????£???????????§????????????
??\?????? 1

147 105

??\?????? 1 ??????????????????

21

=end
def gcd1(a, b)
  a.gcd(b)
end

def gcd2(a, b)
  if b==0 then
    a
  else
    gcd2(b, a % b)
  end
end

class Main
  def initialize
    fh = STDIN
    v=[]
    v = fh.gets.chomp.split.map{|x| x.to_i}
    puts gcd2(v[0],v[1])
  end
end

if $0==__FILE__ then
  Main.new()
end

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

using namespace std;

int main() {
	int N;
	cin >> N;
	double x[100];
	string u[100];

	for (int i = 0; i < N; i++) {
		cin >> x[i] >> u[i];
	}

	double ans = 0;
	for (int i = 0; i < N; i++) {
		if (u[i] == "BTC") {
			x[i] = x[i] * 380000.0;
		}
		ans += x[i];
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN 200005

ll t[4*MAXN], arr[MAXN];
void build(ll node, ll start, ll end){
    if(start == end){
        t[node] = arr[start];
        ret;
    }
    ll mid = (start+end)/2;
    build(2*node, start, mid);
    build(2*node+1, mid+1, end);
    t[node] = max(t[2*node], t[2*node+1]);
}

void update(ll node, ll start, ll end, ll idx, ll val){
    if(start == end){
        t[node] = val;
        arr[idx] = val;
        return;
    }
    ll mid = (start+end)/2;
    if(idx<=mid && idx>=start){
        update(2*node, start, mid, idx, val);
    }
    else {
        update(2*node+1, mid+1, end, idx, val);
    }
    t[node]=max(t[2*node], t[2*node+1]);
}

ll query(ll node, ll start, ll end, ll l, ll r){
    if(end<l || start>r){
        return -inf;
    }
    else if(start>=l && end<=r){
        return t[node];
    }
    ll mid = (start+end)/2;
    ll p1 = query(2*node, start, mid, l, r);
    ll p2 = query(2*node+1, mid+1, end, l, r);
    return max(p1, p2);
}

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

    ll n;
    cin>>n;
    ll h[n+1], a[n+1], b[n+1];
    loop(i,1,n+1) {
        cin>>h[i];
        b[h[i]] = i;
    }
    loop(i,1,n+1) cin>>a[i];

    ll dp[n+1];
    dp[1] = a[b[1]];

    // ll arr[n+1];
    loop(i,0,n+1) arr[i] = -1;

    build(1, 1, n);
    update(1, 1, n, b[1], dp[1]);
    loop(i,2,n+1){
        ll x = b[i];
        ll res = query(1, 1, n, 1, x-1);
        if(res != -1){
            dp[i] = res + a[b[i]];
        }
        else dp[i] = a[b[i]];
        update(1, 1, n, b[i], dp[i]);
    }

    ll ans = INT_MIN;
    loop(i,1,n+1){
        ans = max(ans, dp[i]);
    }
    print(ans);

    
}



Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll INF=1LL << 60;
const ll MOD=1e9+7;

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

  int s;
  cin >> s;
  int c[2001];
  c[0]=1;c[1]=c[2]=0;
  rep1(i, s)if(i>=3)c[i]=(c[i-1]+c[i-3])%MOD;

  cout << c[s] << endl;

  return 0;
}

Measured memory_bytes: 3648
x = int(input())

if x <600:
    print(8)
elif x<800:
    print(7)
elif x<1000:
    print(6)
elif x<1200:
    print(5)
elif x<1400:
    print(4)
elif x<1600:
    print(3)
elif x<1800:
    print(2)
elif x<2000:
    print(1)

Measured memory_bytes: 61588
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    int s_len = s.length(), t_len = t.length();
    s.insert(0, 1, '#');
    t.insert(0, 1, '#');
    vector<vector<long long>> dp(s_len + 1, vector<long long>(t_len + 1));
    for (int i = 1; i <= s_len; i++)
    {
        for (int j = 1; j <= t_len; j++)
        {
            if (s[i] == t[j])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
    string ans;
    int i = s_len, j = t_len;
    while (i > 0 && j > 0)
    {
        if (dp[i][j] == dp[i][j - 1])
        {
            j--;
        }
        else if (dp[i][j] == dp[i - 1][j])
        {
            i--;
        }
        else
        {
            ans += s[i];
            i--;
            j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

long long comb(ll n, ll r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    ll i;

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

    return ans;
}

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> v(n);
  map<ll, ll> mp;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    mp[v[i]]++;
  }
  sort(rall(v));
  ll sum = 0;
  ll big_num = 0;
  for (int i = 0; i < a; i++) {
    sum += v[i];
    if(v[i] > v[a-1]) big_num++;
  }

  long double ave = double(sum) / double(a);
  printf("%LF\n",ave);

  ll res = 0;
  if(a <= mp[v[0]]){
    for (int i = a; i <= mp[v[0]] && i <= b; i++) {
      res += comb(mp[v[0]], i);
    }
  }else if(mp[v[a-1]] >= 2){
    res += comb(mp[v[a-1]], a-big_num);
  }else res++;

  cout << res << endl;
}


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

string s;
bool ans=1;
int n;

int main(){
	cin >> s;
	n=s.length();
	for (int i=0;i<n;i++){
		if (s[i]!=s[n-1-i]) ans=0;
	}
	for (int i=0;i<n/2;i++){
		if (s[i]!=s[(n/2)-1-i]) ans=0;
		if (s[(n/2)+1+i]!=s[n-1-i]) ans=0;
	}
	cout << (ans ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
int n;
int main() {
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<int> p(n);
	int ret = 0;
	bool flag = true;
	for (int i = 29; i >= 0 && flag; i--) {
		int s = 0;
		for (int j = 0; j < n; j++) s ^= a[j] >> i & 1;
		if (s == 0) continue;
		bool ok = false;
		for (int j = 0; j < n && !ok; j++) {
			if (p[j] == 1) continue;
			if ((a[j] >> i & 1) == 1 && a[j] >> i << i == a[j]) {
				p[j] = 1; a[j]--; ret++;
				ok = true;
			}
		}
		if (!ok) flag = false;
	}
	cout << (flag ? ret : -1) << endl;
	return 0;
}

Measured memory_bytes: 1152
s = int(input())

l = [0 for _ in range(1000000)]

l[s] += 1

for i in range(1000000):
  if s % 2 == 0:
    s //= 2
    if l[s] > 0:
      print(i+2)
      break
    else:
      l[s] += 1
  else:
    s = 3 * s + 1
    if l[s] > 0:
      print(i+2)
      break
    else:
      l[s] += 1

Measured memory_bytes: 113904
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MIN(a,b) ((a)<(b)?(a):(b))

long main(void){
    long N;
    long M = 1000000000000;
    long cnt = 0;
    scanf("%ld", &N);
    for (int i = 1; i <= (int)sqrt(N); i++) {
        if (N % i == 0) {           
            M = MIN(N/i + i - 2,M);
        }
    }
    printf("%ld\n",M);
    return 0;
}


Measured memory_bytes: 128
import java.util.*

fun main(args:Array<String>){
    val (n,l) = readLine()!!.split(" ").map{it.toInt()}
    val s = ArrayList<String>()
    for(i in 0 until n){
        s.add(readLine()!!)
    }
    s.sort()
    s.forEach{
        print(it)
    }
    println()
}


Measured memory_bytes: 36008
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n+1],l[n+1],r[n+1],looking[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		l[i]=i-1;
		r[i]=i+1;
		looking[a[i]]=i;
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		int l1=l[looking[i]],r1=r[looking[i]];
		int l2=l[l1],r2=r[r1];
		if(l1!=0)
		{
			ans+=1ll*(l1-l2)*(r1-looking[i])*i;
		}
		if(r1!=n+1)
		{
			ans+=1ll*(r2-r1)*(looking[i]-l1)*i;
		}
		r[l1]=r1;
	   	l[r1]=l1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string s,p;
int num,pos,ans;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(i==0)ans++,p=s[0],pos=1;
		else if(i-pos+1!=p.size()||s[i]!=p[0])
			p=s.substr(pos,i-pos+1),pos=i+1,ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) cin >> A[i];
    int ans = 0;
    rep(i, n) {
        if(i + 1 < n && A[i] == A[i + 1]) continue;
        else if(A[i] < A[i + 1]) {
            while(i + 1 < n && A[i] <= A[i + 1]) i++;
        }
        else if(A[i] > A[i + 1]) {
            while(i + 1 < n && A[i] >= A[i + 1]) i++;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
N = int(input())
T, A = map(int, input().split())
HL = list(map(int, input().split()))

HL1 = [(x[0], abs(A - (T - x[1] * 0.006)), ) for x in enumerate(HL)]

HL1.sort(key=lambda x: x[1])

print(HL1[0][0] + 1)


Measured memory_bytes: 3188
class Heap
  attr_reader :size

  def initialize
    @heap = []
    @size = 0
  end

  def add(arr)
    i = @size
    while i > 0 do
      parent_index = (i - 1) / 2
      break if arr[0] <= @heap[parent_index][0]
      @heap[i] = @heap[parent_index]
      i = parent_index
    end
    @heap[i] = arr
    @size += 1
  end

  def pop
    return if @size <= 0
    max_arr = @heap[0]
    @size -= 1
    n = @heap[@size]
    i = 0
    while i * 2 + 1 < @size do
      child_index1 = i * 2 + 1
      child_index2 = i * 2 + 2
      if child_index2 < @size && @heap[child_index2][0] > @heap[child_index1][0]
        child_index1 = child_index2
      end
      break if @heap[child_index1][0] <= n[0]
      @heap[i] = @heap[child_index1]
      i = child_index1
    end
    @heap[i] = n
    max_arr
  end

  def max; @heap[0] end
  def size; @size end
end

x,y,z,k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i).sort.reverse
b = gets.chomp.split(" ").map(&:to_i).sort.reverse
c = gets.chomp.split(" ").map(&:to_i).sort.reverse
hash = Hash.new(0)
heap = Heap.new
heap.add([a[0]+b[0]+c[0],0,0,0])
hash[[0,0,0]] = 1
k.times do
  maxarr = heap.pop
  puts maxarr[0]
  i = maxarr[1]
  j = maxarr[2]
  k = maxarr[3]
  if i+1 < x && hash[[i+1,j,k]] == 0
    heap.add([a[i+1]+b[j]+c[k],i+1,j,k])
    hash[[i+1,j,k]] = 1
  end
  if j+1 < y && hash[[i,j+1,k]] == 0
    heap.add([a[i]+b[j+1]+c[k],i,j+1,k])
    hash[[i,j+1,k]] = 1
  end
  if k+1 < z && hash[[i,j,k+1]] == 0
    heap.add([a[i]+b[j]+c[k+1],i,j,k+1])
    hash[[i,j,k+1]] = 1
  end
end

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

int a[50], b[50], c[50], d[50], e[50];
int n, m, q; //n:数列のながさ、m:数値の最大値, q:a~dの組みの数
int ret = 0;

void dfs(int pos, int val){
    if(pos == n){
        int tmp = 0;
        for(int i = 0; i < q; i++){
            tmp += d[i] * (e[b[i]]-e[a[i]] == c[i]); //真理値を１か０にしてかけている！
        }
        ret = max(ret, tmp); //tmpはそのサイクルでの得点で、retより大きければ更新していく
        return;
    }
    for(int i = val; i <= m; i++){
        e[pos] = i;
        dfs(pos+1, i);
    }
}

int main(){
    cin >> n >> m >> q;
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i]; //q行分4つずつ受け取っていく
        a[i]--, b[i]--; // indexに使えるように--しておく
    }
    dfs(0,1);
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		
		int num = sc.nextInt();
		
		if(num%2 == 1)
			System.out.println(num/2);
		else
			System.out.println(num/2-1);
	}
}


Measured memory_bytes: 21972
N, K = map(int, input().split())

result = 1
for i in range(K, N+1):
    tmp_min = (i - 1) * i // 2
    tmp_max = (N * (N + 1) - (N - i) * (N - i + 1)) // 2
    result += tmp_max - tmp_min + 1
    result %= 10 ** 9 + 7

print(result)



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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  int x, y;
  cin >> x >> y;
  if ((x+y)%3) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x+y)/3;
  x -= n; y -= n;
  if (x < 0 || y < 0) {
    cout << 0 << endl;
    return 0;
  }
  combination c(x+y);
  mint ans = c(x+y,x);
  cout << ans.x << endl;//お試し
  return 0;
}

Measured memory_bytes: 13804
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<string> w(n);
  for(int i=0;i<n;i++)cin>>w[i];
  bool ans=true;
  for(int i=0;i<n-1;i++){
    if(w[i][w[i].size()-1]!=w[i+1][0])ans=false;
    for(int j=0;j<i;j++){
      if(w[i]==w[j])ans=false;
    }
  }
  for(int i=0;i<n-1;i++){
    if(w[n-1]==w[i])ans=false;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
}


Measured memory_bytes: 26348
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100100100100100100;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll K;
    cin >> K;
    cout << 50 << endl;
    rep(i,50){
        if(i < 50 - K % 50){
            cout << K / 50  - (K % 50) + 50 - 1 << ' ';
        }else{
            cout << K / 50 + 50 - K % 50 + 50 << endl;
        } 
    }
}



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

using namespace std;

struct BIT{
  vector<int>node;
  int sz;
  BIT(int sz):sz(sz){
    node.resize(sz,0);
  }
  int sum(int i){
    int res=0;
    for(i--;i>=0;i=(i&(i+1))-1)res+=node[i];
    return res;
  }
  void add(int i,int x){
    for(;i<sz;i|=i+1)node[i]+=x;
  }
  int sum(int l,int r){
    return sum(r)-sum(l);
  }
};

signed main(){
  int N;
  string S;
  cin>>N>>S;
  vector<BIT>bits;
  for(int i=0;i<26;i++)bits.push_back(BIT(N));
  for(int i=0;i<N;i++){
    bits[S[i]-'a'].add(i,1);
  }
  int Q;
  cin>>Q;
  for(int i=0;i<Q;i++){
    int q;
    cin>>q;
    if(q==1){
      int index;
      char c;
      cin>>index>>c;
      index--;
      bits[S[index]-'a'].add(index,-1);
      bits[c-'a'].add(index,1);
      S[index]=c;
    }
    if(q==2){
      int l,r;
      cin>>l>>r;
      l--,r--;
      int ans=0;
      for(int j=0;j<26;j++){
        ans+=min(bits[j].sum(l,r+1),1ll);
      }
      cout<<ans<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 102532
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 998244353
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}

ll modpow(ll x,ll n){
    ll ret=1;
    while(n>0){
        if(n&1) ret=ret*x%mod;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x=x*x%mod;
        n>>=1;  // n を1bit 左にずらす
    }
    return ret;
}

int main(){
    ll n;cin>>n;
    vector<ll> d(n);
    rep(i,n) cin>>d[i];
    vector<ll> hm(100010,0);//距離ごとに個数を調べる
    
    if(d[0]!=0){
        cout<<0<<endl;
        return 0;
    }

    sort(d.begin(),d.end());
    
    rep(i,n){
        if(i!=0 && d[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    rep(i,n-1){
        if(d[i+1]-d[i]>1){
            cout<<0<<endl;
            return 0;
        }
    }


    rep(i,n){//count
        hm[d[i]]++;
    }

    ll ans=1;
    rep(i,100001){
        if(hm[i+1]==0) break;
    
        ans*=modpow(hm[i],hm[i+1]);
        ans%=mod;
    }

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

Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
#define mod 1000000007
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i];
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum;

char s[N];

int main()
{
	fast;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		if(s[i]=='Y')
			return cout<<"Four",0;
	}
	cout<<"Three";


}

Measured memory_bytes: 256
#include <stdio.h>
int     main(void)
{
    int W, H, x, y, r;
    scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
    
    if ((x - r < 0) || (y - r < 0) || (x + r > W) || (y + r > H))
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    return (0);
}



Measured memory_bytes: 2096
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if (n < 1000)
	{
		
		cout<<"ABC"<< endl;
	}
	else
	{
		cout << "ABD" << endl;
	}
	return 0;
}
/*
死のマウス
.　　あり許せん！
　　　∧＿＿∧
　|| （＃｀Д´ ） ||
　|| ( |　 　| | |||
　从| |　 　| |从从
￣) ⊂ノ￣￣!_つ￣て
　フヘ(　　　　ヽヘ(＼

*/

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>

using namespace std;

typedef long long ll;

const int maxn= 1e4+5;

int main() {
	int L , R , d;
	scanf("%d %d %d", &L ,&R ,&d);
	int cnt = 0;
	for(int i = L ; i <= R ; i++) {
		if(i % d == 0) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main() {
	int x;
	cin>>x;
	int lim = 599,ans = 8;
	while(true) {
		if(x<=lim) {
			cout<<ans;
			return 0;
		}
		lim+=200;
		--ans;
	}
	
}



Measured memory_bytes: 3512
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main() {
    int N,M;
    map<string, int>mp;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        string s;
        cin >> s;
        mp[s]--;
    }

    int ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        ans = max(ans, itr->second);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for(int i=m; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <typename T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0; }
template <typename T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1;} return 0; }


 

int main() {
  int h,w; cin>>h>>w;
  int c[10][10];
  rep(i,0,10) rep(j,0,10) cin>>c[i][j];
  int ans[10]={0};
  rep(i,0,h) rep(j,0,w){
      int a; cin>>a;
      if(a!=-1) ans[a]++;
  } 

  rep(k,0,10) rep(i,0,10) rep(j,0,10){
      c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
  }

  ll res=0;
  rep(i,0,10){
      res+=ans[i]*c[i][1];
  }

  cout<<res<<endl;



}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            for (int k = n - 1; k > i; --k) {
                if (a[k] < a[k - 1]) {
                    int temp = a[k];
                    a[k] = a[k - 1];
                    a[k - 1] = temp;
                    ++swaps;
                }
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");                
        System.out.println(swaps);
    }            
}

Measured memory_bytes: 19096
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef unsigned long long ll;

int main()
{
	ll n;cin >> n;
	ll sum = 0;
	for(ll i = 1;i <= n;++i)
		if(i % 3 != 0 && i % 5 != 0)	
			sum += i;
	cout << sum;
    return 0;
}


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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

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

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;

    set<string> se;
    while (n--) {
        string s;
        cin >> s;
        se.insert(s);
    }

    cout << se.size() << endl;
    return 0;
}


Measured memory_bytes: 19276
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 212345

class UF {
public:
	int p[N], h[N], c[N];
	UF(){
		iota(p, p+N, 0);
		fill(h, h+N, 0);
		fill(c, c+N, 1);
	}
	int group(int a){
		int &ret = p[a];
		if (ret != a) ret = group(ret);
		return ret;
	}
	void merge(int a, int b){
		a = group(a);
		b = group(b);
		if(a == b) return;
		if(h[a] < h[b]) swap(a, b);
		p[b] = a;
		LAR(h[a], h[b] + 1);
		c[a] += c[b];
	}
} uf;

int main(){
	int n, m; scanf("%d%d", &n, &m);
	REP(i, m){
		int a, b; scanf("%d%d", &a, &b);
		uf.merge(a, b);
	}
	int ans = 0;
	FOR(i, 1, n+1){
		if(uf.p[i] == i) LAR(ans, uf.c[i]);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 6288
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
cnt = 0

# 偶数
#if a != 0:
#    if a % 2 != 0:
#        a = a - 1

# 奇数


# 組み合わせ
nCr = {}

# https://qiita.com/derodero24/items/91b6468e66923a87f39f
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


#
if a > 1:
    cnt = cnt + cmb(a, 2)

if b > 1:
    cnt = cnt + cmb(b, 2)
print(cnt)


Measured memory_bytes: 3064
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll H, W, h, w;
	cin >> H >> W >> h >> w;

	ll x = H * W;
	ll y = H * w + h * W;
	ll z = h * w;
	cout << x - y + z << endl;
	return 0;
}

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

vector<int>vc;

int main()
{
    ll a,b,cnt=0,ans=2018;
    cin >> a >> b;
    for(ll i =a;i<=b;i++)
    {
        ll x = i%2019;
        vc.push_back(x);
        cnt++;
        if(cnt>2020)break;
    }
    int s = vc.size();
    for(int i=0;i<s;i++)
    {
        for(int j=i+1;j<s;j++)
        {
            ll x = (vc[i] * vc[j])%2019;
            ans = min(ans,x);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
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 MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#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 count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#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;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
int main() {
  cout << fixed << setprecision(30);
 ll n;
  cin>>n;
  ll ans;
  Loop(i,n,1000000){
    if(primejudge(i)){
      ans=i;
      break;
    }
  }
    putout(ans);
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using llu = long long unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b,c,x,y;
    Scd3(a,b,c);
    Scd2(x,y);
    if( x<y ) swap(x,y), swap(a,b);

    int ans = INF;
    Rep(i,x+1){
        int tmp = 0;
        tmp += i*a;
        tmp += (x-i)*2*c;
        tmp += max(0LL, y-x+i)*b;
        ans = min(ans, tmp );
    }

    printf ("%d\n", ans );

    return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v)
    is >> x;
  return is;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

struct TrieMap {

  int A;
  vector<vector<int>> trans;
  vector<int> value;

  TrieMap() {}

  TrieMap(int A) : A(A), trans(1, vector<int>(A, -1)), value(1, -1) {}

  int get(int o) const { return value[o]; }

  int getId(const vector<int> &s) const {
    int o = 0;
    for (int c : s) {
      o = trans[o][c];
      if (o == -1)
        return -1;
    }
    return o;
  }

  int getV(const vector<int> &s) const { return value[getId(s)]; }

  int extend(int o, int c) {
    if (trans[o][c] == -1) {
      trans[o][c] = trans.size();
      trans.push_back(vector<int>(A, -1));
      value.push_back(-1);
    }
    return trans[o][c];
  }

  void ins(const vector<int> &s, int v) {
    int o = 0;
    for (int c : s) o = extend(o, c);
    value[o] = v;
  }
} mp;

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<string> s(n);
  cin >> s;
  TrieMap trieMap(26);
  for (int i = 0; i < n; ++i) {
    reverse(s[i].begin(), s[i].end());
    vector<int> vec;
    for (int j = 0; j < s[i].size(); ++j) {
      vec.push_back(s[i][j] - 'a');
    }
    trieMap.ins(vec, 1);
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int id = 0;
    vector<int> occ(26);
    ans -= 1;
    for (char c : s[i]) ++occ[c - 'a'];
    for (int j = 0; j < s[i].size(); ++j) {
      for (int t = 0; t < 26; ++t)
        if (occ[t]) {
          int jd = trieMap.trans[id][t];
          if (jd != -1 && trieMap.value[jd] == 1)
            ++ans;
        }
      --occ[s[i][j] - 'a'];
      id = trieMap.trans[id][s[i][j] - 'a'];
    }
  }
  cout << ans << '\n';

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 141236