akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)   //test cases
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define error(x) fixed<<setprecision(x) //cout<<error(5)<<someDouble    -> example - 3.14159
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll i = 0; i < n; i++)    cin>>a[i];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
	boost;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

vvll g;	ll n, m, x, y;	vll dp(MX, -1);
ll dfs(ll i){
	if(dp[i] != -1)	return dp[i];
	ll ans = 0;
	for(auto c : g[i])	ans = max(ans, 1 + dfs(c));
	return dp[i] = ans;
}
int main(){
	init();
	cin>>n>>m;	g.resize(n+1);
	while(m--){
		cin>>x>>y;	g[x].push_back(y);
	}
	for(ll i = 1; i <= n; i++)	dfs(i);
	cout<<*(max_element(dp.begin(), dp.end()));
}

Measured memory_bytes: 11556
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  if(N >= M) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> data(M);
  for(int i = 0; i < M; i++) {
    cin >>data.at(i);
  }
  sort(data.begin(), data.end());
  vector<int> sa(M - 1);
  for(int i = 0; i < M - 1; i++) {
    sa.at(i) = data.at(i + 1) - data.at(i);
  }
  sort(sa.begin(), sa.end());
  int ans = 0;
  for(int i = 0; i < M - N; i++) {
    ans += sa.at(i);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Vertex {
    vector<ll> node;
    vector<pll> cost;
};

Vertex V[100005];
ll Y[100005];
ll C[100005];
ll A[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M, S, T;
    cin >> N >> M >> S >> T;
    S--;
    T--;
    REP(i, M) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--;
        v--;
        V[u].node.push_back(v);
        V[u].cost.push_back(pll(a, b));
        V[v].node.push_back(u);
        V[v].cost.push_back(pll(a, b));
    }
    REP(i, N) {
        Y[i] = C[i] = INF;
    }

    {
        priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q([](pll a, pll b) { return a.second > b.second; });
        Y[S] = 0;
        q.push(pll(S, 0));
        while (!q.empty()) {
            pll t = q.top();
            q.pop();

            if (Y[t.first] < t.second)
                continue;

            REP(i, V[t.first].node.size()) {
                ll n = V[t.first].node[i];
                ll cost = V[t.first].cost[i].first + t.second;
                if (Y[n] <= cost)
                    continue;
                Y[n] = cost;
                q.push(pll(n, cost));
            }
        }
    }
    {
        priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q([](pll a, pll b) { return a.second > b.second; });
        C[T] = 0;
        q.push(pll(T, 0));
        while (!q.empty()) {
            pll t = q.top();
            q.pop();

            if (C[t.first] < t.second)
                continue;

            REP(i, V[t.first].node.size()) {
                ll n = V[t.first].node[i];
                ll cost = V[t.first].cost[i].second + t.second;
                if (C[n] <= cost)
                    continue;
                C[n] = cost;
                q.push(pll(n, cost));
            }
        }
    }

    A[N] = INF;
    for (ll i = N - 1; i >= 0; --i) {
        A[i] = std::min(A[i + 1], C[i] + Y[i]);
    }

    REP(i, N) {
        cout << INF - A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 17736
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a[200010],xsum[200010],sum[200010],ans=0;
    sum[0]=0;xsum[0]=0;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        sum[i+1]=sum[i]+a[i];
        xsum[i+1]=xsum[i]^a[i];
        // cout<<sum[i+1]<<" "<<xsum[i+1]<<endl;
    }
    ll right=0;
    rep(left,n){
        while(right<n && (xsum[right+1]^xsum[left])==(sum[right+1]-sum[left])){
            right++;
            // cout<<(xsum[right+2]^xsum[left])<<" "<<sum[right+2]-sum[left]<<endl;
        }
        right--;
        // cout<<left<<" "<<right<<endl;
        ans+=right -left+1;
        right++;
        // cout<<ans<<endl;
    }
    /*
    bool flag=false;
    rep(l,n){
        rep2(r,l,n){
            ll x=xsum[r+1]^xsum[l];
            ll s=sum[r+1]-sum[l];
            if(x==s){
                cout<<l<<" "<<r<<endl;
                ans++;
            } else break;
            if(r==n-1){
                flag=true;
                ans+=(n-1-l)*(n-l)/2;
                break;
            }
        }
        if(flag) break;
    }
    */

    cout<<ans<<endl;

    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    ll n,d,a;cin>>n>>d>>a;
    vll x(n);
    vl y(n),z(n,0);
    rep(i,n)cin>>x[i].F>>x[i].S;
    sort(all(x));
    rep(i,n)y[i]=x[i].F;
    ll ans=0;
    vl sum(1);
    sum[0]=0;
    ll t=0,k=0;
    rep(i,n){
        if(x[i].S-(t-sum[k])*a>0){
            int l=upper_bound(all(y),x[i].F+2*d)-y.begin()-1;
            z[l]++;
            ll p=(x[i].S-(t-sum[k])*a)/a;
            if((x[i].S-(t-sum[k])*a)%a>0)p++;
            ans+=p;
            t+=p;
            sum.PB(t);
        }
        k+=z[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 8692
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    edge[x].append(y)
    edge[y].append(x)
M = int(input())
AB = tuple(tuple(map(int, input().split())) for _ in range(M))


parent = [-1] * (N + 1)
node = [1]
while node:
    s = node.pop()
    for t in edge[s]:
        if t == parent[s]:
            continue
        parent[t] = s
        node.append(t)

pair = [-1] * M
for i, (a, b) in enumerate(AB):
    pa = set()
    pb = set()
    while a != 1:
        pa.add(a - 1)
        a = parent[a]
    while b != 1:
        pb.add(b - 1)
        b = parent[b]
    pair[i] = pa ^ pb

ans = pow(2, N - 1)

whole = set(range(1, N))
for bit in range(1, 1 << M):
    popcnt = 0
    inter = set()
    for i in range(M):
        if (bit >> i) & 1:
            popcnt += 1
            inter |= pair[i]
    x = N - len(inter) - 1
    if popcnt % 2 == 1:
        ans -= 2 ** x
    else:
        ans += 2 ** x

print(ans)

Measured memory_bytes: 42588
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int int64_t
#define fi first
#define se second
signed main(){
  int a,b;
  for(int i=0;i<7;i++){
    cin>>a>>b;
    cout<<abs(a-b)<<"\n";
  }
}



Measured memory_bytes: 3092
// author: Saman Mahdanian
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 10;
const int MOD = 1e9 + 7;

int _sum (int, int);
int _mul (int, int);
int _pow (int, int);
int gcd (int, int);

int a[N], b[N];

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

	long long a, b, c, d;
	cin >> a >> b >> c >> d;

	auto get = [&] (long long k) {
		return b / k - (a - 1) / k;
	};
	cout << b - a + 1 - get(c) - get(d) + get(c * d / gcd (c, d)) << endl;
}

int gcd (int a, int b) {
	return !b? a : gcd (b, a % b);
}

// int choose (int r, int k) {
// 	return _mul (f[k], _mul(inv[r], inv[k - r]));
// }

int _sum (int a, int b) {
	return a + b - (a + b >= MOD? MOD : 0);
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b) 
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1)
		res = _mul (res, a);
	return res;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=5005;
const int mod=1e9+7;
double dp[N][N],p[N];
int main()
{
int n;
scanf("%i",&n);
for(int i=1;i<=n;i++)
cin>>p[i];
dp[0][0]=1;
for(int i=1;i<=n;i++)
for(int j=0;j<=n;j++)
{
dp[i][j]+=dp[i-1][j]*(1-p[i]);
dp[i][j+1]+=dp[i-1][j]*p[i];
}
double ans=0;
for(int i=n+1>>1;i<=n;i++)
ans+=dp[n][i];
cout<<fixed<<setprecision(12)<<ans;
return 0;
}

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

using namespace std;

int main()
{

    long long a,b,c,d,n[4];

    cin>>a>>b>>c>>d;

    n[0]=a*d;n[1]=a*c;n[2]=b*d;n[3]=b*c;

    sort(n,n+4);

    cout<<n[3];


    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

void sort(int a[3]){
    int i;
    int tmp = 0;
    for(i=0;i<2;i++){
        if(a[i] > a[i+1]){
            tmp = a[i];
            a[i] = a[i+1];
            a[i+1] = tmp;
        }
    }
}

int sousa(int a[3], int count){
    sort(a);
    if(a[1] == a[2]){
        a[0] += 2;
        count += 1;
    }else{
        a[0]+=1;
        a[1]+=1;
        count += 1;
    }
    sort(a);
    // printf("%d\n", count);
    return count;
}



int max(int a, int b){
    if(a > b){
        return a;
    }else{
        return b;
    }
}




int main(){
    int A, B, C;
    int i, j;
    scanf("%d %d %d", &A, &B, &C);
    // printf("%d %d %d\n", A, B, C);

    int number[3] = {A, B, C};
    int cnt = 0;

    sort(number);

    while((number[0] != number[1])||(number[0]!=number[2])){
        cnt = sousa(number, cnt);
    }
    
/*
    for(i=0;i<3;i++){
        printf("%d\n", number[i]);
    }
*/


    printf("%d",cnt);



    return 0;
}

Measured memory_bytes: 128
using System;

namespace abc144_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int index = int.Parse(Console.ReadLine());
            if (index > 81)
            {
                Console.WriteLine("No");
            }
            else
            {
                for (int i = 1; i < 10; i++)
                {
                    if (index % i == 0 && index / i < 10)
                    {
                        Console.WriteLine("Yes");
                        break;

                    }
                    if (i == 9)
                    {
                        Console.WriteLine("No");
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define anuj ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define ll long long int
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%I64d",&x)
#define ss(s)	scanf("%s",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define endl '\n'
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;
const int N = 2e5;
const int LG = 20;
int a[N],dp[N][4];

int main(){
	anuj;

	int n;
	cin >> n;
	int a,b,c;
	Fo(i,1,n+1){
		cin >> a >> b >> c;
		dp[i][1]=a+max(dp[i-1][2],dp[i-1][3]);
		dp[i][2]=b+max(dp[i-1][1],dp[i-1][3]);
		dp[i][3]=c+max(dp[i-1][1],dp[i-1][2]);
	}

	cout << max(dp[n][1],max(dp[n][2],dp[n][3]));

}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

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

	int n, k;
	cin >> n >> k;

	// 勝つ確率

	double ans = 0;

	for (int i = 1; i <= n; i++) {
		int score = i; // nがでた
		double kaku = 1.0;
		int cnt = 0;
		while (score < k) {
			score *= 2;
			cnt++;
			kaku /= 2.0;
		}
		ans += kaku / (double)n;
	}

	//cout << ans << endl;
	printf("%1.12lf\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int>v;

int main() {
	int n;
	cin >> n;
	REP(i, 0, n) {
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(all(v));
	int a = 0, b = 0;
	REP(i, 0, v.size()) {
		if (i % 2 == 0) {
			a += v[v.size() - i - 1];
		}
		else {
			b += v[v.size() - i - 1];
		}
	}
	printf("%d\n", a - b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = ((i-(h*3600))/60)  ;
   s = i % 60;
   
   cout << h << ":" << m << ":" << s <<endl;

 

   
   return 0;
}


Measured memory_bytes: 3100
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	ll n,i,j, f[mx], b[mx], w[mx];
	cin>>n>>w[0];
	f[0]= w[0];
	for(i=1; i< n; i++)
	{
	    cin>>w[i];
	    f[i]= f[i-1] + w[i];
	}
	b[n-1]= w[n-1];
	for(i=n-2; i>-1; i--){
	    b[i]= b[i+1]+ w[i];
	}
	ll ans= inf;
	for(i=0; i< n-1; i++)
	{
	    
	    ll kk= abs(f[i]- b[i+1]);
	    if(kk<ans)
	    ans= kk;
	}
	cout<<ans;
    return 0;
}























Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt(), c = scanner.nextInt(), d = scanner.nextInt();
			int left = a + b, right = c + d;
			System.out.println((left == right) ? "Balanced" : (left > right) ? "Left" : "Right");
		}
	}
}


Measured memory_bytes: 35696
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,w;
	cin>>n>>w;
	vector<int> wt(n),v(n);
	long long int dp[2][100005];
	int V = 100005;
	for(int i=0;i<n;i++)
		cin>>wt[i]>>v[i];
	// dp[i][j] = dp[i-1][j-wt[i]]+v[i];
	dp[0][0] = 0;
	for(int j=1;j<=V;j++)
		dp[0][j] = (j<=v[0]) ? wt[0] : INT_MAX;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<V;j++)
		{
			dp[i%2][j] = dp[(i-1)%2][j];
			dp[i%2][j] = min(dp[i%2][j],dp[(i-1)%2][max(0,j-v[i])]+1LL*wt[i]);
		}
	}

	// for(int i=0;i<n;i++)
	// {
	// 	for(int j=0;j<20;j++)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }

	int ans = -1;
	for(int i=0;i<V;i++)
		if(dp[(n-1)%2][i]<=w)
			ans=max(ans,i);
	cout<<ans<<endl;
}

Measured memory_bytes: 5116
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <bits/stdc++.h>
/*
#include <cstdio>
#include <cstring>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
 */
using namespace std;
#define LSON            id << 1 , l , mid
#define RSON            id << 1 | 1 , mid + 1 , r
#define LS              id << 1
#define RS              id << 1 | 1
#define ROOT            1 , 1 , n
#define CLR(x , y)      memset(x , y , sizeof(x))
#define LOWBIT(x)       x & (-x)
#define FORN(i , a , n)  for(int i = (a) ; i <= (n) ; ++i)
#define FORP(i , n , a)  for(int i = (n) ; i >= (a) ; --i)
#define CASE(x)		printf("Case %d: ", x)
#define CASE#(x) printf("Case #%d: " , x)
#define SFD(x)      scanf("%lf" , &x)
#define SFC(x)      scanf(" %c" , &x)
#define SFS(x)      scanf(" %s" , x)
#define SFI(x)      scanf("%d" , &x)
//#define SFL(x)      scanf("%lld" , &x)
#define SFI64(x)    scanf("%I64d" , &x)
#define PFF(x)         printf("%f" , x)
#define PFD(x)         printf("%lf" , x)
#define PFI(x)         printf("%d" , x)
#define PFC(x)         printf("%c" , x)
#define PFS(x)         printf("%s" , x)
#define PFI64(x)       printf("%I64d" , x)
//#define PFL(x)         printf("%lld" , x)
#define SPACE          printf(" ")
#define PUT            puts("")
#define TEST           printf("pass\n");
#define LPUP(i , j , k) for(int i = j ; i <= k ; ++i)
#define LPDW(i , j , k) for(int i = j ; i >= k ; --i)
#define PB(x)          push_back(x)
#define ALL(A)         A.begin(), A.end()
#define SZ(A)          int((A).size())
#define LBD(A, x)      (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x)      (upper_bound(ALL(A), x) - A.begin())
//#define LOCAL
static const double PI = acos(-1.0);
static const double EPS = 1e-8;
static const int SEED = 131;
static const int OO = 0X3fffffff;
typedef unsigned long long ULL;
typedef long long LL;
typedef double DB;
inline int read1()
{
    int x = 0;
    int f = 1 ; char ch = getchar();
    while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = (x << 1) + (x << 3) + (ch - '0'); ch = getchar();}
    x *= f;
    return x;
}

