akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> a(N);
    Rep (i, N) cin >> a[i];

    vector<vector<ll>> dp(N+1, vector<ll>(N+1));
    Rep (i, N+1) dp[i][i] = 0;

    for (ll len = 1; len <= N; len++) {
        for (ll i = 0; i + len <= N; i++) {
            ll j = i + len;
            if ((N-len) % 2 == 0) {
                dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]);
            } else {
                dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1]);
            }
        }

    }
    cout << dp[0][N] << "\n";
}

Measured memory_bytes: 70784
#include <cstdio>
#include <algorithm>

typedef long long int lli;

const int MAXN = 100004;
const lli INF = 1e18;

int N, M;
int d1[MAXN];
int fm[MAXN];
int uf[MAXN];

int find(int p) {
  if (uf[p] == p) return p;
  return uf[p] = find(uf[p]);
}

int main() {
  scanf("%d %d", &N, &M);

  const int g = N - M;
  if (g == 1) {
    puts("0");
    return 0;
  } else if ((g - 1) * 2 > N) {
    puts("Impossible");
    return 0;
  }

  for (int i = 0; i < N; ++i) {
    uf[i] = i;
    fm[i] = -1;
    scanf("%d", &d1[i]);
  }
  for (int i = 0; i < M; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    const int xx = find(x);
    const int yy = find(y);
    if (xx != yy) uf[xx] = yy;
  }

  for (int i = 0; i < N; ++i) {
    const int ig = find(i);
    if (fm[ig] == -1 || d1[fm[ig]] > d1[i]) {
      fm[ig] = i;
    }
  }

  lli ans = 0;
  int cc = 0;
  for (int i = 0; i < N; ++i) {
    if (fm[i] == -1) continue;
    ans += d1[fm[i]];
    d1[fm[i]] = 1000000004;
  }
  std::sort(d1, d1 + N);
  for (int i = 0; i < g-2; ++i) {
    ans += d1[i];
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
int main()
{
    int a,b;
    char c,d,e;
    scanf("%d%c%c%c%d",&a,&c,&d,&e,&b);
    if(d=='+')
    {
        printf("%d\n",a+b);
    }
    else
    {
        printf("%d\n",a-b);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
struct UnionFind {
    vector<int> t;
    UnionFind(int size): t(size, -1) {}
    int root(int x) {
        return t[x] < 0 ? x : t[x] = root(t[x]);
    }
    int size(int x) {
        return -t[root(x)];
    }
    bool isSame(int x, int y) {
        return root(x) == root(y);
    }
    bool unite(int x, int y) {
        x = root(x), y = root(y);
        if(x != y) {
            if(t[y] < t[x]) swap(x, y);
            t[x] += t[y], t[y] = x;
        }
        return x != y;
    }
};
signed main() {
    INCANT;
    int n, m, a, b, c;
    set<int> s;
    cin>>n>>m;
    UnionFind uf(n);
    rep(i, m) {
        cin>>a>>b>>c;
        a--, b--;
        uf.unite(a, b);
    }
    rep(i, n) {
        s.insert(uf.root(i));
    }
    cout<<s.size()<<endl;
}


Measured memory_bytes: 5760
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	void run(){

		boolean[] np=new boolean[50001];

		np[0]=np[1]=true;

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

			if(np[i]) continue;

			for(int j=i*2;j<50001;j+=i){

				np[j] = true;

			}

		}

		int[] dp = new int[50001];

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

			if(np[i]) continue;

			for(int j=i;i+j<50001;j++){

				if(np[j])continue;

				dp[i+j]++;

			}

		}

		for(;;){

			int n = sc.nextInt();

			if(n==0) break;

			System.out.println(dp[n]);

		}

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N,K;
    cin>>N>>K;
    vector<int> A(N);
    cin>>A;
    vector<int> cnt(N+1,0);
    int M=0;
    REP(i,N) {
        cnt[A[i]]++;
    }
    REP(i,N+1) {
        if(cnt[i]) M++;
    }
    sort(ALL(cnt));
    int ans=0;
    REP(i,N) {
        if(cnt[i]) {
            if(M>K) {
                ans+=cnt[i];
                M--;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
using System;
using System.Linq;
using System.Numerics;

   class Program
    {
        static void Main()
        {
            var ar = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = ar[0];
            var W = ar[1];
            //重量テーブルでdp
            var dp = new long[W + 1];

            for (int i = 0; i < N; i++)
            {
                ar = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var _w = ar[0];
                var v = ar[1];
                //
                for (int w = W; w >= _w; w--)
                {
                    //制約上1つも持てないものは無い
                    //if (w - _w < 0) continue;
                    //空き容量に対して拾ったほうが価値が高まるならdp値を更新
                    dp[w] = Math.Max(dp[w], dp[w - _w] + v);
                }
            }
            Console.WriteLine(dp[W]);
        }
    }

Measured memory_bytes: 29064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class MyProgram
{	
    static long[] B;
    static long[] P;
    static long[] A;
    public static void Main()
	{
        long[] n = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        long N = n[0];
        long X = n[1];
        
        B = new long[N+1];
        P = new long[N+1];
        A = new long[N+1];
        P[0] = 1;
        B[0] = 0;
        A[0] = 1;
        for(int i = 1 ; i <= N ; i++)
        {
            P[i] = P[i-1]*2 + 1;
            B[i] = B[i-1]*2 + 2;      
            A[i] = P[i]+B[i];
        }
        
        long ans = Solve(N,X);
        
        Console.WriteLine(ans);
    }
    
    static long Solve(long N, long X)
    {
        if(N==0) return 1;
        long mid = A[N] / 2 + 1;
        if(X == 1) return 0;
        if(X == mid) return P[N-1] + 1;
        if(X == A[N]) return P[N];
        if(X > mid) return P[N-1] + Solve(N-1, X -mid)+1;
        if(X < mid) return Solve(N-1,X-1);
        
        return 0;
    }

}

Measured memory_bytes: 13524
n = int(input())
l = [int(x) for x in input().split()]
from collections import defaultdict
d = defaultdict(int)
for a in l:
  d[a] += 1
def motomeru(i):
  return int(d[i]*(d[i]-1)/2)
def herasu(i):
  if d[i] == 0:
    return 0
  else:
    return int((d[i]-1)*(d[i]-2)/2)
zenbu = 0
for i in range(n):
  zenbu = zenbu + motomeru(i+1)
for i in l:
  a = zenbu - motomeru(i) + herasu(i)
  print(a)



Measured memory_bytes: 38780
# a, b, c = map(int, input().split())
# if a == b and b == c:
#     print('No')
# elif a!=b and b!=c and c!=a :
#     print('No')
# else:
#     print('Yes')

s,t = input().split()
# print(s)
# print(t)
print(t+s)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<double,double> pint;
typedef pair<pint,int> p3;
typedef long long ll;
const int inf   = 1<<29;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
struct edge{int to,cap,rev;};
vector <edge> v[300];
bool used[300];
void addedge(int from, int to,int cap){
	int x=v[to].size();
	int y=v[from].size();
	v[from].push_back({to,cap,x});
	v[to].push_back({from,0,y});	
}

int dfs(int x,int t,int f){
	if(x==t)return f;
	used[x]=true;
	rep(i,v[x].size()){
		edge &e=v[x][i];
		if(!used[e.to]&&e.cap>0){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				v[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}

int maxflow(int s,int t){
	int flow=0;
	for(;;){
		rep(i,300)used[i]=0;
		int f=dfs(s,t,inf);
		if(f==0) return flow;
		flow+=f;
		
	}
}

int main(){
	int n;cin>>n;
	int a[2*n],b[2*n];
	rep(i,2*n)cin>>a[i]>>b[i];
	int s=2*n,t=2*n+1;
	rep(i,n)addedge(s,i,1);
	rep(i,n)addedge(i+n,t,1);
	rep(i,n)rep(j,n){
		if(a[i]<a[j+n]&&b[i]<b[j+n]){
			addedge(i,j+n,1);
		}
	}
	cout<<maxflow(s,t)<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define fi first
#define se second

class UnionFind{
public:
	vector<ll> par;
	//0-indexed
	void init(ll n = 1) {
		par.resize(n);
		for (ll i = 0; i < n; ++i) par[i] = i;
	}
	ll root(ll x = 1){
		if(par[x]==x)return x;
		else{
			return par[x] = root(par[x]);
		}
	}
	void unite(ll x = 1,ll y = 1){
		x = root(x);
		y = root(y);
		if(x==y)return;
		else par[x] = y;
	}
};
ll n,k,l;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k>>l;
	UnionFind ro,te;
	ro.init(n);
	te.init(n);
	FOR(i,0,k){
		ll p,q;
		cin>>p>>q;p--;q--;
		ro.unite(p,q);
	}
	FOR(i,0,l){
		ll r,s;
		cin>>r>>s;r--;s--;
		te.unite(r,s);
	}
	pair<ll,ll> p;
	vector<pair<ll,ll> > se;
	FOR(i,0,n){
		p.fi=ro.root(i);
		p.se=te.root(i);
		se.pb(p);
	}
	SORT(se);
	map<pair<ll,ll> ,ll> m;
	FOR(i,0,se.size()){
		p=se[i];
		ll k=NUM(se,p);
		m[p]=k;
		i+=k;
		i--;
	}
	p.fi=ro.root(0);p.se=te.root(0);
	cout<<m[p];
	FOR(i,1,n){
		p.fi=ro.root(i);p.se=te.root(i);
		cout<<" "<<m[p];
	}
	cout<<endl;
    return 0;
}

Measured memory_bytes: 18156
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
n = int(input())
b = [int(input()) for i in range(n)]

a1_a = [0]*3
a2_a = [0]*3
a3_a = [0]*3

for i in range(n):
  for j in range(3):
    if a1[j] == b[i]:
      a1_a[j] = 1
    if a2[j] == b[i]:
      a2_a[j] = 1
    if a3[j] == b[i]:
      a3_a[j] = 1
if sum(a1_a) == 3 or sum(a2_a) == 3 or sum(a3_a) == 3:
  print("Yes")
elif a1_a[0] + a2_a[0] + a3_a[0] == 3:
  print("Yes")
elif a1_a[1] + a2_a[1] + a3_a[1] == 3:
  print("Yes")
elif a1_a[2] + a2_a[2] + a3_a[2] == 3:
  print("Yes")
elif a1_a[0] + a2_a[1] + a3_a[2] == 3:
  print("Yes")
elif a1_a[2] + a2_a[1] + a3_a[0] == 3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.util.*;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        if(A>=13){
            System.out.println(B);
        } else if(A>=6){
            System.out.println(B/2);
        } else {
            System.out.println(0);
        }
        sc.close();
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin >> n;
	if(n==1){
		cout << n << ": " << n << endl;
		return 0;
	}
	cout << n << ": ";
	for(int i = 2; i*i <= n; i++){
		while(n%i==0){
			n /= i;
			if(n == 1){
				cout << i << endl;
				return 0;
			}else{
				cout << i << " ";
			}
		}
	}

	if(n!=1){
		cout << n << endl;
	}

	return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  // a: 青ボール, b: 赤ボール
  ll n, a, b;
  cin >> n >> a >> b;

  ll ab = a+b;

  ll abCount = n / ab;
  ll lastBalls = n % ab;

  ll lastBlues;

  if (lastBalls <= a)
    lastBlues = lastBalls;
  else
    lastBlues = a;

  ll ans = abCount*a + lastBlues;

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
loop do

  num = gets.split(" ")
  h = num[0].to_i
  w = num[1].to_i

  if h == 0 && w == 0 then
    break
  end

  for i in 0..h-1  
    for j in 0..w-1
      print "#"
    end
   print "\n"
  end  

  print "\n"

end

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

int main() {
    int side1, side2, diagonal, numOfRectangles = 0, numOfLozenges = 0;
    while (scanf("%d,%d,%d", &side1, &side2, &diagonal) != EOF) {
        if (side1 * side1 + side2 * side2 == diagonal * diagonal)
            numOfRectangles++;
        if (side1 == side2)
            numOfLozenges++;
    }
    cout << numOfRectangles << endl
         << numOfLozenges << endl;
}

Measured memory_bytes: 0
let n, l = Scanf.scanf " %d %d" @@ fun a b -> a, b
let s, m = n * (2 * l + n - 1) / 2, l + n - 1
let _ = Printf.printf "%d\n" @@ if l * m <= 0 then s else s - snd (min (abs l, l) (abs m, m))

Measured memory_bytes: 384
var
  s:string;
  i,l,sc,sf:longint; 
begin
  read(s);
  l:=length(s);
  sc:=99999999;
  for i:=1 to l do
    if s[i]='F'then sf:=i;
  for i:=l downto 1 do
    if s[i]='C'then sc:=i;
  if sc<sf then writeln('Yes')
           else writeln('No');
end.

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(100000)

# Union-Findの用意
def root(x):
    '''島xの根を求める'''
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return root(par[x])
    
def same(x, y):
    return root(x) == root(y)

def unite(x, y):
    '''2つの島の根をつなぎ、島のサイズを更新する'''
    x = root(x)
    y = root(y)
    if x == y:
        return

    par[x] = y
    size[y] = size[x] + size[y]

# 初期値の入力
n, m = [int(x) for x in input().split()]
A = [[int(x)-1 for x in input().split()] for i in range(m)]

# N個の島(0, 1, ..., n-1)がある
#N = [i for i in range(n)]
# それぞれの島の「根」と、その根に属する島の数を更新していく
par = [i for i in range(n)]
size = [1] * n

# 逆順につないでいく
# 不便さは、数列的な考えでいく。初期値は
ans = [0] * m
ans[m-1] = n * (n-1) // 2

for i in reversed(range(m-1)):
    n1 = size[root(A[i+1][0])]
    n2 = size[root(A[i+1][1])]

    if same(A[i+1][0], A[i+1][1]):
        ans[i] = ans[i+1]
    else:
        ans[i] = ans[i+1] - n1 * n2

    unite(A[i+1][0], A[i+1][1])

for i in ans:
    print(i)

# 一本つないだとき、別のグループ同士がつながれば、その組み合わせ分不便さが減る
# Union-Findの実装は定型ではなく、応用が幅広い
# 1~Nの島があり、1本ずつつないでいく
# 知りたいのは、各頂点がどのグループに所属し、そのグループのメンバーの個数はいくつか、ということ


Measured memory_bytes: 40548
#include<bits/stdc++.h>
using namespace std;
struct po
{
	int x,y;
};
bool cmp(po a,po b)
{
	return a.x<b.x;
}
int main()
{
	
	int n;
	while(cin>>n)
	{
		po a[101000];
		for(int i=1;i<=n;i++)
		{
			cin>>a[i].x;
			a[i].y=i;
		}
		sort(a+1,a+n+1,cmp);
		for(int i=1;i<=n;i++)
		{
			//cout<<a[i].x<<" ";
			cout<<a[i].y<<" ";
			
		}cout<<endl;
	}
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mp  make_pair
#define pb  push_back
using namespace std;

typedef long long  LL;
typedef pair <int,int>  PII;
int n,A,B,d,x[100010],y[100010];
LL ans;
map <int,set <PII> > M1,M2;
map <int,vector <int> > V1,V2;
set <PII> ::iterator it1,it2;
queue <int> Q;
int res[100010];

void push(int i)
{
	Q.push(i);
	M1[x[i]+y[i]].erase(mp(x[i],i));
	M2[x[i]-y[i]].erase(mp(x[i],i));
}

void solve1(int p,int l,int r,int ty=0)
{
	ans+=upper_bound(V1[p].begin(),V1[p].end(),r)-lower_bound(V1[p].begin(),V1[p].end(),l);
	it1=M1[p].upper_bound(mp(l,0));
	it2=M1[p].upper_bound(mp(r,n+1));
	while (it1!=it2)  p=(*it1).second,it1++,push(p);
}

void solve2(int p,int l,int r)
{
	ans+=upper_bound(V2[p].begin(),V2[p].end(),r)-lower_bound(V2[p].begin(),V2[p].end(),l);
	it1=M2[p].upper_bound(mp(l,0));
	it2=M2[p].upper_bound(mp(r,n+1));
	while (it1!=it2)  p=(*it1).second,it1++,push(p);
}

void work()
{
	scanf("%d %d %d",&n,&A,&B);
	for (int i=1; i<=n; i++)
		{
			scanf("%d %d",&x[i],&y[i]);
			M1[x[i]+y[i]].insert(mp(x[i],i));
			M2[x[i]-y[i]].insert(mp(x[i],i));
		}
	for (map <int,set <PII> > ::iterator x=M1.begin(); x!=M1.end(); x++)
		for (set <PII> ::iterator y=(*x).second.begin(); y!=(*x).second.end(); y++)
			V1[(*x).first].pb((*y).first);
	for (map <int,set <PII> > ::iterator x=M2.begin(); x!=M2.end(); x++)
		for (set <PII> ::iterator y=(*x).second.begin(); y!=(*x).second.end(); y++)
			V2[(*x).first].pb((*y).first);
	push(A),push(B),d=fabs(x[A]-x[B])+fabs(y[A]-y[B]);
	while (!Q.empty())
		{
			int i=Q.front();  Q.pop();
			res[i]=-ans;
			solve1(x[i]+y[i]-d,x[i]-d+1,x[i]);
			solve1(x[i]+y[i]+d,x[i],x[i]+d-1);
			solve2(x[i]-y[i]-d,x[i]-d,x[i]-1);
			solve2(x[i]-y[i]+d,x[i]+1,x[i]+d);
			res[i]+=ans;
		}
	printf("%lld",ans/2);
}

int main()
{
	work();
	return 0;
}


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

using namespace std;

int main(){
    string s, t;
    cin >> s >> t;

    int len_s = s.size();
    int len_t = t.size();
    vector< vector<int> > is(26);
    for(int i = 0; i < len_s; i++){
        is[s[i]-'a'].push_back(i);
    }
    for(int i = 0; i < len_s; i++){
        is[s[i]-'a'].push_back(i+len_s);
    }

    long long ans = 0;
    int p = 0;
    for(int i = 0; i < len_t; i++){
        int c = t[i]-'a';
        if(is[c].size() == 0){
            cout << -1 << endl;

            return 0;
        }

        p = *lower_bound(is[c].begin(), is[c].end(), p) + 1;
        if(p >= len_s){
            p -= len_s;
            ans += len_s;
        }
    }
    ans += p;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1724
using System;
using System.Collections.Generic;
using System.Linq;

class D
{
	static void Main()
	{
		Func<long, long> comb2 = x => x * (x - 1) / 2;
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var n = h[0];

		var r = new List<long> { 0 };
		var uf = new UF(n + 1);
		var uc = Enumerable.Repeat(1, n + 1).ToArray();

		foreach (var b in new int[h[1]].Select(_ => read()).Reverse())
		{
			if (uf.AreUnited(b[0], b[1]))
			{
				r.Add(r.Last());
			}
			else
			{
				var r0 = uf.GetRoot(b[0]);
				var r1 = uf.GetRoot(b[1]);
				r.Add(r.Last() - comb2(uc[r0]) - comb2(uc[r1]) + comb2(uc[r0] + uc[r1]));
				uf.Unite(r0, r1);
				uc[r0] += uc[r1];
			}
		}
		var nc2 = comb2(n);
		Console.WriteLine(string.Join("\n", r.Select(x => nc2 - x).Reverse().Skip(1)));
	}
}

class UF
{
	int[] p;
	public UF(int n) { p = Enumerable.Range(0, n).ToArray(); }

	public void Unite(int a, int b) { if (!AreUnited(a, b)) p[p[b]] = p[a]; }
	public bool AreUnited(int a, int b) => GetRoot(a) == GetRoot(b);
	public int GetRoot(int a) => p[a] == a ? a : p[a] = GetRoot(p[a]);
}


Measured memory_bytes: 35644
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    n = int(input())
    a = []

    for i in range(n):
        a.append([int(j) for j in input().split()])

    checked = [False] * n
    tree = [0]
    checked[0] = True
    ans = 0

    for i in range(n - 1):
        min_w = float('inf')

        for u in tree:
            for j in range(n):
                if a[u][j] != -1 and not checked[j]:
                    if min_w > a[u][j]:
                        min_w = a[u][j]
                        min_n = j

        checked[min_n] = True
        tree.append(min_n)
        ans += min_w

    print(ans)



if __name__ == '__main__':
    solve()

Measured memory_bytes: 7944
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]
 
sys.setrecursionlimit(1000000)
mod = 1000000007
 
def solve():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a, a)
    k = I()
    ans = 0
    for a in range(1,k+1):
        for b in range(1,k+1):
            g = gcd(a,b)
            for c in range(1,k+1):
                ans += gcd(g,c)
    print(ans)
    return
 
#Solve
if __name__ == "__main__":
    solve()

Measured memory_bytes: 70848
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  int Hcheck[h], Wcheck[w];
  char a[h][w];
  for (int i = 0; i < h; i++) {
    Hcheck[i] = 0;
  }
  for (int i = 0; i < w; i++) {
    Wcheck[i] = 0;
  }
  
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
      if (a[i][j]=='#') {
        Hcheck[i] = 1;
        Wcheck[j] = 1;
      }
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (Hcheck[i] == 1 && Wcheck[j] == 1) {
        cout << a[i][j];
      }
    }
    if (Hcheck[i] == 1) {
      cout << endl;
    }
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<pair<string,pair<ll,ll>>> l(n), cop(n);
    for (ll i = 0; i < n; i++)
    {
        string a;
        ll k;
        cin >> a >> k;
        l[i] = make_pair(a,make_pair(-k, i + 1));
    }
    sort(l.begin(),l.end());
    for(ll i = 0; i < n; i++){
        cout << l[i].second.second << endl;
    }
}

Measured memory_bytes: 256
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define eb emplace_back
#define mp make_pair
using II = pair<int,int>;

int main(){
	int N; cin>>N;
	vvi tree(N);
	vector<II> edge;
	rp(i, 0, N-1){
		int a,b; cin>>a>>b; a--,b--;
		tree[a].eb(b); tree[b].eb(a);
		edge.eb(a,b);
	}

	int K = 0;
	map<II, int> O;

	vi p_color(N), visited(N);
	queue<int> q;
	q.push(0);
	visited[0] = true;
	while(!q.empty()){
		int p = q.front(); q.pop();
		K = max(K, (int)tree[p].size());
		int color = 1;
		for(auto c:tree[p]){
			if(visited[c]) continue;
			visited[c] = true;
			if(color==p_color[p]) color++;
			p_color[c] = O[mp(p,c)] = O[mp(c,p)] = color++;
			q.push(c);
		}
	}

	cout<< K <<endl;
	for(auto p:edge) cout<< O[p] <<endl;
}

Measured memory_bytes: 20084
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rsort(x) sort(x.rbegin(), x.rend())
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define fio(x) ios::sync_with_stdio(x), cin.tie(x), cout.tie(x);
#define znit(x) memset(x, 0, sizeof(x))
#define mnit(x) memset(x, -1, sizeof(x))
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> piii;
typedef pair<pair<int, int>, int> ppi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db EPS = 1e-7;

const ll mod = 1e9 + 7;
const ll mod2 = 1e9 + 9;
ll mypow(ll x, ll y, ll p){ll ret = 1;while(y){if(y & 1) ret = (ret * x) % p;x = (x * x) % p; y /= 2;}return ret;}
ll inv(ll x, ll p){return mypow(x, p - 2, p);}
ll gcd(ll x, ll y){return y ? gcd(y, x % y) : x;}

const int MAX = 1e5 + 3;
int N, A[MAX], oddcnt[MAX], evencnt[MAX];
int main(){
    scanf("%d", &N);
    for(int i = 1; i <= N; i++){
        scanf("%d", A + i);
        if(i & 1)   oddcnt[A[i]]++;
        else evencnt[A[i]]++;
    }
    vector<pii> oddmx, evenmx;
    for(int i = 1; i < MAX; i++){
        if(oddcnt[i])   oddmx.push_back({oddcnt[i], i});
        if(evencnt[i])  evenmx.push_back({evencnt[i], i});
    }
    oddmx.push_back({0, -1});
    evenmx.push_back({0, -2});
    sort(oddmx.rbegin(), oddmx.rend());
    sort(evenmx.rbegin(), evenmx.rend());
    N /= 2;
    int ans = 2 * N - oddmx[0].first - evenmx[0].first;
    if(oddmx[0].second == evenmx[0].second){
        ans = 2 * N - oddmx[0].first - evenmx[1].first;
        ans = min(ans, 2 * N - oddmx[1].first - evenmx[0].first);
    }
    printf("%d\n", ans);
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int64 A, B, K;
  cin >> A >> B >> K;
  int64 cnt = 0;
  for (int i = 100; i >= 1; i--) {
    if (A % i == 0 && B % i == 0) cnt++;
    if (cnt == K) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 384
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
 
  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  ll INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;
 
// const ll N = 2e5 + 5;
  

  

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

      ll x,k,d;
      cin>>x>>k>>d;
      
      ll ans = 1e16;
        ans = min(ans, abs(x-k*d));
        ans = min(ans, abs(x+k*d));
        ll m = -x/d;
        
        if (abs(m)<=k){
          x += m*d;
          // cout<<x<<endl;
          k-= abs(m);
          // ans = min(ans, abs(x));
          if (k%2==1){
            if (x<=0){
              ans = abs(x+d);
            }else{
              ans = abs(x-d);
            }
            
          }else{
            ans = abs(x);
          }
        }
      
      cout<<ans<<"\n";



}

Measured memory_bytes: 3192
#include <stdio.h>
#include <string.h>

int main(){
	int a,b,num,i,j;
	
	while(scanf("%d %d", &a ,&b) != EOF)
	{
			num = a +b;
			for(j = 0;num != 0; j++){
					num = num/10;
			}
			printf("%d\n",j);
	}
	
	return 0;
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    vector<int> a(n + 1), b(n + 1), ans;
    rep(i, n) {
      cin >> a[i + 1];
    }

    for (int i = n; i > 0; --i) {
      int sum = 0;
      for (int j = i + i; j <= n; j += i) {
        sum += b[j];
      }
      if (sum % 2 != a[i]) {
        ans.push_back(i);
        b[i] = 1;
      }
    }
    int len = ans.size();
    cout << len << '\n';
    rep(i, len) {
      if (i < len - 1) {
        cout << ans[i] << " ";
      } else {
        cout << ans[i] << '\n';
      }
    }

    return 0;
}


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

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

  int n = (int)S.size();
  vector<int> vc(n, 0);
  int rc = 0;
  int li = 0;
  for (int i=0; i<n; ++i) {
    if (S[i] == 'R') {
      ++rc;
      if (S[i+1] == 'L') li = i;
    } else {
      vc[i] += rc;
      rc = 0;
      ++vc[li];
    }
  }

  vector<int> ans(n, 0);
  for (int i=0; i<n; ++i) {
    if (vc[i] != 0) {
      ans[i] = (vc[i+1] + 1) / 2 + vc[i] / 2;
      ans[i+1] = (vc[i] + 1) / 2 + vc[i+1] / 2;
      ++i;
    }
  }
  for (int i=0; i<n; ++i) {
    if (i!=0) cout << " ";
    cout << ans[i];
  }
  cout << "\n";
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String st = sc.next();
        int len = st.length();
        while(len != 0) {
            st = st.substring(0, st.length()-2);
            len = len-2;
            String a = st.substring(0, len/2);
            String b = st.substring(len/2);
            if (a.equals(b)) {
                System.out.print(len);
                break;
            }
        }
    }
}

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

int main()
{
	int a, b, c, d;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	if(a+b > c+d)
	{
		cout<<"Left"<<endl;
	} 
	else if(a+b < c+d)
	{
		cout<<"Right"<<endl;
	} 
	else
	{
		cout << "Balanced" <<endl;
	}
	
	return 0;
} 

Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr, tails, sort)
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

isTriangle :: Int -> Int -> Int -> Bool
isTriangle a b c = a < b + c && b < c + a && c < a + b

naive = do
  n <- readLn :: IO Int
  xs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ length [ (a,b,c) | a:xss <- tails xs, b:xsss <- tails xss, c <- xsss, isTriangle a b c ]

-- v は昇順にソートされているとする。
-- count a v は a 以上の要素の個数を数える。
countGE :: Int -> U.Vector Int -> Int
countGE a v | U.null v = 0
            | U.length v == 1 = case compare a (U.head v) of
                                  LT -> 1
                                  EQ -> 1
                                  GT -> 0
            | otherwise = let n = U.length v
                              n2 = n `quot` 2
                          in case compare a (v U.! n2) of
                               LT -> countGE a (U.take n2 v) + n - n2
                               EQ -> countGE a (U.take n2 v) + n - n2
                               GT -> countGE a (U.drop n2 v)

main = do
  n <- readLn :: IO Int
  xs <- mergeSort . U.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ sum [ n - (j+1) - countGE c_max ys
              | i <- [0..n-1]
              , let a = xs U.! i
              , j <- [i+1..n-1]
              , let b = xs U.! j
              , let c_max = a + b {- c < a + b, b - a < c, a - b < c -}
              , let ys = U.drop (j+1) xs
              ]

mergeSortBy :: (U.Unbox a) => (a -> a -> Ordering) -> U.Vector a -> U.Vector a
mergeSortBy !cmp !vec = doSort vec
  where
    doSort vec | U.length vec <= 1 = vec
               | otherwise = let (xs, ys) = U.splitAt (U.length vec `quot` 2) vec
                             in merge (doSort xs) (doSort ys)
    merge xs ys = U.create $ do
      let !n = U.length xs
          !m = U.length ys
      result <- UM.new (n + m)
      let loop !i !j
            | i == n = U.copy (UM.drop (i + j) result) (U.drop j ys)
            | j == m = U.copy (UM.drop (i + j) result) (U.drop i xs)
            | otherwise = let !x = xs U.! i
                              !y = ys U.! j
                          in case cmp x y of
                               LT -> do UM.write result (i + j) x
                                        loop (i + 1) j
                               EQ -> do UM.write result (i + j) x
                                        UM.write result (i + j + 1) y
                                        loop (i + 1) (j + 1)
                               GT -> do UM.write result (i + j) y
                                        loop i (j + 1)
      loop 0 0
      return result

mergeSort :: (U.Unbox a, Ord a) => U.Vector a -> U.Vector a
mergeSort = mergeSortBy compare


Measured memory_bytes: 1020
#include <iostream>
#include <vector>

using namespace std;


int main(){
  int x[4];
  int y[4];
  for(int i=0;i<2;i++){
    cin >> x[i]>>y[i];
  }
  x[2]=x[1]-y[1]+y[0];
  y[2]=y[1]+(x[1]-x[0]);

  x[3]=x[0]-y[1]+y[0];
  y[3]=y[0]+(x[1]-x[0]);
  for(int i=2;i<4;i++){
    cout << x[i]<<' '<<y[i]<<' ';
  }

return 0;







}







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

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int h, r;
  cin >> h >> r;
  if(h + r < 0){
    cout << "-1\n";
  } else if(h + r == 0){
    cout << "0\n";
  } else {
    cout << "1\n";
  }
  return 0;
}



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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
//#define int ll
#define swap(x, y)((x)^=(y)^=(x)^=(y))
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define tcase int _; cin>> _; for( ; _; --_)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

double n;

void solve(){
	cin>> n;
	n/=3.0;
	cout<<fixed << setprecision(7) <<  n*n*n<< endl;
}

int32_t main(){
	fastio;
	solve();
	return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<string> v;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    v.push_back(s);
  }
  unordered_map<string, int> mp;
  ll ans = 0;
  rep(i, n) {
    mp[v[i]]++;
    if (mp[v[i]] >= 2) ans += mp[v[i]] - 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13664
def main():
    A, B, C = map(int, input().split())
    K = int(input())

    for i in range(K):
        if A >= B:
            B *= 2
        elif B >= C:
            C *= 2

    if A < B and B < C:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9164
x1,y1,x2,y2=map(int,input().split())
x=abs(x1-x2)
y=abs(y1-y2)
print(x*"R"+y*"U"+x*"L"+y*"D"+"D"+(x+1)*"R"+(y+1)*"U"+"L"+"U"+(x+1)*"L"+(y+1)*"D"+"R")


Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>

int count_edge(char *S, int N)
{
    int count = 1;
    for(int i=0; i<N-1; i++){
        if(S[i] == '1' && S[i+1] =='0')
            count++;
    }
    return count;
}

void search(char *S, int N, int *chokuritsu, int *sakadachi, int count)
{
    int j = 0;
    for(int i=0; i<count; i++){ //initialize
        chokuritsu[i] = 0;
        sakadachi[i] = 0;
    }
    for(int i=0; i<N; i++){
        if(*(S+i) == '0'){
            chokuritsu[j]++;
        }
        else if(*(S+i) == '1'){
            sakadachi[j]++;
            if(i != N-1 && *(S+i+1) == '0') j++;
        }
    }
}

int main()
{
    int N, K;
    scanf("%d %d", &N, &K);
    char S[N+1];
    scanf(" %s", S);
    
    int count = count_edge(S, N);
    if(K >= count){
        printf("%d\n", N);
        return 0;
    }
    int chokuritsu[count];
    int sakadachi[count];
    search(S, N, chokuritsu, sakadachi, count);

    int max = 0;
    for(int i=0; i<K; i++){
        max += chokuritsu[i] + sakadachi[i];
    }
    int num = max;
    for(int i=0; i<count-K; i++){
        num += chokuritsu[i+K] + sakadachi[i+K] - chokuritsu[i];
        num -= (i==0) ? 0 : sakadachi[i-1];
        if(num > max) max = num;
    }
    
    printf("%d\n", max);
    return 0;
}


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

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

  vector<int> A(N);
  long long tot = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    tot += A.at(i);
  }

  sort(A.begin(), A.end());
  cout << A.at(0) << ' ' << A.at(N - 1) << ' ' << tot << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define CLR(a, b) memset((a), (b), sizeof((a)))
template <typename t> bool ckmin(t& a, const t& b) {return a > b ? a = b, true : false;}
template <typename t> bool ckmax(t& a, const t& b) {return a < b ? a = b, true : false;}

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

    int x, y, z;
    cin >> x >> y >> z;

    cout << z << ' ' << x << ' ' << y;
}




Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count_a = 0
count_b = 0
for i in range(n):
    count_a += max(0,(b[i]-a[i]+1)//2)
    count_b += max(0,a[i]-b[i])
if sum(b)>=sum(a) and sum(b)-sum(a)>=max(count_a,count_b):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...) std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int a, b; std::cin >> a >> b;
  a -= 1;
  b -= 1;
  auto ret = (b + a - 1) / a;
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

 
sm = sum(a)
for i in range(n):
	c = min(a[i],b[i])
	a[i] -= c
	a[i+1] -= min(a[i+1],b[i]-c)
	
print(sm-sum(a))

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
  
// 262144 = 2^18
int tree[262144]; 
  
int dfs(int a,int b,int k,int l,int r){
  if(r<a || b<l)return 0;
  if(a<=l && r<=b)return tree[k];
  int m=(l+r)/2;
  return dfs(a,b,k*2+1,l,m)+dfs(a,b,k*2+2,m+1,r);
}
  
int getSum(int a,int b){
  // 131072 = 2^17
  return dfs(a,b,0,0,131072);
}
  
void update(int i,int x){
  // 131072 = 2^17
  i+=(131072-1);
  tree[i]+=x;
  while(i){
    i=(i-1)/2;
    tree[i]+=x;
  }
}

int n,q;
  
int main(){
  scanf("%d %d",&n,&q);
  while(q--){
    int type;
    scanf("%d",&type);
    if(type==0){
      int l,r,x;
      scanf("%d %d %d",&l,&r,&x);
      update(l,x);
      update(r+1,-x);
      
    }else{
      int target;
      scanf("%d",&target);
      int ans=getSum(0,target+1);
      printf("%d\n", ans);
    }
  }
  return 0;
}

Measured memory_bytes: 3956
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl

typedef pair<int, int> P;
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> l(n);
    REP(i,n) cin>>l[i];
    sort(all(l),greater<int>());
    int sum = 0;
    FOR(i,1,n){
        sum += l[i];
    }
    bool flag = false;
    if(sum>l[0]) flag = true;
    if(flag) print("Yes");
    else print("No");
    return 0;
}

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

int main(){

    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    vector<int> H(N);
    for(int i = 0; i < N; i++) cin >> H[i];

    double min = 1e6;
    int index;
    for(int i = 0; i < N; i++){
        if(min > abs(A - (T - H[i] * 0.006))){
            min = abs(A - (T - H[i] * 0.006));
            index = i + 1;
        }
    }

    cout << index << endl;

    return 0;
}

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

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final String s = fs.next();
        final String t = fs.next();
        int res = Integer.MAX_VALUE;
        for (int end = t.length(); end <= s.length(); end++) {
            res = Math.min(res, f(t, s.substring(end - t.length(), end)));
        }
        System.out.println(res);
    }

    private static int f(String left, String right) {
        int diff = 0;
        for (int i = 0; i < left.length(); i++) {
            if (left.charAt(i) != right.charAt(i)) {
                diff++;
            }
        }
        return diff;
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 33152
n,T=map(int,input().split())
t=[int(i) for i in input().split()]

ans=0
s=0
for i in range(n):
    if i>0:
        if t[i]-t[i-1]>=T:
            ans+=T
        else:
            ans+=t[i]-t[i-1]
            
print(ans+T)


Measured memory_bytes: 25196