akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int n,t[2],a[5][100010],to[100010];
char buffer[10000010],*hed;
inline char Getchar(){
    return *hed++;
}
inline int rd(){
    register int x=0;
    char c;
    do c=Getchar();
    while(!isdigit(c));
    do{
        x=(x<<1)+(x<<3)+(c^48);
        c=Getchar();
    }while(isdigit(c));
    return x;
}
inline int abs(int x){
    return x>=0?x:-x;
}
int main(){
    int len=fread(buffer,1,10000000,stdin);
    hed=buffer;
    n=rd();
    for(int i=1;i<=3;i++)
        for(int j=1;j<=n;j++)
            a[i][j]=rd();
    for(register int i=1;i<=n;i++){
        to[i]=a[2][i]/3+1;
        if(!((a[1][i]-a[2][i]==-1&&a[2][i]-a[3][i]==-1&&a[1][i]%3==1)||(a[1][i]-a[2][i]==1&&a[2][i]-a[3][i]==1&&!(a[1][i]%3)))||(abs(i-to[i])&1)){
            puts("No");
            return 0;
        }
        t[i&1]^=(a[1][i]>a[2][i]);
    }
    for(register int i=1;i<=n;i++){
        while(to[i]!=i){
            t[i&1^1]^=1;
            swap(to[i],to[to[i]]);
        }
    }
    puts(t[0]||t[1]?"No":"Yes");
    return 0;
}

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

