akhauriyash/Code-Regression huggingface dataset:
//#pragma  GCC optimize("Ofast")

//#ifdef  DEBUG
//#define _GLIBCXX_DEBUG
//#endif

// -Ofast
// -O3
// -O2
// -fsanitize=address
// -fsanitize=undefined

// add_compile_options()

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#include <cassert>
#include <random>
using namespace std;
//using namesparsace __gnu_pbds;

mt19937 rnd;

void solve();

int main()
{
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    solve();
    return 0;
}

#define int long long

int max(int a, int b) {
    return a > b ? a : b;
}

const int maxN = 5e5 + 10, inf = 1e18;

int n, a, b;

void solve() {
    cin >> n >> a >> b;
    if ((b - a) % 2 == 0) {
        cout << (b - a) / 2;
    } else {
        cout << min(a - 1 + (b - a + 1) / 2, n - b + (b - a + 1) / 2);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t / 2;
    } else {
        return modpow(m, n - 1) * m % mod;
    }
}



int main() {
    char n;
    cin >> n;
    cout << char(n + 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> P;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const int inf = 1e9;
const ll INF = 2e18;
const ll MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

vector<ll> fac,inv,finv;

void initcom(){
    fac=inv=finv=vector<ll>(1e6);
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(ll i=2;i<1e6;++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll x,ll y){
    if(y==0) return x;
    return gcd(y,x%y);
}
ll mopow(ll a,ll x,ll mod){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}
int main(){
    ll s;cin>>s;
    ll x1=s/(ll)1e9+(s%(ll)1e9==0?0:1);
    ll x2=x1*(ll)1e9-s;
    cout<<0<<' '<<0<<' '<<x1<<' '<<1<<' '<<x2<<' '<<1000000000<<endl;
    return 0;
}

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

int main(){
  long long A, B, K;
  cin >> A >> B >> K;
  
  if (K >= A + B){
    cout << "0 0" << endl;
  }
  else if (K < A + B && K >= A){
    cout << 0 << " " << B - (K - A) << endl;
  }
  else if (K < A){
    cout << A - K << " " << B << endl;
  }
}


Measured memory_bytes: 256
l =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n= int(input())

print(l[n-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
    ll n;
    while (cin >> n) {
        if (n == 0) {
            break;
        } else {
            ll res = 0;
            rep(i, n/4) {
                ll a;
                cin >> a;
                res += a;
            }
            cout << res << endl;
        }
    }
}


Measured memory_bytes: 3004
import sys
input = sys.stdin.readline
mod = 10**9+7

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    L = max(A[-1], X)

    dp = [[0]*N for _ in range(L+1)]
    a = A[0]
    for x in range(L+1):
        dp[x][0] = x%a

    dp1 = [0 for _ in range(L+1)] #累積和見たいな
    for n in range(1, N):
        a = A[n]
        for x in range(L+1):
            dp1[x] = ((n-1) * dp1[x] + dp[x][n-1]) % mod
            dp[x][n] = dp1[x%a]

    ans = 0
    t = 1
    for n in reversed(range(N)):
        ans = (ans + dp[X][n]*t) % mod
        t = t * n % mod

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 204552
#include<stdio.h>
#include<string.h>
int main(){
char* c[20];
  scanf("%s",c);
  
 if(strcmp(c,"hihihihihi")==0){
   printf("Yes");
    return 0;
  }else if(strcmp(c,"hihihihi")==0){
     printf("Yes");
    return 0;
  }else if(strcmp(c,"hihihi")==0){
     printf("Yes");
    return 0;
  }else if(strcmp(c,"hihi")==0){
  printf("Yes");
    return 0;
  }else if(strcmp(c,"hi")==0){
     printf("Yes");
    return 0;
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main{

  public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      for(int i = 1; i < s.length(); i++) {
        if(s.charAt(i) != s.charAt(i-1))
          break;
        if(i == 2) {
          System.out.println("Yes");
          return;
        }
      }
      for(int i = 2; i < s.length(); i++) {
        if(s.charAt(i) != s.charAt(i-1))
          break;
        if(i == 3) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
  }
}



Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    int a,b;
    cin >> a >> b;
    if(a >= 1 && a < 10 && b >= 1 && b < 10)
        cout << a*b;
    else
        cout << "-1";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
Ss = [list(input()) for _ in range(N)]

A = Ss[0][:]
for S in Ss:
    B = []
    for s in S:
        if s in A:
            A.remove(s)
            B.append(s)
    A = B

A.sort()
print(''.join(A))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
  ll mod=(1e9+7)*2;
  ll mod2=1e9+7;
  int n,q;
  cin>>n;
  q=1;
  ll vec[n];
  ll sum[n+1]={};
  ll sumb[n+1]={};
  for(int i=0;i<n;i++){
    cin>>vec[i];
    sum[i+1]=sum[i]+vec[i];
    sum[i+1]%=mod;
    sumb[i+1]=sumb[i]+vec[i]*vec[i];
    sumb[i+1]%=mod;
  }
  while(q--){
    int s,t;
    cin>>s>>t;
    s=1,t=n;
    ll ans=(sum[t]-sum[s-1])*(sum[t]-sum[s-1])-(sumb[t]-sumb[s-1]);
    ans%=mod;
    if(ans<0){
      ans+=mod*100;
    }
    ans%=mod;
    ans/=2;
    ans%=mod2;
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 8316
#include <vector>
#include <iostream>
#include <algorithm>
 
using namespace std;
 
bool is_prime(int n, int k = 3)
{
    if(n < k * k) { return true; }
     
    if(n % k == 0) { return false; }
     
    return is_prime(n, k + 2);
}
 
int main()
{
    vector<int> prime = {2};
     
    for(int i = 3; i < 101300; i += 2)
    {
        if(is_prime(i))
        {
            prime.push_back(i);
        }
    }
     
    int n, m;
     
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &m);
         
        if(n == -1 && m == -1) { break; }
         
        int ptr = distance(prime.begin(), lower_bound(prime.begin(), prime.end(), n + 1));
         
        vector<int> c;
         
        for(int i = ptr; i < ptr + m; i++)
        {
            for(int j = i; j < ptr + m; j++)
            {
                c.push_back(prime[i] + prime[j]);
            }
        }
         
        sort(c.begin(), c.end());
         
        printf("%d\n", c[m - 1]);
    }
     
    return 0;
}

Measured memory_bytes: 3324
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int n,m,X,Y;cin >> n >> m >> X >> Y;
    vector<int>x(n),y(m);
    rep(i,n)cin >> x[i];
    rep(i,m)cin >> y[i];
    int x_max=*max_element(x.begin(),x.end());
    int y_min=*min_element(y.begin(),y.end());
    if(y_min<=x_max){
        out("War");
    }
    else{
        if(X>=y_min || x_max>=Y){
            out("War");
        }
        else{
            out("No War");
        }
    }

    return 0;
}




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



int64_t simple_gcd(int64_t x, int64_t y){

  if(x<y)
    swap(x,y);
  
  while(y>0){
    int64_t r = x%y;
    x=y;
    y=r;
  }
  return x;
}

int main() {

    int64_t x,y;
    cin>>x>>y;

    cout<<simple_gcd(x,y)<<endl;

	return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,0,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
struct Edge{
    int to,cost;
    Edge(int to,int cost):to(to),cost(cost){}
};

signed main(){
    int N,M,L;cin>>N>>M>>L;
    int d[N][N];
    REP(i,N)REP(j,N)d[i][j]=INF;
    REP(i,N)d[i][i]=0;
    REP(i,M){
        int a,b,c;cin>>a>>b>>c;a--;b--;
        d[a][b]=min(d[a][b],c);
        d[b][a]=d[a][b];
    }
    REP(k,N)REP(i,N)REP(j,N)d[i][j]=min(d[i][j],d[i][k]+d[j][k]);
    int fuel[N][N];
    REP(i,N)REP(j,N)fuel[i][j]=INF;
    REP(i,N)fuel[i][i]=0;
    REP(i,N)REP(j,N)if(d[i][j]<=L)fuel[i][j]=1;
    REP(k,N)REP(i,N)REP(j,N)fuel[i][j]=min(fuel[i][j],fuel[i][k]+fuel[j][k]);
    int Q;cin>>Q;
    REP(i,Q){
        int s,t;cin>>s>>t;s--;t--;
        cout<<(fuel[s][t]!=INF?fuel[s][t]-1:-1)<<endl;
    }
}

Measured memory_bytes: 1920
N = int(input())
A = list(map(int,input().split()))

from collections import Counter
cnt = Counter(A)

ans = 0
for v in cnt.values():
    ans += v*(v-1)//2

for a in A:
    k = cnt[a]
    print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2)

Measured memory_bytes: 108040
arrLength=int(input())
a = list(map(int,input().split()))
min = a
max = a
sum = a
# for i in range(arrLength):
for j in range(arrLength):
    if min[0]>min[j]:
        temp=min[0]
        min[0]=min[j]
        min[j]=temp
minans = min[0]
# for i in range(arrLength):
for j in range(arrLength):
    if max[0]<max[j]:
        temp=max[0]
        max[0]=max[j]
        max[j]=temp
maxans=max[0]

sumans =0
for i in range(arrLength):
    sumans += sum[i]


print(minans,maxans,sumans)



Measured memory_bytes: 6592
import sys
def input():
    return sys.stdin.readline()[:-1]

n, k = map(int, input().split())
s = str(input())

u = s + s[::-1]
ss = s

if n < k**2:
    smallest = sorted(s)[0]
    print(smallest * n)

else:
    times = min(n, k)
    for i in range(times):
        for j in range(n):
            part = u[j:j+n]
            if part < ss:
                ss = part
        s = ss
        u = s[::-1] + s
    print(s)

Measured memory_bytes: 43420
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int cnt = 0;
	for(int i=1; i<=n; i++){
		int k = 0;
		int num = i;
		while(num){
			num /= 10;
			k++;
		}
		if(k%2){
			cnt++;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

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

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

	for (int i = 0; i < n; i++)
	{
		if (a[i] == 0)
		{
			cout << 0 << endl;
			return 0;
		}
	}

	signed long long all = 1;
	long long b = 1e18;

	for (int i = 0; i < n; i++)
	{
		if (a[i] > b / all)
		{
			cout << -1 << endl;
			return 0;
		}
		all *= a[i];
	}

	cout << all << endl;

	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < k; ++i) {
        vector<int> b(n + 1);
        for (int j = 0; j < n; ++j) {
            int l = max(0, j - a[j]);
            int r = min(j + a[j] + 1, n);
            ++b[l];
            --b[r];
        }
        for (int j = 0; j < n; ++j) {
            b[j + 1] += b[j];
        }
        b.pop_back();
        if (a == b) {
            break;
        }
        a = b;
    }
    for (int i = 0; i < n; ++i) {
        cout << a[i] << " ";
    }
    cout << '\n';   
    return 0;
}

Measured memory_bytes: 4936
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a = l()

a.sort()

for i in range(n):
    if a[i] % 2 == 0:
        if (a[i] % 3) * (a[i] % 5) != 0:
            print("DENIED")
            break
else:
    print("APPROVED")








Measured memory_bytes: 38384
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define trace(x) cerr << #x << " = " << x << endl
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define sl(a)   scanf("%lld",&a)
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define pi acos(-1)
#define en '\n'
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef vector<pll> vll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] = {-1,+1,0,0,+1,-1,+1,-1};
ll dy[] = {0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;

template <class T> T power(T a,T b){a%=MOD;if(!a) return 0;T p=1;while(b>0){if(b&1){p*=a;p%=MOD;}a*=a;a%=MOD;b=b>>1;}return p;}
template <class T> void print(vector<T> &v){for(T u:v){cout<<u<<" ";}cout<<endl;}
template <class T> T gcd(T a, T b){return (b!=0?gcd<T>(b,a%b):a);}
template <class T> T lcm(T a, T b){return (a/gcd<T>(a,b)*b);}
ll a,b;
bool vis[mx];
vi adj[mx];
void dfs(ll u)
{
    vis[u] = 1;
    for(auto v:adj[u])
    {
        if(!vis[v])
            dfs(v);
    }
}
int main()
{
    speed();
    cin>>a>>b;
    ll u,v,i,ans = 0;
    mem(vis,0);
    rep(i,b)
    {
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    for(i=1;i<=a;i++)
    {
        if(!vis[i])
        {
            dfs(i);
            ans++;
        }
    }
    cout<<ans-1<<endl;




return 0;
}

Measured memory_bytes: 10432
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
  
using namespace std;
 
class tree{
public:
    void putparent(int n);
    void putleft(int n);
    void putright(int n);
    int getparent();
    string gettype();
    int getleft();
    int getright();
    tree();
private:
    int parent;
    int left_child;
    int right;
};
 
typedef struct tree Tree;
 
tree::tree()
{
    parent = -1;
    left_child = -1;
    right = -1;
}
 
void tree::putparent(int n)
{
    parent = n;
    return;
}
 
void tree::putleft(int n)
{
    left_child = n;
    return;
}
 
void tree::putright(int n)
{
    right = n;
    return;
}
 
int tree::getparent()
{
    return parent;
}
 
string tree::gettype()
{
    if(getparent() == -1) return "root";
    else if(getleft() == -1) return "leaf";
    else return "internal node";
}
 
int tree::getleft()
{
    return left_child;
}
 
int tree::getright()
{
    return right;
}
 
int getdepth(Tree a[], int n)
{
    int ans = 0;
    if(a[n].getparent() != -1) return getdepth(a, a[n].getparent()) + 1;
    else return 0;
}
 
int main()
{
    int n;
    cin >> n;
    Tree t[100000];
    int v, d, c, l;
    for(int i = 0; i < n; i++){
        cin >> v >> d;
        for(int j = 0; j < d; j++){
            cin >> c;
            if(j == 0) t[v].putleft(c);
            else t[l].putright(c);
            l = c;
            t[c].putparent(v);
        }
    }
    for(int i = 0; i < n; i++){
        cout << "node " << i << ": ";
        cout << "parent = " << t[i].getparent() << ", ";
        cout << "depth = " << getdepth(t, i) << ", ";
        cout << t[i].gettype() << ", ";
        cout << "[";
        if(t[i].getleft() != -1){
            cout << t[i].getleft();
            l = t[i].getleft();
            while(t[l].getright() != -1){
                cout << ", ";
                cout << t[l].getright();
                l = t[l].getright();
            }
        }
        cout << "]" << endl;
    }
}

Measured memory_bytes: 4328
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int H, W, N;
map<int, set<int>> ma;

void solve() {
    int right = 1;
    for (int x = 2; x <= H; x++) {
        if (!ma.count(x))
            right = min(right + 1, W);
        else {
            int first = *ma[x].begin();
            if (first <= right) {
                cout << x - 1 << endl;
                return;
            }
            if (right != first - 1)
                right++;
        }
    }
    cout << H << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> H >> W >> N;
    FOR(N) {
        int x, y;
        cin >> x >> y;
        ma[x].insert(y);
    }


    solve();
    return 0;
}


Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int ar[n + 4][5];
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < 3; j++) cin >> ar[i][j];
    }
    int dp[n + 4][5];
    for (int i = 0; i < 3; i++) dp[1][i] = ar[1][i];
    for (int i = 2; i <= n; i++){
        for (int j = 0; j < 3; j++){
            dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
            dp[i][j] += ar[i][j];
        }
    }
    int mx = 0;
    for (int i = 0; i < 3; i++) mx = max(mx, dp[n][i]);
    cout << mx << endl;    
}

Measured memory_bytes: 7472
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>

using namespace std; 

#define NOT_FOUND -1
#define rep(i,n) for(int i=0;i<(int)(n); i++)
/*for文のマクロ定義
rep(i,回数){
    処理
}
*/

void swap(int *a, int *b){
	*b=*a-*b;
	*a-=*b;
	*b+=*a;
}

int sosu_judge(int N){
	/*素数ならば1
	  素数でなければ0を返す
	*/
	int i,j;

	if(N==2)   return 1;
	if(N%2==0) return 0;

	for(i=3;i<N && N%i!=0;i+=2);

	if(i>=N) return 1;
	
	return 0;
}

int factorial(int N){  //Nの階乗を求める関数
	int ans=1;

	while(N--) ans*=(N+1);
	return ans;
}

//クイックソートをする関数
void q_sort(int a[], int first, int last){
    int i,j;
    int x,t;

    x = a[(first + last) / 2];
    i = first; j=last;

    while(1){
        while( a[i] < x) i++;
        while( x < a[j]) j--;
        
        if( i >= j) break;
        
        swap(&a[i],&a[j]);
        i++; j--;
    }
    if(first < i-1) q_sort(a, first,i-1 );
    if(last > j+1)  q_sort(a, j+1,  last);
}

int b_search(int target, int array[],int right, int left){
    int mid;
    while(left<right){
        mid=(right+left)/2;
        if(array[mid]<target) left =mid+1;
        else                  right=mid;
    }
    if(array[mid]==target) return mid;
    return NOT_FOUND;
}

int main(){
    vector<int> N(0);
    int buf;

    rep(i,3){
        cin>>buf;
        N.push_back(buf);
        //cout<<N[i]<<endl;
    }
    if((N[0]==N[1] && N[2]!=N[0]) || (N[0]==N[2] && N[1]!=N[0]) || (N[1]==N[2] && N[0]!=N[1])){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
 
    return 0;
}



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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

struct BIT{
    ll N;
    vector<ll> bit;
    BIT(ll N) : bit(N+1),N(N){};

    ll sum(ll i){
        ll s = 0;
        while(i>0){
           s += bit[i];
           i -= i& -i;
        }
        return s;
    }

    void add(ll i,ll x){
        while(i <= N){
            bit[i] += x;
            i += i & -i;
        }
    }
};

//数列の値の範囲を[1,n]に変える
vector<int> convert_array(vector<int> z){
    ll n = z.size();
    vector<int> temp = z;
    sort(all(temp));
    for(int i = 0; i < n; i++){
        z[i] = lower_bound(all(temp), z[i]) - temp.begin() + 1;
    }
    return z;
}

//反転数を求める
ll inverse_number(vector<int> z){
    ll n = z.size();
    ll inv_num = 0;
    z = convert_array(z);

    BIT b(n);
    for(int i = 0; i <= n; i++){
        b.bit[i] = 0;
    }

    for(int i = 0; i < n; i++){
        inv_num += i - b.sum(z[i]);
        b.add(z[i],1);
    }

    return inv_num;
}

int main()
{
	int n;
	cin>>n;
	vector<vector<int>> card(n,vector<int>(2));
	rep(j,2){
		rep(i,n)cin>>card[i][j];
	}

	ll ans = INF;
	for (int bit = 0; bit < (1<<n); bit++){
		vector<int> parity(n);
		for (int i = 0; i < n; i++){
			parity[i] = (bit&(1<<i)?1:0); //bitが立っているのが偶数番目
		}

		// cout<<"sum = "<< accumulate(all(parity),0)<<endl;
		if(accumulate(all(parity),0)!=(n+1)/2)continue;

		vector<P> target_even, target_odd;
		for (int i = 0; i < n; i++){
			if(bit&(1<<i)){
				if(i%2==0)target_even.push_back(P(card[i][0],i));
				else target_even.push_back(P(card[i][1],i));
			}else{
				if(i%2!=0)target_odd.push_back(P(card[i][0],i));
				else target_odd.push_back(P(card[i][1],i));								
			}
		}
		sort(all(target_even));
		sort(all(target_odd));
		vector<int> target(n);
		int cur = 0;
		int pos_even=0, pos_odd=0;
		for (int i = 0; i < n; i++){
			if(i%2==0){
				target[i] = target_even[pos_even].second+1;
				if(cur > target_even[pos_even].first){
					cur = INF;
					break;
				}
				cur = target_even[pos_even].first;
				pos_even++;
			}else{
				target[i] = target_odd[pos_odd].second+1;
				if(cur > target_odd[pos_odd].first){
					cur = INF;
					break;
				}
				cur = target_odd[pos_odd].first;
				pos_odd++;
			}
			// cout<<cur<<endl;
		}
		if(cur==INF)continue;

		// for(auto x:target)cout<<x<<" ";
		// cout<<endl;


		ans = min(ans,inverse_number(target));
	}

	if(ans==INF)cout<<-1<<endl;
	else cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    string s;
    int k;
    cin>>s>>k;

    int n=s.size();

    vec a(n);
    char lll='z'; lll++;
    rep(i,n){
        a[i]=lll-s[i]; // aに変更するには
        a[i]%=26;
    }

    rep(i,n){
        if(a[i]<=k){
            s[i]='a';
            k-=a[i];
        }
    }
    k%=26;
    s[n-1]+=k;
    cout<<s<<endl;
}

Measured memory_bytes: 1360
MOD = 10**9+7

L = input()
N = len(L)

ans = 0
c = 0

for i in range(N):
    if L[i] == '1':
        ans += pow(3,N-i-1,MOD)*pow(2,c,MOD)
        ans %= MOD
        c += 1
        
ans += pow(2,c,MOD)
ans %= MOD

print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <cmath>
#include <cstring>
#include <climits>
#include <iomanip>
using namespace std;

#define FORN(i, j, k) for(int i=j;i<k;i++)
#define FORR(i, j, k) for(int i=j;i>=k;i--)
#define REP(i, n) FORN(i, 0, n)
#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'

const int MODO = 1e+9 + 7;
const int MAX = 1e+5 + 5;
const int nax = 3e+3 + 5;

int n;
int a[MAX];
int dp[nax][nax];

int solRec(int l, int r){
	if(l==r){
		return dp[l][r] = a[l];
	}
	if(dp[l][r] != -1){
		return dp[l][r];
	}
	return dp[l][r] = max(a[l] - solRec(l+1,r), a[r] - solRec(l,r-1));
}

void solve(){
	REP(i,n){
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << solRec(0,n-1) << endl;
	return;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	solve();
	return 0;
}


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



int main() {
  int n;
  cin >>n;
  int a[n];
  rep(i,n)cin >>a[i];
  int ans=a[0];
  for(int i=1;i<n;i++){
    ans=__gcd(ans,a[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define int long long int
#define pb push_back
#define M 1000000007
#define inf 10000000000
#define ff first
#define ss second
#define deb(x) cout< #x< " "< x< endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<=n;i++)
#define FORR(a,b,c) for(int a= b;a>=c;a--)
#define fa(arrr) for(auto x:arrr)
#define iPair pair<int, pair<int,int>>
#define sz size()
// #define mp make_pair
#define mxm3(a,b,c) max(a, max(b,c))
#define mi3(a,b,c) min(a, min(b,c))
#define mxn 500005
#define PII pair<int,int>
#define all(v) v.begin(), v.end()
#define endl "\n"
// #define N 1000
#define C 4
#define nfs ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
// Ordered Set Tree
// typedef tree<PII, null_type, less<PII>,
//         rb_tree_tag,
//         tree_order_statistics_node_update>
//         oset;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}



void solve() {
    int n, m;
    cin >> n >> m;
    vector<string>arr;
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        arr.pb(s);
    }
    int dp[n][m] ;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++) dp[i][j] = 0;
    }
    for (int i = 0; i < n; i++) {
        if (arr[i][0] == '#') break;
        dp[i][0] = 1;
    }
    for (int i = 0; i < m; i++) {
        if (arr[0][i] == '#') break;
        dp[0][i] = 1;
    }
    // cout << dp[0][0] << endl;
    for (int i = 1; i < n; i++) {
        for (int j = 1; j < m; j++) {
            
            if (arr[i][j] == '#') {
                dp[i][j] = 0;
                // continue;
            }
            else dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % M;
        }

        // cout << endl;
    }
    cout << dp[n - 1][m - 1] << endl;
}


int32_t main()
{


    nfs;
    int t;
    // facto();
    // cin >> t;
    t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 9088
N,M = map(int,input().split())
drink_store = [list(map(int,input().split())) for _ in range(N)]
drink_store.sort(key=lambda x: x[0])

total_price = 0
drink_num  = 0


for i in range(N):
    drink_num += drink_store[i][1]
    if M <= drink_num:
        left = drink_num - M
        total_price += (drink_store[i][0]*drink_store[i][1]) - (drink_store[i][0]*left)
        break
    else:
         total_price += drink_store[i][0]*drink_store[i][1]

print(total_price)

Measured memory_bytes: 29028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int A, B, M;
    cin >> A >> B >> M;
    int a[A], a2[A], b[B], b2[B], x[M], y[M], c[M];
    for(int i=0;i<A;i++){
        cin >> a[i];
        a2[i] = a[i];
    }
    for(int i=0;i<B;i++){
        cin >> b[i];
        b2[i] = b[i];
    }
    for(int i=0;i<M;i++){
        cin >> x[i] >> y[i] >> c[i];
        x[i]--;
        y[i]--;
    }
        

    // 割引券なし
    sort(a2, a2 + A);
    sort(b2, b2 + B);
    ll ans = a2[0] + b2[0];
    
    // 割引券使用
    for(int i=0;i<M;i++){
        ll price;
        price = a[x[i]] + b[y[i]] - c[i];
        ans = min(ans, price);
    }

    cout << ans << endl;

}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  #define int long long
  
  int n,m,k,ans=1;
  cin >> n >> m;

  k = __gcd(m,n);
  for (int i = 2; i <= sqrt(k); i++) {
    if(!(k%i)) {
        ans++;
        while (!(k%i)) {
          k/=i;
        }

    }
  }

  if (k>1) ans++;
  cout << ans;
 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int
main()
{
	int x, y;

	cin >> x >> y;

	if (x == 2 || y == 2 || x == 11) {
		cout << "No";
	}
	else if (x == 4 || x == 6 || x == 9) {
		if (y == 6 || y == 9 || y == 11) {
			cout << "Yes";
		}
		else {
			cout << "No";
		}
	}
	else {
		if (y == 6 || y == 9 || y == 11) {
			cout << "No";
		}
		else {
			cout << "Yes";
		}

	}
	cin >> x;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in freopen("input.txt", "r" ,stdin)
#define out freopen("output.txt", "w" , stdout)
#define ll long long
#define inf 200005
#define fr first
#define  sc second
#define pb push_back
#define p_b pop_back
#define mp make_pair
#define N 100100
#define mod 1000000007
#define pi 3.1415926535
using namespace std;
int n,k;
int dp[100005];
int x[105];
int main (){
//in;out;
ios_base::sync_with_stdio(0);
cin >> n >> k;
for (int i = 1; i <=n; i++){
    cin >> x[i];
}
for (int i = 0; i <= 1e5; i++) dp[i] = 2;
for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= n; j++){
            if (i < x[j])continue;
        if (dp[i - x[j]] == 2) {
            dp[i] = 1;
        }
    }
}

if (dp[k] == 1){cout << "First";}
else cout << "Second";
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
                    #include <set>
					#include <ext/pb_ds/assoc_container.hpp> 
					#include <ext/pb_ds/tree_policy.hpp> 
					using namespace __gnu_pbds; 
					#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
					using namespace std;
                    #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
                    #define pb push_back
                    #define ff first
                    #define ss second
                    #define sz size()
                    #define mp make_pair
                    #define int long long
                    #define double long double
                    #define bp __builtin_popcountll
                    #define FOR(i,a,b) for(int i=a;i<b;i++)
                    #define ROR(i,a,b) for(int i=a;i>=b;i--)
                    const int M=1e9+7;
                    const int N=1e5+5;
                    const int inf=1e18;
                    
                    int32_t main()
                    {
                    	FAST
                    	int h,w;
                    	int a,b;
                    	cin>>h>>w>>a>>b;
                    	string s="";
                    	string t="";
                    	string X[h];
                    	for(int i=0;i<a;i++)
                    	s+='0',t+='1';
                    	for(int i=a;i<w;i++)
                    	s+='1',t+='0';
                    	for(int i=0;i<b;i++)
                    	X[i]=s;
                    	for(int i=b;i<h;i++)
                    	X[i]=t;
                    	for(int i=0;i<h;i++)
                    	{
                    		int o=0,e=0;
                    		for(int j=0;j<w;j++)
                    		{
                    			if(X[i][j]=='1')
                    			o++;
                    			else
                    			e++;
                    		}
                    		int mm=min(o,e);
                    		if(mm!=a)
                    		return cout<<"-1",0;
                    	}
                    	for(int i=0;i<w;i++)
                    	{
                    		int o=0,e=0;
                    		for(int j=0;j<h;j++)
                    		{
                    			if(X[j][i]=='1')
                    			o++;
                    			else
                    			e++;
                    		}
                    		int mm=min(o,e);
                    		if(mm!=b)
                    		return cout<<"-1",0;
                    	}
                    	for(int i=0;i<h;i++)
                    	cout<<X[i]<<endl;
                    	
                    }
  

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  vector<int> y = x;
  sort(x);
  int med1 = x[n/2-1];
  int med2 = x[n/2];
  int med3 = (med1+med2)/2;
  rep(i,n){
    if(y[i] <= med3) cout << med2 << endl;
    else cout << med1 << endl;
  }
}

Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<int>> M(H+1, vector<int>(W+1));
  REP(i, H) {
    string S;
    cin >> S;
    REP(j, W) {
      M[i+1][j+1] = S[j] - '0';
    }
  }
  REP(i, H) {
    REP(j, W) {
      M[i+1][j+1] += M[i+1][j];
    }
  }
  REP(i, H) {
    REP(j, W) {
      M[i+1][j+1] += M[i][j+1];
    }
  }
  
  int dHmax = 1 << (H-1);
  int ret = 999999;
  for(int dH=0; dH<dHmax; ++dH) {
    vector<pair<int, int>> segs;
    {
      int seg_l = 0;
      int tdH = dH;
      for(int i = 1; i < H; ++i) {
        if(tdH&1) {
          segs.push_back(make_pair(seg_l, i));
          seg_l = i;
        }
        tdH >>= 1;
      }
      segs.push_back(make_pair(seg_l, H));
    }
    for(const auto& seg : segs){
        int sT = seg.first, sB = seg.second;
        cerr << "(" << sT << "," << sB << ")" << " ";
    }
    int left = 0, vcut = 0;
    for(int i=1; i<=W; ++i) {
      int flag = false;
      for(const auto& seg : segs){
        int sT = seg.first, sB = seg.second;
        int tw = M[sB][i] - M[sT][i] - M[sB][left] + M[sT][left];
        if(tw > K) {
          flag = true;
          break;
        }
      }
      if(flag) {
        if(left == i - 1) {
          vcut = 999999;
          break;
        }
        left = i - 1;
        vcut++;
      }
    }
    cerr << __builtin_popcount(dH) << "+" << vcut << endl;
    int tret = __builtin_popcount(dH) + vcut;
    ret = min(ret, tret);
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a,b[12],i,x=0,y=0;
	scanf("%d",&a);
	FOR(i,0,a){
		scanf("%d",&b[i]);
		y=y+b[i];
		if(x<b[i]){
			x=b[i];
		}
	}
	printf("%d",y-x/2);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> vec;
//配列の添字ズレに注意
//=に注意

int main(){
  long n,ans=0; cin>>n;
  
  for(int a=1;a<n;a++){
    ans+=(n-1)/a;
  
  
  }
  cout<<ans;
  
  
  
 /* 
  while(n>1){
     for(long i=1;i*i<=n;i++){
       if(n%i==0){
         if(n==n/i)ans++;
         else ans+=2;
       }
     }
    
    n--;  
  }

  cout<<ans<<endl;
  */
}


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

public class Main {

    void solve() {
	String ans = "";
	long a = sc.nextLong();
	long b = sc.nextLong();

	if (a > 0) {
	    ans = "Positive";
	} else if (a == 0 || b == 0) {
	    ans = "Zero";
	} else if (a <= 0 && b >= 0) {
	    ans = "Zero";
	} else if (a == b) {
	    ans = "Negative";
	} else {
	    if (((b - a) + 1) % 2 == 0) {
		ans = "Positive";
	    } else {
		ans = "Negative";
	    }
	}
	System.out.println(ans);
    }

    void print(int[] a) {
	out.print(a[0]);
	for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
	out.println();
    }

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

    MyScanner sc = null;
    PrintWriter out = null;
    public void run() throws Exception {
	sc = new MyScanner(System.in);
	out = new PrintWriter(System.out);
	for (;sc.hasNext();) {
	    solve();
	    out.flush();
	}
	out.close();
    }

    class MyScanner {
	String line;
	BufferedReader reader;
	StringTokenizer tokenizer;

	public MyScanner(InputStream stream) {
	    reader = new BufferedReader(new InputStreamReader(stream));
	    tokenizer = null;
	}
	public void eat() {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		try {
		    line = reader.readLine();
		    if (line == null) {
			tokenizer = null;
			return;
		    }
		    tokenizer = new StringTokenizer(line);
		} catch (IOException e) {
		    throw new RuntimeException(e);
		}
	    }
	}
	public String next() {
	    eat();
	    return tokenizer.nextToken();
	}
	public String nextLine() {
	    try {
		return reader.readLine();
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	public boolean hasNext() {
	    eat();
	    return (tokenizer != null && tokenizer.hasMoreElements());
	}
	public int nextInt() {
	    return Integer.parseInt(next());
	}
	public long nextLong() {
	    return Long.parseLong(next());
	}
	public double nextDouble() {
	    return Double.parseDouble(next());
	}
	public int[] nextIntArray(int n) {
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) a[i] = nextInt();
	    return a;
	}
    }
}


Measured memory_bytes: 8016
N, M = map(int, input().split())
a = []
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    if M > 0:
        a += [int(input())]
    for i in range(M - 1):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
    a.append([-1])
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    memo[1] = 1
    try:
        if a[0] == 1:
            a.pop(0)
            memo[1] = 0
    except:
        pass
    j = 0
    for i in range(N - 1):
        if i + 2 == a[j]:
            j += 1
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)


Measured memory_bytes: 48344
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  size_t n, m;
  cin >> n >> m;
  vector<size_t> cnt(n);
  for(size_t i = 0, u, v; i < m; ++i)
  {
    cin >> u >> v;
    --u; --v;
    ++cnt[u];
    ++cnt[v];
  }

  for(const auto i: cnt)
    if(i & 1)
    {
      cout << "NO";
      return 0;
    }

  cout << "YES";

  return EXIT_SUCCESS;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
const ll MOD=1000000007LL;

ll factorial(ll x){
  if(x==0)return 1;
  return x*factorial(x-1)%MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll comb(ll n, ll r){
	if(n<=10000000){
      return factorial(n)*modpow(factorial(n-r),MOD-2,MOD)%MOD*modpow(factorial(r),MOD-2,MOD)%MOD;
    }
  ll res=1;
    for(ll i=0;i<r;i++){
      res*=n-i;
      res%=MOD;
    }
  res*=modpow(factorial(r),MOD-2,MOD);
  res%=MOD;
  return res;
}
  
int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans=(((modpow(2,n,MOD)-comb(n,a))%MOD-comb(n,b))%MOD-1)%MOD;
  if(ans<0)ans=MOD+ans;
  cout<<ans%MOD<<endl;
	
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

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

	string s, t;
	cin >> s >> t;
	int len = s.size();
	int len2 = t.size();
	if (len2 == len + 1) {
					int i;
		for (i = 0; i < len && s[i] == t[i]; i++);
		if (i == len) {
						cout << "Yes" << endl;
						return 0;
		}
	} 
	cout << "No" << endl;


  return 0;
}


Measured memory_bytes: 3612