akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

struct Card
{
    char suite, value;
};

void bubble(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        for (int j = N - 1; j >= i + 1; j--)
        {
            if (A[j].value < A[j - 1].value)
            {
                Card t = A[j];
                A[j] = A[j - 1];
                A[j - 1] = t;
            }
        }
    }
}

void selection(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        int minj = i;
        for (int j = i; j < N; j++)
        {
            if (A[j].value < A[minj].value)
                minj = j;
        }
        Card t = A[i];
        A[i] = A[minj];
        A[minj] = t;
    }
}

void print(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        if (i > 0)
            cout << " ";
        cout << A[i].suite << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N)
{
    for (int i = 0; i < N; i++)
    {
        if (C1[i].suite != C2[i].suite)
            return false;
    }
    return true;
}

int main()
{
    Card C1[100], C2[100];
    int N;
    char ch;

    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> C1[i].suite >> C1[i].value;
    }

    for (int i = 0; i < N; i++)
        C2[i] = C1[i];

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;

    print(C2, N);
    if (isStable(C1, C2, N))
    {
        cout << "Stable" << endl;
    }
    else
    {
        cout << "Not stable" << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
implicit none
integer :: k,s,count,y,x
read(5,*) k,s
count=0

do y = 0, k
do x = 0, k
   if (x + y <= s + k .and. s-x-y>=0 .and. s-x-y<=k) then
      count=count+1
   endif
enddo
enddo
write(6,"(i0)") count
end


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
//#define N 100005
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define mp make_pair
#define INF 9223372036854775807
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

signed main() 
{
    speed;
    //freopen("input.tXt","r",stdin);
    //freopen("output.tXt","w",stdout);

    int N,W;
    cin>>N>>W;
    int dp[N+1][W+1];
    memset(dp,0,sizeof(dp));
    map<int,pii> m;
    for(int i=1;i<=N;i++)
    {
        int w,v;
        cin>>w>>v;
        m[i]={w,v};
    }
    for(int i=1;i<=N;i++)
    {
        int ww=m[i].FF;
        int v=m[i].SS;
        for(int w=1;w<=W;w++)
        {
            dp[i][w]=dp[i-1][w];
            if(w>=ww) dp[i][w]=max(v+dp[i-1][w-ww],dp[i][w]);
        }
    }
    cout<<dp[N][W]<<endl;
}   

Measured memory_bytes: 82420
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include<sstream>
#include <vector>
#include <set>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define PI 3.14159265358979323846264338327950L

#define INF 0x3f3f3f3f
//const int N = 2e5 + 5;

 
 
int a[200010];

int32_t  main() {

	IOS;
  
	int N;
	cin >> N;

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

		int tmp;

		cin >> tmp;
		
		a[tmp]++;

	}


	 

	for (int i = 1; i <= N; i++) {
		cout << a[i] << endl;
	}
}

Measured memory_bytes: 4676
import math
def main():
    L = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())

    hoge = math.ceil(A / C)
    fuga = math.ceil(B / D)

    if hoge >= fuga:
        print(L - hoge)
    else:
        print(L - fuga)


if __name__ == "__main__":
    main()

