akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i <= (n); ++i)
#define repD(i, a, n) for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define MAXN 5000000
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
const long long mod = 1000000007;
int Ceil(int a, int b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}

int main(){
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int n;
    cin>>n;
    vector<int> v(n,0);
    for(int i = 0;i<n-1;i++){
        int x;
        cin>>x;
        v[x-1]++;
    }
    for(int i = 0;i<n;i++)
        cout<<v[i]<<endl;
    return 0;
}

Measured memory_bytes: 3996
#include <stdio.h>
 
int main (void){
    int score, bscore = -1, a_c;
    int h;
    int i, j, before;
    int del = -1;
    int f, e;
    while(1)
    {
        score = 0;
        bscore = -1;
        scanf("%d", &h);
        int a[h][5];
        if (h == 0) break;
        for (i = 0; i < h; i++) {
            a_c = 0;
            for (j = 0; j < 5; j++) {
                scanf("%d", &a[i][j]);
            }
        }
        while (score != bscore) {
            bscore = score;
            for (i = 0; i < h; i++){
                a_c = 0;
                del = -1;
                for (j = 0; j < 5; j++) 
                {
                    //printf("%d ", a_c);
                    if (j == 0) {
                        before = a[i][j];
                        a_c++;
                        f = j;
                    } else if (before == a[i][j]) {
                        a_c++;
                        //printf("%d ", a_c);
                    } else {
                        if (a_c >= 3 && before != -1) {
                            score += before * a_c;
                            del = before;
                            e = j;
                        }
                        a_c = 1;
                        before = a[i][j];
                        if(j <= 2){
                        	f = j;
                        }
                    }
                    if(j == 4) {
                        if (a_c >= 3 && before != -1) {
                            score += before * a_c;
                            del = before;
                            e = j;
                        }
                        a_c = 0;
                    }
                }
                for (j = 0; j < 5; j++) {
                    if(a[i][j]==del && j >= f && j <= e){
                        a[i][j]=-1;
                    }
                }
 
            }
 
 
 
/*
            printf("\n");
            for (i = 0; i < h; i++){
                for (j = 0; j < 5; j++) {
                    printf("%d ", a[i][j]);
                }
                printf("\n");
            }
*/
 
 
            int flag = 0, i_;
                for(j = 0; j < 5; j++){
                    flag = 0;
                    for(i = h-1; i >= 0; i--){
                        if(a[i][j] == -1){
                            int k = i - 1;
                            while(k >= 0){
                                if(a[k][j] != -1){
                                    a[i][j] = a[k][j];
                                    a[k][j] = -1;
                                    break;
                                }
                                k--;
                            }
                        }
                    }
                }
 
/*
            printf("\n");
            for (i = 0; i < h; i++){
                for (j = 0; j < 5; j++) {
                    printf("%d ", a[i][j]);
                }
                printf("\n");
            }
*/
 
        }
        printf("%d\n", score);
    }
    return 0;
}


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

int main (){

  int n;
  int sat=0;
  cin>>n;
  
  vector <int> a(n);
  vector <int> b(n);
  vector <int> c(n);
  
  for(int i=0 ; i<n ;i++){
  	cin>>a.at(i);
  }
  
  for(int i=0 ; i<n ;i++){
  	cin>>b.at(i);
  }
  
  for(int i=0 ; i<n ;i++){
  	cin>>c.at(i);
  }
  
   
  for(int i = 0; i < n;i++){
    sat+=b.at(a.at(i)-1);
    
    if((i > 0 )&&(a.at(i) - a.at(i-1) == 1)){
      sat+=c.at(a.at(i-1)-1);
    }
  }
  cout<<sat<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
typedef pair<int,int> P;
vector<int> G[N];
set<int> g[N];
int n;
int check(int a,int b){
  if(g[a].size() < 2) return 0;
  if(g[b].size() < 2) return 0;
  return 1;
}

int used[N];
int check2(int pos=0,int f=0){
  if(used[pos] != -1) return f != used[pos];
  used[pos] = f;
  for(int to:G[pos]) if(check2(to,!f)) return 1;
}

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

  vector<int> A(m),B(m);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b; a--,b--;
    A[i] = a, B[i] = b;
    G[a].push_back(b);
    G[b].push_back(a);
    g[a].insert(b);
    g[b].insert(a);
  }
  int flg = 0;
  for(int i=0;i<m;i++) flg |= check(A[i],B[i]);

  memset(used,-1,sizeof(used));
  if(flg == 0) cout << 0 << endl;
  else if(check2()) cout<<n*(n-1)/2 - m << endl;
  else {
    int cnt[2]={};
    for(int i=0;i<n;i++) cnt[used[i]]++;
    cout<<(cnt[0] * cnt[1]) - m <<endl;
  }

  
  return 0;
}


