akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define INF 2<<29
#define F first
#define S second

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

int main(){
  int r;
  scanf("%d",&r);
  printf("%d\n",3*r*r);
  
  
  return 0;
}



Measured memory_bytes: 256
K = int(input())
S = input()
MOD = 10**9 + 7

length = len(S)
length_all = K + length
ans = 0
list_25 = [1] * (10**6 + 5)
list_26 = [1] * (10**6 + 5)
for i in range(1,10**6 + 5):
  list_25[i] = list_25[i - 1] * 25 % MOD
  list_26[i] = list_26[i - 1] * 26 % MOD
  
fact = [1] * (2 * 10**6 + 5)
fact_inv = [1] * (2 * 10**6 + 5)
for i in range(1, 2 * 10**6 + 5):
  fact[i] = fact[i-1] * i % MOD
  fact_inv[i] = fact_inv[i - 1] * pow(i, MOD - 2, MOD) % MOD

for i in range(K + 1):
  ans += list_26[i] * list_25[K - i] % MOD * fact[length_all - i - 1] * fact_inv[length - 1] * fact_inv[K - i] % MOD

print(ans % MOD)

Measured memory_bytes: 133068
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
#define N 200005
#define M 30005
#define ll long long 
#define INF 0x3f3f3f3f
#define PI 3.1415926535
#define EPS 1e-6
inline ll rd()
{
	ll f=1ll,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-f;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
int n;
ll k;
ll a[N],f[N],b[N];
bool cmp(int p,int q)
{
	return p>q;
}
bool check(ll x)
{
	for(int i=1;i<=n;i++)
		b[i]=x/f[i];//b[i]是每个人减少x 所应该减少的a[]的数量下取整 
	ll r=0;
	for(int i=1;i<=n;i++)
		r+=max(0ll,a[i]-b[i]);
	return r<=k;
}
int main()
{
	scanf("%d",&n);k=rd();
	for(int i=1;i<=n;i++)
		a[i]=rd();
	for(int i=1;i<=n;i++)
		f[i]=rd();
	sort(a+1,a+n+1);
	sort(f+1,f+n+1,cmp);
	ll l=0,r=(ll)1e12;//1e6*1e6 
	while(l+1<=r)
	{
		ll mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%lld\n",r);
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
//#include<con>
using namespace std;
int main(){
    long long n,m,ans=1e18;
    cin>>n>>m;
    n%=m;
    for(int i=1;i<=10;i++){
        ans=min(ans,n);
        n=abs(n-m);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){
  int N; cin >> N;
  string S; cin >> S;

  int ans = 0;
  while (S.length() > 0){
    
    vector <int> A(S.length());
    A[0] = S.length();
    // A[i]は、SとS[i:length-1]の共通接頭辞の長さを表す

    int i = 1, j = 0;
    //　jが共通の接頭辞の長さ

    while (i < S.length()){
      while (S[j] == S[i + j] && i + j < S.length()){
        j++;
      }
      A[i] = j;
      if (j == 0) i++;
      else{
        int k = 1;
        while (k + A[k] < j && i + k < S.length()){
          A[i + k] = A[k]; k++;
        }
        i += k; j -= k;
      }
    }
    
    for (int k = 0; k < A.size(); k++){
      int cnt = min(k, A[k]);
      if (ans < cnt) ans = cnt;
    }
    S.erase(0, 1);
  }
  
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
"use strict"
function main(arg) {
    let tmp = arg.trim().split("\n")
    let [A,V] = tmp[0].split(" ").map(Number)
    let [B,W] = tmp[1].split(" ").map(Number)
    let T = Number(tmp[2]) +0
    let at,bw
    let ans = false
    if (B < A) {
        // 鬼の方が先
        at = BigInt(A) - BigInt(V) * BigInt(T) //鬼
        bw = BigInt(B) - BigInt(W) * BigInt(T) //逃げ
        if (at <= bw) {
            ans = true
        }
    } else {
        at = BigInt(A) + BigInt(V) * BigInt(T) //鬼
        bw = BigInt(B) + BigInt(W) * BigInt(T)
        if (at >= bw) {
            ans = true
        }
    }
    if (ans) {
        console.log('YES')
    } else {
        console.log('NO')
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl
#define all(vec) vec.begin(), vec.end()

int main() {
    int n, q;
    cin >> n >> q;
    queue<pair<string, int> > process;
    vector<pair<string, int> > ans;
    rep(i,n) {
        string name;
        int time;
        cin >> name >> time;
        process.push(make_pair(name, time));
    }
    int t = 0;
    while (process.size()) {
        string pname = process.front().first;
        int ptime = process.front().second;
        if (ptime <= q) {
            t += ptime;
            ans.push_back(make_pair(pname, t));
            process.pop();
        } else {
            t += q;
            ptime -= q;
            process.push(make_pair(pname, ptime));
            process.pop();
        }
    }
    for (auto x: ans) {
        cout << x.first << " " << x.second << endl;
    }
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

class UnionFind {
private:
    int n;
    vector<int> a;
public:
    UnionFind(int n) : n(n), a(n, -1) {}
    int find(int x) { return a[x] < 0 ? x : (a[x] = find(a[x])); }
    bool same(int x, int y) { return find(x) == find(y); }
    bool same(ii& p) { return same(p.first, p.second); }
    bool same(pair<ll, ll>& p) { return same(p.first, p.second); }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;
        if (a[x] > a[y]) swap(x, y);
        a[x] += a[y];
        a[y] = x;
        n--;
        return true;
    }
    bool unite(ii& p) { return unite(p.first, p.second); }
    bool unite(pair<ll, ll>& p) { return unite(p.first, p.second); }
    int size() const { return n; }
    int size(int x) { return -a[find(x)]; }
};

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

    vll vp;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        vp.push_back({ a, b });
    }

    reverse(ASC(vp));
    UnionFind uf(n);
    vl res;
    ll cnt = n * (n - 1) / 2;
    rep(i, m) {
        res.push_back(cnt);
        if (uf.same(vp[i])) continue;
        cnt -= uf.size(vp[i].first) * uf.size(vp[i].second);
        uf.unite(vp[i]);
    }
    reverse(ASC(res));
    rep(i, res.size()) cout << res[i] << endl;
}

Measured memory_bytes: 5104
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int MAXN = 10000001;
const int INF = 1e9;
#define ll long long 

class TaskD {
private:
	Debugger debugger;
	vector<vector<int>> graph;
	vector<bool> vis;
	int dfs(int u) {
		vis[u] = true;
		int ans = 1;
		for(int nxt : graph[u]) {
			if(!vis[nxt]) {
				ans += dfs(nxt);
			}
		}
		return ans;
	}

public:
	void solveOne(int it){
		int n, m;
		cin >> n >> m;
		graph.assign(n, vector<int>());
		for(int i = 0; i < m; i++) {
			int x, y;
			cin >> x >> y;
			x--; y--;
			graph[x].push_back(y);
			graph[y].push_back(x);
		}
		int ans = 0;
		vis.assign(n, false);
		for(int i = 0 ; i < n; i++) {
			if(!vis[i]) {
				ans = max(ans, dfs(i));
			}
		}
		cout << ans << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskD solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 23540
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		char[] c = new Scanner(System.in).nextLine()
		        .toCharArray();
		for (int i = c.length - 1; i >= 0; i--) {
			System.out.print(c[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 11000
program sample
    implicit none
    character(3)::s
    integer(8) :: i,j,m,n,w,t,a,r
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n
    w=0
    a=0
    r=0
    t=0
    do i=1,n
        read(*,*)s
        if (s .eq. 'WA')then
            w=w+1
        else if(s .eq. 'TLE')then
            t=t+1
        else if(s .eq. 'AC')then
            a=a+1
        else
            r=r+1    
        end if
    end do
    write(*,'(a,x,a,x,i6)')'AC','x',a
    write(*,'(a,x,a,x,i6)')'WA','x',w
    write(*,'(a,x,a,x,i6)')'TLE','x',t
    write(*,'(a,x,a,x,i6)')'RE','x',r
    stop
end program sample
  



Measured memory_bytes: 2940
n = int(input())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))

al = sorted(al)
bl = sorted(bl)
cl = sorted(cl)

import bisect
bl_ac = []
for b in bl:
    idx = bisect.bisect_right(cl, b)
    bl_ac.append(n-idx)
import itertools
bl_ac = [0] + list(itertools.accumulate(bl_ac[::-1]))
bl_ac = bl_ac
ans = 0
for a in al:
    idx = bisect.bisect_right(bl, a)
    ans += bl_ac[n-idx]

print(ans)


Measured memory_bytes: 116196
n,m=map(int,input().split())
light=[]
ans=0
for i in range(m):
    List=list(map(int,input().split()))
    light.append(List)
p=list(map(int,input().split()))

for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if (i>>j&1):
            l[j]=1
    on=0
    for k in range(m):
        cnt=0
        for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
        if cnt%2==p[k]:
            on+=1
    if on==m:
        ans+=1
print(ans)

Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, A;
    cin >> N >> A;
    cout << (N * N) - A << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

 
int main()
{
	int n;
	cin>>n;
	int a=0,b;
	for(int i=1;i<=n;i++){
		cin>>b;
		if(a!=0)	continue;
		if(b%2==0){
			if(b%3==0||b%5==0){
			}
			else{
				a=1;
			}
		}
	}
	if(a==0){
		cout<<"APPROVED"<<endl;
	}
	else{
		cout<<"DENIED"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 100000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    ll x;
    cin >> x;

    for (ll a = -2000; a <= 2000; a++) {
        for (ll b = -2000; b <= 2000; b++) {
            if (a*a*a*a*a - b*b*b*b*b == x) {
                cout << a << " " << b << endl; 
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  int n;
  cin>>n;
  vector<P> p(n);
  vector<int> p1(n);
  vector<int> p2(n);
  vector<int> p3(n);
  rep(i,n){
    int x,l; cin>>x>>l;
    p[i].fs=x-l;
    p[i].sc=x+l;
  }
  sort(ALL(p));
  rep(i,n){
    p1[i]=p[i].fs;
    p2[i]=p[i].sc;
    p3[i]=1;
  }
  int ans=1;
  for(int i=n-1;i>=0;i--){
    auto itr=lower_bound(ALL(p1),p2[i]);
    if(itr==p1.end())
    p3[i]=ans;
    else{
      int id=itr-p1.begin();
      if(ans<p3[id]+1){
        p3[i]=p3[id]+1;
        ans++;
      }else
      p3[i]=ans;
    }
  }

  cout<<p3[0]<<endl;

  return 0;
}


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

int main () {
  int K,S;
  cin >> K >> S;
  
  int ans = 0;
  
  for(int a=0; a<=K; a++){
    for(int b=0; b<=K; b++){
      int z = S - a - b;
      if( z>=0 && z<=K ){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

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

public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();

		String[] input = br.readLine().split(" ");
		int r = Integer.parseInt(input[0]);
		int c = Integer.parseInt(input[1]);
		int i = 0;
		int j = 0;
		int a = 0;
		int b = 0;
		int matrix[][] = new int[r][c];

		for( i=0 ; i<r ; i++ ){
			input = br.readLine().split(" ");
			for( j=0 ; j<c ; j++ ){
				matrix[i][j] = Integer.parseInt(input[j]);
			}
		}

		for( i=0 ; i<r ; i++){
			for( j=0 ; j<c ; j++ ){
				a = matrix[i][j] + a;
				sb.append(Integer.toString(matrix[i][j])).append(" ");
			}
			sb.append(Integer.toString(a)).append("\n");
			a = 0;
		}

		for( i=0 ; i<c ; i++ ){
			for( j=0 ; j<r ; j++ ){
				a = a + matrix[j][i];
			}
			sb.append(Integer.toString(a)).append(" ");
			b = b + a;
			a = 0;
		}

		sb.append(Integer.toString(b)).append("\n");
		System.out.print(sb);
	}
}

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

using namespace std;

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

int main(){

    bool flag=false;
    ll ans=INF,sum=0;

    ll n;
    cin >>n;

    for (int i = 1; i <= sqrt(n)+1; i++){
        if(n%i == 0){
            int a = dig(i);
            int b = dig(n/i);

            ans = min((int)ans,max(a,b));
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
while True:
    N=int(input())
    if N==0:
        break
    l=list(range(1,N+1))
    x=0
    for i in range(3,N+1):
        SUM=sum(l[0:i])
        if SUM==N:
            x+=1
        for j in range(i-2):
            SUM=SUM-l[j]
            if SUM==N:
                x+=1
    if N==3:
        print('1')
    else:
        print(x)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  string s;
  in(s);
  for(ll i = 0; i < s.size(); i = i + 2ll){
    out(s[i]);
  }
  memi;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>

using std::list;
using std::max;
using std::min;
using std::vector;

int main()
{
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  int result = 0;
  int ab = std::abs(a - b);
  int bc = std::abs(b - c);
  int ca = std::abs(c - a);
  result = ab + bc + ca - max(ab, max(bc, ca));
  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 128
from itertools import *
import sys

maxnum = 50001
primes = [True]*maxnum
primes[0] = primes[1] = False
for i in xrange(maxnum):
    if i >= maxnum**0.5 : break
    if not primes[i]: continue
    for j in xrange(i*2,maxnum,i): primes[j] = False

p = [ i for i in xrange(maxnum) if primes[i] ]
c = [0]*maxnum*2
for i,j in combinations_with_replacement(p,2):
    c[i+j] += 1

for s in sys.stdin:
    d = int(s)
    if d == 0: break
    print c[d]

Measured memory_bytes: 6292
s=input()
flag=0
if len(s)==2:
    if s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
else:
    for i in range(len(s)-2):
        if s[i]==s[i+1] or s[i+1]==s[i+2] or s[i]==s[i+2]:
            print(i+1,i+3,sep=' ')
            flag=1
            break
    if flag==0:
        print('-1 -1')
            
    

                


Measured memory_bytes: 3188
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
    cin >> A >> B;
    cin >> N;
    ll ans = 0;
    fei(i, A, B, 1) {
    	if(i % N == 0) {
    		ans++;
    	}
    }
    cout << ans << "\n";
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define INF 1000000005
#define MOD 1000000007
#define FF first
#define SS second
#define int long long int

using namespace std;
typedef long long ll;

ll gcd(ll loc, ll b)
{
    if(loc == 0LL)
        return b;
    if(b == 0LL)
        return loc;
    return gcd(b, loc%b);
}

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll modx(ll Base, ll exponent)
{
  ll ans = 1;
  if(Base == 1)
    return Base;
  while(exponent)
  {
    if(exponent & 1)
      ans = (ans * Base)%MOD;
    Base = (Base * Base)%MOD;
    exponent = exponent >> 1;
  }
  return ans;
}

ll inmodx(ll num)
{
  return (modx(num, MOD-2LL));
}

bool cmp(pii loc, pii b)//true for loc before b
{
  if(loc.SS < b.SS)
    return 1;
  if(loc.SS > b.SS)
    return 0;
  if(loc.FF <= b.FF)
    return 1;
  return 0;
}
int dp[500005],inp[500005];
signed main()
{   
    
  
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0); 
    cin.tie(0);
    cout.tie(0);
    
        int n,k;
        cin>>n>>k;
        for(int i=1;i<=n;i++)
        {
          cin>>inp[i];
        }
        for(int i=2;i<=k+1;i++)
        {
          dp[i]=abs(inp[i]-inp[1]);
        }
        if(k<=n-2)
        {
          for(int i=k+2;i<=n;i++)
          {
            dp[i]=INF;
            for(int j=i-1;j>=(i-k);j--)
            {
              dp[i]=min(dp[i],dp[j]+abs(inp[i]-inp[j]));
            }
          }
        }
        cout<<dp[n]<<endl;
        return 0;
}


Measured memory_bytes: 5120
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

ll cost[10];

ll solve(string s);

int main() {
	fast_cin();
	string s; cin >> s;
	string t = s;
	ll k; cin >> k;
	for (int c = 1; c <= 4; ++c) {
		cost[c] = solve(t);
		t += s;
	}
	if (k <= 4) {
		cout << cost[k] << endl;
	} else {
		ll ans = cost[2] + ((k - 2) / 2) * (cost[4] - cost[2]) + (k & 1) * (cost[3] - cost[2]);
		cout << ans << endl;
	}
}

ll solve(string s) {
	ll ans = 0;
	int n = s.length();
	s += char(0);
	ll cur = 1;
	for (int i = 1; i <= n; ++i) {
		if (s[i] == s[i - 1]) {
			++cur;
		} else {
			ans += cur / 2;
			cur = 1;
		}
	}
	return ans;
}

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();
        long ans = 1;
        for (int i = 1; i <= N; i++) {
            ans *= i;
            ans %= 1000000007;
        }

        System.out.println(ans);
    }
}


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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int n;

signed main()
{
    cin >> n;

    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n - 1);

    rep(i, n)
    {
        cin >> a[i];
    }
    rep(i, n)
    {
        cin >> b[i];
    }
    rep(i, n - 1)
    {
        cin >> c[i];
    }

    int ans = b[a[0] - 1];

    rep1(i, n)
    {

        //cout << ans << endl;
        ans += b[a[i] - 1];

        if ((a[i] - a[i - 1]) == 1)
        {
            ans += c[a[i - 1] - 1];
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    int n,k;
    cin>>n>>k;
    vector<int>a(n);
    rep(i,0,n)
        cin>>a[i];
    sort(all(a));
    ll ans = 0;
    for(int i = 0;i<n;i++)
    {
        ans += a[i];
        --k;
        if(k <= 0)
            break;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	vector<pair<int,int>>arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i].first;
		arr[i].second=i+1;
	}
	sort(arr.begin(),arr.end());
	for(int i=0;i<n;i++){
		cout<<arr[i].second<<" ";
	}
	return 0;
}

Measured memory_bytes: 3860
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (long long i = (a); i < (n); i++)
#define REP(i, n) for(long long i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
using namespace std;

typedef long long ll;

long long Mygcd(long long a, long long b)
{
	if (a % b == 0)return b;
	return Mygcd(b, a % b);
}

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

long long Mylcm(long long a, long long b)
{
	return a * b / Mygcd(a, b);
}

int Mylcm(int a, int b)
{
	return a * b / Mygcd(a, b);
}

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

	ll N, M;
	ll temp;
	ll S = 0;

	cin >> N >> M;

	REP(i, M)
	{
		cin >> temp;
		S += temp;
	}

	if (N - S < 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << N - S << endl;
	}

	return 0;
}

Measured memory_bytes: 3656
n,m = map(int,input().split())
c = [False for i in range(200000)]
d = [False for i in range(200000)]
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        c[b] = True
    if b == n:
        d[a] = True
for i in range(n):
    if c[i] and d[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Measured memory_bytes: 6320
H,W = map(int,input().split())
list1 =[]
count = 0
for i in range(H):
  a = list(input())
  list1.append(a)
for i in range(H):
  for j in range(W):
    if list1[i][j] == '#':
      count +=1
if count == H +W -1:
  print('Possible')
else:
  print('Impossible')

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    ll x, y;
    cin >> x >> y;
    if (x % y != 0){
        cout << x << endl;
        return 0;
    }
    else{
        cout << -1 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1e9+7
using namespace std;
#define  pp push_back
#define  po pop_back
#define  mp make_pair
#define clr(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,-1,sizeof(a))
#define fas(a) memset(a,false,sizeof(a))
#define debug(x) cout<<#x<<": "<<x<<endl
#define debug1(x) cout<<#x<<": "<<x<<" "
#define rev(x) reverse(x.begin(), x.end())
#define int long long 
#define F first
#define S second
//int a[2000];
void printvector(std::vector<int> v){  for (int i = 0; i < v.size(); ++i){cout<<v[i]<<" ";}cout<<""<<endl;}
void printarray(int a[],int n){for (int i = 0; i < n; ++i){cout<<a[i]<<" ";}cout<<""<<endl;}
 
 

void  solve()
{
  int n;cin>>n;
  std::vector<pair<int,int> > v(n),sav;    
  for(int i=0;i<n;i++)
  {
     cin>>v[i].F>>v[i].S;
  }

  sav=v;
  sort(v.begin(), v.end());int ma=v.back().F;int mi=v.back().S;
  while(v.back().F==ma)
  {
      mi=min(mi,v.back().S);
      v.pop_back();
  }
  for(auto &it:v)swap(it.F,it.S);sort(v.begin(), v.end());
  for(int i=1;i<v.size();i++)
  {
     v[i].S=max(v[i-1].S,v[i].S);
  }
  int ans=0;
  for(int i=0;i<v.size();i++)
  {
    int x1=0;if(v[0].F>=v[i].S)x1=v[0].F-v[i].S+1;
    int x2=mi;if(i+1!=v.size())x2=min(v[i+1].F,mi);
    if(x2>=ma)x2=x2-ma+1;
    else x2=0;
    ans=max(ans,x1+x2); 
  }

  multiset<int> X,Y;
  for(int i=0;i<sav.size();i++)
  {
     X.insert(-sav[i].F);
     Y.insert(sav[i].S);
  }

  for(int i=0;i<sav.size();i++)
  {
    X.erase(X.lower_bound(-sav[i].F));
    Y.erase(Y.lower_bound(sav[i].S));
    int x1=*Y.begin()+*X.begin()+1;if(x1<0)x1=0;
    int x2=sav[i].S-sav[i].F+1;
    ans=max(ans,x1+x2);
    X.insert(-sav[i].F);
    Y.insert(sav[i].S);
  }   

  cout<<ans<<endl;

}




 int32_t main() 
{

  // #ifndef ONLINE_JUDGE
  //  freopen("input.txt", "r", stdin);
  // #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
    
   solve();

return 0;

}

Measured memory_bytes: 12800
import java.util.Scanner;

class Main{


	public static void main(String[] a){

		Scanner sc = new Scanner(System.in);



		int n = sc.nextInt();

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

			//???????????°??????????????????????????????
			int iningTokuten = 0;
			//?????????????????????
			int outCount = 0;		//MAX:2 3???????????¨????????????????????°????????´
			int baseCount = 0;	//MAX:3 4???????????¨?????????+1


			while(outCount < 3) {
				//???????????????????????????
				String event = sc.next();


				if(event.equals("HIT")) { //???????????????
					if(baseCount == 3) {
						iningTokuten++;
					}else{baseCount++;}

				}else if(event.equals("HOMERUN")) {	//?????????????????????
					iningTokuten += baseCount +1;
					baseCount = 0;

				}else{		//??¢????????????
					outCount++;
				}
			}


			System.out.println(iningTokuten);
		}

	}
}

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

int main() {

  int A,B,res;
  
  cin >> A >> B;
  
  
  res = A*B;
  
  cout << res << endl;
  
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getbit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

const int N = 100005;

int root[N], hang[N];

int find(int i) {
  if (i == root[i]) return i;
  return root[i] = find(root[i]);
}

int join(int u, int v) {
  u = find(u); v = find(v);
  if (u == v) return false;
  if (hang[u] < hang[v]) swap(u, v);
  hang[u] += hang[v];
  root[v] = u;
  return true;
}

void Main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    root[i] = i;
    hang[i] = 1;
  }
  vector<int> fr(n + 1);
  vector<vi> bl(n + 1);
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    join(u, v);
    fr[u]++;
    fr[v]++;
  }
  for (int i = 1; i <= k; i++) {
    int u, v;
    cin >> u >> v;
    bl[u].push_back(v);
    bl[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    int ans = hang[find(i)] - 1;
    ans -= fr[i];
    for (auto &j : bl[i]) {
      if (find(i) == find(j)) ans--;
    }
    cout << ans << ' ';
  }
  cout << '\n';
}

signed main() {
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 11336
#include<stdio.h>
int main(void){
    int a,b,c,i;
    scanf("%d%d%d",&a,&b,&c);
if(a==b&&b==c){
    i=1;
}
else if(a==b||b==c||a==c){
    i=2;
}
else {
    i=1;
}

if(i==1){
    printf("No\n");
}
else{
    printf("Yes\n");
}
return 0;

}

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

int main() {
	int n, lim;
	scanf("%d%d", &n, &lim);
	
	int ans = 0;
	for(int i=0;i<n;i++) {
		int x;
		scanf("%d", &x);
		if(x>=lim) ans++;
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    if N % 2:
        ret = 0
        print(ret)
        return
    ret = N // 10
    i = 1
    while 10 * (5 ** i) <= N:
        ret += N // (10 * (5 ** i))
        i += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

using namespace std;

const int MAX_N = 2e5;

int n;
string s;
int wolf[MAX_N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> s;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            wolf[0] = i;
            wolf[1] = j;
            for (int q = 2; q < n; q++) {
                if (wolf[q - 1]) {
                    if (s[q - 1] == 'x') {
                        wolf[q] = wolf[q - 2];
                    } else {
                        wolf[q] = 1 - wolf[q - 2];
                    }
                } else {
                    if (s[q - 1] == 'x') {
                        wolf[q] = 1 - wolf[q - 2];
                    } else {
                        wolf[q] = wolf[q - 2];
                    }
                }
            }
            int flag = 0;
            if (wolf[0]) {
                if (s[0] == 'o') {
                    if (wolf[n - 1] != wolf[1]) {
                        flag++;
                    }
                } else {
                    if (wolf[n - 1] == wolf[1]) {
                        flag++;
                    }
                }
            } else {
                if (s[0] == 'o') {
                    if (wolf[n - 1] == wolf[1]) {
                        flag++;
                    }
                } else {
                    if (wolf[n - 1] != wolf[1]) {
                        flag++;
                    }
                }
            }
            if (wolf[n - 1]) {
                if (s[n - 1] == 'o') {
                    if (wolf[n - 2] != wolf[0]) {
                        flag++;
                    }
                } else {
                    if (wolf[n - 2] == wolf[0]) {
                        flag++;
                    }
                }
            } else {
                if (s[n - 1] == 'o') {
                    if (wolf[n - 2] == wolf[0]) {
                        flag++;
                    }
                } else {
                    if (wolf[n - 2] != wolf[0]) {
                        flag++;
                    }
                }
            }
            if (flag == 2) {
                for (int i = 0; i < n; i++) {
                    if (wolf[i]) {
                        cout << "W";
                    } else {
                        cout << "S";
                    }
                }
                cout << "\n";
                return 0;
            }
        }
    }
    cout << "-1\n";
}



Measured memory_bytes: 976
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>

#if __has_include(<string_view>)
#include <string_view>
#endif
#if __has_include(<optional>)
#include <optional>

template <class T>
constexpr const T& max(const T& a, const std::optional<T>& b)
{
    return b ? max(a, *b) : a;
}

template <class T>
constexpr const T& max(const std::optional<T>& a, const T& b)
{
    return a ? max(*a, b) : b;
}

template <class T>
constexpr const std::optional<T>& max(const std::optional<T>& a, const std::optional<T>& b)
{
    if (a && b)
        return *a > *b ? a : b;
    else if (a)
        return a;
    else
        return b;
}

template <class T>
constexpr const T& min(const T& a, const std::optional<T>& b)
{
    return b ? min(a, *b) : a;
}

template <class T>
constexpr const T& min(const std::optional<T>& a, const T& b)
{
    return a ? min(*a, b) : b;
}

template <class T>
constexpr const std::optional<T>& min(const std::optional<T>& a, const std::optional<T>& b)
{
    if (a && b)
        return *a < *b ? a : b;
    else if (a)
        return a;
    else
        return b;
}

#endif
#if __has_include(<any>)
#include <any>
#endif

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

using namespace std;

template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template <class T>
istream& operator>>(istream& is, vector<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
istream& operator>>(istream& is, valarray<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
T peak_and_pop(std::queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.front());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::priority_queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::stack<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

void solution()
{
    int64_t n;
    cin >> n;
    string result;
    while(n > 0){
        result.push_back('a' + (n-1) % 26);
        n = (n-1)/26;
    }
    for(auto i = result.rbegin(); i != result.rend(); ++i){
        cout << *i;
    }
    cout << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solution();
    return 0;
}


Measured memory_bytes: 3668
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    r = II()

    print(r*r)
    return

# B


def B():
    N = II()
    S = input()
    if len(S) % 2 == 0:
        print('No')
        return
    j = S[N//2]
    p = N//2
    for i in S[:N//2]:
        if i != j:
            print('No')
            return
        p += 1
        j = S[p]

    print('Yes')

    return

# C


def C():
    N = II()
    x = [0]*N
    y = [0]*N
    for i in range(N):
        x[i], y[i] = LI()
    ans = 0
    for j in range(N-1):
        for k in range(j+1, N):
            len = sqrt(((x[j]-x[k])*(x[j]-x[k]))+((y[j]-y[k])*(y[j]-y[k])))
            ans += len
    ans = ans*2/N
    print(ans)

    return

# D


def D():

    a, b, x = LI()
    BIG = a*a*b/2
    if x > BIG:
        y = 2*b-(2*x/a/a)
        print(math.degrees(math.atan(y/a)))
    else:
        y = 2*x/a/b
        print(math.degrees(math.atan(b/y)))
    return

# E


def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 40432
#include <iostream>
#include <unordered_map>

using namespace std;


int main()
{
	int N;
	int Q;
	int B, C;
	unordered_map<int,int> freq;
	long long int partial = 0;
	cin >> N;
	int tmp;
	for(int i = 0; i < N; i++) {
		cin >> tmp;
		partial += tmp;
		++freq[tmp];
	}
	cin >> Q;
	int delta = 0;
	int sum_delta = 0;
	while(Q) {
		cin >> B >> C;
		delta = C - B;
		sum_delta = delta * freq[B];
		freq[C] += freq[B];
		freq[B] = 0;
		partial += sum_delta;
		cout << partial << endl;
		Q--;
	}
	return 0;
}


Measured memory_bytes: 7092
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, days = 0, sum = 0;
  scanf("%d %d %d", &a, &b, &c);
  while(1){
    if(sum >= c) break;
    days += 1;
    sum += a;
    if(days % 7 == 0) sum += b;
  }
  printf("%d\n", days);
}


Measured memory_bytes: 3232
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to, len;
    Edge(int to0, int len0){
        to = to0;
        len = len0;
    }
};

double INF = DBL_MAX / 2.0;
double EPS = 1.0e-7;

double solve(vector<int>& ticket, vector<vector<Edge> >& edges, int a, int b)
{
    int n = ticket.size();
    int m = edges.size();

    vector<vector<double> > minCost(m, vector<double>(1<<n, INF));
    multimap<double, pair<int, int> > mm;
    mm.insert(make_pair(0.0, make_pair(a, (1<<n)-1)));
    minCost[a][(1<<n)-1] = 0.0;

    while(!mm.empty()){
        multimap<double, pair<int, int> >::iterator it = mm.begin();
        double cost = it->first;
        int x = it->second.first;
        int y = it->second.second;
        mm.erase(it);

        if(x == b)
            return minCost[x][y];
        if(cost > minCost[x][y] + EPS)
            continue;

        bitset<8> bs(y);
        for(unsigned i=0; i<edges[x].size(); ++i){
            int to = edges[x][i].to;
            int len = edges[x][i].len;
            for(int j=0; j<n; ++j){
                if(!bs[j])
                    continue;
                bs[j] = false;
                double cost1 = cost + (double)len / ticket[j];
                if(cost1 < minCost[to][bs.to_ulong()] - EPS){
                    minCost[to][bs.to_ulong()] = cost1;
                    mm.insert(make_pair(cost1, make_pair(to, bs.to_ulong())));
                }
                bs[j] = true;
            }
        }
    }

    return INF;
}

int main()
{
    for(;;){
        int n, m, p, a, b;
        cin >> n >> m >> p >> a >> b;
        if(n == 0)
            break;

        vector<int> ticket(n);
        for(int i=0; i<n; ++i)
            cin >> ticket[i];

        vector<vector<Edge> > edges(m);
        for(int i=0; i<p; ++i){
            int x, y, z;
            cin >> x >> y >> z;
            edges[x-1].push_back(Edge(y-1, z));
            edges[y-1].push_back(Edge(x-1, z));
        }

        double ret = solve(ticket, edges, a-1, b-1);
        if(ret == INF)
            cout << "Impossible" << endl;
        else
            printf("%.10f\n", ret);
    }
}

Measured memory_bytes: 2668