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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll dp[3002][3002];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  string s, t;
  cin >> s;
  cin >> t;
  // dump(s, t);
  int i, j;
  string ans = "";
  s += "#";
  t += "$";
  for (i = 0; i < s.size(); i++) {
    for (j = 0; j < t.size(); j++) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
      }
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
    }
  }
  // dumpv(dp, s.size() + 1, t.size() + 1);
  i = s.size() - 1;
  j = t.size() - 1;
  while (i + j) {
    // while (0 <= i && 0 <= j) {
    if (0 < i && dp[i][j] == dp[i - 1][j]) {
      i--;
    } else if (0 < j && dp[i][j] == dp[i][j - 1]) {
      j--;
    } else {
      i--;
      j--;
      ans += s[i];
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

typedef long long ll;

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;


int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    int ruiseki[n];
    ruiseki[0] = 0;
    for(int i = 1; i < n ; i++){
        ruiseki[i] = ruiseki[i-1];
        if(s[i] == 'C' && s[i-1] == 'A') ruiseki[i]++;
    }
    vector<pair<int,int>> p(q);
    for(int i = 0; i < q; i++){
        int l,r;
        cin >> l >> r;
        p[i].first = l - 1;
        p[i].second = r - 1;
    }
    for(int i = 0; i < q; i++){
        int l,r;
        l = p[i].first;
        r = p[i].second;
        cout << ruiseki[r] - ruiseki[l] << endl;
    }
    return 0;
}

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

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 100000007;
const int INF = 1 << 29;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	int N;
	string s;
	cin >> N >> s;
	s += s;

	vector<vector<char>> ans(4);
	string ans_in = "SSSWWWWS";

	FOR(i, 0, 4) {

		ans[i].emplace_back(ans_in[2 * i]);
		ans[i].emplace_back(ans_in[2 * i + 1]);

		FOR(j, 1, N + 1) {

			if (s[j] == 'o') {
				     if (*(ans[i].end() - 2) == 'S' && *(ans[i].end() - 1) == 'S') ans[i].emplace_back('S');
				else if (*(ans[i].end() - 2) == 'W' && *(ans[i].end() - 1) == 'S') ans[i].emplace_back('W');
				else if (*(ans[i].end() - 2) == 'W' && *(ans[i].end() - 1) == 'W') ans[i].emplace_back('S');
				else if (*(ans[i].end() - 2) == 'S' && *(ans[i].end() - 1) == 'W') ans[i].emplace_back('W');
				else return -1;
			}
			if (s[j] == 'x') {
				     if (*(ans[i].end() - 2) == 'S' && *(ans[i].end() - 1) == 'S') ans[i].emplace_back('W');
				else if (*(ans[i].end() - 2) == 'W' && *(ans[i].end() - 1) == 'S') ans[i].emplace_back('S');
				else if (*(ans[i].end() - 2) == 'W' && *(ans[i].end() - 1) == 'W') ans[i].emplace_back('W');
				else if (*(ans[i].end() - 2) == 'S' && *(ans[i].end() - 1) == 'W') ans[i].emplace_back('S');
				else return -1;
			}
		}

		if (ans[i].front() == *(ans[i].end() - 2) && *(ans[i].begin() + 1) == ans[i].back()) {

			ans[i].erase(ans[i].end() - 2, ans[i].end());
			for (auto &elem : ans[i]) cout << elem;
			return 0;
		}
	}
		cout << "-1";
		return 0;
}

Measured memory_bytes: 1064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcountll(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pii,vector<pii>,greater<pii> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<int,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}


typedef tree<pii, null_type, less<pii>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#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