struct buf
{
	operator int()
	{
		int x = 0 , y = 0 , c = getchar();
		while(c < 48)
			y = c == 45 , c = getchar();
		while(c > 47)
			x = (x << 1) + (x << 3) + (c - 48) , c = getchar();
		return y ? -x : x;
	}
}read;



inline void write(int x)
{
    int y = 10 , len = 1;
	if(x < 0)
	{
		putchar('-');
		x = -x;
	}
    while(y <= x)
    {
        y *= 10;
        ++len;
    }
    while(len--)
    {
        y /= 10;
        putchar(x / y + 48);
        x %= y;
    }
}

/************************Little Pea****************************/


int main()
{
#ifdef LOCAL
    freopen("G:\\desktop\\littlepea\\in.data" , "r" , stdin);
#endif
    int x , a , b;
    scanf("%d%d%d" , &x , &a , &b);
    int aa = abs(x - a);
    int bb = abs(x - b);
    if(aa > bb)
        puts("B");
    else
        puts("A");

#ifdef LOCAL
    fclose(stdin);fclose(stdout);
#endif
}


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

typedef long long int ll;
const ll n = 1e6+100;
const ll mod = 998244353;

ll po(ll base, ll e) {
	ll res = 1;
	while(e != 0) {
		if(e % 2 == 1) {
			res *= base;
			res %= mod;
		}
		base *= base;
		base %= mod;
		e /= 2;
	}
	return res;
}

