akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int getdigit(int num){
    int digit = 0;
    while(num!=0){
        num/=10;
        digit++;
    }
    return digit;
}
int main(void){
    //Input
    int n;
    cin >> n;
    //Process
    int ans=0;
    for(int i=1;i<=n;i++){
        if(getdigit(i)%2==1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
int main() {
	int n, H, W;
	scanf("%d%d%d", &n, &H, &W);
	vector<pair<int, pair<int, int>>> edges(n);
	for (int i = 0; i < n; ++i) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		--a;
		--b;
		edges[i] = {c, {a, H + b}};
	}
	sort(edges.begin(), edges.end());
	vector<int> par(H + W), nume(H + W), siz(H + W, 1);
	ll ans = 0;
	iota(par.begin(), par.end(), 0);
	function<int(int)> root = [&](int a) {
		if (par[a] == a) return a;
		return par[a] = root(par[a]);
	};
	for (int i = n - 1; i >= 0; --i) {
		int a, b;
		tie(a, b) = edges[i].second;
		int pa = root(a), pb = root(b);
		if (pa == pb) {
			if (nume[pa] < siz[pa]) {
				++nume[pa];
				ans += edges[i].first;
			}
			continue;
		}
		if (nume[pa] + nume[pb] + 1 > siz[pa] + siz[pb]) continue;
		siz[pb] += siz[pa];
		nume[pb] += nume[pa] + 1;
		ans += edges[i].first;
		par[pa] = pb;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    int n; cin >> n;
    Rep(i, 1, 50000){
        int m = i;
        if(i*108/100 == n){
            cout << i << endl;
            return;
        }
    }
    cout << ":(" << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    long n,a,b;
    long z = 0;
    long ans = 0;
 
    if(scanf("%ld%ld%ld",&n,&a,&b) != -1){
		ans = n / (a + b) * a;
		z = n % (a + b);
 
		if(a <= z){
			ans = ans + a;
		}else{
			ans = ans + z;
		}
 
		printf("%ld",ans);
    }
 
    return 0;
}

Measured memory_bytes: 128
using System;
using System.IO;

namespace Recursion___Divide_and_Conquer
{
    class Koch_Curve
    {
        static void Main(string[] args)
        {
            var p1 = new Vec(0, 0);
            var p2 = new Vec(100, 0);
            var n = int.Parse(Console.ReadLine());

            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Console.WriteLine(0 + " " + 0);
            Draw(p1, p2, n);

            Console.Out.Flush();
        }

        static void Draw(Vec left, Vec right, int n)
        {
            if (n == 0)
            {
                right.Show();
                return;
            }

            var v = (1.0 / 3) * (right - left);
            var s = left + v;
            var t = s + v.Rot60();
            var u = t + v.RotInv60();

            Draw(left, s, n - 1);
            Draw(s, t, n - 1);
            Draw(t, u, n - 1);
            Draw(u, right, n - 1);
        }

        struct Vec
        {
            public double x;
            public double y;
            public Vec(double x, double y)
            {
                this.x = x;
                this.y = y;
            }

            public Vec Rot60()
            {
                return new Vec(x * 0.5 - Math.Sqrt(3) * 0.5 * y, Math.Sqrt(3) * 0.5 * x + y * 0.5);
            }

            public Vec RotInv60()
            {
                return new Vec(x * 0.5 + Math.Sqrt(3) * 0.5 * y, -Math.Sqrt(3) * 0.5 * x + y * 0.5);
            }

            public static Vec operator +(Vec v, Vec w)
            {
                return new Vec(v.x + w.x, v.y + w.y);
            }

            public static Vec operator -(Vec v, Vec w)
            {
                return new Vec(v.x - w.x, v.y - w.y);
            }
            public static Vec operator *(double k, Vec v)
            {
                return new Vec(v.x * k, v.y * k);
            }

            public void Show()
            {
                Console.WriteLine(x + " " + y);
            }
        }
    }
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std; 

ll nCr(ll n, ll r)
{
    ll x = 1;
    ll y = 1;

    irep(i, r) {
        x *= n-i;
        y *= r-i;    
    }

    return x / y;
}

int main(void)
{

    int n, m;
    cin >> n >> m;
    
    v_int v(n+1);
    v[0] = 0;

    irep2(i, 1, n) {
        cin >> v[i];
        v[i] += v[i-1];
        v[i] %= m;
    }
    
    map<int, int> mmod;
    
    ll ans = 0;
    irep2(i, 0, n) {
        ans += mmod[v[i]];   
        mmod[v[i]]++;
    }

    cout << ans << endl;

    return 0;
}
/** tcoder **/


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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  vector<int> s(n + 1, 0);
  for (int i = 0; i < n; i++) s[i + 1] = (s[i] + a[i]) % k;
  map<int, int> mp;
  long long ans = 0;
  queue<int> q;
  for (int i = 0; i < n + 1; i++) {
    ans += mp[s[i]];
    mp[s[i]]++;
    q.push(s[i]);
    if (q.size() == k) {
      mp[q.front()]--;
      q.pop();
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 12032
#include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
	char str[N][50];
	int num[N],i=0,max=0,l=0;
	while(cin >> str[i]){
		i++;
	}
	for(int j=0;j<i;j++){
		num[j]=0;
	}
	for(int j=0;j<i;j++){
		for(int k=0;k<i;k++){
			if(strcmp(str[j],str[k])==0)
		num[j]++;
		}
		if(num[max] < num[j])
			max = j;
		if(strlen(str[l]) < strlen(str[j]))
			l=j;
	}
	cout << str[max] << " " << str[l] << endl;
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=300+10;
const int MOD=998244353;
int n,a[N],dp[N][N*N],sum;

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]),sum+=a[i];
	
	dp[0][0]=1;
	for (int i=1;i<=n;i++)
		for (int j=0;j<=sum;j++) {
			dp[i][j]=dp[i-1][j];
			if (j>=a[i]) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]]*2)%MOD;
		}	
	
	int ans=0;
	for (int i=0;i<=sum/2;i++) ans=(ans+dp[n][i])%MOD;
	
	if (sum%2==0) {
		memset(dp,0,sizeof(dp)); dp[0][0]=1;
		for (int i=1;i<=n;i++)
			for (int j=0;j<=sum;j++) {
				dp[i][j]=dp[i-1][j];
				if (j>=a[i]) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%MOD;
			}
		ans=((ans-dp[n][sum/2])%MOD+MOD)%MOD;		
	}
	ans=(ans*3)%MOD;
	
	int tmp=1;
	for (int i=1;i<=n;i++) tmp=(tmp*3)%MOD;
	cout<<((tmp-ans)%MOD+MOD)%MOD<<endl;
	return 0;
}

