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

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

  string K; cin >> K;
  ll D; cin >> D;
  ll N = K.size();

  ll MOD = 1e9 + 7;
  vector<ll> eq(D, 0), ls(D, 0);
  eq[0] = 1;
  for (ll i = 0; i < N; i++) {
    int d = K[i] - '0';
    vector<ll> eq2(D, 0), ls2(D, 0);

    for (ll j = 0; j < D; j++) {
      eq2[(j + d) % D] += eq[j];

      for (ll k = 0; k < d; k++) {
        ls2[(j + k) % D] += eq[j];
      }

      for (ll k = 0; k < 10; k++) {
        ls2[(j + k) % D] += ls[j];
      }
    }
    for (ll j = 0; j < D; j++) {
      eq[j] = eq2[j] % MOD;
      ls[j] = ls2[j] % MOD;
      // cout << eq[j] << ' ' << ls[j] << '\n';
    }
    // cout << '\n';
  }
  cout << (eq[0] + ls[0] - 1 + MOD) % MOD << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int n;
long long int x;
long long int b[60];
long long int p[60];

void init() {
  b[0] = 1; p[0] = 1;
  for(int i=1; i<=n; i++){
    b[i] = 2*b[i-1] + 3;
    p[i] = 2*p[i-1] + 1;
  }
}

long long int f(int n, long long int x) {
  if(x == 0) return 0;
  else if(n == 0){
    return 1;
  } else if(x <= 1 + b[n-1]) {
    return f(n-1, x-1);
  } else {
    return p[n-1] + 1 + f(n-1, x-2-b[n-1]);
  }
}

int main() {
  cin >> n >> x;

  init();
  cout << f(n, x) << endl;

  return 0;
}



///


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