int main(){
    int N,a=0;
    cin>>N;
    int d[N];
    for(int i=0;i<N;i++){
        cin>>d[i];
    }
    for(int i=0; i<N;i++){
        for(int j=i+1;j<N;j++){
            a+=d[i]*d[j];
        }
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int N,X;
    cin >> N >>X;
    vi m(N);in(N,m);
    int ans = 0;
    
    rep(i,N){
        ans ++;
        X -= m[i];
    }
    sor(m);
    ans += X/m[0];
    out(ans);



    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll MOD = 998244353;
const double PI = 2 * asin(1);

int main(){
  int N; cin >> N;
  pair<ll, ll> LR[N];
  for (int i = 0; i < N; i++){
    ll X, L; cin >> X >> L;
    LR[i].first = X - L;
    LR[i].second = X + L;
  }
  sort(LR, LR + N, greater<pair<ll, ll> >());

  int ans = 1; ll now = LR[0].first;
  for (int i = 1; i < N; i++){
    if (now >= LR[i].second){
      ans++;
      now = LR[i].first;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
struct Tree {
    Tree *l, *r;
};
 
Tree *tree[2];
 
Tree* make_node()
{
    Tree *t = new Tree;
    t->l = t->r = NULL;
    return t;
}
 
void init()
{    
    tree[0] = make_node();
    tree[1] = make_node();
}
  
bool search_left_node(int &cur, string &s)
{
    int p = 0;
    for (int i = cur; i >= 1; i--) {
        if (s[i] == ')') {
            p++;
        } else if (s[i] == '(') {
            p--;
        }
        if (s[i] == ',' && p == 1) {
            cur = i;
            return 1;
        }
        if (p < 0) return 0;
    }
    return 0;
}
 
bool search_right_node(int &cur, string &s)
{
    int p = 0;
    for (int i = cur; i < (int)s.size()-1; i++) {
        if (s[i] == '(') {
            p++;
        } else if (s[i] == ')') {
            p--;
        }
        if (s[i] == ',' && p == 1) {
            cur = i;
            return 1;
        }
        if (p < 0) return 0;
    }
    return 0;
}
 
void add_left(Tree *t)
{
    t->l = make_node();
}
 
void add_right(Tree *t)
{
    t->r = make_node();
}
 
void dfs(int cur, string &s, Tree *t)
{
    int L = cur - 1, R = cur + 1;
    if (search_left_node(L, s)) {        
        add_left(t);
        dfs(L, s, t->l);
    }
    if (search_right_node(R, s)) {
        add_right(t);
        dfs(R, s, t->r);
    }
}
  
string make_i_tree(Tree *t1, Tree *t2)
{
    string l, r;
    if (t1->l != NULL && t2->l != NULL) {
        l = make_i_tree(t1->l, t2->l);
    } 
        
    if (t1->r != NULL && t2->r != NULL) {
        r = make_i_tree(t1->r, t2->r);
    }
    return "(" + l + "," + r + ")";
}

string make_u_tree(Tree *t1, Tree *t2)
{
    string l, r;
    if (t1->l != NULL || t2->l != NULL) {
        if (t1->l == NULL) add_left(t1);
        if (t2->l == NULL) add_left(t2);
        l = make_u_tree(t1->l, t2->l);
    } 
        
    if (t1->r != NULL || t2->r != NULL) {
        if (t1->r == NULL) add_right(t1);
        if (t2->r == NULL) add_right(t2);
        r = make_u_tree(t1->r, t2->r);
    }
    return "(" + l + "," + r + ")";
}

int get_root(string &s)
{
    int depth = 0;
    for (int i = 1; i < (int)s.size(); i++) {
        if (s[i] == '(') depth++;
        else if (s[i] == ')') depth--;
        if (depth == 0 && s[i] == ',') {
            return i;
        }
    }
    return -1;
}

void solve(char order, string &a, string &b)
{
    int cur_a = get_root(a), cur_b = get_root(b);   
    init();
    
    dfs(cur_a, a, tree[0]);
    dfs(cur_b, b, tree[1]);
    
    if (order == 'i') {
        cout << make_i_tree(tree[0], tree[1]) << endl;
    } else {
        cout << make_u_tree(tree[0], tree[1]) << endl;
    }
}
 
int main()
{
    char order;
    string a, b;
    while (cin >> order >> a >> b) {
        solve(order, a, b);
    }
    return 0;
}

Measured memory_bytes: 3204
#include "bits/stdc++.h"
 
using namespace std;
 
#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009
#define pi 3.141592653589793238
 
typedef pair<int, int> P;
 

void solve(long long X, long long Y, long long Z){
    cout << Z << " " << X << " " << Y << endl;
}
 
signed main(){
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s, A, C;
  cin >> A >> s >> C;
  
  A = A.at(0);
  C = C.at(0);
  s = s.at(0);
  
  cout << A << s << C << endl;
}
  

Measured memory_bytes: 256
n=input()
k=int(input())
counter=0
nex=0
for i in range(len(n)):
  if n[i]=='1':
    counter+=1
  else:
    nex=n[i]
    break
if nex==0:
  nex='1'
if k>counter:
  print(nex)
else:
  print(1)

Measured memory_bytes: 38324
def insertion_sort(a, n, g, cnt):
    for i in range(g,n,1):
        v = a[i]
        j = i - g #initial value
        while j>=0 and a[j]>v:
            a[j+g]=a[j]
            j -= g
            cnt += 1
        a[j+g] = v
    return a, cnt

def shell_sort(a,n,m,g):
    cnt = 0
    for i in range(m):
        sorted_list, cnt = insertion_sort(a,n,g[i],cnt)
    return sorted_list, cnt

def seqforshell(n):
    seq = [1]
    next_num = 3*seq[0] + 1
    while next_num<n:
        seq.insert(0, next_num)
        next_num = 3*next_num + 1
    return seq

if __name__ == "__main__":
    a = []
    n = int(input())
    for i in range(n):
        a.append(int(input()))
    
    g = seqforshell(n)
    m = len(g)
    res, cnt = shell_sort(a,n,m,g)
    
    print(m)
    print(*g)
    print(cnt)
    for i in range(n):
        print(res[i])


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

int main() {
    string n;
    cin >> n;
    for (int i = 0; i < n.size(); i++) {
        if (n.at(i) == '1') {
            n.at(i) = '9';
            goto next;
        }
        else if (n.at(i) == '9') {
            n.at(i) = '1';
        }
        next:;
    }
    cout << n << endl;
}

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

int remain(int n) {
  if(n % 10 != 0)
    return 10 - n % 10;
  else
    return 0;
}

int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  
  int a, b, c, d, e;
  a = remain(A);
  b = remain(B);
  c = remain(C);
  d = remain(D);
  e = remain(E);
  
  int x = 0;
  x = max(a, b);
  x = max(x, c);
  x = max(x, d);
  x = max(x, e);
  
  int ans = A+B+C+D+E+a+b+c+d+e - x;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();
        System.out.println(solve(a,b,c,d));
    }
    public static String solve(int a, int b, int c, int d) {
        if (Math.abs(c-a) <= d) {
            return "Yes";
        }
        if (Math.abs(b-a) <= d && Math.abs(c-b) <= d) {
            return "Yes";
        }
        return "No";
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n, a[100000], res = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    for (int i = 0; i < n;) {
        int count = 0, cc = a[i];
        while (a[i] == cc && i < n) i++, count++;
        res += count % 2;
    }
    cout << res << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int main(){
  int n; cin >> n;
  map<string,long long> mp;
  for(int i=0;i<n;++i){
    string s; cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  long long ans = 0;
  for(auto c:mp){
    //cout << c.second << endl;
    ans += c.second*(c.second-1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
<?php
fscanf(STDIN, "%d", $n);

while ($n--) {
  fscanf(STDIN, "%d %d %d", $y, $m, $d);
  
  $cnt = 0;
  while ($y != 1000 || $m != 1 || $d != 1) {
    $cnt++;
    $d++;
    if ($y % 3) {
      if (($m % 2 && $d > 20) || ($m % 2 == 0 && $d > 19)) {
        $m++;
        $d = 1;
      }
    } else {
      if ($d > 20) {
        $m++;
        $d = 1;
      }
    }
    if ($m > 10) {
      $y++;
      $m = 1;
    }
  }
  
  print $cnt . "\n";
}

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

int main() {
  unsigned long num;
  unsigned long countFive = 0;
  unsigned long check = 10;
  cin >> num;
  if (num % 2 == 1) {
    cout << 0 << endl;
  } else {
    while (check <= num) {
      countFive += num / check;
      check *= 5;
    }
    cout << countFive << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int k = Integer.parseInt(in.readLine());
    int[] x = new int[n];
    String[] str = in.readLine().split(" ");
    int sum = 0;
    for(int i=0; i<n; i++) {
      x[i] = Integer.parseInt(str[i]);
      int a_sum = x[i]*2;
      int b_sum = (k-x[i])*2;
      sum += Math.min(a_sum,b_sum);
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 32584
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
using namespace std;

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

int n,m;
long long dp[2][21];

int main(){	
	int data[100];
	
	scanf("%d",&n);
	rep(i,n-1)scanf("%d",&data[i]);
	scanf("%d",&m);
	
	dp[1][data[0]] = 1;
	REP(i,1,n-1){
		int cur = i%2;
		int next = (i+1)%2;
		rep(j,21){
			if( j+data[i]<=20 ){
				dp[next][j+data[i]] += dp[cur][j];
				//printf("i:%d  , +: %d  :  %lld\n",i,j+data[i],dp[next][j+data[i]]);
			}
			if( j-data[i]>=0 ){
				dp[next][j-data[i]] += dp[cur][j];
				//printf("i:%d  , -: %d  :  %lld\n",i,j-data[i],dp[next][j-data[i]]);
			}
		}
		rep(j,21)dp[cur][j]=0;
	}
	printf("%lld\n",dp[(n-1)%2][m]);
	return 0;
}

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

using ll = int64_t;
#define int ll

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  string s, tmp;
  std::cin >> tmp >> s >> tmp;
  std::cout << "A" << s[0] << "C" << std::endl;
}


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

int main() {
  double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
  while (cin >> xa1 >> ya1 >> xa2 >> ya2 >> xb1 >> yb1 >> xb2 >> yb2) {
    if ((xa1-xb2)*(xa2-xb1)<=0.0 && (ya1-yb2)*(ya2-yb1)<=0.0) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int res(int n){
    int c=0;
    while(n!=0){
        n/=10;
        c++;
    }
    return c;
}
int main()
{ //A
/*
    int a,b,c;
    cin>>a>>b>>c;
    int t,u;
    t=a;
    a=b;
    b=t;

    u=a;
    a=c;
    c=u;

    cout<<a<<" "<<b<<" "<<c<<endl;
*/
//B
/*
int n,m;cin>>n>>m;
vector<int> a(n);
int sum=0;
rep(i,0,n) {
    cin>>a[i];
    sum+=a[i];
}
sort(a.begin(),a.end());
reverse(a.begin(),a.end());

//cout<<a[m-1]<<endl;
//cout<<1/4.0/(float)m<<endl;
if(a[m-1]<sum*1/4.0/(float)m) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
*/
//C
/*?
ll n,k;
cin>>n>>k;
ll min=n;
while(1){
    n=abs(n-k);
    if(n<min) min=n;
    else break;
}
cout<<min<<endl;
*/
//D
/*×
int k;cin>>k;
vector<int> n(0);
rep(i,1,100000){
    bool f=true;
    int j=i%10;
    if(j==i) n.push_back(i);
    else {
        rep(l,1,res(i)+1){
            if(abs(j-i%int(pow(10,l))/int(pow(10,l-1)))>=2){
                f=false;
                break;
            }
        }
        if(f) n.push_back(i);
    }
}
cout<<res(100000)<<endl;
rep(i,0,n.size()) cout<<n[i]<<endl;
cout<<n[k-1]<<endl;
*/
int k;cin>>k;
vector<ll> q(0);
rep(i,1,10) q.push_back(i);
int c=0;
while(c<=k){
    if(c==k){
        cout<<q[k-1]<<endl;
        return 0;
    }
    if(q[c]%10!=0) q.push_back(10*q[c]+(q[c]%10-1));
    q.push_back(10*q[c]+q[c]%10);
    if(q[c]%10!=9) q.push_back(10*q[c]+(q[c]%10+1));
    c++;
    //cout<<c<<endl;
}
//for(auto i:q) cout<<i<<endl;
//cout<<q[14]<<endl;

}


/*
//D MAQ氏の解
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
vector<int64_t> s;
priority_queue<int64_t, vector<int64_t>, greater<int64_t>> q;
queue <int64_t> Q;
int k;
void dfs(int64_t t,int l){
    if(l>9){
        return ;
    }
    s.push_back(t); 
    //q.push(t);
    //cout<<t<<endl;
    dfs(10*t+(t%10),l+1); 1個前の数字がそのまま続くパターン
    if(t%10 !=0){
        dfs(10*t+(t%10-1),l+1); 1個前の数字-1が続くパターン
    }
    if(t%10 !=9){
        dfs(10*t+(t%10+1),l+1); 1個前の数字+1が続くパターン
    }

}
int main(){

    cin>>k;
    int64_t i=1;
    int count=0;
    dfs(1,0);
    dfs(2,0);
    dfs(3,0);
    dfs(4,0);
    dfs(5,0);
    dfs(6,0);
    dfs(7,0);
    dfs(8,0);
    dfs(9,0);
    all(s);
    //cout<<s.size()<<endl;
    /*
    rep(i,k){
        cout<<s[i]<<" ";
    }
    
   cout<<s[k-1]<<endl;

    //cout<<"ans is "<<s[k-2]<<endl;
}
*/

Measured memory_bytes: 6512
package main

import "fmt"

/*
   Insertion Sort
*/
func main() {
	var N int
	fmt.Scan(&N)

	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
	}

	trace(A, N)
	for i := 1; i < N; i++ {
		key := A[i]
		j := i - 1
		for j >= 0 && A[j] > key {
			A[j+1] = A[j]
			j--
		}
		A[j+1] = key
		trace(A, N)
	}
}

func trace(A []int, n int) {
	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Printf(" ")
		}
		fmt.Printf("%d", A[i])
	}
	fmt.Printf("\n")
}



Measured memory_bytes: 1204
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll man(ll x,ll y, ll s, ll t){
    return abs(x-s)+abs(y-t);
}

void solve() {
    ll N,M;
    cin >> N >> M;
    vll a(N),b(N),c(M),d(M),goal(N);
    rep(i,N){
        cin >> a[i] >> b[i];
    }
    rep(i,M){
        cin >> c[i] >> d[i];
    }
    
    ll min_dist,dist;
    rep(i,N){
        min_dist = 10000000000;
        rep(j,M){
            dist = man(a[i],b[i],c[j],d[j]);
            if(dist < min_dist){
                min_dist = dist;
                goal[i] = j+1;
            }
        }
    }

    rep(i,N){
        print(goal[i]);
    }
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String[] al = a.split("");
		String[] bl = b.split("");
		if ((al[0].equals(bl[2])) && (bl[0].equals(al[2])) && (al[1].equals(bl[1]))) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}


	}}

Measured memory_bytes: 21844
class process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

def main():
    n, q = map(int, raw_input().split())
    p = list()
    for i in range(n):
        name, time = raw_input().split()
        p.append(process(name, int(time)))

    s = 0
    while len(p) > 0:
        e = p.pop(0)
        if e.time - q <= 0:
            s += e.time
            print(e.name + " " + str(s))
        else:
            s += q
            e.time -= q
            p.append(e)

main()

Measured memory_bytes: 26180
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int  main(){
    string s,t;
	cin>>s>>t;
	ll dp[s.length()+1][t.length()+1];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=s.length();i++){
		for(int j =1;j<=t.length();j++){
			if(s[i-1]==t[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	ll i=s.length(),j=t.length();
	string res="";
	while(i>0&&j>0){
		if(s[i-1]==t[j-1]){
			res+=s[i-1];
			i--;j--;
		}
		else if(dp[i-1][j]>dp[i][j-1]){
			i--;
		}
		else{
			j--;
		}
	}
	reverse(begin(res),end(res));
	cout<<res;
	

    return 0;

}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
typedef long long ll;
#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 all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


void solve(){
    ll n, m, a, b;
    cin >> n >> m >> a >> b;
    cout << atcoder::floor_sum(n,m,a,b) << endl;
}
int main() {
    int t;
    cin >> t;
    while(t--)solve();
}


Measured memory_bytes: 3636
import java.util.Scanner
object Main {
  def main(args:Array[String]):Unit = {
    val sc = new Scanner(System.in)
    val a,b,c = sc.nextInt()
    var cnt = 0
    for (i <- a to b if c % i == 0) {
      cnt += 1
    }
    println(cnt)
  }
}

Measured memory_bytes: 45220
#include<stdio.h>
int main()
{
    int a,b,ans;
    scanf("%d" "%d", &a, &b);
    ans = a*b;
  	if((ans % 2) == 0){
    	printf("Even");    
    }
	else{    
    	printf("Odd");    
    }      
    return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

const INF: i64 = 10000000000000;

fn main() {
    let v = read_vec::<i64>();
    let (n, m, limit) = (v[0] as usize, v[1] as usize, v[2]);
    let mut edges = vec![vec![INF; n]; n];
    for _ in 0..m {
        let v = read_vec::<i64>();
        let (a, b, c) = (v[0] as usize - 1, v[1] as usize - 1, v[2]);
        edges[a][b] = c;
        edges[b][a] = c;
    }
    let q = read::<usize>();
    let mut qs = vec![];
    for _ in 0..q {
        let v = read_vec::<usize>();
        qs.push((v[0] - 1, v[1] - 1));
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                edges[i][j] = std::cmp::min(edges[i][j], edges[i][k] + edges[k][j]);
            }
        }
    }

    let mut edges2 = vec![vec![INF; n]; n];
    for i in 0..n {
        for j in 0..n {
            if edges[i][j] <= limit {
                edges2[i][j] = 1;
            }
        }
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                edges2[i][j] = std::cmp::min(edges2[i][j], edges2[i][k] + edges2[k][j]);
            }
        }
    }

    for (s, t) in qs {
        if edges2[s][t] == INF {
            println!("-1");
        } else {
            println!("{}", edges2[s][t] - 1);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 8700
N,K = map(int,input().split())
A = list(map(int,input().split()))
defi = 10**9 + 7

countInA = 0
countBetA = 0
for i in range(N):
  for j in range(N):
    if i <= j and A[i] > A[j]:
      countInA += 1
    if A[i] > A[j] :
      countBetA += 1

print( (countInA*K + (countBetA * (K * (K-1) // 2))) % defi)

      

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359

int main(void)
{
	string s;

	getline(cin, s);
	rep(i, s.length())
	{
		if (s[i] >= 'a' && s[i] <= 'z')
			s[i] = 'A' + (s[i] - 'a');
		else if (s[i] >= 'A' && s[i] <= 'Z')
			s[i] = 'a' + (s[i] - 'A');
	}
	cout << s  << endl;
}



Measured memory_bytes: 3168
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
from collections import Counter as co
D=co(A)

cnt=0
for i in range(N):
  if D[A[-1-i]]>0:
    D[A[-1-i]]-=1
    d=A[-1-i]
    f=len(bin(d))-2
    e=2**f-d
    if D[e]>0:
      cnt+=1
      D[e]-=1
print(cnt)


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

int main(){

    int N, M;
    cin >> N >> M;

    int ltemp, rtemp, l = 0, r = 1e6;
    for (int i=0; i<M; i++){
        cin >> ltemp >> rtemp;
        l = max(l, ltemp);
        r = min(r, rtemp);

        if (r < l){
            cout << 0 << endl;
            return 0;
        }
    }

    int ans = r - l + 1;

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

Measured memory_bytes: 256
#nは枚数、yは金額
n,y=map(int,input().split())

for i in range(n+1):
    if i*10000>y:break
    for j in range(n-i+1):
        if i*10000+j*5000>y:break
        k=n-i-j
        if 10000*i+5000*j+1000*k==y:
            print(i,j,k)
            exit()

print(-1,-1,-1)



Measured memory_bytes: 40812
from itertools import permutations , combinations
a  = list(map(int , input().split()))
p = permutations(a,3)
ans = 999999999
for i in p:
    cost = 0
    for idx in range(1,3):
        cost += abs(i[idx] - i[idx-1])
    ans = min(cost , ans)
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] array = new char[3];
		for (int i = 0; i < 3; i++) {
			array[i] = sc.next().charAt(i);
		}
		System.out.println("" + array[0] + array[1] + array[2]);
	}
}

Measured memory_bytes: 21460
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace sandbox
{
    class Program
    {
        static void Main(string[] args)
        {
            var consoleReader = new ConsoleReader(Console.In);
            var N = consoleReader.Int;

            var items = consoleReader.Repeat(N).String
            .Select(x => new string(x.OrderBy(c => c).ToArray()))
            .GroupBy(x => x)
            .Select(g => (long)g.Count());
            long count = 0;

            foreach (var i in items)
            {
                if (i > 1)
                {
                    count += i * (i - 1) / 2;
                }
            }


            Console.WriteLine(count);
        }
    }

    class ConsoleReader
    {
        private Queue<string> queue = new Queue<string>();
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (queue.Count > 0) return queue.Dequeue();
                var line = textReader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 1; i < line.Length; i++) queue.Enqueue(line[i]);
                return line[0];
            }
        }
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}


Measured memory_bytes: 31996
def power(a, p, mod):
  res = 1
  pwr = a
  while p > 0:
    if p & 1:
      res = res * pwr % mod
    pwr = pwr * pwr % mod
    p >>= 1
  return res

mod = 10**9 + 7

l = [int(bit) for bit in input()]
bl = len(l)
inv3 = power(3, mod-2, mod)
pow2 = 1
pow3 = power(3, bl-1, mod)
count = 0

for i in range(bl-1):
  if l[i]:
    count = (count + pow2 * pow3) % mod
    pow2 = pow2 * 2 % mod
  pow3 = pow3 * inv3 % mod
if l[-1]:
  count = (count + pow2 * 3) % mod
else:
  count = (count + pow2) % mod

print(count)

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

#define int long long

#define pii pair<int, int>

#define x1 x1228
#define y1 y1228

#define left left228
#define right right228

#define pb push_back
#define eb emplace_back

#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   

#define matr vector<vector<int> > 

#define all(x) x.begin(), x.end()


using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;
const double eps = 1e-9;
const ll inf = 1e18;
mt19937 rnd(time(0));
int n;
string s; 
int binom[2][2]; 

int cnk(int n, int k) {
    int ans = 1; 
    for (int i = 0; i < 30; ++i) {
        ans *= binom[(n >> i) & 1][(k >> i) & 1]; 
    }
    return ans; 
}

bool check(vector<int> cur) {
    for (int i = 0; i < cur.size(); ++i) {
        if (cur[i] == 1) return false; 
    }
    for (auto &v : cur) {
        if (v == 2) v = 1; 
    }
    int res = 0; 
    /*
    for (auto v : cur) cout << v << " "; 
    cout << endl; 
    cout << "binom: "; 
    */
    for (int i = 0; i < (int)cur.size(); ++i) {
//        cout << cnk((int)cur.size() - 1, i) << " "; 
        res ^= cnk((int)cur.size() - 1, i) * cur[i]; 
    }
//    cout << endl; 
    return (res == 1); 
}

void solve() {
    cin >> n >> s; 
    vector<int> cur; 
    for (auto v : s) cur.pb(v - 'a'); 
    for (int i = 0; i < 1; ++i) {
        vector<int> t;         
        for (int j = 1; j < cur.size(); ++j) t.pb(abs(cur[j - 1] - cur[j])); 
        cur = t; 
    } 
    if (check(cur)) {
        cout << 2; 
        return; 
    } 
    for (auto &v : cur) {
        if (v == 2) v = 0; 
        else if (v == 1) v = 2; 
    }    
    if (check(cur)) {                 
        cout << 1; 
        return; 
    }
    cout << 0; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    binom[0][0] = 1; 
    binom[1][0] = 1; 
    binom[1][1] = 1;
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

Measured memory_bytes: 23568
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll w, h, x, y;
    cin>>w>>h>>x>>y;
    double area = (w/2.0)*h;
    cout<<area<<" ";
    if(2*x == w && 2*y == h)
        cout<<1<<endl;
    else cout<<0<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n, cnt=0;
    cin >> n;
    vector<int> vec(n);
    rep (i, n) cin >> vec[i];
    sort(all(vec));
    int start = vec.size() / 2 - 1;
    int end = vec.size() / 2;
    for(int i=vec[start]+1; i<=vec[end]; i++){
        cnt++;
    }
    out(cnt);
}

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


void swapcl(char &s) {
    if(s == '0') {
        s = '1';
    } else {
        s = '0';
    }
}

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

    int ans = 0;

    for (int i = 0; i < s.size()-1; i++) {
        if(s[i] == s[i+1]) {
            swapcl(s[i + 1]);
            ans++;
        }
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(long long i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
vct factors(ll x)
{
 vct v;
   for(ll i=2;i*i<=x;i++)
   {
     if(x%i==0)
     {
       v.pb(i);
       if(i!=x/i)
       {v.pb(x/i);}
     }
   }
   return v;
}
int main()
{
       ll n;
       cin>>n;
       vct fct = factors(n-1);
       ll ans = fct.size()+1;
       fct = factors(n);
       for(ll k : fct)
       {
              ll nn = n;
              while((nn%k)==0){
                     nn /= k;
              }
              if((nn%k)==1){
                     ans++;
              }
       }
       if(n==2){
              cout<<1<<endl;
              return 0;
       }
       cout<<ans+1<<endl;
}


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

int table [ 1000000 ] = { 0 };
int isprime(int x) {
  return table[x-1];
}


int main() {

  int a,d,n;
  for(int i=2; i<1000000; i++) {
    if(table[i-1] == 0) {
      for(int j=2; i*j<1000000; j++)
	table[i*j-1] = 1;
    }
  }
  table[0] = 1;

  while(true) {

    cin>>a>>d>>n;
    if( a==0 && d==0 && n==0 ) break;
    int count = 0, i = 0;
    while(true) {
      if( isprime(a+i*d) == 0 )
	count++;
      if( n==count ) {
	cout<<(a+i*d)<<endl;
	break;
      }

      i++;
    }

  }

}

Measured memory_bytes: 0
#include<iostream>
#include<cstring>
using namespace std;
int t[30];
int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	char ca;
	while(cin>>n){
		if(!n)break;
		memset(t,0,sizeof(t));
		a=27,b=28;
		for(i=0;i<n;i++){
			cin>>ca;
			c=(int)ca-(int)'A';
			t[c]++;
			if(t[c]>t[a]){b=a;a=c;}
			else if(c!=a && t[c]>t[b])b=c;
			if(t[a]>t[b]+n-i-1){
				c=i++;break;
			}
		}
		for(;i<n;i++)cin>>ca;
		if(t[a]==t[b])cout<<"TIE"<<endl;
		else cout<<(char)('A'+a)<<" "<<c+1<<endl;
	}
}



Measured memory_bytes: 3084
def partition(a,p,r):
    x = a[r]
    i = p - 1
    for j in range(p,r):
        if a[j] <= x:
            i += 1
            a[i],a[j] = a[j],a[i]
    a[i+1],a[r] = a[r],a[i+1]
    return i + 1    
n = input()
a = map(int, raw_input().split())
r = partition(a,0,n-1)
print " ".join(map(str,a[:r])) + " [" + str(a[r]) + "] " + " ".join(map(str,a[r+1:]))

Measured memory_bytes: 15632
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;

// int func(int num){

//     int sum = 0;
//     int i = 1;

//     while(num >= i*i){
//         if(num % i == 0){
//             if(num / i == i){
//                 sum += 1;
//             }
//             else{
//                 sum += 2;
//             }
//         }
//         i++;
//     }

//     return sum;
// }

// int main(){
    
//     int N = 0;

//     cin>>N;

//     int count = 0;

//     for(int i = 1; i < N; i++){
//         count += func(N - i);
//     }

//     cout<<count<<endl;
//     return 0;
// }

int main(){

    int n;

    cin>>n;

    int ans = 0;

    for(int i = 1; i < n; i++){
        ans += (n - 1) / i;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;

const ll MOD = 1000000000 + 7;
const ll INF = 1e+9;
const ld PI = acos((long double)(-1));

#define no "no"
#define No "No"
#define NO "NO"
#define yes "yes"
#define Yes "Yes"
#define YES "YES"
#define next '\n'
#define sp " "
#define print(x) cout << (x) << endl;
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define EPS 0.00000001

// 桁数を数える
ll countDigit(ll n){
    ll ans = 1;
    while(n / 10 != 0){
        n /= 10;
        ans++;
    }

    return ans;
}

ll f(ll a, ll b){
    return std::max(countDigit(a), countDigit(b));
}

int main() {
    FAST;

    ll n;
    cin >> n;

    ll ans = 10000000000 + 10;
    for(ll i = 1; i <= sqrt(n); ++i){
        ll j = n / i;
        if(n % i == 0){
            ans = std::min(ans, f(i, j));
        }
    }

    print(ans);
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int a,b; cin >> a  >>b;
    cout << a * b /2 << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

int main() {
    string s;
    cin >> s;
    for (size_t i = 1; i < s.size(); ++i) {
        if (s[i] == s[i - 1]) {
            cout << "Bad";
            return 0;
        }
    }
    cout << "Good";
}


Measured memory_bytes: 256
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table




def main():
    n = int(input())
    tmp = num_divisors_table(n + 2)
    ans = 0
    for i in range(1, n + 1):
        ans += tmp[i]*i
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 145852
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = MAP()

sm = 0
mn = INF
for i in range(N):
    a, b = A[i], B[i]
    if a > b:
        mn = min(mn, b)
    sm += b
if mn == INF:
    print(0)
    exit()
ans = sm - mn
print(ans)


Measured memory_bytes: 4596
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

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


int main(){
    int K, X;
    cin >> K >> X;
    if(K * 500 >= X)cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256