Measured memory_bytes: 23040
#include<stdio.h>
int main(void){
  int i,j,k;
  int N;
  int v;
  int a[200];
  scanf("%d",&N);
  for(i=0;i<N;i++)  scanf("%d",&a[i]);
  for(i=0;i<N-1;i++)  printf("%d ",a[i]);
  printf("%d\n",a[i]);
  for(i=1;i<=N-1;i++){
    //printf("\n");
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
      a[j+1]=v;
    }
    for(k=0;k<N-1;k++)  printf("%d ",a[k]);
    printf("%d\n",a[k]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	int cost;
} edge;

int main( void ){
	// initialize();
	int D, T, S;
	cin >> D >> T >> S;
	if (D <= T * S)
		cout << "Yes\n";
	else
		cout << "No\n";
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 3584
//ひとつの整数を読み込み、それを出力する
//整数が0の場合、入力の終わりを意味するためそれ以降の
//出力はしない
//各整数の出力は以下の形式
//Case i: x
//xが出力整数、iがデータセットの番号
//1 <= x <= 10000
//データセットiは10000を超えない

#include <iostream>
using namespace std;

int main()
{
	int x;
	int i;

	for (i = 1; i <= 10000; i++) {
		cin >> x;
		if (x == 0)
			break;
		cout << "Case " << i << ": " << x << '\n';

	}
	return 0;
}


Measured memory_bytes: 3056
#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<string>
#include<algorithm>

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, s, a) for (int i = s; i < a; i++)
#define llint long long int
using namespace std;

const int N_MAX = 505;
const llint INF = 999999999999999;

int main()
{
    int n, m, X, Y, x[105], y[105];


    cin >> n >> m >> X >> Y;
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];

    sort(x, x + n);
    sort(y, y + m);

    /*rep(i, n) cout << x[i] << ' ';
    cout << endl;
    rep(i, m)*/

    bool w = true;
    int z = x[n - 1] + 1;

    while (z <= y[0]){
        if (X < z && z <= Y) w = false;
        z++;
    }

    if (w) cout << "War";
    else cout << "No War";
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    
    public static int[] generatePrimes(int n) {
		boolean[] prime = new boolean[n + 1];
		Arrays.fill(prime, 2, n + 1, true);
		for (int i = 2; i * i <= n; i++)
			if (prime[i])
				for (int j = i * i; j <= n; j += i)
					prime[j] = false;
		int[] primes = new int[n + 1];
		int cnt = 0;
		for (int i = 0; i < prime.length; i++)
			if (prime[i])
				primes[cnt++] = i;
		return Arrays.copyOf(primes, cnt);
	}
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        
        HashSet<Integer> st = new HashSet<>();
        int n = in.nextInt();
        int x = 0, f = 0;
        for(int i=0;i<n;i++){
            x = in.nextInt();
            if(st.contains(x)) f=1;
            st.add(x);
        }
        if(f==0) out.write("YES\n");
        else out.write("NO\n");
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

#define fer( a , b , c ) for( register int a = b ; a <= c ; a ++ )
#define der( a , b , c ) for( register int a = b ; a >= c ; a -- )

  using namespace std ;

inline int read(){
	int sum = 0 , f = 1 ;
	char ch = getchar() ;
	while( ch < '0' || ch > '9' ){
		if( ch == '-' ){
			f = -1 ;
		}
		ch = getchar() ;
	}
	while( ch >= '0' && ch <= '9' ){
		sum = ( sum << 1 ) + ( sum << 3 ) + ( ch ^ 48 ) ;
		ch = getchar() ;
	}
	return sum * f ;
}

long long a , b , c , d , x , y ;

signed main(){
	cin >> a >> b >> c >> d ;
	cout << max( b * d , max( a * c , max( a * d , max( b * c , b * d ) ) ) ) ;
	return 0 ;
}



Measured memory_bytes: 3604
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;
  cin >> D;
  if (D == 25)
  cout << "Christmas";
  else if(D == 24)
  cout << "Christmas Eve";
  else if(D == 23)
  cout << "Christmas Eve Eve";
  else if(D == 22)
  cout << "Christmas Eve Eve Eve";
}

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