ll inv(ll k) {
	k %= mod;
	assert(k != 0);
	ll res = po(k, mod-2);
	assert(res*k%mod == 1);
	return res;
}

int main() {
	vector<ll> ns(n, 0);
	{
		int m;
		cin >> m;
		forn(i, 0, m) {
			ll k;
			cin >> k;
			ns[k]++;
		}
	}

	vector<ll> factor(n, 0);
	ll total = 0;
	forn(g, 1, n) {
		ll k = factor[g] + inv(g);
		k %= mod;

		ll sum = 0;
		for(ll i = 0; i < n; i += g) {
			sum += i*ns[i];
			sum %= mod;
			factor[i] += mod - k;
			factor[i] %= mod;
		}
		sum %= mod;
		sum *= sum;
		sum %= mod;

		total += sum * k;
		total += mod - (ns[g] * g) % mod;
		total %= mod;
	}

	total *= inv(2);
	total %= mod;

	cout << total << endl;
}

Measured memory_bytes: 15872
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n, k, ans, a[200];
int main()
{
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    for(int i = 1; i < n; i++) {
        if(k >= a[i]) {
            k -= a[i];
            ans++;
        }
        else break;
    }
    if(k == a[n]) ans++;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
use std::collections::HashMap;

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

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

pub struct UnionFind {
    pub par: Vec<usize>,
    pub rank: Vec<usize>,
}

impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        let par = (0..n).collect::<Vec<usize>>();
        let rank = vec![0; n];
        UnionFind { par: par, rank: rank }
    }

    pub fn root(&mut self, x: usize) -> usize {
        let cand = self.par[x];
        if cand == x {
            return x;
        } else {
            let ret = self.root(cand);
            self.par[x] = ret;
            return ret;
        }
    }

    pub fn same(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }

    pub fn unite(&mut self, x: usize, y: usize) {
        let root_x = self.root(x);
        let root_y = self.root(y);
        if root_x == root_y { return; }

        if self.rank[root_x] < self.rank[root_y] {
            self.par[root_x] = self.par[root_y];
        } else {
            self.par[root_y] = self.par[root_x];
            if self.rank[root_y] == self.rank[root_x] {
                self.rank[root_x] += 1;
            }
        }
    }
}

