akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
v = list(map(int, input().split()))

i = 0
ans = 0

for number in range(min(n+1, k+1)):
    for i in range(number+1):
        right = n - number + i
        vv = v[:i] + v[right:]

        vv.sort()
        tmp_ans = sum(vv)
        qb = min(k - number, len(vv))
        #print(vv, qb)
        for j in range(qb):
            if vv[j] < 0:
                tmp_ans -= vv[j]
            else:
                break

        ans = max(ans, tmp_ans)

print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int fibo[45];

int kansuu(int n){

  if(n==0||n==1) return fibo[n]=1;
  else if(fibo[n]!=-1) return fibo[n];
  else return fibo[n]=kansuu(n-1)+kansuu(n-2);

}

int main(){

  int n, i;
  for(i=0;i<45;i++) fibo[i]=-1;

  scanf("%d", &n);

  if(n==0||n==1) printf("1\n");
  else{
  printf("%d\n",kansuu(n));
  }
  
  return 0;
}
  
  



Measured memory_bytes: 2052
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	ull n;
	cin >> n;
	ull a[n];
	for(ull i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n, greater<ull>());
	ull g1=0, g2=0;
	for(ull i=0; i<n; i++){
		if(a[i]==a[i+1]){
			if(g1==0) g1=a[i];
			else{
				g2=a[i];
				cout << g1*g2 << endl;
				return 0;
			}
			i++;
		}
	}
	cout << g1*g2 << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if (a + b == c || a + c == b || b + c == a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,X;
    cin >> X >> A;
    if(X<A){
        cout <<"0"<< "\n";
    }else{
        cout <<"10"<< "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int A,B;cin>>A>>B;
  int a=A-1;
  int b=B-1;
  string f[101][101];
  cout<<"100 100"<<"\n";
  // 埋める
  for(int i=1;i<=50;i++){
    for(int j=1;j<=100;j++){
      f[i][j]='#';
    }
  }
  for(int i=51;i<=100;i++){
    for(int j=1;j<=100;j++){
      f[i][j]='.';
    }
  }
  if(a>0){
    for(int k=1;k<=a;k++){
      int i=2*(k/50) + 1;
      int j=k%50;
      f[i][2*j-1]='.';
    }
  }
  if(b>0){
    for(int k=1;k<=b;k++){
      int i=2*(k/50) + 52;
      int j=k%50;
      f[i][2*j-1]='#';
    }
  }
  // f[1][1]='.';
  // f[1][2]='.';
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      cout<<f[i][j];
    }
    cout<<"\n";
  }
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 1LL << 40
#define INF 2000000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define prique priority_queue
#define double float
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
struct edge {
    int to, cost;
};

int dp[101][10010];

int main() {
    int n, weight;
    cin >> n >> weight;
    vi v(n), w(n);
    rep(i, n) cin >> v[i] >> w[i];
    rep(i, weight + 1) dp[0][i] = 0;
    rep(i, n) {
        rep(j, weight + 1) {
            if(j - w[i] >= 0) {
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            } else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }
    cout << dp[n][weight] << endl;
}



Measured memory_bytes: 7064
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[4];
    rep(i,1){
        cin >> A[i];
    }
    char S[1000];
    cin >> S;
    //sort(A,A+3);
    cout << (A[0]>=3200 ? S : "red") << endl;
}

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

signed main(){
    int n; cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a.at(i);
        a.at(i)-=i+1;
    }
    sort(a.begin(),a.end());
    int b=(n%2==0?round((a.at(n/2)+a.at(n/2-1))/2.0):a.at((n-1)/2));
    int sum=0;
    for(int i=0; i<n; i++) sum+=abs(a.at(i)-b);
    cout<<sum<<endl;
}

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

