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


using namespace std;

int main() {
	int A, B, X;
	cin >> A >> B >> X;
	if (A > X) {
		cout << "NO" << endl;
	}
	else if (X - A <= B) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using namespace std;
vector<ll> t;
int main(){
  int x,t;
  cin >> x >> t;
  cout << max(x - t, 0) << endl;
  return 0;
}

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

int main() {
  int h1, m1, h2, m2;
  cin >> h1 >> m1 >> h2 >> m2;
  int k;
  cin >> k;
  
  int a, b;
  a = h1 * 60 + m1;
  b = h2 * 60 + m2;
  if (a >= b - k) {
    cout << 0 << endl;
  }
  else {
    cout << b - k - a << endl;
  }
}

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

using namespace std;

// Prioridade
typedef long long   ll;
typedef pair<ll,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i = a; i < (b); i++)
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define endl '\n'
#define mdc(a, b) (__gcd((a), (b)))
#define mmc(a, b) (((a)*(b))/__gcd((a), (b)))

// fim da Prioridade
ll dp[110][100010];
int n;
ll v[110];
ll w[110];
ll solve(int i, int resto){
	if(i == n){
		return 0;
	}
	if(dp[i][resto] != -1){
		return dp[i][resto];
	}
	ll ans = 0;
	if(resto >= w[i]){
		ans = solve(i + 1, resto - w[i]) + v[i];
	}
		ans = max(ans,solve(i+1,resto));
	return dp[i][resto] = ans;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin >> n ;
	int valor = 0;
	cin >> valor;
	REP(i,0,n){
		cin >> w[i] >> v[i];
	}
	memset(dp,-1,sizeof dp);
	cout << solve(0,valor) << endl;
	return 0;
}