fn main() {
    let nmk = readn::<usize>(" ");
    let n = nmk[0];
    let m = nmk[1];
    let k = nmk[2];

    let mut uf = UnionFind::new(n);
    let mut loss = vec![1; n];
    for _ in 0..m {
        let ab = readn::<usize>(" ");
        let a = ab[0] - 1;
        let b = ab[1] - 1;
        uf.unite(a, b);
        loss[a] += 1;
        loss[b] += 1;
    }

    let mut dict = HashMap::new();
    for i in 0..n {
        let count = dict.entry(uf.root(i)).or_insert(0usize);
        *count += 1;
    }

    for _ in 0..k {
        let cd = readn::<usize>(" ");
        let c = cd[0] - 1;
        let d = cd[1] - 1;
        if uf.same(c, d) {
            loss[c] += 1;
            loss[d] += 1;
        }
    }

    let mut ans = "".to_string();
    for i in 0..n {
        let num = dict.get(&uf.root(i)).unwrap() - loss[i];
        ans = ans + &(num.to_string()) + " ";
    }
    println!("{}", ans);
}

Measured memory_bytes: 14588
#include "vector"
#include "set"
#include "map"
#include "unordered_set"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define INF2 4611686018427387904
//#define MOD 1000000007
#define MOD 998244353
#define MAX_SIZE 1000000000

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) { bool first = true; for (const auto& j: v) { if (!first) { os << " "; } first = false; os <<j; } os << "\n"; return os; }
template<typename T>
istream& operator>>(istream& is, vector<T>& v) { for (auto& elem : v) { is >> elem; } return is; }

