akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n;
    cin >> n;
    vector<int> v1(n);
    vector<int> v(0);
    for(int i=0; i<n; i++){
        cin >> v1.at(i);
    }
    sort(v1.begin(), v1.end());
    int res = 0;
    v = v1;
    for(int i=0; i<v.size()-2; i++){
        for(int j=i+1; j<v.size()-1; j++){
            for(int k=j+1; k<v.size(); k++){
                if(v.at(i) < v.at(j) + v.at(k) &&
                   v.at(j) < v.at(k) + v.at(i) &&
                   v.at(k) < v.at(i) + v.at(j)){
                    res++;
                }
            }
        }
    }
    cout << res << endl;
    
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=998244353;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    long A, B;
    cin>>A>>B;

    if(B==1){
        cout<<0<<endl;
    }else if(B<=A){
        cout<<1<<endl;
    }else{
        cout<<ceil((B-A)*1.0/(A-1)) + 1<<endl;
    }

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 3780
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)


constexpr int MOD = 1000000007;

int N, M;


int fac_mod(int n)
{
    long long x = 1;
    for(int i = n; i >= 2; --i) {
        x *= i;
        x %= MOD;
    }
    return x;
}

int main()
{
    cin >> N >> M;

    long long ans;
    if(N == M) {
        ans  = fac_mod(N);
        ans *= fac_mod(M);
        ans %= MOD;
        ans *= 2;
        ans %= MOD;
    }
    else if(abs(N-M) == 1) {
        ans  = fac_mod(N);
        ans *= fac_mod(M);
        ans %= MOD;
    }
    else {
        ans = 0;
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;

int a[100005];

int check(string s) {
	if (s == "Vacant") {
		return 0;
	}
	else if (s == "Male") {
		return 1;
	}
	else {
		return 2;
	}
}

int main() {
	int n;
	string s;
	cin >> n;
	int t1, t2;
	t1 = 0; t2 = n;
	printf("%d\n", 0);
	int b;
	cin >> s;
	int t = check(s);
	if (t == 0) { 
		fflush(stdout);
		return 0;
	}
	else {
		a[0] = a[n] = t;
	}
	while (t2 - t1 > 1) {
		int mid = (t2 + t1) / 2;
		printf("%d\n", mid);
		cin >> s;
		t = check(s);
		if (t == 0) {
			fflush(stdout);
			return 0;
		}
		else {
			a[mid] = t;
		}
		if (((mid - t1) % 2 == 0 && (a[t1] != a[mid]) || ((mid - t1) % 2 == 1 && a[t1] == a[mid]))) {
			t2 = mid;
		}
		else {
			t1 = mid;
		}
	}
}


Measured memory_bytes: 852
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

template<class T>
inline istream& operator >>( istream& s, vector<T>& v ) {
	for( size_t i = 0; i < v.size(); ++i ) { s >> v[i]; }
	return s;
}

template<class T>
inline ostream& operator <<( ostream& s, vector<T>& v ) {
	for( size_t i = 0; i < v.size(); ++i ) {
		s << v[i];
		if( i < v.size()-1 ) { s << ' '; }
	}
	return s;
}


int main() {
	ios_base::sync_with_stdio( false );

	int n;
	cin >> n;
	vector<int> a( n );
	cin >> a;
	int q;
	cin >> q;
	while( q-- > 0 ) {
		int b, e, t;
		cin >> b >> e >> t;
		auto it = a.begin();
		swap_ranges( it+b, it+e, it+t );
	}
	cout << a << endl;

	return 0;
}



Measured memory_bytes: 3208
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    string S;
    cin >> S;

    vector<string> day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    int index = find(day.begin(), day.end(), S) - day.begin();

    cout << 7 - index << endl;

    return 0;
}


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

int main(){
    int n, m;
    cin >> n;
    m=n;
    int f=0;
    rep(i, 10){
        f += (n%10);
        n /= 10;
    }

    if(m%f==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

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

vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

bool check(long long d, long long k, const vector<long long> &a) {
    int len = (int)a.size();
    vector<long long> b(len);
    long long sum = 0;
    for (int i = 0; i < len; i++) {
        b.at(i) = a.at(i) % d;
        sum += b.at(i);
    }
    
    sort(b.begin(), b.end());
    long long mod_sum = 0;
    for (int i = 0; i < len - sum / d; i++) {
        mod_sum += b.at(i);
    }
    
    if (mod_sum <= k) return true;
    else return false;
}

int main() {
    long long n, k;
    cin >> n >> k;
    vector<long long> a(n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        sum += a.at(i);
    }

    vector<long long> div = divisor(sum);
    sort(div.begin(), div.end());
    reverse(div.begin(), div.end());
    for (int i = 0; i < (int)div.size(); i++) {
        if (check(div.at(i), k, a)) {
            cout << div.at(i) << endl;
            return 0;
        }
    }
}   

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

int main()
{
    // 整数の入力
    long long X,Y;
    cin >> X >> Y;

    if (abs(X - Y) <= 1){
        cout << "Brown" << endl;
    }else{
        cout << "Alice" << endl;
    }

    return 0;
}

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

typedef long long lint; typedef pair<int, int> ii;
const int MOD = 1'000'000'007, MOD2 = 1'000'000'009;
const int INF = 0x3f3f3f3f; const lint BINF = 0x3f3f3f3f3f3f3f3fLL;

int n, xx1, yy1, xx2, yy2;

struct pt{
	int xx, yy;
	bool operator<(const pt &rhs) const{
		return yy < rhs.yy;
	}
} a[200005];

int lis(vector<int> a){
	if(a.size() == 0) return 0;
	vector<int> s(a.size());
	int l = 0;
	s[l++]=a[0];
	for(int i=1;i<(int)a.size();i++)
		if(a[i]>s[l-1])
			s[l++]=a[i];
		else
			*lower_bound(s.begin(),s.begin()+l,a[i])=a[i];
	return l;
}

int solve(){
	cin >> xx1 >> yy1 >> xx2 >> yy2 >> n;
	for(int i=0;i<n;i++) cin >> a[i].xx >> a[i].yy;
	if(xx1 > xx2){
		for(int i=0;i<n;i++) a[i].xx *= -1;
		xx1 *= -1, xx2 *= -1;
	}
	if(yy1 > yy2){
		for(int i=0;i<n;i++) a[i].yy *= -1;
		yy1 *= -1, yy2 *= -1;
	}

	long double orig = 100LL * (xx2 - xx1 + yy2 - yy1);

	long double wtf = 20LL * atan((long double) 1) * 2LL - 20LL;

	sort(a, a+n);
	vector<int> b;
	for(int i=0;i<n;i++) if(a[i].yy >= yy1 && a[i].yy <= yy2 && a[i].xx >= xx1 && a[i].xx <= xx2) b.push_back(a[i].xx);
	long double cand = 20LL - 20LL * atan((long double) 1LL);
	int lss = lis(b);
	long double ans = orig - 1LL * lss * cand;
	if(lss >= min(xx2 - xx1 + 1, yy2 - yy1 + 1)) ans += wtf + cand;
	cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

int main(){
	ios::sync_with_stdio(0);
	// int t; cin >> t; while(t--)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 4340
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A; cin >> A;

	printf("%.9f\n", A * 2 * 3.14159);

	return 0;
}



Measured memory_bytes: 3768
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int n, a;
bool b[4][13];  
const char suit[4] = {'S', 'H', 'C', 'D'};
int main() {
	cin >> n;
	rep(i,n) {
		char s[3];
		cin >> s >> a;
		char c = s[0];
		rep(j,4) {
			if(c == suit[j]) {
				b[j][a - 1] = true;
			}
		}
	}
	rep(i,4) {
		rep(j,13) {
			if(!b[i][j]) {
				cout << suit[i] << ' ' << j + 1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>



int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




int main(void){
    int price[4];
    long long n;
    unsigned long long min = 10000000000000000;
    int mini;
    unsigned long long ans = 0;
    for (int i = 0; i < 4; i++){
        scanf("%d", &price[i]);
    }
    scanf("%lld", &n);
    n *= 4;
    for (int i = 0; i < 3; i++){
        if (min > price[i]*(int)pow(2, 3-i)){
            min = (unsigned long long)price[i]*(int)pow(2, 3-i);
            mini = i;
        }
    }
    if (min > price[3]){
        ans = (unsigned long long)n/8*price[3]+(n%8)/(int)pow(2, mini)*price[mini];
    }else{
        ans = (unsigned long long)n/(int)pow(2, mini)*price[mini];
    }

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

    return 0;
}


Measured memory_bytes: 256
#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 fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    string s;cin>>s;
    string ans;

    ll n=s.size();
    rep(i,n){
        if(s[i]=='0') ans.push_back('0');
        else if(s[i]=='1') ans.push_back('1');
        else if(ans.size()!=0) ans.pop_back();
    }

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

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
# define pb push_back
# define FOR(i,a,n) for(int i=a;i<n;i++)
# define mp make_pair
# define RFOR(i,a,n) for(int i=n;i>a;i--)
# define pii pair<long long int,long long int>
#define ub upper_bound
#define lb lower_bound
#define MOD 1000000007
typedef long long int ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
        cout.tie(0);
	ll h,w,k;
	cin>>h>>w>>k;
	char arr[h][w];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>arr[i][j];
		}
	}
	ll ans=0;
	for(int maskh=0;maskh<(1<<h);maskh++)
	{
		for(int maskb=0;maskb<(1<<w);maskb++)
		{
			ll black=0;
			for(int i=0;i<h;i++)
			{
				for(int j=0;j<w;j++)
				{
					if((maskh&(1<<i))&&(maskb&(1<<j)))
					{
						if(arr[i][j]=='#')
						black++;
					}
				}
			}
			if(black==k)
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <list>
#include <stack>
#include <set>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
using namespace std;
int main() {
	ll n, m, r, R[10], a, b, c, dis[210][210], inf = 1e9;
	for (int i = 0; i < 210; i++) {
		for (int j = 0; j < 210; j++) {
			dis[i][j] = inf;
		}
		dis[i][i] = 0;
	}
	cin >> n >> m >> r;
	for (int i = 0; i < r; i++)cin >> R[i];
	for (int i = 0; i < m; i++) {
		cin >> a >> b >> c;
		dis[a][b] = min(dis[a][b], c);
		dis[b][a] = dis[a][b];
	}
	for (int k = 1; k <= n; k++) {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				dis[i][j] = min(dis[i][k] + dis[k][j], dis[i][j]);
			}
		}
	}
	sort(R, R + r);
	ll yan, ans = 1e9;
	do {
		yan = 0;
		for (int i = 0; i < r - 1; i++)yan += dis[R[i]][R[i + 1]];
		ans = min(yan, ans);
	} while (next_permutation(R, R + r));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        String month = s.substring(5, 7);
        if (month.equals("01") || month.equals("02") || month.equals("03") || month.equals("04")) {
            System.out.println("Heisei");
        } else {
            System.out.println("TBD");
        }
    }

}


Measured memory_bytes: 21844
import sys
import math
input = sys.stdin.readline

h, w = map(int, input().split())
ans = math.ceil(w / 2) * math.ceil(h / 2) + math.floor(w / 2) * math.floor(h / 2)
if h == 1 or w == 1:
    ans = 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
long double dp[302][302][302];
int fr[4];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	cin>>n;
    	int ar[n];
    	for(int i=0;i<n;i++)
    	{
    		cin>>ar[i];
    		fr[ar[i]]++;
    	}
    	int s = n;
    	dp[0][0][0] = 0;
  		// dp[1][0][0] = n;
    			for(int k=0;k<=s;k++)
    	{
    		for(int j=0;j<=s-k;j++)
    		{
    	for(int i=0;i<=s-j-k;i++)
    			{
    				int tot = i+j+k;
    				dp[i][j][k] = 0;
    				int s1 = 0;
    				if(k!=0)
    				{
    					s1++;
    					dp[i][j][k] += (dp[i][j+1][k-1]+1)*k;
    				}
    				if(j!=0)
    				{
    					s1++;
    					dp[i][j][k] += (dp[i+1][j-1][k]+1)*j; 
    				}
    				if(i!=0)
    				{
    					s1++;
    					// if(i==1)
    						// dp[i][j][k] += dp[i-1][j][k]+n-1;
    					// else
    					// cout<<(double(i)/(n))<<' ';
    					dp[i][j][k] += (dp[i-1][j][k]+1)*i;
    				}
    				if(s1!=0)
    				{dp[i][j][k] += (n-tot);
    				// {dp[i][j][k]/=s1;
    				dp[i][j][k]/=tot;
    			}
    				// dp[i][j][k] += double(n)/(n-tot);
    				// cout<<i<<' '<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
    			}
    		}
    	}
    	// dp[3][0][0] = 5.5;
    	// cout<<fr[1]<<endl;
    	printf("%.14Lf\n",dp[fr[1]][fr[2]][fr[3]]);
    }
    return 0;
}

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

double sikakusui(int x, int h);

int main(void)
{
    int x,h;

    while (1)
    {
        scanf("%d", &x);
        scanf("%d", &h);
        if (x == 0 && h == 0){
            break;
        }
        printf("%.6lf\n", sikakusui(x, h));
    }

    return (0);
}
double sikakusui(int x, int h)
{
    double s;
    s = sqrt((h * h) + ((x / 2.0) * (x / 2.0)));

    return ((x * x) + ((x * s / 2.0) * 4.0));
}


Measured memory_bytes: 2028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		//Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);
		int t=Integer.parseInt(br.readLine());
		Set<String> set=new HashSet<String>();
		StringTokenizer st;
		while((t--)!=0){
			String s=br.readLine();
			st=new StringTokenizer(s," ");
			//String ch=scan.next();
			if(st.nextToken().charAt(0)=='i'){
				set.add(st.nextToken());
			}else{
				if(set.contains(st.nextToken()))
					pw.println("yes");
				else
					pw.println("no");
			}
		}
		pw.close();
	}


}

Measured memory_bytes: 132492
# -*- coding: utf-8 -*- #

N = int(input())
S = input()
cnt = [0] * (N+1)
cnt[0] = 0
ans = N

for i in range(N):
    cnt[i+1] = cnt[i]
    if S[i] == 'W':
        cnt[i+1] += 1

for j in range(1, N+1):
    ans = min(ans, cnt[j-1] + (N - j) - (cnt[N]-cnt[j]))

print(ans)

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

struct P
{
    int x,y;
    bool operator<(const P &a)const{
              return x>a.x;
    }
};

vector<int> v;
//bitset<4001000> b;
int a,c,i,b,k,n,d,e,m;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int o[333350];
int l[333351];
int j[333355];
int dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};