int32_t main()
{
	fast;
	int n;cin>>n;
	int *arr=new int[n];
	int ans=0;
	for(int i=0;i<n;i++)
		cin>>arr[i];

	int sum=arr[0];
	for(int i=1;i<n;i++)
	{
		int val=sum*arr[i];
		val%=mod;
		ans+=val,ans%=mod;
		sum+=arr[i],sum%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 5216
//-------------
//include
//-------------
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <random>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef long long LL;
typedef  vector<int> VI;
typedef  vector<string>VS;
typedef  set<int> SI;
typedef  set<string> SS;
typedef  string STR;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(a) cout<<a<<endl
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(c) REP(i,SZ(c))cerr<<#c<<i<<"="<<(c[i])<<endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const int MOD = 1000000007;
int main()
{
	STR S;
	cin >> S;
	REP(i,SZ(S))
	{
		if (i % 2 == 0)
		{
			cout << S[i];
		}
	}
	cout << endl;
#ifdef _DEBUG
	while (1);
#endif // _DEBUG

	return 0;
}

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

#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll n, k;
    cin>>n>>k;
    map<ll, vector<string> > m;
    ll tmp;
    string s;
    for(int i=0;i<k;i++)
    {
        cin>>tmp>>s;
        m[tmp].push_back(s);
    }
    ll correct=0, penalities=0;
    for(auto it:m)
    {
        for(int i=0;i<it.second.size();i++)
        {
            if(it.second[i]=="AC")
            {
                correct++;
                break;
            }
        }
        ll pen=0;
        for(int i=0;i<it.second.size();i++)
        {
            if(it.second[i]=="WA")pen++;
            else break;
        }
        if(pen!=it.second.size())penalities+=pen;
    }
    cout<<correct<<" "<<penalities;

    return 0;
}

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

string s;
int cur = 0, cnt = 0;
long long ans = 0;

long long solve(int l, int r) {
    return 1LL * (l - 1) * l / 2 
         + 1LL * (r - 1) * r / 2
         + max(l, r);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> s;
    int le = 0, ri = 0;
    char pre = '<';
    for (char &c : s) {
        if (c == '<') {
            if (pre == '<') {
                le++;
            } else {
                ans += solve(le, ri);
                le = 1; ri = 0;
            }
        } else {
            ri++;
        }
        pre = c;
    }
    cout << ans + solve(le, ri);
}


Measured memory_bytes: 1172
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 500
using namespace std;
int read(){
    int nm=0,fh=1; int cw=getchar();
    for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
    for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
    return nm*fh;
}
int n,m,e1,e2,h1,h2,cnt,in[M],ot[M],f[M]; bool vs[M];
int fd(int x){return x==f[x]?x:f[x]=fd(f[x]);}
int main(){
    n=read(),m=read();
    for(int i=1;i<=m;i++) f[i]=i,f[i+m]=i+m,vs[i]=vs[i+m]=false;
    for(int i=1;i<=n;i++){
        h1=read(),h2=read(),e1=read(),e2=read();
        int t1=e1>0?e1:-h1,t2=e2>0?-e2:h2; t1+=m,t2+=m;
        if(fd(t1)!=fd(t2)) f[fd(t1)]=fd(t2); in[t2]++,ot[t1]++;
    }
    for(int i=-m;i<0;i++) if(in[i+m]>ot[i+m]){puts("NO");return 0;}
    for(int i=1;i<=m;i++) if(in[i+m]<ot[i+m]){puts("NO");return 0;}
    for(int i=0;i<=m+m;i++) if(in[i]!=ot[i]) vs[fd(i)]=true;
    for(int i=0;i<=m+m;i++) if(in[i]&&ot[i]&&!vs[fd(i)]){puts("NO");return 0;}
    puts("YES"); return 0;
}

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

namespace AGC011B {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            Array.Sort(input);
            long[] sum = new long[N];
            sum[0] = input[0];
            for (int i = 1; i < N; i++) {
                sum[i] = sum[i - 1] + input[i];
            }
            int ans = 1;
            for (int i = N - 2; i >= 0; i--) {
                if (sum[i] * 2 >= input[i + 1]) {
                    ans++;
                } else {
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28892
#include <stdio.h>

int main(){
  int n,a=0,b=1,c,i;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    c = a + b;
    a = b;
    b = c;
  }
  printf("%d\n",c);
  return 0;
}


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

int n;
int a[100];
int cnt[9];

int main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= 3200) a[i] = 3200;
		cnt[a[i] / 400]++;
	}
	
	int minC = 0;
	for (i = 0; i < 8; i++) {
		if (cnt[i] > 0) {
			minC++;
		}
	}
	if (minC == 0 && cnt[8] > 0) minC++;
	
	int maxC = 0;
	for (i = 0; i < 8; i++) {
		if (cnt[i] > 0) {
			maxC++;
		}
	}
	maxC += cnt[8];
	cout << minC << " " << maxC << endl;
	return 0;
}

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

int main() {
int n,a,c[100000] ,i, j;

cin>>n;
for (i = 1; i<= n; i++){
    cin>>a;
    c[a] = i;
}

for (i = 1; i <= n; i++){
    cout << c[i] <<endl;
}

return 0;
}