vector<ll> f;
void set_f(int n) { f.resize(n+1); f[0] = 1; for (int i=1; i<= n; i++) { f[i] = (f[i-1] * i) % MOD;} }
ll nod(ll a, ll b) { if (b == 0) { return a; } else { return nod(b, a % b); } }
ll pw(ll x, ll n, ll m=MOD) { if (n == 0) { return 1;} if (n%2 == 0) { return pw((x*x) % m, n/2, m); } return (pw(x, n-1, m) * x) % m; }
ll dv(ll a, ll b) { return (a * pw(b, MOD - 2)) % MOD; }
ll c_n_k(int n, int k) { if (k > n) { return 0; } if (k < 0) { return 0; } return dv(dv(f[n], f[k]), f[n-k]); }

void solve() {
    ll x;
    cin >> x;

    for (ll a=0; a * a * a * a <= x; a++) {
        ll y = a * a * a * a * a - x;
        ll sign = 1;
        if (y < 0) {
            sign = -1;
            y = -y;
        }

        ll b = 0;
        while (b * b * b * b * b < y) {
            b++;
        }
        b *= sign;

        //cout << a << ' ' << y << ' ' << b << endl;

        if (a * a * a * a * a - b * b * b * b * b == x) {
            cout << a << ' ' << b;
            return;
        }
    }
}

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

    if (0) {
        int tests;
        cin >> tests;
        for (int t = 1; t <= tests; t++) {
            //cout << "Case #" << t << ": ";
            solve();
            //cout << "\n";
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

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

int n, a[111], cnt;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i];
	sort(a+1, a+1+n);

	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int k=j+1;k<=n;k++){
				if(a[i] != a[j] && a[j] != a[k] && a[j] != a[i] && a[k] < a[i] + a[j]) cnt++;
			}
		}
	}
	cout << cnt;
}

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