long long x,y,mod=1000000007;
long long z;

P u[10];
stack<int> s,s1;

//set<int> s;
priority_queue<int,vector<int>,greater<int> > q,q1;


//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p[10100];
//list<int> l;

//string r;
char r[335333];
//deque<int> de;
bool as(P a,P b)
{
    return a.x>b.x;
}



int main()
{
    scanf("%d %d %d",&a,&b,&c);
    for(int t=1;t<=a;l[t]=o[t],t++)
        scanf("%d",&o[t]);
    k=1987654321;
    sort(l+1,l+a+1);
    l[a+1]=1987654321;
    for(int t=1;t<=a;t++)
    {
        for(int w=1;w<=a;)
        if(o[w]>=l[t])
        {
            int h=w;
            for(;o[h]>=l[t]&&h<=a;h++)
                q.push(o[h]);
            h--;
            for(;q.size()>=b;q1.push(q.top()),q.pop());
            for(;q.size();q.pop());
            //printf("**%d ",h);

            w=h+1;
        }
        else w++;
        if(q1.size()>=c)
        {
        n=q1.top();
        for(int h=1;h<=c;m=q1.top(),q1.pop(),h++);
        k=min(k,m-n);
        }
        for(;q1.size();q1.pop());
    }
    printf("%d",k);
}




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