Measured memory_bytes: 7840
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100005
#define INF 1000000005
#define PI 3.1415926535897
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 998244353;
vector<int>to[N];
vector<int>d(N,INF);
int main(){
    int n,m;
    cin>>n>>m;
    REP(i,m){
        int x,y;
        cin>>x>>y;
        x--;y--;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    vector<int>prev(n);
    
    queue<int> q;
    d[0]=0;
	q.push(0);
    while(SZ(q)){
        int a=q.front();
        q.pop();
        for(auto s:to[a]){
            if(d[s]>d[a]+1){
                d[s]=d[a]+1;
                prev[s]=a;
                q.push(s);
            }
        }
    }
    OUT("Yes");
    for(int i=1;i<n;i++){
        OUT(prev[i]+1);
    }    return 0;
}

Measured memory_bytes: 10620
#include<stdio.h>
int main(){
int X;
int A;
  scanf("%d",&X);
  scanf("%d",&A);
 if(X<0){
    goto theend;
    }else if(X>10){
    goto theend;
  }else{
  }
if(A<0){
  goto theend;
    }else if(A>10){
  goto theend;
  }else{
}
  if(X>=A){
  printf("10");
  }else{
  printf("0");
  }
  
  theend:
;
}

Measured memory_bytes: 128
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

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

fn main() {
    input! {
        s: String,
    }
    for i in (0..s.len()).rev() {
        if &s[..i / 2] == &s[i / 2..i] {
            println!("{}", i);
            break;
        }
    }
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; i++)
#define repn(i, st, ed) for(ll i=st; i<=ed; i++)
#define repb(i, ed, st) for(ll i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

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



// Main Code



int main()
{
	int n, q;
	cin>>n>>q;
	int s[n], t[n], x[n];
	rep(i, 0, n) cin>>s[i]>>t[i]>>x[i];
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int,int>>> pq;
	rep(i, 0, n)
	{
		pq.push({t[i] - x[i], -n - i - 1});
		pq.push({s[i] - x[i], -i-1});
	}
	int d[q];
	rep(i, 0, q)
	{
		cin>>d[i];
		pq.push({d[i], i});
	}
	set<ll> ss;
	ll ans[q];
	while(!pq.empty())
	{
		auto p = pq.top();
		pq.pop();
		if(p.s < -n)
		{
			ll id = -(p.s + n + 1);
			ss.erase(x[id]);
		}
		else if(p.s < 0)
		{
			ll id = -(p.s + 1);
			ss.insert(x[id]);
		}
		else
		{
			if(ss.empty())
				ans[p.s] = -1;
			else
				ans[p.s] = *begin(ss);
		}
	}
	rep(i, 0, q)
		cout<<ans[i]<<endl;
}


Measured memory_bytes: 21480
#include <stdio.h>
int t[10];
int T[3];
int main(void){
  int i,j,work;
  for(i=0;i<10;i++){
    scanf("%d",&t[i]);
  }
  for(i=0;i<3;i++){
    work=0;
    T[i]=t[0];
    for(j=1;j<10;j++){
      if(T[i]<t[j]){
        T[i]=t[j];
        work=j;
      }
    }
    t[work]=0;
  }
  printf("%d\n%d\n%d\n",T[0],T[1],T[2]);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define int long long
#define P pair<int,int>

int n,x;
int tot[55],pat[55];

int dfs(int N, int X){
    if(N == 0) {
        if(X <= 0) return 0;
        else return 1;
    }
    else if(X <= tot[N-1] + 1) return dfs(N-1,X-1);
    else return pat[N-1] + 1 + dfs(N-1,X - tot[N-1] - 2);
}

signed main() {
    cin >> n >> x;

    tot[0] = 1;
    pat[0] = 1;
    for(int i = 1; i <= n; i++){
        tot[i] = tot[i-1] * 2 + 3;
        pat[i] = pat[i-1] * 2 + 1;
    }
    cout << dfs(n,x) << endl;
}


Measured memory_bytes: 256
# vim: fileencoding=utf-8


def main():
    N = int(input())
    ans = [0] * N
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                t = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x - 1
                if t >= len(ans):
                    break
                ans[t] += 1

    print(*ans)


if __name__ == "__main__":
    main()


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

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int ar[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k; --k;
    cout << ar[k] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

// #define int long long
using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
  for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
  os << "]";
  return os;
}

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

//const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
  int h,w,ch,cw,dh,dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--; cw--; dh--; dw--;
  
  string s[h];
  for(auto &i : s) cin>>i;
  
  vector<vector<int>> mp(h, vector<int>(w,MOD));
  
  deque<P> Q;
  
  Q.push_back( {ch,cw} );
  
  mp[ch][cw] = 0;
  
  while( !Q.empty() ){
    P p;
    p = Q.front();
    Q.pop_front();
    for(int i=0;i<4;i++){
      int ny = p.first + dy[i];
      int nx = p.second + dx[i];
      if( !isIn(nx,ny,w,h) ) continue;
      if(s[ny][nx] != '.') continue;
      if( mp[ny][nx] > mp[p.first][p.second] ){
        mp[ny][nx] = mp[p.first][p.second];
        Q.push_front({ny,nx});
      }
    }
    for(int i=-2;i<=2;i++){
      for(int j=-2;j<=2;j++){
        int ny = p.first+i;
        int nx = p.second+j;
        if( !isIn(nx,ny,w,h) ) continue;
        if(s[ny][nx] != '.')continue;
        if( mp[ny][nx]>mp[p.first][p.second] ){
          mp[ny][nx] =mp[p.first][p.second]+1;
          Q.push_back({ny,nx});
        }
      }
    }
  }
  if( mp[dh][dw] == MOD ){
    cout << -1 << endl;
  } else {
    cout << mp[dh][dw] << endl;
  }
  return 0;
}



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

const ll mod = 1000000007;

bool isprime(ll n){
	if(n == 2) return true;
	else{
		for (int i = 2; i*i <= n; ++i) {
			if(n % i == 0) return false;
		}
	}
	return true;
}

int main(){
	ll n;
	cin >> n;
	vector<ll> prime;
	ll ans = 1;
	vector<ll> div(n+1);
	for (int i = 2; i <= n; ++i) {
		if(isprime(i)) prime.push_back(i);
	}
	for(auto p : prime){
		ll count = 0;
		for (int i = 2; i <= n; ++i) {
			if (i % p != 0) continue;
			ll temp = i;
			while (temp > 0 && temp % p == 0) {
				temp /= p;
				count++;
			}
		}
		ans *= (count + 1) % mod;
		ans %= mod;
	}
	cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 3648
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace AtCoder {
    class MainClass {
        public static void Main(string[] args) { new MainClass().solve(); }

        Scanner cin = new Scanner();

        int N, K;
        void solve() {
            N = cin.nextInt();
            K = cin.nextInt();

            long ans = K;
            for (int i = 1; i < N; i++)
                ans *= K - 1;

            Console.WriteLine(ans);

        }
        class Scanner {
            string[] nextBuffer; int BufferCnt; char[] cs = new char[] { ' ' };
            public Scanner() { nextBuffer = new string[0]; BufferCnt = 0; }
            public string next() {
                if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                BufferCnt = 0;
                return nextBuffer[BufferCnt++];
            }
            public int nextInt() { return int.Parse(next()); }
            public long nextLong() { return long.Parse(next()); }
            public double nextDouble() { return double.Parse(next()); }
        }
        class Mathf {
            private int mod = 1000000007;//10^9+7
            public int Mod { get; set; }
            public Mathf() { }
            public Mathf(int mod) { this.mod = mod; }
            public long Pow(long a, long b) {
                if (b == 0) return 1;
                if (b % 2 == 1) return (a % mod * Pow(a % mod, b - 1) % mod) % mod;
                else return Pow(a * a % mod, b / 2) % mod;
            }
            public long Fact(long n) { return n != 0 ? (n % mod * (Fact(n - 1) % mod) % mod) : 1; }
            public long C(long n, long r) {if (r == 0 || n == r) return 1;
                else return (Fact(n) % mod * Pow((Fact(n - r) % mod * Fact(r) % mod) % mod, mod - 2) % mod) % mod;}
        }
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
int main(void){
int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(c>b&&b>a){       
 printf("%d %d %d\n",a,b,c);
    } 
   if(b>c&&c>a){    
    printf("%d %d %d\n",a,c,b);
    } 
   if(c>a&&a>b){        
     printf("%d %d %d\n",b,a,c);
    } 
   if(a>c&&c>b){       
       printf("%d %d %d\n",b,c,a);
    }
    if(a>b&&b>c){ 
       printf("%d %d %d\n",c,b,a);
    } 
   if(b>a&&a>c){
        printf("%d %d %d\n",c,a,b);
    }
    if(c==b&&b<a){
        printf("%d %d %d\n",b,b,a);
    }
    if(b==a&&a<c){ 
       printf("%d %d %d\n",a,a,c);
    } 
   if(a==c&&c<b){ 
       printf("%d %d %d\n",c,c,b); 
   } 
   return 0;
    }


Measured memory_bytes: 2036
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            int val = 0;
            foreach (var c in N.ToString())
            {
                val += int.Parse(c.ToString());
            }

            if (N % val == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main()
{
  int n;
  int64_t ans = 0;
  cin >> n;
  vector<int64_t> A(n);
  map<int64_t, int64_t> d;
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    A[i] = a;
    if (d.count(a))
      ++d[a];
    else
      d[a] = 1;
  }

  for (auto dd : d)
  {
    ans += dd.second * (dd.second - 1) / 2;
  }

  for (int i = 0; i < n; ++i)
  {
    int64_t val = d[A[i]];
    int64_t before = val * (val - 1) / 2;
    int64_t after = (val - 1) * (val - 2) / 2;
    cout << ans - before + after << "\n";
  }
}

Measured memory_bytes: 11008
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String ss = sc.next();
		long sum = 0;
		long count = 0;
		boolean flg = true;
		
		long st_num=0;
		
		for(int i=0;i<ss.length();i++){
			if( ss.charAt(i) == '<' ){
				if (flg){
					count++;
				}else{
					sum+=count*(count-1)/2 + Math.max(count-st_num,0);
					st_num=0;
					count=1;
				}
				flg=true;
			}else if(ss.charAt(i) == '>'){
				if(flg){
					sum+=(1+count)*count/2;
					st_num=count;
					count=1;
				}else{
					count++;
				}
				flg=false;
			}
		}
		
		if(flg){
			sum+=(1+count)*count/2;
		}else{
			sum+=count*(count-1)/2 + Math.max(count-st_num,0);
		}
		
		
		System.out.print(sum);
	}
}

Measured memory_bytes: 29884
#include<bits/stdc++.h>
 using namespace std;
 
#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0)
#define mod                     1000000007
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define eps                     1e-6
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
typedef  long long                   ll;
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  unordered_map<int, int>    mii;
typedef  vector<ll>                 vll;
typedef  long double                 ld;


int main()
{
  FIO;
 /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
  #endif */
  
  int a,b;
  cin>>a>>b;
  if(abs(a-b)>1)
    cout<<":(";
  else
    cout<<"Yay!";

 return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n,d;
  cin >> d >> n;
  int div = 1;
  rep(i,d) div *= 100;
  if(n==100) n++;
  cout << div*n << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> in(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> in[i];
  }
  int sum = 0;
  for (int i = 0; i <= n; i++) {
    sum += abs(in[i + 1] - in[i]);
  }
  for (int i = 1; i <= n; i++) {
    cout << sum - abs(in[i] - in[i + 1]) - abs(in[i] - in[i - 1]) + abs(in[i + 1] - in[i - 1]) << '\n';
  }
  return 0;
}


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

using namespace std;

const int N = 100001;

vector <int> a[N];
queue <pair <int, int> > q;

vector <int> grad_interior(N, 0);

int main()
{
	int n, m;
	int maxi = -1;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int n1, n2;
		cin >> n1 >> n2;
		a[n1].push_back(n2);
		grad_interior[n2]++;
	}
	
	for (int i = 1; i <= n; i++) {
		if (grad_interior[i] == 0) {
			q.push(make_pair(i, 1));
		}
	}

	while(!q.empty()) {
		pair<int, int> x = q.front();
		maxi = max(maxi, x.second);
		q.pop();

		for (auto it : a[x.first]) {
			grad_interior[it]--;
			if (grad_interior[it] == 0) {
				q.push(make_pair(it, 1 + x.second));
			}
		}
	}

	cout << maxi - 1;

	return 0;
}

Measured memory_bytes: 6144
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		int a,b,c;
		Scanner foo = new Scanner(System.in);
		a = new Integer(foo.next()).intValue();
		b = new Integer(foo.next()).intValue();
		c = new Integer(foo.next()).intValue();
		if (a == b && b == c) {
			System.out.println("1");
		} else if (a == b || b == c || c == a) {
			System.out.println("2");
		} else {
			System.out.println("3");
		}
    }
}