Measured memory_bytes: 1152
///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 1e6+10
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
const int N = 2e5 + 10;
ll aarray[200000+10];
ll magic[101][101];
vector<ll>primes;
bool prime[1000001];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    makefast__
    string str;
    dl i,j,n,m,k,t,a,b,ans=0;
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        cin>>a>>b;
        k=(a*a)+(b*b);
        k=sqrt(k);
        if(k<=m)
            ans++;

    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 3664
from sys import stdin
f_i = stdin

N = int(f_i.readline())
P = ''.join(f_i.readline().split())
Q = ''.join(f_i.readline().split())

from itertools import permutations
seq = permutations(str(i) for i in range(1, N + 1))
seq = sorted(''.join(p) for p in seq)

from bisect import bisect_left
idx1 = bisect_left(seq, P)
idx2 = bisect_left(seq, Q)

print(abs(idx1 - idx2))

Measured memory_bytes: 6052
#include <bits/stdc++.h>
#include <numeric>
#include <iterator>
#include <stdio.h>
#define ll long long
#define ull unsigned long long int
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define sz(a) int((a).size())
#define all(a) (a).begin(),(a).end()
#define fr(i,p,n) for(int i=p;i<n;i++)
#define precise cout << std::setprecision(10) << std::fixed;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
ll M=1000000007;
//ll M=  998244353;
typedef pair<int, int> pairs;

int main()
{
    fastio; precise;
    int T=1;
    //cin>>T;
    while(T--){
        int n,w,x;
        cin>>n>>w;
        int wt[n];
        ll v[n];
        fr(i,0,n){
        cin>>wt[i]>>v[i];
        }
        ll dp[n][w+1];
        fr(i,0,n){
        fr(j,0,w+1){
        if(i==0) dp[i][j]=j>=wt[i] ? v[i]:0;
        else if(j-wt[i]<0) dp[i][j]=dp[i-1][j];
        else dp[i][j]=max(dp[i-1][j-wt[i]]+v[i],dp[i-1][j]);
        }
        }
        cout<<dp[n-1][w]<<endl;


    }
     return 0;
}


Measured memory_bytes: 81564
n=int(input())
a = list(map(int,input().split()))
a.sort()
 
def gcd(a,b):
  if a>b:
    return gcd(b,a)
  else:
    if b%a==0:
      return a
    else:
      return gcd(b%a,a)

dp1=[[0 for i in range(n)] for j in range(2)]
dp1[0][0]=a[0]
dp1[1][0]=a[0]
dp1[0][1]=gcd(a[0],a[1])
dp1[1][1]=a[1]
for i in range(n-2):
  dp1[0][i+2]=gcd(dp1[0][i+1],a[i+2])
  dp1[1][i+2]=max(gcd(dp1[1][i+1],a[i+2]),dp1[0][i+1])

dp2=[[0 for i in range(n)] for j in range(2)]
dp2[0][0]=a[0]
dp2[1][0]=a[0]
dp2[0][1]=gcd(a[0],a[1])
dp2[1][1]=a[0]
for i in range(n-2):
  dp2[0][i+2]=gcd(dp2[0][i+1],a[i+2])
  dp2[1][i+2]=max(gcd(dp2[1][i+1],a[i+2]),dp2[0][i+1])
 
print(max(dp1[1][n-1],dp2[1][n-1]))

Measured memory_bytes: 14076
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        n: usize,
        a: [(u8, i64); n],
    }
    let mut p = (1, 0);
    for (q, x) in a {
        p = match q {
            1 => (p.0 * x, p.1 * x),
            2 => (p.0, p.1 + x),
            _ => (p.0, p.1 - x),
        };
    }
    println!("{} {}", -p.1, p.0);
}

fn main() {
    run();
}



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

vector<char> vtovi(vector<char>& vc) {
	vector<char> tmp;
	int i=0;
	while(i<vc.size() && vc[i]=='0') ++i;
	if(i==vc.size()) return tmp;
	tmp.insert(tmp.begin(),vc.begin()+i,vc.end());
	return tmp;
}
 
int main() {
	int w,h;
	while(cin >> w >> h,w) {
		vector<vector<char> > c(h,vector<char>(w));
		for(auto&e:c) for(auto&a:e) cin >> a;
		vector<vector<vector<char> > > tmp(h+1,vector<vector<char> >(w+1));
		vector<char> ans;
		for(int i=h-1;i>=0;--i) {
			for(int j=w-1;j>=0;--j) {
				if(isdigit(c[i][j])) {
					vector<char> maxi;
					if(tmp[i+1][j].size()==tmp[i][j+1].size())
						maxi=max(tmp[i+1][j],tmp[i][j+1]);
					else maxi=tmp[i+1][j].size()>tmp[i][j+1].size()?
							 tmp[i+1][j]:tmp[i][j+1];
					tmp[i][j].push_back(c[i][j]);
					tmp[i][j].insert(tmp[i][j].begin()+1,maxi.begin(),maxi.end());
					vector<char> t(vtovi(tmp[i][j]));
					if(ans.size()<t.size()) ans=t;
					else if(ans.size()==t.size()) ans=max(ans,t);
				}
			}
		}
		for(auto a:ans) cout << a;
		cout << endl;
	}
 
	return 0;
}