struct UnionFind {
    vector<int> parent;
    UnionFind(int N) {
        parent=vector<int>(N,-1);
    }
    int root(int x) {
        if (parent[x] < 0) return x;
        return parent[x] = root(parent[x]);
    }
    int size(int x){
        return -parent[root(x)];
    }
    bool unite(int x, int y) {
        x=root(x);
        y=root(y);
        if (x==y) return false;
        if(size(x)<size(y)) swap(x,y);
        parent[x]+=parent[y];
        parent[y]=x;
        return true;
    }
    bool same(int x, int y) {
        return root(x)==root(y);
    }
};

int main(){

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

    UnionFind tree(n);
    vector<int> cnt(n,0);

    rep(i,m){
        int a,b;
        cin >>a >> b;
        a--;b--;
        tree.unite(a,b);
        cnt[a]++;
        cnt[b]++;
    }

    vector<vector<int>> cd(n);

    rep(i,k){
        int c,d;
        cin >> c >> d;
        c--;d--;
        cd[c].push_back(d);
        cd[d].push_back(c);
    }
    vector<int> ans(n);
    rep(i,n){
        ans[i]=tree.size(i)-1-cnt[i];
        rep(j,cd[i].size()){
            if(tree.same(i,cd[i][j])){
                ans[i]--;
            }
        }
    }
    rep(i,n){
        cout << ans[i] <<" ";
    }cout << endl;

    return 0;
}

Measured memory_bytes: 7168
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

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

ll m(ll a,ll b,ll x){

  ll A=a-a%x,B=b-b%x;
  ll ret=(B-A)/x;
  if(a%x==0)ret++;

  return ret;
}


int main(void){
  ll a,b,c,d,e;
  
  cin>>a>>b>>c>>d;
  ll n=b-a+1;

  e=c*d/gcd(c,d);

  cout<<n-(m(a,b,c)+m(a,b,d))+m(a,b,e)<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n, h, w, x, y, q = 0;
	cin >> n >> h >> w;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> y;
		q += min(x / h, y / w);
		//cout << q << endl;
	}
	cout << q;
	return 0;
}


Measured memory_bytes: 256
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let [| s; t |] = reada string
    let [| a; b |] = reada int
    let u = read string
    if s = u then sprintf "%d %d" (a - 1) b else sprintf "%d %d" a (b - 1)
    |> puts
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 14160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int digitsum(string s){
    int res = 0;
    int k = s.size();
    rep(i, k) res += s[i] - '0';
    return res;
}