int main() {
	int a, b, c; cin >> a >> b >> c;
	bool ok = false;
	for (int i = a; i <= a*b; i+=a) {
		if (i % b == c) {
			ok = true;
		}
	}
	cout << (ok ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 3628
n=int(input())
a=list(map(int,input().split()))

def gcd(a,b):
    return gcd(b,a%b) if b != 0 else a
mod = 10**9+7

def lcm(a,b):
    return a*b%mod * pow(gcd(a,b),mod-2,mod) % mod

num = {}

for i in range(n):
    nown=a[i]
    tmp = {}
    for i in range(2,int(nown**0.5) + 5):
        while nown % i ==0:
            nown//=i
            if(i in tmp):
                tmp[i]+=1
            else:
                tmp[i] = 1
    if nown != 1:
        tmp[nown] = 1    
    for key in tmp:
        if (key in num):
            num[key] = max(num[key],tmp[key])
        else:
            num[key] = tmp[key]

kobai = 1
for key in num:
    kobai *= pow(key, num[key],mod)
    kobai %= mod
    
ans = 0

for i in range(n):
    ans += kobai * pow(a[i],mod-2,mod) %mod
    ans %= mod

print(ans)

Measured memory_bytes: 46044
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <climits>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {

	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";

    return out;

}


int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	vector<int> contests = { 111, 222, 333, 444, 555, 666, 777, 888, 999};

	int n;
	cin >> n;

	int idx = upper_bound(contests.begin(), contests.end(), n) - contests.begin();
	if (contests[idx - 1] == n) {
		cout << n << "\n";
	} else {
		cout << contests[idx] << "\n"; 
	}


	return 0;

}

Measured memory_bytes: 256
N=int(input())
W=list(map(int,input().split()))
ans=10000
for i in range(N):
    sum1=0
    sum2=0
    for j in range(i+1):
        sum1+=W[j]
    for k in range(i+1,N):
        sum2+=W[k]
    dist=abs(sum1-sum2)
    ans=min(ans,dist)

print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
LL n;
int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    int x=sqrt(n);
    LL ans=LLONG_MAX;
    for(int i=1;i<=x;i++){
        if(n%i==0){
            LL l=i;
            LL r=n/i;
            ans=min(ans,l+r-2);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

const int MOD = 1000000007;

int main() {
    int n;cin>>n;

    ll ans = 0;
    ll a_10 = 10;
    ll a_9 = 9;
    ll a_8 = 8;
    
    for(int i=2;i<=n;++i){
        a_10 = (a_10*10)%MOD;
        a_9 = (a_9*9)%MOD;
        a_8 = (a_8*8)%MOD;
    }
    if(n>=2) ans = (a_10 - 2 * a_9 + a_8)%MOD;
    if(ans<0)ans+=MOD;
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <math.h>
#define N_MAX 10000

int isPrime(int x)
{
  int i;
  if (x <= 3) {
    return 1;
  } else if (x % 2 == 0) {
    return 0;
  } else {
    for (i = 3; i <= sqrt(x); i = i + 2) {
      if (x % i == 0) {
        return 0;
      }
    }
    return 1;
  }
}

int main(int argc, char *argv[])
{
  int i, j, n, x;
  int answer = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    answer = answer + isPrime(x);
  }
  printf("%d\n", answer);
  return 0;
}

Measured memory_bytes: 1760
#include <iostream>
using namespace std;
int main()
{
    int n;
    while(cin >> n)
    {
        int s = 0,m = 1, l;
        for(int i = 2; i <= n; i++)
        {
            int j = i;
            l = 0;
            if(j % 2 != 0)
                continue;
            else
            {
                while(j%2==0)
                {
                   l++;
                   j/=2;
                }
            }
            if(l>s)
            {
                s = l;
                m = i;
            }
        }
        cout << m << endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int n;cin>>n;
    vector<ll> a(n),b(n);
    ll sum=0;
    bool f=true;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]!=b[i]) f=false;
        sum+=a[i];
    }
    if(f){
        cout<<0<<endl;
        return 0;
    }
    ll mi=INF;
    for(int i=0;i<n;i++){
        if(a[i]>b[i]){
            mi=min(mi,b[i]);
        }
    }
    cout<<sum-mi<<endl;
}


Measured memory_bytes: 640
N = int(input())
a = input().split()
b = [""] * N
b1 = [a[i] for i in range(len(a)) if i % 2 == 1][::-1]
b2 = [a[i] for i in range(len(a)) if i % 2 == 0]
b = b1 + b2
if N % 2 == 1:
	b = b[::-1]
line = " ".join(b)
print(line)

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

using namespace std;
using ll = long long;

int main() {
	int A, B, K;
	cin >> A >> B >> K;

	if (B - A + 1 <= 2 * K) {
		for (int i = A; i <= B; ++i) {
			cout << i << endl;
		}
	}
	else {
		for (int i = 0; i < K; ++i) {
			cout << A + i << endl;
		}
		for (int i = K-1; i >= 0; --i) {
			cout << B - i << endl;
		}
	}

	return 0;
}



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

typedef long long ll;
typedef long double ld;

ll a;
ld b;

int main()
{
    cin >> a >> b;
    ll B = b * 100 + 1e-9l;
    cout << a * B / 100 << endl;
    return 0;
}


Measured memory_bytes: 3668
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int N=2e5+5;
#define mst(a) memset(a,0,sizeof a)
int a[N],n;
ll ans; 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int l=1,r=1,sum=0;l<=n;){
		while(r<=n&&(sum^a[r])==sum+a[r]) sum^=a[r++];
		ans+=r-l,sum^=a[l++];
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 1024
// I am Varun Das from Jadavpur University
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define mod 1000000007
#define ll long long
#define dbg(x) cerr << #x << " = " << x << endl
#define INF LLONG_MAX
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) for(int i=a;i>=b;i--)
#define nax 503405
using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//cout<<fixed<<setprecision(12);
ll n,s=0;
cin>>n;
ll a[nax],b[nax],c[nax];
loop(i,1,n+1) cin>>a[i];
loop(i,1,n+1) cin>>b[i],s+=b[i];
loop(i,1,n) cin>>c[i];
loop(i,2,n+1){
    if(a[i] == a[i-1] + 1) s+=c[a[i-1]];
}
cout<<s;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  VEC<double> v(N);
  REP(i, 0, N) cin >> v[i];
  sort(ALL(v));
  REP(i, 0, N - 1) {
    double c = (v[i] + v[i + 1]) / 2;
    v[i + 1] = c;
  }
  printf("%lf\n", v[N-1]);

  return 0;
}


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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;


