akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;


struct FactorInfo {
	int64_t v;
	int64_t c;
};

// n の素因数分解を行う。 
bitset<1000001> primes;


// sqrt(n) までの素数を求める。 まで対応
void create_primes(int64_t n) {
	primes.flip();

	int64_t u_b = sqrt(n + 1);
	assert(u_b < 1000002);

	{
		for (int64_t j = 4; j <= u_b; j += 2) {
			primes.reset(j);
		}
	}
	for (int64_t i = 3; i <= u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int64_t j = i * 2; j <= u_b; j += i) {
			primes.reset(j);
		}
	}
}

vector<FactorInfo> make_factors(int64_t n)
{
	int64_t v = n;
	int64_t limit = sqrt(n + 1);

	vector<FactorInfo> ans;
	FOR_LE(i, 2, limit) {
		if (!primes.test(i)) continue;

		int64_t count = 0;
		while (v % i == 0) {
			v /= i;
			count++;
		}

		if (count != 0) {
			ans.push_back({ i, count });
		}
	}

	if (v != 1) {
		ans.push_back({ v , 1 });
	}

	return ans;
}

void create_factors(vector<FactorInfo>& m, unordered_set<int64_t>& dst, int i, int64_t v)
{
	if (i == m.size()) {
		dst.insert(v);
		return;
	}

	FOR_LE(k, 0, m[i].c) {
		create_factors(m, dst, i + 1, v);
		v *= m[i].v;
	}
}

int64_t powint(int64_t x, int64_t m)
{
	if (m == 0) {
		return 1;
	}
	if (m == 1) {
		return x;
	}

	if (m & 1) {
		int64_t val = powint(x, m / 2);
		val = val * val;
		val *= x;
		return val;
	}
	else {
		int64_t val = powint(x, m / 2);
		val = val * val;
		return val;
	}
}

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

	int64_t n; cin >> n;
	create_primes(n);

	unordered_set<int64_t> anss;
	{
		vector<FactorInfo> m1 = make_factors(n - 1);
		create_factors(m1, anss, 0, 1);
	}

	vector<FactorInfo> m = make_factors(n);
	unordered_set<int64_t> divs;
	create_factors(m, divs, 0, 1);
	for (auto& i : divs) {
		if (i == 1) continue;
		int64_t v = n;
		while (v % i == 0) v /= i;
		if (v % i == 1) anss.insert(i);
	}

	cout << anss.size() - 1 << endl;

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include <math.h>
  int main(){
	  int n;
	  double y;
	  int i,j;
	  while(scanf("%d",&n) && n != 0){
		    double x[51][4]={},xy[51]={};
			double p,q,r;
		  scanf("%lf",&y);
		   for(i=0;i<n;i++){
			   scanf("%lf %lf %lf",&p,&q,&r);
			   x[i+1][0]=p;
			   x[i+1][1]=q;
			   x[i+1][2]=r;
		   if(x[i+1][2] == 1){
			   x[i+1][3] = 1.00;
			   x[i+1][3] += y * x[i+1][1] / 100;
		   }else{
			   x[i+1][3]=1.00;
			   x[i+1][3] += x[i+1][1]/100;
			   x[i+1][3] = pow(x[i+1][3],y);
		   }
		   }
		   for(i=0;i<n;i++){
			   for(j=0;j<n;j++){
				   if(x[i+1][3]<x[j+1][3]){
					   xy[i+1]++;
				   }
			   }
		   }
		   for(i=0;i<n;i++){
			   if(xy[i+1]==0){
				   int xyz=x[i+1][0];
				   printf("%d\n",xyz);
				   break;
			   }
		   }
	  }
	  return 0;
  }

			  

Measured memory_bytes: 728
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, N: int):
    if N % max(H, W) != 0:
        print(int(N / max(H, W) + 1))
    else:
        print(int(N / max(H, W)))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(H, W, N)

if __name__ == '__main__':
    main()


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define For(i, a, b) for (int i = (a); i <= (b); ++i)
#define Ford(i, a, b) for (int i = (a); i >= (b); --i)
#define endl '\n'
#define debug(a) cout << a << endl
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;

const ll limit = 2e5 + 5;
const ll limit1 = 1e6 + 5;
const ll limit2 = 1e3 + 5;
const ll limit3 = 1e4 + 5;

ll test;
ll n, m, x, u, v;
ll res = 0, sum = 0, ans = 0, kd, hkd;
bool ok = false;
ll h[limit];
bool tick[limit3][limit3];
vector<ll> a[limit];

