akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {

        //スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);

        int[] a = new int[n];
        int[] b = new int[n-1];

        string[] b_str = Console.ReadLine().Split(' ');

        for (int i = 0; i < n-1; i++)
        {
            b[i] = int.Parse(b_str[i]);
        }

        for (int i = 0; i < n; i++)
        {
            if (i == 0)
            {
                a[i] = b[i];
            }
            else if (i == n-1)
            {
                a[i] = b[i-1];
            }
            else
            {
                a[i] = Math.Min(b[i], b[i - 1]);
            }
        }

        Console.WriteLine(a.Sum());
        return;
    }

}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
 
int main (){
	int  a,b;
  	scanf("%d%d",&a,&b);
  	int tmp=max(ceil(a*12.5),ceil(b*10));
	  
	if(floor(tmp*0.08)==a&&floor(tmp*0.1)==b) 
		printf("%d\n",tmp);
	else 
		printf("-1\n");

	return 0; 
}

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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int N;
    cin >> N;
    vector<int> cakes(N);
    REP(i, N) cin >> cakes[i];

    sort(cakes.rbegin(), cakes.rend());

    UNIQUE(cakes);

    cout << cakes.size() << "\n";

    return 0;
}

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

using namespace std;
using ll = long long;

#define MOD 1000000007
template<int mod>
struct ModInt{
   int x;
   ModInt():x(0){}
   ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
   ModInt &operator+=(const ModInt &p){
       if((x+=p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator-=(const ModInt &p){
       if((x+=mod-p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator*=(const ModInt &p){
       x=(int)(1LL*x*p.x%mod);
       return *this;
   }
   ModInt &operator/=(const ModInt &p){
       *this*=p.inverse();
       return *this;
   }
   ModInt &operator^=(long long p){
       ModInt res = 1;
       for (; p; p >>= 1) {
           if (p & 1) res *= *this;
           *this *= *this;
       }
       return *this = res;
   }
   ModInt operator-()const{return ModInt(-x);}
   ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
   ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
   ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
   ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
   ModInt operator^(long long p)const{return ModInt(*this)^=p;}
   bool operator==(const ModInt &p)const{return x==p.x;}
   bool operator!=(const ModInt &p)const{return x!=p.x;}
   explicit operator int() const { return x; }
   ModInt operator=(const int p) {x = p; return ModInt(*this);}
   ModInt inverse()const{
       int a=x,b=mod,u=1,v=0,t;
       while(b>0){
           t=a/b;
           a-=t*b;
           std::swap(a,b);
           u-=t*v;
           std::swap(u,v);
       }
       return ModInt(u);
   }
   friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
       return os<<p.x;
   }
   friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
       long long x;
       is>>x;
       a=ModInt<mod>(x);
       return (is);
   }
};
typedef ModInt<MOD> mint;
 
struct MComb {
   std::vector<mint> fact;
   std::vector<mint> inversed;
   MComb(int n) { // O(n+log(mod))
       fact = std::vector<mint>(n+1,1);
       for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
       inversed = std::vector<mint>(n+1);
       inversed[n] = fact[n] ^ (MOD-2);
       for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
   }
   mint ncr(int n, int r) {
        if (n < r) return 0;
        if (n < 0 || r < 0) return 0;
       return (fact[n] * inversed[r] * inversed[n-r]);
   }
   mint npr(int n, int r) {
        if (n < r) return 0;
        if (n < 0 || r < 0) return 0;
       return (fact[n] * inversed[n-r]);
   }
   mint nhr(int n, int r) {
       assert(n+r-1 < (int)fact.size());
       return ncr(n+r-1, r);
   }
   mint fac(int n) {
       if(n < 0)return 0;
       return fact[n];
   }
};
MComb comb(5000000);

mint F(int x, int y) {
    mint res = 0;
    for(int i = 0; i <= y; i++) {
        res += comb.ncr(x + i + 1, x);
    }
    return res;
}


int main()
{
    int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
    c1--, r1--;

    cout << F(r2, c2) - F(r2, c1) - F(r1, c2) + F(r1, c1) << endl;

}


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

int main() {
  int A, B;
  char op;
  cin >> A >> op >> B;
  
  int sum = 0;
  
  if (op =='+') {
    sum = A + B;
  }
  else {
    sum = A-B;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
n = gets.to_s.to_i
s = gets.to_s.chomp.chars

ans = s.count('R') * s.count('G') * s.count('B')
n.times do |i|
  t = 1
  while i + 2 * t < n
    j = i + t
    k = j + t
    ans -= 1 if s[i] != s[i+t] && s[i] != s[i+2*t] && s[i+t] != s[i+2*t]
    t += 1
  end
end

puts ans

Measured memory_bytes: 14436
from collections import Counter

def factor(n):
    Ret = []
    for i in range(2, n + 1):
        while n % i == 0:
            n = n // i
            Ret.append(i)
    if len(Ret) == 0:
        return [n, ]
    else:
        return Ret

n = int(input())
fact = []

for i in range(2, n + 1):
    fact += factor(i)

ans = 1
for k, v in Counter(fact).items():
    ans *= v + 1
    ans %= 10**9 + 7
print(ans)

Measured memory_bytes: 9472
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int MOD = 1000000007;
typedef long long LL;

vector<long long> fact, fact_inv, inv;

void init_nCk(int SIZE) {
  fact.resize(SIZE + 5);
  fact_inv.resize(SIZE + 5);
  inv.resize(SIZE + 5);
  fact[0] = fact[1] = 1;
  fact_inv[0] = fact_inv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < SIZE + 5; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
  }
}

long long nCk(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

int main() {
  int N, K; std::cin >> N >> K;
  init_nCk(1e5);
  for (int k = 1; k <= K; ++k) {
    std::cout << nCk(N - K + 1, k) * nCk(K - 1,  k - 1) % MOD << std::endl;
  }
}


Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int l, r, c; char o;
	int rec = 0, par = 0;
	
	while (cin>>l>>o>>r>>o>>c) {
		if (l*l+r*r==c*c) rec++;
		else if (l==r) par++;
	}
	
	cout << rec << endl << par << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    rep(i,0,N){
        A[i] = i * 20000 + 1;
        B[N - i - 1] = i * 20000 + 1;
    }
    rep(i,0,N){
        int p;
        cin >> p;
        A[p-1] += i;
    }
    rep(i,0,N){
        cout << A[i] << " \n"[i == N-1];
    }
    rep(i,0,N){
        cout << B[i] << " \n"[i == N-1];
    }
}

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

int main() {
  int N , A;
  cin >> N >> A;
  
  if (A >= 500){
    cout << "Yes" << endl;
  }
  
  else if(N % 500 <= A){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
}


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


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

void solve()
{
	ll w,a,b;
	cin>>w>>a>>b;
	cout<<max((ll)0,max(a,b)-min(a,b)-w);
	
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
from math import factorial

def unique(w):
    d = {}
    for c in w:
        if c in d.keys():
            d[c] += 1
        else:
            d.setdefault(c, 1)
    return list(d.values())

n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()
# s = sorted([''.join(sorted(list(t))) for t in s])
s = [''.join(sorted(list(t))) for t in s]
values = unique(s)
count = 0
for i in values:
    if i > 1:
        count += factorial(i) // factorial(2) // factorial(i - 2)
print(count)


Measured memory_bytes: 20048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;
long long modinv(long long a, long long m=MOD) {long long b = m, u = 1, v = 0;while (b) {    long long t = a / b;    a -= t * b; swap(a, b);    u -= t * v; swap(u, v);}u %= m; if (u < 0) u += m;return u;}
//MODの割り算の際にa/＝b;をa *= modinv(b,MOD);とする。
int gcd(int a, int b){if (a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}
 
int main(){
    int N;cin>> N;
    int X;cin >> X;
    int x[100001];
    rep(i,N){
        cin>>x[i];
    }
    x[N] = X;
    sort(x,x+N+1);
    int mi = x[1] - x[0];
    Rep(i,N-1){
        mi = gcd(mi, x[i+1]- x[i]);
    }

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

Measured memory_bytes: 3836
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll x;cin>>x;
  cout<<(2199-x)/200<<endl;
  return 0;
}

Measured memory_bytes: 3652
N = gets.to_i

ans = Array.new(N, 0)
1.step(100) do |x|
  x.step(100) do |y|
    y.step(100) do |z|
      n = x**2 + y**2 + z**2 + x*y + y*z + z*x
      break if N < n
      ans[n - 1] += 
        case
        when x == y && x == z then 1
        when x != y && y != z then 6
        else ;                   ; 3
        end
    end
  end
end

puts ans

Measured memory_bytes: 14156
import collections


class Formatter:
    def __init__(self, s):
        self._d = collections.deque(s)
        self._reversed = False

    def reverse(self):
        self._reversed = not self._reversed

    def append(self, s):
        if self._reversed:
            self._d.appendleft(s)
        else:
            self._d.append(s)

    def appendleft(self, s):
        if self._reversed:
            self._d.append(s)
        else:
            self._d.appendleft(s)

    def __iter__(self):
        if self._reversed:
            return reversed(self._d)
        else:
            return iter(self._d)


S = input()
Q = int(input())

d = Formatter(S)

for _ in range(Q):
    Qi = input()
    if Qi == "1":
        d.reverse()
    else:
        T, F, C = Qi.split()
        if F == "1":
            d.appendleft(C)
        else:
            d.append(C)

print("".join(d))


Measured memory_bytes: 8684
#include <stdio.h>

int main (void){
  int a, b, i;
  
  scanf("%d%d", &a, &b);
  if (a <= b)
  {
    for(i = 0; i < b; i++){
      printf("%d",a);
    }
  }
  else
  {
    for(i = 0; i < a; i++){
      printf("%d",b);
    }
  }
  
  return(0);
}

Measured memory_bytes: 128
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,p = LI()
    print((a*3+p)//2)
    return

#B
def B():
    n = I()
    s = [None for i in range(n)]
    for i in range(n):
        l = input().split()
        s[i] = l+[i]
    s.sort(key = lambda x:(x[0],-int(x[1])))
    for i,a,b in s:
        print(b+1)
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()


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

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD!string;
	long sn;
	foreach (c; N)
	{
		sn += [c].to!long;
	}

	writeln(N.to!long % sn == 0 ? "Yes" : "No");
	stdout.flush();
	debug readln();
}


Measured memory_bytes: 256
a, b, m = map(int, input().split())

al = list(map(int, input().split()))
bl = list(map(int, input().split()))
xl = list(list(map(int, input().split())) for _ in range(m))

cost = min(al) +min(bl)
for i in range(m):
    ai = xl[i][0]
    bi = xl[i][1]
    ci = xl[i][2]
    if cost > (al[ai-1] + bl[bi-1] - ci):
        cost = (al[ai-1] + bl[bi-1] - ci)

print(cost)

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */


int main(){
    map<int, int> m;
    ii(n);
    rep(i, n){
        ii(a); m[a]++;
        if(m[a] > 1){
            out("NO"); return 0;
        }
    }
    out("YES");
}

Measured memory_bytes: 9600
S = int(input())
a = S
list1=[a]
b = 1
while True:
  if a%2 ==0:
    a = a/2
    b +=1
    if a in list1:
      break
    list1.append(a)
  else:
    a = 3*a+1
    b+=1
    if a in list1:
      break
    list1.append(a)
print(b)

Measured memory_bytes: 9232
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod =1'000'000'007;

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

    vi h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.rbegin(), h.rend());

    ll ans = 0;
    REP(i,k,n) ans += h.at(i);
    cout << ans << endl;
    return 0;
}


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

using ll = long long;

int main() {
    string s, t;
    cin >> s >> t;
    vector<int> a[26];
    rep(i, s.size()) a[s[i] - 'a'].push_back(i);
    rep(i, 26) {
        if (a[i].size() == 0) continue;
        //cout << i;
        //rep(j, a[i].size()) cout << " " << a[i][j];
        //cout << endl;
    }
    ll ans = 0;
    int j = 0;
    rep(i, t.size()) {
        int c = t[i] - 'a';
        //cout << c << endl;
        if (a[c].size() == 0) {
            ans = -1;
            break;
        }
        int k = lower_bound(a[c].begin(), a[c].end(), j) - a[c].begin();
        //cout << i << " " << j << " " << k << endl;
        if (k == a[c].size()) {
            ans += s.size();
            j = a[c][0] + 1;
        } else {
            j = a[c][k] + 1;
        }
        if (j == s.size()) {
            ans += s.size();
            j = 0;
        }
    }
    if (ans > -1) ans += j;
    cout << ans << endl;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
int main(){
    FAST
    string s;
    double x;
    int n;
    cin>>n;
    double ans=0;
    for(int i=1;i<=n;i++){
        cin>>x>>s;
        if(s=="JPY")
         ans+=x;
        else{
            ans+=(x*(380000.0));
        }
    }
    cout<<fixed<<setprecision(10)<<ans;

}

Measured memory_bytes: 256
import sys
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
	nt,nx,ny = map(int,input().split())
	k = abs(nx-x) + abs(ny-y)
	can = nt - t
	if k>can:
		print("No")
		sys.exit()
	elif k%2!=can%2:
		print("No")
		sys.exit()
	else:
		x = nx
		y = ny
		t = nt
print("Yes")


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
int main() {
  int N;
  cin >> N;
  N = N % 10;
  if (N == 3) cout << "bon" << endl;
  else if (N == 0|| N == 1|| N == 6 || N == 8) cout << "pon" << endl;
  else if (N == 2|| N == 4|| N == 5|| N == 7|| N == 9) cout << "hon" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>

using namespace std;

int main() {
    string sa, sb, sc;
    cin >> sa >> sb >> sc;

    auto sai = sa.begin();
    auto sbi = sb.begin();
    auto sci = sc.begin();

    char winner = '\0';

    for (auto c = sa.begin(); !winner;) {
        if (*c == 'a') {
            if (sai == sa.end()) winner = 'A';
            else c = sai++;

        } else if (*c == 'b') {
            if (sbi == sb.end()) winner = 'B';
            else c = sbi++;
            
        } else {
            if (sci == sc.end()) winner = 'C';
            else c = sci++;
        }
    }

    cout << winner << endl;

    return 0;
}

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

public class Main{
	public static InputReader scn = new InputReader();
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws Exception {
		//System.out.println("GO");
		
		int n = scn.nextInt();
		if(n <= 999) {
			System.out.println("ABC");
		} else {
			System.out.println("ABD");
		}
	}

	public static class InputReader {
		InputStream is;

		public InputReader() {
			is = System.in;
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}
	}
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int n, k;
  cin >> n >> k;
  if( k == 1) cout << 0 << endl;
  else cout << max(0, n-k) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];

    sort( all(v) );

    if( v[0] == v[2] ){
        cout << "No" << endl;
    }
    else if( v[0] == v[1] || v[1] == v[2] ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;        
    }

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring> 
#include <algorithm>
#include <stack> 
#define ll long long
int n;
int num[105]={},ans=0;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>num[i];
		if(num[i]%2!=0&&i%2!=0)
		{
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int N;
vec<int> x, y;
    double ans = 0;
    ll cnt     = 0;

double distance(double x1, double x2, double y1, double y2) {
    double dx = x2 - x1;
    double dy = y2 - y1;
    return sqrt(dx * dx + dy * dy);
}

void dfs(string s) {
    if (s.size() == N) {
        cnt++;
        rep(i, N - 1) {
            ans += distance(x[s[i] - '0'], x[s[i + 1] - '0'], y[s[i] - '0'],
                            y[s[i + 1] - '0']);
        }
        return;
    }

    rep(i, N) {
        bool flag = true;
        for (auto e : s)
            if (e == (i + '0')) flag = false;
        if (!flag) continue;
        s += to_string(i);
        dfs(s);
        s.pop_back();
    }
};



int main() {
    cin >> N;
    x.resize(N);
    y.resize(N);

    rep(i, N) {
        cin >> x[i] >> y[i];
        --x[i], --y[i];
    }

    dfs("");
    cout << fixed << setprecision(15);
    cout << ans / cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 0;

        for(int i = 0;i < s.length/2;i++){
            if(s[i] != s[s.length-i-1])
                ans++;
        }

        System.out.println(ans);
    }
}

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

int main(void)
{
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	int turnA=0,turnB=0;
	turnA=C/B;if(C%B!=0)turnA++;
	turnB=A/D;if(A%D!=0)turnB++;
	
	//cout<<"turnA"<<turnA;
	//cout<<"turnB"<<turnB;
	if(turnA<=turnB)cout<<"Yes";
	else cout<<"No";
	
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

LL solve(int w, int h, int k)
{
    LL ret = 0;
    for (int a = 1; a <= w - 1 && a * h <= 2 * k + 2 * h - 2; a++)
        rep1(x, h - 1)
        {
            int ub = 2 * k + __gcd(a, h - x) - 2 - a * x;
            ret += min(ub / (h - x), w - 1) >= a ? (min(w - 1, ub / (h - x)) - a) * 2 + 1 : 0;
            for (int b = max(a, min(ub / (h - x), w - 1) + 1); b <= w - 1 && b * (h - x) <= ub + h + x; b++)
                if (b * (h - x) - __gcd(h, b - a) - __gcd(b, x) <= ub)
                    ret += b == a ? 1 : 2;
        }
    return ret;
}

int main()
{
    int w, h, k;
    scanf("%d%d%d", &w, &h, &k);
    printf("%lld\n", 2 * solve(w, h, k) + 2 * solve(h, w, k));
    return 0;
}


Measured memory_bytes: 3804
<?php
$nl=(int)trim(fgets(STDIN));

$node=array($nl);

for($i=0;$i<$nl;$i++){$node[$i]=array('ch'=>array(),'pa'=>-1);}

for($i=0;$i<$nl;$i++){
	$ls=explode(' ',trim(fgets(STDIN)));#lines

	$id=(int)array_shift($ls);
	$cl=(int)array_shift($ls);#child length

	$node[$id]['ch']=$ls;#child

	for($j=0;$j<$cl;$j++){#child's parent is id
		$node[$ls[$j]]['pa']=$id;
	}
}

for($i=0;$i<$nl;$i++){
	$ni=$node[$i];#id=i
	$ch=implode(', ',$ni['ch']);
	$ty='root';#type
	$de=0;#depth

	if($ni['pa']!=-1){
		$de=1;
		$nt=$ni['pa'];
		while($node[$nt]['pa']!=-1){
			++$de;
			$nt=$node[$nt]['pa'];
		}
		$ty=(count($ni['ch']))? 'internal node':'leaf';
	}

	printf("node %d: parent = %d, depth = %d, %s, [%s]\n"
		,$i
		,$ni['pa']
		,$de
		,$ty
		,$ch
	);
}

Measured memory_bytes: 109748
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;

// vector<vector<int>> mat(N, vector<int>(M, 0));


int main(int argc, const char *argv[])
{
  int N;
  cin>>N;
  vector<vector<int> > mat(3,vector<int>(N,0));


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

    for (int j = 0; j < N; j++)
    {
      cin>>mat[1][j];
    }

    for (int j = 0; j < N - 1; j++)
    {
      cin>>mat[2][j];
    }

    int sum = 0;
    int before_suf = 100000;

    for (int i = 0; i < N; i++)
    {
      sum += mat[1][i];

      if(before_suf + 1 == mat[0][i])
      {
        sum += mat[2][before_suf - 1];
      }

      before_suf = mat[0][i];
    }
    

  cout<<sum;

  
  return 0;
}


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

typedef long long ll;
ll MOD = 1e9+7;

int a[20][20];
int b[20];
int main()
{
	int n,m,c;
	int ans=0;
	cin>>n>>m>>c;
	for(int i=0;i<m;i++)
		cin>>b[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
			cin>>a[i][j];
	}

	for(int i=0;i<n;i++)
	{
		int s=0;
		for(int j=0;j<m;j++)
		{
			s+=a[i][j]*b[j];
		}
		s+=c;
		if(s>0)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

C = [A[i] - B[i] for i in range(n)]
C.sort()

if sum(C)<0:
  print(-1)
  exit()
  
ans = 0

from collections import deque
C = deque(C)
c = 0
while C:
  nc = C.popleft()
  if nc >=0:
    break
  c+= nc
  ans += 1
  while c<0:
    c+=C.pop()
    ans += 1
print(ans)



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

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

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

int main()
{
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string result;
    rep(i, 2 * n)
    {
        if(i % 2 == 0)
        {
            result += s[i / 2];
        }else{
            result += t[i / 2];
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(M)]

tmp=[0]*N

for li in S:
    A=li[0]-1
    B=li[1]-1

    if H[A]>=H[B]:
        tmp[B]=1
    if H[A]<=H[B]:
        tmp[A]=1

c=tmp.count(0)
print(c)

Measured memory_bytes: 32016
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
const int64_t INF=9999999999999999;
int main() {
 int N,X;
 cin>>N>>X;
 vector<int>L(N);
 for(int i=0;i<N;i++){
    cin>>L[i];
 }
 vector<int>D(N+1);
 int count=0;
 for(int i=0;i<N+1;i++){
    if(i>=1){D[i]=D[i-1]+L[i-1];}
    if(D[i]<=X){count++;}
 }
 cout<<count<<endl;
 return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, q; cin >> n >> k >> q;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  vector<ll> Acopy(n);
  copy(all(A), begin(Acopy));
  sort(all(Acopy));
  ll mn = longinf;
  rep(i, n) {
    ll tmp = Acopy[i];
    priority_queue<ll, vector<ll>, greater<ll>> que;
    vector<ll> v;
    rep(j, n) {
      if(A[j] < tmp) {
        while((int)que.size() >= k) {
          v.push_back(que.top()); que.pop();
        }
        while(!que.empty()) que.pop();
      } else {
        que.push(A[j]);
      }
    }
    while((int)que.size() >= k) {
      v.push_back(que.top()); que.pop();
    }
    sort(all(v));
    if((int)v.size() < q) continue;
    mn = min(v[q-1]-v[0], mn);
  }
  cout << mn << "\n";
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>

using namespace std;

typedef long long ll;

int X;
int main() {
  scanf("%d", &X);
  int res = 1;
  for (int b = 2; b * b <= X; b++) {
    int t = b;
    while (t * b <= X) {
      t *= b;
    }
    res = max(res, t);
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 256
n, a, b = map(int,input().split())
lis = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    if (lis[i + 1] -lis[i]) * a <= b:
        ans += (lis[i + 1] -lis[i]) * a
    else:
        ans += b
print(ans)

Measured memory_bytes: 14228
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long cnt = 0;
        cnt = (B/C) - (A/C);
        if(A%C == 0) cnt++;
        System.out.println(cnt);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int N=5010;
ll n,f[N],dp[N][N],siz[N],t[N];
vector<int>e[N];
void dfs(int x,int fa){
    siz[x]=1;
    dp[x][1]=1;
    for(int i=0;i<e[x].size();i++){
    	int v=e[x][i];
        if(v==fa) continue;
        dfs(v,x);
        for(int i=0;i<=siz[x];i++){
        	t[i]=dp[x][i];
        	dp[x][i]=0;
		}
        for(int j=siz[x];j>=0;j--){
        	for(int k=siz[v];k>=0;k--){
            	(dp[x][j+k]+=t[j]*dp[v][k]%mod)%=mod;
			}
		}    
        siz[x]+=siz[v];
    }
    for(int i=0;i<=siz[x];i+=2){
    	(dp[x][0]+=mod-dp[x][i]*f[i]%mod)%=mod;
	}
}
int main(){
    scanf("%lld",&n);
    for(int i=1,u,v;i<n;i++){
        scanf("%d%d",&u,&v);
        e[u].push_back(v);
        e[v].push_back(u);
    }   
    f[0]=1;
    for(int i=2;i<=n;i+=2){
    	f[i]=f[i-2]*(i-1)%mod;
	}
    dfs(1,0);
    cout<<mod-dp[1][0];
}

Measured memory_bytes: 92900
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;

const int MOD =  1000000007; //   1000000009 , 1000000023 ,1000000007 , 998244353
const ll INF = ll(1e18);
const ld PI = 4*atan((ld)1);

using namespace __gnu_pbds;
template<typename T, class cmp = std::less<T>>
using Tree = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;


int main() {
  
#ifdef AVI  
  freopen("input.txt" , "r" , stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  
  ll tt = 1 , cc = 1;
  //cin >> tt;
  while(tt--){
    ll n;
    cin >> n;
    vector<ll>ar(n);
    ll x = 0;
    for(auto &y:ar)cin >> y , x ^= y;
    for(auto &y:ar){
      cout << (y^x) << ' ';
    }
  }
  

}

Measured memory_bytes: 4788
fun main(args:Array<String>){
    val a=readLine()!!.split(" ").map{it.toInt()}
    if (a[0]==a[1] && a[1]==a[2]){
        println("No")
    }else if (a[0]!=a[1] && a[1]!=a[2] && a[2]!=a[0]){
        println("No")
    } else {
        println("Yes")
    }
}

Measured memory_bytes: 37944
def ask?(i)
  puts i
  $stdout.flush
  gets[0].to_sym
end

N = gets.to_i
A = Array.new(N + 1)

A[0] = A[N] = ask?(0)
exit if A[0] == :V

l = 0
r = N

20.times do
  mid = (l + r) / 2
  A[mid] = ask?(mid)
  exit if A[mid] == :V

  if (l - mid).even? ^ (A[l] != A[mid])
    l = mid
  else
    r = mid
  end
end


Measured memory_bytes: 15156
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
#define endl "\n"
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 

 
ll mul_inv(ll a, ll b) {
    ll b0 = b, t, q;
    ll x0 = 0ll, x1 = 1ll;
    if (b == 1ll) return 1ll;
    while (a > 1ll) {
        q = a / b;
        t = b, b = a % b, a = t;
        t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0ll) x1 += b0;
    return x1;
}
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
#define arr2 array<ll,2>
#define arr3 array<ll,3>
#define varr2 vector<array<ll,2> >
#define varr3 vector<array<ll,3> >
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }


const ll maxn=2e5+2;





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

ll n;cin>>n;
ll ans=0;
for(int i=1;i<=n;i++){
    ll x=n/i;
    if(n%i==0)x--;
    ans+=x;
}
p1(ans);


return 0;
}





  







Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

typedef struct
{
  int front;
  int rear;
  int data[MAX][2];
} queue;

queue que;

void initQueue(queue *p)
{
  p->front = p->rear = 0;
}

bool emptyQueue(queue *p)
{
  return p->front == p->rear;
}

bool fullQueue(queue *p)
{
  return (p->front - 1 == p->rear) || (p->front == 0 && p->rear == MAX - 1);
}

void queuePop(queue *p)
{
  if (emptyQueue(p))
  {
    printf("UnderFlow\n");
    exit(1);
  }
  else
  {
    p->front++;
    if (p->front == MAX)
      p->front = 0;
  }
}

void queuePush(queue *p, int node, int parent)
{
  if (fullQueue(p))
  {
    printf("OverFlow\n");
    exit(1);
  }
  else
  {
    p->data[p->rear][0] = node;
    p->data[p->rear][1] = parent;
    p->rear++;
    if (p->rear == MAX)
      p->rear = 0;
  }
}

typedef struct list {
  int node;
  struct list *next;
} list;

list *graph[MAX];

void initGraph(void) {
  for (int i = 0; i < MAX; i++)
    graph[i] = NULL;
}

void addEdge(int node1, int node2)
{
  list *new1 = (list *)malloc(sizeof(list *));
  new1->node = node2;
  new1->next = graph[node1];
  graph[node1] = new1;

  list *new2 = (list *)malloc(sizeof(list *));
  new2->node = node1;
  new2->next = graph[node2];
  graph[node2] = new2;
}

int main(void) {
  int N, u, v, a, b;
  scanf("%d %d %d", &N, &u, &v);
  initGraph();
  rep(i, 0, N) {
    scanf("%d %d", &a, &b);
    addEdge(a, b);
  }

  int aoki[MAX]; // 青木くんのその頂点までの最短移動距離
  queue ki;
  initQueue(&ki);
  queuePush(&ki, v, 0);
  aoki[v] = 0;
  while ( !emptyQueue(&ki) ) {
    int n = ki.data[ki.front][0]; // 今
    int p = ki.data[ki.front][1]; // 親
    queuePop(&ki);
    int count = 0;
    for (list *c = graph[n]; c != NULL; c = c->next) {
      if (c->node == p) continue;
      aoki[c->node] = aoki[n] + 1;
      queuePush(&ki, c->node, n);
      count++;
    }
    if (count == 0) aoki[n] = 0;
  }

  int taka[MAX]; // 高橋くんのその頂点までの最短移動距離
  initQueue(&ki);
  queuePush(&ki, u, 0);
  taka[u] = 0;
  while ( !emptyQueue(&ki) ) {
    int n = ki.data[ki.front][0]; // 今
    int p = ki.data[ki.front][1]; // 親
    queuePop(&ki);
    for (list *c = graph[n]; c != NULL; c = c->next) {
      if (c->node == p) continue;
      taka[c->node] = taka[n] + 1;
      queuePush(&ki, c->node, n);
    }
  }

  int ans = 0;
  rep(node, 1, N + 1) {
    // 同じ回数で到達
    if (taka[node] > aoki[node]) continue;
    ans = max(ans, aoki[node]);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mod 100000
typedef pair<int, int> P;
int n, m, ans;
string s, t;
int dp[2][2010][2010];
int main()
{
	cin >> n >> m >> s >> t;
	memset(dp[1], -1, sizeof(dp[1]));
	if(s[0] == 'I')
		dp[1][1][0] = 1;
	if(t[0] == 'I')
		dp[1][0][1] = 1;
	for(int i = 0; i <= n; ++i)
	{
		for(int j = 0; j <= m; ++j)
		{
			bool get;
			if(i != n)
			{
				get = (s[i] == 'I');
				dp[get][i + 1][j] = max(dp[get][i + 1][j], dp[get ^ 1][i][j] + 1);
			}
			if(j != m)
			{
				get = (t[j] == 'I');
				dp[get][i][j + 1] = max(dp[get][i][j + 1], dp[get ^ 1][i][j] + 1);
			}	
			ans = max(ans, dp[1][i][j]);
		}
	}
		cout << ans << endl;
}

Measured memory_bytes: 34728
N = int(input())
X = sorted(list(map(int, input().split())))
if N == 1:
    print(0)
else:
    r = X[-1] - X[0]
    ans = float("inf")
    for i in range(r + 1):
        R = X[0] + i
        hp = 0
        for j in range(N):
            hp = hp + (R - X[j]) ** 2

        ans = min(hp, ans)

    print(ans)


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

int main(){
  int n,k;
  string s;
  cin>>n>>k;
  cin>>s;
  k--;
  char &x=s.at(k);
  if(x=='A') x='a';
  else if(x=='B') x='b';
  else x='c';
  cout<<s<<endl;
}


Measured memory_bytes: 256
import java.util.*;

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

        String s = sc.nextLine();

        int count = s.length() - 2;

        System.out.printf("%s%d%s", s.charAt(0), count, s.charAt(s.length() - 1));

    }
}

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

odd = []
even = []
for i in range(n):
    if i % 2 == 0:
        even.append(a[i])
    else:
        odd.append(a[i])

if n % 2 == 1:
    ans = even[::-1]+odd
else:
    ans = odd[::-1]+even
print(*ans)


Measured memory_bytes: 26020
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll c[26],ans=1ll;

int main(void){
	int n,i;
	string s;
	cin >> n;
	cin >> s;
	for(i=0; i<n; ++i){
		++c[s[i]-'a'];
	}
	for(i=0; i<26; ++i){
		mul_mod(ans,c[i]+1);
	}
	add_mod(ans,MOD-1);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512