Measured memory_bytes: 86272
#include <iostream>
#include <map>
using namespace std;
int main(){
    int n,k=0;
    map<int,bool>m;
    while(cin>>n){
        
        m.insert({n,true});
        while(true){
            k++;
            if(n%2)
                n = 3 * n + 1;
            else
                n = n / 2;
            if(m.find(n)==m.end())
                m.insert({n,true});
            else{
                cout<<k+1<<endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define INF (2 << 28)
#define fr first
#define sc second
using namespace std;

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

int main(){
  
  int n, d, m;
  vector <int> pizza;
  
  while(cin >> d, d){
    cin >> n >> m;
    pizza.resize(n + 1);
    pizza[0] = 0, pizza[n] = d;
    for(int i = 1; i < n; i++) cin >> pizza[i];
    sort(pizza.begin(), pizza.end());
    
    int sum = 0;
    for(int i = 0; i < m; i++){
      int q; cin >> q;
      vector <int>::iterator it = lower_bound(pizza.begin(), pizza.end(), q);
      sum += min(abs(*it - q), abs(*(it - 1) - q));
    }
    cout << sum << endl;
  }
}

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

int main(void) {
    int N,median,large,small;
    cin >> N;
    vector<int> X(N);
    vector<int> copy(N);

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

    copy = X;
    sort(copy.begin(), copy.end());
    median = copy[copy.size()/2-1];
    large = copy[copy.size()/2];
    for(int i=0;i<N;i++) {
        if(X[i] > median) {
            cout << median << endl;
        } else if(X[i] < median) {
            cout << large << endl;
        }else {
            if(large == median) {
                cout << median << endl;
            } else {
                cout << large << endl;
            }
        }
    }

    return 0;
}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n,k;
    cin >> n >> k;

    vector<int> a(n);

    rep(i, n){
        cin >> a[i];
    }

    sort(ALL(a));

    int ans = 0;

    rep(i, k){
        ans += a[i];
    }

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


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


int main(){
	int x,cnt=0;
	cin >> x;
	for(int i=111;i<=999;i++){
		int a=i/100,b=(i%100)/10,c=(i%100)%10;
		if(a>x || b>x || c>x || a==0 || b==0 || c==0) continue;
		cnt++;
	}
	
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

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

  ll n;
  std::cin>>n;

  std::string s;
  std::cin>>s;

  ll q;
  std::cin>>q;

  rep(_,0,q){
    ll k;
    std::cin>>k;

    ll d=0,m=0,c=0;
    ll mc=0;

    ll ans=0;

    for(ll i=n-1;i>=0;i--){
      if(s[i]=='D'){
        ans+=mc;
      }else if(s[i]=='M'){
        m++;
        mc+=c;
      }else if(s[i]=='C'){
        c++;
      }

      if(i+k-1<n){
        if(s[i+k-1]=='D'){

        }else if(s[i+k-1]=='M'){
          m--;
        }else if(s[i+k-1]=='C'){
          c--;
          mc-=m;
        }
      }
    }

    std::cout<<ans<<"\n";
  }
  return 0;
}

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

#define HASH 100003
#define Mod 1000000007

typedef struct List {
	struct List *next;
	long long a, b;
	int num;
} list;

long long gcd(long long a, long long b)
{
	if (a > b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	if (b % a == 0) return a;
	else return gcd(b % a, a);
}

int main()
{
	int h, i, N;
	long long A, B, G;
	list *p, *hash[HASH] = {}, d[200010];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld %lld", &A, &B);
		if (A != 0 && B != 0) {
			G = gcd(llabs(A), llabs(B));
			A /= G;
			B /= G;
			if (A < 0) {
				A *= -1;
				B *= -1;
			}
		} else if (A != 0) A = 1;
		else if (B != 0) B = -1;
		
		h = (A % HASH - B % HASH * 397 + HASH * 397) % HASH;
		for (p = hash[h]; p != NULL; p = p->next) if (p->a == A && p->b == B) break;
		if (p != NULL) p->num++;
		else {
			d[i].a = A;
			d[i].b = B;
			d[i].num = 1;
			d[i].next = hash[h];
			hash[h] = &(d[i]);
		}
	}
	
	long long ans = 1, zero = 0, pow[200010], tmp;
	list *q, *r;
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	for (h = 0; h < HASH; h++) {
		for (p = hash[h]; p != NULL; p = p->next) {
			if (p->num > 0) {
				if (p->a == 0 && p->b == 0) zero += p->num;
				else {
					tmp = (p->b < 0)? p->a: -(p->a);
					i = (llabs(p->b) % HASH - tmp % HASH * 397 + HASH * 397) % HASH;
					for (q = hash[i]; q != NULL; q = q->next) if (q->a == llabs(p->b) && q->b == tmp) break;
					if (q == NULL) ans = ans * pow[p->num] % Mod;
					else {
						ans = ans * (pow[p->num] + pow[q->num] - 1) % Mod;
						q->num = 0;
					}
				}
			}
		}
	}
	printf("%lld\n", (ans + zero + Mod - 1) % Mod);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 10228
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#pragma GCC optimize("O3")

// 1 - indexed
template <typename T>
struct BIT
{
   vector<T> bit;

   BIT(int sz) : bit(sz + 1, 0) {}

   // sum of [1, k]
   T sum(int k)
   {
      T res = 0;
      for (int x = k; x > 0; x -= x & -x)
         res += bit[x];
      return res;
   }

   void add(int k, T w)
   {
      for (int x = k; x < (int)bit.size(); x += x & -x)
         bit[x] += w;
   }

   // sum of [x, y)
   T getSum(int x, int y)
   {
      return sum(y - 1) - sum(x - 1);
   }

   // find an index i s.t. a[1] + a[2] + ⋯ + a[x] ≧ w
   T lower_bound(T w)
   {
      if (w <= 0)
         return 0;

      T x = 0;
      int p = 1, N = bit.size();

      while (2 * p <= N)
         p *= 2;

      for (T k = p; k > 0; k /= 2)
      {
         if (x + k <= N && bit[x + k] < w)
         {
            w -= bit[x + k];
            x += k;
         }
      }

      return x + 1;
   }
};

int main()
{
   fast();

   int N, Q;
   cin >> N >> Q;
   vector<int> c(N + 1);
   for (int i = 0; i < N; i++)
      cin >> c[i + 1];

   vector<vector<pair<int, int>>> queries(N + 1, vector<pair<int, int>>());

   for (int i = 0, l, r; i < Q; i++)
   {
      cin >> l >> r;
      queries[l].emplace_back(r, i);
   }

   vector<priority_queue<int, vector<int>, greater<int>>> pos(N + 1);

   for (int i = 1; i <= N; i++)
      pos[c[i]].push(i);

   BIT<int> bit(N);

   for (int i = 1; i <= N; i++)
   {
      if (pos[i].empty())
         continue;
      bit.add(pos[i].top(), 1);
      pos[i].pop();
   }

   vector<int> ans(Q);

   for (int l = 1; l <= N; l++)
   {
      for (auto q : queries[l])
      { // 左端がlのクエリ
         int R = q.first + 1, ind = q.second;
         ans[ind] = bit.getSum(l, R);
      }

      if (pos[c[l]].empty())
         continue;

      int nxt = pos[c[l]].top();
      pos[c[l]].pop();
      bit.add(nxt, 1);
   }

   for (int i = 0; i < Q; i++)
      cout << ans[i] << "\n";
}


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

int main() {
  ll a,b,k;
  cin>>a>>b>>k;
  if(k>=a+b) cout<<0<<" "<<0<<endl;
  else if(a>=k) cout<<a-k<<" "<<b<<endl;
  else cout<<0<<" "<<b-(k-a)<<endl;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<algorithm>
using namespace std;
int solve(int j,int o,int i);
int main(){
    char c;
    int j=0,o=0,i=0;
    int f = 0;
    int ans = 0;
    int x=0;
    while(c != 10){

        c = getchar();

        if(c == 'I' && f == 4){
            i++;
            x = solve(j,o,i);
            ans = max(ans,x);
            continue;
        }
        else if(f == 4){
            j = 0,o = 0,i = 0;
            f = 0;
        }
        if(c == 'J' && f == 0 || c == 'J' && f == 1){
            j++;
            f = 1;
        }
        if(c == 'O' && f == 1 ||c == 'O' && f == 2){
            //printf("poyo-\n");
            o++;
            f = 2;
        }
        if (c == 'J' && f == 2){
            j=1,o=0,i=0;
            f = 1;
        }
        if(c == 'I' && f == 2){
            i++;
            f = 4;
            x = solve(j,o,i);
            //printf("%d %d %d\n",j,o,i);
            ans = max(ans,x);
        }
        else if(c == 'I' && f == 1){
            j=0,i=0,o=0;
            f = 0;
        }
    }
    //printf("%d %d %d\n",j,o,i);
    printf("%d\n",ans);
    return 0;
}
int solve(int j,int o,int i){
    int x=0;
    x = min(j,i);
    if(o <= x)return o;
    if(o > x)return 0;
}

Measured memory_bytes: 936
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;
const ll inf=10000000000;
bool vis[100005];
vector <ll> dp(100005,-1),v[100005];

void dfs(ll a)
{
    if(vis[a])
        return;
    vis[a]=1;
    for(auto it:v[a])
    {
        dfs(it);
        dp[a]=max(dp[a],dp[it]+1);
    }
}

int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   ll n,m,i,j,a,b;
   cin>>n>>m;
   for(i=0;i<m;i++)
   {
       cin>>a>>b;
       v[a].pb(b);
   }
   for(i=1;i<=n;i++)
   {
       v[0].pb(i);
   }
   dfs(0);
   cout<<dp[0]<<endl;
   return 0;
}

Measured memory_bytes: 9588
#include <stdio.h>
        int main() {   
            int x, k, k_t;
            scanf("%d", &k);
            scanf("%d", &x);
            k_t = k * 500;
            if(k_t >= x){
                printf("Yes");
            }else{
                printf("No");
            }
            return 0;
        }

Measured memory_bytes: 128
#include<iostream>
#include<string.h>
#include<set>
#include<algorithm>
#include<iterator>
using namespace std;
int main()
{
    int i,j,len,flag=0;
    char w[102];
    set<char>st;
    set<char>::iterator it;
    cin>>w;
    for(i=0;w[i]!='\0';i++){
        st.insert(w[i]);
    }
    for(it=st.begin();it!=st.end();it++){
        int count=0;
        for(i=0;w[i]!='\0';i++){
            if(*it==w[i]) count++;
        }
        if(count & 1) {
            cout<<"No\n";
            flag=1;
            break;
        }
        else flag=0;
    }
    if(flag==0) cout<<"Yes\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, dp[1001][1001], pref[mxn], a, b;

int main(){
    cin >> a >>b;
    if(a > 0 && b > 0){
        cout << "Positive";
    }else if(a < 0 && b < 0){
        llong k = abs(b - a) + 1;
        if(k % 2){
            cout << "Negative";
        }else{
            cout << "Positive";
        }
    }else{
        cout << "Zero";
    }
    return 0;
}


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

namespace ConsoleApp110 {
    class Program {
        static void Main(string[] args) {
            long N = long.Parse(Console.ReadLine());

            long small = 1;
            long big = N;

            //一番√に近い二つの積を求める
            for (int i = (int)Math.Sqrt(N); i >= 1; i--) {
                if (N % i == 0) {
                    small = i;
                    big = N / i;
                    break;
                }
            }


            Console.WriteLine(big.ToString().Length);
        }
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>bool chmax(T &a, const T &b);
template <class T>bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t,std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001

void Main()
{
  int n;
  int d[100];
  cin >> n;
  rep(i, n){cin >> d[i];}

  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    for (int l = i + 1; l < n; l++)
    {
      sum += d[i] * d[l];
    }
  }
  
  std::cout << sum << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

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

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }
  
  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if(n % i == 0){
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }
  
  return res;
}

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

using namespace std;

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

int main() {
    int n;
    map<int, int> cnt;
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        cnt[a]++;
    }

    long long ans = 0;
    for(auto iter=cnt.rbegin(); iter!=cnt.rend(); iter++) {
        int k = log2(iter->first) + 1;
        int b = pow(2, k) - iter->first;
        if(iter->first == b) {
            ans += iter->second / 2;
            iter->second = max(iter->second-2, 0);
        } else {
            int m = min(iter->second, cnt[b]);
            ans += m;
            iter->second = max(iter->second-m, 0);
            cnt[b] = max(cnt[b]-m, 0);
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;


int main() {

    int x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> x1 >> y1 >> x2 >> y2;

    if(x2>=x1){
        if(y2>=y1){
            x3 = x2-(y2-y1);
            y3 = y2+(x2-x1);
            x4 = x1-(y2-y1);
            y4 = y1+(x2-x1);
        }else{
            x3 = x2+(y1-y2);
            y3 = y2+(x2-x1);
            x4 = x1+(y1-y2);
            y4 = y1+(x2-x1);
        }
    }else{
        if(y2>=y1){
            x3 = x2-(y2-y1);
            y3 = y2-(x1-x2);
            x4 = x1-(y2-y1);
            y4 = y1-(x1-x2);
        }else{
            x3 = x2+(y1-y2);
            y3 = y2-(x1-x2);
            x4 = x1+(y1-y2);
            y4 = y1-(x1-x2);
        }       
    }

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
 

}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;


int main(){
  string alp = "abcdefghijklmnopqrstuvwxyz";
  string s;
  while( getline(cin, s) ){
    // cerr << s.size() << endl;
    bool f = false;
    int tmp = 0;
    for(int i=0; i<26; i++){

      for(int j=0; j<s.size()-4; j++){
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'i' && alp[ (s[j+3]-'a'+i)%26 ] == 's' ){
          f = true;
          break;
        }
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'a' && alp[ (s[j+3]-'a'+i)%26 ] == 't' ){
          f = true;
          break;
        }
        if( alp[ (s[j]-'a'+i)%26 ] == 't' && alp[ (s[j+1]-'a'+i)%26 ] == 'h' && alp[ (s[j+2]-'a'+i)%26 ] == 'e' ){
          f = true;
          break;
        }
        // if( s[j] == ' ' ) cerr << ' ';
        // else cerr << alp[ (s[j]-'a'+i)%26 ];
      }
      // cerr << endl;
      if( f ){
        // cerr << "  " << i << endl;
        tmp = i;
        break;
      }
    }
    // cerr << tmp << endl;

    for(int i=0; i<s.size(); i++){
      if( s[i] == ' ' || s[i] == '.' ) cout << s[i];
      else cout << alp[ (s[i] - 'a' + tmp)%26 ];
    }
    cout << endl;
  }

  return 0;
}








// EOF

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;

int main(){
    
    int N;cin>>N;
    vector<pair<ll,ll>> S(N);
    for(int i=0;i<N;i++){
        ll a,b;cin>>a>>b;
        S[i].first=b;
        S[i].second=a;
    }
    sort(all(S));
    
    ll now=0;
    bool flag=true;
    for(int i=0;i<N;i++){
        now+=S[i].second;
        if(now>S[i].first) flag=false;
    }
    
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string o,e;
    std::cin >> o >>e;
    for (int i = 0; i < o.length(); i++) {
        std::cout << o[i];
        if(i<e.length())std::cout <<e[i];
    }
    std::cout  << std::endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;

void Main()
{
	ll N; 
  	cin >> N;
  	vector<ll> x(N), y(N), h(N);
  	rep(i,N){
		cin >> x[i] >> y[i] >> h[i];
    }
  	
  	auto Hp = [&] (ll x, ll y, ll h, ll Cx, ll Cy){
      	return abs(x-Cx) + abs(y-Cy) + h;
    };
  	
  	auto H = [&] (ll x, ll y, ll Hp, ll Cx, ll Cy){
		ll ans = Hp - abs(x-Cx) - abs(y-Cy);
      	ans = max(ans, (ll)0);
      	return ans;
    };
  	// 0 <= Cx, Cy <= 100 について全探索
  	// h[i] = 0 の情報は無視
  		ll Htemp;
  		rep(Cx,101){
          rep(Cy,101){
  			int flagfirst = 0;
			int flagNG = 0;
            int flagoutput = 1;
            rep(i,N){
              		if(h[i] == 0){;}
  					else if(flagfirst == 0){
                      Htemp = Hp(x[i],y[i],h[i],Cx,Cy);
                      flagfirst = 1;
                    }
              		else{
                      if(Htemp != Hp(x[i],y[i],h[i],Cx,Cy)){
                      	flagNG = 1;
                        break;
                      }
                    }
        	}
            if(flagNG == 0){
              rep(i,N){
                	if(h[i] != H(x[i], y[i], Htemp, Cx, Cy)){
                    	flagoutput = 0;
                    }
              }
              if(flagoutput == 1){
           		cout << Cx << " " << Cy << " " << Htemp << endl;
            	return;
              }
            }
          }
        }
  	cout << "error" << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mx = 1e5+5;
long long int knapsack[mx];
int main()
{
    int n,W;
    cin>>n>>W;
    for(int item =0;item<n;item++)
    {
        int wei,val;
        cin>>wei>>val;
        for(int i=W;i>=wei;i--)
            knapsack[i]  = max(knapsack[i],knapsack[i-wei]+val);
    }
    long long int ans =0;
    for(int i=0;i<=W;i++)
        ans = max(ans,knapsack[i]);
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e9+7;
const int inf=(1ull<<31)-1;
string a;
map<string,int> mp;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	mp["SUN"]=7;
	mp["MON"]=6;
	mp["TUE"]=5;
	mp["WED"]=4;
	mp["THU"]=3;
	mp["FRI"]=2;
	mp["SAT"]=1;
	cin>>a;
	cout<<mp[a];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
using namespace std;
int main(void)
{
	ios_base::sync_with_stdio(false);
	bool flag=false;
	int n,num;
	string s;
	list<int> intlist;
	list<int>::iterator it;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s;
		if(s=="insert"){
			cin >> num;
			intlist.push_front(num);
		}
		else if(s=="delete"){
			cin >> num;
			for(it=intlist.begin();it!=intlist.end();++it){
				if(*it ==num){
					intlist.erase(it);
					break;
				}
			}
		}
		else if(s=="deleteFirst"){
			intlist.pop_front();
		}
		else if(s=="deleteLast"){
			intlist.pop_back();
		}
	}
	for(it=intlist.begin();it!=intlist.end();++it){
		if(flag==false){
			cout << *it;
			flag=true;
		}
		else cout << " " << *it;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 32476
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int n, k;

int f(int n)
{
    if (n <= 1) return 0;
    return f(n - k + 1) + 1;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    if (n <= k)
        cout << 1;
    else if (n <= k + k - 1)
        cout << 2;
    else
        cout << f(n);
}


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

int main()
{
	int W, H;
	int x, y, r;
		
	cin >> W >> H >> x >> y >> r;
	
	if (x - r < 0 || x + r > W || y - r < 0 || y + r > H)
	{
		cout << "No" << endl;
	}
	else 
	{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
import scala.io.StdIn.readInt

object Main extends App{
  val n = readInt()
  println(
    n % 10 match{
      case 2|4|5|7|9 => "hon"
      case 0|1|6|8 => "pon"
      case 3 => "bon"
    }
  )
  
}

Measured memory_bytes: 54660
//b.c B-Resale
#include<stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int v[n],c[n];
    for(int i=0;i<n;++i){
        scanf("%d",v+i);
    }
    for(int i=0;i<n;++i){
        scanf("%d",c+i);
    }

    int x=0,y=0;
    for(int i=0;i<n;++i){
        if(v[i]-c[i]>0){
            x += v[i];
            y += c[i];
        }
    }
    printf("%d\n",x-y);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
  int n, m, a, sum;
  sum = 0;
  cin >> n >> m;

  for(int i=0; i<m; i++){
    cin >> a;
    sum += a;
  }

  int diff;
  diff = n - sum;

  if(diff < 0){
    cout << -1 << endl;
  }else{
    cout << diff << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3628
#include<queue>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> P;
struct edge{
  ll to;
  ll cost;
  ll en;
  edge(ll t,ll w,ll e) : to(t),cost(w),en(e){}
};
int main(){
  while(1){
    vector<vector<edge> > g(110);
    ll i,j,n,m,l,a,b,d,e;
    ll ds[110][110],ns[110][110];
    const ll INF=1000000000000;
    priority_queue<P,vector<P>,greater<P> > que;
    scanf("%lld %lld %lld\n",&n,&m,&l);
    if(n==0 && m==0 && l==0){
      return 0;
    }
    for(i=0;i<m;i++){
      scanf("%lld %lld %lld %lld\n",&a,&b,&d,&e);
      a--,b--;
      g[a].push_back(edge(b,d,e));
      g[b].push_back(edge(a,d,e));
    }
    for(i=0;i<n;i++){
      for(j=0;j<=l;j++){
        ds[i][j]=INF,ns[i][j]=0;
      }
    }
    ds[0][0]=0,ns[0][0]=1;
    que.push(make_pair(0,pll(0,0)));
    while(!que.empty()){
      P p=que.top();
      ll v=p.second.first,w=p.second.second;
      que.pop();
      for(i=0;i<g[v].size();i++){
        edge us=g[v][i];
        if(w+us.cost<=l && ds[us.to][w+us.cost]>ds[v][w] && ns[us.to][w+us.cost]==0){
          ds[us.to][w+us.cost]=ds[v][w];
          que.push(make_pair(ds[us.to][w+us.cost],pll(us.to,w+us.cost)));
        }
        if(ds[us.to][w]>ds[v][w]+us.en && ns[us.to][w]==0){
          ds[us.to][w]=ds[v][w]+us.en;
          que.push(make_pair(ds[us.to][w],pll(us.to,w)));
        }
      }
      ns[v][w]=1;
    }
    ll ans=INF;
    for(i=0;i<=l;i++){
      ans=min(ans,ds[n-1][i]);
    }
    printf("%lld\n",ans);
  }
  return 0;
}


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

int main(void) {
  int H,W;
  cin >> H >> W;
  vector<string> a(H);
  rep(i,H) cin >> a.at(i);
  rep(i,H){
    rep(j,W){
      if(a.at(i).at(j) == '.'){
        int count = 0;
        
        rep2(k,-1,2){
          rep2(l,-1,2){
            if(i == 0 && k == -1){
              continue;
            }
            else if(i == H-1 && k == 1){
              continue;
            }
            else if(j == 0 && l == -1){
              continue;
            }
            else if(j == W-1 && l == 1){
              continue;
            }
            else if(a.at(i+k).at(j+l) == '#'){
              count++;
            }
          }
        }
        string s = to_string(count);
        a.at(i).at(j) = s.at(0);
      }
    }
  }
  
  rep(i,H) cout << a.at(i) << endl;
  
               
   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

vector<ll>relation[20], money(20, 1);

int main() {
	int n;
	cin >> n;
	vector<int>a(n - 1);
	vector<int>both(n);
	rep(i, n - 1) {
		cin >> a[i];
		both[a[i] - 1]++;
	}
	rep(i, n) {
		cout << both[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4792
using System;

namespace AGC004C{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var H = sr.Next<int>();
            var W = sr.Next<int>();
            var A = sr.Next<string>(H);

            var rmap = new char[H, W].ToJaggedArray();
            var bmap = new char[H, W].ToJaggedArray();

            for(var i = 0; i < H; i++){
                for(var j = 0; j < W; j++){
                    if(A[i][j] == '#'){
                        rmap[i][j] = '#';
                        bmap[i][j] = '#';
                        continue;
                    }

                    if(i == 0 || (i != H - 1 && j % 2 == 0)){
                        rmap[i][j] = '#';
                    } else{
                        rmap[i][j] = '.';
                    }

                    if(i == H - 1 || (i != 0 && j % 2 == 1)){
                        bmap[i][j] = '#';
                    } else{
                        bmap[i][j] = '.';
                    }
                }
            }

            Array.ForEach(bmap, Console.WriteLine);
            Console.WriteLine();
            Array.ForEach(rmap, Console.WriteLine);
            //---------------------------------
        }
    }

    public static class ExMethod{
        public static T[][] ToJaggedArray<T>(this T[,] src){
            var x = src.GetLength(1);
            var y = src.GetLength(0);
            var ret = new T[y][];

            for(var i = 0; i < y; i++){
                ret[i] = new T[x];
                for(var j = 0; j < x; j++){
                    ret[i][j] = src[i, j];
                }
            }

            return ret;
        } 
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

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


int main(){
    string w1,w2;
    int cnt;
    cin >> w1;
    w2 = w1;
    reverse(w2.begin(),w2.end());
    cnt = 0;
    rep(i,w1.size()){
        if(w1[i]!=w2[i]){
            cnt++;
        }
    }
    cnt = cnt / 2;
    cout << cnt;
}


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

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        _out.println((n - 1) * (m - 1));
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

const int N = 20005;
int a[N], b[N];

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

    for (int i=1; i<=n; i++)    a[i] = i*n, b[i] = (n+1-i)*n;

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

    for (int i=1; i<=n; i++)    cout<<a[i]<<" "; cout<<endl;
    for (int i=1; i<=n; i++)    cout<<b[i]<<" "; cout<<endl;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

map<int, P> mp;
int g[301][301];

signed main() {
  int h, w, d;
  cin >> h >> w >> d;
  int a[d + 1][(h * w) / d + 1] = {};
  rep(i, 0, h) rep(j, 0, w) {
    cin >> g[i][j];
    mp[g[i][j]] = P(i, j);
  }
  int q;
  cin >> q;
  rep(i, 0, d) {
    for(int j = 1; j <= (h * w) / d; j++) {
      a[i][j] += abs(mp[i + j * d].first - mp[i + j * d - d].first);
      a[i][j] += abs(mp[i + j * d].second - mp[i + j * d - d].second);
      a[i][j] += a[i][j - 1];
    }
  }
  rep(i, 0, q) {
    int l, r;
    cin >> l >> r;
    cout << a[l % d][r / d] - a[l % d][l / d] << endl;
  }
}


Measured memory_bytes: 12800
#include <stdio.h>
#define MAXH 101
using namespace std;

int v[MAXH * MAXH];
int ans[MAXH][MAXH];
int main()
{
    int H, W, N;
    int color = 1;
    scanf("%d %d", &H, &W);
    scanf("%d", &N);
    for (int i = 1; i <= N; ++i) {
        scanf("%d", &v[i]);
    }
    for (int i = 1; i <= H; ++i) {
        if (i % 2 == 1) {
            for (int j = 1; j <= W; ++j) {
                ans[i][j] = color;
                --v[color];
                if (v[color] == 0) {
                    ++color;
                }
            }
        } else {
            for (int j = W; j >= 1; --j) {
                ans[i][j] = color;
                --v[color];
                if (v[color] == 0) {
                    ++color;
                }
            }
        }
    }
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            printf("%d ", ans[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
  int N;
  cin >>N;
  
  long ai=0;
  long sum=0;
  int cnt=0;
  for(int i=0;i<N;i++){
    cin >> ai;
    cnt=0;
    if(ai%2==0)
    { 
      while(ai%2==0){
        cnt++;
        ai/=2;
      }
    }
    sum+=cnt;
  }
  

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

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

void main ()
{
	int n, k;
	while (readf (" %s %s", &n, &k) > 0)
	{
		readln;
		auto a = readln.split.map !(to !(long)).array;
		long [] s = [0L];
		foreach (c; a)
		{
			s ~= s.back + c;
		}
		long [] t = [0L];
		foreach (c; a)
		{
			t ~= t.back + max (0L, c);
		}

		debug {writeln (s); writeln (t);}
		long res = long.min / 4;
		long cur = t.back;
		debug {writeln (s); writeln (t); writeln (cur);}
		foreach (i; k..n + 1)
		{
			debug {writeln (i, " ", t[i] - t[i - k], " ",
			    s[i] - s[i - k]);}
			res = max (res, cur - (t[i] - t[i - k]) +
			    max (0L, (s[i] - s[i - k])));
		}

		writeln (res);
	}
}


Measured memory_bytes: 6052
from itertools import permutations as p
from math import factorial as f
from math import sqrt as s

def func(x1, x2, y1, y2): return s((x2-x1) ** 2 + (y2-y1) ** 2)

N = int(input())
xy = list(list(map(int,input().split())) for _ in range(N))

total = 0

for l in p(range(1, N+1)):
  for i in range(N-1):
    total += func(xy[l[i]-1][0], xy[l[i+1]-1][0], xy[l[i]-1][1], xy[l[i+1]-1][1])

print(total / f(N))

Measured memory_bytes: 9200
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    full = 0
    for i in range(N + 1):
        if i == 0:
            full += abs(A[0])
        elif i == N:
            full += abs(A[-1])
        else:
            full += abs(A[i] - A[i - 1])
    diff = [0 for _ in range(N)]
    for i in range(N):
        if i == 0:
            diff[0] = abs(A[1]) - (abs(A[1] - A[0]) + abs(A[0]))
        elif i == N - 1:
            diff[N - 1] = abs(A[-2]) - (abs(A[-2] - A[-1]) + abs(A[-1]))
        else:
            diff[i] = abs(A[i + 1] - A[i - 1]) - (abs(A[i + 1] - A[i]) + abs(A[i] - A[i - 1]))
    for d in diff:
        print(full + d)


if __name__ == '__main__':
    main()

Measured memory_bytes: 13920
def bin_tree( pri , li_pri , len_li ):
    #pri: どこに入れていいかわからない値段
    #li_pri: 値段のリスト(昇順)
    #len_li: リストの長さ
    lo = 0
    hi = len_li - 1
    while hi - lo > 1:
        mid = lo + (hi - lo) // 2
        guess = li_pri[mid]
        if guess >= pri:
            hi = mid
        else:
            lo = mid
    return lo

I = input().split()
N = int(I[0])
M = int(I[1])
# N: 品物の数
# M: 割引券の数
# A: 品物の値段行列
A = list(map(int , input().split()))
A.sort()

while M > 0:
    M -= 1
    pri = A.pop( N - 1 )
    pri = pri // 2
    if len(A) == 0:
        ans = 0
    elif (pri < A[0] ):
        ans = 0
    else:
        ans = bin_tree( pri , A , N - 1 ) + 1
    # ans: pri以上となる値段のうち最小のインデックス
    A[ans:ans] = [pri]    

F_pri = 0
for i in range(N):
    F_pri += A[i]
print(F_pri)

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

int main() {
    string S;
    cin >> S;
    if (S[0] == 'A') {
        int count = 0;
        for (int i = 2; i < S.length() - 1; i++) {
            if (S[i] == 'C') count++;
        }
        if (count == 1) {
            for (int j = 0; j < S.length(); j++) {
                if (S[j] != 'A' && S[j] != 'C') {
                    if (S[j] >= 'a' && S[j] <= 'z') continue;
                    else {
                        cout << "WA" << endl;
                        return 0;
                    }
                }
            }
            cout << "AC" << endl;
            return 0;
        }
        else {
            cout << "WA" << endl;
            return 0;
        }
    }
    else {
        cout << "WA" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

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

void solve(long long N, long long K, long long Q, std::vector<long long> A) {
    auto B = A;
    sort(B.begin(), B.end());
    for (int i = 0; i < N; i++) {
        if( K - Q + upper_bound(B.begin(), B.end(), i+1) - lower_bound(B.begin(), B.end(), i+1) > 0){
            cout << YES << endl;
        }else{
            cout << NO << endl;
        }
    }
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    long long Q;
    scanf("%lld", &Q);
    std::vector<long long> A(Q);
    for (int i = 0; i < Q; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, K, Q, std::move(A));
    return 0;
}


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

int main(){

    int n,k;cin >> n >> k;
    vector<int> h(n,0);
    for(int i=0;i<n;++i)cin >> h.at(i);

    int sum=0;
    for(int i=0;i<n;++i){
        if(h.at(i)>=k)++sum;
    }

    cout << sum << endl;

    return 0;

}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static long Mod = (long)1e9 + 7;
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var abc = Sarray();
            Array.Sort(abc);
            if (abc[0] + abc[1] == abc[2])
                WriteLine("Yes");
            else
                WriteLine("No");
        }
    }
}

Measured memory_bytes: 28036