void FastIn(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void ReadIn(){
    cin >> n >> m;
    For(i, 1, n)
        cin >> h[i];
    For(i, 1, m){
        cin >> u >> v;
        a[u].push_back(v);
        a[v].push_back(u);
    }
  //  cout << endl;
    For(i, 1, n){
        ok = false;
        for(ll j = 0; j < a[i].size(); j++){
            v = a[i][j];
          //  cout << v <<" ";
            if(h[i] <= h[v]){
                ok = true;
            }
        }
        //cout << endl;
        if(ok == false) res++;

    }
    cout << res;

}
int main(){
    FastIn();
    ReadIn();
}
/*
* Ctrl + Shift + K Delete Line
* Ctrl + / TOGGLE LINE COMMENT
Ctrl + F Find
* Ctrl + H  REPLACE
* shift + alt + f FORMAT CODE DOCUMENT
Shift + alt + uparrow/downarrow Copy line up/down
Ctrl + ]/[ INDENT/OUTDENT LINE
Quy Hoạch Động
2 kiểu
+ Đếm cách
+ Dùng ít nhất
*/


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

#define pi 2*acos(0)
#define INF 1e16
#define MIN 1e-9
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define m_p make_pair
#define p_b push_back
#define n_p(a) next_permutation(all(a))
#define all(v) v.begin(),v.end()
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define rev(s) reverse(all(s))
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define mem(a,k) memset(a,k,sizeof a)
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define u_b(X,V) upper_bound(X.begin(),X.end(),V)
#define l_b(X,V) lower_bound(X.begin(),X.end(),V)
#define cnt(s,c) count(all(s),c)

//bitwise helpers
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)

#define modulo(S, N) ((S) & (N - 1))
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S - 1))
#define turnOnLastZero(S) ((S) | (S + 1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))

using namespace std;

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

    int n;

    cin >> n;

    int h[n];

    for(int i = 0; i < n; i++)
        cin >> h[i];

    int dp[n + 1];
    dp[0] = 0;
    dp[1] = 0;

    dp[2] = abs(h[1] - h[0]);

    for(int i = 3; i <= n; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i - 2]), dp[i - 2] + abs(h[i - 1] - h[i - 3]));
    }

    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
 
using namespace std;
 
#define LL long long
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)
#define pi pair<int,int>
#define mp make_pair
 
const int maxN = 1e5 + 11;
const LL oo = 1e17 + 11;
const int msk = 1 << 12;
 
int N,M;
int A[maxN];
vector <int> e[maxN];
LL F[1001][msk];
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    //
    cin >> N >> M;
    FOR(i,1,M){
        int d,x;
        cin >> A[i] >> d;
        FOR(j,1,d){
            cin >> x;
            e[i].push_back(x);
        }
    }
 
    int woosh = 1 << N;
    FOR(i,0,M) REP(j,0,woosh) F[i][j] = oo;
    F[0][0] = 0;
    //
    REP(i,0,M) REP(j,0,woosh) if(F[i][j] < oo){
        F[i + 1][j] = min(F[i + 1][j],F[i][j]); // không chọn i + 1
        int newMask = j;
        REP(k,0,e[i + 1].size()){
            int z = e[i + 1][k];
            newMask |= (1 << (z - 1));
        }
        F[i + 1][newMask] = min(F[i + 1][newMask],F[i][j] + A[i + 1]);
    }
    
    if(F[M][woosh - 1] >= oo) cout << -1;
    else cout << F[M][woosh - 1];
 
    return 0;
}

Measured memory_bytes: 34688
#include<stdio.h>

#define N 100




int main(void){
	
	int n,A[N],count;

	
	scanf("%d",&n);

	for(int i=0;i<n;i++){

		scanf("%d",&A[i]);

		}
	
		int flag=1;
	
	
	while(flag){
		flag=0;
	
	for(int j=n-1;j>0;j--){
		
		if(A[j]<A[j-1]){
			
			int temp=A[j];
			A[j] = A[j-1];
			A[j-1]=temp;
			
			flag=1;
			count++;
			
		}
	}
	
	}
	
	for(int i=0;i<n-1;i++){

			printf("%d ",A[i]);
			
		
		}
	
	printf("%d\n",A[n-1]);
	printf("%d\n",count);
	
	return 0;
}



	
	


