akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x,int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

int N, D;
double X[10][10];

double dist(int i, int j)
{
	double x = 0;
	for (int k = 0; k < D; k++)
	{
		x += pow((X[i][k] - X[j][k]), 2.0);
	}
	return pow(x, 0.5);
}


int main()
{
	cin >> N >> D;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < D; j++)
		{
			cin >> X[i][j];
		}
	}

	int ans = 0;
	double d;
	int di;
	for (int i = 0; i < N-1; i++)
	{
		for (int j = i+1; j < N; j++)
		{
			d = dist(i, j);
			di = (int)d;
			if (d-(double)di == 0) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define mod 1000000007
#define int long long
using namespace std;

signed main(){
    double r; cin>>r;
    double e=3.14159, num=2;
    double ans=(num*r)*e;
    
    cout<<setprecision(8)<<ans;
    return 0; 
}

Measured memory_bytes: 3784
S = int(input())

Flag = True

if (S//1000) == ((S%1000)//100) or ((S%1000)//100) == ((S%100)//10) or ((S%100)//10) == ((S%10)//1):
  Flag = False
  
if Flag == False:
  print("Bad")
else:
  print("Good")

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

int compare_int(const void *a, const void *b) {
  return *(int*)a - *(int*)b;
}

int min3(int a, int b, int c) {
  int min=a;
  if (b < min) min=b;
  if (c < min) min=c;
  return min;
}

int main() {
  int N,A,B;
  scanf("%d",&N);
  scanf("%d %d",&A,&B);
  int P[N];
  for (int i = 0; i < N; i++) {
    scanf("%d",&P[i]);
  }
  qsort(P, N, sizeof(int), compare_int);
  int a=0,b=0,c;
  for (int i = 0; i < N; i++) {
    if (P[i] <= A) a++;
    if (A < P[i] && P[i] <= B) b++;
  }
  c=N-(a+b);
  int answer;
  answer = min3(a, b, c);
  printf("%d",answer);
  return 0;
}


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

const int N_MAX = 100;
const int W_MAX = 10000;

int dp[N_MAX+1][W_MAX+1];

int main(){
  
  int n, w; cin >> n >> w;
  vector<int> val(n), wei(n);
  for(int i = 0; i < n; i++){
    /*
    順番チェック
    */
    cin >> val[i] >> wei[i];
  }
  
  memset(dp, 0, sizeof(dp));
  
  for(int i = 0; i < n; i++){
    for(int j = 0; j < w; j++){
      if(j + 1 >= wei[i])
        dp[i+1][j+1] = max(dp[i][j+1], dp[i][j+1 - wei[i]] + val[i]);
      else dp[i+1][j+1] = dp[i][j+1];
    }
  }
  
  cout << dp[n][w] << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int imax = INT_MAX;
int imin = INT_MIN;
ll llmax = LLONG_MAX;
ll llmin = LLONG_MIN;


int main()
{
	string s, a;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
		if (i % 2 == 0)
			a.push_back(s[i]);
	cout << a << endl;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    set<int> st;

    for(auto num:a){
        int t=num;
        for(int i=2;i*i<=num;++i){
            while(t%i==0){
                t/=i;
                st.insert(i);
            }
        }
        if(num!=1)st.insert(num);
    }
    long long ans=0;
    for(auto div:st){
        long long tans=0;
        for(int i=0;i<n;++i){
            if(a[i]%div==0)tans+=a[i];
        }
        ans=max(ans,tans);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '

const int MAXN = 200;
//ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];

bool perfectSquare(ll x){
    ll s = sqrt(x);
    if(s *s == x) return true;
    else return false;
}

int main() { 
    int a = 0, b = 0, c = 0, d = 0, e = 0;
    int k = 0;
    cin >> a >> b >> c >> d >> e >> k;
    if(abs(a - b) > k or abs(a - c) > k or abs(a - e) > k or abs(a - d) > k){
        cout << ":(" << endl;
        return 0;
    }
    if(abs(b - c) > k or abs(b - d) > k or abs(b - e) > k){
        cout << ":(" << endl;
        return 0;
    }
    if(abs(c - d) > k or abs(c - e) > k){
        cout << ":(" << endl;
        return 0;
    }
    if(abs(d - e) > k){
        cout << ":(" << endl;
        return 0;
    }
    cout << "Yay!" << endl;
  
    return 0; 
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #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 cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

int len(int n)
{
  int ans = 0;
  while(n)
  {
    ans++;
    n/=10;
  }
  return ans;
}


int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS



    int n;
    cin >> n;

    priority_queue<int> pq;

    for(int i = 0; i < n; i++)
    {
      int x;
      cin >> x;
      pq.push(x);

    }

    int ok = 1;

    int ans1 = 0,ans2 = 0;

    while(!pq.empty())
    {
      if(ok)
      {
        ans1 += pq.top();
      }
      else
      {
        ans2 += pq.top();
      }
      pq.pop();
      ok = ok xor 1;
     
    }

    cout <<ans1 - ans2;
    return 0; 
}


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


#define ll long long
#define rep(i,x,y) for(int64_t i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
const int64_t mod = 1e9+7;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int64_t n;
    cin >> n;
    int64_t ans = 0;
    int64_t a[n];
    int64_t ma=0;
    rep(i,0,n){
        cin >> a[i];
        ma = max(ma,a[i]);
    }
    int64_t im=1;
    int64_t imc=1;
    while(ma>=im){
        im*=2;
        imc++;
    }
    rep(i,0,62){
        int64_t t=0,f=0;
        rep(j,0,n){
            //cout << (int64_t)((int64_t)1<<i) << endl;
            if(a[j] & (int64_t)((int64_t)1<<i)) t++;
            else f++;
        }
        int64_t po=1;
        rep(j,0,i) po = (po * 2) % mod;
        ans = (ans + ((po * t)%mod * f)%mod) % mod;
        //cout << ans << endl;
    }
    cout << ans << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n;
	cin >> n;

	ll t, a;
	cin >> t >> a;

	ll diff = 1e13;
	int ans = -1;

	rep(i, n){
		ll h;
		cin >> h;

		ll tdiff = abs(1000 * a - (1000 * t - 6 * h));
		if(tdiff < diff){
			diff = tdiff;
			ans = i+1;
		}
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
n,k = map(int,input().split( ))
if k>n:
    flag =1
else:
    flag =0
    
k = min(k,n)
h = list(map(int, input().split( )))
dp =[abs(h[i]-h[0]) for i in range(k)]
for i in range(2,k):
    tmp =[]
    for j in range(i+1):
        #tmp =[]
        #print(*dp)
        #print(dp[j])
        #print(*h)
        #print(h[i],h[j],i,j)
        tmp.append(dp[j]+abs(h[i]-h[j]))#こっちはdp[j],h[j]
    dp[i]= min(tmp)
if flag:
    print(dp[-1])
    sys.exit()
for i in range(k,n):
    tmp =[]
    for j in range(1,k+1):#+1
        tmp.append(dp[i-j]+abs(h[i]-h[i-j]))#こっちはdp[i-j],h[i-j]
    dp.append(min(tmp))
#print(*dp)
print(dp[n-1])


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

int main() {
  long int n, c = 0;
  cin >> n;
  long int a[n + 1], b[n];
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] >= b[i]) {
      c += b[i];
      a[i] -= b[i];
      b[i] = 0;
    } else {
      c += a[i];
      b[i] -= a[i];
      a[i] = 0;
      if (a[i + 1] <= b[i]) {
        c += a[i + 1];
        b[i] -= a[i + 1];
        a[i + 1] = 0;
      } else {
        c += b[i];
        a[i + 1] -= b[i];
        b[i] = 0;
      }
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A, B, K;
		A = sc.nextInt();
		B = sc.nextInt();
		K = sc.nextInt();
		sc.close();
		int a = 0;
		int ans = 0;
		for (int i = 100; i >= 1; i--) {
			if (A % i == 0 && B % i == 0) {
				a++;
				if (a == K) {
					ans = i;
				}
			}
		}
		System.out.println(ans);
	}
}


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

int main()
{
    long long x;

    scanf("%lld", &x);
    long long ans = x / 11;
    ans <<= 1;
    x %= 11;
    if (x > 0) {
        ans++;
    }
    if (x > 6) {
        ans++;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long  n,k,i;
	long long sum=0;
	long long  arr[200005];
	scanf("%lld%lld",&n,&k);
	for(i=0;i<k;i++)
	{
		scanf("%lld",&arr[i]);
	}
	sort(arr,arr+k);
	for(i=1;i<k;i++)
	{
		sum=max(sum,arr[i]-arr[i-1]);
	}
	sum=max(sum,n-arr[k-1]+arr[0]);
	printf("%lld",n-sum);
 } 

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const int MAX_N=1e5;
int N;
ll A[MAX_N];
int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	sort(A,A+N);
	ll ans=0;
	REP(i,N-1){
		ans+=llabs(A[i+1]-A[i])*(min(i+1,N-i-1)*2);
	}
	if (N&1){
		ans-=min(llabs(A[N/2+1]-A[N/2]),llabs(A[N/2]-A[N/2-1]));
	}else{
		ans-=llabs(A[N/2]-A[N/2-1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define ff(x) cerr << #x << " is " << x << '\n'
#define FL freopen("in", "r", stdin),freopen("out", "w", stdout);
#define time cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b) 
int main(){
    //FL;
    fin;
    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    double aux = h * 60 + m;
    double angle_1 = (aux / 60.0) * 30.0;
    double angle_2 = m * 6LL;
    if(angle_1 == 0LL)
        angle_1 = 360LL;
    if(angle_2 == 0LL)
        angle_2 = 360LL;
    double angle = abs(angle_2 - angle_1);
    //cout << angle << '\n';
    if(angle >= 180LL)
        angle = 360LL - angle;
    double ans;
    ans = sqrt(a * a + b * b - 2.0 * a * b * cos(angle * acos(-1) / 180.0));
    cout << fixed << setprecision(10) << ans << '\n';
    time;
    return 0;
}   

Measured memory_bytes: 4220
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>
using namespace std;
const int num = 10000;
const int INF = 2000000000;
class Disjointset {
public:
	vector<int> rank, p;
	Disjointset(int n) {
		rank.resize(n, 0);
		for (int i = 0; i < n; i++)
			p.push_back(i);
	}
	int find(int x) {
		if (x != p[x])
			return p[x] = find(p[x]);
		else return x;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	void unite(int x, int y) {
		int px = find(x);
		int py = find(y);
		if (rank[px] > rank[py]) {
			p[py] = px;
		}
		else {
			p[px] = py;
			if (rank[px] == rank[py]) rank[py]++;
		}
	}
};
class Edge {
public:
	int fr, to, co;
	Edge(int f, int t, int c):fr(f), to(t), co(c) {}
	bool operator < (const Edge &e) const{
		return co > e.co;
	}
};
int main() {
	int n, e;
	cin >> n >> e;
	priority_queue <Edge> q;
	for (int i = 0; i < e; i++) {
		int s, t, w;
		cin >> s >> t >> w;
		Edge ed(s, t, w);
		q.push(ed);
	}
	Disjointset d(n);
	int sum = 0;
	while (!q.empty()) {
		Edge e = q.top(); q.pop();
		if (d.same(e.fr, e.to)) continue;
		else {
			d.unite(e.fr, e.to);
			sum += e.co;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 4528
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define MAX INT_MAX
#define MIN INT_MIN
#define ss second
#define ff first
const int mod = 1e9+7;

int minm(vector<vector<int> > &v, int w){
	int n = v.size();
	int dp[w+1];
	memset(dp, 0, sizeof(dp));
	//wt[0] = 0;
	//vector<vector<bool> > pick(w+1, vector<bool>(n, 0));
	for(int i = 0; i < n; i++){
		//int temp = i;
		for(int j = w; j >= v[i][0]; j--){
			dp[j] = max(dp[j], v[i][1]+dp[j-v[i][0]]);
			//cout << "i: " << i << " ||  j: " <<  J << " || " << dp[j] << endl;

		}
	}
	return dp[w];
	
}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, w;
	cin >> n >> w;
	vector<vector<int> > v(n,vector<int>(2));
	for(int i = 0; i < n; i++)
		for(int j = 0; j < 2; j++)
			cin >> v[i][j];
	cout << minm(v, w) << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int len(int x){
    int i=1;
    while(x>=i) i<<=1;
    i>>=1;
    return i;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, XOR=0;
    cin>>N;
    
    vector<int> nums(N);
    rep(i,N) cin>>nums[i],XOR^=nums[i];
    
    int cnt=0;
    for(int i=30;i>=0;i--) if(XOR&(1<<i)){
        rep(j,N){
            int t=nums[j]^(nums[j]-1);
            if(t+1==(1<<(i+1))){
                XOR^=t;
                cnt++;
                break;
            }
        }
    }
    
    if(XOR==0){
        cout1(cnt);
    }else{
        cout1(-1);
    }
}

Measured memory_bytes: 640
#define FASTIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//#define BZ
//#define PBDS
//#define POINT

#ifndef BZ
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("no-stack-protector")
#pragma GCC target ("tune=native")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize ("conserve-stack")
//#pragma GCC optimize ("no-stack-limit")
#endif

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using str = string;
using pll = pair<ll, ll>;

#ifdef POINT
using point = complex<ll>;
#define x real
#define y imag
#endif

#ifdef PBDS
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//using namespace __gnu_pbds::detail;
template <class T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif

#define INF 0x7fffffffffffffffLL
#define BASE 1000000007LL // 3 * 10**9 + 19 // 998244353 - rev == pow(n + m, BASE - 2)
#define MAX(type) std::numeric_limits<type>::max()
#define MIN(type) std::numeric_limits<type>::min()

#define LOG(v) cout << #v << " " << v << "\n";

#define pb push_back
#define eb emplace_back
//#define all(c) c.begin(), c.end()
//#define rall(c) c.rbegin(), c.rend()
#define F first
#define S second
#define forEach(c) for (auto &it : c)
#define loop while (true)
#define mp make_pair
#define mt make_tuple

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

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

inline ll divUp(ll a, ll b) {
	return (a + b - 1)/b;
}

ll sq(ll a) {
	return a * a;
}

ld dist(pll a, pll b) {
	return sqrt(sq(a.F - b.F) + sq(a.S - b.S));
}

void solve() {
	ll n;
	cin >> n;
	vector<pll> a(n);
	forEach(a) cin >> it.F >> it.S;
	sort(a.begin(), a.end());
	ld sum = 0;
	ll cnt = 0;
	do {
		cnt++;
		for (ll i = 0; i < n - 1; i++) {
			sum += dist(a[i], a[(i + 1) % n]);
		}
	} while (next_permutation(a.begin(), a.end()));
	cout.precision(16);
	cout << sum / cnt << "\n";
}

//#define LOCAL

int main() {
	FASTIO
#ifdef LOCAL
	auto start = std::chrono::system_clock::now();
#endif
	solve();
#ifdef LOCAL
	auto end = std::chrono::system_clock::now();
	std::chrono::duration<ld> elapsed_seconds = end - start;
	cerr << "\ntime: " << elapsed_seconds.count() << " s\n";
#endif
	return 0;
}


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

#define null				""
#define all(dat)			dat.begin(), dat.end()
#define over(msg)			cout << msg << endl, exit(0);
#define loop(i, to)			for (int i = 0; i < to; ++i)
#define cont(i, to)			for (int i = 1; i <= to; ++i)
#define foreach(i, dat)		for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long			num;

using namespace std;

int n, q;
num a[100005], pre[100005], pres[2][100005], ans;

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> q;
	loop (i, n) {
		cin >> a[i];
		pre[i + 1] = pre[i] + a[i];
		pres[i % 2][i + 1] = pres[i % 2][i] + a[i];
		pres[(i % 2) ^ 1][i + 1] = pres[(i % 2) ^ 1][i];
	}
	cont (cas, q) {
		num x, l = 0, r = n, mid;
		cin >> x;
		while (l < r) {
			mid = (l + r) >> 1;
			int pos = (int) (lower_bound(a, a + n, x - (a[mid] - x)) - a);
			if (mid - pos < n - mid - 1) {
				l = mid + 1;
			} else {
				r = mid;
			}
		}
		ans = pre[n] - pre[l] + pres[(n % 2) ^ 1][l - (n - l)];
		cout << ans << '\n';
	}
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

lint lucas[100];

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

    lucas[0] = 2;
    lucas[1] = 1;
    for (int i = 2; i <= n; i++) {
        lucas[i] = lucas[i-1] + lucas[i-2];
    }

    cout << lucas[n] << endl;
    return 0;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */
int main(){
    lint a,b,c,k;
    cin>>a>>b>>c>>k;
    lint ans=0;
    if(k<=a){
        ans += k;
    }else{
        ans += a;
        k -= a;
        if(k>b){
            ans -= (k-b);
        }
    }
    out(ans);
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll x;
  cin>>x;
  ll a = x/500;
  x%=500;
  ll b = x/5;
  ll ans = a*1000+b*5;
  cout<<(ans)<<endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#define max(i, j) (i > j ? i : j)
int main() {
    int n, m, k, ans = 0;
    scanf("%d%d%d", &n, &m, &k);
    n = max(n, m);
    if(k % n) ++ans;
    ans += k / n;
    printf("%d\n", ans);
    return 0;
}

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


int main(void){
    
    int N;
    int K;
    long long S;
    
    cin >> N >> K >> S;
    if(S!=1000000000){
        if(N!=K){
            for(int i = 0; i < K;i++)cout << S <<" ";
            for(int i = K; i < N-1;i++)cout << S+1 <<" ";
            cout << S+1 <<endl;
        }else{
            for(int i = 0; i < N - 1;i++)cout << S <<" ";
            cout << S <<endl;
        }
    }else{
        if(N!=K){
            for(int i = 0; i < K;i++)cout << S <<" ";
            for(int i = K; i < N-1;i++)cout << 1 <<" ";
            cout << 1 <<endl;
        }else{
            for(int i = 0; i < N - 1;i++)cout << S <<" ";
            cout << S <<endl;
        }
    }
    
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
int N; 
cin >> N; 
int A[314159]; 
for(int i = 0; i < N; i++){
cin >> A[i];
}
long long int B[314159]; //第i部分和を用意
B[0] = A[0]; 
for(int i = 0; i < N; i++){
B[i+1] = B[i] + A[i+1]; 
}

long long int S = B[N-1]; 

for(int i = 1; i < N-1; i++){
// 以下，A[i]までとそれ以後で分けることを考える
long long int L = upper_bound(B, B+N, B[i]/2) - B; 
long long int M = upper_bound(B, B+N, (B[i] + B[N-1])/2) - B; 

long long int P1 = max(max(B[L], B[i]-B[L]), max(B[M]-B[i], B[N-1]-B[M])); 
long long int P2 = max(max(B[L], B[i]-B[L]), max(B[M-1]-B[i], B[N-1]-B[M-1])); 
long long int P3 = max(max(B[L-1], B[i]-B[L-1]), max(B[M]-B[i], B[N-1]-B[M])); 
long long int P4 = max(max(B[L-1], B[i]-B[L-1]), max(B[M-1]-B[i], B[N-1]-B[M-1])); 
long long int Q1 = min(min(B[L], B[i]-B[L]), min(B[M]-B[i], B[N-1]-B[M])); 
long long int Q2 = min(min(B[L], B[i]-B[L]), min(B[M-1]-B[i], B[N-1]-B[M-1])); 
long long int Q3 = min(min(B[L-1], B[i]-B[L-1]), min(B[M]-B[i], B[N-1]-B[M])); 
long long int Q4 = min(min(B[L-1], B[i]-B[L-1]), min(B[M-1]-B[i], B[N-1]-B[M-1]));
long long int R1 = P1 - Q1; 
long long int R2 = P2 - Q2;
long long int R3 = P3 - Q3;
long long int R4 = P4 - Q4;
long long int R = min(min(R1, R2), min(R3, R4)); 
 S = min(S, R);
}
cout << S << endl; 
}

Measured memory_bytes: 3200
character(100)S
logical Check
read*,S
check=.true.
do i=1,len_trim(S)
  if(mod(i,2)==1)then
    if(S(i:i)=="L")check=.false.
  else
    if(S(i:i)=="R")check=.false.
  endif
end do
if(check)then
  print"(A)","Yes"
else
  print"(A)","No"
endif
end

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

int main(){
	int n;
	cin >> n;
	int arr[n];
	for(int& i : arr) cin >> i;
	int DP[n];
	DP[n-1] = 0;
	for(int i = n-2; i >=0; --i){
		DP[i] = DP[i+1] + abs(arr[i] - arr[i+1]);
		if(i+2 < n) DP[i] = min(DP[i], DP[i+2] + abs(arr[i] - arr[i+2]));
	}
	cout << DP[0] << endl;	
}

Measured memory_bytes: 4408
#include<iostream>
#include<map>
#include<vector>

int main(){

    size_t n;
    std::cin >> n;

    std::map<size_t, size_t> m;

    for(size_t i = 0; i < n; i++){
        size_t a;
        std::cin >> a;

        if(m.find(a) != m.end()){
            m[a]++;
        }else{
            m.emplace(a, 1);
        }
    }

    std::vector<std::pair<size_t, size_t>> v;
    for(auto it = m.rbegin(); it != m.rend(); it++){
        if((*it).second >= 2){
            v.emplace_back(*it);
        }
    }

    if(v.size() < 2){
        std::cout << 0 << std::endl;
    }else if(v[0].second >= 4){
        std::cout << v[0].first * v[0].first << std::endl;
    }else{
        std::cout << v[0].first * v[1].first << std::endl;
    }

    return 0;
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    vector<i64> v(5);
    rep(i,0,5) cin >> v[i];

    i64 ans=inf64;
    do{
        i64 t=0;
        rep(i,0,5){
            if(t%10) t+=10-t%10;
            t+=v[i];
        }
        chmin(ans,t);
    }while(next_permutation(begin(v),end(v)));

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using namespace std;

int a[205];

main(){
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, L, sum = 0;
    cin >> n >> L;
    for (int i = 1; i <= n; ++i){
        a[i] = L + i - 1;
        sum += a[i];
    }
    int imin = 1e9;
    for (int i = 1; i <= n; ++i){
        if (abs(a[i]) <= abs(imin)) imin = a[i];
    }
    cout << sum - imin << '\n';
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	const int INT_MAX = 2147483647;
	int n, ansnum = 1;
	double t, a, ans = INT_MAX;
	double h[1000];
	scanf("%d%lf%lf", &n, &t, &a);
	for (int i = 0; i <= n - 1; i++)
	{
		scanf("%lf", &h[i]);
		h[i] = t - h[i] * 0.006 - a;
		if (h[i] < 0)
		{
			h[i] = -h[i];
		}
		if (h[i] < ans)
		{
			ans = h[i];
			ansnum = i + 1;
		}
	}
	printf("%d", ansnum);
	return 0;
}


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


int main() {
  int a,b;
  int ans = 0;
  std::cin >> a >> b;
  if (a-b > 0) {
    ans = a + a -1;
  }else if (b - a >0) {
    ans = b + b -1;
  }else{
    ans = a + b;
  }
  std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
dp=[0]
res=0
for i in range(1,n):
    if i>1:
        if (abs(h[i]-h[i-1])+dp[i-1])>(abs(h[i]-h[i-2])+dp[i-2]):
            dp.append(abs(h[i]-h[i-2])+dp[i-2])
        else:
            dp.append(abs(h[i]-h[i-1])+dp[i-1])
    else:
        dp.append(abs(h[i]-h[i-1]))
    res=dp[i]
print(res)

Measured memory_bytes: 13924
#include<bits/stdc++.h>
using namespace std;                void iosbase(void);
typedef  long long int     ll;      typedef long double                            db;
typedef  vector<int>       vi;      typedef priority_queue<int>                    MAXHEAP;
typedef  pair<int, int>    pii;     typedef priority_queue<int, vi, greater<int>>  MINHEAP;
#define  int               ll
#define  ff                first
#define  ss                second
#define  pb                push_back
#define  si(x)             (int)x.size()
#define  minv(m,n)         *min_element(m,n)
#define  maxv(m,n)         *max_element(m,n)
#define  deb(x)            cout<<"> "<<#x<<" : "<<x<<endl;
#define  mem(a,x)          memset(a,x,sizeof(a))
#define  rep(i,n)          for(int i=0;i<n;i++)
#define  prs(x,y)          fixed<<setprecision(y)<<x
#define  show(a)           for(auto x:a){cout<<x<<" ";}cout<<endl;
#define  showmap(a)        for(auto x:a){cout<<x.ff<<" "<<x.ss<<endl;}
#define  showstack(a)      while(!a.empty()){cout<<a.top()<<endl;a.pop();}
const int sz = 1e5 + 5;

int32_t main()
{
    iosbase(); int tt = 1;
    //cin>>tt;
    for (int t = 1; t <= tt; t++)
    {
        int n ;
        cin >> n;
        string s;
        cin >> s;
        int l = 0 , r = n - 1;
        int ans = 0;
        while ( l <= r)
        {
            if ( s[l] == 'W'  and s[r] == 'R')
            {
                swap(s[l] , s[r]);
                l++;
                r--;
                ans++;
            }
            if (s[l] == 'W'  and s[r] == 'W')
            {
                r--;
            }
            if (s[l] == 'R' and s[r] == 'W')
            {
                l++;
                r--;
            }
            if (s[r] == 'R'  and s[l] == 'R')
            {
                l++;
            }
            if ( l == r)
                break;
        }
        cout << ans << endl;
    }
    return 0 ;
}
void iosbase(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
//freopen("in2.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

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

    cout<<(n-1)*(m-1)<<endl;

    return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


signed main(){
    int N, x[100], y[100], h[100];
    cin >> N;
    REP(i, N) cin >> x[i] >> y[i] >> h[i];
    REP(cx, 101){
        REP(cy, 101){
            int H = -1;
            bool ok = true;
            REP(i, N) if(h[i] != 0) H = h[i] + abs(cx - x[i]) + abs(cy - y[i]);
            REP(i, N){
                if(h[i] == 0) ok = (H <= h[i] + abs(cx - x[i]) + abs(cy - y[i]));
                else ok = (H == h[i] + abs(cx - x[i]) + abs(cy - y[i]));
                if(!ok) break;
            }
            if(ok){
                cout << cx << " " << cy << " " << H << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string answer = "No";
  for(int i = 0;i <= n/7; i++){
    for(int j = 0;j <= n/4;j++){
      if(7*i + 4*j == n){
        answer = "Yes";
        break;
      }
    }
    if(answer == "Yes") break;
  }
  cout << answer << endl;
}

  
    
      

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

struct point
{
	int p[11], id;
}a[11];

int main()
{
	int n, k, cnt=0;
	cin >> n >> k;
	
	for (int i=1; i<=n; i++)
	{
		for (int j=1; j<=k; j++)
		{
			cin >> a[i].p[j];
			a[i].id=i;
		}
	}
	
	for (int i=1; i<=n; i++)
	{
		for (int j=1; j<=n; j++)
		{
			bool flag=false;
			if (!(i>=j))
			{
				int sum=0;
				for (int aa=1; aa<=k; aa++)
				{
					sum=sum + fabs(a[i].p[aa]-a[j].p[aa])*fabs(a[i].p[aa]-a[j].p[aa]);
				}
				int bb=sqrt(sum);
				if (/*float(sum/bb)-sum/bb==0 &&*/ float(sum)/float(bb)==bb)
				{
					flag=true;
				}
			//	cout << bb << endl;
				if (flag==true)
					cnt++;
			}
			
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 384
import math

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        dist2 = 0
        for d in range(D):
            dist2 += (X[i][d] - X[j][d])**2
        dist = math.sqrt(dist2)
        if dist.is_integer():
            ans += 1

print(ans)

Measured memory_bytes: 3060
def main():
    N = int(input())
    S = input()
    cnt = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = 2 * j - i
            if k >= N:
                continue
            if S[j] != S[i] and S[i] != S[k] and S[k] != S[j]:
                cnt += 1
    print(S.count("R") * S.count("B") * S.count("G") - cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 67656
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define mod 1000000007
using namespace std;

void dfile(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


int32_t main()
{   
    //dfile();
    
    int dp[100005]={};
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++) cin>>h[i];
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++){
        int op1=dp[i-1]+abs(h[i]-h[i-1]);
        int op2=dp[i-2]+abs(h[i]-h[i-2]);
        dp[i]=min(op1,op2);
    }
    cout<<dp[n-1];
    // for(int i=0;i<n;i++) cout<<dp[i]<<" ";

    return 0;   
}



Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
vector<int> solve(long long n) {
	if(n == 1) return vector<int>();
	if(n & 1) {
		vector<int> res = solve(n - 1);
		res.insert(res.begin(), res.size() + 1);
		return res;
	}
	vector<int> res = solve(n / 2);
	res.push_back(res.size() + 1);
	return res;
}
int main() {
	long long n;
	cin >> n;
	vector<int> ret = solve(n + 1);
	cout << ret.size() * 2 << endl;
	for(int i = 1; i <= ret.size(); i++) cout << i << ' ';
	for(int i : ret) cout << i << ' ';
	return 0;
}

Measured memory_bytes: 256
import numpy as np
from numba import *

N = int(input())
length = np.array(input().split(), np.int64)

length = np.sort(length)

@njit
def calc(cache=True):
    cnt = 0

    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc()
print(ans)


Measured memory_bytes: 111044
//thanks God For Every Thing!
//contest link:
#include<bits/stdc++.h>
#define pi                      acose(-1)

typedef long long int           ll;
typedef double                  dl;
using namespace std;
const int mx = 1e2+5;


int main()
{
    int n;
    cin>>n;
    cout<< n*n;

    return 0;
}


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

int main(){
    int n[4];
    cin >>n[0] >>n[1] >>n[2] >>n[3];
    sort(n,n+4);

    if(n[0]==1 && n[1]==4 && n[2]==7 && n[3]==9){
        cout <<"YES" <<endl;
    } else {
        cout <<"NO" <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int a[8];
int main()
{
    int i,n;
    int temp;
    int ans=0;
    int t=0;
    for(i=0;i<8;i++)
    {
        a[i]=0;
    }
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&temp);
        if(temp>=1&&temp<=399)
        {
            a[0]=1;
        }
        if(temp>=400&&temp<=799)
        {
            a[1]=1;
        }
        if(temp>=800&&temp<=1199)
        {
            a[2]=1;
        }
        if(temp>=1200&&temp<=1599)
        {
            a[3]=1;
        }
        if(temp>=1600&&temp<=1999)
        {
            a[4]=1;
        }
        if(temp>=2000&&temp<=2399)
        {
            a[5]=1;
        }
        if(temp>=2400&&temp<=2799)
        {
            a[6]=1;
        }
        if(temp>=2800&&temp<=3199)
        {
            a[7]=1;
        }
        if(temp>=3200)
        {
            t++;
        }
    }
    for(i=0;i<=7;i++)
    {
        if(a[i]==1)
            ans++;
    }
    if(ans==0)
    {
        printf("1 %d",t);
    }
    else
    {
    printf("%d %d",ans,ans+t);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<string,ll> P;
const long long int MOD = 1000000007;
const int INF = 1000000000;

ll n, m, p;
int N;
ll bit[200001];
vector<P> v;

ll sum(int i){
	ll s = 0;
	while(i > 0){
        s = (s+bit[i])%p;
		i -= i&-i;
	}
	return s;
}

void add(int i, ll x){
	while(i <= N){
        bit[i] = (bit[i]+x)%p;
		i += i&-i;
	}
}

string to_string(ll x){
    stringstream ss;
    ss << x;
    return ss.str();
}

void solve(){
    v.clear();
    memset(bit,0,sizeof(bit));
    N = m-n+2;
    for(ll i = n; i <= m; i++){
        string s = to_string(i);
        v.push_back(P(s,i-n+2));
    }
    sort(v.begin(),v.end());
    add(1,1);
    rep(i,v.size()){
        ll z = v[i].second;
        add(z,sum(z));
    }
    cout << (sum(m-n+2)-1+p)%p << endl;
}

int main(){
    while(cin >> n >> m >> p){
        if(n == 0 && m == 0 && p == 0) break;
        solve();
    }
}

Measured memory_bytes: 10840
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			Queue<Integer> queue = new PriorityQueue<>((x, y) -> y.compareTo(x));
			IntStream.range(0, n).forEach(i -> queue.add(scanner.nextInt()));
			IntStream.range(0, m).forEach(i -> queue.add(queue.poll() / 2));
			System.out.println(queue.stream().mapToLong(i -> (long) i).sum());
		}
	}
}


Measured memory_bytes: 59920
def winner(cells)
  winner_patterns = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
  winner_patterns.each do |winner_pattern|
    a, b, c = winner_pattern
    return cells[a] if cells.values_at(a, b, c).uniq.size == 1 && cells.values_at(a, b, c).uniq.first != 's'
  end   
  'd'
end

while line = gets
  cells = line.chomp.split('')
  puts winner(cells)
end

Measured memory_bytes: 8712
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define SIZE 5
#define LL long long
#define MIN(a, b) ((a < b) ? a : b)

bool move(LL *a, LL *list, int size) {
    int i; bool flag = false;
    LL tmp;
    for(i = size - 2; i >= 0; --i) {
        if(list[i] != 0) {
            tmp = MIN(a[i], list[i]);
            list[i] -= tmp; list[i+1] += tmp;
            if(!flag) { flag = true; }
        }
    }
    return flag;
}

void parray(LL *a, int size) {
    int i;
    for(i = 0; i < size; ++i ) { printf("%lld ", a[i]); }
    printf("\n");
}

void solve(LL *a, LL n, int size) {
    LL *list = (LL*)malloc((size + 2) * sizeof(LL));
    int i;
    for(i = 0; i < size + 1; ++i) { list[i] = 0; }
    list[0] = n;
    LL count = 0;
    parray(list, size + 1);
    while(move(a, list, size + 1)) { ++count;  parray(list, size + 1); }
    printf("%lld\n", count);
}

void solve1(LL *a, LL n, int size) {
    int i; LL min = a[0];
    //printf("sizeof(LL): %d\n", (int)sizeof(LL));
    //printf("test: %lld\n", min);
    for(i = 0; i < size; ++i) { min = MIN(min, a[i]); }
    //printf("min: %lld\n", min);
    LL x = (n % min != 0) ? n/min + 1 : n/min;
    printf("%lld\n", (LL)(size - 1) + x);
}

int main(void)
{
    int i; LL n;
    LL *a = (LL*)malloc((SIZE+1) * sizeof(LL));
    scanf("%lld", &n);
    for(i = 0; i < SIZE; ++i) { scanf("%lld", &a[i]); }
    solve1(a, n, SIZE);
    return 0;
}

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



//配列の要素数
//#define MAX	1000000
#define MAX	100000

int h_input[MAX] = {0};


int main(void)
{
	//入力変数
	int n = 0;

	while (true)
	{
		cin >> n;
		if (n == 0)	{	return 0;	}

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

		//カウント変数
		int count = 0;

		for (int i = n - 1; i >= 0; i--)
		{
			for (int j = 1; j <= i; j++)
			{
				if (h_input[j - 1] > h_input[j])
				{
					int tmp = h_input[j];
					h_input[j] = h_input[j - 1];
					h_input[j - 1] = tmp;

					count++;
				}
			}
		}

		cout << count << endl;
	}

	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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


int main() {

  ll N;
  cin >> N;
  map<ll, ll> l;
  vector<ll> L;
  REP(i, N){
    ll l_; cin >> l_;
    L.push_back(l_);
    
    // l[l_]++;
  }
  // for(auto itr=l.begin(); itr != l.end(); itr++ ){
  //   L.push_back(itr->first);
  // }
  // REP(i, L.size()){
  //   cout << L[i] << endl;
  // }

  sort(L.begin(), L.end());
  ll ans = 0;

  if(N<=2){
    cout << 0 << endl;
    return 0;
  }

  REP(i, L.size()){
    for(int j=i+1; j<L.size(); j++){
      for(int k=j+1; k < L.size(); k++){
        if(L[i]+L[j]>L[k]){
          if(L[i]==L[j] || L[i]==L[k] || L[k]==L[j]){

          }else{
          // cout << L[i] << L[j] << L[k] << endl;
          // cout << i+1 << j+1 << k+1 << endl;
          ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3624
console.log((args=>{
  const [s,t] = args.trim().split('\n').map( r=>r.split('').map(v=>v.charCodeAt()));
  s.sort((a,b)=>a-b);
  t.sort((a,b)=>b-a);
  for ( let i = 0, l = Math.min(s.length,t.length); i < l; i++ ) {
    if ( s[i] < t[i] ) return 'Yes';
    if ( s[i] > t[i] ) return 'No';
  }
  return (s.length<t.length)?'Yes':'No';
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 29560
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int n,a[300010],b[300010];
char s[300010];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++) a[i]=a[i-1]+(s[i]=='W');
	for(int i=n;i>=1;i--) b[i]=b[i+1]+(s[i]=='E');
	int ans=n+1;
	//for(int i=1;i<=n;i++) printf("%d ",a[i]);printf("\n");
	//for(int i=1;i<=n;i++) printf("%d ",b[i]);printf("\n");
	for(int i=1;i<=n;i++) ans=min(ans,a[i-1]+b[i+1]);
	printf("%d",ans);
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> data(n);
		string s;
		for (int i = 0; i < n; i++) {
			cin >> s;
			data[i] = s.size();
		}
		/*for (int i = 0; i < n; i++) {
			cout << data[i] << endl;
		}*/
		for (int i = 0; i < n; i++) {
			int a[5] = {0};
			int cc = 0;
			bool h = true;
			a[0] = data[i];
			if (a[0] == 5) {
				cc++;
			} else if (a[0] > 5) {
				continue;
			}
			for (int j = i+1; j < n; j++) {
				a[cc] += data[j];
				if (cc == 0) {
					if (a[0] == 5) {
						cc++;
					} else if (a[0] > 5) {
						h = false;
						break;
					}
				} else if (cc == 1) {
					if (a[1] == 7) {
						cc++;
					} else if (a[1] > 7) {
						h = false;
						break;
					}
				} else if (cc == 2) {
					if (a[2] == 5) {
						cc++;
					} else if (a[2] > 5) {
						h = false;
						break;
					}
				} else if (cc == 3) {
					if (a[3] == 7) {
						cc++;
					} else if (a[3] > 7) {
						h = false;
						break;
					}
				} else {
					if (a[4] == 7) {
						cc++;
						break;
					} else if (a[4] > 7) {
						h = false;
						break;
					}
				}
			}
			if (h && cc == 5) {
				cout << i+1 << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1212