akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int l,r,d,cnt = 0;
	cin >> l >> r >> d;
	for (int i = l;i <= r;++i) {
		if (i%d == 0) {
			++cnt;
		}
	}
	cout << cnt << '\n';
	return 0;
}



Measured memory_bytes: 3652
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;


ll mod = 1e9 + 7;

ll calc(ll i, ll n) {
  ll smallest = (i - 1) * i / 2;
  ll largest = (n * (n + 1) / 2) - ((n - i) * (n - i + 1) / 2);
  return (largest - smallest) + 1;
}

int main()
{
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  for(int i = k; i <= n + 1; i++)
  {
    ans += calc(i, n);
    ans %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
mint choose(int n,int a){
  mint x = 1,y=1;
  rep(i,a){
    x*= n-i;
    y*= i+1;
  }
  return x/y;
}
mint dp [101][4][4][4];
int main(){
  int n,k;cin>>n;
  dp[0][3][3][3] = 1;
  for(int i = 0; i < n; i++){
    for(int c1 = 0; c1 < 4; c1++){
      for(int c2 = 0; c2 < 4; c2++){
        for(int c3 = 0; c3 < 4; c3++){
          for(int c4 = 0; c4 < 4; c4++){
            if(c2 == 0 && c3 == 1 && c4 == 2) continue;
            if(c2 == 1 && c3 == 0 && c4 == 2) continue;
            if(c2 == 0 && c3 == 2 && c4 == 1) continue;
            if(c1 == 0 && c2 == 1 && c4 == 2) continue;
            if(c1 == 0 && c3 == 1 && c4 == 2) continue;
            dp[i + 1][c2][c3][c4] += dp[i][c1][c2][c3];
          }
        }
      }
    }
  }
  mint ans  =0;
  for(int c1 = 0; c1 < 4; c1++){
    for(int c2 = 0; c2 < 4; c2++){
      for(int c3 = 0; c3 < 4; c3++) ans += dp[n][c1][c2][c3];
    }
  }
  cout<<ans.x<<endl;
}

Measured memory_bytes: 256
read N
tr ' ' '\n'|awk '{a[$0 " " NR%2]++}END{for(i in a)print i,a[i]}'|sort -nrk3|awk -v M=$N 'a[$2]++<2{if($2){if(!p){p++;lp=$1;N-=$3};if(q&&lq!=$1&&!r){r++;M-=$3}}else{if(!q){q++;lq=$1;M-=$3};if(p&&lp!=$1&&!s){s++;N-=$3}}}END{print (N>M)?M:N}' N=$N

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

int main() {
	int h,A[251];
	cin>>h;
	for(int i=1;i<=h;i++)cin>>A[i];
	for(int i=1;i<=h;i++)
	{
		cout<<"node "<<i<<": key = "<<A[i]<<", ";
		if(i/2>=1)cout<<"parent key = "<<A[i/2]<<", ";
		if(i*2<=h)cout<<"left key = "<<A[i*2]<<", ";
		if(i*2+1<=h)cout<<"right key = "<<A[i*2+1]<<", ";
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10;

int n,m,up[N][N],st[N],tp=0;
char s[N][N];

int main() {
	cin>>n>>m;
	for(int i=1;i<=n;i++) {
		scanf("%s",s[i]+1);
		for(int j=2;j<=m;j++) {
			if(i==1) up[i][j]=1;
			else if((s[i][j]==s[i][j-1])==(s[i-1][j]==s[i-1][j-1])) up[i][j]=up[i-1][j]+1;
			else up[i][j]=1;
		}
	}
	int ans=n;
	for(int i=1;i<=n;i++) {
		st[tp=0]=1;
		for(int j=2;j<=m+1;j++) {
			while(tp&&up[i][st[tp]]>=up[i][j]) {
				ans=max(ans,up[i][st[tp]]*(j-st[tp-1])),--tp;
			}
			st[++tp]=j;
		}
	}
	cout<<ans;
	return 0;
}


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


int main(){
	int n, x, t, c;
	while (cin >> n >> x && n | x != 0) {
		c = 0;
		for (int i = 1; i < n && 3 * i + 2 < x; i++) {
			for (int j = i + 1; j < n && i + 2 * j < x; j++) {
				if (x - i - j <= n) {
					c++;
				}
			}
		}
		cout << c << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int INF = 1e9;
const ll lINF = 1e18;
const int MOD = 1e9+7;
const int SIZE = 100;


int main() {
	ll n, m;
	scanf ("%lld %lld", &n, &m);
	vector<string> a(n);
	vector<int> b;
	ll cnt[26];
	for (int i = 0; i < 26; i++) {
		cnt[i] = 0;
	}
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < m; j++) {
			cnt[a[i][j] - 97]++;
		}
	}

	while(n > 0) {
		if (n % 2 == 1) {
			b.push_back(1);
			n --;
		} else {
			b.push_back(2);
			n -= 2;
		}
	}

	vector<int> c;
	for (int i = 0; i < b.size(); i++) {
		c.push_back(b[i] * 2);
	}

	vector<int> d;
	while (m > 0) {
		if (m % 2 == 1) {
			for (int i = 0; i < b.size(); i++) {
				d.push_back(b[i]);
			}
			m --;
		} else {
			for (int i = 0; i < c.size(); i++) {
				d.push_back(c[i]);
			}
			m -= 2;
		}
	}

//	for (int i = 0; i < 26; i++) {
//		cout << cnt[i] << endl;
//	}

	sort(d.begin(), d.end(), greater<int>());
	bool flg = true;
	for (int i = 0; i < d.size(); i++) {
		bool flg1 = false;
		for (int j = 0; j < 26; j++) {
			if (cnt[j] >= d[i]) {
				cnt[j] -= d[i];
				flg1 = true;
				break;
			}
		}
		if (flg1 == false) {
			flg = false;
		}
	}

	if (flg == true) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

//	for (int i = 0; i < d.size(); i++) {
//		cout << d[i] << endl;
//	}


	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 998244353;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

int L[205];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	//	freopen("a.in","r",stdin);
	//	freopen("a.out","w",stdout);
	int n; cin >> n;
	rep(i, 0, 2*n)
	{
		cin >> L[i];
	}

	sort(L, L + 2 * n);

	int ans = 0;
	for (int i = 0; i < 2 * n; i += 2) {
		ans += L[i];
	}

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


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

using namespace std;
typedef long long ll;




int main()
{
    
    
    int N,M;
    cin >> N >> M;
    
    double ans = 0;
    
    double a = (double)((N-M)*100+1900*M);
    
    double b = 1;
    rep(i,M) b/=2;
    double c = 1-b;
    
    for (int i = 1; i < 1000000; i++) {
        double j = double(i);
        ans += j*a*b;
        b *= c;
    }
    cout << ans << endl;
    
    
    return 0;
}



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

int main() {
  string s; cin >> s;
  int a = stoi(s.substr(0, 2));
  int b = stoi(s.substr(2, 2));
  int f = 0;
  if (1 <= a && a <= 12) f |= 1;
  if (1 <= b && b <= 12) f |= 2;
  string res[] = { "NA", "MMYY", "YYMM", "AMBIGUOUS" };
  cout << res[f] << endl;
}

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

using namespace std;

const int N = 1e5 + 100;
const int Mod = 1e9 + 7;

ll Fact[N];

ll FastPower (ll a, ll b) {
	if (!b) return 1;
	if (b & 1)	return a * FastPower (a, b - 1) % Mod;
	return FastPower (a * a % Mod, b >> 1);
}

ll C(int N, int R) {
	if (R > N) return 0;
	return (Fact[N] * FastPower((Fact[R] * Fact[N - R])%Mod, Mod - 2)) % Mod;
}

int main()
{
	Fact[0] = 1;
	for (int i = 1; i < N; i++)
		Fact[i] = i * Fact[i - 1] % Mod;

	int n, k;	scanf("%d%d", &n, &k);

	vector <int> Arr;
	for (int i = 0; i < n; i++) {
		int x;	scanf("%d", &x);
		Arr.push_back(x);
	}

	sort(Arr.begin(), Arr.end());

	ll Max = 0, Min = 0;
	for (int i = 0; i < n; i++) {
		Max = (Max + Arr[i] * C(i, k - 1) % Mod) % Mod;
		Min = (Min + Arr[i] * C(n - i - 1, k - 1) % Mod) % Mod;
	}

	cout << (Max - Min + Mod) % Mod << '\n';
	return 0;
}


Measured memory_bytes: 1660
import sys
input = sys.stdin.readline

max_n = 100000
max_k = 100000
max_w = 10000


def check(p):
  global N, K, T

  i = 0
  for k in range(K):
    s = 0
    while s + T[i] <= p:
      s += T[i]
      i += 1
      if i == N: return N
  return i

def solve():
  left = 0
  right = max_k * max_w

  while right - left > 1:
    mid = (left + right) // 2
    v = check(mid)
    if (v >= N):
      right = mid
    else:
      left = mid
  return right


if __name__ == '__main__':
  N, K = map(int, input().split())
  T = [int(input()) for _ in range(N)]

  ans = solve()
  print(ans)



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

using namespace std;

#define ll long long

signed main() {
	int n; cin >> n;
	set<int> st;
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		st.insert(a);
	}
	cout << (st.size()) << endl;
	return 0;
}


Measured memory_bytes: 7748
#include<stdio.h>
#include<stdlib.h>

int main() {
	int n,i,H[250];
	
	scanf("%d",&n);
	
	for(i=1;i<=n;i++) {
		scanf("%d",&H[i]);
	}
	
	for(i=1;i<=n;i++) {
		printf("node %d: key = %d, ",i,H[i]);
		if(i!=1) printf("parent key = %d, ",H[i/2]);
		if(2*i<=n)
		printf("left key = %d, ",H[2*i]);
		if((2*i+1)<=n)
		printf("right key = %d, ",H[2*i+1]);
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2048
(* Vicfred
 * https://atcoder.jp/contests/abc141/tasks/abc141_b
 * implementation
 * *)
Scanf.scanf "%s\n" (fun s ->
    if
      Array.fold_left ( && ) true @@
      Array.init (String.length s) @@ fun i ->
        if i mod 2 = 0 && s.[i] = 'L' then false
        else if i mod 2 = 1 && s.[i] = 'R' then false
        else true
    then "Yes"
    else "No"
) |> Printf.printf "%s\n"



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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n;
  scanf("%d",&n);
  int p[100001];
  int i;
  for(i=1;i<=n;i++){
    scanf("%d",p+i);
  }
  int cnt=0;
  for(i=1;i<n;i++){
    if(p[i]==i){
      cnt++;
      int s=p[i+1];
      p[i+1]=p[i];
      p[i]=s;
    }
  }
  if(p[n]==n) cnt++;
  printf("%d\n",cnt);
  return;
}

int main(void){
  run();
  return 0;
}


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

class UnionFind{
	public:
		vector<int> Parent;
		vector<int> Rank;
		UnionFind(int n){
			++n;
			Parent.resize(n, 0);
			Rank.resize(n, 0);
			for(int i=0; i<n; ++i){
				Parent[i] = i;
				Rank[i] = 0;
			}
		}

		int find(int x){
			if(Parent[x] == x) return x;
			return Parent[x] = find(Parent[x]);
		}

		void unite(int x, int y){
			x = find(x);
			y = find(y);
			if(x == y) return;
			if(Rank[x] < Rank[y]) Parent[x] = y;
			else{
				Parent[y] = x;
				if(Rank[x] == Rank[y]) ++Rank[x];
			}
		}

		bool same(int x, int y){
			return find(x) == find(y);
		}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
//	scanf("%d %d", &n, &q);
	UnionFind uf(n);
	for(int i=0; i<q; ++i){
		int c, x, y;
		cin >> c >> x >> y;
//		scanf("%d %d %d", &c, &x, &y);
		if(c == 0) uf.unite(x, y);
		else cout << (uf.same(x, y) ? 1 : 0) << "\n";
//		else printf("%d\n", uf.same(x, y) ? 1 : 0);
	}
}


Measured memory_bytes: 3252
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program{
  static void Main(){
    var input = ReadLine().Split(' ');
    int a = int.Parse(input[0]);
    int b = int.Parse(input[1]);
    
    for(var i = 0;i < 10000;i++){
    	if((int)(i*0.08) == a && (int)(i*0.1) == b){
        	Write(i);
          	return;
        }
    }
	Write(-1);
  }
}

Measured memory_bytes: 17728
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}

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

    int subs[S.length()];
    FOR(i,S.length()){
        subs[i]=(int)S[i]-'0';
    }

    int min=999;

    FOR(i,S.length()-2){
        int tmp=subs[i]*100 + subs[i+1]*10 + subs[i+2];
        int dif=abs(tmp-753);
        if(min>dif){
            min=dif;
        }

    }
    cout << min;
  
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

int main() {
	
	long double r;
	cin >> r;
	cout << setprecision(10) <<  2 * r* 3.1415926535<< endl;

	
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dump(x) cerr << #x " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define endl '\n'

#ifdef _DEBUG27_
    //#define STRESS 1
#endif

typedef long long llong;

const int INF = 2e9;
const llong LINF = 2e18;

void inv(bool e);
template<typename T> T sign(T a);
template<typename T> void die(T &a);
template<typename T> void umax(T &a, T b);
template<typename T> void umin(T &a, T b);

bool brute, alter;
int cnt_tests = 1;

// Improoving ATC rating. I want to leave this green trash

// Code below

string vv;

void inp() {
    cin >> vv;    
}

int Sign[2] = {1, -1};
int num[4];

void solve() {
    for (int i = 0; i < 4; ++i) {
        num[i] = vv[i] - '0';
    }
    for (int i = 0; i < (1 << 3); ++i) {
        int res = num[0];
        for (int j = 0; j < 3; ++j) {
            res += Sign[(i >> j) & 1] * num[j + 1];
        }
        if (res == 7) {
            cout << num[0];
            for (int j = 0; j < 3; ++j) {
                if ((i >> j) & 1) {
                    cout << '-';
                } else {
                    cout << '+';
                }
                cout << num[j + 1];
            }
            cout << "=7";
            return;
        }
    }
}

void stress() {

}

void naive() {

}
void run();
int main() {
    #ifdef _DEBUG27_
        if (1)
            freopen("input.txt", "r", stdin);
    #else
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (0) {
            freopen("palindrome.in", "r", stdin);
            freopen("palindrome.out", "w", stdout);
        }
    #endif
    srand(time(0));
    #ifdef STRESS
        brute = true;
    #else
        brute = false;
    #endif  
    
    for (int i = 0; (i < cnt_tests); i++) {
        run();
    }
    #ifdef _DEBUG27_
        cout << endl << "Time: " << clock() / 1000.0 << " ms";
    #endif
    return 0;
}

void run() {
    if (!brute) {
        inp();
    }
    else {
        stress();
    }
    solve();
    cout << endl;
}

template<typename T>
void die(T &a) {
    cout << a;
    exit(0);
}

template<typename T>
T sign(T a) {
    if (a == 0)
        return 0;
    if (a < 0)
        return -1;
    return 1;
}

template<typename T>
void umax(T &a, T b) {
    if (b > a)
        a = b;
}

template<typename T>
void umin(T &a, T b) {
    if (b < a)
        a = b;
}

void inv(bool e) {
    if (!e) {
        vector<int> a;
        a[-1] += 1;
    }
}

/** CLEARING BUFFER

    cout << VAL << flush;

    OR

    printf(VAL);
    fflush(stdout);
*/

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

int main(){
    int n;
    cin >> n;
    vector<pair<int, int>> p(n);
    for(int i=0; i<n; i++){
        cin >> p[i].first >> p[i].second;
    }
    if(n&1){
        cout << "NA" << endl;
        return 0;
    }
    int ax, ay;
    for(int i=0; i*2 < n; i++){
        int j = n/2 + i;
        if(i == 0){
            ax = p[i].first + p[j].first;
            ay = p[i].second + p[j].second;
        }
        if(ax != p[i].first + p[j].first || ay != p[i].second + p[j].second){
            cout << "NA" << endl;
            return 0;
        }
    }
    cout << fixed << setprecision(20) << 1.*ax/2. << " " << 1.*ay/2. << endl;
}


Measured memory_bytes: 3272
W, H, x, y = map(int,input().split())


"""考え方
下記の時のみ「最大の面積は全体の半分」、かつ「パターンが１つ」のみに決まる。
もし下記の両条件を満たしているときは「パターンは2つ」となる。

W/2 == x,
H/2 == y


それ以外の場合は「パターンは複数」となる。
また、最大の面積は、必ず全体の半分となる。


以上から、下記の事柄が導かれる。
・求める面積は、必ず全体面積の半分
・W/2==x,H/2==yの「どちらか１つだけ」の条件を満たしている場合は、パターンは1つ。それ以外の時は複数パターン存在する。
"""

area = (W*H) / 2.0

ck1 = False
if W/2 == x:
  ck1 = True

ck2 = False
if H/2 == y:
  ck2 = True

if ck1 and ck2:
  print(str(area)+ ' ' + '1')
else:
  print(str(area)+ ' ' + '0')
  

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
string s;
int k;
ll INF=1000000000000000;
int dh[4]={0,1,0,-1};
int dw[4]={1,0,-1,0};

int main(){
    int N,W;cin>>N>>W;
    int v[N],w[N];
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    int dp[W+1];
    for(int i=0;i<=W;i++){
        dp[i]=0;
    }
    for(int i=0;i<N;i++){
        for(int j=w[i];j<=W;j++){
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    cout<<dp[W]<<endl;
    return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

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

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   ull x;
   cin >> x;
   ull ans = x/11;
   ans *= 2;
   if(x%11)ans++;
   if(x%11 > 6)ans++;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
n = int(input())
f = False
c = []
d = []
for i in range(n//4+1):
    c.append(i)

for i in range(n//7+1):
    d.append(i)

for i in range(len(c)):
    for j in range(len(d)):
        if c[i]*4+d[j]*7 == n:
            f = True
            break

if f:
    print('Yes')
else:
    print('No')

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


if __name__ == '__main__':
    n = int(input())
    a = list(map(lambda x: int(x) - 1, input().split()))
    count = 0

    # See:
    # http://code-festival-2016-quala.contest.atcoder.jp/data/other/code-festival-2016-quala/editorial.pdf
    for i in range(len(a)):
        if i == a[a[i]]:
            count += 1

    print(count // 2)


Measured memory_bytes: 14008
/*
    Take me to church
    I'll worship like a dog at the shrine of your lies
    I'll tell you my sins and you can sharpen your knife
    Offer me that deathless death
    Good God, let me give you my life
*/
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, A[N];
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++)
        scanf("%d", &A[i]);
    for (int i = 1, a; i <= n; i ++)
        scanf("%d", &a), A[i] -= a;
    sort(A + 1, A + n + 1);
    long long SM = 0; int C = 0;
    for (int i = 1; i <= n; i ++)
        if (A[i] < 0)
            SM -= A[i], C ++;
    for (int i = n; i; i --)
        if (A[i] > 0 && SM > 0)
            SM -= A[i], C ++;
    if (SM > 0)
        return !printf("-1\n");
    return !printf("%d\n", C);
}

Measured memory_bytes: 640
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,cos,radians,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7



def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n=I()
bekit=[0 for i in range(n+1)]
bekit[0]=1
for i in range(n):
    bekit[i+1]=(bekit[i]*2)%mod
#print(bekit)
countz=0
countx=0
county=0
nump=[]
numm=[]
for i in range(n):
    a,b=MI()
    if a==0 and b==0:
        countz+=1
    elif a==0:
        if b<0:
            b*=(-1)
        countx+=1
    elif b==0:
        if a<0:
            a*=(-1)
        county+=1
    elif a*b<0:
        #print(a,b)
        if b<0:
            a*=(-1)
            b*=(-1)
        g=gcd(abs(a),b)
        a=a//g
        b=b//g
        #print(a,b)
        numm.append([a,b])
    else:
        g=gcd(abs(a),abs(b))
        a//=g
        b//=g
        nump.append([abs(a),abs(b)])
#print(nump)
#print(numm)
nump=list(map(tuple,nump))
numm=list(map(tuple,numm))
u=Counter(nump)
v=Counter(numm)
#print(u)
#print(v)
nums=[]
pairs=[]
for k in u.keys():
    vz=((-1)*k[1],k[0])
    s=u[k]
    t=v[vz]
    #print(vz)
    #print(s)
    #print(t)
    if t>0:
        nums.append([s,t])
        pairs.append(s+t)
#print(nums)
#print(nums)
#print(n-sum(pairs)-countx-county-countz)
#print(pairs)
#print(n-sum(pairs)-countx-county-countz)
if countx>0 and county>0:
    cou=countx+county
else:
    cou=0
ans=bekit[n-sum(pairs)-cou-countz]
#print(ans)
for j in range(len(nums)):
    q=bekit[nums[j][0]]
    p=bekit[nums[j][1]]
    #print(q)
    #print(p)
    ans=(ans*(q+p-1))%mod
if countx>0 and county>0:
    ans=(ans*(bekit[countx]+bekit[county]-1))%mod
ans-=1
if countz>0:
    ans+=countz%mod
print(ans%mod)


Measured memory_bytes: 68668
#include <iostream>
#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>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

struct Pony {
  long a, b, c;
  Pony(long aa, long bb, long cc) : a(aa), b(bb), c(cc) {}
  bool operator<(Pony other) const {
      return c > other.c;
  }
};

const int mod = 1000000007;

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

  int n;
  cin >> n;

  vector<Pony> happyDiff;
  rep(i, n) {
    long a, b;
    cin >> a >> b;
    happyDiff.push_back(Pony(a, b, a+b)); 
  }
  sortv(happyDiff);
  int mode = 0;
  long res = 0;

  rep(i, n) {
    if (mode == 0) {
      res += happyDiff[i].a;
    } else {
      res -= happyDiff[i].b;
    }
    mode = (mode+1)%2;
  }

  cout << res << endl;
}


Measured memory_bytes: 4852
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def M(n): return ModInt(n)
def MI(): return M(I())

class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n)

def inv(x):
    return pow(x, mod - 2, mod)

cms = 10**6
cm = [0] * cms

def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod

def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod

def h(a,b):
    return comb(a+b-1, b)

def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r


print(main())





Measured memory_bytes: 75500
/******************************\
*  Everyone has a different way of thinking, so God Created us
   Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Mo_Murad   *
\******************************/
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define SZ(c) int(c.size())
#define ff first
#define ss second
#define INF INT32_MAX
#define _INF INT32_MIN
#define PQ priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	LL c;
	while (a != 0) {
		c = a;
		a = b % a;
		b = c;
	}
	return b;
}
int LCM(int a, int b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		printf("%d ", 2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			printf("%d ", i);
			n /= i;
		}
	}
	if (n > 2)printf("%d ", n);
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
void dijjkstra(int src, int n) {
	list<ipair>adj[1000005];
	vector<bool>visited(1000005, false);
	vector<int>dis(1000005, 1e9);
	PQ<ipair, vector<ipair>, greater<ipair>>pq;
	pq.push(MP(0, 1));
	dis[src] = 0;
	while (!pq.empty())
	{
		int u = pq.top().ss;
		visited[u] = true;
		pq.pop();
		list<ipair>::iterator i;
		for (i = adj[u].begin(); i != adj[u].end(); i++)
		{
			int v = i->ff;
			int we = i->ss;
			if (!visited[v] && dis[v] > dis[u] + we)
			{
				dis[v] = dis[u] + we;
				pq.push(MP(dis[v], v));
			}
		}
	}
}
const int N = 1e+5;
int dp[N];
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	int n, m;
	cin >> n >> m;
	vector<int>a(n+1);
	dp[0] = 1;
	dp[1] = 1;
	for (int i = 0; i < m; i++)
	{
		int x;
		cin >> x;
		a[x] = -1;
	}
	for (int i = 1; i <= n; i++)
	{
		if (a[i] == -1)
			dp[i] = 0;
		else if (i >= 2)
			dp[i] = (dp[i - 1] + dp[i - 2]) % modd;
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T> inline T gcd(T&a,T&b){return b==0?a:gcd(b,a%b);}
template<typename T> inline T lcm(T&a,T&b){return a/gcd(a,b)*b;}
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
int n,a[maxn];
int main(){
    read(n);
    for (int i=1;i<=n;i++) read(a[i]);
    int cnt=0;
    for (int i=1;i<n;i++){
        if (a[i]==i) swap(a[i],a[i+1]),cnt++;
    }
    if (a[n]==n) cnt++;
    printf("%d\n",cnt);
    return 0;
}


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

int main(){
  string s, t;
  cin >> s >> t;
  bool torf = false;
  for(int i = 0; i < 26; i++){
    if(t == s + string(1, 'a'+ i)){
      torf = true;
      break;
    }
  }
  
  if(torf) cout << "Yes" << endl;
  else cout << "No" << endl;
    
}

Measured memory_bytes: 3644
#include<algorithm>
#include<stdio.h>
#include<math.h>

using namespace std;

int main(void){
	
	long long str[26] = { 0 };
	char *s;
	int count = 0;
	long long ans = 0;
	s = (char *)malloc(sizeof(char) * 200001);
	
	for (int i = 0; i < 200001; i++)
		s[i] = '\0';
	scanf("%s", s);

	for (int i = 0; s[i] != '\0'; i++){

		count = i + 1;
		str[s[i] - 'a']++;
	}

	for (int i = 0; i < 26; i++){
		ans += (count - str[i]) * str[i];
		count -= str[i];
	}

	printf("%lld\n", ans + 1);
	return 0;
	

}

Measured memory_bytes: 384
# ABC106b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())

ans = 0

for i in range(1, n + 1, 2):
    cnt = 2
    for j in range(2, i):
        if (i % j == 0):
            cnt += 1
    if (cnt == 8):
        ans += 1
    #print(i, cnt)
print(ans)

Measured memory_bytes: 3064
using System;
public class Test{
    public static void Main(){
        var second = int.Parse(Console.ReadLine());
        var hour = 0;
        while(second / 3600 > 0){
            second -= 3600;
            ++hour;
        }
        var minute = 0;
        while(second / 60 > 0){
            second -= 60;
            ++minute;
        }
        Console.WriteLine(String.Format("{0}:{1}:{2}", hour, minute, second));
    }
}


Measured memory_bytes: 9216
#include<iostream>
using namespace std;
int main()
{
    long long k, a, b;
    cin >> a >> b >> k;
    if(k <= a)
        cout << a - k << " " << b;
    else if(k <= a + b)
        cout << 0 << " " << a + b - k;
    else
        cout << 0 << " " << 0;
    return 0;
}

Measured memory_bytes: 3584
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    vector<int> A;
    A.push_back(a);
    A.push_back(b);
    A.push_back(c);
    sort(ALL(A));
    
    ll sum = A[0] + A[1] + A[2] * pow(2, k);

    p(sum);
    
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp67 {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            int len = s.Length;

            StringBuilder ans = new StringBuilder("");

            for (int i = 0; i < len; i++) {
                if (i % 2 == 0) {
                    ans.Append(s[i]);


                }
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 11616
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

int calc(int x, char op, int y)
{
    switch(op)
    {
    case '+': return x+y;
    case '-': return x-y;
    case '*':
    default:  return x*y;
    }
}

string solve(int[] a, int[] b)
{
    if(b is null)
    {
        string c = "+-*";
        foreach(c1;c)
            foreach(c2;c)
                foreach(c3;c)
                {
                    auto w = a.map!(to!string).array();
                    if(10==calc(a[0],c1,calc(a[1],c2,calc(a[2],c3,a[3]))))
                        return w[0]~[c1]~"("~w[1]~[c2]~"("~w[2]~[c3]~w[3]~"))";
                    if(10==calc(a[0],c1,calc(calc(a[1],c2,a[2]),c3,a[3])))
                        return w[0]~[c1]~"(("~w[1]~[c2]~w[2]~")"~[c3]~w[3]~")";
                    if(10==calc(calc(a[0],c1,a[1]),c2,calc(a[2],c3,a[3])))
                        return "("~w[0]~[c1]~w[1]~")"~[c2]~"("~w[2]~[c3]~w[3]~")";
                    if(10==calc(calc(calc(a[0],c1,a[1]),c2,a[2]),c3,a[3]))
                        return "(("~w[0]~[c1]~w[1]~")"~[c2]~w[2]~")"~[c3]~w[3];
                    if(10==calc(calc(a[0],c1,calc(a[1],c2,a[2])),c3,a[3]))
                        return "("~w[0]~[c1]~"("~w[1]~[c2]~w[2]~"))"~[c3]~w[3];
                }
        return [];
    }
    foreach(i;0..b.length)
    {
        auto r = solve(a~b[i],b[0..i]~b[i+1..$]);
        if(r !is null)
            return r;
    }
    return [];
}

void main()
{
    foreach(vs;stdin.byLine().map!(s=>s.split().map!(to!int).array())())
    {
        if(vs.all!"a==0"()) break;
        auto r = solve([],vs);
        writeln(r is null?"0":r);
    }
}

Measured memory_bytes: 2028
n = int(input())
s = list(map(int,input().split()))
count = 0

def merge(a, left, mid, right):
    global count
    l = a[left:mid] + [float("inf")]
    r = a[mid:right] + [float("inf")]
    i = j = 0
    for k in range(left, right):
        if l[i] <= r[j]:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            j += 1
            count += len(l) - i - 1

def mergeSort(a, left, right):
    if left + 1 < right:
        mid = right + (left - right)//2
        mergeSort(a, left, mid)
        mergeSort(a, mid, right)
        merge(a, left, mid, right)

mergeSort(s, 0, n)

print(count)

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;


ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }

  return gcd(b, a % b);
}

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  ll mini = 1e9;
  REP(i, N){
    cin >> A[i];
  }
  
  ll g = A[0];
  REP(i, N){
    g = gcd(g, A[i]);
  }

  cout << g << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll dp[3][202020];

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];


    ll res = 0;
    if(N%2==0){
        const ll INF = (1ll<<60);
        REP(i, 2)REP(j, 202020) dp[i][j] = -INF;
        dp[0][0] = 0;
        dp[1][0] = 0;

        REP(i, N){
            if(i<N) chmax(dp[0][i+2], dp[0][i] + A[i]);
            if(i+1<N) chmax(dp[1][i+3], dp[0][i] + A[i+1]);
            if(i<N) chmax(dp[1][i+2], dp[1][i] + A[i]);
        }
        
        res = max(dp[0][N], dp[1][N+1]);
    }else{
        const ll INF = (1ll<<60);
        REP(i, 3)REP(j, 202020) dp[i][j] = -INF;
        dp[0][0] = 0;
        dp[1][0] = 0;
        dp[2][0] = 0;

        REP(i, N){
            if(i<N) chmax(dp[0][i+2], dp[0][i] + A[i]);
            if(i+1<N) chmax(dp[1][i+3], dp[0][i] + A[i+1]);
            if(i<N) chmax(dp[1][i+2], dp[1][i] + A[i]);
            if(i+1<N) chmax(dp[2][i+3], dp[1][i] + A[i+1]);
            if(i<N) chmax(dp[2][i+2], dp[2][i] + A[i]);
        }

        /*
        REP(i, 2){
            REP(j, N+2){
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }
        */
        
        res = max(max(dp[0][N-1], dp[1][N]), dp[2][N+1]);

        ll tmp = 0;
        ll mi = INF;
        REP(i, N){
            if(i%2==0){
                tmp += A[i];
                chmin(mi, A[i]);
            }
        }
        tmp -= mi;
        chmax(res, tmp);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 9480
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(void)
{
    double a,b,h,m,ha,ma,sa;
    double pi=3.14159265358979323846264338;
    cin >> a >> b >> h >> m;
    ha=30*h+0.5*m; ma=6*m;
    sa=abs(ha-ma);
    printf("%.12lf" ,sqrt(a*a+b*b-2*a*b*cos(sa*pi/180)));
    return 0;
}


Measured memory_bytes: 4188
import sys
N, M, Q = map(int, sys.stdin.readline().split())
 
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = map(int, sys.stdin.readline().split())
  LR[L][R-L+1] += 1
 
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
for i in range(Q):
  p, q = map(int, sys.stdin.readline().split())
  sys.stdout.write(str(LR[p][q-p+1]))
  sys.stdout.write("\n")

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int a,b,c; scanf("%d%d%d",&a,&b,&c);
	if((a==b && a!=c)
	|| (a==c && a!=b)
	|| (b==c && a!=b)) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()

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

ans1 = []
ans2 = []
for i in range(N):
    ans1.append(X[i] + Y[i])
    ans2.append(Y[i] - X[i])
ans1.sort()
ans2.sort()

a = ans1[-1] - ans1[0]
b = ans2[-1] - ans2[0]

print(max(a,b))

Measured memory_bytes: 41476
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())

ans=1
while N>=ans:
    ans*=2

print(ans//2)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#define X first
#define Y second
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 5003;
const ll MOD = 1000000007;

ll mpow (ll bs, ll ep, ll md) {
    ep %= (md - 1);
    ll ret = 1;
    while (ep) {
        if (ep & 1) {
            ret = ret * bs % md;
        }
        ep >>= 1;
        bs = bs * bs % md;
    }
    return ret;
}

struct Hash {
    int n;
    string s;

    pii pre[MAXN], inv[MAXN];
    pii a;
    const pii MOD = {1000000009, 1000000007};
    Hash (string &str) : n(SZ(str)), s(str) {
        a.X = rand() % 300 + 300;
        a.Y = rand() % 300 + 300;
        inv[0] = {1, 1};

        REP1 (i, n) {
            inv[i].X = mpow(a.X, i * (MOD.X - 2LL), MOD.X);
            inv[i].Y = mpow(a.Y, i * (MOD.Y - 2LL), MOD.Y);
        }

        pll bs = {1, 1};
        REP1 (i, n) {
            pre[i].X = (pre[i-1].X + s[i-1] * bs.X) % MOD.X;
            pre[i].Y = (pre[i-1].Y + s[i-1] * bs.Y) % MOD.Y;
            bs.X = bs.X * a.X % MOD.X;
            bs.Y = bs.Y * a.Y % MOD.Y;
        }
    }

    pii get (int l, int r) {
        pll dl;
        dl.X = pre[r+1].X - pre[l].X;
        dl.Y = pre[r+1].Y - pre[l].Y;
        if (dl.X < 0) {
            dl.X += MOD.X;
        }
        if (dl.Y < 0) {
            dl.Y += MOD.Y;
        }

        dl.X = dl.X * inv[l].X % MOD.X;
        dl.Y = dl.Y * inv[l].Y % MOD.Y;
        return dl;
    }
};

/*********************GoodLuck***********************/
int main () {
    IOS();
    srand(2002);

    int n;
    string s;

    cin >> n >> s;
    Hash hasher(s);

    for (int i=n/2; i>=0; i--) {
        set<pii> tbl;

        REP (j, n) {
            if (j >= i*2-1) {
                tbl.insert(hasher.get(j-i*2+1, j-i));
                pii res = hasher.get(j-i*2+1, j-i);
                debug(res.X, res.Y);
            }
            if (j >= i-1) {
                pii res = hasher.get(j-i+1, j);
                debug(res.X, res.Y);
                if (tbl.count(hasher.get(j-i+1, j))) {
                    cout << i << endl;
                    return 0;
                }
            }
        }
    }

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ff(p,a,b) for(int p=a;p<=b;p++)
#define fo(p,a,b) for(int p=a;p>=b;p--)
#define LL long long
using namespace std;
char temp;
int ans;
int main() {
	cin>>temp;
	cout<<temp;
	while(cin>>temp){
		ans++;
	}
	cout<<ans-1<<temp<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b;
	for(;;){
		cin>>a>>b;
		if(a==0||b==0){
			break;
		}
		for(int i=1;i<=a;i++){
			for(int j=1;j<=b;j++){
				if(i==1||i==a||j==1||j==b){
					cout<<"#";
				}else{
					cout<<".";
				}
			}
			cout<<endl;
		}
		cout<<endl;
	}
}

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

using namespace std;

typedef unsigned long long ull;

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

int main(){
    int n;
    cin >> n;
    rep(p, n){
        vector<int> v(10);
        rep(i,10) cin >> v[i];
        int a=0, b=0;
        bool is = true;
        for(int i=0; i < 10; i++){
            if(v[i] < a && v[i] < b){is = false; break;}
            if(a < b) (b<v[i]?b:a) = v[i];
            else (a<v[i]?a:b) = v[i];
        }
        cout << (is?"YES":"NO") << endl;
    }
}

Measured memory_bytes: 1184