int main(){
	int n;
	char str[300002];

	int e=0,w=0;

	int ans = 8641919;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>str[i];
		if(str[i]=='E')e++;
	}

	for(int i=0;i<n;i++){
		if(str[i]=='E')e--;
		ans = min(ans,e+w);
		if(str[i]=='W')w++;
	}

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

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long int ll;
int main(){
  ll n;
  cin >>n;
  ll a[n],sum=0;
  for(ll i=0;i<n;i++) {
    cin >>a[i];
    if(i!=0)sum+=(abs(a[i]-a[i-1]));
    else sum+=abs(a[i]);
  }
  sum+=abs(a[n-1]);
  for(ll i=0;i<n;i++){
     ll ans=sum;
    if(i!=0&&i!=n-1) {
      ans-=(abs(a[i+1]-a[i])+abs(a[i]-a[i-1]));
      ans+=(abs(a[i+1]-a[i-1]));
      cout <<ans<<endl;
    }
    else if(i==0){
      ans-=(abs(a[i])+abs(a[i+1]-a[i]));
      ans+=abs(a[i+1]);
      cout <<ans<<endl;
    }
    else{
      ans-=(abs(a[i])+abs(a[i]-a[i-1]));
      ans+=abs(a[i-1]);
      cout <<ans<<endl;
    }
  }
}