int main(){
    int n;
    cin >> n;
    int ans = 10000;
    for(int i = 1; i < n; i++){
        string s = to_string(i);
        string t = to_string(n-i);
        ans = min(ans, digitsum(s)+digitsum(t));
    }    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
s = input()
count = 0
flag = 1
que = deque([0]*(2*k+1))
ans = 0
tmp = 0
for x in s:
    if x == '0':
        if flag == 1:
            que.append(count)
            tmp += count - que.popleft()
            ans = max(ans, tmp) 
            count = 0
        flag = 0
        count += 1
    else:
        if flag == 0:
            que.append(count)         
            tmp += count - que.popleft()
            count = 0
        flag = 1
        count += 1

que.append(count)
tmp += count - que.popleft()
if s[-1] == '0':
    tmp -= que.popleft()
ans = max(ans,sum(que))
print(ans)

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

num = [0] * (N + 1)
for a in A:
    num[a] += 1

S = 0
for n in num:
    S += n * (n - 1) // 2

ans = []
for i in range(N):
    rst = S
    p = A[i]
    m = num[p]

    rst -= m * (m - 1) // 2
    rst += (m - 1) * (m - 2) // 2
    ans.append(rst)

print(*ans, sep='\n')


Measured memory_bytes: 90572
function main(input){
  input = input.split('\n');
  const N = Number(input[0].split(' ')[0]);
  const K = Number(input[0].split(' ')[1]) - 1;
  var S = input[1].split('');
  
  result = [];
  S.forEach((value,index) => {
    if(index == K){
      result.push(value.toLowerCase());
    }else{
     result.push(value);
    }
  })
    console.log(result.join(''));
}
main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5+5;

long long int arr[N];
int main()
{
    int t,a,b,c,n,i,j=0,m1,m2,d1,d2;
  cin>>a>>b>>c;
  m2=a+b+c;

  if(m2>=22)
  {
       cout<<"bust"<<endl;
  }

  else
  {
       cout<<"win"<<endl;

  }








    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define txt freopen("ip.txt", "r", stdin); freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define div2(a) (!(a&1))
#define deb(x) cout<<(#x)<<" "<<(x)<<"\n";
#define newl cout<<"\n" 
#define all(s) s.begin(),s.end()
#define pi 3.14159265358979323846
#define fp(x) fixed<<setprecision(x)<<
template<class T>
T mod(T a){
    if(a < 0){
        a += 1000000007;
    }
    return a%1000000007; 
}
template<class T>
T addmod(T a, T b){
    return (mod(a) + mod(b)) % 1000000007;
}
template<class T>
T prodmod(T a, T b){
    return (mod(a) * mod(b)) % 1000000007;
}
template<class T>
T bin_exp(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b %2 == 0)
        res = bin_exp(a * a, b / 2);
    else
    {
        res *= a;
        temp = bin_exp(a, --b);
    }
    return res * temp;
}
template<class T>
T bin_expmod(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b %2 == 0)
        res = bin_expmod(prodmod(a,a), b / 2);
    else
    {
        res = prodmod(a,res);
        temp = bin_exp(a, --b);
    }
    return prodmod(res , temp);
}