Measured memory_bytes: 2756
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
vector<PII> v[20];
int res;
int cnt1(int x)
{
	int r=0;
	while (x) r+=x%2,x/=2;
	return r;
}
int main()
{
	cin >>n;
	for (int i=0;i<n;i++)
	{
		int m;
		cin >>m;
		for (int j=0;j<m;j++)
		{
			int x,y;
			cin >>x>>y;
			x--;
			v[i].push_back(MP(x,y));
		}
	}
	for (int i=0;i<(1<<n);i++)
	{
		bool fl=1;
		for (int j=0;j<n;j++)
		{
			if (!(i & (1<<j))) continue;
			for (int k=0;k<v[j].size();k++)
			{
				if (v[j][k].Snd && !(i & (1<<v[j][k].Fst))) fl=0;
				if (!v[j][k].Snd && (i & (1<<v[j][k].Fst))) fl=0;
			}
		} 
		//cout <<i<<" "<<fl<<" ##\n";
		if (fl) res=max(res,cnt1(i));
	}
	cout <<res;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int a = 0;
	int b = 0;
	int c = 0;
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		if (tmp % 4 == 0) {
			c++;
		} else if (tmp % 2 == 0) {
			b++;
		} else {
			a++;
		}
	}
	if (b == 0) {
		if (a <= c + 1) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		if (a <= c) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
int main()
{
    io
    string s;
	cin >> s;
	if((s[0] == 'A'&& s[1] == 'A' && s[2] == 'A' ) || (s[0] == 'B' && s[1] == 'B' && s[2] == 'B'))
	{
		cout << "No\n";
	}
	else cout << "Yes\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=1e5+1;
vector<ll> a[N];
ll dp[N][2];

ll go(int node, int color,int p=-1){
    if(a[node].size()==1 && p!=-1 || a[node].size()==0) return 1;
    if(dp[node][color]!=-1)
        return dp[node][color];
    ll sum=1;
    for(ll u:a[node]){
        if(u==p) continue;
        ll ans=0;
        ans=(ans+go(u,0,node))%mod;
        if(color==0) ans=(ans+go(u,1,node))%mod;
        sum=(sum*ans)%mod;
    }
    //if(sum==0) cout<<node<<" "<<color<<"\n";
    return dp[node][color]=sum;
} 

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    ll n;
    cin>>n;
    for(ll i=0;i<n-1;i++){
        ll u,v;
        cin>>u>>v; u--,v--;
        a[u].pb(v);
        a[v].pb(u);
    }
    memset(dp,-1,sizeof(dp));
    cout<<(go(0,1)+go(0,0))%mod;


 
 
    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 19136
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin >> N;
  VEC<int> H(N);
  int ma = 0;
  REP(i, 0, N) {
    cin >> H[i];
    ma = max(ma, H[i]);
  }
  int cnt = 0;
  for (int h = ma; h > 0; h--) {
    // DUMP(h, H);
    REP(i, 0, N) {
      if (H[i] == h) {
        ++cnt;
        while (H[i] == h) {
          H[i]--;
          i++;
        }
        i--;
      }
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int m, f, r;
	while (scanf("%d%d%d", &m, &f, &r) == 3 && (m != -1 || f != -1 || r != -1)) {
		int grade;
		int total = m + f;
		if (m < 0 || f < 0) grade = 'F';
		else if (total >= 80) grade = 'A';
		else if (total >= 65) grade = 'B';
		else if (total >= 50) grade = 'C';
		else if (total >= 30) grade = (r >= 50 ? 'C' : 'D');
		else  grade = 'F';
		printf("%c\n", grade);
	}
	return 0;
}




Measured memory_bytes: 1988
#include<bits/stdc++.h> 
using namespace std; 
void lcs( string X, string Y, int m, int n ) 
{ 
   int L[m+1][n+1]; 
   for (int i=0; i<=m; i++) 
   { 
     for (int j=0; j<=n; j++) 
     { 
       if (i == 0 || j == 0) 
         L[i][j] = 0; 
       else if (X[i-1] == Y[j-1]) 
         L[i][j] = L[i-1][j-1] + 1; 
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]); 
     } 
   } 
   int index = L[m][n]; 
   char lcs[index+1]; 
   lcs[index] = '\0';
   int i = m, j = n; 
   while (i > 0 && j > 0) 
   { 
      if (X[i-1] == Y[j-1]) 
      { 
          lcs[index-1] = X[i-1];
          i--; j--; index--;
      } 
      else if (L[i-1][j] > L[i][j-1]) 
         i--; 
      else
         j--; 
   } 
   cout << lcs; 
} 
int main() 
{ 
  string X,Y;
  cin>>X>>Y;
  int m = X.size(); 
  int n = Y.size(); 
  lcs(X, Y, m, n); 
} 

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define ll long long
#define MAX_N 51
using namespace std;

// b[i] >= max(a[i], a[i+1]);
// a[i] = min(b[i],b[i-1]);
// b[i =1 ~(n-1)]
// a[i = 1~n]

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n+2,0);
    vector<int> b(n+1,0);
    for(int i = 1; i< n;i++){
        cin>> b[i];
        if(i == 1) a[i] = b[i];
        else a[i] = min(b[i],b[i-1]);

        if(i == (n-1)) a[n] = b[i]; 
    }
    ll sum = 0;
    for(int i = 1; i<=n; i++) sum += a[i];
    cout<< sum <<endl;
    return 0;
}