Measured memory_bytes: 2048
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  Cout((n + 1) / 2);
  return 0;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll s, result = 0;
  rep(i, 10) {
    cin >> s;
    result += s;
  }
  cout << result << endl;
	return 0;
}


Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		int min = a;
		int len = b;
		if(a>b){
			min = b;
			len = a;
		}
		String s = "";
		for(int i=0;i<len;i++){
			s = s + min;
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 23764
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(s...)  fprintf(stderr, s)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
int H, W;
char F[555][555];


int main() {

    scanf("%d%d", &H, &W);
    REP (i, H) scanf("%s", F[i]);

    REP (i, H) {
	REP (j, W) {
	    if (F[i][j] == '#' || j == 0 || (j != W-1 && i % 2 == 0)) putchar('#');
	    else putchar('.');
	}
	putchar('\n');
    }
    putchar('\n');

    REP (i, H) {
	REP (j, W) {
	    if (F[i][j] == '#' || j == W-1 || (j != 0 && i % 2 == 1)) putchar('#');
	    else putchar('.');
	}
	putchar('\n');
    }


    return 0;
}



Measured memory_bytes: 1024
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        Console.WriteLine(inpt.Where(a => inpt.Count(b => b == a) == 1).First());
    
    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"

3 5 5

";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 13396
#include<iostream>
#define ll long long int
using namespace std;
int main(){
  	ios_base::sync_with_stdio(false);cin.tie(NULL);
	string s;cin>>s;
  	if(s[2]==s[3]&&s[4]==s[5]){
    	cout<<"Yes";
    }else{
    	cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
let judge w h x y r =
  if x + r <= w && y + r <= h && x - r >= 0 && y - r >= 0 then "Yes"
  else "No"

let () =
  Scanf.scanf "%d %d %d %d %d\n" (
    fun w h x y r ->
    Printf.printf "%s\n" (judge w h x y r)
  );;



Measured memory_bytes: 2308
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int isOk(string s, int N){
    int ok = 1;
    char c = s[0];
    rep(i,0,N) if(s[i]!=c) ok=0;
    return ok;
}
int main(){
  int a,b,c;    cin>>a>>b>>c;
  string ans = "NO";
  for(int i=0 ; i<=100 ; i++){
    if(a*i%b==c) ans="YES";
  }
  cout<<ans<<endl;
  return 0;
}   

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  vector<int> dmod(200000,0);
  rep(i,200000){
    if(i == 0) dmod[0] = 1;
    if(i > 0) dmod[i] = (dmod[i-1]*10)%2019;
  }
  string s;
  cin >> s;
  reverse(s);
  int n = s.size();
  vector<int> smod(n);
  rep(i,n){
    if(i == 0) smod[0] = (s[i]-'0')*dmod[0];
    if(i > 0){
      smod[i] = smod[i-1] + (s[i]-'0')*dmod[i];
      smod[i] %= 2019;
    }
  }
  smod.push_back(0);
  int ans = 0;
  rep(i,2019){
    int m = count(smod.begin(),smod.end(),i);
    ans += m*(m-1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6032
n = int(input())
l = []
for i in range(n):
    data = input()
    l.append(data)

ans=0
import re
b_st=0
a_en=0
b_a=0

for tmp in l:
    res = re.findall('AB', tmp)
    ans += len(res)

    a_flg=False
    b_flg=False
    if tmp[0] == "B":
        b_flg=True
    if tmp[-1] == "A":
        a_flg=True

    if b_flg and a_flg:
        b_a+=1
    elif b_flg:
        b_st+=1
    elif a_flg:
        a_en+=1

ans+=min(a_en,b_st)
a_en -= min(a_en,b_st)
b_st -= min(a_en,b_st)

if b_a == 0:
    print(ans)
    exit()
ans+=b_a-1
if a_en != 0 or b_st!= 0:
    print(ans+1)
else:
    print(ans)

Measured memory_bytes: 46168
#include<bits/stdc++.h>
using namespace std;
int main() 
{

int A,B,x,y,z,i,j;
cin>>A>>B;
x=A+B;
y=A-B;
z=A*B;
i=max(x,y);
j=max(y,z);
cout<<max(i,j)<<endl;

return 0;
}

Measured memory_bytes: 3636
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
H = iil()
d = {}
for i in range(m):
    a,b = iim()
    d[a] = max(d.get(a,0),H[b-1])
    d[b] = max(d.get(b,0),H[a-1])
ans = 0
for i,item in enumerate(H):
    if item > d.get(i+1,0):
        ans += 1
print(ans)

Measured memory_bytes: 20156
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

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

typedef long long ll;

const int kMaxN = 100000;
const int kMaxM = 200000;

struct Edge { int to, d; };

int N, M;
int L[kMaxM], R[kMaxM], D[kMaxM];
string ans;

bool used[kMaxN];
int x[kMaxN];
vector<Edge> es[kMaxN];

bool Bfs(int i) {
  if (used[i]) { return true; }

  queue<int> q;
  used[i] = true;
  x[i] = 0;
  q.push(i);
  while (!q.empty()) {
    int j = q.front(); q.pop();
    REP(k, es[j].size()) {
      Edge e = es[j][k];
      if (!used[e.to]) {
        used[e.to] = true;
        x[e.to] = x[j] + e.d;
        q.push(e.to);
      } else {
        if (x[e.to] != x[j] + e.d) { return false; }
      }
    }
  }
  return true;
}

int main() {
  cin >> N >> M;
  REP(i, M) { cin >> L[i] >> R[i] >> D[i]; }
  REP(i, M) {
    --L[i];
    --R[i];
  }

  REP(i, M) {
    Edge e1 = {R[i], D[i]};
    es[L[i]].push_back(e1);
    Edge e2 = {L[i], -D[i]};
    es[R[i]].push_back(e2);
  }

  bool f = true;
  REP(i, N) {
    f = Bfs(i);
    if (!f) { break; }
  }
  if (f) {
    ans = "Yes";
  } else {
    ans = "No";
  }

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


Measured memory_bytes: 11776
#include <cstdio>
#include <vector>

#define REDIRECT(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout);
#define CLOSEALL() fclose(stdin), fclose(stdout)

using namespace std;

template <class T>
T emplaceMin(T & x, const T & y)
{
	if(x > y)
		x = y;
	return x;
}

const int MAXN = 2000 + 5;

vector<int> Adj[MAXN];
int dep[MAXN];
int N, K;
int ans (0x7F7F7F7F);

void DFS(int cur, int fa, int deep)
{
	dep[cur] = deep;
	for(vector<int>::iterator itr = Adj[cur].begin(); itr != Adj[cur].end(); ++itr)
		if(*itr != fa)
			DFS(*itr, cur, deep + 1);
}

int main()
{
	//REDIRECT("shorten");

	int u, v;

	scanf("%d%d", &N, &K);
	for (int i = 1; i < N; i++)
		scanf("%d%d", &u, &v), Adj[u].push_back(v), Adj[v].push_back(u);

	if((K & 1) == 0)			// If K is even then the tree can be halved
		for(int i = 1; i <= N; i++)
		{
			int nans = 0;
			DFS(i, 0, 0);
			for(int k = 1; k <= N; k++)
				nans += (dep[k] > (K / 2));
			emplaceMin(ans, nans);
		}
	else						// If K is odd things will be complicated
		for(int i = 1; i <= N; i++)					// Raise two nodes as one root, then the tree can be halved
			for(vector<int>::iterator itr = Adj[i].begin(); itr != Adj[i].end(); ++itr)
			{
				int nans = 0;
				DFS(i, *itr, 0);
				DFS(*itr, i, 0);
				for(int k = 1; k <= N; k++)
					nans += (dep[k] > (K / 2));
				emplaceMin(ans, nans);
			}

	printf("%d\n", ans);

	CLOSEALL();
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n,y;
    cin >> n >> y;
    y /= 1000;
    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= n;j++){
            if(10*i + 5*j + (n-i-j) == y && n-i-j>=0){
                cout << i << " " << j << " " << n-i-j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>

int main()
{
	double x1,y1,x2,y2,xq,yq,xr,yr,m,n;
	for(;~scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq);)
	{
		if(x2==x1)
			printf("%f %f\n",2*x1-xq,yq);
		else if(y2==y1)
			printf("%f %f\n",xq,2*y1-yq);
		else
		{
			x2-=x1;y2-=y1;xq-=x1;yq-=y1;
			m=y2/x2;
			n=1/(1+m*m);
			xr=n*(1-m*m)*xq+2*m*n*yq+x1;
			yr=n*2*m*xq+n*(m*m-1)*yq+y1;
			printf("%f %f\n",xr,yr);
		}
	}
	return 0;
}

Measured memory_bytes: 648
import java.io.*;// 从这行开始复制，这是第一行
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String t = sc.next();
        String s=t.replace("?","D");
        System.out.println(s);
    }
}

Measured memory_bytes: 41316
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    char str[n+1];
    scanf("%s", str);
    int flag = 1;
    if(n%2 != 0){
        flag = 0;
    }
    else{
        for(int i = 0, j=n/2;  i<n/2; i++, j++){
            if(str[i] != str[j]){
                flag = 0;
                break;
            }
        }
    }
    
    flag ? printf("Yes\n") : printf("No\n");
    
    return 0;
}

Measured memory_bytes: 1640
#include<iostream>
#include<string>
#include<algorithm>

int const MAXNL = 1e6;
int const INF = 1e8;

int dpo[MAXNL+1], dpu[MAXNL+1];

int main() {
  std::string N; std::cin >> N;
  int l = N.size();
  std::fill_n(dpo, l+1, INF);
  std::fill_n(dpu, l+1, INF);
  dpu[0] = 0;
  dpo[0] = 1;
  for(int i = 0; i < l; ++i) {
    int d = N[i] - '0';
    if(dpu[i] < INF) {
      dpu[i+1] = dpu[i] + d;
      if(d < 9) dpo[i+1] = dpu[i] + d+1;
    }
    if(dpo[i] < INF) {
      d = 10 - d;
      dpu[i+1] = std::min(dpu[i+1], dpo[i]+d);
      if(d > 0) dpo[i+1] = std::min(dpo[i+1], dpo[i]+d-1);
    }
  }
  std::cout << dpu[l] << std::endl;
  return 0;
}


Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
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; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
int main(){

    ll a;
    double b;
    cin >> a >> b;
    ll c=b*100+0.01;
    cout << a*c/100 << endl; 
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef long long ll;

int main(){
    int n; cin>>n;
    vector<bool> v(n);
    rep(i,n){
        int a,b; cin>>a>>b;
        v[i] = (a==b);
    }
    for(int i=2;i<n;i++){
        if(v[i]==1&&v[i-1]==1&&v[i-2]==1){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long int
#define p pair<ll,ll>
#define pp pair<pair<ll,ll>,ll>
#define fi first
#define se second
#define opti ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll N = 1e6+6;
ll t,i,j,k,n,m,q;
int main()
{
    opti
    string s;
    cin>>s;
    string s1="0",s2="1";
    for(ll i=1;i<s.size();i++){
        if(s1[i-1] == '0'){
            s1.push_back('1');
        }
        else{
            s1.push_back('0');
        }
        if(s2[i-1] == '0'){
            s2.push_back('1');
        }
        else{
            s2.push_back('0');
        }
    }
    ll cunt1=0;
    ll cunt2=0;
    //cout<<s1<<" "<<s2<<endl;
    for(ll i=0;i<s.size();i++){
        if(s[i]!=s1[i]){
            cunt1++;
        }
        if(s[i]!=s2[i]){
            cunt2++;
        }
    }
     cout<<min(cunt1,cunt2)<<endl;
    return 0;
}


Measured memory_bytes: 720
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	cout << 0 << endl;
	return 0;
	int N; cin >> N;
	vector<int> r(N);
	for (int i = 0; i < N; i++)
		cin >> r[i];
	sort(r.begin(), r.end());
	double ma = 0;
	for (int n = 3; n <= N; n++) {
		vector<int> a(r.end() - n, r.end());
		do {
			vector<double> x(n), y(n);
			for (int i = 0; i < n; i++) {
				x[i] = a[i] * cos(M_PI*2 / n * i);
				y[i] = a[i] * sin(M_PI*2 / n * i);
			}
			for (int t = 0; t < 0; t++) {
				int i = rand() % n;
				int j = (i + n - 1) % n, k = (i + 1) % n;
				double dx = x[k] - x[j], dy = y[k] - y[j];
				double _dx = dy, _dy = -dx;
				double r = sqrt(_dx * _dx + _dy * _dy);
				x[i] = _dx / r * a[i];
				y[i] = _dy / r * a[i];
			}
			double sum = 0;
			for (int i = 0; i < n; i++) {
				int j = (i + 1) % n;
				sum += x[i] * y[j] - y[i] * x[j];
			}
			ma = max(ma, sum);
		} while (next_permutation(a.begin() + 1, a.end()));
	}
	printf("%.15f\n", ma / 2);
}

Measured memory_bytes: 3112
from math import ceil
from bisect import bisect_right
n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
imos=[0]*(n+1)
x=[]
for i in range(n):
  x.append(xh[i][0])
ans,cnt=0,0
for i in range(n):
  cnt+=imos[i]
  hp=xh[i][1]-cnt*a
  if hp>0:
    cnt+=ceil(hp/a)
    ans+=ceil(hp/a)
    imos[bisect_right(x,x[i]+2*d)]-=ceil(hp/a)
print(ans)


Measured memory_bytes: 62100
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
int n,m;
int L,R,M,ans;
int base[200000];
bool B[200000];
/*---define function---*/

bool check(int x)
{
	for(int i=1;i<m;++i)
	{
		B[i]=(base[i]>=x?1:0);
	}
	for(int i=n-1;i>0;i--)
	{
		if((B[i]!=B[n])&&(B[m-i]!=B[n])) 
		{
			B[n]=!B[n];
		}
		else
		{
			return B[n];
		}
	}
	return B[n];
}

/*---main code---*/
int main()
{
	FIO;
	cin>>n;
	m=2*n;
	for(int i=1;i<m;++i)
	{
		cin>>base[i];
	}
	L=1,R=m-1;
	while(L<=R)
	{
		M=(L+R)>>1;
//		cout<<L<<' '<<R<<' '<<M<<'\n';
		if(check(M))
		{
			L=M+1;
			ans=M;
		}
		else
		{
			R=M-1;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll mod = 1000000007;

int p[200002];
int r[200002];


long long ruijo(long long x,ll n){
	long long p,ans;
	if(n==0)return 1;
	if(n==1)return x;
	if(n%2){
		p = ruijo(x,n/2);
		ans = (x*p)%mod;
		ans = (ans*p)%mod;
		return ans;
	}else{
		p = ruijo(x,n/2);
		ans = (p*p)%mod;
		return ans;       
    }
}
void init(int n){
    for (int i = 0; i < n; ++i) {
        p[i]=i;
        r[i]=0;
    }
}


int find(int x){
	if(x != p[x]){
		p[x] = find(p[x]);
    }
   	return p[x];
}
     
void union_set(int x,int y){
	x = find(x);
	y = find(y);
	if(x==y) return;
	if(r[x] < r[y]){
		p[x] = y;	
	}else{
		p[y] = x;
		if(r[x] == r[y])r[x]++;
	}
	return ;
}



int main(){
    int n;
    ll x,y;
    cin >> n >> x >> y;
    init(n);
    ll kai[200020];
    kai[0] = 1;
    kai[1] = 1;
    for(ll i=2;i<=200000;i++){
        kai[i] = (i*kai[i-1])%mod;
    }
    vector<vector<int> > v(n);
    vector<pair<int,int> > p;
    for(int i=0;i<n;i++){
        int c;
        ll w;
        cin >> c >> w;
        c--;
        v[c].PB(w);
        p.PB(MP(w,c));
    }
    sort(p.begin(),p.end());
    int c1,c2=-1;
    ll d1,d2;
    c1 = p[0].second;
    d1 = p[0].first;
    for(int i=1;i<n;i++){
        if(p[i].second!=c1){
            c2 = p[i].second;
            d2 = p[i].first;
            break;
        }
    }
    if(c2==-1){
        cout << 1 << endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        if(v[i].size()!=0){
            sort(v[i].begin(),v[i].end());
        }
    }
    vector<int> ss(n);
    vector<int> cc(n);
    int z = 0;
    for(int i=0;i<n;i++){
        int tmp = z;
        for(int j=0;j<v[i].size();j++){
            cc[z] = i;
            if(j==0){
                ss[i] = z;
                z++;
            }else{
                if(v[i][0]+v[i][j]<=x)union_set(tmp,z);
                z++;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(i!=c1){
            for(int j=0;j<v[i].size();j++){
                if(d1+v[i][j]<=y){
                    union_set(ss[c1],ss[i]+j);
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        if(i!=c2){
            for(int j=0;j<v[i].size();j++){
                if(d2+v[i][j]<=y){
                    union_set(ss[c2],ss[i]+j);
                }
            }
        }
    }
    vector<ll> pp(n);
    ll s=0;
    for(int i=0;i<n;i++){
        if(find(i)==find(ss[c1])){
            pp[cc[i]]++;
            s++;
        }
    }
    ll inv = 1;
    for(int i=0;i<n;i++){
        inv = (inv*kai[pp[i]])%mod;
    }
    ll ans = (kai[s]*ruijo(inv,mod-2) )%mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17136
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int n, m;
    scan(n, m);
    writeln(n == m ? "Yes" : "No");
}
















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
def solve(n, A, q, m):
    memo = dict()
    for i in range(2**n):
        tmp = 0
        for j in range(n):
            if i >> j & 1:
                tmp += A[j]
        memo[tmp] = 1

    for val in m:
        print("yes" if val in memo else "no")

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



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

public class Main {

	public static void main(String[] args) throws IOException {

		int[][] trump = new int [4][13];
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		for (int i =0; i < n; i++) {
			String[] info = br.readLine().split(" ");
			int num = Integer.parseInt(info[1]);

			if ("S".equals(info[0])) {
				trump[0][num-1] = 1;
			} else if ("H".equals(info[0])) {
				trump[1][num-1] = 1;
			} else if ("C".equals(info[0])) {
				trump[2][num-1] = 1;
			} else if ("D".equals(info[0])) {
				trump[3][num-1] = 1;
			}
		}

		String blank = " ";
		for (int i = 0; i< trump.length; i++) {
			for (int j = 0; j < trump[0].length; j++) {
				if (trump[i][j] == 0) {
					if (i == 0) {
						System.out.println("S" + blank + (j + 1));
					} else if (i == 1) {
						System.out.println("H" + blank + (j + 1));
					} else if (i == 2) {
						System.out.println("C" + blank + (j + 1));
					} else {
						System.out.println("D" + blank + (j + 1));
					}
				}
			}
		}
	}
}

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

int main(void){

  int a,b,c;
  int e=0,t=0,d=0;
  int s=0;


  while(1){
  scanf("%d %d %d" ,&a ,&b ,&c);

  if( (fabs(a-b) < c && a + b > c)){

    s++;

   
    if((a*a + b*b < c*c)||(a*a + c*c < b*b) ||(b*b + c*c < a*a) ) d++;
    else  if((a*a + b*b == c*c) ||( a*a + c*c == b*b) || (b*b + c*c == a*a) ) t++;
    else if((a*a + b*b > c*c) ||(a*a + c*c > b*b) ||(b*b + c*c > a*a)) e++;
  }

  else break;

  }

  printf("%d %d %d %d\n" ,s ,t ,e ,d);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,X,T;
    cin >> N >> X >> T;
    
    int A;
    int ans;
    A=N/X;
    if(N%X!=0) {
        A++;
    }
    ans =A*T;
    cout << ans << endl;
}

Measured memory_bytes: 3628
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n;
	cin >> n;
	Vec t(n), a(n);
	rep(i, n) cin >> t[i] >> a[i];

	ll x = t[0], y = a[0];
	rep(i, n){
		if(!i) continue;
		if(x%t[i]) x += t[i]-x%t[i];
		if(y%a[i]) y += a[i]-y%a[i];
		if(x/t[i] > y/a[i]) y = x/t[i]*a[i];
		else if(x/t[i] < y/a[i]) x = y/a[i]*t[i];
	}
	co(x+y);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
	#define test int tt; cin>>tt; while(tt--)
	#define ll long long
	#define vi vector<int>
	#define pb push_back
	#define F first
	#define S second
	#define mod 1000000007
	#define all(v) v.begin(), v.end()
	#define allr(v) v.rbegin(), v.rend()
	#define deb(x,y) cout<< #x << "=" <<x <<","<<#y<<"="<<endl; 
	const int N = 2e5+5;
	const ll MAX = 1e9 +7;
	 
	int main()
	{
		//test{
		int n;
		cin>>n;
		
		ll a[n],b[n];
		for(int i=0;i<n; i++)
		{
			cin>>a[i];
		}
		for(int i=0;i<n; i++)
		{
			cin>>b[i];
		}
		priority_queue< pair<ll,ll> >pq;
		
		for(int i=0;i<n; i++)
		{
			if(b[i]>=a[i])
			pq.push({b[i],i});
			else if(b[i]<a[i])
			return cout<<"-1",0;
		}
		
		int ind;
		ll val,ans=0,z=0;
		int pre = -1;
		while(!pq.empty())
		{
			 auto it = pq.top();
			  pq.pop();
			 
			 val = it.F;
			 ind = it.S;
			 
			 if(pre == ind)
			 {
				 cout<<"-1\n";
				 return 0;
			}
			pre = ind;
		 
			 z = (val-a[ind])/(b[(ind-1+n)%n]+b[(ind+1)%n]);
			 ans += z;
			 b[ind] -= (b[(ind-1+n)%n]+b[(ind+1)%n]) * z;

			 if(b[ind] < a[ind])
			 {
				 cout<<"-1\n";
				 return 0;
			}
			 
			 if(b[ind]>a[ind])
			 pq.push({b[ind],ind});
		}
		cout<<ans<<"\n";
	//}
		return 0;		
	}
			


Measured memory_bytes: 9584
// Problem : C - Maximum Volume
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << " | ";
	err(++it, args...);
}

const ll inf = 1e18;
const int nax = 1e5 + 5;

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		double x;
		cin>>x;
		
		double ans = (x/3.0)*(x/3.0)*(x/3.0);
		cout<<fixed<<setprecision(9)<<ans;
	}

	return 0;
}


Measured memory_bytes: 256
using System;

public class Test
{
	public static void Main()
	{
		while (true)
		{
			var s = Console.ReadLine();
			if (string.IsNullOrEmpty(s))
			{
				return;
			}
			int n = int.Parse(s);
			Console.WriteLine((1 + n) * n / 2 + 1);
		}
	}
}

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

int minimumcost(int n,vector<int>&v)
{
    vector<int>dp(n,0);
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);

    for(int i=2;i<n;i++)
    {
        dp[i] = min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
    }
    return dp[n-1];
}

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

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

	cout<<minimumcost(n,v);
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt(), k = in.nextInt();
		int[] a=new int[n];
		for (int i=0;i<n;++i) a[i]=in.nextInt();
		int[] dp = new int[n];
		for (int i=1;i<n;++i) {
                    dp[i] = dp[i-1] + Math.abs(a[i] - a[i-1]);
                    for(int j = 2; j <=k; j++) {
                        if(i - j < 0) {
                            break;
                     }
                    dp[i] = Math.min(dp[i], dp[i-j] + Math.abs(a[i] - a[i-j]));
               }
        }
	System.out.println(dp[n-1]);
	}
}


Measured memory_bytes: 50304
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();

		if((x < a) || ((a+b) < x))
			System.out.println("NO");
		else
			System.out.println("YES");
	}
}


Measured memory_bytes: 23764
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn solve(s: &mut [usize], fs: &Vec<Vec<usize>>, ps: &Vec<Vec<i64>>, i: usize) -> i64 {
    if i == s.len() {
        let mut p = 0;
        for n in 0..fs.len() {
            let mut cnt = 0;
            for j in 0..fs[n].len() {
                if fs[n][j] == 1 && s[j] == 1 { cnt+= 1 }
            }
            p += ps[n][cnt];
        }
        return p;
    }

    s[i] = 0;
    if i == s.len()-1 && s.iter().fold(0, |sum, i| sum + i) == 0 {
        s[i] = 1;
    }
    let a1 = solve(s, fs, ps, i+1);
    s[i] = 1;
    let a2 = solve(s, fs, ps, i+1);
    return max(a1, a2)
}


fn main() {
    input!{
      n: usize,
      fs: [[usize; 10]; n],
      ps: [[i64; 11]; n],
    }

    let mut s = vec![0; 10];
    let ans = solve(&mut s, &fs, &ps, 0);
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 998244353;
using mint = Fp<MOD>;
mint dp[3001][3001];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,s,A[3001];
    cin>>n>>s;
    rep(i,n) cin>>A[i];
    mint a=1;
    rep(i,n) a*=2;
    dp[0][0]=a;
    rep(i,n)rep(j,s+1){
        if(j-A[i]>=0) dp[i+1][j]=dp[i][j]+dp[i][j-A[i]]/2;
        else dp[i+1][j]=dp[i][j];
    }
    cout<<dp[n][s];
}

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

int main(){
  int n, i;
  string s;
  cin >> n;
  
  for(i=0; i < n; i++){
    cin >> s;
    if(s == "Y"){
      cout << "Four" << endl;
      break;
    }
  }
  if(i == n) cout << "Three" << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;

#define INF (1<<30)
typedef pair< int , int > P;
struct Edge { int to,cost; };
vector< vector< Edge > > Graph;

void Dijkstra(int s,int g) {
  vector< int > min_cost(Graph.size(),INF);
  priority_queue < P ,vector< P >,greater< P > > que;
  que.push(P(0,s));
  min_cost[s] = 0;
  while(!que.empty()){
    int cost = que.top().first;
    int now = que.top().second;
    que.pop();
    //if(now == g) return cost;
    if(cost > min_cost[now]) continue;
    for(int i=0;i<Graph[now].size();i++){
      Edge e = Graph[now][i];
      if(cost + e.cost < min_cost[e.to]){
	min_cost[e.to] = cost + e.cost;
	que.push(P(min_cost[e.to],e.to));
      }
    }
  }
  for(int i=0;i<g;i++){
    if(min_cost[i] == INF) cout << "INF" << endl;
    else cout << min_cost[i] << endl;
  }
  //return (-1);
}

int main(){
  int V,E,r;
  cin >> V >> E >> r;
  Graph.resize(V);
  for(int i=0;i<E;i++){
    int a,b,c;
    cin >> a >> b >> c;
    Edge e; e.to = b; e.cost = c;
    Graph[a].push_back(e);
    //e.to = a;
    //Graph[b].push_back(e);
  }
  Dijkstra(r,V);
}

Measured memory_bytes: 11236
n,m = map(int,input().split())
x = list(map(int,input().split()))

if n>=m:
    print(0)
else:
    x.sort()
    dis = []
    for i in range(m-1):
        dis.append(x[i+1]-x[i])
    dis.sort()

    ans = 0
    for i in range(m-n):
        ans += dis[i]
    print(ans)

Measured memory_bytes: 13960
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, n) for(long i = x; i < n; i++)
#define erep(i, x, n) for(long i = x; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define show(ans)  cout << ans << endl;

long a[2][101];
int main() {long N;
cin >> N; long ans = 0;
erep(i, 1, 2){
    erep(j, 1, N){
        cin >> a[i][j];
    }
}
erep(i, 1, N){
    a[1][i] += a[1][i-1];
}
for(long i = N; i > 1; i--){
    a[2][i-1] += a[2][i];
}
erep(i, 1, N){
    ans = max(ans, a[1][i]+a[2][i]);
}
show(ans);

  return 0;
 
}



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

int main() {
  int N, K;
  cin >> N >> K;
  int p[N];
  for(int i=0; i<N; i++){
    cin >> p[i];
  }
  sort(p, p+N);
  int ans = 0;
  for(int i=0; i<K; i++){
    ans += p[i];
  }
  cout << ans;
}

Measured memory_bytes: 3600