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

using ll = long long;
static const ll INF = 1e18;

// ワ―シャルフロイド法 O(V^3)
void warshall_floyd(vector<vector<ll>> &M) { // 隣接行列Mを書き換える
  int n = M.size();
  for (int i = 0; i < n; i++) // 経由する頂点
    for (int j = 0; j < n; j++) // 始点
      for (int k = 0; k < n; k++) // 終点
        M[j][k] = min(M[j][k], M[j][i] + M[i][k]);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  // 重み付き無向(有向)グラフの隣接行列
  int n, m, l; // n:頂点数 m:辺数
  cin >> n >> m >> l;
  
  vector<vector<ll>> M(n, vector<ll>(n, INF)); // M:頂点数がnのグラフを表す隣接行列(初期値INF)
  for (int i = 0; i < n; i++) M[i][i] = 0;
  
  ll u, v, w;
  for (int i = 0; i < m; i++) {
    cin >> u >> v >> w;
    u--;
    v--;
    M[u][v] = w;
    M[v][u] = w; // 重み付き有向グラフではこの行をコメントアウト
  }
  
  warshall_floyd(M);
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) M[i][j] = 0;
      else if (M[i][j] <= l) M[i][j] = 1;
      else M[i][j] = INF;
    }
  }
  
  warshall_floyd(M);
  
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    if (M[s][t] == INF) cout << "-1\n";
    else cout << M[s][t] - 1 << '\n';
  }
}

Measured memory_bytes: 1280
//リストにある素数の個数を求める
#include<iostream>
#include<cmath>
using namespace std;