Measured memory_bytes: 3152
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: usize,
        a: [u64;n],
    }

    input! {
        q: usize
    }

    let mut bs = vec![];
    let mut cs = vec![];

    for _ in 0..q {
        input! {
            b: u64,
            c: u64,
        }
        bs.push(b);
        cs.push(c);
    }

    let mut dic = HashMap::new();
    for x in a {
        *dic.entry(x).or_insert(0u64) += 1;
    }
    let mut sum: u64 = dic.iter().map(|(k, v)| k * v).sum();
    for i in 0..q {
        let tmp = *dic.entry(bs[i]).or_insert(0);
        *dic.entry(bs[i]).or_insert(0) = 0;
        *dic.entry(cs[i]).or_insert(0) += tmp;
        sum = sum - bs[i] * tmp + cs[i] * tmp;
        println!("{}", sum);
    }
}


Measured memory_bytes: 9464
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> V(N);
    for(int i = 0;i < N;i++){
        cin >> V[i];
    }
    long long sum = 0;
    for(int i = 0;i < N;i++)
    {
        for(int j = i + 1;j < N;j++){
            sum += V[i] * V[j];
        }
    }
    cout << sum << '\n';
}

Measured memory_bytes: 256
class UnionSet:
    def __init__(self, nmax: int) -> None:
        self.size = [1] * nmax
        self.id = [i for i in range(nmax)]
        self.weight = [0] * nmax

    def root(self, i: int) -> int:
        if (i == self.id[i]):
            return i
        else:
            tmp = self.root(self.id[i])
            self.weight[i] += self.weight[self.id[i]]
            self.id[i] = tmp
            return self.id[i]

    def get_weight(self, i: int) -> int:
        self.root(i)
        return self.weight[i]

    def connected(self, p: int, q: int) -> bool:
        return self.root(p) == self.root(q)

    def unite(self, p: int, q: int, w: int) -> None:
        w += self.get_weight(p)
        w -= self.get_weight(q)
        i, j = self.root(p), self.root(q)
        if (i == j):
            return
        if self.size[i] < self.size[j]:
            self.id[i] = j
            self.size[j] += self.size[i]
            self.weight[i] = -w
        else:
            self.id[j] = i
            self.size[i] += self.size[j]
            self.weight[j] = w

    def diff(self, p: int, q: int) -> None:
        i, j = self.root(p), self.root(q)
        if (i == j):
            print(self.get_weight(q) - self.get_weight(p))
        else:
            print("?")


if __name__ == "__main__":
    n, q = map(int, input().split())

    u = UnionSet(n)
    for _ in range(q):
        op, *v = map(lambda x: int(x), input().split())
        if (0 == op):
            x, y, w = v
            u.unite(x, y, w)
        else:
            x, y = v
            u.diff(x, y)



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K; cin >> N >> K;
    vector<ll> x(N); rep(i, N){cin >> x.at(i);}
    sort(x.begin(), x.end());
    ll ans = 0;
    rep(i, K){ans += x.at(i);}
    cout << ans << endl;
}

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


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int n = 0;
		for(int i = 0; i < str.length(); i++){
			String c = str.substring(i, i+1);
			if(str.indexOf(c) != i){
				System.out.println("no");
				n++;
				break;
			}else {
			}
		}
		if(n == 0){
			System.out.println("yes");
		}
	}
}

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