Measured memory_bytes: 256
a = []
for i in range(5):
    a.append(int(input()))

n = a[0] % 10
if n == 0: n = 10
idx = 0
for i in range(5):
    if a[i] % 10 == 0:
        continue
    else:
        if n > a[i] % 10:
            n = a[i] % 10
            idx = i

for i in range(5):
    if i != idx and a[i]%10 != 0:
        a[i] = (a[i] // 10) * 10 + 10

print(sum(a))


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std ;
vector<int>vc;
int k,counter=0;
int main ( ) {
int n ;
cin>>n;
int a[10000];
for(int i = 1 ; i <= n ; i ++ ){
    cin>>a[i];
}
for(int i =1 ; i <=n ; i ++ ){
    if(a[i] != i ){
        counter++;
    }
}
if(counter == 0 || counter == 2){
    cout<<"YES";
}
else {
    cout<<"NO";
}
}


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

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

template <class T>
inline bool chmin(T &a, const T &b) noexcept {
    return b < a && (a = b, true);
}

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    cout << fixed << setprecision(10);
    var(double, L);
    L /= 3.0;

    output(L * L * L);

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, x int64
	fmt.Scan(&a, &b, &x)
	if a == 0 {
		fmt.Println(b/x + 1)
	} else {
		fmt.Println(b/x - (a-1)/x)
	}
}

Measured memory_bytes: 512
// In god we trust

#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>


#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define INF 1000000000
#define int long long

using namespace std;
using namespace std::chrono;


signed main(){
  int n;
  string s;
  int q;
  cin >> n >> s >> q;
  set<int> g[26];

  for (int i = 0; i < n; i++){
    g[s[i] - 'a'].insert(i);
  }
  
  for (int i = 0; i < q; i++){
    int t;
    cin >> t;
    if (t == 1){
      int i;
      char c;
      cin >> i >> c;
      i --;
      g[s[i] - 'a'].erase(i);
      s[i] = c;
      g[c - 'a'].insert(i);
    }else{
      int l, r;
      cin >> l >> r;
      l--, r--;
      int cnt = 0;
      for (int j = 0; j < 26; j++){
	auto l_ = g[j].lower_bound(l);
	auto r_ = g[j].lower_bound(r + 1);
	if (l_ != g[j].end() and l_ != r_){
	  cnt++;
	}
      }
      cout << cnt << endl;
    }

  }
}