#define P(s) cout<<(s)<<"\n"

int main() {
    int32_t a, b, c;
    cin >> a >> b >> c;
    array<int32_t, 3> v{a, b, c}; 
    sort(v.begin(), v.end());

    auto cnt = 0;
    cnt += v[2] - v[1];
    v[0] += v[2] - v[1];
    cnt += (v[2] - v[0] + 1) / 2 + (v[2] - v[0]) % 2;

    P(cnt); 
}

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

int main() {
  char c;
  cin>>c;
  if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout<<"vowel"<<endl;
  }
  else {
    cout<<"consonant"<<endl;
  }
}


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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int main(void) {
	bool res = true;
	int pos = 2;
	int prime[100000] = {};
	prime[1] = 2;
	for(int i=3;i<=300000;i+=2){
		res = true;
		FOR(t, 2, sqrt(i)) {
			if (i%t == 0) {
				res = false;
				break;
			}
		}
		if (res) {
			prime[pos] = i;
			pos++;
		}
	}
	while (1) {
		int n;
		int first = 0;
		int last = 0;
		bool flag = true;

		cin >> n;
		if (n == 0) {
			break;
		}
		FOR(t, 1, pos - 1) {
			if (flag) {
				if (prime[t] >= n + 1) {
					first = t;
					flag = false;
				}
			}
			else {
				if (prime[t] > 2 * n) {
					last = t;
					break;
				}
			}
		}
		cout << last - first << endl;
	}
}


Measured memory_bytes: 3408
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N; cin >> N;
    int res = 0;
    res = N * N * N;
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    Map<String, Integer> map = new HashMap<>();
    int n = sc.nextInt();
    for(int i = 0; i < n; i++){
      String str = sc.next();
      if(!map.containsKey(str)){
        map.put(str, 0);
      }
      map.put(str, map.get(str) + 1);
    }
    int m = sc.nextInt();
    for(int i = 0; i < m; i++){
      String str = sc.next();
      if(!map.containsKey(str)){
        map.put(str, 0);
      }
      map.put(str, map.get(str) - 1);
    }
    int max = 0;
    for(int i : map.values()){
      max = max > i ? max : i;
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 0;
  cin >> N;

  int t = N, c = 0;
  while(t > 0) {
    c += t % 10;
    t = t / 10;
  }

  if (N % c == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int n,m;
char c[2010][2010];
int a[2010][2010];
int res=0;
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++) scanf("%s",&c[i]); 
	for (int i=0;i<n;i++)
	{
		int t=0;
		for (int j=0;j<m;j++)
		{
			a[i][j]+=t;
			if (c[i][j]=='.') t++;
			else t=0;
		} 
		t=0;
		for (int j=m-1;j>=0;j--)
		{
			a[i][j]+=t;
			if (c[i][j]=='.') t++;
			else t=0;
		}
	}
	for (int j=0;j<m;j++)
	{
		int t=0;
		for (int i=0;i<n;i++)
		{
			a[i][j]+=t;
			if (c[i][j]=='.') t++;
			else t=0;
		} 
		t=0;
		for (int i=n-1;i>=0;i--)
		{
			a[i][j]+=t;
			if (c[i][j]=='.') t++;
			else t=0;
		}
	}
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<m;j++)
		{
			if (c[i][j]=='#') continue;
			res=max(res,a[i][j]);
			//cout <<a[i][j]<<" ";
		}
		//cout <<"\n";
	}
	cout <<res+1;
	return 0;
} 