Measured memory_bytes: 8916
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
int n,s;
string str;
	scanf("%d\n",&n);
for(int i=0;i<n;i++){
	getline(cin,str);
	s=str.size();
for(int j=0;j<s-6;j++){
if(str[j]=='H'&&str[j+1]=='o'&&str[j+2]=='s'&&str[j+3]=='h'&&str[j+4]=='i'&&str[j+5]=='n'&&str[j+6]=='o')str[j+6]='a';
}
cout<<str<<endl;
}
return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  if (abs(x) / d >= k) cout << abs(x) - k * d << endl;
  else {
    if ((k - abs(x) / d) % 2 == 0) cout << abs(x) % d << endl;
    else cout << abs(abs(x) % d - d) << endl;
  }

  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, hs[505], vs[505], ans = inf;
char ipt[505][505];

int main()
{
	bool flag = false;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%s",ipt[i]+1);
		for(int j=1;j<=n;j++) {
			hs[i] += (ipt[i][j] == '#');
		}
		if(hs[i]) flag = true;
	}
	if(!flag) {puts("-1"); return 0;}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) {
			vs[i] += (ipt[j][i] == '#');
		}
	}
	for(int i=1;i<=n;i++) {
		ans = min(ans, n-hs[i]+!(vs[i]));
	}
	for(int i=1;i<=n;i++) {
		if(vs[i] < n) ans++;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
#define MN 100000
struct SEG{int l,r;bool u;}s[MN+5];
int n,now;
long long ans1=0,ans2=0;
int l[MN+5],r[MN+5];
bool cmp1(int a,int b){return s[a].r<s[b].r;}
bool cmp2(int a,int b){return s[a].l>s[b].l;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&s[i].l,&s[i].r);
		l[i]=i,r[i]=i;
	}
	std::sort(l+1,l+1+n,cmp1);
	std::sort(r+1,r+1+n,cmp2);
	#define ans ans1
	now=0;
	for(int i=1;i<=n;i++)
		s[i].u=false;
	for(int i=1,j=1;i<=n&&j<=n;){
		while(s[l[i]].u&&i<=n)i++;
		if(i>n)break;
		if(!(s[l[i]].l<=now&&s[l[i]].r>=now)){
			ans+=std::abs(now-s[l[i]].r);
			now=s[l[i]].r;
		}
		s[l[i]].u=true;
		while(s[r[j]].u&&j<=n)j++;
		if(j>n)break;
		if(!(s[r[j]].l<=now&&s[r[j]].r>=now)){
			ans+=std::abs(now-s[r[j]].l);
			now=s[r[j]].l;
		}
		s[r[j]].u=true;
	}
	ans+=std::abs(now);
	#undef ans
	#define ans ans2
	now=0;
	for(int i=1;i<=n;i++)
		s[i].u=false;
	for(int i=1,j=1;i<=n&&j<=n;){
		while(s[r[j]].u&&j<=n)j++;
		if(j>n)break;
		if(!(s[r[j]].l<=now&&s[r[j]].r>=now)){
			ans+=std::abs(now-s[r[j]].l);
			now=s[r[j]].l;
		}
		s[r[j]].u=true;
		while(s[l[i]].u&&i<=n)i++;
		if(i>n)break;
		if(!(s[l[i]].l<=now&&s[l[i]].r>=now)){
			ans+=std::abs(now-s[l[i]].r);
			now=s[l[i]].r;
		}
		s[l[i]].u=true;
	}
	ans+=std::abs(now);
	#undef ans
	printf("%lld",std::max(ans1,ans2));
} 

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