int n = 50;
ll ans[100];

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll k;
    cin >> k;
    ll x = ( k + n * n - n ) / n;
    if ( ( k + n * n - n ) % n != 0 ){
        x++;
    }
    ll cnt = n * ( x - n + 1 ) - k;
    for ( int i = 1; i <= n; i++ ){
        ans[i] = x;
    }
    for ( int i = 1; i <= cnt; i++ ){
        int p = 0;
        for ( int j = 1; j <= n; j++ ){
            if ( ans[j] > ans[p] ){
                p = j;
            }
        }
        for ( int j = 1; j <= n; j++ ){
            if ( j == p ){
                ans[j] -= n;
            }
            else{
                ans[j]++;
            }
        }
    }
    cout << n << endl;
    for ( int i = 1; i <= n; i++ ){
        cout << ans[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", (a - b + 1) * (a - c + 1));
	
	Please AC;
}


Measured memory_bytes: 888
///created: 29/May/2019 17:55:52

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 3;
typedef long long ll;
typedef pair<int, int> ii;
int n, k;
bool ch[N] = {0};
ii a[N];
stack<int> st;

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", &a[i].second, &a[i].first);
	}
	sort(a + 1, a + 1 + n, greater<ii>());
	ll sum = 0, diff = 0;
	for (int i = 1; i <= k; ++i) {
		if (!ch[a[i].second]) {
			ch[a[i].second] = 1;
			diff++;
		}
		else
			st.push(a[i].first);
		sum += a[i].first;
	}
	ll ans = sum + diff * diff;
	for (int i = k + 1; i <= n && !st.empty(); ++i) {
		if (!ch[a[i].second]) {
			sum += a[i].first - st.top();
			st.pop();
			ch[a[i].second] = 1;
			diff++;
			ans = max(ans, sum + diff * diff);
		}
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

void solve(){
  ll N, A, B;
  cin >> N >> A >> B;
  if(A % 2 == B % 2){
    cout << abs(A-B)/2 << endl;
    return;
  }
  if(A > B)swap(A, B);
  ll ans = 0;
  if(A == 1){
    ans++;
    B--;
    ans += (B-A) / 2;
  }else if(B == N){
    ans++;
    A++;
    ans += (B-A) / 2;
  }else{
    if(A-1 <= N-B){
      ans += (A-1);
      B -= (A-1);
      A = 1;
      ans++;
      B--;
      ans += (B-A) / 2;
    }else{
      ans += (N-B);
      A += (N-B);
      B = N;
      ans++;
      A++;
      ans += (B-A) / 2;
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
/*
 Author: Alokit Kumar 
 */
 #include<bits/stdc++.h>
 using namespace std;
 #define int long long
 int32_t main()
 {
   int n,i,j,k,l,s=0;
   cin>>n;
   map<int,int> m;
   for(i=1;i<=n;i++)
   {
     cin>>k;
     m[k]++;
   }
   vector<int> v;
   for(auto it=m.begin();it!=m.end();it++)
   {
     j=(it->first);
     v.push_back(j);
   }
   j=v[v.size()-1];
   bool a[j+1];
   memset(a,1,sizeof(a));
   for(i=0;i<v.size();i++)
   {
     if(a[v[i]])
     {
       for(k=2*v[i];k<=j;k+=v[i])
        a[k]=0;
     }
   }
   for(i=0;i<v.size();i++)
   {
     j=v[i];
     if(m[j]==1&&a[j])
      {s++;}
   }
   cout<<s;
   return 0;
 }

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const int N = 100005;

int n, m;
int cnt[N];

int main() {
    scanf("%d%d", &n, &m);
    memset(cnt, 0, sizeof cnt);
    forn(i, n) {
        int x;
        scanf("%d", &x);
        ++cnt[x];
    }
    int ans = 0;
    for (int i = 0; 2 * i <= m; ++i) {
        int j = 0;
        if (i > 0) {
            j = m - i;
        }
        if (i == j) {
            int c = 0;
            for (int x = i; x < N; x += m) {
                c += cnt[x];
            }
            ans += c / 2;
        } else {
            int le = 0, ri = 0, lpairs = 0, rpairs = 0;
            for (int x = i; x < N; x += m) {
                lpairs += cnt[x] / 2;
                le += cnt[x] % 2;
            }
            for (int x = j; x < N; x += m) {
                rpairs += cnt[x] / 2;
                ri += cnt[x] % 2;
            }
            //cerr << le << ' ' << ri << ' ' << lpairs << ' ' << rpairs << endl;
            ans += lpairs + rpairs;
            int mn = min(le, ri);
            le -= mn;
            ri -= mn;
            ans += mn;
            ans += min(le / 2, rpairs);
            ans += min(ri / 2, lpairs);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  int cnt=0;
  FOR(i,1,n+1) {
    if (to_string(i).size() % 2) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}


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

#define PB push_back
#define MP make_pair
#define fi first
#define se second

typedef long long LL;

const double EPS=1e-9;
const double PI=acos(-1.0);
const int MAXN=100005;
const LL MOD=1000000007;
const int dx[8]={-1, 0, 1, -1, 1, -1, 0, 1}, dy[8]={-1, -1, -1, 0, 0, 1, 1, 1};

void base(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

set<pair<int, pair<int, int> > > cek;

int main(){
	base();
	vector<int> a, newa;
	int temp, ans=0;
	for(int i=0; i<3; i++){
		cin>>temp;
		a.PB(temp);
	}
	sort(a.begin(), a.end());
	cek.insert(MP(a[0], MP(a[1], a[2])));
	while(1){
		if(a[0]%2||a[1]%2||a[2]%2) break;
		newa.clear();
		newa.PB(a[0]/2+a[1]/2);
		newa.PB(a[0]/2+a[2]/2);
		newa.PB(a[1]/2+a[2]/2);
		sort(newa.begin(), newa.end());
		ans++;
		if(cek.count(MP(newa[0], MP(newa[1], newa[2])))){
			ans=-1;
			break;
		}
		cek.insert(MP(newa[0], MP(newa[1], newa[2])));
		for(int i=0; i<3; i++){
			a[i]=newa[i];
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
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; }


int main()
{
    int n; cin >> n;
    char s[n]; cin >> s;
    int x = 0;
    int max = 0;
    rep(i,n){
        if(s[i]=='I') x++;
        else if(s[i]=='D') x--;
        chmax(max,x);
    }
    cout << max;
    return 0;
}

Measured memory_bytes: 256
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

a,b,c,x,y = map(int,input().split())

mn = 10**10
for i in range(max(x,y) + 1):
    if x<=i<=y:
        total = 2*c*i + b*(y-i)
    elif y<=i<=x:
        total = 2*c*i + a*(x-i)

    else:
        total = 2*c*i + a*(x-i) + b*(y-i)

    mn = min(mn, total)

print(mn)

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> org_x(n);
    vector<ll> org_y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        org_x[i] = x[i];
        org_y[i] = y[i];
    }
    sort(ALL(x));
    sort(ALL(y));

    ll min_a = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
    for (int bx = 0; bx < n - 1; bx++) {
        for (int tx = bx + 1; tx < n; tx++) {
            for (int ly = 0; ly < n - 1; ly++) {
                for (int ry = ly + 1; ry < n; ry++) {
                    int c = 0;
                    for (int i = 0; i < n; i++) {
                        if (org_x[i] <= x[tx] && org_x[i] >= x[bx] && org_y[i] >= y[ly] && org_y[i] <= y[ry]) {
                            c++;
                        }
                    }
                    if (c >= k) {
                        min_a = min(min_a, (x[tx] - x[bx]) * (y[ry] - y[ly]));
                    }
                }
            }
        }
    }
    cout << min_a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

int main(){
    int N;
    cin >> N;
    LL C[N],S[N],F[N];
    for(int i=0;i<N-1;i++){
        cin >> C[i] >> S[i] >> F[i];
    }
    for(int j=0;j<N;j++){
        LL ans=0;
        for(int i=j;i<N-1;i++){
            if(ans<=S[i]){
                ans=S[i]+C[i];
            }
            else{
                if(ans%F[i]!=0)
                    ans+=(F[i]-ans%F[i]+C[i]);
                else ans+=C[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

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

 if(s.at(0)=='o' && s.at(1)=='o' &&s.at(2)=='o') cout <<1000<<endl;
 else if(s.at(0)=='o' && s.at(1)=='o' &&s.at(2)=='x') cout <<900<<endl;
 else if(s.at(0)=='o' && s.at(1)=='x' && s.at(2)=='o') cout <<900<<endl;
 else if(s.at(0)=='x' && s.at(1)=='o' &&s.at(2)=='o') cout <<900<<endl;
 else if(s.at(0)=='x' && s.at(1)=='x' &&s.at(2)=='o') cout <<800<<endl;
 else if(s.at(0)=='x' && s.at(1)=='o' &&s.at(2)=='x') cout <<800<<endl;
 else if(s.at(0)=='o' && s.at(1)=='x' &&s.at(2)=='x') cout <<800<<endl;
 else if(s.at(0)=='x' && s.at(1)=='x' &&s.at(2)=='x') cout <<700<<endl;
}


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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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


ll n;
char s[101];

int main(){
	cin >> n;
	if(n == 0){cout << 0 << endl; return 0;}
	for(int i = 0; i < 101; i++) s[i] = '0';
	int j = 0;
	for(ll i = 1; n != 0; i *= 2){
		if(n % (i*2)){
			s[j] = '1';
			j%2 ? n += i : n -= i;
		}
		else{
			s[j] = '0';
		}
		j++;
	}
	bool b = 0;
	for(int i = 100; i >= 0; i--){
		if(!b && s[i] == '0') continue;
		b = 1;
		cout << s[i];
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val (n, m, d) = readLine()!!.split(" ").map { it.toInt() }
  if (d == 0) {
    val ans = 1.0 / n * (m - 1)
    println(String.format("%.9f", ans))
  } else {
    val ans = 2.0 * Math.max(n - d, 0) / (n.toDouble() * n.toDouble()) * (m - 1)
    println(String.format("%.9f", ans))
  }
}

Measured memory_bytes: 37872
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
#include <cmath>
#include <random>
using namespace std;
long long mod = 1000000000 + 7;


int main()
{
	int n, k, hin;
	vector<int> h;
	cin >> n >>k;
	
	for (int i = 0; i < n; i++) {
		cin >> hin;
		h.push_back(hin);
	}

	sort(h.begin(), h.end());
	long long ans = 0;
	for (int i = 0; i < n - k; i++) {
		ans = ans + h[i];
	}
	cout << ans << endl;
	return 0;

}

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

typedef long long ll;
#define int ll

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    cout<<fixed<<setprecision(10)<<(n+1)/2*1.0/n;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

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


int N;
long long M;
vector<long long> a;

long long solve() {
    while (a[0] % 2 == 0) {
        for (int i = 0; i < N; ++i) {
            if (a[i] % 2 != 0) return 0;
            a[i] /= 2;
        }
        M /= 2;
    }

    //COUT(M); COUT(a);
    
    long long lcm = a[0];
    for (int i = 0; i < N; ++i) {
        if (a[i] % 2 == 0) return 0;
        long long g = GCD(lcm, a[i]);
        lcm = lcm / g * a[i];

        //COUT(lcm);
        
        if (lcm > M) return 0;
    }
    return (M / lcm + 1) / 2;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N >> M) {
        a.resize(N);
        for (int i = 0; i < N; ++i) cin >> a[i], a[i] /= 2;
        cout << solve() << endl;
    }
}


















Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
double pitagoras(double x1,double y1,double x2,double y2){
  return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    double xa,ya,ra,xb,yb,rb;
    scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
    double r=pitagoras(xa,ya,xb,yb);
    if(rb-ra > r && rb>ra) printf("-2\n");
    else if(ra-rb > r && ra>rb) printf("2\n");
    else if(ra+rb >= r) printf("1\n");
    else printf("0\n");
  }
}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make([][]int, 10)
	for i := range m {
		m[i] = make([]int, 10)
	}
	var cnt int
	for i := 1; i <= n; i++ {
		h, e := ghe(i)
		cnt += m[e][h] * 2
		m[h][e]++
		if h == e {
			cnt++
		}
	}

	fmt.Println(cnt)
}

func ghe(i int) (int, int) {
	s := []byte(strconv.Itoa(i))
	return tonum(s[0]), tonum(s[len(s)-1])
}

func tonum(b byte) int {
	i, _ := strconv.Atoi(string([]byte{b}))
	return i
}


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

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

    vector<int> L;

    for (int i = 0; i < N; ++i)
    {
        int l;
        cin >> l;
        L.push_back(l);
    }

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

    int ans = 0;

    for (int i = 0; i < N; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            for (int k = j + 1; k < N; ++k)
            {
                if (L[k] < L[i] + L[j]) ++ans;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//==================================================================================================
// Name        : B.cpp
// Author      : lotus.eater086
// Copyright   : If you're reading this then this warning is for you. Every word you read of this 
//               useless fine print is another second of your life. Don't you've other things to do?
//               Is your life so empty that you honestly can't think of a better way to spend these
//               moments ? Or are you so impressed with authority that you give respect and 
//               credence to all who claim it ? Do you read everything you're supposed to read ? Do
//               you think everything you're supposed to think ? Buy what you're told you should 
//               want ? Get out of your apartment . Meet a member of the opposite sex. Stop the 
//               excessive shopping and self-improvement . Quit your boring job.
//               Start a fight. Prove you're alive. If you don't claim your humanity you'll become a
//               statistic. You've been warned !

// Description : 
// Date        : 2019-07-27
// Time        : 18:13:37
// Directory   : c:\Users\Lenovo\cpPractise\deliberatePractise\code_folder
// FilePath    : c:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\B.cpp
//==================================================================================================
    

#include <bits/stdc++.h>
#define LL long long
#define endl "\n"

using namespace std ;
    
//
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 << 1 ) + ( x << 3 ) + ch - '0' , ch = getchar() ;

    }

    return x = f ? -x:x ;

}
//

int main( void )

{

    //ios_base::sync_with_stdio( false ) ;  cin.tie( NULL ) ;  cout.tie( NULL ) ;

  //  #ifndef ONLINE_JUDGE
   //     freopen( "input.txt" , "r" , stdin ) ;
     //   freopen( "output.txt" , "w" , stdout ) ;
   // #endif

    int n ;

    read( n ) ;

    int cnt = 0 , i = 1 , a ;

    while( n-- )  {

        read( a ) ;

        if( i != a )  cnt++ ;

        i++ ;

    }

    if( cnt == 0 || cnt == 2 )  cout << "YES\n" ;

    else if( cnt == 1 )  cout << "NO\n" ;

    else if( cnt > 2 )  cout << "NO\n" ;

    

    return 0 ;

}


Measured memory_bytes: 256
data class Plan(val t: Int, val x: Int, val y: Int)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val plans = Array(n + 1, {
    if (it == 0) {
      Plan(0, 0, 0)
    } else {
      val (t, x, y) = readLine()!!.split(" ").map(String::toInt)
      Plan(t, x, y)
    }
  })
  for (k in 0 until n) {
    val dt = plans[k + 1].t - plans[k].t
    val distance = Math.abs(plans[k + 1].x - plans[k].x) + Math.abs(plans[k + 1].y - plans[k].y)
    if (distance > dt || distance % 2 != dt % 2) {
      println("No")
      return
    }
  }
  println("Yes")
}

Measured memory_bytes: 56136
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
if n % 2 == 1:
    print(0)
else:
    n //= 2
    ans = 0
    while n:
        n //= 5
        ans += n
    print(ans)


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <string>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;


int main() {
    while(1) {
        int n;
        ull m;
        i_i d[10050];
        cin >> n >> m;
        if(n == 0) {
            break;
        }
        int sum = 0;
        rep(i,n) {
            cin >> d[i].first >> d[i].second;
            sum += d[i].first*d[i].second;
        }
        sort(begin(d),&d[n], [](i_i p, i_i q) { return p.second > q.second; });
        for(int i = 0; m > 0; i++) {
            if(i == n) {
                break;
            }
            if(m > (ull)d[i].first) {
                sum-=d[i].first*d[i].second;
                m-=(ull)d[i].first;
            } else {
               sum-=(ull)d[i].second *m;
               m=0;
            }
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        System.out.println( solve(x) );
    }

    private static long solve(long x) {
        // 6 -> 5 -> 6 -> 5と実行するのがよい
        long d11 = x / 11;
        long r11 = x % 11;
        if( r11 == 0 ) return d11 * 2;

        if( r11 <= 6 ) {
            return d11 * 2 + 1;
        } else {
            return d11 * 2 + 2;
        }
    }
}


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

int main() {
  int A, B, C, D; scanf("%d%d%d%d", &A, &B, &C, &D);
  int L = A + B, R = C + D;
  printf("%s\n", L > R ? "Left" : L == R ? "Balanced" : "Right");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
using namespace std;
int main(){
    int n,Q,q;
    long long sum=0;
    string q_num,Q_num;
    queue<int> que;
    queue<string> que_num;
    cin>>n>>q;
    for(int i=0;i<n;i++){
        cin>>Q_num>>Q;
        que_num.push(Q_num);
        que.push(Q);
    }
    while(que_num.size()!=0){
        if(que.front()<=q){
            sum+=que.front();
            cout<<que_num.front()<<" "<<sum<<endl;
            que.pop();
            que_num.pop();
        }
        else{
            sum+=q;
            int q_rest=que.front()-q;
            que.pop();
            que.push(q_rest);
            que_num.push(que_num.front());
            que_num.pop();
        }
    }
    
    return 0;
}


Measured memory_bytes: 6140
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();    
    int c = sc.nextInt();    

    if(a+b>=c){
    System.out.println("Yes");
    }else{
    System.out.println("No");
    }
}
}

Measured memory_bytes: 35664
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define LONG_LONG_MAX    9223372036854775807LL
#define LONG_LONG_MIN    (-LONG_LONG_MAX-1)



vector<vector<int> >v;
vector<vector<int> >dp;
int n;

int ways(int men,int women){
    if(dp[men][women]!=-1){
        return dp[men][women];
    }
    int w=0;
   for(int i=0;i<n;i++){
        if((women&(1<<i)) && v[men][i]==1){
            w += ways(men+1,(women&(~(1<<i))));
            w %=mod;
        }
   }
   return dp[men][women] = w;
}

void solve(){
   cin>>n;
   v.resize(n,vector<int>(n,0));
   for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        cin>>v[i][j];
    }
   }
   int women = (1<<n)-1;
   dp.resize(n+1,vector<int>(women+1,-1));
   dp[n][0]=1;
   cout<<ways(0,women)<<"\n";

}

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

    cout.precision(10);
    int t=1;//cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


Measured memory_bytes: 188800
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long 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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
int main() {
	int n;
	cin >> n;
	vector<double>a(n);
	rep(i, n)cin >> a[i];
	double ans=0;
	rep(i, n) {
		ans += 1 / a[i];
	}
	ans = 1 / ans;
	cout <<fixed<< setprecision(10) <<ans;
}
	


Measured memory_bytes: 3768
#include <iostream>

using namespace std;

int main() 
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if (x-r >= 0 && y-r >= 0 && x+r <= w && y+r <= h)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}


Measured memory_bytes: 3116
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    n = int(input())
    n -= 400
    ans = 8 - n // 200
    print(ans)
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 27172
from collections import Counter
lim=10**9+7
N=int(input())
A=[int(i) for i in input().split()]
if N % 2 == 0:
    if Counter(A) == {2*i+1:2 for i in range(N//2)}:
        print(2**(N//2)%lim)
    else:
        print(0)
else:
    if Counter(A) == {2*i if i>0 else 0:2 if i>0 else 1 for i in range((N+1)//2)}:
        print(2**((N-1)//2)%lim)
    else:
        print(0)

Measured memory_bytes: 59372
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+5;
bitset<N*N>b;
int n,a[N],i,s,ss;
int main(){
	b[0]=1;
	scanf("%d",&n);for(i=1;i<=n;++i)scanf("%d",a+i),b|=b<<a[i];
	for(i=1;i<N*N;++i)s+=b[i];
	for(i=1;ss+=b[i],ss<s+1>>1;++i);printf("%d\n",i);
}

Measured memory_bytes: 1664
div1 a b = let (d,m) = divMod a b in div a b + signum m

binSearch op xmin xmax p
 | succ xmin == xmax = xmax
 | p h = binSearch op xmin h p
 | otherwise = binSearch op h xmax p
 where h = op xmin xmax

main = do
 [_,a,b] <- map read . words <$> getLine
 hs <- map read . words <$> getContents
 print (wideSpread a b hs)

wideSpread a b hs = binSearch med xmin xmax (explode a b hs)
 where
  hmax = maximum hs
  med x y = x + div (y-x) 2
  xmin = 0
  xmax = sum . map (`div1` a) $ hs

explode a b hs x = nmag <= x
 where
  dadd = a - b
  mrest = map (max 0 . subtract (x*b)) hs
  nmag = sum . map (`div1` dadd) $ mrest

Measured memory_bytes: 12668
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    vector<int> a(3);
    for (int i = 0; i < 3; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    cout << a.at(2) - a.at(0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 3002;

int n, m, f[maxn][maxn], g[maxn][maxn];
string s, t, ans;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    cin >> s >> t;

    n = s.length();
    m = t.length();

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (s[i-1] == t[j-1]) {
                f[i][j] = f[i-1][j-1] + 1;
                g[i][j] = 0;
            } else {
                if (f[i-1][j] > f[i][j-1]) {
                    f[i][j] = f[i-1][j];
                    g[i][j] = 1;
                } else {
                    f[i][j] = f[i][j-1];
                    g[i][j] = 2;
                }
            }
        }
    }
    
    int x = n, y = m;
    while (x > 0 && y > 0 && f[x][y] > 0) {
        if (g[x][y] == 0) {
            ans += s[x-1];
            --x;
            --y;
        } else if (g[x][y] == 1) {
            --x;
        } else
            --y;
    }
	
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 70656
#include <stdio.h>

int main(void) {
  int W, H, x, y;
  scanf("%d %d %d %d", &W, &H, &x, &y);
  double area = (double)W * (double)H / 2.0;
  int flag = 0;
  if(((2 * x) == W) && ((2 * y) == H))
    flag = 1;
  printf("%lf %d\n", area, flag);
  return 0;
}


Measured memory_bytes: 128
io = STDIN
n,m=io.gets.split.map(&:to_i)
ar=io.gets.split.map(&:to_i)
sum=Array.new(n+1,0)
(1..n).each do |i|
  sum[i]=(sum[i-1]+ar[i-1])%m
end
hash=Hash.new{|h,k|h[k]=0}
ans=0
sum.each do |sm|
  #calculate same as self
  ans+=hash[sm]
  hash[sm]+=1
end
p ans


Measured memory_bytes: 12932
use strict;
my ($N,$K)=glob<>;
my $s = <>; chomp $s;
my @dat = split(/ /,$s);
my $a;
for($a=0;$a<$N-$K;$a++){
if($dat[$a]<$dat[$a+$K]){print"Yes\n";}
else{print"No\n";}}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n;
int a[50];

int main()
{
	IOS;
	cin >> n;
	int e, m, c = 1;
	cin >> e;
	m = e;
	for (int i = 1; i < n; i++) {
		cin >> e; 
		if (m <= e) {
			m = e;
			c++;
		}
	}
	cout << c << endl;
	return 0;
}



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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  sort(ALL(s));
  sort(ALL(t), greater<char>());
  cout << (s < t ? "Yes" : "No") << endl;
  return 0;
}


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

int main() {
	int N,K;
	cin >> N >>K;
			int ans = 0;
	rep(i,N){
		int h;
		cin >> h;
		if(h>=K) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
from sys import stdin
import bisect

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

point = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        bi = bisect.bisect_left(li,li[i]+li[j])
        point += bi-j-1
print(point)

Measured memory_bytes: 3188