Measured memory_bytes: 19968
def binary_search(*, ok, ng, is_ok):
    while abs(ok - ng) > 1:
        mid = (ng + ok) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    from itertools import accumulate

    N, M = map(int, input().split())
    *A, = sorted(map(int, input().split()))

    acc = [0]
    for x in accumulate(A):
        acc.append(x)

    def count(h):
        ret = 0

        j = N
        for i in range(N):
            while j - 1 >= 0 and A[i] + A[j - 1] >= h:
                j -= 1
            ret += N - j
            # [j,N)の要素数

        return ret

    x = binary_search(ok=A[-1] * 2 + 1, ng=0, is_ok=lambda x: count(x) < M)
    # 幸福度の総和がX以上のペア数がM未満となる最大のX

    s = 0
    j = N
    for i in range(N):
        while j - 1 >= 0 and A[i] + A[j - 1] >= x:
            j -= 1
        s += A[i] * (N - j) + acc[N] - acc[j]
    s += (M - count(x)) * (x - 1)

    print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14260
import statistics
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    x[i] -= i+1

x.sort()
x_ = []
b = 0
if x.count(0) <= n//2:
    for i in range(n):
        if x[i] != 0:
             x_.append(x[i])

    b = statistics.median(x_)

ans = 0
for i in range(n):
    ans += abs(x[i] - b)

print(int(ans))

Measured memory_bytes: 27248
#include<iostream>
#include<cstdio>
#include<iomanip>
#include <math.h>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
	long long n, k;
	vector<long long> h(200005);
	long long count = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> h[i];
	
	sort(h.begin(), h.end(), greater<long long>());
	for (int i = k; i < n; i++)count = count + h[i];
	cout << count << endl;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+123;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