Measured memory_bytes: 232960
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n[3]={0, 0, 0};
    string s;
    cin>>s;
    n[0]=s.length();
    for(int i=0;i<n[0];i++){
        if(s[i]=='a'){
            n[1]++;
        }else if(s[i]=='b'){
            n[2]++;
        }
    }
    n[0]-=n[1]+n[2];
    sort(n,n+3);
    if(n[2]-n[0]<=1){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC168_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int K = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();

            if (S.Length > K)
            {
                S = S.Substring(0, K) + "...";

            }

            Console.WriteLine(S);
            Console.ReadLine();
        }
    }
}

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

void solve(int TestCase) {
    char c;
    cin >> c;
    c++;
    cout << c << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t = 1;
    //cin >> t;
    for(auto i = 1; i <= t; ++i)
        solve(i);
}


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

#define MOD (1000 * 1000 * 1000 + 7)
typedef long long ll;
typedef long double ld;

int main() {

    string str;
    cin >> str;

    map<char, int> oc;
    for(auto &c : str) {
        ++oc[c];
    }

    for(auto &i : oc) {
        if(i.second % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;


    return 0;
}

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

const int MAXN = 1e5 + 1;

int n, k, h[MAXN];

int main(){

    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> h[i];
    int dp[n + 5];
    for(int i = 1; i <= n; i++) dp[i] = 1e9;
    dp[1] = 0;
    for(int i = 2; i <= n; i++) for(int j = 1; j <= k && j < i; j++) if(i > j) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

#define MAX_N 5000000
#define MIN_S 0
#define MAX_S 1000000000

int compare_cnt = 0;

void merge(int *array, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	int i, j, k, *left_array, *right_array;

	left_array = malloc(sizeof(int) * n1 + 100);
	right_array = malloc(sizeof(int) * n2 + 100);

	for(i = 0; i < n1; i++) 
		left_array[i] = array[left + i];
	for(i = 0; i < n2; i++)
		right_array[i] = array[mid + i];
	left_array[n1] = MAX_S + 1;
	right_array[n2] = MAX_S + 1;
	i = 0;
	j = 0;
	for(k = left; k < right; k++) {
		compare_cnt++;
		if(left_array[i] <= right_array[j]) 
			array[k] = left_array[i++];
		else 
			array[k] = right_array[j++];
		
	}
	free(left_array);
	free(right_array);
}

void merge_sort(int *array, int left, int right)
{
	if(left + 1 < right) {
		int mid;

		mid = (left + right) / 2;
		merge_sort(array, left, mid);
		merge_sort(array, mid, right);
		merge(array, left, mid, right);
	}

}

int main(void)
{
	int i, n, *num;

	scanf("%d", &n);
	num = malloc(sizeof(int) * n + 100);
	for(i = 0; i < n; i++) {
		scanf("%d", num + i);
	}

	merge_sort(num, 0, n);

	for(i = 0; i < n - 1; i++) {
		printf("%d ", num[i]);
	}
	printf("%d\n", num[i]);
	printf("%d\n", compare_cnt);
	free(num);

	return 0;
}

Measured memory_bytes: 5388
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits>
#include <map>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <cstring>

typedef long long li;
using namespace std;

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

li max(li a, li b, li c) {
    return max(a, max(b, c));
}

li max(li a, li b, li c, li d) {
    return max(a, max(b, max(c, d)));
}

li max(li a, li b, li c, li d, li e) {
    return max(a, max(b, max(c, max(d, e))));
}


li pow_mod(li n, li e, li mod)
{
    li r = 1;
    
    while(e > 0)
    {
        if(e & 1)
            r *= n;
            r %= mod;
        
        n *= n;
        n %= mod;
        e >>= 1;
    }
    
    return r;
}

int main() {
    // ifstream fin("read.txt");
    int n, cnt = 0;
    string s;
    
    cin >> n >> s;
    
    for (int i = 0; i < s.length() - 2; i++) {
    	if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') cnt++;
    }

    cout << cnt << endl;
    
    return 0;
}








Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n;
  int s[10000];
  int i = -1;
  scanf("%d", &n);
  if ( n == 0 ) {
    s[++i] = 0;
  }
  while ( n ) {
    i++;
    if ( n % -2 ) {
      n -= 1;
      s[i] = 1;
    } else {
      s[i] = 0;
    }
    n /= -2;
  }
  for ( i; i >= 0; i-- ) {
    printf("%d", s[i]);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


i64 n;
string s;
int ss[101010];
i64 cnt[10][10];
int b[11];

int main(){
	cin >> n;
	cin >> s;
	for(int i = 0; i < n; i++){
		ss[i] = s[i]-'0';
	}
	for(int i = n-1; i >= 0; i--){
		if(b[ss[i]]) continue;
		b[ss[i]] = i;
	}
	
	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			if(cnt[ss[i]][ss[j]]) continue;
			cnt[ss[i]][ss[j]]++;
			for(int k = 0; k < 10; k++){
				if(b[k] > j){
					ans++;
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
import math
d, g = map(int, input().split())

ps = []
cs = []
for i in range(d):
  p, c = map(int, input().split())
  ps.append(p)
  cs.append(c)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i]) #全部解いたときの点
      cnt += int(s[i]) * ps[i]
    if total >= g:
      #return cnt
      ans.append(cnt)
      return
    else:
      #解いていない中で得点が最大の問題を探す
      s = s[::-1]
      idx = s.find("0")
      if s == -1:
        return
      #溶けるだけ解いてgを超えるならおk
      if math.ceil((g-total) /  ((d-idx)*100)) < ps[d-1-idx]:
        cnt += math.ceil((g-total) /  ((d-idx)*100))
        #return cnt
        ans.append(cnt)
        return
      else:
        #return 0
        return
      return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

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

 
int main() {


    int n,m;
    cin>>n>>m;


    vector<vector<int>> G(n+1);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;

        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }

    //探索する。
    vector<int> visit(n+1,-1);
    int max_count=1;
    for(int i=1;i<=n;i++){

        int cnt_wk=0;
        if(G[i].size()!=0 && visit.at(i)==-1){//空では無く未訪問の場合
            queue<int> que;
            que.push(i); //iからスタート

            //BFS開始（キューが空になるまで探索を行う）
            while(!que.empty()){
                int v=que.front();
                que.pop();
                visit.at(v)=0;//訪問済みにする。
                cnt_wk++;

                //vからたどれるところを調べる。
                for(int nv : G[v]){
                    if(visit[nv] != -1) continue;

                    visit.at(nv)=0;//訪問済みにする。
                    que.push(nv);
                }
            }
        }
        max_count = max(max_count,cnt_wk);
    }

    cout<<max_count<<endl;

 	return 0;
}


Measured memory_bytes: 15700
#include <iostream>

using namespace std;

int main(){
	int a,b;
	while(cin>>a>>b){
		if(a<=5)
			cout<<"0"<<endl;
		else if(6<=a&&a<=12)
			cout<<b/2<<endl;
		else
			cout<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

int n,m,arr[101];
const int mod=1000000007;
int dp[101][100010];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>arr[i];
	for(int i=0;i<=arr[0];i++)dp[0][i]=1+dp[0][i-1];
	for(int i=1+arr[0];i<=m;i++)dp[0][i]=dp[0][i-1];
	for(int j=1;j<n;j++){
		for(int i=0;i<=m;i++){
			dp[j][i]=dp[j-1][i]+dp[j][i-1];
			if(dp[j][i]>=mod)
				dp[j][i]-=mod;
			dp[j][i]-=dp[j-1][max(0,i-arr[j])-1];
			if(dp[j][i]<0)dp[j][i]+=mod;
		}
	}
	int ans=dp[n-1][m]-dp[n-1][m-1];
	if(ans<0)ans+=mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 39296
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    string S; cin >> S; int cnt=0;
    vector<pair<char,int>> p;
    rep(i,S.size()){
       if(S[i]=='x') continue;
       else p.push_back(make_pair(S[i],i));
    }
    bool can = true;
    rep(i,p.size()/2){
        if(p[i].first!=p[p.size()-1-i].first) can = false;
    }
    if(can){
        rep(i,(p.size()%2==0 ? p.size()/2 : p.size()/2+1)){
            if(i==0){
                cnt+=abs(p[0].second-((int)S.size()-1-p[p.size()-1].second));
            }
            else {
                cnt+=abs((p[i].second-p[i-1].second)-
                (p[p.size()-i].second-p[p.size()-1-i].second));
            }
        }
    }
    if(can) cout << cnt << endl;
    else cout << -1 << endl;


    return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
#define ll long long
#include<algorithm>
using namespace std;
int main(){
	ll int a,b,c,d;
cin>>a>>b>>c>>d;
if(a>=0 && b>=0 && c>=0 && d>=0) cout<<d*b;
else if(c>=0 && d>=0 && b>=0 && a<0) cout<<d*b;
else if(c>=0 && d>=0 && a<0 && b<0) cout<<b*c;
else if(d>=0 && c<0 && b>=0 && a>=0) cout<<b*d;
else if(b>=0 && a<0 && d>=0 && c<0) cout<<max(b*d,a*c);	
else if(a<0 && b<0 && d>=0 && c<0) cout<<a*c;
else if(a>=0 && b>=0 && c<0 && d<0)  cout<<a*d;
else if(a<0 && b>=0 && c<0 && d<0)  cout<<a*c;
else if(a<0 && b<0 && c<0 && d<0)  cout<<a*c;
return 0;}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main()
{
    int r;cin>>r;
    int ans = pow(r,2);
    cout << ans << endl;
    return 0;
}

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

def main():
    S,T=input().split()
    A,B=map(int,input().split())
    U=input()
    if S==U:
        print(A-1,B)
    else:
        print(A,B-1)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1

x,a,b=map(int,input().split())
ab=b-a
if ab<=0:
    print("delicious")
elif 0<ab<=x:
    print("safe")
else:
    print("dangerous")

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,i,j;cin>>n;
      std::vector<pair<LI,LI>> v(n);
      fo(i,0,n) cin>>v[i].ff>>v[i].ss;
      double d=0,x=1;
      fo(i,1,n+1) x*=i;
      fo(i,0,n){
        fo(j,0,i){
          d+=sqrt(pow(v[i].ff-v[j].ff,2)+pow(v[i].ss-v[j].ss,2))*2/n;
        }
      }
      cout<<fixed<<setprecision(10)<<d;
    }
    return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int p,q,r,sum = 0,max;
    cin >> p;
    sum += p;
    max = p;
    cin >> q;
    sum += q;
    if(q > max)max = q;
    cin >> r;
    sum += r;
    if(r > max)max = r;
    cout << sum - max << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> K >> N;
    vec<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int ans = A[0]+(K-A[N-1]);
    for(int i=0;i<N-1;i++) ans = max(ans,A[i+1]-A[i]);
    cout << K-ans << "\n";
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}

const int N = 200005;

LL s1[N], s2[N], a[N], L, Ans;
int n;

LL f(int l,int r) {
    return s1[r] - a[l] * (r - l) - s1[l];
}

void Calc() {
    for (int i = 1; i <= n; ++i) 
        s1[i] = s1[i - 1] + a[i], s2[i] = s2[i - 1] + (L - a[n - i + 1]);
    for (int i = 0; i < n; ++i) {
        LL now = a[i] * (n - i) + a[i];
        int cnt = (n - i) / 2;
        if ((n - i) % 2 == 0) 
            now += s2[cnt] * 2 + f(i, i + cnt) * 2 - (a[i + cnt] - a[i]);
        else 
            now += s2[cnt + 1] * 2 + f(i, i + cnt) * 2 - (L - a[n - cnt]);
        Ans = max(Ans, now);
    }
}
int main() {
    L = read(); n = read();
    for (int i = 1; i <= n; ++i) a[i] = read();
    Calc();
    for (int i = 1; i <= n; ++i) a[i] = L - a[i];
    reverse(a + 1, a + n + 1);
    Calc();
    cout << Ans;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <complex>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <vector>
#define X real()
#define Y imag()
#define EPS 1e-10
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;

double dot(P a, P b){
  return a.X*b.X + a.Y*b.Y;
}

double cross(P a, P b){
  return a.X*b.Y - a.Y*b.X;
}

vector<P> sort_comp(vector<P> a){
  int l = a.size();
  vector< pair<double, double> > t(l);
  for(int i = 0; i < l; ++i){
    t[i].first = a[i].X;
    t[i].second = a[i].Y;
  }
  sort(t.begin(),t.end());
  for(int i = 0; i < l; ++i){
    a[i] = P(t[i].first,t[i].second);
  }
  return a;
}

P n_vector(P a){
  double l = abs(a);
  return P(-a.Y,a.X)/l;
}

vector<P> cpcc(C a, C b){
  double d = abs(a.first-b.first), ra = a.second, rb = b.second;
  double t = (ra*ra-rb*rb+d*d)/2/d, h = sqrt(ra*ra-t*t);
  P m = t/abs(b.first-a.first)*(b.first-a.first)+a.first;
  vector<P> cp(2,m);
  P n = n_vector(a.first-b.first);
  cp[0] -= h*n;
  cp[1] += h*n;
  return sort_comp(cp);
}

vector<P> tangent_to_C(P p, C c){
  C c2 = C((p+c.first)/2.0,abs(p-c.first)/2.0);
  return cpcc(c,c2);
}

vector<P> common_tangent(C a, C b){
  vector<P> ret, cp;
  if(a.second == b.second){
    P n = n_vector(b.first-a.first);
    ret.push_back(P(a.first+a.second*n));
    ret.push_back(P(a.first-a.second*n));
  }
  P i = (a.first*b.second+b.first*a.second)/(a.second+b.second);
  if(abs(a.first-b.first) > a.second+b.second){//4??¬
    cp = tangent_to_C(i,a);
    for(int i = 0; i < 2; ++i) ret.push_back(cp[i]);
    if(a.second != b.second){
      P e = (a.first*b.second-b.first*a.second)/(b.second-a.second);
      cp = tangent_to_C(e,a);
      for(int i = 0; i < 2; ++i) ret.push_back(cp[i]);
    }
  }else if(abs(a.first-b.first) == a.second+b.second){//3??¬
    cp = tangent_to_C(i,a);
    ret.push_back(cp[0]);
    if(a.second != b.second){
      P e = (a.first*b.second-b.first*a.second)/(b.second-a.second);
      cp = tangent_to_C(e,a);
      for(int i = 0; i < 2; ++i) ret.push_back(cp[i]);
    }
  }else if(abs(a.first-b.first) > abs(a.second-b.second)){//2??¬
    if(a.second != b.second){
      P e = (a.first*b.second-b.first*a.second)/(b.second-a.second);
      cp = tangent_to_C(e,a);
      for(int i = 0; i < 2; ++i) ret.push_back(cp[i]);
    }
  }else if(abs(a.first-b.first) == abs(a.second-b.second)){//1??¬
    P e = (a.first*b.second-b.first*a.second)/(b.second-a.second);
    cp = tangent_to_C(e,a);
    ret.push_back(cp[0]);
  }
  return sort_comp(ret);//0??¬
}

int main(){
  double x, y, r;
  vector<C> Cs(2);
  for(int i = 0; i < 2; ++i){
    cin >> x >> y >> r;
    Cs[i] = C(P(x,y),r);
  }
  vector<P> cp = common_tangent(Cs[0],Cs[1]);
  for(int i = 0; i < cp.size(); ++i){
    printf("%.10lf %.10lf\n",cp[i].X,cp[i].Y);
  }
  return 0;
}

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

int n, q;
vector<int> P;
vector<pair<char, int>> O;
vector<int> go_to;
vector<int> marked;

void delete_mark(int v) {
  marked[v]--;
  if (!marked[v]) {
    go_to[v] = go_to[P[v]];
  }
}
int search_mark(int v) {
  if (go_to[v] == v) {
    return v;
  }
  return (go_to[v] = search_mark(go_to[v]));
}

int main() {
  while (cin >> n >> q) {
    if (!n && !q)
      break;

    P = vector<int>(n + 1);
    go_to = vector<int>(n + 1);
    marked = vector<int>(n + 1, 0);
    O.clear();
    P[1] = 1;
    go_to[1] = 1;
    for (int i = 2; i <= n; i++) {
      cin >> P[i];
      go_to[i] = P[i];
    }
    for (int i = 0; i < q; i++) {
      char ope;
      int v;
      cin >> ope >> v;
      O.push_back(make_pair(ope, v));
      if (ope == 'M') {
        go_to[v] = v;
        marked[v]++;
      }
    }

    long long ans = 0;
    for (int i = q - 1; i >= 0; i--) {
      if (O[i].first == 'M') {
        delete_mark(O[i].second);
      } else {
        ans += search_mark(O[i].second);
      }
    }

    // bug:二回マークされているときを考えていなかった->markedに回数を保存
    cout << ans << endl;
  }
}



Measured memory_bytes: 5232
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		for (int i = 9; i >= 1; i--) {
			if (N % i != 0) continue;
			int par = N / i;
			if (par <= 9) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  int n,m,sum = 0,i,a,b;cin >> n >> m;
  int h[n];bool ans[n];fill(ans,ans+n,1);
  for(i=0;i<n;i++) cin >> h[i];
  for(i=0;i<m;i++){
    cin >> a >> b;a--;b--;
    if(h[a]<=h[b]) ans[a] = false;
    if(h[b]<=h[a]) ans[b] = false;
  }
  for(int x:ans) sum += x;
  cout << sum << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int keta(int a){
    int count = 0;
    while(a>0){
        a /=10;
        count++;
    }
    return count;
}


int main(void){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(keta(i)%2 == 1){
            ans++;
        } 
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
r=range;_,*s=open(0)
h,w,k=map(int,_.split())
m=9e9
for i in r(1<<h-1):
 t,v,l=[],-1,1
 for j in r(h):z=i>>j&1;t+=[-~j]*z;l+=z
 t+=h,
 c=[0]*l
 for i in r(w):
  b=f=g=0;u=[]
  for j in r(l):d,b=sum(s[j][i]>"0"for j in r(b,t[j])),t[j];u+=d,;g|=d>k;c[j]+=d;f|=c[j]>k
  v+=f
  if f:c=u
 if not g:m=min(m,v+l)
print(m)

Measured memory_bytes: 50776
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	W, a, b := sc.nextInt(), sc.nextInt(), sc.nextInt()
	if (a <= b && b <= a+W) || (a <= b+W && b+W <= a+W) {
		fmt.Fprintln(wtr, 0)
	} else {
		fmt.Fprintln(wtr, min(abs(a+W-b), abs(b+W-a)))
	}

	wtr.Flush()
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, M, X; 
    cin >> N >> M >> X;
    int i;  
    int count = 0;  
    for(int i = 0; i < M; ++i){
     int A; 
     cin >> A; 
     if(A < X) count++; 
    } 
    cout << min(count, M - count) << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	ll n, cnt=0;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	while(1){
		bool ok=true;
		rep(i,n){
			if(a[i]%2==0) ;
			else{
				ok = false;
				break;
			}
		}
		if(ok){
			cnt++;
			rep(i,n) a[i]/=2;
		}else break;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
long long ans;
int main(){
	long long l,r;
	scanf("%lld%lld",&l,&r);
	r=min(r,l+2019*2);
	ans=1e9;
	for (long long i=l; i<=r; i++){
		for (long long j=i+1; j<=r; j++){
			ans=min(ans,i*j%2019);
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

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

    vector <int> v;
    int cnt = 0;
    if(s[0] == '0'){
        v.push_back(0);
    }

    for(int i = 0; i < n; i++){
        cnt++;
        if(i == n-1 ||  s[i] != s[i+1]){
            v.push_back(cnt);
            cnt = 0;
        }
    }
    if(s[n-1] == '0'){
        v.push_back(0);
    }
    n = v.size();
    int range = 2 * k + 1;
    int ans = 0;
    if(range > n){
        for(int i = 0; i < n; i++){
            ans += v[i];
        }
    }else{
        for(int i = 0; i < n; i += 2){
            if(n < i + range){
                break;
            }else{
                int tmp = 0;
                for(int j = 0; j < range; j++){
                    tmp += v[i+j]; 
                }
                ans = max(ans,tmp);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1020
#include<stdio.h>

int main(){

  int n;
  scanf("%d",&n);

  long long int m = 0;
  long long int a = 0;
  long long int r = 0;
  long long int c = 0;
  long long int h = 0;

  int P[10]={0,0,0,0,0,0,1,1,1,2};
  int Q[10]={1,1,1,2,2,3,2,2,3,3};
  int R[10]={2,3,4,3,4,4,3,4,4,4};

  char name[11];
  for(int i = 0 ; i < n ; ++i){
    scanf("%s",name);
    if(name[0] == 'M') m++;
    if(name[0] == 'A') a++;
    if(name[0] == 'R') r++;
    if(name[0] == 'C') c++;
    if(name[0] == 'H') h++;
  }

  long long int d[5];
  d[0]=m; d[1]=a; d[2]=r; d[3]=c; d[4]=h;

  long long int ans = 0;
  for(int i = 0; i <10 ; ++i){
    ans += d[P[i]] * d[Q[i]] * d[R[i]];
  }

  printf("%lld",ans);

  return 0;

}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(ll i = 0; i < n; ++i)
#define REP1(i, n) for(ll i = 1; i <= n; ++i)
#define REP2(i, B, E) for(ll i = B; i <= E; ++i)

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

template<class T> T& chmin(T &obj, T val){ return obj = min(obj, val); }
template<class T> T& chmax(T &obj, T val){ return obj = max(obj, val); }

// 二分探索 : [low, high) の範囲で述語 pred がtrue を返す最大の値を返す
template<class Pred>
ll bsearch(ll low, ll high, Pred pred){
    while(low + 1 < high){
        const ll mid = low + (high - low) / 2;
        if(pred(mid)){ low = mid; }
        else{ high = mid; }
    }
    return low;
}


const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e15;

ll S[20][20] = {};
ll dist[400][400] = {};

int main() {

    ll H, W; cin >> H >> W;
    ll N = 0;
    REP(h, H){
        REP(w, W){
            char c; cin >> c;
            if(c == '.'){
                S[h][w] = N++;
            }
            if(c == '#'){ 
                S[h][w] = -1;
            }
        }
    }
    
    if(H == 1 && W == 1){ cout << 0 << endl; return 0; }
    if(N <= 1) { cout << 0 << endl; return 0; }
    
    
    REP(i, N) REP(j, N) if(i != j) dist[i][j] = INF;
    REP(h, H) REP(w, W){
        ll n = S[h][w];
        if(n < 0) continue;
        ll n2 = h > 0 ? S[h-1][w] : -1;
        ll n3 = w > 0 ? S[h][w-1] : -1;
        if(n2 >= 0) dist[n][n2] = dist[n2][n] = 1;
        if(n3 >= 0) dist[n][n3] = dist[n3][n] = 1;
    }
    
    for(int k = 0; k < N; k++)
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
    
    ll ans = 0;
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
                chmax(ans, dist[i][j]);
    
    write(ans);
}



Measured memory_bytes: 1536
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<stdlib.h>
#define M 200005
#define N 100
#define ll long long
#define oo 1000000000
#define mod 555555555
using namespace std;
int n,m,cnt[M],A[M];
long long Tr1[2*M],Tr2[2*M],ans;
void Add1(int x,int y){
	while(x<=2*m){
		Tr1[x]+=y;
		x+=x&(-x);
	}
}
long long Get1(int x){
	long long res=0;
	while(x){
		res+=Tr1[x];
		x-=x&(-x);
	}
	return res;
}
void Add2(int x,int y){
	while(x<=2*m){
		Tr2[x]+=y;
		x+=x&(-x);
	}
}
long long Get2(int x){
	long long res=0;
	while(x){
		res+=Tr2[x];
		x-=x&(-x);
	}
	return res;
}

int main(){
	int i,j;
	long long mx=0;
	cin>>n>>m;
	for(i=1;i<=n;i++){
		scanf("%d",&A[i]);
	}
	for(i=2;i<=n;i++){
		if(A[i]>A[i-1])ans+=A[i]-A[i-1];
		else ans+=-A[i-1]+A[i]+m;
		//cout<<ans<<endl;
	}
	
	for(i=2;i<=n;i++){
		//A[i-1],A[i]
		if(A[i-1]<A[i]){
			int b=A[i]-A[i-1];
			Add1(A[i-1]+1,-A[i-1]-1);
			Add1(A[i]+1,A[i-1]+1);
			Add2(A[i-1]+1,1);
			Add2(A[i]+1,-1);
		}
		else {
			//A[i] A[i-1]+m
			//printf("hei=%d %d\n",A[i-1],A[i]+m);
			//int b=m+A[i]-A[i-1];
			int q=A[i-1]+m;
			Add1(A[i-1]+1,-A[i-1]-1);
			Add1(A[i]+1+m,A[i-1]+1);
			Add2(A[i-1]+1,1);
			Add2(A[i]+1+m,-1);
		}
	}
	for(i=1;i<=m;i++){
		//printf("b=%lld\n",Get2(i));
		long long res=1LL*Get2(i)*i+Get1(i);
		res+=1LL*Get2(i+m)*(i+m)+Get1(i+m);
		//printf("a=%d %lld %lld %lld\n",i,res,Get1(i),Get2(i));
		if(res>mx)mx=res;
	}
	cout<<ans-mx<<endl;
	return 0;
}
/*
2 5
1 4
*/
	
	

Measured memory_bytes: 6272
n, x = map(int, input().split())
xl = [int(_) for _ in input().split()]
for i in range(n):
    if x > xl[i]:
        xl[i] = x - xl[i]
    else:
        xl[i] = xl[i] - x


def gcd(a, b):
    if a < b:
        x_a = b
        x_b = a
    else:
        x_a = a
        x_b = b
    while(1):
        if x_a < x_b:
            tmp = x_a
            x_a = x_b
            x_b = tmp
        x_a %= x_b
        if x_a == 0:
            break
    return x_b

    
x_gcd = xl[0]
if n > 1:
    for i in range(1, n):
        x_gcd = gcd(x_gcd, xl[i])
print(x_gcd)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define tp          tuple<int,int,int>
#define fastio      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int N = 1e6 + 6;

int main()  {
    fastio;
    int n;
    cin>>n;
    vector<int>vec(n+1);
    for(int i =1 ; i < n ; i++ ) {
        for(int j = i ; j < n ; j+=i) vec[j]++;
    }

    int tot = 0;
    for(auto x : vec) tot += x;
    cout<<tot<<'\n';
    return 0;
    
    
}

Measured memory_bytes: 7136
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int H,W,K;
    string c[10];

    cin>>H>>W>>K;

    for(int i=0;i<H;i++){
        cin>>c[i];
    }

    int ans=0;
    for(int i=0;i<1<<(W+H);i++){
        int w[10]={0};
        int h[10]={0};

        for(int j=0;j<W;j++){
            w[j]=(i>>j)%2;
        }
        for(int j=0;j<H;j++){
            h[j]=(i>>(W+j))%2;
        }

        int ct=0;
        for(int j=0;j<H;j++){
            for(int k=0;k<W;k++){
                if(c[j][k]=='#'&&h[j]==0&&w[k]==0){
                    ct++;
                }
            }
        }
        if(ct==K){
            ans++;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3192
n = int(input())

al = []
for _ in range(n):
    al.append(input())

m = int(input())
bl = []
for _ in range(m):
    bl.append(input())

ans = 0
for i in list(set(al)):
    tmp = al.count(i) - bl.count(i)
    ans = max(ans,tmp)

print(ans)
    

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

int main() {
  string s,t; cin>>s>>t;
  int n=s.size();
  bool ok=true;
  rep(i, n) if (s[i]!=t[i]) ok=false;
  if (ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3628
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int m=scn.nextInt();
		int []bulbs=new int[m+1];
		int []p=new int[m+1];
		//switches[1,n] -> bulbs[1,m]
		HashMap<Integer,HashSet<Integer>> hmap=new HashMap<>();
		for(int i=1;i<=m;i++) {
			int s=scn.nextInt();
			for(int j=0;j<s;j++) {
				int a=scn.nextInt();
				if(hmap.containsKey(a)) {
					HashSet<Integer> set=hmap.get(a);
					set.add(i);
					hmap.put(a, set);
				}else {
					HashSet<Integer> set=new HashSet<Integer>();
					set.add(i);
					hmap.put(a, set);
				}
			}
		}
		for(int i=1;i<=m;i++) {
			p[i]=scn.nextInt();
		}
		int x=0,y=0;
		int []b1=bulbs.clone();
		int []b2=bulbs.clone();
		x=solve(1,n,1,b1,p,hmap);
		//System.out.println("start");

		y=solve(0,n,1,b2,p,hmap);
		System.out.println(x+y);
	}
	public static int solve(int on,int n, int switch_idx, int []bulbs,int []p,HashMap<Integer,HashSet<Integer>> hmap) {
		
		int []b1=bulbs.clone();
		int []b2=bulbs.clone();
		
		// processing
		HashSet<Integer> set=hmap.get(switch_idx);
		if(set!=null) {
			Iterator<Integer> itr=set.iterator();
			while(itr.hasNext()) {
				int x=itr.next();
				bulbs[x]=(bulbs[x]+on)%2;
				b1[x]=bulbs[x];
				b2[x]=bulbs[x];
			}
		}
		if(switch_idx==n) {
			for(int i=1;i<bulbs.length;i++) {
				//System.out.println(bulbs[i]+" "+p[i]);
				if(bulbs[i]!=p[i]) {
					return 0;
				}
			}
			//System.out.println("end");
			return 1;
		}
//		System.out.println("Before"+" "+on+" "+switch_idx);
//		for(int i=0;i<b1.length;i++) {
//			System.out.print(b1[i]+" ");
//		}
//		System.out.println("b2222");
//		for(int i=0;i<b1.length;i++) {
//			System.out.print(b2[i]+" ");
//		}
//		System.out.println();
		// calling
		int x=0,y=0;
		x=solve(1,n,switch_idx+1,b1,p,hmap);
//		System.out.println("After"+" "+on+" "+switch_idx);
//		for(int i=0;i<b1.length;i++) {
//			System.out.print(b2[i]+" ");
//		}
//		System.out.println();
		y=solve(0,n,switch_idx+1,b2,p,hmap);
		return x+y;
	}
}


Measured memory_bytes: 23764
//winners never quite
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ans=0;
    int n;
    scanf("%d",&n);
    for(int i=1 ; i<n ; i++)
    {
        for(int j=1; i*j<n ; j++)
        {
            ans++;
        }
    }
    printf("%d\n",ans);
}


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

using namespace std;
#define ll long long

int main(){
	ll n;char a[100],b[100];
	cin>>n;
	for (ll i=0;i<n;i++){
		cin>>a[i];
		
	}
	for (ll i=0;i<n;i++){
		cin>>b[i];
		
	}
	for (ll i=0;i<n;i++){
		cout<<a[i]<<b[i];
		
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;cin>>s;
    int d=999999;
    int x;
    for(int i=0;i<s.size()-2;i++){
        x = 100*(int)(s[i]-'0')+10*(int)(s[i+1]-'0')+(int)(s[i+2]-'0');
        d = min(d,abs(x-753));
    }
    cout<<d<<endl;
}

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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    if (a.at(a.size()-1) == b.at(0) && b.at(b.size()-1) == c.at(0)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		String b = sc.next();

		for(int i =0;i< n;i++) {
			System.out.print(a.substring(i,i+1)+b.substring(i,i+1));
		}
	}
}



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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, x, p[222222];

int main() {
	cin >> n >> x;
	if (x==1 || x==2*n-1) {
		cout << "No" << ln;
		return 0;
	}
	cout << "Yes" << ln;
	if (n==2) {
		repst(i,1,3) cout << i << ln;
		return 0;
 	}
	// この4箇所がこうなってれば2行目から頂点までn番目とn+1番目の要素がずっとxのままになる
	if (x==2) p[n-1] = x+1, p[n] = x, p[n+1] = x-1, p[n+2] = x+2;
	else p[n-1] = x-1, p[n] = x, p[n+1] = x+1, p[n+2] = x-2;
	
	int j = 1;
	repst(i,1,2*n-1) {
		if (x==2 && x-1<=j && j<=x+2) j = x+3;
		if (x!=2 && x-2<=j && j<=x+1) j = x+2;
		if (!p[i]) p[i] = j++;
		cout << p[i] << ln;
	}
}

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

using namespace std;

int main(void) {
	int H, W;
	cin >> H >> W;

	string  S[60];
	for (int i = 0; i < H; i++)
	{
		cin >> S[i];
	}

	int  a[8] = { -1,-1,-1,0,0,1,1,1 };
	int  b[8] = { -1,0,1,-1,1,-1,0,1 };

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (S[i][j] == '#')
			{
				continue;
			}

			int num = 0;
			for (int t = 0; t < 8; t++)
			{
				const int ai = i + a[t];
				const int bj = j + b[t];

				if (ai<0 || ai > H)
				{
					continue;
				}
				if (bj < 0 || bj > W)
				{
					continue;
				}
				if (S[ai][bj] == '#')
				{
					num++;
				}

			}
			S[i][j] = char(num + '0');
		}
	}

	for (int i = 0; i < H; i++)
	{
		cout << S[i] << endl;
	}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
using Graph = vector<vector<ll> >;
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; }
const ll INF = 1e18;


//入力
ll n;

int ans[510][510];

void solve(int l,int r,int level){
    if(l+1==r)return;
    int c = (l+r)/2;
    for(int i=l;i<c;i++){
        for(int j=c;j<r;j++){
            ans[i][j]=level;
        }
    }
    solve(l,c,level+1);
    solve(c,r,level+1);
    return;
}

int main(){
    cin >> n;
    solve(0,n,1);
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n-1;j++){
            cout<<ans[i][j] << ' ';
        }
        cout<< ans[i][n-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int A, B, X;
    cin >> A >> B >> X;
    int t1 = (X + 1000 - 1) / 1000 * A;
    int t2 = (X + 500 - 1) / 500 * B;
    int t3 = X / 1000 * A + (X - X / 1000 * 1000 + 500 - 1) / 500 * B;
    cout << min(t1, min(t2, t3)) << "\n";
    return 0;
}


Measured memory_bytes: 3112