akhauriyash/Code-Regression huggingface dataset:
from itertools import combinations_with_replacement

n,m,q = map(int,input().split())
A_lists = [list(map(int,input().split())) for _ in range(q)]

A_max = 0

for conbi in combinations_with_replacement(range(1,m+1), n):
    tmp = 0

    for A_list in A_lists:
        if conbi[A_list[1]-1] - conbi[A_list[0]-1] == A_list[2]:
            tmp += A_list[3]

    A_max = max(A_max, tmp)

print(A_max)

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

int main() {
    int r, g, b;
    cin >> r >> g >> b;
	if ((r*100 + g*10 + b) % 4 == 0){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<int, lli> il;
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;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
#define int long long int
signed main() {
	int N; lli W;
	scanf("%lld %lld", &N, &W);
	lli v[4][109];
	SET_ZERO(v);
	int w1; int v1;
	scanf("%lld %lld", &w1, &v1);
	v[0][1] = v1;
	for (int i = 2; i <= N; i++) {
		int iw, iv;
		scanf("%lld %lld", &iw, &iv);
		v[iw-w1][i] = iv;
		eprintf("init v[%lld][%lld] = %lld\n", iw-w1, i, v[iw-w1][i]);
	}
	
	for (int i = 0; i < 4; i++) {
		sort(&v[i][1], &v[i][1]+N, greater<int>() );
		for (int j = 0; j <= N; j++) {
			eprintf("show v[%lld][%lld] = %lld\n", i, j, v[i][j]);
		}
		for (int j = 2; j <= N; j++) {
			v[i][j] += v[i][j-1];
			eprintf("v[%lld][%lld] = %lld\n", i, j, v[i][j]);
		}
	}	

	lli ans = 0;
	for (int  a = 0; a <= N; a++) {
		for (int b = 0; b <= N-a; b++) {
			for (int  c = 0; c <= N-a-b; c++) {
				for (int  d = 0; d <= N-a-b-c; d++) {
					if (a*w1 + b*(w1+1) + c*(w1+2) + d*(w1+3) <= W) 
						chmax<lli>(ans, v[0][a] + v[1][b] + v[2][c] + v[3][d]);
				}
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	s := next()

	m, x := 0, 0
	for i := 0; i < n; i++ {
		switch s[i] {
		case 'I':
			x++
		case 'D':
			x--
		}

		if m < x {
			m = x
		}
	}

	fmt.Println(m)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  string s;
  cin >> s;
  ll n=s.size();
  ll ans=0,sum=0;
  rep(i,n-1){
    if(s[i]=='A')sum++;
    else if(s[i]=='B' && s[i+1]=='C'){
      ans+=sum;
      i++;
    }
    else sum=0;
  }
  cout << ans << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <cassert>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <vector>
#include <set>
#include <fstream>
#include <map>

#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define x first
#define y second

using namespace std;

const int INF = int(2e9) + 7;
const int N = int(1e5) + 11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long n;
    cin >> n;
    long long ans = INF * 1ll * INF;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i) continue;
        long long j = n / i;
        ans = min(ans, i + j - 2);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int a[13], b[25];

ll rec(ll x){
	if(x<0){
		//rep(j, 24) cerr<<b[j]<<" "; cerr<<endl;
		rep(_i, 24){
			int i = _i+1;
			rep(j, 24){
				if(b[j] && b[(j+i)%24]) return i%24;
			}
		}
	}
	if(a[x]==0) return rec(x-1);
	if(a[x]>=2 || x%12==0){
		b[x] = b[24-x] = 1;
		return rec(x-1);
	}
	ll res = 0;
	b[x] = 1;
	res = max(res, rec(x-1));
	b[x] = 0; b[24-x] = 1;
	res = max(res, rec(x-1));
	b[24-x] = 0;
	return res;
}

int main(){
	int n;
	cin>>n;
	rep(i, n){
		int d;
		cin>>d;
		a[d]++;
	}
	a[0]++;
	rep(i, 13){
		if(a[i]>=3 || (i%12==0&&a[i]>=2)){
			cout<<0<<endl;
			return 0;
		}
	}
	cout<<rec(12)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <set>
#include <stack>
#include <bitset>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <string.h>
#include <array>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a[5];
	int ind;
	for(int i=0; i<5; i++){
		cin >> a[i];
		if(a[i]==0){
			ind=i;
		}
	}
	cout << ind+1 << '\n';
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int app() {
  vector<int> dx={1,0,-1,0};
  vector<int> dy={0,1,0,-1};

  int n;
  cin>>n;
  int n2=n*n;

  vector<vector<int>> dp(n,vector<int>(n));
  rep(i,n)rep(j,n){
    dp[i][j]=min(min(i,j),min(n-1-i,n-1-j));
  }

  int ans=0;
  vector<vector<int>> s(n,vector<int>(n,1));
  rep(t_,n2){
    int p;
    cin>>p;
    p--;
    int i=p/n,j=p%n;

    //cout<<dp[i][j]<<endl;
    //rep(i,n){rep(j,n)cout<<dp[i][j];cout<<endl;}
    ans+=dp[i][j];
    s[i][j]=0;

    queue<pair<int,int>> q;
    q.emplace(i,j);
    while(!q.empty()){
      auto u=q.front();
      q.pop();
      int x=u.first;
      int y=u.second;
      rep(k,4){
        int vx=x+dx[k];
        int vy=y+dy[k];
        if(vx<0||vx>=n||vy<0||vy>=n) continue;
        if(chmin(dp[vx][vy],dp[x][y]+s[x][y])){
          q.emplace(vx,vy);
        }
      }
    }

  }

  return ans;
}

int main(){cout<<app()<<endl;return 0;}


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

public class Solution
{
    public static void Main()
    {
        var X = long.Parse(Console.ReadLine());
        long yen = 100;
        for (int i = 1; true; i++)
        {
            yen = (long)(yen * 1.01);
            if (yen >= X)
            {
                Console.WriteLine(i);
                return;
            }
        }
    }
}

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

int n;
int x[24],y[24],r[24],c[24];
bool memo[1<<24];
char bit_count[1<<24];

bool ok(int a,int bit){
    for(int i=0;i<a;i++){
        if(((bit>>i)&1)==0)continue;
        int dist=(x[i]-x[a])*(x[i]-x[a])+(y[i]-y[a])*(y[i]-y[a]);
        int sum=(r[i]+r[a])*(r[i]+r[a]);
        if(dist<sum)return false;
    }
    return true;
}

int dfs(int bit){
    memo[bit]=true;

    int ret=n-bit_count[bit];

    for(int i=0;i<n;i++){
        if(((bit>>i)&1)==0||ok(i,bit)==false)continue;
        for(int j=i+1;j<n;j++){
            if(((bit>>j)&1)==0||ok(j,bit)==false||c[i]!=c[j])continue;
            int to_bit=(bit^(1<<i))^(1<<j);
            if(!memo[to_bit])ret=max(ret,dfs(to_bit));

        }
    }

    return ret;
}

void solve(){
    fill_n(memo,1<<n,false);

    cout<<dfs((1<<n)-1)<<endl;
}

bool input(){
    cin>>n;
    if(!n)return false;
    for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>r[i]>>c[i];
    return true;
}

void init(){
    for(int i=0;i<(1<<24);i++){
        for(int j=0;j<24;j++)if((i>>j)&1){
            bit_count[i]++;
        }
    }
}

int main(){
    init();
    while(input())solve();
    return 0;
}

Measured memory_bytes: 33928
/**
 * ?¨???????

???????????´??° a, b ??¨?????????????????? op ?????????????????§???a op b
????¨??????????????????°?????????????????????????????????????????????????????? op
??????"+"(???)???"-"(???)???"*"(???)???"/"(???)???????????¨?????????????????§????????????????????´??????????°???°?????\??????????????¨????????????????¨????????????¨????????????

Input
??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????

a op b

op ??? '?' ?????¨??? ??\?????????????????????????????????????????±???????????????????????£????????????????????????

Output
?????????????????????????????????????¨??????????????????????????????????????????????

Constraints
0 ??? a, b ??? 20000
0 ?????????????????????????????????????????¨?????????????????????
Sample Input
1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0
Sample Output
3
38
26
10
108

 */

#include <functional>
#include <iostream>
#include <sstream>
#include <unordered_map>

int main(int argc, char const *argv[]) {
  unsigned int a, b;
  a = b = 0;
  std::string op;
  bool IsValid = true;
  const static std::unordered_map<
      std::string, std::function<int(unsigned int, unsigned int)>>
      Functions = {{"+",
                    [](unsigned int a, unsigned int b) -> int {
                      return a + b;
                    }},
                   {"-",
                    [](unsigned int a, unsigned int b) -> int {
                      return a - b;
                    }},
                   {"*",
                    [](unsigned int a, unsigned int b) -> int {
                      return a * b;
                    }},
                   {"/", [](unsigned int a, unsigned int b) -> int {
                      return a / b;
                    }}};

  while (true) {
    while (true) {
      std::string Param;

      getline(std::cin, Param);
      std::istringstream iss(Param);
      iss >> a >> op >> b;
      IsValid = true;

      if (a > 20000 || b > 20000) {
        std::cout << "Error: 0 <= a, b <= 20000" << std::endl;
        IsValid = false;
      }
      if (!(op == "+" || op == "-" || op == "*" || op == "/" || op == "?")) {
        std::cout << "Error: op == +, -, *, /, ?" << std::endl;
        IsValid = false;
      }
      if (IsValid == true) {
        break;
      }
    }

    if (op != "?") {
      auto it = Functions.find(op);
      if (it != Functions.end()) {
        std::cout << it->second(a, b) << std::endl;
      } else {
        std::cout << "not found" << std::endl;
      }
    } else {
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3172
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

    int N;
    String S;

    public void solve() {
        N = nextInt();
        S = next();

        int ans = 0;
        boolean ok = true;
        for(int i = 0;i < N-1;i++) {
            ans++;
            if (S.charAt(i) == 'x' && S.charAt(i + 1) == 'x') {
                ok = false;
                break;
            }
        }

        if (ok){
            ans++;
        }

        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

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

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;

int X1[1005], X2[1005], Y1[1005], Y2[1005], w, h, n, dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
bool field[1001 * 6][1001 * 6];
vector<int> tv;

int compress(int *p1, int *p2, int w) {
  tv.clear();

  for (int i = 0; i < n; ++i) {
    for (int j = -1; j <= 1; ++j) {
      int tp1 = p1[i] + j, tp2 = p2[i] + j;

      if (0 <= tp1 && tp1 <= w) tv.PB(tp1);
      if (0 <= tp2 && tp2 <= w) tv.PB(tp2);
    }
  }

  sort(tv.begin(), tv.end());

  tv.erase(unique(tv.begin(), tv.end()), tv.end());

  for (int i = 0; i < n; ++i) {
    p1[i] = find(tv.begin(), tv.end(), p1[i]) - tv.begin();
    p2[i] = find(tv.begin(), tv.end(), p2[i]) - tv.begin();
  }

  return tv.size() - 1;
}

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

  while (cin >> w >> h, w) {
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
    }

    w = compress(X1, X2, w);
    h = compress(Y1, Y2, h);

    memset(field, 0, sizeof(field));
    for (int i = 0; i < n; ++i) {
      for (int y = Y1[i]; y < Y2[i]; ++y) {
        for (int x = X1[i]; x < X2[i]; ++x) {
          field[x][y] = true;
        }
      }
    }

    int ans = 0;
    for (int y = 0; y < h; ++y) {
      for (int x = 0; x < w; ++x) {
        if (field[x][y]) continue;
        ans++;
        queue<pii> q;
        q.push(pii(x, y));

        while (q.size()) {
          pii p = q.front();
          q.pop();
          int tx = p.first, ty = p.second;
          if (field[tx][ty]) continue;
          field[tx][ty] = true;

          for (int i = 0; i < 4; ++i) {
            int nx = tx + dx[i], ny = ty + dy[i];
            if (nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
            q.push(pii(nx, ny));
          }
        }
      }
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 36556
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,s=0;
  cin>>n;
  vector<int> a(n);
  bool f=true;
  for(int i=0;i<n;i++){
    cin>>a[i];
    s+=a[i];
    if(a[i]%10!=0)
      f=false;
  }
  if(f){
    cout<<0;
    return 0;
  }
  if(s%10!=0){
    cout<<s;
    return 0;
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    if(a[i]%10!=0){
      cout<<s-a[i];
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;

    int sum = 0;

    if (a > b) {
        sum += a;
        a--;
    } else {
        sum += b;
        b--;
    }

    if (a > b) {
        sum += a;
        a--;
    } else {
        sum += b;
        b--;
    }

    cout << sum;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[20];
int n;
bool work(int r,int t)
{
    if(t<0)
        return false;
    if(t==0)
        return true;
    if(r==1)
        return a[0]==t;
    return work(r-1,t)||work(r-1,t-a[r-1]);
}
int main()
{
    int q,i;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    cin>>q;
    while(q--)
    {
        cin>>i;
        if(work(n,i))
            cout<<"yes"<<endl;
        else
            cout<<"no"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int f(int x) {
    return 10 * x + 7;
}
int main() {
    int K;
    cin >> K;
    int x = 7;
    int ans = 1;
    int tmp = K % 10;
    if (tmp % 2 == 0 || tmp == 5) {
        cout << -1 << endl;
        return 0;
    }
    if (K == 1 || K == 7) {
        cout << 1 << endl;
        return 0;
    }
    do {
        ans += 1;
    } while ((x = (f(x) % K)) != 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#[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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        s: chars,
    }

    let n = s.len();
    if s[0] == '0' || s[n - 1] == '1' || (0..(n - 1) / 2).any(|i| s[i] != s[n - 2 - i]) {
        println!("-1");
        return;
    }

    let mut g: Vec<Vec<usize>> = vec![vec![]; n];
    let mut f: Vec<usize> = vec![];
    {
        let mut add_edge = |u: usize, v: usize| {
            g[u].push(v);
            g[v].push(u);
        };

        for i in 0..n - 1 {
            if s[i] == '0' {
                f.push(i);
            } else {
                for &k in f.iter() {
                    add_edge(i, k);
                }
                f.clear();
                f.push(i);
            }
        }

        for &k in f.iter() {
            add_edge(n - 1, k);
        }
    }

    dfs(0, None, &g);
}

fn dfs(u: usize, prev: Option<usize>, g: &Vec<Vec<usize>>) {
    for &v in g[u].iter() {
        if Some(v) == prev {
            continue;
        }
        println!("{} {}", u + 1, v + 1);
        dfs(v, Some(u), g);
    }
}


Measured memory_bytes: 28796
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root, NIL;
int maxh;

void insert(int k){
  int H;
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;

    if ( z->key < x->key ){
      x = x->left;
    } 
    else {
      x = x->right;
    }
  }

  z->parent = y;


  if ( y == NIL ){
    root = z;
  } 
  else {
    if (z->key < y->key) {
      y->left = z;
    } 
    else {
      y->right = z;
    }
  }
}

void inorder(Node u){
  if ( u == NIL ) return;

  inorder(u->left);
  printf(" %d", u->key);

  inorder(u->right);
}
void preorder(Node u){
  if ( u == NIL ) return;
  printf(" %d", u->key);

  preorder(u->left);

  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  maxh = 0;
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);

    if ( strcmp(com, "insert") == 0 ){
      scanf("%d", &x);
      insert(x);
    } 
    else if ( strcmp(com, "print") == 0 ){
      
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 25296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

struct edge { int to, cost; };

int n, m;
vector<edge> g[101];
bool used[101][101];
int d[101];

void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>> pq;
	fill(d, d + n, inf);
	pq.emplace(0, s);
	d[s] = 0;
	while (pq.size()) {
		P p = pq.top(); pq.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		for (auto& c : g[v]) {
			edge e = c;
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				pq.emplace(d[e.to], e.to);
			}
		}
	}

	rep(i, n) {
		for (auto& c : g[i]) {
			edge e = c;
			if (d[i] + e.cost == d[e.to]) {
				used[i][e.to] = true;
				used[e.to][i] = true;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		g[a].push_back({ b,c });
		g[b].push_back({ a,c });
	}
	rep(i, n) dijkstra(i);
	int ans = m;
	rep(i, n - 1) {
		for (int j = i + 1; j < n; ++j) {
			if (used[i][j]) ans--;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#define MX 100005

using namespace std;

typedef long long ll;

ll x[MX];
ll seq[MX], det[MX], tar[MX], ans[MX];
ll n, m;
ll k;
ll id[MX], to[MX];
ll vis[MX], cnt;
vector<ll> src[MX], cyc[MX];

void dfs(ll x)
{
	vis[x] = 1;
	src[cnt].push_back(x);
	cyc[cnt].push_back(x);
	if(!vis[to[x]]) dfs(to[x]);
}

int main()
{
	scanf("%lld", &n);
	for(int i=1; i<=n; i++) scanf("%lld", &x[i]), det[i] = x[i]-x[i-1];
	scanf("%lld%lld", &m, &k);
	for(int i=1; i<=m; i++) scanf("%lld", &seq[i]);
	for(int i=1; i<=n; i++) id[i] = i;
	for(int i=1; i<=m; i++) swap(id[seq[i]], id[seq[i]+1]);
	for(int i=1; i<=n; i++) to[id[i]] = i;
	for(int i=1; i<=n; i++) if(!vis[i]) cnt++, dfs(i);
	for(int i=1; i<=cnt; i++)
	{
		int t = k % cyc[i].size();
		cyc[i].insert(cyc[i].end(), cyc[i].begin(), cyc[i].begin()+t);
		cyc[i].erase(cyc[i].begin(), cyc[i].begin()+t);
	}
	for(int i=1; i<=cnt; i++)
		for(int j=0; j<src[i].size(); j++)
			tar[cyc[i][j]] = det[src[i][j]];
	for(int i=1; i<=n; i++) ans[i] = ans[i-1] + tar[i];
	for(int i=1; i<=n; i++) printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 18432
n, m = map(int, input().split())

A = [-1] * n
for _ in range(m):
    s, c = map(int, input().split())
    s -= 1
    if A[s] == -1:
        A[s] = c
    elif A[s] != c:
        print(-1)
        exit()

if n >= 2:
    if A[0] == -1:
        A[0] = 1
    elif A[0] == 0:
        print(-1)
        exit()

for i in range(n):
    if A[i] == -1:
        A[i] = 0

print(*A, sep = "")


Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int n,x;
  string s;
  cin >> n >> x;
  vector<ll> L(n+1);
  vector<ll> D(n+1);
  REP(i, n) cin >> L[i];
  ll cnt = 1;
  D[0] = 0;
  vector<ll> vec;
  FOR(i,1,n+1) {
    D[i] = D[i-1] + L[i-1];
    //if(D[i] <= x) cnt++;        
    //cerr << D[i] << endl;
    vec.push_back(D[i]);
  }
  sort(vec.begin(), vec.end());

  for(auto &e: vec){
    if(e <= x){
      cnt++;
    }
    //cerr << e << "cnt: " << cnt << endl;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll


signed main() {
  int X, Y; cin >> X >> Y;
  rep(i, X+1) {
    if(2*i + 4*(X-i) == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			Arrays.sort(chr);
			int a = Integer.parseInt(chr[0]);
			int b = Integer.parseInt(chr[1]);
			int c = Integer.parseInt(chr[2]);
			 System.out.println(c*10+a+b);
		}
	}
}

Measured memory_bytes: 25424
#include<bits/stdc++.h>
using namespace std;
int a[1000],b[1000];
int main()
{
	int n;
	cin>>n;
	for (int i = 1; i <= n-1; ++i)
	{
		cin>>b[i];
	}
	a[1] = b[1];
	for (int i = 1; i <= n-2; ++i)
	{
		a[i+1] = min(b[i],b[i+1]);
	}
	a[n] = b[n-1];
	int ans=0;
	for (int i = 1; i <= n; ++i)
	{
		ans+= a[i];
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int n = s.size(), dp[n + 1][2]{};
	for (int i = 0; i < n + 1; i++) {
		for (int j = 0; j < 2; j++) {
			dp[i][j] = -1;
		}
	}
	dp[0][1] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 2; j++) {
			if (dp[i][j] < 0) {
				continue;
			}
			int lim = j ? (s[i] - '0') : 9;
			for (int d = 0; d <= lim; d++) {
				dp[i + 1][j && (d == lim)] = max(dp[i + 1][j && (d == lim)], dp[i][j] + d);
			}
		}
	}
	cout << max(dp[n][0], dp[n][1]) << endl;
	return 0;
}

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

#define ll long long int

#define pi 2*acos(0.0)
#define mod 1000000007

#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}

#define pb push_back
#define Bit_off(val,pos)       (val & (~(1<<pos)))
#define Bit_on(val,pos)        (val | (1<<pos))
#define Bit_toggle(val,pos)    (val ^ (1<<pos))
#define Bit_check(val,pos)     (bool)(val & (1<<pos))
#define odd_even(val)          (bool)(val & 1)
#define koita_1_ase(val)       (__builtin_popcount(val))

//ll Big_Mod(ll v1, ll p, ll md)  { ll res=1; v1=v1%md; while (p > 0){if (p & 1)res = (res * v1) % md; p =p>>1; v1 = (v1 * v1) % md;}return res;}

ll ar[500009],br[500009],cr[500009];
map<ll,ll>mp,mp1;
vector<ll>v;
string s,d;

int main()
{
    ll a,b,c,i,j,k,x,y,z,f,g,h;
    cin>>a>>b;
    if(a<=b)
    {
        cout<<"unsafe"<<endl;
    }
    else
    {
        cout<<"safe"<<endl;
    }
}



Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
		while (sc.hasNextInt()) {
			int m = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			if (m + f + r <= -3) {
				break;
			}
			if (m == -1 || f == -1) {
				 System.out.println("F");
				} else if (m + f >= 80) {
					System.out.println("A");
				} else if (m + f >= 65) {
					System.out.println("B");
				} else if (m + f >= 50) {
					System.out.println("C");
				} else if(m + f >= 30){
					if (r >= 50) {
						System.out.println("C");
					} else  {
						System.out.println("D");
					}
				}else System.out.println("F");

			}
    }
}



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

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>>code(m,vector<int>(3));
	for (int i = 0; i < m; i++) {
		code.at(i).at(2) = i;
		cin >> code.at(i).at(0) >> code.at(i).at(1);
	}
	sort(code.begin(), code.end());
	int prefecture = code.at(0).at(0);
	int birth = 0;
	for (int i = 0; i < m; i++) {
		if (prefecture == code.at(i).at(0))birth++;
		else {
			prefecture = code.at(i).at(0);
			birth = 1;
		}
		code.at(i).at(1) = birth;
		swap(code.at(i).at(0), code.at(i).at(2));
		swap(code.at(i).at(1), code.at(i).at(2));
	}
	sort(code.begin(), code.end());
	for (int i = 0; i < m; i++) {
		printf("%06d", code.at(i).at(1));
		printf("%06d", code.at(i).at(2));
		cout << endl;
	}
}


Measured memory_bytes: 7040
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	s := nextInt()

	var a, b int
	sup := 1000000000

	if s%sup == 0 {
		a = s / sup
		b = 0
	} else {
		a = s/sup + 1
		b = sup - s%sup
	}

	fmt.Printf("0 0 %d 1 %d %d\n", sup, b, a)

}

// func main() {
// 	sc.Split(bufio.ScanWords)

// 	s := nextInt()

// 	x1, x2, x3 := 0, 0, 0
// 	y1, y2, y3 := 0, 0, 0

// 	var y23 int
// 	for i := 1; ; i++ {
// 		if s%i == 0 && s/i >= 2 {
// 			y23 = s / i
// 			x1 = i
// 			break
// 		}
// 	}

// 	y3 = 0
// 	y2 = y23 + y3
// 	y1 = y2 + 100

// 	fmt.Printf("%d %d %d %d %d %d\n", x1, y1, x2, y2, x3, y3)

// }


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

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    for (int i=0;i<k;i++) cout << s << " ";
    for (int i=0;i<n-k;i++) {
        if (s==1e9) cout << 1 << endl;
        else cout << s+1 << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    int n, x;
    while (cin >> s, s != "-") {
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> x;
            s = s.substr(x) + s.substr(0, x);
        }
        cout << s << endl;
    }
}

Measured memory_bytes: 3156
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CMaximumVolume {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int l; cin >> l;
      double dl = l;
      cout << setprecision(10) << fixed;
      cout << (dl/3)*(dl/3)*(dl/3) << endl;
    }
};

signed main() {
  CMaximumVolume solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void solve(){  
    int h,w; cin>>h>>w; char maze[h][w]; int dp[h][w];
    loopf(i,0,h-1){
        loopf(j,0,w-1){
            cin>>maze[i][j]; dp[i][j]=0;
        }
    }
    loopf(i,0,h-1){
        loopf(j,0,w-1){
            if(i==0 && j==0){dp[i][j]=1; continue;}
            if(maze[i][j]=='#') {dp[i][j]=0; continue;}
            if(i>0) (dp[i][j]+=dp[i-1][j])%=mod;
            if(j>0) (dp[i][j]+=dp[i][j-1])%=mod;
        }
    }
    cout<<dp[h-1][w-1];
}

int32_t main(){
    
    fastIO();

    //tc(t){
        solve();
    //}

    return 0;
}

Measured memory_bytes: 9088
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[][] = new int [2][n];
    for(int i = 0;i < 2;i++){
      for(int j = 0;j < n;j++){
        a[i][j] = sc.nextInt();
      }
    }
    int max = 0;
    int x = 0;
    int count = n;
    while(count > 0){
      int sum = 0;
      int i = 0;
      for(int j = 0;j < n;j++){
        sum += a[i][j];
        if(j == x){
          i++;
          sum += a[i][j];
        }
      }
      if(max < sum){
        max = sum;
      }
      x++;
      count--;
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define Fi first
#define Se second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz(x) (int)(x).size()
#define pii pair<int,int>
#define pll pair<ll,ll>

void fsscan(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

void scani(int &x)
{
    register int c = gc();x = 0;int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

int main()
{
    fsscan();
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(c-a)<=d)
    cout<<"Yes";
    else
    if((abs(a-b)<=d)&&abs(b-c)<=d)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      String a = sc.next();
      String b = sc.next();
      String c = sc.next();

      char a1 = a.toUpperCase().charAt(0);
      char b1 = b.toUpperCase().charAt(0);
      char c1 = c.toUpperCase().charAt(0);


        System.out.print(a1);
        System.out.print(b1);
        System.out.print(c1);
        System.out.println();



}
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

#define PI 3.14159265358979

double a, b, x;

int main() {
	cin >> a >> b >> x;
	double ans;
	double ta;
	if (a * a * b / 2 > x) {
		double e = (2.0 * x) / (a * b);
		//ta = (2 * x) / (a * e * e);
		ans = atan((2 * x) / (a * e * e));
	}
	else {
		//ta = (2.0 * a * a * b - 2.0 * x) / (a * a * a);
		ans = atan((2.0 * a * a * b - 2.0 * x) / (a * a * a));
	}
	ans = (ans * 180.0) / PI;
	printf("%.7f\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string w;
    cin>>w;
    int l = w.length();
    int a[26];
    memset(a,0,sizeof(a));
    for(int i=0;i<l;i++)
    {
        int temp = w[i]-97;
        a[temp]++;
    }
    int flag = 0;
    for(int i=0;i<26;i++)
    {
        if(a[i]!=0&& a[i]%2!=0)
        {
            flag++;
            break;
        }
    }
    if(flag)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int L;
	long double ans;
	
	cin>>L;
	
	ans = pow((long double)L/3,3);
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,T;
  string s;
  cin >> n >> T >> s;
  ll d[n+1];
  mem(d);
  REP(i,1,n) {
    if(s[i-1]=='A'&&s[i]=='C') d[i+1]++;
  }
  rep(i,n) d[i+1]+=d[i];
  while(T--) {
    ll l,r;
    cin >> l >> r;
    ll ans=d[r]-d[l];
    pr(ans);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1872
#include <stdio.h>
int main(void){
    int a,b,c,tmp;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    if(a>b){
        tmp=a;
        a=b;
        b=tmp;

    }
    if(b>c){
        tmp=b;
        b=c;
        c=tmp;

    }
    if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    printf("%d %d %d\n",a ,b, c);
   return 0;  
}



Measured memory_bytes: 2036
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vec vector

typedef long long ll;

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

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

template<class T> T gcd(T m, T n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}

template<class T> T lcm(T m, T n) {
  return m * n / gcd(m, n);
}

const ll inf = 1LL << 60;
const int mod = 1e9 + 7;

using namespace std;

/* Input variables. */
int k;
int x;

/* Solve! */
void solve() {
  if (500 * k >= x) {
    cout << "Yes" << endl;
  } else cout << "No" << endl;
}

int main() {
  /* Input handling. */
  cin >> k >> x;

  solve();
  return 0;
}

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

using namespace std;

#define B       (cout << "Sehen Sie mich!" << endl)
#define VB(val) (cout << val << endl)

int main()
{
        int n, a, b;
        cin >> n >> a >> b;
        int ret = ((n * a < b) ? n * a : b);
        VB(ret);
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    string s;
    cin>>s;
    int cnt=0;
    REP(i,s.size())if(s[i]=='2')cnt++;
    cout<<cnt<<endl;
}

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

int main(int argc, char const *argv[]) {
  int N, M;
  int x, y;
  int result = 0;
  std::cin >> N >> M;
  std::vector<bool> has_possibility(N, false);
  std::vector<int64_t> n_ball(N, 1);
  has_possibility[0] = true;

  for (size_t i = 0; i < M; i++) {
    std::cin >> x >> y;
    if (has_possibility[x-1]) {
      if (n_ball[x-1] - 1 == 0) has_possibility[x-1] = false;
      has_possibility[y-1] = true;
    }
      n_ball[x-1]--;
      n_ball[y-1]++;
  }

  for (size_t i = 0; i < N; i++) {
    if (has_possibility[i]) result++;
  }
  std::cout << result << std::endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<numeric>
#include<stack>
#include<map>
#include<queue>
#include<unordered_map>
#include<cmath>
#include<utility>
 
#include<ctime>
#include<random>
using namespace std;
typedef long long ll;
const ll inf = 1001001001001001;

int D;
int v=27;
vector<int> c(v,0);
vector<vector<int>> s;
vector<int> t;
vector<int> last(v,0);

void init(){
    cin >> D;
    s.resize(D+1);
    t.resize(D+1);
    for(int i=0;i<D+1;i++){
        s[i].resize(v);
    }

    for(int i=1;i<27;i++){
        cin >> c.at(i);
    }
    for(int i=1;i<D+1;i++){
        for(int j=1;j<27;j++){
            cin >> s.at(i).at(j);
        }
    }
/*
    for(int i=1;i<D+1;i++){
        cin >> t.at(i);
    }
*/

}

void init_last(){
  for(int i=0;i<v;i++){
    last.at(i) = 0;
  }
}

void calc(){
    init_last();
  	//ll sum=0;
  	for(int d=1;d<D+1;d++){
      	//day d: i
      	ll best_of_day=-inf;
      	for(int i=1;i<27;i++){
          	ll sum_of_day=0;
          	vector<int> tmp_last = last;
          	sum_of_day += s.at(d).at(i);
          	tmp_last.at(i) = 0;
          	for(int j=1;j<27;j++){
              	sum_of_day -= c.at(j) * (d - tmp_last.at(j));
            }
          
          	if(sum_of_day > best_of_day){
              	best_of_day = sum_of_day;
              	last = tmp_last;
              	t.at(d) = i;
            }
        }      
    }
}

ll total(){
    ll ans=0;
    init_last();
    for(int i=1;i<D+1;i++){
        ans += s.at(i).at(t.at(i));
        last.at(t.at(i)) = i;
        for(int j=1;j<v;j++){
            ans -= c.at(j) * (i - last.at(j));
        }
    }
    return ans;
}

int main(){
	int time = std::clock();  
    init();
  	//calc();
    std::random_device rd;

    std::mt19937 mt(rd());
  
  	for(int d=1;d<D+1;d++){
	    int x = mt()%26+1;
	    t.at(d) = x;
    }
  	ll sum = total();

	while(static_cast<int>((double)(std::clock() - time) / CLOCKS_PER_SEC * 1000.0) < 1900){  
    	int d = (mt()%D)+1;
      	int x = (mt()%26)+1;
      	vector<int> res = t;
      	res.at(d) = x;
      	if(total() > sum){
        	t = res;
          	sum = total();
        }
    }
  
  	//cout << total() << endl;
  
  	for(int d=1;d<D+1;d++){
      cout << t.at(d) << endl;
    }
  
  	return(0);
}

Measured memory_bytes: 3696