bool isPrime(int N)
{
    if ( N == 2)
    {
        return true;
    }

    if (N < 2 || ( N > 2 &&N % 2 == 0 ))
    {
        return false;
    }
    
    for (int i = 2; i <= sqrt(N); i++)
    {
        if(N % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int A[10000], n, count;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    count = 0;
    for (int i = 0; i < n; i++)
    {
        if (isPrime(A[i]))
        {
             count++;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3112
A=input()
if A=="SUN":
    print("7")
if A=="MON":
    print("6")
if A=="TUE":
    print("5")
if A=="WED":
    print("4")
if A=="THU":
    print("3")
if A=="FRI":
    print("2")
if A=="SAT":
    print("1")

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, x, n) for(ll i=x; i<(ll)n; ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

int main(){
    int X, A;
    cin >> X >> A;
    if(X<A) cout << 0 << endl;
    else cout << 10 << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
V = [int(v) for v in input().split()]

nk = min(N, K)  # NとKのmin（Vから取れる宝石の上限数）
ans = 0

for i in range(1, nk + 1):   # i:取る宝石の数
    for j in range(i + 1):   # j:左端から取る宝石の数
        tmp = V[:j] + V[N-i+j:] # 左からj個、右からi-j個取る
        tmp.sort()
        ngcnt = 0   # マイナスの数
        vsum = 0
        for t in tmp:
            if t < 0 and ngcnt < K-i:
                ngcnt += 1
                continue
            else:
                vsum += t
        ans = max(vsum, ans)

print(ans)


Measured memory_bytes: 3064
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,m=gsmi
ps=m.times.map{
  i=gets.chomp.split
  [i[0].to_i,i[1]]
}

ac=Array.new(n,0)
wa=0
ps.each do |a|
  if a[1]=='WA'
    h[a[0]]+=1 if h[a[0]]
    #puts h[a[0]]
  else
    ac[a[0]]=1
    wa+=h[a[0]] if h[a[0]]
    h[a[0]]=nil
  end

end

puts [ac.count(1),wa].join(" ")

Measured memory_bytes: 22268
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++)
#define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i))
using lpair = pair<lint,lint>;
using vl = vector<lint>;
using vll = vector<long long>;
using Llist = list<lint>;
using vs = vector<string>;
#define all(v) (v).begin(),(v).end()
#define out1(x) cout << (x) << '\n';

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

template <typename T>
T sum(vector<T> vec) {
	ll ret = 0;
	rep(i,vec.size()) {
		ret += vec.at(i);
	}
	return ret;
}

void Main() {
	vl a(4,0);
	rep(i,3) {
		lint x,y;
		cin >> x >> y;
		++a[x-1];++a[y-1];
	}
	if (a[0] == 3 || a[1] == 3 || a[2] == 3 || a[3] == 3) {
		out1("NO");
		return;
	}
	out1("YES");
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 2e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN][2];
int dp[MAXM][MAXM];
int id[MAXM][2];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;
    char c;

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

    cin>>n;

    for(int i=0;i<2*n;i++)
    {
        cin>>c>>x;
        if(c=='W'){
            dp[x][0] = i-cnt;
            A[cnt++][0] = x;
            id[x][0] = i;
        }
        else  {
            A[i-cnt][1] = x;
            id[x][1] = i;
        }
    }

    int res = 0;

    for(int i=0;i<n;i++)
        for(int j=0;j<i;j++){
            if(A[i][0]<A[j][0])res++;
            if(A[i][1]<A[j][1])res++;
        }

    int inv;

    for(int i=1;i<=n;i++){
        mn = dp[i-1][0];
        inv = dp[i][0];
        dp[i][0]+=dp[i-1][0];
        for(int j=1;j<=n;j++){
            mn = min(mn,dp[i-1][j]);
            if(id[j][1]<id[i][0])inv--;
            else inv++;
            dp[i][j] = inv+mn;
        }
    }

    mn = INF;

    for(int i=0;i<=n;i++)
        mn = min(mn,dp[n][i]);

    res+=mn;

    cout<<res<<"\n";

    return 0;
}


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

int main() {
  int N;
  cin>>N;
  int sum=0;
  int i=1;
  while (i<N+1) {
    int a= N/i-N/(i*10)*10;
    sum += a;
    i *=10;
  }
  if (N%sum == 0) {
      cout<<"Yes"<<endl;
  }
  
  else {
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#3
n = int(input())
lista = [int(i) for i in input().split()]

evn = {}
odd = {}
for i in range(n):
    #print(i,evn,odd)
    if i%2==0:
        candi = lista[i]
        if candi not in evn:
            evn[candi] = 1
        else:
            evn[candi] += 1
    else:
        candi = lista[i]
        if candi not in odd:
            odd[candi] = 1
        else:
            odd[candi] += 1
        
maxevnkey1 = 0
maxevnval1 = 0
maxevnkey2 = 0
maxevnval2 = 0

for key in evn:
    val = evn[key]
    if val>maxevnval2:
        if val>=maxevnval1:
            maxevnkey2,maxevnval2 = maxevnkey1,maxevnval1
            maxevnkey1,maxevnval1 = key,val
        else:
            maxevnkey2,maxevnval2 = key,val

maxoddkey1 = 0
maxoddval1= 0
maxoddkey2 = 0
maxoddval2= 0

for key in odd:
    val = odd[key]
    if val>maxoddval2:
        if val>=maxoddval1:
            maxoddkey2,maxoddval2 = maxoddkey1,maxoddval1
            maxoddkey1,maxoddval1 = key,val
        else:
            maxoddkey2,maxoddval2 = key,val
            
ans = 0
if maxevnkey1!=maxoddkey1:
    ans = n-maxevnval1-maxoddval1
else:
    temp = max(maxevnval1+maxoddval2,maxevnval2+maxoddval1)
    ans = n-temp
print(ans)
    





Measured memory_bytes: 59140
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
#define M_INF -1000000000
typedef long long int ll;

int main(){
    ll n,k,flag=0,ich,ans=1e18;
    cin>>n>>k;
    vector<ll> v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i];
        if(v[i]==0){//座標0にろうそくが存在するか
            flag=1;
            ich=i;//座標0のろうそくの添え字
        }
    }
    if(flag==1){//座標0にろうそくが存在するとき
        for(ll i=0;i+k-1<n;i++){
            ll left=i,right=i+k-1;
            if(right<ich || ich<left){//ichが含まれていない場合
                continue;
            }else if(right==ich){
                ans=min(ans,abs(v[left]));
            }else if(left<ich && ich<right){//座標0から左右どちらに先に向かうか
                ll a=abs(v[left])+abs(v[left]-v[right]);
                ll b=abs(v[right])+abs(v[left]-v[right]);
                ans=min(ans,min(a,b));
            }else if(left==ich){
                ans=min(ans,v[right]);
            }
        }
    }else if(flag==0){//座標0にろうそくが存在しないとき
        for(ll i=0;i+k-1<n;i++){
            ll left=i,right=i+k-1;
            if(v[left]<0 && v[right]<0){
                ans=min(ans,abs(v[left]));
            }else if(v[left]<0 && v[right]>0){
                ll a=abs(v[left])+abs(v[left]-v[right]);
                ll b=abs(v[right])+abs(v[left]-v[right]);
                ans=min(ans,min(a,b));
            }else if(v[left]>0){
                ans=min(ans,abs(v[right]));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
    

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

int main(void){
	int W,H;
	string l1 = "";
	string l2 = "";
	for(int i = 0; i < 300; i++){
		l1 += "#";
		l2 += ".";
	}
	cin >> H >> W;
	string line;
	while(H != 0 || W != 0){
		for(int i = 0; i < H; i++){
		if(i == 0 || i == H-1)line = l1.substr(0,W);
		else line = "#" + l2.substr(0,W-2) + "#";
			cout << line << "\n";
		}
		cout << "\n";
		cin >> H >> W;
	}
	return 0;

}


Measured memory_bytes: 3032
#include<iostream>
using namespace std;
using ull = unsigned long long;

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

int N;
ull sum = 0;
ull A[200001];

int main() {
  scanf("%d", &N);
  REP(i,N) scanf("%llu", &A[i]);

  ull count = 0;
  int j = 1;
  sum = A[0];
  REP(i,N) {
    while((j < N) && ((sum & A[j]) == 0)) sum ^= A[j++];
    count += j - i;
    sum ^= A[i];
  }

  printf("%llu\n", count);
  return 0;
}

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

vector<int> o, e;
vector<int> v[200010];
bool c[200010];
int ans[200010];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for (int i = 0; i < n-1; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        v[a].emplace_back(b);
        v[b].emplace_back(a);
    }
    auto dfs = [&](auto f, int curr, int prev) -> void {
        if (c[curr]) o.emplace_back(curr);
        else e.emplace_back(curr);
        for (auto &to: v[curr]) {
            if (to == prev) continue;
            c[to] = !c[curr];
            f(f, to, curr);
        }
    };
    c[0] = 1;
    dfs(dfs, 0, -1);
    vector<int> p[3];
    for (int i = 1; i <= n; i++) {
        p[i % 3].emplace_back(i);
    }
    if (o.size() > e.size()) swap(o, e);
    if (o.size() <= p[0].size()) {
        for (auto &x: o) {
            ans[x] = p[0].back();
            p[0].pop_back();
        }
        vector<int> rem;
        for (int i = 0; i < 3; i++) {
            for (auto &x: p[i]) {
                rem.emplace_back(x);
            }
        }
        assert(e.size() == rem.size());
        for (int i = 0; i < e.size(); i++) {
            ans[e[i]] = rem[i];
        }
    } else {
        assert(p[2].size() <= o.size());
        for (auto &x: o) {
            int i;
            if (p[2].empty()) i = 0;
            else i = 2;
            ans[x] = p[i].back();
            p[i].pop_back();
        }
        vector<int> rem;
        for (int i = 0; i < 3; i++) {
            for (auto &x: p[i]) {
                rem.emplace_back(x);
            }
        }
        assert(e.size() == rem.size());
        for (int i = 0; i < e.size(); i++) {
            ans[e[i]] = rem[i];
        }
    }
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 17480
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() { 
  vector<int> A(201),B;
  for(int i=1;i<=200;i++){
    A[i]=i*(i+1)*(i+2)/6;
    if(A[i]%2==1) B.push_back(A[i]);
  }
  
  int dp1[1000100],dp2[1000100];
  rep(i,1000100) dp1[i]=dp2[i]=1e9;
  dp1[0]=dp2[0]=0;
  for(int i=1;i<=1000000;i++){
    for(int j=1;j<=200;j++){
      if(i-A[j]>=0) dp1[i]=min(dp1[i],dp1[i-A[j]]+1);
    }
    rep(j,B.size()){
      if(i-B[j]>=0) dp2[i]=min(dp2[i],dp2[i-B[j]]+1);
    }
  }
  
  ll n;
  while(cin>>n){
    if(n==0) return 0;
    cout<<dp1[n]<<" "<<dp2[n]<<endl;
  } 
}


Measured memory_bytes: 10884
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(void){
  int n;
  int i;
  int sum=1;
  scanf("%d",&n);
  char a[n][11];
   for(i=0; i<n; i++){
       scanf("%s",&a[i]);
   }

  qsort(a,n,11,strcmp);

  for(i=1; i<n; i++){
      if(strcmp(a[i] , a[i-1])!=0){
        sum++;
      }
  }
  printf("%d",sum);
   return 0;
}


Measured memory_bytes: 5696
S = input()
N = len(S)

def f(i, a):
    if i == N-1:
        return sum(list(map(int, a.split('+'))))
    
    return f(i+1, a + S[i+1]) + f(i+1, a + '+' + S[i+1])

print(f(0, S[0]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        return;
    }
    ll ans = n / 10;
    ll c = 5 * 5 * 2;
    while (c <= n) {
        ans += n / c;
        c *= 5;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define INF (1LL<<59)
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
        return x;
    else
        return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
        if(m%2)
            r=(r*n)%p;
        n=(n*n)%p;
        m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
int c,d;
int f(int x)
{
	if(x==0)
		return 0;
	int lcm=(c*d)/gcd(c,d);
	int s=x/c+x/d-x/lcm;
	return x-s;
}
int32_t main()
{
   IOS;
   /*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif 
   /********************* Code starts here ***********************/   
   int n;
   cin>>n;
   vector<pair<int,int> > a(n);
   for(int i=0;i<n;i++)
   {
   	cin>>a[i].ss>>a[i].ff;
   }
   sort(all(a));
   bool ok = true;
   int t=0;
   for(int i=0;i<n;i++)
   {
   	t=t+a[i].ss;
   	if(t<=a[i].ff)
   		;
   	else
   		ok=false;
   	//cout<<t<<' '<<ok<<endl;
   }
   if(!ok)
   	cout<<"No"<<endl;
   else
   	cout<<"Yes"<<endl;
}	

Measured memory_bytes: 3328
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
    string s;cin>>s;
    cout<<s.substr(0,3);
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3656
import java.util.*;

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

        if (a * b % 2 == 0){
        	System.out.println("Even");
        }else {
        	System.out.println("Odd");
        }
    }
}

Measured memory_bytes: 20820
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N, K = map(int, input().split())
    H = list(map(int, input().split()))

    H.sort(reverse=1)
    for i in range(min(N, K)):
        H[i] = 0
    print(sum(H))


main()


Measured memory_bytes: 26024
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();

    int[][] red = new int[N][2];
    int[][] blue = new int[N][2];

    for (int i = 0; i < N; i++) for (int j = 0; j < 2; j++) red[i][j] = scanner.nextInt();
    for (int i = 0; i < N; i++) for (int j = 0; j < 2; j++) blue[i][j] = scanner.nextInt();

    Arrays.sort(red, Comparator.comparingInt(o -> o[1]));
    Arrays.sort(blue, Comparator.comparingInt(o -> o[0]));

    boolean[] paired = new boolean[N];
    int numPairs = 0;

    for (int i = 0; i < N; i++) {
      int[] b = blue[i];
      for (int j = N - 1; j >= 0; j--) {
        if (paired[j]) continue;
        int[] r = red[j];
        if (r[0] < b[0] && r[1] < b[1]) {
          numPairs++;
          paired[j] = true;
          break;
        }
      }
    }

    System.out.println(numPairs);
  }
}


Measured memory_bytes: 28884
#include <bits/stdc++.h>
#define lli long long int

using namespace std;
vector<pair<int,int > >adj[100010];
bool visit[100010];
int  dis[100010];
bool dfs(int v)
{
    visit[v]=1;
    bool ret=1;
    for(int i=0;i<adj[v].size();i++)
    {
        int u=adj[v][i].first;
        if(!visit[u])
        {
            dis[u]=dis[v]+adj[v][i].second;
            ret&=dfs(u);
            if(!ret)
                return 0;
        }
        else
            if(dis[u]!=dis[v]+adj[v][i].second)
            return 0;
    }
    return ret;
}

int main()
{

  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
      int t,a,b;
      cin>>t>>a>>b;
      if(a+b>t)
      {
          cout <<"No";
          return 0;
      }
      else if((t-a-b)%2)
      {
           cout <<"No";
          return 0;
      }

  }
  cout <<"Yes";

}



Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
using namespace std;
typedef long double LD;

int main() {
	int n;
	cin >> n;
	for (int x = 0;x < n;x++) {
		LD a, b, c, d, e, f, g, h;
		cin >> a >> b >> c >> d >> e >> f >> g >> h;

		LD i = (c - a)*(h - f);
		LD j = (d - b)*(g - e);

		if (i - j == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#include<stdio.h>
#include<string.h>

int main()
{
	char ch,s[300009],f[200009],r[200009];
	gets(s);
	int len=strlen(s);
	int front=0,rear=0,q,i,t,order,now=1;
	scanf("%d",&q);
	
	for (i=1;i<=q;i++)
	{
		scanf("%d",&t);
		if (t==1) now=1-now;
		else
		{
			scanf("%d",&order);
			if (order==1)
			{
				if (now==1)
				{
					++front;
					ch=getchar();
					f[front]=getchar();
				}
				else 
				{
					++rear;
					ch=getchar();
					r[rear]=getchar();
				}
			}
			else 
			{
				if (now==0)
				{
					++front;
					ch=getchar();
					f[front]=getchar();
				}
				else 
				{
					++rear;
					ch=getchar();
					r[rear]=getchar();
				}
			}
		}
	}
	
	if (now==1)
	{
		for (i=front;i>=1;i--)
			putchar(f[i]);
		for (i=0;i<len;i++)
			putchar(s[i]);
		for (i=1;i<=rear;i++)
			putchar(r[i]);
	}
	else
	{
		for (i=rear;i>=1;i--)
			putchar(r[i]);
		for (i=len-1;i>=0;i--)
			putchar(s[i]);
		for (i=1;i<=front;i++)
			putchar(f[i]);
	}
	
	return 0;
}


Measured memory_bytes: 768
from itertools import permutations
from math import sqrt,factorial
n=int(input())
ans=0
distance=[list(map(int,input().split())) for i in range(n)]
town=[]
for i in range(n):
    town.append(i)
for a in list(permutations(town)):
    for j in range(n-1):
        ans+=sqrt((distance[a[j+1]][1]-distance[a[j]][1])**2+(distance[a[j+1]][0]-distance[a[j]][0])**2)
print(ans/(factorial(n)))

Measured memory_bytes: 13992
#include <bits/stdc++.h>
using namespace std;
 
inline int gcd(int a,int b) {
    while(b^=a^=b^=a%=b);
    return a;
}
 
int main()
{
    int k;
    cin >> k;
    int sum = 0;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 1; j <= k; j++)
        {
            for (int z = 1; z <= k; z++)
            {
                sum += gcd(gcd(i, j), z);
            }
        }
    }
    cout << sum;
  	return 0;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N, T = inpl()
A = tuple(inpl())
m = A[0]
benefit = 0
pairs = 0
ans = 0

for i in range(1, N):
    a = A[i]
    d = a - m
    if d < 0:
        m = a
    elif d < benefit:
        continue
    elif d == benefit:
        pairs += 1
    elif d > benefit:
        ans = max(ans, pairs)
        benefit = d
        pairs = 1

ans = max(ans, pairs)
print(ans)

Measured memory_bytes: 15148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define iter(it,a) for(auto it=a.begin();it!=a.end();it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define preturn(X) cout<<X<<endl; return 0
//cout.setf(ios::fixed); cout.precision(18)
typedef long long ll;
typedef long double ld;

const ll MOD = 1e9+7;

vector<int> ans[1000];

void func(int i,int k,int x){
	if(k==1){
		return;
	}
	rep(j,0,k-1){
		ans[i].pb(x+j);
		ans[i+1+j].pb(x+j);
	}
	func(i+1,k-1,x+k-1);
}

int main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    ll n;
    cin>>n;
    ll k = 1;
    while(k*(k-1) < 2*n){
    	k++;
    }
    if(k*(k-1)==2*n){
    	cout<<"Yes"<<endl;
    	func(0,k,1);
    	cout<<k<<endl;
    	rep(i,0,k){
    		cout<<(k-1)<<" ";
    		iter(it,ans[i]){
    			cout<<(*it)<<" ";
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    preturn("No");
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void OUT(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void OUT(T t,Ts... ts){cout<<t<<" ";OUT(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type FILL(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type FILL(T&t,const V&v){for(auto &e:t)FILL(e,v);}
constexpr long long INF = 1e18;
 
signed main(){
	int X,A,B;
	cin>>X>>A>>B;
	int N;
	cin>>N;
	REP(i,N){
		string s;
		cin>>s;
		if(s[0]=='n'){
			X+=A;
		}else if(s[0]=='t'){
			X+=B;
		}else X=0;
		if(X<0)X=0;
	}
	OUT(X);
}



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

typedef long long                   ll;
typedef long double                 ld;
typedef pair<ll,ll>                 pll;
typedef pair<ld,ld>                 pld;


#define all(x)          (x).begin(),(x).end()
#define Sort(x)         sort(all(x))
#define sep             ' '
#define endl            '\n'
#define tab             '\t'
#define X               first
#define Y               second
#define SZ(x)           x.size()
#define kill(x)         return cout<<x<<endl,0;
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io         freopen("in.txt" , "r" , stdin) ; freopen("out.txt" , "w" , stdout);
#define set_random      mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7,
         MAXN= 2010,
         INF=1e18;
ll c[MAXN][MAXN],n,k;
int main()
{
    cin >> n >> k;
    for(ll i=0;i<MAXN;i++){
        c[i][0]=1;
        c[i][i]=1;
    }
    for(ll i=1;i<MAXN;i++){
        for(ll j=1;j<i;j++){
            c[i][j]=(c[i-1][j-1]+c[i-1][j])%MOD;
        }
    }
    for(ll i=1;i<=k;i++){
        cout<<c[k-1][i-1]*c[n-k+1][i]%MOD<<endl;
    }
    return 0;
}


Measured memory_bytes: 30336
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

        vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var ans = 0;
        for(int i = 0; i < vars.Count(); i++)
        {
            for(int j = i+1; j < vars.Count(); j++)
            {
                for(int k = j+1; k < vars.Count(); k++)
                {
                    var a = vars[i];
                    var b = vars[j];
                    var c = vars[k];
                    if(a != b && b !=c && c!= a)
                    {
                        if(a+b >c && b+c > a && c+a > b)
                        {
                            ans++;
                        }
                      
                    }
                }
            }
        }
        Console.WriteLine(ans);
    }

}


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

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    rep(i, 1, n+1){
        int sum = 0;
        string x = to_string(i);
        rep(j, 0, x.size()) sum += x[j] - '0';
        if(a <= sum && sum <= b) ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3760
if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))

    answer = 'Yes'
    for i in reversed(range(0, N-1)):
        if H[i] - H[i+1] <= 0:
            continue
        elif H[i] - H[i+1] == 1:
            H[i] = H[i] - 1
        else:
            answer = 'No'
            break
    print(answer)




Measured memory_bytes: 15020
n, a, b = map(int,input().split())
ad = a - b
H = [int(input()) for i in range(n)]

le = 0
ri = max(H) // b + 2
mid = (le + ri) // 2
while ri - le > 1:
    ad_n = 0
    for i in range(n):
        hh = max(0, H[i] - mid * b)
        #print(H[i])
        ad_n += -(-hh // ad)
    #print(ad_n, mid)
    if ad_n > mid:  # 倒せない
        le = mid
    else:
        ri = mid
    mid = (le + ri) // 2
print(le+1)


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

int main(){
  int i;
  int l;
  int n;

  scanf("%d",&n);

  for(i=1; i<=9; i++){
    if(100*(i-1)+10*(i-1)+(i-1)<n && n<=100*i+10*i+i){
      l=100*i+10*i+i;
    }
  }
  printf("%d\n",l);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    ll ans=0;
    for(int i=1;i<n;i++){
        if(i>n-i) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

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

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir[] = {"R", "D", "L", "U"};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int main() {
    double W, H, w, h, x, y;
    cin >> W >> H >> w >> h >> x >> y;
    double xh,xl,yh,yl;
    xh = min(W/2,x+w/2);
    xl = max(-W/2,x-w/2);
    yh = min(H/2,y+h/2);
    yl = max(-H/2,y-h/2);
    printf("%.8lf\n",(yh+yl)/(xh+xl));
    return 0;
}



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

int main() {
    int A, B, ans = 0;
    cin >> A >> B;

   for (int i = A; i < B + 1; i++) {
       int a, b, c, d, k = i;
       rep(j, 5){
           if (j == 0){
               a = k % 10;
           }
           else if (j == 1){
               b = k % 10;
           }
           else if (j == 3){
               c = k % 10;
           }
           else if (j == 4){
               d = k % 10;
           }
           k /= 10;
       }
       if (a == d && b == c){
           ans += 1;
       }
   }
    cout << ans << endl;
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"01B0"# => r#"00"#,
r#"BB"# => r#""#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        s: chars,
    }
    let mut ans:Vec<String> = Vec::new();

    for i in 0..s.len() {
        if s[i] == '0' {
            ans.push("0".to_string());
        } else if s[i] == '1' {
            ans.push("1".to_string());
        } else {
            ans.pop();
        }
    }

    ans.join("").to_string()
}

Measured memory_bytes: 4476
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair



int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int x, y;
	scanf("%d%d", &x, &y);
	if (x + y == 15)
		printf("+\n");
	else if (x * y == 15)
		printf("*\n");
	else
		printf("x\n");

	return 0;
}


Measured memory_bytes: 256
A, B = gets.split.map(&:to_i)
S = gets.chomp

begin
  s = S.split("-")

  if ((s[0].length == A) and (s[1].length == B)) then
    ans = "Yes"
  else
    ans = "No"
  end

rescue NoMethodError
  ans = "No"
end

puts ans


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL A, B;
    cin >> A >> B;
    
    if(A == B) {
        cout << A << endl;
    } else {
        if(A % 2 == 0 && B % 2 == 0) {
            LL t;
            if((B - A) % 4 == 0) t = 0;
            else t = 1;
            cout << (t ^ B) << endl;
        }
        if(A % 2 == 0 && B % 2 == 1) {
            if((B - A + 1) % 4 == 0) {
                cout << 0 << endl;
            } else {
                cout << 1 << endl;
            }
        }
        if(A % 2 == 1 && B % 2 == 1) {
            LL t;
            if((B - A) % 4 == 0) t = 0;
            else t = 1;
            cout << (t ^ A) << endl;
        }
        if(A % 2 == 1 && B % 2 == 0) {
            LL t;
            if((B - A - 1) % 4 == 0) t = 0;
            else t = 1;
            cout << (t ^ (A ^ B)) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3668
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	int a;
	while(scanf("%d",&a),a){
		int z=(long long)a*a*a;
		int ret=2000000000;
		for(int i=1;i<a;i++){
			int b=(int)(pow(z-(i*i*i),1.0/3)+0.000000001);
			ret=min(ret,z-i*i*i-b*b*b);
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 1088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.BufferUnderflowException;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  private void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int MAX_INPUT_SIZE = 2_000_000;
      PriorityQueue queue = new PriorityQueue(MAX_INPUT_SIZE);
      boolean isContinue = true;
      String[] order;
      StringBuilder buf = new StringBuilder(MAX_INPUT_SIZE*5);

      while(isContinue) {
        order = br.readLine().split(" ");

        switch( order[0] ) {
          case "insert" :
            queue.insert(Integer.parseInt(order[1]));
            break;
          case "extract" :
            buf.append( queue.extract() ).append("\n");
            break;
          case "end" :
            buf.setLength(buf.length()-1);
            isContinue = false;
            break;
          default :
        }
      }

      System.out.println(buf);

    } catch(IOException e) {
      System.out.println("IOException!");
    } catch(ArrayIndexOutOfBoundsException e) {
      System.out.println("heap index out of bounds!");
    } catch(BufferUnderflowException e) {
      System.out.println("heap underflow!");
    } catch(IllegalArgumentException e) {
      System.out.println("new key is smaler than current key!");
    }
  }
}

class PriorityQueue {

  int[] heap;
  int tail;

  public PriorityQueue(int size) {
    heap = new int[size+1];
    tail = 0;
  }

  public void insert(int key) {
    heap[++tail] = Integer.MIN_VALUE;
    heapIncreaseKey(tail, key);
  }
  public int extract() {
    return heapExtractMax();
  }

  private void heapIncreaseKey(int id, int key) {
    if( key < heap[id] ) throw new IllegalArgumentException();

    int t;
    heap[id] = key;
    while( (id > 1) && (heap[parent(id)] < heap[id]) ){
      t = heap[id]; heap[id] = heap[parent(id)]; heap[parent(id)] = t;
      id = parent(id);
    }
  }
  private int heapExtractMax() {
    if(tail < 1) throw new BufferUnderflowException();

    int max = heap[1];
    heap[1] = heap[tail--];
    maxHeapify(1);

    return max;
  }
  private void maxHeapify(int id) {
    int t,left,right,largest;
    left  = nodeLeft(id);
    right = nodeRight(id);

    if( (left <= tail) && (heap[left] > heap[id]) )
      largest = left;
    else
      largest = id;
    if( (right <= tail) && (heap[right] > heap[largest]) )
      largest = right;

    if( largest != id ) {
      t = heap[id]; heap[id] = heap[largest]; heap[largest] = t;

      maxHeapify(largest);
    }
  }
  private int parent(int id) {
    return id/2;
  }
  private int nodeLeft(int id) {
    return id*2;
  }
  private int nodeRight(int id) {
    return id*2+1;
  }
}


Measured memory_bytes: 187864
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

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

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    vll c(n + 1);
    for(ll i = 1; i <= n; ++i) {
        for(ll j = i; j <= n; j += i) ++c[j];
    }
    ll ans = 0;
    for(ll i = 1; i < n; ++i) {
        ans += c[n - i];
    }
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 11100
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, m, l;
	cin >> n >> m >> l;
	vector<vector<int>> dis(n, vector<int>(n, INF));
	rep(i, n) dis[i][i] = 0;
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		chmin(dis[a][b], c);
		chmin(dis[b][a], c);
	}
	rep(k, n) rep(i, n) rep(j, n) chmin(dis[i][j], dis[i][k] + dis[k][j]);
	vector<vector<int>> ans(n, vector<int>(n, inf));
	rep(i, n) rep(j, n) if (dis[i][j] <= l) ans[i][j] = 1;
  	rep(i, n) ans[i][i] = 0;
	rep(k, n) rep(i, n) rep(j, n) chmin(ans[i][j], ans[i][k] + ans[k][j]);
	int q;
	cin >> q;
	rep(_, q) {
		int s, t;
		cin >> s >> t;
		s--; t--;
		cout << (ans[s][t] == inf ? -1 : ans[s][t] - 1) << '\n';
	}
}

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
   int n;
   ll k;
   cin>>n>>k;
   vector<ll> a(n);
   rep(i, n) cin>>a[i];

   ll l=1, r=1000000000, m;
   while(l<r){
      m=(r-l)/2+l;
      ll tk=0;
      rep(i, n){
         tk+=(a[i]-1)/m;
      }
      if(tk<=k) r=m;
      else l=m+1;
   }
   cout<<l<<endl;
   return 0;
}


Measured memory_bytes: 4808
#include <bits/stdc++.h>
using i64 = long long;

using B = std::bitset<61>;

int main() {
    int n;
    std::cin >> n;
    std::vector<i64> a(n);
    i64 x = 0;
    for (auto &e : a) {
        std::cin >> e;
        x ^= e;
    }

    for (auto &e : a) e &= ~x;

    std::sort(a.begin(), a.end(), std::greater<>());

    // for (auto e : a) std::cout << e << std::endl;

    int index = 0;
    for (int i = 60; i >= 0; i--) {
        int mi = index;
        i64 me = -1;
        for (int j = index; j < n; j++) {
            if ((a[j] & (1ll << i)) && a[j] > me) {
                me = a[j];
                mi = j;
            }
        }

        if (me == -1) continue;

        std::swap(a[index], a[mi]);

        mi = index;

        for (int j = 0; j < n; j++) {
            if (j != mi && (a[j] & (1ll << i))) a[j] ^= a[mi];
        }

        index++;
    }

    i64 m = 0;
    for (int i = 0; i < n; i++) m ^= a[i];

    std::cout << x + m * 2 << std::endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'


int main() {
	#ifdef shiven
	freopen("test.in", "r", stdin);
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int x; cin >> x;
	cout << 1-x << endl;

	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>

const int z = 1e9+7;

int fp(int a, int x) {
  if ( x == 0 ) return 1;

  if ( x % 2 == 1 ) return 1ll * a * fp(a, x - 1) % z;

  int t = fp(a, x / 2);
  return 1ll * t * t % z;
}

int rev(int a) {
  return fp(a, z - 2);
}

int count(int n, int m) {
  int ret = 1;
  for (int i = 1; i <= m; ++i) {
    ret = 1ll * ret * (n - i + 1) % z;
    ret = 1ll * ret * rev(i) % z;
  }

  return ret;
}

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<int> table;
  for (int i = 2; i * i <= M; ++i) {
    if ( M % i == 0 ) {
      table.push_back(0);
      while ( M % i == 0 ) {
        int n = table.size();
        table[n - 1]++;
        M /= i;
      }
    }
  }
  if ( M != 1 ) table.push_back(1);

  int ans = 1;
  for (int i : table) {
    ans = 1ll * ans * count(N + i - 1, i) % z;
  }
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, itertools
from fractions import gcd
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0



a, b, c = map(int, input().split())
for i in itertools.permutations([a, b, c], 3):
    if i[0] == sum(i[1:]) or sum(i[:2]) == i[2]:
        print("Yes")
        exit()

print("No")


Measured memory_bytes: 63852
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int N;
	cin >> N;
	if (N <= 999)puts("ABC");
	else puts("ABD");

	return(0);
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int main(){
    int a,b;
    cin >> a >> b;

    cout << 6-a-b << endl;

    return 0;
}

Measured memory_bytes: 3580