void _case()
{
    ll n,i,j,k,ans=0;
    cin>>n;
    n--;
    for(i=1;i<=n;i++) {ans+=(n/i);}
    cout<<ans el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3652
fun main(args: Array<String>) {
    val N = nextInt()
    val S = Array(N) { next() }
    val Ch = Array(N) { IntArray(26) }
    val Co = IntArray(26)
    S.forEachIndexed { n, s ->
        s.forEach { ch -> Ch[n][ch - 'a'] += 1 }
    }
    for (n in Co.indices) {
        var min = Int.MAX_VALUE
        for (m in Ch.indices) min = Math.min(min, Ch[m][n])
        Co[n] = min
    }
    val ans = StringBuilder()
    Co.forEachIndexed { offset, count ->
        if (count > 0) ans.append(("" + ('a' + offset)).repeat(count))
    }
    println(ans.toString())
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 36212
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int n;

vector<int>graph[106];
int par[106];
LL degree[106],level[106];

void dfs(int u,int pp)
{
    LL dd=0;
    dd=graph[u].size();
    if(pp!=-1)dd--;
    if(dd==0)dd++;
    degree[level[u]]=max(degree[level[u]],dd);
    for(int i=0;i<graph[u].size();i++)
    {
        int v=graph[u][i];
        if(v==pp)continue;
        par[v]=u;
        level[v]=level[u]+1;
        dfs(v,u);
    }
}

int main()
{
    scanf("%d",&n);
    int x,y;
    for(int i=1;i<n;i++)
    {
        scanf("%d %d",&x,&y);
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    dfs(1,-1);
    int root=-1,mxl=0;
    for(int i=1;i<=n;i++)
    {
        if(level[i]>mxl)
        {
            root=i;
            mxl=level[i];
        }
    }
    level[root]=0;
    dfs(root,-1);
    mxl=0;
    int xx;
    for(int i=1;i<=n;i++)
    {
        if(level[i]>mxl)
        {
            xx=i;
            mxl=level[i];
        }
    }

    if(mxl%2)
    {
        int now=xx;
        while(level[now]!=(mxl+1)/2)
        {
            now=par[now];
        }
        x=now;
        y=par[now];
        memset(degree,0,sizeof degree);
        level[x]=level[y]=0;
        dfs(x,y);
        dfs(y,x);
        LL ans=2,ans2=(mxl+1)/2;
        for(int i=0;i<ans2;i++)ans*=degree[i];
        printf("%lld %lld\n",ans2,ans);
        return 0;
    }
    LL ans=1,ans2=(mxl/2)+1;
    int now=xx;
    while(level[now]!=mxl/2)
    {
        now=par[now];
    }
    x=now;
    memset(degree,0,sizeof degree);
    level[x]=0;
    dfs(x,-1);
    for(int i=0;i<ans2;i++)ans*=degree[i];
    LL temp;
    for(int i=0;i<graph[x].size();i++)
    {
        int y=graph[x][i];
        memset(degree,0,sizeof degree);
        level[x]=level[y]=0;
        dfs(x,y);
        dfs(y,x);
        temp=2;
        for(int i=0;i<ans2;i++)temp*=degree[i];
        ans=min(ans,temp);
    }
    printf("%lld %lld\n",ans2,ans);
    return 0;
}


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

using namespace std;
int main()

{
int a,b,c;
cin >> a >> b >> c;
      int ans;
 
      if(a == b&& b  == c){
            ans =1;
      }else if((a == b && b != c)||(b == c && c != a) || ( a == c && c != b)){
            ans = 2;
      }else{
            ans = 3;
      }
      cout << ans << endl;
  return 0;
}

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

int main() {
  int n, k;
  cin>>n>>k;
  int a[n];
  for (int i=0; i<n; i++) cin>>a[i];
  vector<long long> v;
  for (int i=0; i<n; i++) {
    long long sum = 0;
    for (int j=i; j<n; j++) {
      sum += a[j];
      v.push_back(sum);
    }
  }
  for (int i=62; i>=0; i--) {
    vector<long long> nv;
    for (long long vi: v) {
      if ((vi >> i) & 1) {
        nv.push_back(vi);
      }
    }
    if (nv.size() >= k) {
      v = nv;
    }
  }
  long long ans = v[0];
  for (int i=1; i<v.size(); i++) {
    ans = ans & v[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6384
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 二項係数計算
long long COM(ll n, ll k)
{
    ll s = 1;
    rep(i, k)
    {
        s = s * (n - i) % MOD;
    }
    reps(i, 1, k + 1)
    {
        s = s * modinv(i, MOD) % MOD;
    }
    return s;
}

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

void solve()
{
    IN(n, a, b);
    ll s = 0;
    cout << (modpow(2, n, MOD) - COM(n, a) - COM(n, b) - 1 + MOD * 2) % MOD << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

using namespace std;

int main(){
  int N; cin >> N;
  vector<long> a(N); for(int i = 0; i<N;i++)cin >> a[i];
  vector<long> b = a;
  
  long ans = 0;
  for(int i = 1; i<N;i++){
    if(a[i]<a[i-1])a[i]=a[i-1];
    ans += a[i]-b[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6400
#include <iostream>
using namespace std;
int main(void) {
	int h, n, i, a[100000], total = 0;
	cin >> h >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}
	if (total >= h) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

#define ___ ios::sync_with_stdio(0),  cin.tie(0);
#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){___
  char c; cin >> c;
  if(c<='Z')  printf("A\n");
  else printf("a\n");
  return 0;
}

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

int main()
{
	long long int x;
	cin >> x;
	int ans = 0;
	long long int money = 100;
	while(money < x){
		money = (long long int)(money * 1.01);
		++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main{

    public static void main(String[] ards){
        Scanner sc = new Scanner(System.in);
        while(true){
            int x = sc.nextInt();
            int y = sc.nextInt();

            if(x==0 && y==0){break;}

            if(x>y){
                int[] a = new int[1];
                int[] b = new int[1];
                int temp;
                a[0]=x;b[0]=y;
        
                temp = a[0];
                a[0] = b[0];
                b[0] = temp;

                x=a[0];y=b[0];

            }
            System.out.println(x + " " + y);
        }
    }
}



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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

ll N, M;

ll dx[4] = {1, -1, 0, 0};
ll dy[4] = {0,  0, 1,-1};

vector<vector<ll > > G;
 
vector<vector<ll > > bfs(){
    //準備
    vector<vector<ll > > dist(N, vector<ll >(M, -1));
    queue<pi> que;
    //初期化
    dist[0][0] = 0;
    que.push(make_pair(0, 0));
 
    while(!que.empty()){
        ll from_y = que.front().first;
        ll from_x = que.front().second;
        que.pop();
 
        for(ll i = 0; i < 4; i++){
            if(from_y + dy[i] >= 0 && from_y + dy[i] < N && from_x + dx[i] >= 0 && from_x + dx[i] < M){
                ll to_y = from_y + dy[i];
                ll to_x = from_x + dx[i];
                //壁がある時
                if(G[to_y][to_x] == -1 || dist[to_y][to_x] != -1) continue;
 
                dist[to_y][to_x] = dist[from_y][from_x] + 1;
                que.push(make_pair(to_y, to_x));

            }
        }
    }

    return dist;
}

int main() {

    cin >> N >> M;
    G.assign(N, vector<ll >());

    ll cn = 0;
    for(ll row = 0; row < N; row++){
        for(ll col = 0; col < M; col++){
            char t; cin >> t;
            if(t == '.'){
                G[row].push_back(0);
            }else{
                G[row].push_back(-1);
                cn++;
            }
        }
    }

    vector<vector<ll > > dist = bfs();

    if(dist[N-1][M-1] == -1){
        cout << -1 << endl;
        return 0;
    }

    ll ans = N * M - (dist[N-1][M-1] + 1) - cn;

    cout << ans << endl;


}

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

int main(void){
    string s; cin >> s;
    for(int i=0;i<s.length();i++){
        if(i%2==0){
            if(s[i]!='R' and s[i]!='U' and s[i]!='D'){
                cout << "No" << endl;
                return 0;
            } 
        }else{
            if(s[i]!= 'L' and s[i]!='U' and s[i]!='D'){
                cout << "No" << endl;
                return 0;
            } 
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;
#define int long long
int32_t main()
{
  int t,a,b,c,i,j,k;
   cin>>a>>b>>c>>k;
   if(k<=a)
    cout<<k;
   else if((a+b)>=k)
    cout<<a;
   else
   {
     k=k-(a+b);
     cout<<a-k;
   }
    return 0;
}


Measured memory_bytes: 3624
N=int(input())
*H,=map(int,input().split())
RH=H[::-1]

ans='Yes'
i=0
while i+1<=N-1:
    if RH[i+1]-RH[i]==1:
        RH[i+1]-=1
    elif RH[i+1]-RH[i]>=2:
        ans='No'
    i+=1

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
    int d,t,s;
    cin>>d>>t>>s;
if(float(s)>=float(d)/t)
cout<<"Yes"<<endl;
else
{
    cout<<"No"<<endl;
}

    return 0;
}

Measured memory_bytes: 3632
N = int(input())
s = input()
mod = 10**9+7

dp = [[0] * N for _ in range(N)]
dp[0][0] = 1
for i in range(N-1):
    prev_cs = [0] * (N+1)
    for j in range(N):
        prev_cs[j+1] = (prev_cs[j] + dp[i][j]) % mod
    if s[i] == '>':
        for j in range(i+2):
            dp[i+1][j] = (prev_cs[-1] - prev_cs[j]) % mod
    else:
        for j in range(i+2):
            dp[i+1][j] = prev_cs[j]

ans = 0
for x in dp[-1]:
    ans = (ans + x) % mod
print(ans)


Measured memory_bytes: 114652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	int [] ans_ar; 
	public static void main(String[] args) {
		new Thread(null, new Main(), "", 32 * 1024 * 1024).start(); //
	}
	public void run() {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int ans = 0;
		int[] b = new int[n];
		for (int i = 0; i < n-1; i++) {
			b[i+1] = Integer.parseInt(sc.next());
		}
		b[0] = 100000;
		for (int i = 0; i < n-1; i++) {
			ans += Math.min(b[i],b[i+1]);
		}
		ans += b[n-1];

		out.println(ans);
		out.flush();
	}


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    string s;
    cin >> s;
    int r = 0;
    if(s[0]=='1')r++;
    if(s[1]=='1')r++;
    if(s[2]=='1')r++;
    cout << r << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ');
            var n = int.Parse(inputs[0]);
            var m = int.Parse(inputs[1]);
            var matrix = new int[n][];
            for (int i = 0; i < n; i++)
            {
                matrix[i] = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            }
            var vectorB = new int[m];
            for (int i = 0; i < vectorB.Length; i++)
            {
                vectorB[i] = int.Parse(Console.ReadLine());
            }

            for (int i = 0; i < n; i++)
            {
                var result = 0;
                for (int j = 0; j < m; j++)
                {
                    result += matrix[i][j] * vectorB[j];
                }
                Console.WriteLine(result);
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 5892
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;


int main(){
	int N,M,P;
	while(cin>>N>>M>>P,N){
		int a,sum=0,win;
		REP(i,0,N){
			cin>>a;
			if(i+1==M) win=a;
			sum+=a*100;
		}
		sum*=100-P;
		sum/=100;
		if(win==0) cout<<"0"<<endl;
		else cout<<sum/win<<endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include "bits/stdc++.h"
using namespace std;

int N, K;
const int mod = 1e9 + 7;
int a[105], cumul[105];
long long dp[105][100005];

// dp[n][c] = num of ways to dist exactly c candies among [0...n] kids

long long rec(int n, int c)
{
    if (dp[n][c] != -1)
        return dp[n][c];

    if (n == 0)
    {
        if (c <= a[0])
            return dp[n][c] = 1;
        else
            return dp[n][c] = 0;
    }

    if (c > cumul[n])
        return dp[n][c] = 0;

    if (c - a[n] - 1 >= 0)
        dp[n][c] = rec(n, c - 1) + rec(n - 1, c) - rec(n - 1, c - a[n] - 1) + mod;
    else
        dp[n][c] = rec(n, c - 1) + rec(n - 1, c);

    dp[n][c] %= mod;
    return dp[n][c];
}

int main()
{
    cin >> N >> K;
    for (int i = 0; i < N; i++)
        cin >> a[i];

    cumul[0] = a[0];
    for (int i = 0; i < N; i++)
        cumul[i] = cumul[i - 1] + a[i];

    for (int i = 0; i < N; i++)
        for (int j = 0; j <= K; j++)
            dp[i][j] = -1;

    long long ans = rec(N - 1, K);
    cout << ans << endl;
    return 0;
}

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

ct = [0 for i in range(N)]
for i in range(N):
    A[i] -= 1
    ct[A[i]]+= 1

allct = 0
for i in range(N):
    allct += ct[i]*(ct[i]-1)//2

for i in range(N):
    print(allct - ct[A[i]] + 1)

Measured memory_bytes: 24748
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;

const int MAXN = (int) 2e5;

char str[MAXN + 1];


int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int n, i;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> str + 1;
    n = strlen(str + 1);

    int cnta = 0;
    ll ans = 0;
    i = 1;
    while(i <= n) {
        if(str[i] == 'A') {
            cnta++, i++;
            continue;
        }
        if(i < n && str[i] == 'B' && str[i + 1] == 'C') {
            ans += cnta;
            i += 2;
        }
        else {
            cnta = 0;
            i++;
        }
    }
    cout << ans;

    return 0;
}



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

int main() {
	string S, T, U;
	int A, B;
	cin >> S >> T;
	cin >> A >> B;
	cin >> U;

	if (S == U) A--;
	else B--;
	cout << A << endl;
	cout << B << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005

struct Edge{

	int from,to;
	ll A,B;
};

struct Info{
	Info(int arg_to,int arg_index){
		to = arg_to;
		edge_index = arg_index;
	}
	int to,edge_index;
};

struct State{
	State(int arg_node_id,double arg_sum_dist){
		node_id = arg_node_id;
		sum_dist = arg_sum_dist;
	}
	bool operator<(const struct State &arg) const{

		return sum_dist > arg.sum_dist; //総距離の昇順(PQ)
	}

	int node_id;
	double sum_dist;
};

int N,M,start,goal;
double min_dist[SIZE];
Edge edge[SIZE];
vector<Info> G[SIZE];

int main(){

	scanf("%d %d %d %d",&N,&M,&start,&goal);
	start--;
	goal--;

	for(int i = 0; i < M; i++){

		scanf("%d %d %lld %lld",&edge[i].from,&edge[i].to,&edge[i].A,&edge[i].B);
		edge[i].from--;
		edge[i].to--;
		G[edge[i].from].push_back(Info(edge[i].to,i));
		G[edge[i].to].push_back(Info(edge[i].from,i));
	}

	for(int i = 0; i < N; i++){

		min_dist[i] = DBL_MAX;
	}

	min_dist[start] = 0;

	priority_queue<State> Q;
	Q.push(State(start,0));

	while(!Q.empty()){

		if(Q.top().sum_dist > min_dist[Q.top().node_id]+EPS){

			Q.pop();

		}else if(Q.top().node_id == goal){

			printf("%.0lf\n",Q.top().sum_dist);
			return 0;

		}else{

			for(int i = 0; i < G[Q.top().node_id].size(); i++){

				int next = G[Q.top().node_id][i].to;
				int index = G[Q.top().node_id][i].edge_index;
				ll A = edge[index].A;
				ll B = edge[index].B;

				double base = sqrt(B)-A;
				double next_dist;

				if(base <= Q.top().sum_dist){

					next_dist = ceil(Q.top().sum_dist+(B/(Q.top().sum_dist+A)));

				}else{

					next_dist = ceil(base+(B/(base+A)));
				}

				if(min_dist[next] > next_dist){
					min_dist[next] = next_dist;
					Q.push(State(next,next_dist));
				}
			}

			Q.pop();
		}
	}

	printf("-1\n");

	return 0;
}



Measured memory_bytes: 26700
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
int main(){
  ll n;cin >> n;
  vl v=divisor(n);
  unordered_set<ll> ans;
  vl ddd=divisor(n-1);
  for(auto x:ddd){
    if(x==1)continue;
    ans.ins(x);
  }
  rep(i,v.size()){
    ll y=v[i];
    if(y==1)continue;
    ll m=n;
    while(m%y==0){
      m/=y;
    }
    if(m%y==1){
      ans.ins(y);
    }
  }
  cout << ans.size() <<endl;
}


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

int main() {
    int x, y, s, ans;
    while(1){
        ans = 0;
        cin >> x >> y >> s;
        if(x==0) break;
        for(int i=1; i<s; i++){
            for (int j=1; j<s; j++){
                int a = i*(100+x)/100;
                int b = j*(100+x)/100;
                if(a+b==s){
                    ans = max(ans, i*(100+y)/100+j*(100+y)/100);
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, a, b, N = 1e5+1;
    vector<vector<pii>> cnt(2, vector<pii>(N));
    fore(i,0,N) {
        cnt[0][i] = cnt[1][i] = {0, i};
    }
    cin >> n;
    fore(i,0,n) {
        cin >> a;
        cnt[i&1][a].F++;
    }
    sort(cnt[0].rbegin(), cnt[0].rend());
    sort(cnt[1].rbegin(), cnt[1].rend());
    int ans = 0;
    if (cnt[0][0].S != cnt[1][0].S) {
        ans = n-cnt[0][0].F-cnt[1][0].F;
    } else {
        a = n-cnt[0][0].F-cnt[1][1].F;
        b = n-cnt[0][1].F-cnt[1][0].F;
        ans = min(a, b);
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll r,x,d;

int main(){
  cin >> r >> d >> x;
  for(ll i = 0;i < 10;i++){
    x = r*x-d;
    cout << x << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  string s,t;
  cin >> s >> t;
  cout << t << s << endl;
}

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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	int dx = tx - sx;
	int dy = ty - sy;

	cout << string( dy, 'U' ) << string( dx, 'R' );
	cout << string( dy, 'D' ) << string( dx, 'L' );
	cout << 'L' << string( dy+1, 'U' ) << string( dx+1, 'R' ) << 'D';
	cout << 'R' << string( dy+1, 'D' ) << string( dx+1, 'L' ) << 'U';
}


Measured memory_bytes: 256
function Main(input) {
  var inputs = input.split(" ");
  var headnum = parseInt(inputs[1][0], 10);
  var a = parseInt(inputs[0], 10);
  var b = parseInt(inputs[1], 10);
  var cnt = 0;
  for (var i = 1; i <= headnum; i++) {
    for (var j = 0; j <= 9; j++) {
      for (var k = 0; k <= 9; k++) {
        var pn = i * 10000 + j * 1000 + k * 100 + j * 10 + i;
        if (pn >= a && pn <= b) cnt++;
      }
    }
  }
  console.log(cnt);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	printf("%d %d %d\n", c, a, b);
	return 0;
}

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

int main(){
	int N, X;
	cin >> N >> X;
	int L[N];
	for(int i=0;i<N;i++){
		cin >> L[i];
	}
	int D[N+2];
	D[0] = 0;
	for(int i=1;i<N+2;i++){
		D[i] = D[i-1] + L[i-1];
	}
	for(int i=0;i<N+2;i++){
		if(D[i] > X){
			cout << i << endl;
			break;
		}
		if(i==N+1) cout << N+1 << endl;
	}
}

Measured memory_bytes: 256