int main()
{
    int a, b, c, k, i = 0;
    cin >> a >> b >> c >> k;
    while(a >= b) {
        b *= 2;
        i++;
    }
    while(b >= c) {
        c *= 2;
        i++;
    }
    if (i <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3672
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>A;//きゅー
int main(void)
{
	int r;
	scanf("%d", &r);
	long long int y;
	y = r * r;
	printf("%lld", y);
	return 0;

}


Measured memory_bytes: 256
#include <cstdio>

int main(void)
{
    int a, b;
    char op;

    while (1) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '?')
            break;
        if (op == '+')
            printf("%d\n", a+b);
        if (op == '-')
            printf("%d\n", a-b);
        if (op == '*')
            printf("%d\n", a*b);
        if (op == '/')
            printf("%d\n", a/b);
    }

    return 0;
}

Measured memory_bytes: 2744
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
	char s[110000];
	cin>>s;
	int len=strlen(s),sum=0;
	for(int i=0;i<len-1;i++){
		if(s[i]!=s[i+1]){
			sum++;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll MOD=1e9+7;
int main(){
	ll N,ans=1,a;
	cin >> N;
	priority_queue<pair<ll,ll>> Q;
	FOR(i,0,N)cin>>a,Q.push({-a,-1});
	FOR(i,0,N)cin>>a,Q.push({-a,1});
	a = 0;
	while(!Q.empty()){
		if(a != Q.top().second*llabs(a))
			(ans *= llabs(a) )%=MOD;
		a+=Q.top().second;
		Q.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 6384
#include <iostream>
using namespace std;
int main()
{
	int n ,y;
	cin >> n >> y;
	for (int a = 0; a <= n; a++)
	{
		for (int b = 0; b <= n; b++)
		{
			int c = (y - ((a * 10000) + (b * 5000))) / 1000;
			if (c < 0) {
				continue;
			}

			if ((a + b + c) == n)
			{
				cout << a << " " << b << " " << c << endl;
				return 0;
			}

		}
	}
	cout << "-1 -1 -1" << 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;
using ll = long long;
using P = pair<int,int>;

int main(){
	string s;
	cin >> s;
	int count0 = 0;
	int count1 = 0;
	rep(i,(int)s.size()){
		if(s[i] == '1') count1++;
		else if(s[i] == '0') count0++;
	}
	cout << min(count0,count1)*2 << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 3724
#include<iostream>
#include<string>
#include<algorithm>

#define REP(i,N) for(int i = 0; i < N; i++)


using namespace std;

// テンプレートここまで
#define INF 100000001


typedef struct{
    int x;
    int y;
}Coord;

int distance(Coord people,Coord point){
    return abs(people.x - point.x) + abs(people.y - point.y);
}

int main(){
    int n,m;
    Coord people[55];
    Coord point[55];
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> people[i].x >> people[i].y;
    }
    for(int i = 1; i <= m; i++){
        cin >> point[i].x >> point[i].y;
    }
    for(int i = 1; i <= n; i++){
        int minDis = distance(people[i],point[1]);
        // int minDis = INF;
        int ansPoint = 1;
        for(int j = 1; j <= m; j++){
            int tmpDis = distance(people[i],point[j]);
            // printf("%d,%d,%d\n",i,j,tmpDis);
            if(tmpDis < minDis){
                minDis = tmpDis;
                ansPoint = j;
            }
        }
        cout << ansPoint << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	int N, K;
	cin >> N >> K;
	int p = 1;
	for (int i = 0; i < N; ++i) {
		p = min(p * 2, K + p);
	}
	cout << p << endl;
	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mod 1000000007
#define mod1 998244353
#define N 100003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::floatfield );std::cout.precision(15)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*/
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v , ll a = 0)
{
    //ll a ;
    for(ll i=a ; i<v.size() ; i=i+1)
    {
        v[i] = max((ll)0,v[i]);
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
ll n,m,k;
bool ok = true;
int main()
{
    FastIO ;
    PRECISION ;
    ll a,b,c,d,e,i,j,t,x,y,z,x1,y1,z1,f;
    //double p,q,r,u,w ;
    char ch,chr ;
    //string str,st,str2,str3;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>n>>m;
  	vll v;
  	READ(v,m);
  	a = accumulate(all(v),(ll)0);
  	if(a>n)
    {
      cout<<"-1";
    }
  	else
    {
      cout<<n-a;
    }
}

Measured memory_bytes: 3752
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

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


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,K,M,P,L[200500],R[200500],C[230005]={},res=0;
long long int clean[300050]={},memo[200040]={};
bool used[200040]={};
priority_queue<pair<long long int,pll> >pq;
string S;
char ch[200][200];


int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>M;
	cout<<(N-1)*(M-1)<<endl;
}


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


int main(){
	
	int N;
	
	scanf("%d", &N);
	
	int a[N];
	int check[N];
	int point = 0 ;
	
	for(int i=0; i<N ; i++ ){
		scanf("%d", &a[i] );
	}
	
	int number = 1 ;
	
	for ( int i=0; i<N ; i++ ) {
		if( a[i] == number ){
			number++;
		}
	}
	if(number == 1) {
		printf("-1");
		return 0;
	}
	
	printf("%d",N-number+1);

	return 0;
	
}

Measured memory_bytes: 896
start_time = Time.now.to_f
n = gets.to_i
s = (1..n).map{|a|gets.chomp.chars.map(&:to_i)}
#######
result = -1
nodes = Array.new(n+1){
  {
    sides: [],
    limit: nil, # nilはallOK, []はallNG
    kotei: nil, # 固定したら
    visit: false,
  }
}
n.times do |i|
  n.times do |ii|
    nodes[i+1][:sides] << ii+1 if s[i][ii] == 1
  end
end



n.times do |ifirst| #############
  n.times do |i|
    nodes[i+1][:limit] = nil
    nodes[i+1][:kotei] = nil
    nodes[i+1][:visit] = false
  end
  first = ifirst+1
  nodes[first][:limit] = [1]
  queue = [first]
  while !queue.empty?
    ind = queue.shift # とるときshift, 入れるとき<<(push)
    next if nodes[ind][:visit]
    kotei = nodes[ind][:limit].max # できるだけ大きい値で固定
    if kotei.nil?
      break
    end
    nodes[ind][:kotei] = kotei
    nodes[ind][:sides].each do |side| # sideは周りのnodesのindex
      if nodes[side][:limit].nil?
        nodes[side][:limit] = [nodes[ind][:kotei]-1, nodes[ind][:kotei]+1]
      else
        nodes[side][:limit] = nodes[side][:limit] & [nodes[ind][:kotei]-1, nodes[ind][:kotei]+1]
        if nodes[side][:limit].empty?
          puts '-1'
          exit
        end
      end
      queue << side if nodes[side][:visit] == false
    end
    nodes[ind][:visit] = true
  end
  if nodes[1..-1].map{|a|a[:kotei]}.none?{|a|a.nil?}
    tmpmax = nodes[1..-1].map{|a|a[:kotei]}.max
    if result < tmpmax
      result = tmpmax
    end
  end
  if Time.now.to_f - start_time > 1.8
    p result
    exit
  end
end ##################
p result


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

// #define ONLINE_JUDGE

#define V vector
#define P pair

using LL = long long;
#define FOR(i, x, y) \
    for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) \
    for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    do {                                      \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    } while (0)
void err() { cerr << "\033[39;0m" << endl; }
template <template <typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
    for (auto v : a) cerr << v << ' ';
    err(x...);
}
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif
#define sz(x) (int)x.size()

LL bin(LL a, LL b, LL p) {
    LL res = 1;
    a = (a % p + p) % p;
    for (; b; b >>= 1, a = a * a % p)
        if (b & 1) res = res * a % p;

    return res;
}

const int N = 1e5+50;


void solve() {

    LL A, B, N;
    cin >> A >> B >> N;
    N = min(N, B-1);
    LL p1 = A / B, q1 = A % B;
    LL q2 = N;
    LL ans = p1 * q2 + (q1 * q2) / B;
    cout << ans << endl;
}

int main() {

    // int t;
    // cin >> t;
    // while (t--) solve();

    solve();

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

int main(){
  int h, w;cin>>h>>w;
  vector<vector<char>> field(h, vector<char>(w));
  vector<bool> row(h), column(w);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>field[i][j];
    }
  }
  for(int i=0;i<h;i++){
    bool blank=true;
    for(int j=0;j<w;j++){
      if(field[i][j]=='#'){blank=false;break;}
    }
    if(blank)row[i]=true;
  }
  for(int i=0;i<w;i++){
    bool blank=true;
    for(int j=0;j<h;j++){
      if(field[j][i]=='#'){blank=false;break;}
    }
    if(blank)column[i]=true;
  }
  for(int i=0;i<h;i++){
    if(row[i])continue;
    for(int j=0;j<w;j++){
      if(column[j])continue;
      cout<<field[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
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; }

vector<pair<ll,ll> > to[100005];
vector<ll> dp(100005);
// Kからの最短距離を各頂点について求めて、最後に足し算すれば良い。

void dfs(ll v, ll parent, ll distance){
    if(dp.at(v) != 0) return;
    dp.at(v) = distance;
    for(pair<ll, ll> child: to[v]){
        if(child.first == parent) continue;
        dfs(child.first, v, distance + child.second);
    }
}

int main(){
    ll N, Q, K;
    cin >> N;
    rep(i, N-1) {
        ll A, B, C;
        cin >> A >> B >> C;
        A--;
        B--;
        to[A].emplace_back(make_pair(B, C));
        to[B].emplace_back(make_pair(A, C));
    }
    cin >> Q >> K;
    dfs(K-1, -1,0);
    rep(i, Q) {
        ll x, y;
        cin >> x >> y;
        cout << dp.at(x-1) + dp.at(y-1) << endl;
    }
}

Measured memory_bytes: 15572
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// Not gonna give up until it's over
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 21;
const ll MAXK = (1<<21) + 1;
ll a[MAXN][MAXN];
ll dp[MAXK];
ll n,t_mask;
const ll MOD = 1e9 + 7;

ll rec(ll mask){
    if(mask == t_mask) return 1;

    ll &ans = dp[mask];

    if(ans != -1) return ans;

    ans = 0;

    ll idx = __builtin_popcount(mask);

    FOR(i,0,n-1){
        if(mask&(1<<i) || a[idx][i] == 0) continue;
        ans = (ans + rec(mask|(1<<i)))%MOD;
    }
    return ans;
}

void solve(){
    cin>>n;
    t_mask = (1<<n) - 1;

    FOR(i,0,n-1) FOR(j,0,n-1) cin>>a[i][j];

    MINUS(dp);

    cout<<rec(0)<<endl;
}

signed main(){
 
   FastRead;    
 

    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string S;
    cin>>S;
    S="T"+S+"T";
    vint v;
    rep(i,S.size())if(S[i]=='T')v.pb(i);

    vint X,Y;
    for(int i=0;i+1<v.size();i++){
        int d=v[i+1]-v[i]-1;
        if(i&1)Y.pb(d);
        else X.pb(d);
    }


    bitset<20000>bs;
    bs[10000]=1;
    rep(i,X.size()){
        if(i)bs=(bs<<X[i])|(bs>>X[i]);
        else bs<<=X[i];
    }

    int x,y;cin>>x>>y;


    if(bs[x+10000]==0){
        cout<<"No"<<endl;
        return 0;
    }

    bs=bitset<20000>();
    bs[10000]=1;
    rep(i,Y.size())bs=(bs<<Y[i])|(bs>>Y[i]);
    if(bs[y+10000])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	int N;
	long long maxd, X;
	long long x[100000], d[100000];
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}

	sort(x, x + N);

	for (int i = 0; i < N; i++) {
		d[i] = abs(x[i] - X);
	}

	maxd = d[0];

	for (int i = 1; i < N; i++) {
		maxd = gcd(maxd, d[i]);
	}


	cout << maxd << endl;

	return(0);
}


Measured memory_bytes: 1792
import itertools
n = int(input())
q = [0] * 5
for i in range(n):
    s = input()
    if s[0] == "M":
        q[0] += 1
    elif s[0] == "A":
        q[1] += 1
    elif s[0] == "R":
        q[2] += 1
    elif s[0] == "C":
        q[3] += 1
    elif s[0] == "H":
        q[4] += 1

R = [i for i in range(5)]
rec = 0
for a, b, c in itertools.combinations(R, 3):
    rec += q[a] * q[b] * q[c]

print(rec)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		int count=0;
		for(int i=0;i<3;i++) {
			if(s.charAt(i)=='o') {
				count++;
			}
		}
		System.out.println(700+(100*count));
	}
}

Measured memory_bytes: 35748
#include <bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
long long int k;cin>>k;
  long long int n;cin>>n;long long int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
long long int b[n];

 for(int i=0;i<n-1;i++){
 b[i]=a[i+1]-a[i];
 } 
b[n-1]=k-a[n-1]+a[0];
sort(b,b+n);long long int h=0;
  for(int i=0;i<n-1;i++) h=h+b[i];
  
  cout<<h<<"\n";
  
  
 return 0;} 

Measured memory_bytes: 3456
import math
pi=3.141592657589793238462643383279

#quoted from https://atcoder.jp/contests/agc021/submissions/2436528
def cross(C, A, B):
    return (C[0] - A[0])*(C[1] - B[1]) - (C[1] - A[1])*(C[0] - B[0])

def convex_hull(P):
    P.sort()
    Q = []
    for p in P:
        while 1 < len(Q) and cross(Q[-2], Q[-1], p) >= 0:
            Q.pop()
        Q.append(p)
    k = len(Q)
    for p in reversed(P[:-1]):
        while k < len(Q) and cross(Q[-2], Q[-1], p) >= 0:
            Q.pop()
        Q.append(p)
    return Q

n=int(input())
arr=[]
for _ in range(n):
  x,y=map(int,input().split())
  arr.append((x,y))
arr2=convex_hull(arr[:])[:-1]
ans=[0]*n
if n==2:
  print(0.5)
  print(0.5)
else:
  for i in range(n):
    pos=arr[i]
    if pos not in arr2:
      continue
    else:
      idx=arr2.index(pos)
      pos1=arr2[idx-1]
      pos2=arr2[(idx+1)%len(arr2)]
      x1=pos[0]-pos1[0]
      y1=pos[1]-pos1[1]
      x2=pos2[0]-pos[0]
      y2=pos2[1]-pos[1]
      angle=abs(math.atan2(x1*y2-x2*y1,x1*x2+y1*y2))
      ans[i]=angle/(2*pi)
  for i in range(n):
    print(ans[i])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

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

void solve()
{
    vi a(5);
    int ans=0;
    for(int i=0;i<5;i++) {
        cin>>a[i];
        if(a[i]==0) ans=i+1;
    }
    cout<<ans;
}

int main()
{
    fastio;
    int t;

    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n;
	ll a[n],b[n];
	rep(i,0,n) cin>>a[i];
	rep(i,0,n) cin>>b[i];
	rep(i,0,n) ans+=max(0LL,a[i]-b[i]);
	ret(ans)	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

const int INF = 2147483647; // 2147483647 = 2^31-1

// SegmentTree seg(vector<int> A(N, INF));でセグメント木を生成
// seg.update(x, a);でx番目の要素をaに更新
// seg.getmin(x, y+1);でx番目からy番目の最小値を取得
struct SegmentTree{
private:
  int n;
  vector<int> node;

public:
  SegmentTree(vector<int> V){
    int sz = V.size();
    n = 1; while(n < sz) n *= 2;
    node.resize(2*n-1, INF);
    for(int i = 0; i < sz; i++) node[i+n-1] = V[i];
    for(int i = n-2; i >= 0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
  }

  void update(int idx, int val){
    idx += (n - 1);
    node[idx] = val;
    while(idx > 0){
      idx = (idx - 1) / 2;
      node[idx] = min(node[2*idx+1], node[2*idx+2]);
    }
  }

  int getmin(int a, int b, int k = 0, int l = 0, int r = -1){
    if(r < 0) r = n;
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return node[k];
    int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
    int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q; cin >> n >> q;
  vector<int> A(n, INF);
  SegmentTree seg(A);
  vector<int> ans;
  REP(i, q){
    int c, x, y; cin >> c >> x >> y;
    if(c == 0){
      seg.update(x, y);
    }else{
      ans.push_back(seg.getmin(x, y+1));
    }
  }
  for(auto &i : ans) cout << i << endl;
}


Measured memory_bytes: 4744
N, K = map(int, input().split())
L = list(map(int,input().split()))
l = []
import collections as coll
c = coll.Counter(L)
for x in c.items():
    tmp = (x[1],x[0])
    l.append(tmp)
l=sorted(l)
ans = 0
for i in range(len(l)-K):
    ans += l[i][0]
print(ans)

Measured memory_bytes: 106952
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m), c(n);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i) >> b.at(i);
    c.at(a.at(i) - 1)++;
    c.at(b.at(i) - 1)++;
  }
  for (int i = 0; i < n; i++) cout << c.at(i) << endl;
}


Measured memory_bytes: 256