using namespace std;
typedef long long int ll;
int main() 
{

ll r;
cin>>r;

long double a = (2.0)*(3.1415926535)*(r);
    
    cout.setf(ios::fixed,ios::floatfield);
    cout.precision(10);
    
cout<<a;

    

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i=0; i<N; i++){
        cin >> S.at(i);
    }
    sort(S.begin(),S.end());
    int a=0;
  	vector<int> max;
  	int m=0;
    vector<string> maxs;
    for(int i=1; i<N; i++){
        if(S.at(i)!=S.at(i-1)){
            int k=i-a;
            if(k>=m){
                max.push_back(k);
              	m=k;
                maxs.push_back(S.at(i-1));
            }
            a=i;
        }
        if(i==N-1){
			int k=i-a+1;
          	if(k>=m){
                max.push_back(k);
              	m=k;
                maxs.push_back(S.at(i));
            }
        }
    }
  
    for(int i=0; i<maxs.size(); i++){
       if(max.at(i)==m) cout << maxs.at(i) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 16872
import java.util.*;	
public class Main {
	public static void main(String[] args) {
					Scanner in =new Scanner(System.in).useDelimiter("[^0123456789-]+");
					int []a=new int[5];
					for(int i=0;i<a.length;i++){
						a[i]=in.nextInt();
					}
					Arrays.sort(a);
					for (int i = a.length-1; i >=1; i--) {
						System.out.print(a[i]+" ");
					}
					System.out.println(a[0]);
						
					in.close();
			}
	
	}


Measured memory_bytes: 26176
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int N = Integer.parseInt(sc.next());
        int[] ar = new int[N];
        int[] br = new int[N];
        for (int i = 0; i < N; i++) {
            ar[i] = Integer.parseInt(sc.next());
            br[i] = ar[i];
        }
        
        Arrays.sort(br);

        for (int i = 0; i < N; i++) {
            out.println(ar[i] == br[N-1] ? br[N-2] : br[N-1]);
        }
        
        out.flush();
    }
}

Measured memory_bytes: 62992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i;
  int N,M;
  int A[101];
  int count = 0;
  bool exist = false;
  int sum = 0;
  
  cin >> N >> M;
  for(i=1;i<=N;i++){
    cin >> A[i];
    sum += A[i];
  }
  
  for(i=1;i<=N;i++){
    if(A[i]*4*M<sum ){
      count = count;
    }
    else if(A[i]*4*M>=sum){
      count++;
    }
  }
  if(count>=M){
      exist=true;
      //break;
  }
  
  if(exist==true)
    cout << "Yes";
  else if(exist==false)
    cout << "No";
  
  
  
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
long long a[2010];
long long m=1e9+7;
int main(){
	long long n,k;
	cin >> n >> k;
	long long aa=(((k+1)*k)/2)%m;
	long long bb=((k*(k-1))/2)%m;
	for(long long i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	long long qian=0,hou=0;
	for(long long i=0;i<n;i++){
		for(long long j=i+1;j<n;j++){
			if(a[i]<a[j]){
				qian++;
				qian=qian%m;
			}
			else if(a[i]>a[j])
				hou++;
				hou=hou%m;
		}
	}
	long long ans=((hou*(aa%m))%m+(qian*(bb%m))%m)%m;
	cout << ans;
    return 0;
}//dasdasdasda

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

//0~aまでのxor
ll func(ll a) {
	ll res = (a + 1) / 2;
	res %= 2;
	if (a % 2 == 0) res ^= a;
	return res;
}

int main() {
	ll A, B;

	cin >> A >> B;

	ll ans;
	if (A > 0) ans = func(A - 1) ^ func(B);
	else ans = func(B);

	cout << ans << endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  char c;
  cin >> c;

  bool flag = false;
  vector<char> l = {'a','e','i','o','u'};
  REP(i, l.size()){
    if(l[i] == c)
      flag = true;
  }

  if(flag)
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;

}


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

long long int a[21];
long long int b[21];
int main(){
	int i=0;
	int j=0;
	int n=0;
	int k=0;
	cin>>n;
	for(i=0;i<22;i++){
		a[i]=0;
		b[i]=0;
	}
	cin>>k;
	a[k]=1;
	for(i=0;i<n-2;i++){
		cin>>k;
		for(j=0;j<22;j++){
			 if(j-k<0){
			 	b[j]=a[j+k];
			 }
			 if(j+k>20){
		 		b[j]=a[j-k];
			 }
			 if(j-k>=0 && j+k<=20){
			 	b[j]=a[j-k]+a[j+k];
			 }
		}
		for(j=0;j<22;j++){
			a[j]=b[j];
		}
	}
	cin>>k;
	cout<<a[k]<<endl;
} 

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int n;
    cin>>n;
    set<int> s;
    rep(i, n) {
        int e;
        cin>>e;
        s.insert(e);
    }

    int m;
    cin>>m;
    set<int> t;
    rep(i, m) {
        int e;
        cin>>e;
        t.insert(e);
    }

    set<int> res;
    set_difference(s.begin(), s.end(), t.begin(), t.end(), inserter(res, res.end()));

    for (auto e : res) cout<<e<<endl;
}