Measured memory_bytes: 24196
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define rep(i, n) for(int i = 0; i < n; i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;

using namespace std;

//#include "./lib/generic/search.h"

//木
struct Node{
    int p, l, r;
};
Node T[100005];
int n, D[100005];

void print(int u){
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";

    if(T[u].p == -1) cout << "root, ";
    else if(T[u].l == -1) cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";

    for(i=0, c=T[u].l; c!=-1; i++, c=T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
 }

int rec(int u, int p){
    D[u] = p;
    if(T[u].r != -1) rec(T[u].r, p);
    if(T[u].l != -1) rec(T[u].l, p+1);
}

int main(){
    int i, j, d, v, c, l, r;
    cin >> n; //接点の個数
    rep(i, n) T[i].p=T[i].l=T[i].r = -1;

    rep(i, n){
        cin >> v >> d;
        rep(j ,d){
            cin >> c;
            if(j==0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }

    rep(i, n){
        if(T[i].p == -1) r = i;
    }

    rec(r, 0);

    rep(i, n) print(i);

}


Measured memory_bytes: 7716
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  if (n == m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define _printV(vec) for(int i = 0; i < SZ(vec); i++){cout << vec[i];if (i==SZ(vec)-1){cout<<endl;}else{cout << " ";}}
#define printV(vec) cout<<#vec<<":";_printV(vec)
#define _printA(arr,n) for(int i = 0; i < n; i++){cout << arr[i];if (i==n-1){cout<<endl;}else{cout << " ";}}
#define printA(arr) cout<<#arr<<":";_printA(arr,sizeof(arr)/sizeof(arr[0]))
#define LLINF = (1LL<<62)
#define puts(var) cout<<#var<<":"<<var<<" "
typedef long long ll;

int main()
{
  int N = 3;
  vector<int> v;
  REP(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  int min = *std::min_element(v.begin(), v.end());
  int max = *std::max_element(v.begin(), v.end());
  cout << max - min << endl;

  return 0;
}


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

using namespace std;

#define ll long long int
#define ld long double
#define pii pair<int,int>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define bit(a,b) ((a>>b)&1)
#define IOS ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

const ll mx = 2e5+1, Mod = 1e9+7;

int n, a[mx];

int main()
{
    IOS;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=1;i<n;i++)
        if(a[i] - a[i-1] > 1)
            return cout << "-1\n", 0;
    for(int i=0;i<n;i++)
        if(a[i] > i)
            return cout << "-1\n", 0;
    ll ans = 0;
    for(int i=1;i<n;i++)
    {
        if(a[i] == a[i-1]+1)
            ans ++;
        else
            ans += a[i];
    }
    cout << ans << '\n';
    return 0;
}












Measured memory_bytes: 1152
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <iostream>
#include <queue>
using namespace std;

typedef long long llint;
#define pii pair<int, int>
#define mp make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const int N = 305;

int n;
int M[N][N];
int graf[N][N];
bool bio[N][N];

void load( ) {
	cin >> n;
	for( int i = 0; i < n; i++ ) {
		for( int j = 0; j < n; j++ ) {
			cin >> M[i][j];
			graf[i][j] = M[i][j];
		}
	}
}

void solve( ) {
	for( int k = 0; k < n; k++ ) {
		for( int i = 0; i < n; i++ ) {
			for( int j = 0; j < n; j++ ) {
				int ans = graf[i][k] + graf[k][j];
				if( ans <= graf[i][j] ) {
					graf[i][j] = ans;
					if( k != i && k != j ) {
						bio[i][j] = true;
					}
				}
			}
		}
	}
	
	llint sol = 0;
	for( int i = 0; i < n; i++ ) {
		for( int j = 0; j < n; j++ ) {
			if( M[i][j] != graf[i][j] ) {
				printf( "-1\n" );
				return;
			}
			if(!bio[i][j]) sol += graf[i][j];
		}
	}
	
	cout << sol / 2 << endl;
}


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


Measured memory_bytes: 1024
<?php


while ($line = fgets(STDIN)) {
   $tmp[] = trim($line);
}
// var_dump($tmp);

// 配列の各要素をさらに分解します
foreach ($tmp as $key => $value) {
  $inputTmp[] = explode(" ", $value);
} 
foreach ($inputTmp as $key => $array) {
	foreach ($array as $key => $value) {
	$input[] = $value;
	}
}
// var_dump($input);
// $input = array(2, 1, 3, 2, 4, 3); //N K

/*
アウトな例
・同じ街が３回でる ＝ 同じ数字が３つ以上
・出ない数字がある

*/
$count = array(
	1 => 0,
	2 => 0,
	3 => 0,
	4 => 0,
);
foreach ($input as $key => $townNum) {
	$townNum = (int)$townNum;
	$count[$townNum]++;
}


$noFg = false; 
foreach ($count as $townNum => $countAppear) {
	if(2 < $countAppear) {
		$noFg = true; 
	}
}

if(!$noFg) {
	print 'YES';
} else {
	print 'NO';
}

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

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD = 1000000007
#define INF (1e9)
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    string s;
    cin >> s;
    rep(i,3) {
        if (s[i] == '1') s[i] = '9';
        else if (s[i] == '9') s[i] = '1';
    }
    print(s);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c; cin >> a >> b >> c;
    int k; cin >> k;
    int cnt = 0;
    while(b<=a){
        b *= 2;
        cnt++;
    }
    while(c<=b){
        c *= 2;
        cnt++;
    }
    if(cnt<=k)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3620
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

template<typename T>
void chkmax(T& x,T y) { if (y>x) x=y; }

const int N=100+10;

int n,W,w[N],v[N];
int dp[N][N][N*3];

int main() {
	n=read(),W=read();
	for (int i=1;i<=n;++i) w[i]=read(),v[i]=read();
	memset(dp,0xc0,sizeof(dp)); dp[0][0][0]=0;
	for (int i=0;i<n;++i)
		for (int j=0;j<=i;++j)
			for (int k=0;k<=3*j;++k) {
				chkmax(dp[i+1][j][k],dp[i][j][k]);
				chkmax(dp[i+1][j+1][k+w[i+1]-w[1]],dp[i][j][k]+v[i+1]);
			}
	int ans=0;
	for (int i=0;i<=n;++i)
		for (int j=0;j<=3*i;++j)
			if (1ll*i*w[1]+j<=W) ans=max(ans,dp[n][i][j]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 19328
import numpy as np
c = np.array([[int(item) for item in input().split()] for _ in range(3)])

for i in range(3):
  while not 0 in c[:,i]:
    c[:,i] -= 1
    
for i in range(3):
  while not 0 in c[i,:]:
    c[i,:] -= 1

if np.all(c==0):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 12500
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7 

lb0 = [0]*60
lb1 = [0]*60
for i in range(N):
  bs = format(A[i],"060b")
  for j in range(60):
    if bs[j] == "0":
      lb0[j] += 1
    if bs[j] == "1":
      lb1[j] += 1  
###
ans = 0
for i in range(60):
  ans += ((lb0[i]*lb1[i] %mod)*(2**(59-i) %mod)) %mod
  ans %= mod
print(ans)  

Measured memory_bytes: 125624
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

def divisors(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            if (i*i != n):
                table.append(n//i)
        i+=1
    return table

n = int(input())

tbl = divisors(n)
ans = []

for i in tbl:
    tmp = i + n//i -2
    ans.append(tmp)

print(min(ans))



Measured memory_bytes: 9304
#include <iostream>

using namespace std;
int main() {

    int N;
    string S;
    string result;
    string Sa = "";
    string Sb = "";

    cin >> N;
    cin >> S;


    // cout << S[1] << endl; b

    if ((N % 2) == 0)
    {
        for (size_t i = 0; i < N; i++)
        {
            if ((N / 2) > i)
            {
                Sa = Sa + S[i];
            } else {
                Sb += S[i];
            }
        }

        if (Sa == Sb)
        {
            result = "Yes";
        } else {
            result = "No";
        }


    } else {
        result = "No";
    }

    cout << result << endl;

    return 0;

}


Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(ReadLine());
        int[] a = ReadLine().Split(' ').Select(int.Parse).ToArray();
        int ans = 0;
        int t = 1;
        for(int i = 0; i < N; i++)
        {
            if(a[i] == t)
            {
                t++;
            }
            else
            {
                ans++;
            }
        }

        if(t == 1)
        {
            WriteLine(-1);
        }
        else
        {
            WriteLine(ans);
        }
    }
}

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

int main()
{
  string s;
  cin >> s;
  
  char p, c;
  for (int i = 0; i < s.size(); i += 2)
  {
    p = s.at(i);
    if (i + 1 < s.size()) c = s.at(i + 1);
    else 
    {
      cout << "No" << endl;
      return 0;
    }
    if (!(p == 'h' && c == 'i'))
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;

int main(){
    int n;
    double m;
    double s[1001];
    while(1){
        cin >> n;
        if(n == 0) break;
        m = 0.0;
        for(int i=0;i<n;i++){
            cin >> s[i];
            m += s[i];
        }
        m /= n;
        double dev = 0.0;
        for(int i=0;i<n;i++){
            dev += (s[i]-m)*(s[i]-m);
        }
        printf("%.8f\n",sqrt(dev/n));
    }
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

const double pi = acos(-1);

int main() {
    fastio;
    double ans=0;
    ll a,b,x;
    cin >> a >> b >> x;
    ll m = a*a*b;
    if (m <= x * 2) {
        double c = (m-x)*2.0/(a*a);
        ans = atan2(c,a);
    } else {
        double c = x*2.0/(a*b);
        ans = atan2(b,c);
    }
    printf("%.10f\n", ans/pi*180);
}


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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

signed main() {
    int A, B, Q;
    cin >> A >> B >> Q;

    vi s(A+2), t(B+2), o(Q);
    s[0] = -INF; s[A+1] = INF;
    t[0] = -INF; t[B+1] = INF;
    REP(i, A) cin >> s[i+1];
    REP(i, B) cin >> t[i+1];
    REP(i, Q) cin >> o[i];
    vi::iterator it;
    REP(i, Q) {
        int x = o[i];
        it = lower_bound(s.begin(), s.end(), x);
        int sR = *it;
        int sL = *(--it);
        it = lower_bound(t.begin(), t.end(), x);
        int tR = *it;
        int tL = *(--it);

        int a1 = x - min(sL, tL);
        int a2 = max(sR, tR) - x;
        int a3 = x - sL > tR - x ? 2 * (tR - x) + x - sL : 2 * (x - sL) + tR - x;
        int a4 = x - tL > sR - x ? 2 * (sR - x) + x - tL : 2 * (x - tL) + sR - x;

        int ans = min({a1, a2, a3, a4});
        cout << ans << endl;
    }

    return 0;
}


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

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, M, V, P;
    scan(N, M, V, P);
    auto a = readln.split.to!(int[]).sort!"a > b"();

    int check(int x) {
        long vt = 1L * M * V;
        int ue = P - 1;

        foreach (i ; 0 .. N) {
            if (ue == 0) {
                if (a[i] > a[x] + M) {
                    return false;
                }
                else {
                    assert(a[x] + M >= a[i]);
                    vt -= min(M, a[x] + M - a[i]);
                }
            }
            else if (i != x) {
                vt -= M;
                ue--;
            }
        }

        return vt <= 0;
    }

    int ng = N, ok = -1;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    auto ans = ok + 1;
    writeln(ans);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 4404
#define NDEBUG
#include <cassert>
#include <cstdint>

template <template <class> class Container> class eratosthenes {
	using uint64 = ::std::uint_fast64_t;

public:
	using container_type = Container<uint64>;
	using size_type = typename container_type::size_type;

protected:
	container_type c;
	size_type s;

public:
	eratosthenes() : c(), s(0) {}
	explicit eratosthenes(const size_type size)
		: c((size >> 6) + 1, 0), s(size) {
		c[0] ^= 3;
		for (size_type i = 2; i * i < size; ++i)
			if (!(c[i >> 6] >> (i & 0x3F) & 1))
				for (size_type j = i * i; j < size; j += i)
					c[j >> 6] |= static_cast<uint64>(1) << (j & 0x3F);
	}

	bool empty() const { return !s; }
	size_type size() const { return s; }

	bool test(const size_type i) const {
		assert(i < size());
		return !(c[i >> 6] >> (i & 0x3F) & 1);
	}
	bool operator[](const size_type i) const {
		assert(i < size());
		return !(c[i >> 6] >> (i & 0x3F) & 1);
	}
};

#include <cstdio>
#include <vector>

template <class T> using vec_alias = ::std::vector<T>;

int main() {
	using uint = unsigned int;

	constexpr uint N = 100000001;

	eratosthenes<vec_alias> pri(N);

	uint n;
	scanf("%u", &n);

	uint cnt = 0, x;
	while (n--) {
		scanf("%u", &x);
		cnt += pri[x];
	}

	printf("%u\n", cnt);

	return 0;
}



Measured memory_bytes: 14300
#include<iostream>
#include<cstdio>
using namespace std;
char s[50][50];
int main()
{
	int i,j,k,n,m,a,a1=0,b,b1,b2,c,c1,c2,ans=9999999;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)cin>>s[i][j];
	}
	for(i=1;i<=n-2;i++)
	{
		for(a=1;a<=m;a++)
		{
			if(s[i][a]!='W')a1++;
		}
		b1=0;
		for(j=i+1;j<=n-1;j++)
		{
			for(b=1;b<=m;b++)
			{
				if(s[j][b]!='B')b1++;
			}
			c1=0;
			for(k=j+1;k<=n;k++)
			{
				for(c=1;c<=m;c++)
				{
					if(s[k][c]!='R')c1++;
				}
			}
			if(ans>(a1+b1+c1))ans=a1+b1+c1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3072
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int W,H,N;
ll x[100100],y[100100];
ll tx[100100],ty[100100];
ll p[2],q[2];
ll cal(ll s,ll t)
{
	ll m=0;
	ll sum=0;
	for(int i=0;i<N;i++)
	{
		sum+=2ll*(llabs(x[i]-s)+llabs(y[i]-t));
		m=max(m,llabs(x[i]-s)+llabs(y[i]-t));
	}
	return sum-m;
}
int main()
{
	cin >> W >> H;
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> x[i] >> y[i];
		tx[i]=x[i];ty[i]=y[i];
	}
	sort(tx,tx+N);
	sort(ty,ty+N);
	p[0]=tx[(N+1)/2],p[1]=tx[(N-1)/2];
	q[0]=ty[(N+1)/2],q[1]=ty[(N-1)/2];
	int ansx,ansy;
	ll ans=1000000000000000000ll;
	for(int i=0;i<4;i++)
	{
		ll k=cal(p[i/2],q[i%2]);
		if(ans>k)
		{
			ansx=p[i/2];
			ansy=q[i%2];
			ans=k;
		}
		else if(ans==k)
		{
			if(ansx>p[i/2])
			{
				ansx=p[i/2];
				ansy=q[i%2];
			}
			else if(ansx==p[i/2]&&ansy>q[i%2])
			{
				ansy=q[i%2];
			}
		}
	}
	cout << ans << endl;
	cout << ansx << ' ' << ansy << endl;
	return 0;
}

Measured memory_bytes: 4320
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var threshold = a.Sum() / (nm[1] * 4.0);

        Console.WriteLine(a.Count(x => x >= threshold) >= nm[1] ? "Yes" : "No");
    }
}

Measured memory_bytes: 13396
#include <stdio.h>

int main()
{
  int sum=0,n,u,i,j,min;

  scanf("%d",&n);

  int g[n][n],d[n],p[n],color[n],tmp;

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&tmp);
      if(tmp==-1){
        g[i][j]=2001;
      }
      else g[i][j]=tmp;
    }
  }

  for(i=0;i<n;i++){
    d[i]=2001;
    p[i]=-1;
    color[i]=0;
  }

   d[0]=0;

  while(1){

    min=2001;
    u=-1;

    for(i=0;i<n;i++){
      if(color[i]!=2 && d[i]<min){
        u=i;
        min=d[i];
      }
    }

    if(min==2001) break;

    color[u]=2;

    for(i=0;i<n;i++){
      if(color[i]!=2 && g[u][i]<d[i]){
        if(g[u][i]!=2001){
          p[i]=u;
          d[i]=g[u][i];
          color[i]=1;
        }
      }
    }
  }


  for(i=0;i<n;i++){
    if(p[i]!=-1)sum+=g[i][p[i]];
  }

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

  return 0;

}


Measured memory_bytes: 2104
import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    color_list = [0 for i in range(8)]
    top_coder_num = 0
    for i in range(N):
        rate = int(input_raw[i])
        if rate>= 1 and rate < 400:
            color_list[0] = 1
        elif rate>= 400 and rate < 800:
            color_list[1] = 1
        elif rate>= 800 and rate < 1200:
            color_list[2] = 1
        elif rate>= 1200 and rate < 1600:
            color_list[3] = 1
        elif rate>= 1600 and rate < 2000:
            color_list[4] = 1
        elif rate>= 2000 and rate < 2400:
            color_list[5] = 1
        elif rate>= 2400 and rate < 2800:
            color_list[6] = 1
        elif rate>= 2800 and rate < 3200:
            color_list[7] = 1
        elif rate >= 3200:
            top_coder_num += 1

    min_color = sum(color_list)
    if min_color == 0 and top_coder_num >= 1:
        min_color = 1
    max_color = sum(color_list) + top_coder_num

    print min_color, max_color




if __name__ == '__main__':
    main()

Measured memory_bytes: 16228
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  map<ll, int> mp;
  mp[0] = 1;
  ll now = 0;
  for(int i : a){
    now += i;
    mp[now]++;
  }
  ll ans = 0;
  for(auto p : mp){
    ans += (ll)p.second*(p.second-1)/2;
  }
  cout << ans << endl;
  return 0;
}

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

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


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, rt<<1
#define Rson mid+1, R, rt<<1|1
const int maxn=4e5+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
int n,m,k,t,h[maxn],tot,ans[maxn];
set<int>cmp[maxn];
struct node
{
    int c,id;
    node(int _c,int _id)
    {
        c=_c,id=_id;
    }
    bool operator<(const node&p)const
    {
        return c==p.c?id<p.id:c>p.c;
    }
};
struct node1
{
    int to,nxt,id;
}e[maxn];
void add(int x,int y,int z)
{
    tot++;
    e[tot].to=y;
    e[tot].nxt=h[x];
    e[tot].id=z;
    h[x]=tot;
}
priority_queue<node>p;
int main()
{
    int i,j;
    memset(ans,inf,sizeof ans);
    scanf("%d%d",&n,&m);
    while(m--)
    {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        add(a,b,c);
        add(b,a,c);
    }
    p.push(node(0,1));ans[1]=0;
    while(!p.empty())
    {
        int now=p.top().id,ca=p.top().c;
        p.pop();
        if(ans[now]<ca)continue;
        for(i=h[now];i;i=e[i].nxt)
        {
            int to=e[i].to,to_cmp=e[i].id;
            int to_ca=ca+(!cmp[now].count(to_cmp));
            if(ans[to]>to_ca)
            {
                ans[to]=to_ca;
                p.push(node(to_ca,to));
                cmp[to].clear();
                cmp[to].insert(to_cmp);
            }
            else if(ans[to]==to_ca)
            {
                cmp[to].insert(to_cmp);
            }
        }
    }
    printf("%d\n",ans[n]==inf?-1:ans[n]);
    //system("Pause");
    return 0;
}


Measured memory_bytes: 35448