template<class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template<class T>
int sumAllInts(T n){
    int a = 1;
    int su = 0;
    while(n){
        su += n%10;
        n/=10;
    }
    return su;
}
template<class T>
void split(char c,T s){
    int n = s.size();
    int i = 0;
    while ((cout<<s[i],i+=1) && (i<n) && (cout<<c<<' '));
}
void solve(){
    long long int N;
    cin>>N;
    cout<<(800*N)-((N/15)*200)<<endl;
}
int main(){
    quickie;
    
    int t=1;
    while(t--){
        solve(); 
        newl; 
    } 
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18;
int main(){
    ll n,m;
    cin>>n>>m;
    if(n*m<=2){
        cout<<n*m%2<<endl;
    }
    else if(n==1||m==1){
        cout<<max((ll)0,n-2)*m+max((ll)0,m-2)*n<<endl;
    }
    else cout<<(n-2)*(m-2)<<endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

int main(void)
{
    int ans = 0;
    int x, y, z;

    scanf("%d%d%d", &x, &y, &z);

    int tmp = x;
    x = y;
    y = tmp;

    tmp = x;
    x = z;
    z = tmp;

    printf("%d %d %d\n", x, y, z);

    return 0;
}

Measured memory_bytes: 1692
#include <stdio.h>

int main(){
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  int tmp = 0;
  tmp = a;
  a = b;
  b = tmp;
  
  tmp = a;
  a = c;
  c = tmp;
  
  printf("%d %d %d", a, b, c);
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> position(n + 1);
	FOR(i, 0, n) {
		scanf("%d", &a[i]);
		position[a[i]] = i;
	}
	set<int> border;
	long long sumx = 0;
	FOR(i, 1, n + 1) {
		int nowpos = position[i];

		// upper_bound(border.begin(), border.end(), nowpos)じゃだめらしい(時間が)
		auto pos = border.upper_bound(nowpos);

		int ub, lb;
		if (border.size() == 0) {
			ub = n, lb = -1;
		}

		else if (pos == border.end()) {
			ub = n;
			lb = *border.rbegin();
		}
		else {
			ub = *pos;
			if (pos == border.begin())
				lb = -1;
			else
				lb = *(--pos);
		}

		long long left = nowpos - lb - 1;
		long long right = ub - nowpos - 1;
		if (left < right)
			swap(left, right);

		long long toadd = (long long)i*(right + 1)*(left + 1);
		sumx += toadd;
		border.insert(nowpos);
	}
	cout << sumx << endl;


	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int n;
	cin >> n;
	if (n / 10 == 9 || n % 10 == 9)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define RSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))
#define PREC(n) setprecision(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef unsigned long long lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
    int n,i,j,k,m;
    vi x,y;
    double ans;

    cin>>n;
    SIZE(x,n);
    SIZE(y,n);
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    ans=0;
    k=1;
    rep(i,n){
        k*=(i+1);
    }
    m=k/n;
    m*=2;
    rep(i,n-1){
        repj(j,i+1,n){
            ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))*m;
        }
    }
    cout<<PREC(20)<<ans/k<<endl;
	
	return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N,D;
    cin >>N>>D;



    cout << (N+2*D)/(2*D+1) <<endl;
    return (0);
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  int M=N%10;
  
  if(M==3)
    cout<<"bon"<<endl;
  else if(M==0 || M==1 || M==6 || M==8)
    cout<<"pon"<<endl;
  else
    cout<<"hon"<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    
    int a,b,c;
    cin>>a>>b>>c;
    if(a==5&&b==7&&c==5||a==5&&b==5&&c==7||a==7&&b==5&&c==5){
        cout<<"YES"<<endl;
    }
    
    else {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
#include<cstdio>
int dpL[200005],dpR[200005],n,D,a[200005];
long long ans;
int Min(int x,int y){return x>y?y:x;}
int main()
{
	scanf("%d%d",&n,&D);
	for(int i=0;i<n;i++)
	scanf("%d",a+i),ans+=a[i]+D;
	ans-=D;
	dpR[0]=a[0];
	for(int i=1;i<n;i++)
	dpR[i]=Min(dpR[i-1]+D,a[i]);
	dpL[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)
	dpL[i]=Min(dpL[i+1]+D,a[i]);
	for(int i=1;i<n-1;i++)
	ans+=Min(dpL[i],dpR[i]);
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 2560
s = input()
t = input()

news=''.join(sorted(s))
newt=''.join(sorted(t, reverse=True))
mylist=[news,newt]
mylist=sorted(mylist)

if news==newt:
    print("No")
    exit()

if mylist[0]==news:
    print("Yes")
else:
    print("No")

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


int main() {
  long long a, b , c ;
  cin >> a >> b >> c ;
  
  bool ans = false;
  for(int i=1;i<=a*b;i++){
    int x=a*i;
    if(x%b==c){
      ans = true ;
      break ;
    }
  }
  if(ans){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}



//距離を計算
double calc_dist(double x1, double y1, double x2, double y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main(){//
	int N;
	cin >> N;
	vector<double> x(N), y(N);
	vector<int> p(N);
	for(int i=0; i<N; i++) cin >> x[i] >> y[i];
	for(int i=0; i<N; i++) p[i] = i;

	int nPn = 1;
	for(int i=1; i<=N; i++) nPn *= i;
	//cout << " p: "; print_vec(p); cout << "    nPn: " << nPn << endl;
	double sum = 0;
	do{
		
		for(int i=0; i<N-1; i++){
			sum += calc_dist(x[p[i]], y[p[i]], x[p[i+1]], y[p[i+1]]);
		}

		


	}while(next_permutation(p.begin(), p.end()));

	sum /= nPn;
	printf("%.8f", sum);
}


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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	string s;

	cin >> s;
	int n = s.size();
	int ans = n;
	stack<char> st;
	REPU(i, 0, n) {
		if (s[i] == 'S') st.push(s[i]);
		else {
			if (!st.empty()) {
				st.pop();
				ans -= 2;
			}
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720