route_dic = {i: set() for i in range(1, N+1)}
for a, b in AB_list:
    route_dic[a].add(b)
    route_dic[b].add(a)

ans = 0
for k, v in route_dic.items():
    flag = True
    for vv in v:
        if H[k-1] <= H[vv-1]:
            flag = False
            break
    if flag:
        ans += 1

print(ans)


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int H,W,A,B;
  cin>>H>>W>>A>>B;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(i<B)cout<<(j<A);
      else cout<<!(j<A);
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <math.h>

int main(){
	int K,X;
	int Xsta,Xend;
	std::cin >> K >> X;
	Xsta = X-K+1;
	Xend = X+K;
	if(Xsta < -1000000){
		Xsta = -1000000;
	}
	if(Xend > 1000000){
		Xend = 1000000;
	}
	for(int i = Xsta;i < Xend;i++){
		std::cout << i << " ";
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    d={'SUN': 7,'MON': 6,'TUE': 5,'WED': 4,'THU': 3,'FRI': 2,'SAT': 1}
    print(d[input()])
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string S[10005];
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i=0; i<N; i++) cin >> S[i];
  int pre = 0;
  int post = 0;
  int both = 0;
  int ret = 0;
  for (int i=0; i<N; i++) {
    string& s = S[i];
    if (s[0] == 'B' && s[s.size() - 1] == 'A') both++;
    else if (s[0] == 'B') pre++;
    else if (s[s.size() - 1] == 'A') post++;
    for (int j=0; j<s.size()-1; j++) {
      if (s[j] == 'A' && s[j+1] == 'B') ret++;
    }
  }
  if (both > 0) {
    ret += both - 1;
    if (pre > 0) { ret++; pre--; }
    if (post > 0) { ret++; post--; }
  }
  ret += min(pre, post);
  cout << ret << endl;
}