Measured memory_bytes: 31320
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;

public class Main {

	void solve() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		int[] ans = new int[N];
		for (int i = 0; i < M; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			ans[a]++;
			ans[b]++;
		}
		for (int i = 0; i < N; i++) {
			out.println(ans[i]);
		}
	}
	
	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

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

#define mp(x, y) make_pair((x), (y))

typedef long long ll;

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

int n;
int a[100005];
int k;
int g, m;

int main()
{
	scanf("%d%d", &n, &k);
	for(int i=0; i<n; i++) {
		scanf("%d", &a[i]);
		if(i==0) g=a[i];
		else g=gcd(g, a[i]);
		m=max(m, a[i]);
	}
	if(k<=m) {
		if(k%g==0) printf("POSSIBLE\n");
		else printf("IMPOSSIBLE\n");
	} else {
		printf("IMPOSSIBLE\n");
	}

	return 0;
}

Measured memory_bytes: 640
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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 end

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

    ll n, W;
    in >> n >> W;
    ll w[n+1] = {};
    ll v[n+1] = {};
    ll sum_v = 0;

    REP(i, n){
        in >> w[i+1] >> v[i+1];
        sum_v += v[i+1];
    }
    ll dp[n+1][sum_v+1] = {};
    REP(i, n+1) REP(j, sum_v+1) dp[i][j] = INF;
    REP(i, n+1) dp[i][0] = 0;

    REP_AB(i, 1, n){
        REP(j, v[i]) dp[i][j] = dp[i-1][j];
        REP_AB(j, v[i], sum_v){
            // dp[n番目][価値jの時] = 価値をjにできる最小のw
            dp[i][j] = dp[i-1][j];
            if(dp[i-1][j-v[i]] > W) continue;
            dp[i][j] = min(dp[i-1][j-v[i]] + w[i], dp[i][j]); 
        }
    }
    ll ans = 0;
    REP(i, sum_v+1){
        if(dp[n][i] <= W){
            ans = i;
        }
    }
    out << ans << endl;
}


Measured memory_bytes: 79232
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")


p,q,r = MI()

print(min(p+q,p+r,q+r))

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int gcd(int a, int b) {

    if(a < b)
        swap(a, b);

    int c = a % b;

    while(c != 0) {

        a = b;
        b = c;
        c = a % b;

    }

    return b;

}

int main() {

    int n;
    using ll = long long;

    cin >> n;

    ll sum = 0;


    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= n; ++j)
            for(int k = 1; k <= n; ++k) 
                sum += gcd(i, gcd(j, k));


    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 3608
s = input()

first_sep = int((len(s) - 1) / 2)
second_sep = int((len(s) + 3) / 2) - 1

first = s[0:first_sep]
second = s[second_sep:]

s_rev = s[::-1]
first_rev = first[::-1]
second_rev = second[::-1]

if s == s_rev and first == first_rev and second == second_rev:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 8856
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
    string s, t, f, ans;
    cin >> s >> t;
    int sl = s.size(), tl = t.size();
    for (int i = 0; i < sl; ++i)
        f += '{';
    ans = f;
    
    for (int i = 0; i <= sl - tl; ++i) {
        bool success = true;
        for (int j = 0; j < tl; ++j) {
            if (s[i + j] == '?')
                continue;
            if (s[i + j] != t[j])
                success = false;
        }
        if (success) {
            string temp = s;
            for (int j = 0; j < tl; ++j)
                temp[i + j] = t[j];
            for (int j = 0; j < sl; ++j)
                if (temp[j] == '?')
                    temp[j] = 'a';
            ans = min(ans, temp);
        }
    }
    
    if (ans == f)
        cout << "UNRESTORABLE" << endl;
    else
        cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
 
using namespace std;
 
string s;
int p;
int T;
 
int number()
{
    int res = s[p] - '0';
    p++;
    return res;
}
 
int formula()
{
    int res = number();
    for (;;) {
        if (s[p] == '*') {
            p++;
            res *= number();
        } else {
            break;
        }
    }
    return res;
}
 
int expr()
{
    int res = formula();
    for (;;) {
        if (s[p] == '+') {
            p++;
            res += formula();
        } else {
            break;
        }
    }
    return res;
}
 
int expr2()
{
    int res = number();
    for (;;) {
        if (s[p] == '+') {
            p++;
            res += number();
        }
        else if (s[p] == '*') {
            p++;
            res *= number();
        }
        else {
            break;
        }
    }
    return res;
}
 
int main()
{
    cin >> s >> T;
 
    bool l1, l2;
    p = 0;
    l1 = expr() == T;
    p = 0;
    l2 = expr2() == T;
 
    if (l1 && l2) cout << "U" << endl;
    if (l1 && !l2) cout << "M" << endl;
    if (!l1 && l2) cout << "L" << endl;
    if (!l1 && !l2) cout << "I" << endl;
}

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

int main() {
  int K, N;
  cin >> N >> K;
  vector <int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  int result = 0;
  for (int i = 0; i < K; i++) {
    result += p.at(i);
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3588
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    if(a+b >= c) cout << b+c << endl;
    else cout << (a+b) + b + 1 << endl;
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
    using namespace std;
     
    using ll = long long;
     
    #define INF (1LL << 31 - 1)
    #define MOD int(1e9+7)
    #define repi(i,j,n) for(int i = (j); i < (n); ++i)
    #define rep(i,n) repi(i,0,n)
    #define fi first
    #define se second
     
    inline void init() {
      cin.tie(0);
      ios::sync_with_stdio(false);
    }
     
    ll n, m, a, b;
    vector<int> g[100001];
     
    /* 二部グラフ判定 */
    /* グラフはvector<int> g[MAX_V]; */
    /* isBipartiteGraph(0, 1) で呼ぶ*/
    int color[100001];
     
    bool isBipartiteGraph(int v, int c) {
    	color[v] = c;
     
    	int si = g[v].size();
    	for (int i = 0; i < si; ++i) {
    		int nxt = g[v][i];
    		if (color[nxt] == c) return false;
    		if (color[nxt] == 0 and !isBipartiteGraph(nxt, -c)) return false;
    	}
     
    	return true;
    }
    /***************/
     
    int main() {
    	init();
     
    	cin >> n >> m;
    	rep(i,m) {
    		cin >> a >> b;
    		a--, b--;
    		g[a].push_back(b);
    		g[b].push_back(a);
    	}
     
    	// 奇数長の閉路がない = 二部グラフ
    	if (isBipartiteGraph(0, 1)) {
    		a = b = 0;
    		rep(i,n) {
    			if (color[i] == 1) a++;
    			else b++;
    		}
    		cout << a * b - m << endl;
    	}
    	// あれば完全グラフになりうる
    	else {
    		cout << (n * (n - 1) / 2 - m) << endl;
    	}
     
      return 0;
    }

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <tuple>
#include <thread>///////////////////

#define rep(i,m,n) for(int i=(m);i<(n);++i)
#define rem(i,m,n) for(int i=(m);i>(n);--i)
#define MOD 1000000007

using namespace std;

using ll = long long int;
using std::swap;

vector<int> v;
vector<int> w;
vector<long long int> vll;
vector<long long int> wll;
//vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;

//int N, Y;
int mode = 0;

//tuple<int, int, int> calc(int A, int B, int C) {}



int main() {
	int L;
	cin >> L;
	long double X = pow(L / 3.0, 3.);
	cout << fixed << setprecision(10) << X << '\n';
	return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#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);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int A, B, ans=0;
  cin >> A >> B;
  int M = 1;
  while(M < B) {
    M += A-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
N = int(input())
 
A = list(map(int,input().split()))
gou = A[0]
xor = A[0]
ans_max = 0
ans = 0
a = 0
b = 0
while 1:
  if gou == xor and a <= N-1:
    ans_max += 1
    if a >= N-1:
      a += 1
      continue
    a  += 1
    gou += A[a]
    xor ^= A[a]
  else:
    ans += ans_max
    ans_max -= 1
    gou -= A[b]
    xor ^= A[b]
    b += 1
    if b >= N:
      break
print(ans)

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

int x;
string s;


int main(){
  cin>> x;
  cin>> s;
  if(x%2==1){
    cout << "No\n";
    return 0;}
    int pan = s.size();
    int sampe = pan/2;
    for(int i=0;i<sampe;i++){
      if(s[i] != s[i+sampe]){
        cout << "No\n";
        return 0;
        }
      }
    cout << "Yes\n";
  return 0;
  }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i,n) for (int i = 0; i < n; ++i)

ll getVal(vi cs) {
    ll val = 0;
    REP (k, 4) {
        ll v = 0;
        REP (i, 4) v = v * 1000 + cs[(i+k)&3];
        val = max(val, v);
    }
    return val;
}

vi getVector(ll val) {
    vi vec(4);
    REP (k, 4) {
        vec[k] = val % 1000;
        val /= 1000;
    }
    return vec;
}

vi getVector(vi top, vi bottom, int idx) {
    vi cs(4);
    cs[0] = top[(idx+1)&3];
    cs[1] = top[idx];
    cs[2] = bottom[idx&3];
    cs[3] = bottom[(idx+1)&3];
    return cs;
}

ll rotate(ll tile) {
    ll next = tile / 1000;
    next += (tile%1000) * 1e9;
    return next;
}

const int MAX = 410;

int N;
map<ll, int> tiles;
ll C[MAX];

int main() {
    cin >> N;
    REP (k, N) {
        vi t(4);
        REP (i, 4) cin >> t[i];
        ll val = getVal(t);
        tiles[val] += 1;
        C[k] = val;
    }

    ll ans = 0;
    int count = 0;
    REP (idxT, N) {
        ll top = C[idxT];
        tiles[top] -= 1;
        vi vecT = getVector(top);
        reverse(vecT.begin(), vecT.end());
        for (int idxB = idxT+1; idxB < N; idxB++) {
            ll bottom = C[idxB];
            tiles[bottom] -= 1;

            REP (n, 4) {
                vi vecB = getVector(bottom);

                ll tmp = 1;
                vi ts(4);

                REP (idx, 4) {
                    vi side = getVector(vecT, vecB, idx);
                    ll v = getVal(side);
                    tmp *= tiles[v];
                    if (side[0] == side[2] && side[1] == side[3]) {
                        tmp *= 2;
                        if (side[0] == side[1]) tmp *= 2;
                    }
                    tiles[v] -= 1;
                    ts[idx] = v;
                }
                ans += tmp;
                REP (idx, 4) tiles[ts[idx]] += 1;

                bottom = rotate(bottom);
            }

            tiles[bottom] += 1;
        }
    }

    cout << ans << endl;
}

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


int main() {
	long long N;
	cin >> N;
	long long minimum;
	for(int i = 0; i < 5; i++){
		long long a;
		cin >> a;
		if(i == 0){
			minimum = a;
		}
		else{
			minimum = min(minimum, a);
		}
	}
	long long ans = 4;
	if(N % minimum == 0){
		ans += N / minimum;
	}
	else{
		ans += N / minimum + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
H = list(map(int, input().split()))

if n == 1:
    print("Yes")
else:
    flag = True
    for i in range(n-2, -1, -1):
        if H[i] <= H[i+1]:
            continue
        elif H[i] == H[i+1] + 1:
            H[i] = H[i] - 1
        else:
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 14252
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    int n, p;
    cin >> n >> p;
    int a[n];
    rep(i, n)cin >> a[i];
    ll odd, even;
    odd = even = 0;
    rep(i, n){
          if(a[i]&1){
              ll tmp = odd;
              tmp += even+1, even += odd;
              odd = tmp;
          }
          else {
              even += even+1, odd += odd;
          }
    }
    if(p&1)cout << odd << endl;
    else cout << even+1 << endl;
}

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

int main() {
  int n;
  string k;
  cin >> n;
  
  set<string> S;

  for (int i = 0; i < n; i++) {
    cin >> k;
    S.insert(k);
  }
  cout << S.size() << endl;

}

Measured memory_bytes: 19112
#include <stdio.h>
#include<math.h>

double abso(double n){
	if(n<0)n*=(-1);
	return n;
}

double dis(double xa,double ya,double xb,double yb){
	if(xa==xb){
		return abso(ya-yb);
	}else{
		return sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
	}
}

int main(void) {
	int n,i;
	double xa,ya,ra,xb,yb,rb;
	
	scanf("%d",&n);
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
		if(ra+rb<dis(xa,ya,xb,yb)){
			puts("0");
		}else{
			if(ra>rb){
				if(ra-rb>dis(xa,ya,xb,yb)){
					puts("2");
				}else{
					puts("1");
				}
			}else if(ra<rb){
				if(rb-ra>dis(xa,ya,xb,yb)){
					puts("-2");
				}else{
					puts("1");
				}
			}else if(ra==rb){
				puts("1");
			}
		}
	}
	return 0;
}

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

using namespace std;

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

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

  vector<int> card(N);
  rep(i,N){
    cin >> card.at(i);
  }

  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());

  int Alice=0;
  int Bob=0;
  rep(i,N){
    if(!(i%2)){
      Alice += card.at(i);
    }
    else{
      Bob += card.at(i);
    }
  }

  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256