Measured memory_bytes: 768
#include<iostream> 
#include<string> 
#include<cstring> 
#include<vector> 
#include<map> 
#include<algorithm> 
#include<queue> 
#include<set> 
#include<cstdio> 
#include<functional> 
#include<iomanip> 
#include<cmath> 
#include<stack> 
#include<iomanip>
#include<functional>
using namespace std;
const int maxn = 2*(int)(1e5)+1000;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-6;
typedef long long LL;
typedef unsigned long long ull;
int a[maxn], num[maxn];
vector<int>ans;
int main() {
	//freopen("E:\\test.txt", "r", stdin);
	int n;
	while (~scanf("%d", &n)) {
		ans.clear();
		for (int i = 0; i < n; i++) {
			scanf("%d", &num[i]);
			a[i] = num[i];
		}
		sort(num, num + n);
		int l = num[n / 2-1], r = num[n / 2];
		for (int i = 0; i < n; i++) {
			if (a[i] <= l) ans.push_back(r);
			else ans.push_back(l);
		}
		for (int i = 0; i < ans.size(); i++)
			printf("%d\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 4724
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    int year,month,day;
    char c1,c2;
    cin >> year >> c1 >> month >> c2 >> day;
    cout<<(month<=4? "Heisei" : "TBD") << endl;
}

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

int main() {
	map<int, int>mp;
	rep(i, 12) {
		int e; cin >> e;
		mp[e]++;
	}
	for (auto p : mp) {
		if (p.second < 4) {
			puts("no");
			return 0;
		}
	}
	puts("yes");
}

Measured memory_bytes: 3100
import itertools
import numpy as np
def dist(p1,p2):
    dx = p1[0] - p2[0]
    dy = p1[1] - p2[1]
    return (dx ** 2 + dy ** 2)**0.5
    
ans = 0
n = int(input())
lis = []
for _ in range(n):
  x, y = map(int, input().split())
  lis.append((x, y))
per = list(itertools.permutations(lis, n))
count = 0
for i in per:
    for j in range(1,n):
        ans += dist(i[j-1],i[j])
print(ans/len(per))

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

namespace B___Counting_Roads
{
    class Program
    {
        static void Main(string[] args)
        {
            var N_M = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = N_M[0], M = N_M[1];
            var ai_bi = Enumerable.Range(1, M).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).SelectMany(x => x).ToArray();

            for (int i = 0; i < N; i++)
                Console.WriteLine(ai_bi.Count(x => x == (i + 1)));
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// leave to tomorrow anything that can be done today
#define MOD 1e9+7
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
ll dp[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll vet[n+2];
    rep(i,1,n+1)cin>>vet[i];
    dp[0]=0;
    ll pr[n+2];
    pr[1]=vet[1];
    for(int i=3;i<=n;i+=2)pr[i]=vet[i]+pr[i-2];
    dp[1]=0LL;
    rep(i,2,n+1){
        if(i&1){
            dp[i] = max(vet[i]+dp[i-2],dp[i-1]);
        }
        else{
            dp[i] = max(vet[i]+dp[i-2],pr[i-1]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;   
}   

Measured memory_bytes: 8316
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
using lint = long long;

int main()
{
    int R;
    cin >> R;
    if (R < 1200) cout << "ABC" << endl;
    else if (R < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}


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

typedef long long int ll;
#define f(a, b) for(auto i = a;i < b;i++)

bool sortbysec(const pair<ll, ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 
void solve()
{
	return ;
}

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

	n = n % k;
	if(n >= (k - n))
		cout << k - n << "\n";
	else
		cout << n << "\n"; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
//ll mod=1000000007;
ll mod;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    ll l,r;cin>>l>>r;
    if(r-l>=2019){
        cout<<0<<endl;
        return 0;
    }
    ll a=l%2019;
    ll b=r%2019;
    if(b<=a){
        cout<<0<<endl;
        return 0;
    }
    ll ans=1000000000000;
    rep(i,a,b){
        rep(j,i+1,b+1){
            ll u=i*j;
            ans=min(ans,u%2019);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0) break;
		vvi a(n,vi(m));
		for(int i=0;i<n;i++) for(int j=0;j<m;j++){
			char c;
			cin>>c;
			if(c=='1') a[i][j]++;
		}
		if(n<=22){
			int res=0;
			vector<bitset<500>> b(n);
			for(int i=0;i<n;i++) for(int j=0;j<m;j++) b[i][j]=a[i][j];
			for(int i=0;i<1<<n;i++){
				bitset<500> bit;
				int t=0;
				for(int j=0;j<n;j++) if(i&1<<j){
					bit^=b[j];
					t++;
				}
				if(bit==bitset<500>()) res=max(res,t);
			}
			cout<<res<<endl;
		}
		else{
			vi dp(1<<m,-inf);
			dp[0]=0;
			for(int i=0;i<n;i++){
				vi DP=dp;
				int t=0;
				for(int j=0;j<m;j++) if(a[i][j]) t|=1<<j;
				for(int j=0;j<1<<m;j++) DP[j]=max(DP[j],dp[j^t]+1);
				dp=DP;
			}
			cout<<dp[0]<<endl;
		}
	}
}


Measured memory_bytes: 23420
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N;
    cin >> N;
    int cnt = 0;
    for(int i = 0; i < N; ++i){
        int d, e;
        cin >> d >> e;
        if(d == e){
            if(++cnt == 3){
                cout << "Yes\n";
                return 0;
            }
        }
        else{
            cnt = 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 3636
#include <vector>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

using namespace std;

int main() {

	SINT32 ans = 0;
	
	vector<SINT32> DATA(5);
	cin >> DATA[0] >> DATA[1] >> DATA[2];

	ans = DATA[0] * DATA[1] / 2;
	
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()

pre = int(s[0:2])
post = int(s[2:])

#print((pre,post))


def is_m(x):
    return 1<= x  and x <=12


is_pre_m =  is_m(pre)
is_post_m = is_m(post)

ans = "YYMM" if (not is_pre_m ) and is_post_m \
            else "MMYY" if is_pre_m and not is_post_m \
            else "AMBIGUOUS" if is_pre_m and is_post_m \
            else "NA"

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

void solve() {
    int dist, t, vel;
    cin >> dist >> t >> vel;

    double time = 1.0*vel/dist;
    dout << dvar(1/time, t) << endl;
    cout << (1/time <= t ? "Yes" : "No") << endl;
}

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

    int tc = 1;
    FOR(i, 1, tc + 1) {
        //cout << "Case #" << i << ": ";
        solve();
    }
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  int m1,m2,d1,d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;
  if(m1 == m2) cout << 0;
  else cout << 1;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
s.find_by_order(x) xth element in set
x.order_of_key(x) number of elements <x*/
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) (int)s.size()
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
const int MOD=1e9+7;
const int N=(int)1e6;
int lpf[N+1];
void p()
{
    iota(lpf,lpf+N+1,0);
    for(int i=2;i*i<=N;i++)
    { 
        if(lpf[i]==i)
        {
            for(int j=2*i;j<=N;j+=i)
            if(lpf[j]==j)
            lpf[j]=i;
        }
    }
}
mii mp[N+1];
int ans[N+1];
void pf()
{
    for(int i=1;i<=N;i++)
    {
        int j=i;
        while(j!=1)
        {
            mp[i][lpf[j]]++;
            j/=lpf[j];
        }
        int l=1;
        for(auto &x:mp[i])
        l*=(1+x.second);
        ans[i]=l;
    }
}
void solve()
{
fastio
int n;
cin>>n;
int cnt=0;
int res=0;
for(int i=1;i<n;i++)
{
	int ab=n-i;
	res+=ans[ab];
}
cout<<res;
}
int main()
{
//code
fastio
p();
pf();
int t;
t=1;
while(t--)
{
solve();
cout<<endl;
}
}


Measured memory_bytes: 192104
#include <stdio.h>

#define MAX_DATA 100000

int temp[MAX_DATA];    /* 最小でも配列と同じサイズの領域が必要 */

void MergeSort(int x[ ], int left, int right);

  /* 配列 x[ ] の left から right の要素のマージソートを行う */
void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
	
    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

int main(void)
{
  int i,j;
      /* ソートされるデータ */
    int A[100000],N;
    long int eg[2];
    for(i=0;i<100000;i++){
      A[i]=0;
    }
    scanf("%d",&N);
    for(i=0;i<N;i++){
      scanf("%d",&A[i]);
    }
    MergeSort(A, 0, N - 1);
    for(j=0;j<2;j++){
      for(i=1;i<N;i++){
	if(A[N-i]==A[N-i-1]){
	  eg[j]=A[N-i];
	  A[N-i]=-2;A[N-i-1]=-1;
	  break;
	}
      }
    }
    printf("%ld\n",eg[0]*eg[1]);

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define N 200000 + 5
#define M 
#define inf 123456789
#define Inf 1000000000000000000
#define Mod 1000000007
#define int long long
#define rep(i, l, r) for(register int i = l; i <= r; ++i)
#define dep(i, l, r) for(register int i = r; i >= l; --i)
#define Next(i, u) for(register int i = h[u]; i; i = e[i].next)
#define mem(f, x) memset(f, x, sizeof(f))
#define file(a) freopen(#a".in","r",stdin); freopen(#a".out","w",stdout);
typedef long long ll;
typedef double D;
int n, m, k, l, r, pos1, pos2, pos, pre, len, a[N], b[N];
int read(){
	char c; int x = 0, f = 1;
	c = getchar();
	while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9'){ x = (x << 3) + (x << 1) + c - '0'; c = getchar();}
	return x * f;
}
int Mul(int a, int b) { return 1ll * a * b % Mod; }
int Inc(int a, int b) { return (a += b) >= Mod ? a - Mod : a; }
int Dec(int a, int b) { return (a -= b) < 0 ? a + Mod : a; }
bool check(int Mid){
    int sum = 0;
    if(Mid < 0){
        if(pos > n) return false;
        rep(i, 1, pos - 1){
            int l = pos, r = n;
            while(l < r){
                int mid = (l + r) >> 1;
                if(a[i] * a[mid] <= Mid) r = mid;
                else l = mid + 1; 
            }
            if(a[i] * a[r] > Mid) r++;
            if(r == i) r++;
            if(n >= r) sum += n - r + 1;
        }
        if(sum >= k) return true;
        else return false;
    }
    else if(Mid == 0){
        sum = (pos - 1) * (n - pos + 1) + pre;
        if(sum >= k) return true;
        else return false;
    }
    else{
        sum = (pos - 1) * (n - pos + 1) + pre;
        rep(i, 1, pos - 1){
            int l = i, r = pos - 1;
            while(l < r){
                int mid = (l + r) >> 1;
                if(a[i] * a[mid] <= Mid) r = mid;
                else l = mid + 1; 
            }
            if(a[i] * a[r] > Mid) r++;
            if(r == i) r++;
            if(pos > r) sum += pos - r;
        }
        rep(i, pos, n){
            int l = i, r = n;
            while(l < r){
                int mid = (l + r) >> 1;
                if(a[i] * a[mid] < Mid) l = mid + 1;
                else r = mid;
            }
            if(a[i] * a[r] > Mid) r--;
            if(r > i) sum += r - i;
        }
        if(sum >= k) return true;
        else return false;
    }
}
signed main(){
	//file(data);
	n = read(), k = read();
    rep(i, 1, n) b[i] = read();
    sort(b + 1, b + n + 1);
    b[n + 1] = 1;
    rep(i, 1, n){
        if(b[i] == 0 && !pos1) pos1 = i;
        if(b[i] == 0 && b[i + 1] != 0 && !pos2) pos2 = i;
    } 
    if(pos1) len = pos2 - pos1 + 1, pre += len * (len - 1) / 2 + (n - len) * len;
    m = n, n = 0;
    rep(i, 1, m) if(!(i >= pos1 && i <= pos2)) a[++n] = b[i];
    rep(i, 1, n) if(a[i] > 0 && !pos) pos = i;
    if(!pos) pos = n + 1;
    l = -Inf, r = Inf;
    while(l < r){
        int Mid = (l + r) >> 1;
        if(check(Mid)) r = Mid;
        else l = Mid + 1;
    }
    printf("%lld", r);
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};


int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  int ans = inf;
  for(int ab=0; ab <= 2*max(X,Y); ab+=2) {
	int x = max(0,X - ab/2);
	int y = max(0,Y - ab/2);
	int tmp = x * A + y * B + C * ab;
	ans = min(tmp, ans);
  }
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 3600
//
// Created by Daiki Kuyoshi on 2020/05/26.
//

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main(){
    long double A, B;
    cin >> A >> B;

    cout << (ll)(A * B) << endl;
}

Measured memory_bytes: 3172
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let a = nextIntArray()
    let min = Number.POSITIVE_INFINITY
    for (let y = -100; y <= 100; y++) {
        let tmp = 0
        for (let j = 0; j < a.length; j++) {
          tmp += (a[j] - y) * (a[j] - y)
        }
        min = Math.min(min, tmp)
    }
    console.log(min)
}
Main()



Measured memory_bytes: 32544