akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

int main(){
	int a, b, c, d, e;
	read(a); read(b); read(c); read(d); read(e);
	int t = c * 60 + d - a * 60 - b - e;
	cout << t << endl; 
	return 0;
}



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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

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

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; }

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

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

    REP( i, s.size() ){
        if( s[i] + N > 'Z' ){
            cout << (char)( s[i] + N - 'Z' + 'A' - 1 );
        }else{
            cout << (char)( s[i] + N );
        }
    }
    cout << endl;
}

/*
05

*/

Measured memory_bytes: 256
holidays, homeworks = input().split(' ')
holidays = int(holidays)
homeworks = int(homeworks)

days_per_homework = input().split(' ')
days_to_finish = 0
for _days in days_per_homework:
    days_to_finish = days_to_finish + int(_days)

if days_to_finish <= holidays:
    print(holidays - days_to_finish)
else:
    print(-1)


Measured memory_bytes: 9580
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *h = map(int, read().split())
if len(h) == 1:
    print('Yes')
    exit()

h = h[::-1]

for i in range(1, n):
    if h[i - 1] < h[i]:
        h[i] -= 1
    if h[i - 1] < h[i]:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 12508
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int h, w;
const int D = 80*160+10;
const int D2 = D*2;
typedef bitset<D2> bs;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> h >> w;

  int a[90][90];

  REP(i, h) REP(j, w) cin >> a[i][j];
  REP(i, h) REP(j, w) {
    int x;
    cin >> x;
    a[i][j] = abs(a[i][j] - x);
  }

  bs dp[90][90];
  dp[0][0][D - a[0][0]] = 1;
  dp[0][0][D + a[0][0]] = 1;
  REP(i, h) REP(j, w) {
    if(i) {
      dp[i][j] |= dp[i - 1][j] << a[i][j];
      dp[i][j] |= dp[i - 1][j] >> a[i][j];
    }
    if(j) {
      dp[i][j] |= dp[i][j - 1] << a[i][j];
      dp[i][j] |= dp[i][j - 1] >> a[i][j];
    }
  }

  int ans = D2;
  REP(i, D2) if(dp[h - 1][w - 1][i]) {
    ans = min(ans, abs(i - D));
  }
  cout << ans << endl;
}


Measured memory_bytes: 29084
#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int N;
    cin >> N;
    vector<int> a(N);
    REP (i, 0, N) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[N - 1] - a[0] << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

void solve() {
    int n, m;
    cin >> n >> m;
    vector<bool> ac(n+1, false);
    vector<int> cnt(n+1, 0);
    int cntAC = 0, cntWA = 0;
    for (int i=0; i<m; i++) {
        int p;
        string s;
        cin >> p >> s;
        if (s == "AC") {
            if (!ac.at(p)) {
                ac.at(p) = true;
            }
        } else {
            if (!ac.at(p)) {
                cnt.at(p)++;
            }
        }
    }
    for (int i=1; i<n+1; i++) {
        if (ac.at(i)) {
            cntAC++;
            cntWA += cnt.at(i);
        }
    }
    cout << cntAC << " " << cntWA << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 640
dbflag=""

def next(b):
	result = []
	x,y = b
	if x -1 >= 0 and S[x-1,y]=='.' and depthS[x-1,y]== -1:
		result.append((x-1,y))
	if y -1 >= 0 and S[x,y-1]=='.' and depthS[x,y-1]== -1:
		result.append((x,y-1))
	if x +1 < H and S[x+1,y]=='.' and depthS[x+1,y]== -1:
		result.append((x+1,y))
	if y +1 < W and S[x, y+1]=='.' and depthS[x,y+1]== -1:
		result.append((x,y+1))
	
	return result

  
def debug(*args):
  if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
  if ""!=dbflag:return _INDATA.readline()
  else: return input()


result = -1

H, W = map(int, readline().split())

#２次元配列
import numpy as np

S= np.ndarray(shape=(H,W), dtype=object)

for i in range(0,H):
	S[i,0:W] =list(readline().rstrip())
	

wNum = S[S == "."].size
bNum = H * W - wNum

debug(H,W)
debug(S)
debug(wNum)



from collections import deque
queue = deque([])
#queue.append(A)
#queue.popleft()


depthS = np.full((H,W), -1, dtype=int)

depthS[0,0] = 0
queue.append((0,0))

while len(queue) > 0 and depthS[H-1,W-1]==-1:
	base = queue.popleft()
	baseDepth = depthS[base]

	debug("----")
	debug(base,baseDepth)
	debug("depthS")	
	debug(depthS)	


	neighbors = next(base)
	
	debug('depthS',depthS)
	for n in neighbors: depthS[n[0],n[1]]=baseDepth + 1

	debug('depthS2',depthS)
	debug('neighbors',neighbors)
	
	for n in neighbors:
		queue.append(n)
	debug("queue",queue)	


if depthS[H-1,W-1]!=-1:
	result = wNum - (depthS[H-1,W-1] + 1)
else:
	result = -1

print(result)




Measured memory_bytes: 12540
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)

using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

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

    ll i,j,h;
    ll Q,M,K,P,A,B,N;

    long double x;

    string S;

    ll ans=0;
    ll count=0;
    ll flag=0;
    ll temp=0;

vector<ll> aa, bb, hh, ff;
ll a,b;
    cin >>N>>M;
    ll d;
    rep(i,N){
        cin>>temp;
        hh.push_back(temp);
        ff.push_back(0);
    }
    rep(i,M){
        cin>>a>>b;
        aa.push_back(a);
        bb.push_back(b);
    }
    
    
rep(i,M){
    if(hh[aa[i]-1]>=hh[bb[i]-1]){
        ff[bb[i]-1]++;
    }
    if(hh[bb[i]-1]>=hh[aa[i]-1]){
        ff[aa[i]-1]++;
    }
}
rep(i,N){
    if(ff[i]==0){
        ans++;
    }
}

//rep(i,N)cout<<ff[i];
cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7256
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve <$> replicateM n f <*> f >>= prt
    main
  where
    f = map read <$> words <$> getLine
    prt xs
      | null xs = putStrLn "NA"
      | otherwise = mapM_ print xs

solve :: [[Int]] -> [Int] -> [Int]
solve xss [p, q, r, c]= map head $ filter g xss
  where
    f p q r = 4 * p + 9 * q + 4 * r
    g [si, pi, qi, ri] = pi <= p && qi <= q && ri <= r && f pi qi ri <= c



Measured memory_bytes: 6336
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int W = sc.nextInt();
        int w[] = new int[n+1];
        int v[] = new int[n+1];
        for(int i = 1 ; i < w.length ; i++){
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }
        long dp[][] = new long[n+1][W+1];
        for(int i = 1 ; i <= n ; i++){
            for(int j = 0 ; j <= W ; j++){
                if(j>=w[i])
                    dp[i][j] = Math.max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]);
                else dp[i][j] = dp[i-1][j];
            }
        }
        System.out.println(dp[n][W]);
    }
}

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

using namespace std;

void eliminate_empty_line(vector< vector<bool> > &map)
{
  auto itr = map.begin();
  while (itr != map.end()) {
    if ( accumulate(itr->begin(), itr->end(), true, logical_and<bool>()) ) {
      itr = map.erase(itr);
    } else {
      ++itr;
    }
  }
}

vector< vector<bool> > transpose(vector< vector<bool> > &src)
{
  uint64_t H = src.size(), W = src[0].size();
  vector< vector<bool> > dst(W, vector<bool>(H));
  for (uint64_t h = 0; h < H; ++h) {
    for (uint64_t w = 0; w < W; ++w) {
      dst[w][h] = src[h][w];
    }
  }
  return dst;
}

ostream& operator<<(ostream &os, const vector< vector<bool> > &map)
{
  for (uint64_t h = 0; h < map.size(); ++h) {
    for (uint64_t w = 0; w < map[h].size(); ++w) {
      os << (map[h][w] ? '.' : '#');
    }
    os << endl;
  }
  return os;
}

int main()
{
  uint64_t H, W;
  cin >> H >> W;
  
  vector< vector<bool> > map(H, vector<bool>(W));
  for (uint64_t h = 0; h < H; ++h) {
    for (uint64_t w = 0; w < W; ++w) {
      char c;
      cin >> c;
      map[h][w] = c == '.';
    }
  }
  
  eliminate_empty_line(map);
  
  map = transpose(map);
  
  eliminate_empty_line(map);
  
  map = transpose(map);
  
  cout << map << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mt make_tuple
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int N;
MII fact;


void makeFact(){
	repe(i, 2, N){
		int n = i;
		repif(j, 2, j*j<=n){
			while(n%j == 0) fact[j]++, n/=j;
		}
		if(n != 1) fact[n]++;
	}
}


int solve(){
	int ans = 1;
	for(PII p : fact)
		ans = MUL(ans, p.se+1);
	return ans;
}


signed main(){
	cin >> N;
	
	makeFact();
	
	cout << solve() << endl;
	
	return 0;
}

Measured memory_bytes: 256
/*
貪欲
後ろから見る
DP
順位表をチェック



*/
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1
#define MAX 110000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,ll>,ll> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);

const int MAX_N=1<<17;

//セグメント木を持つグローバル配列
int n;
int dat[2*MAX_N-1];

//初期化
void init(int n_){
    //簡単のために要素数を2のべき乗に
    n=1;
    while(n<n_) n*=2;

    //全ての値をINT_MAXに
    for(int i=0;i<2*n-1;i++) dat[i]=MAX;
}

//k番目の値(0-indexed)をaに変更
void update(int k,int a){
    //葉の節点
    k+=n-1;
    dat[k]=a;
    //登りながら更新
    while(k>0){
        k=(k-1)/2;
        dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
}

//[a,b)の最小値を求める
//後ろの方の引数は、計算の簡単のための引数
//ｋは接点の番号、l,rはその接点が[l,r)に対応づいていることを表す
//したがって、外からはquery(a,b,0,0,n)として呼ぶ
int query(int a,int b,int k,int l,int r){
    //[a,b)と[l,r)が交差しなければ,INT_MAX
    if(r<=a || b<=l) return MAX;

    //[a,b)が[l,r)を完全に含んでいれば、この節点の値
    if(a<=l && r<=b) return dat[k];
    else{
        //そうでなければ、２つの子の最小値
        int vl=query(a,b,k*2+1,l,(l+r)/2);
        int vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}


int main(){
    int N,M;
    cin>>N>>M;
    string S;
    cin>>S;
    init(N+1);
    update(N,0);
    for(int i=N-1;i>=0;i--){
        if(S[i]=='1'){
            update(i,MAX);
            continue;
        }
        int x=query(i+1,min(N+1,i+M+1),0,0,n);
        update(i,x+1);
    }
    
    if(query(0,1,0,0,n)==MAX){
        cout<<-1<<endl;
        return 0;
    }
    int dp[110000];
    for(int i=0;i<=N;i++){
        dp[i]=query(i,i+1,0,0,n);
    }
    //cout<<dp[8]<<endl;
    int now=dp[0];
    vector<int> V;
    V.push_back(0);
    for(int i=1;i<=N;i++){
        if(now-1==dp[i]){
            now--;
            V.push_back(i);
        }
    }
    for(int i=1;i<(int)V.size();i++){
        if(i!=1) cout<<" ";
        cout<<V[i]-V[i-1];
    }
    cout<<endl;


}


Measured memory_bytes: 2552
n=int(input())
p= list(map(int, input().split()))

count=0
for i in range(n):
  if(p[i] != i+1):
    count=count+1

    c=p[i]
    p[i], p[c-1] = p[c-1],p[i]

    if(count == 2):
      print("NO")
      exit()

print("YES")
exit()

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

using namespace std;

/* Template file for Online Algorithmic Competitions */
/* Typedefs */
    /* Basic types */
    typedef long long           ll;
    typedef unsigned long long ull;
    /* STL containers */
    typedef vector <int>    vi;
    typedef vector <ll>     vll;
    typedef pair <int, int> pii;
    typedef pair <ll, ll>   pll;
    typedef vector < pii >  vpii;
    typedef vector < pll >  vpll;
    typedef vector <string> vs;
    typedef vector < vi >   vvi;
/* Macros */
    /* Loops */
    #define fl(i, a, b)     for(int i(a); i<(b); i++)
    #define rep(i, n)       fl(i, 0, n)
    #define rep1(i, n)      fl(i, 1, n)
    #define rfl(i, a, b)    for(int i(a);i>=(b);i--)
    /* Algorithmic functions */
    #define srt(v)          sort((v).begin(),(v).end())
    /* STL container methods */
    #define pb              push_back
    #define mp              make_pair
    /* String methods */
    #define slen(s)         s.length()
    /* Shorthand notations */
    #define F               first
    #define S               second
    #define MOD             1000000007
    #define MAX             100010
    #define re              return 
    #define sz(x)           ((int) (x).size())
    #define all(x)          ((x).begin(), (x).end())
    #define sqr(x)          ((x) * (x))
    #define fill(x, y)      memset(x, y, sizeof(x))
/* Templates */
template<class T> T abs(T x) { re x > 0 ? x : -x; }
	
int main(){
	int n;

    cin >> n;

    vector <ll> a(n + 1, 0);

    ll sum = 0;
    rep1(i, n + 1){
        cin >> a[i];
        a[i] -= i;
        sum += a[i];
    }

    sort(a.begin() + 1, a.end());

    ll median;
    if(n % 2 == 0){
        median = floor(1.0*(a[n/2] + a[(n + 1)/2])/2);
    }
    else{
        median = a[(n + 1)/2];
    }
    ll min_sad = 0;
    rep1(i, n + 1){
        a[i] -= median;
        min_sad += abs(a[i]);
    }

    cout << min_sad;
	return 0;
}

Measured memory_bytes: 1792
import numpy as np
import sys
input = sys.stdin.readline


def main():
    N,K = map(int, input().split())
    A = np.array(sorted([int(i) for i in input().split()]))

    negative = A[A < 0]
    positive = A[A > 0]
    ln = len(negative)
    lp = len(positive)
    zero = np.count_nonzero(A == 0)

    def count(x):
        count = 0
        if x >= 0:
            count += N * zero
        count += np.searchsorted(A, x // positive, side='right').sum()
        count += N * ln - np.searchsorted(A, -(-x // negative), side='left').sum()
        count -= np.count_nonzero(A * A <= x)
        count //= 2

        return count


    left = -(10**18)
    right = 10**18
    while right - left > 1:
        x = (left + right) // 2
        if count(x) < K:
            left = x
        else:
            right = x

    print(right)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32300
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

const int days[13] = {
  0,
  31, 28, 31, 30, 31, 30,
  31, 31, 30, 31, 30, 31
};

inline bool IsLeap(const int year) {
  return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0));
}

int main() {
  int y1, m1, d1, y2, m2, d2;
  while (scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2)) {
    if (y1 == -1) break;
    int lhs = d1, rhs = d2;
    for (int i = 1; i < y1; ++i) {
      lhs += 365;
      if (IsLeap(i)) ++lhs;
    }
    for (int i = 1; i < y2; ++i) {
      rhs += 365;
      if (IsLeap(i)) ++rhs;
    }
    for (int i = 1; i < m1; ++i)
      lhs += days[i];
    for (int i = 1; i < m2; ++i)
      rhs += days[i];
    if (m1 >= 3 && IsLeap(y1)) ++lhs;
    if (m2 >= 3 && IsLeap(y2)) ++rhs;
    // printf("%d : %d\n", lhs, rhs);
    printf("%d\n", rhs - lhs);
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m, p;
int pos;
char str[10000];
map<string, vector<int> > mapto;
map<vector<int>, string> mapfrom;
map<string, string> convert;
vector<int> error;

vector<int> formula();
vector<int> factor() {
  vector<int> lhs;
  if (str[pos] == '(') {
    pos++;
    lhs = formula();
    if (lhs == error) { return error; }
    assert(str[pos] == ')');
    pos++;
  } else {
    assert(isalpha(str[pos]));
    string s;
    while (isalpha(str[pos])) { s += str[pos++]; }
    if (!convert.count(s)) { return error; }
    if (!mapto.count(convert[s])) { return error; }
    lhs = mapto[convert[s]];
  }
  return lhs;
}

vector<int> term() {
  vector<int> lhs = factor();
  if (lhs == error) { return error; }
  while (str[pos] == '*' || str[pos] == '/') {
    int s = str[pos] == '*' ? 1 : -1;
    pos++;
    vector<int> rhs = factor();
    if (rhs == error) { return error; }
    REP(i, n) {
      lhs[i] += s * rhs[i];
    }
  }
  return lhs;
}

vector<int> formula() {
  vector<int> lhs = term();
  if (lhs == error) { return error; }
  while (str[pos] == '+' || str[pos] == '-') {
    pos++;
    vector<int> rhs = term();
    if (rhs == error) { return error; }
    REP(i, n) {
      if (lhs[i] != rhs[i]) { return error; }
    }
  }
  return lhs;
}

int main() {
  error = vector<int>(1, -1000000000);
  while (scanf("%d %d %d", &n, &m, &p), n|m|p) {
    pos = 0;
    mapto.clear();
    mapfrom.clear();
    REP(i, m) {
      string s;
      cin >> s;
      vector<int> vect(n, 0);
      REP(i, n) {
        scanf("%d", &vect[i]);
      }
      mapto[s] = vect;
      mapfrom[vect] = s;
    }
    scanf("%s", str);
    REP(i, p) {
      string from, to;
      cin >> from >> to;
      convert[from] = to;
    }
    int cnt = 0;
    REP(i, strlen(str)) { cnt += str[i] == '(' ? 1 : 0; cnt -= str[i] == ')' ? 1 : 0; }
    while (cnt != 0);
    
    vector<int> ans = formula();
    if (ans[0] <= -100000) {
      puts("error");
    } else if (mapfrom.count(ans)) {
      printf("%s\n", mapfrom[ans].c_str());
    } else {
      puts("undefined");
    }
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define tmp(x) std::cout<<"& "<<(x)<<" &\n"
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define mp make_pair
#define pii pair<int,int>
typedef long long ll;

using namespace std;
const int maxn=4e5+100;
int tot,to[maxn],nxt[maxn],head[maxn],sz[maxn],vis[maxn];
inline void add(int u,int v){
    to[++tot]=v,nxt[tot]=head[u],head[u]=tot;
}
void dfs(int x,int fa){
	vis[x]=1;
	sz[x]=1;
	for(int i=head[x];i;i=nxt[i]){
		if(vis[to[i]]||to[i]==fa)continue;
		dfs(to[i],x);
		sz[x]+=sz[to[i]];
	}
}
int main(){
	int n,m,u,v,ans=1;
	cin>>n>>m;
	
	rep(i,1,m){
		cin>>u>>v;
		add(u,v);
		add(v,u);
	}
	rep(i,1,n){
		if(!vis[i])dfs(i,0);
	}
	rep(i,1,n)ans=max(ans,sz[i]);
	cout<<ans;
 
    return 0;
}


Measured memory_bytes: 21368
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	int N,K;
	cin>>N>>K;
	
	vector<long long> a(N);
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	
	vector<long long> S(N+1,0),S_p(N+1,0);
	
	for(int i=0;i<N;i++){
		S[i+1] = S[i] + a[i];
		S_p[i+1] = S_p[i];
		if(a[i]>0)S_p[i+1]+=a[i];
	}
	
	long long ans = 0;
	
	for(int i=1;i<=N;i++){
		int r = i+K-1;
		if(r>N)break;
		
		long long a = max((long long)0,S[r]-S[i-1]);
		a += S_p[i-1];
		a += S_p[N]-S_p[r];
		ans = max(a,ans);
	}
	
	cout<<ans<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  int e;
  cin >> a >> b >> c >> d;
  cout << c + (b-d) << " " << d - (a-c) << " " << a + (b-d) << " " << b - (a-c);
}
      
    
    


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

using namespace std;

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  long long answer = 0, sum_a = 0, sum_b = 0;
  vector<pair<int, int>> all(n << 1);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    answer += a[i] + b[i];
    sum_a += a[i];
    sum_b += b[i];
    all[i << 1] = make_pair(a[i], i);
    all[i << 1 | 1] = make_pair(b[i], i);
  }
  long long result = max(sum_a, sum_b);
  sort(all.begin(), all.end(), greater<pair<int, int>> ());
  vector<bool> visit(n);
  bool already = false;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    if (visit[all[i].second]) {
      already = true;
    }
    sum += all[i].first;
    visit[all[i].second] = true;
  }
  if (already) {
    result = max(result, sum);
  } else {
    for (int i = n; i < n << 1; ++i) {
      if (all[n - 1].second == all[i].second) {
        result = max(result, sum + all[i].first - all[n - 2].first);
      } else {
        result = max(result, sum + all[i].first - all[n - 1].first);
      }
    }
  }
  cout << answer - result << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n;
	int ans = 0;
	scanf("%d", &n);
	int arr[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &arr[i]);
	for (int i = 0; i < n; i++) {
		if (arr[i] == arr[i + 1] && i < n - 1) {
			continue;
		} else if (arr[i] > arr[i + 1]) {
			while (arr[i] >= arr[i + 1] && i < n - 1)
				i++;
		} else if (arr[i] < arr[i + 1]) {
			while (arr[i] <= arr[i + 1] && i < n - 1)
				i++;
		}
		ans++;
	}
	printf("%d\n", ans);
}


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

const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

/*vector<long long> h(100010);
vector<long long> dp(100010,INF);
int main(){
int N,K;cin>>N>>K;
for(int i=0;i<N;i++) cin>>h[i];
dp[0]=0;
for(int i=0;i<N;i++){
    for(int k=1;k<=K;k++){
        chmin(dp[i+k],dp[i]+abs(h[i]-h[i+k]));
    }
}
cout<<dp[N-1]<<endl;
    return 0;
}*/
vector<vector<int>> h(100010,vector<int>(3,0));
vector<vector<int>> dp(100010,vector<int>(3,0));//pairでもよさそう
int main(){
    int N;cin>>N;
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>h[i][j];
        }
    }
    for(int i=1;i<=N;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j!=k) chmax(dp[i][k],dp[i-1][j]+h[i-1][k]);//chmaxの後ろが+h[i-1][j]じゃなくてh[i-1][k]なのは前日にした以外の行動が2通りあり、その2つでもkのfor文で比較する必要があるため。
            }
        }
    }
    int ans=0;
    for(int i=0;i<3;i++){
        ans=max(dp[N][i],ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
#define TRACE(x) cerr << #x << " = " << x << endl
#define _  << " " << 
 
const int TOUR = 1<<18;
const ll INF = 1e15;
 
struct tour {
  ll val, prop;
  tour (ll _val, ll _prop) : val(_val), prop(_prop) {}
  tour () {}
} tpoz[2*TOUR], tneg[2*TOUR];
 
int n;
int p[TOUR], poc[TOUR];
vector <int> V;
int beg, endd;
ll minn, poz;
 
void Add(tour t[2*TOUR], int node, ll val)
{
  t[node].prop += val;
  t[node].val += val;
}
 
void Propagiraj(tour t[2*TOUR], int node)
{
  Add(t, 2*node+0, t[node].prop);
  Add(t, 2*node+1, t[node].prop);
  t[node].prop = 0;
}
 
void Stavi(int pos, int lo, int hi)
{
  if (lo >= endd || hi <= beg)
    return;
  if (lo >= beg && hi <= endd) {
    tpoz[pos].val = min(tpoz[pos].val, minn + poz);
    tneg[pos].val = min(tneg[pos].val, minn - poz);
    return;
  }
 
  if (tpoz[pos].prop)
    Propagiraj(tpoz, pos);
  if (tneg[pos].prop)
    Propagiraj(tneg, pos);
 
  Stavi(2*pos+0, lo, (lo+hi)/2);
  Stavi(2*pos+1, (lo+hi)/2, hi);
  tpoz[pos].val = min(tpoz[2*pos].val, tpoz[2*pos+1].val);
  tneg[pos].val = min(tneg[2*pos].val, tneg[2*pos+1].val);
}
 
void Stavi(int _begin, int _end, ll _minn, ll _poz)
{
  beg = _begin;
  endd = _end;
  minn = _minn;
  poz = _poz;
  Stavi(1, 0, TOUR);
}
 
ll Vrati(tour t[2*TOUR], int pos, int lo, int hi, int begin, int end)
{
  if (lo >= end || hi <= begin)
    return INF;
  if (lo >= begin && hi <= end)
    return t[pos].val;
 
  return t[pos].prop + min(Vrati(t, 2*pos+0, lo, (lo+hi)/2, begin, end),
                           Vrati(t, 2*pos+1, (lo+hi)/2, hi, begin, end) );
}
  
ll Rijesi()
{
  for (int i=1; i<TOUR; i++)
    Propagiraj(tpoz, i);
 
  ll ret = INF;
  for (int i=0; i<=n+1; i++)
    ret = min(ret, tpoz[p[i]+TOUR].val - poc[i]);
 
  return ret;
}
 
int main()
{
  scanf("%*d%d", &n);
  
  int A, B;
  scanf("%d%d", &A, &B);
  p[0] = poc[0] = A; p[0] = poc[0] = 0;
  B -=A;
  p[1] = poc[1] = B;
  
  V.push_back(p[0]); V.push_back(p[1]);
  for (int i=2; i<=n+1; i++) {
    scanf("%d", &p[i]);
    p[i] -= A;
    poc[i] = p[i];
    V.push_back(p[i]);
  }
 
  sort(V.begin(), V.end());
 
  for (int i=0; i<=n+1; i++)
    p[i] = lower_bound(V.begin(), V.end(), p[i]) - V.begin();

 
  Add(tpoz, 1, INF);
  Add(tneg, 1, INF);
  Stavi(p[0], p[0] + 1, 0, 0);
  //Add(tpoz, p[0], p[0] + 
 
  for (int i=2; i<=n+1; i++) {
    ll mn = min(Vrati(tpoz, 1, 0, TOUR, p[i], TOUR) - poc[i],
		Vrati(tneg, 1, 0, TOUR, 0, p[i] + 1) + poc[i] );


    Add(tpoz, 1, abs(poc[i] - poc[i-1]));
    Add(tneg, 1, abs(poc[i] - poc[i-1]));
 
    Stavi(p[i-1], p[i-1] + 1, mn, poc[i-1]);
  }
 
  cout << Rijesi() << endl;
 
  return 0;
}


Measured memory_bytes: 19060
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const n = Number(input);

const dp = [];
dp[0] = 1;
dp[1] = 1;
for (let i = 2; i <= n; i++) {
  dp[i] = dp[i - 1] + dp[i - 2];
}

console.log(dp[n]);



Measured memory_bytes: 15128
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif
#define LDcout(x,n) fixed<<setprecision(n)<<x

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

int foo(int a,int b,int c){
    int t=a*a+b*b+c*c;
    return t;
}
void mainmain(){
    vector<string> v;
    v.PB("black");
    v.PB("blue");
    v.PB("lime");
    v.PB("aqua");
    v.PB("red");
    v.PB("fuchsia");
    v.PB("yellow");
    v.PB("white");
    string s;
    while(cin>>s){
        if(s.size()==1) return;
        vint w(3,0);
        rep(i,3){
            string tmp=s.substr(1+i*2,2);
            if(isdigit(tmp[0])) w[i]=16*(tmp[0]-'0');
            else{
                w[i]=16*(tmp[0]-'a'+10);
            }
            if(isdigit(tmp[1])) w[i]+=(tmp[1]-'0');
            else{
                w[i]+=(tmp[1]-'a'+10);
            }
        }
        vector<pii> vv(8);
        rep(i,8){
            vint tmp(3);
            rep(j,3){
                if((1<<j)&i) tmp[2-j]=255;
                else tmp[2-j]=0;
            }
            vv[i].S=i;
            vv[i].F=foo(w[0]-tmp[0],w[1]-tmp[1],w[2]-tmp[2]);
        }
        sort(ALL(vv));
        cout<<v[vv[0].S]<<endl;
    }
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
      cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 1196
#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

class UnionFind {
private:
    vector<int> par;
public:
    UnionFind(int n) {
        par.resize(n, -1);
    }
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    bool unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return false;
        if (size(rx) < size(ry)) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n,m;cin >> n >> m;
    vector<int> a(m),b(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
    }
    int cnt = 0;
    for (int i = 0; i < m; i++) {
        UnionFind uf(n);
        for (int j = 0; j < m; j++) {
            if (i == j) continue;
            uf.unite(a[j],b[j]);
        }
        cnt += uf.size(0) != n;
    }
    cout << cnt << endl;
    return 0;
}

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

const int MAX_N = 100, MAX_M = 100;
const double EPS = 1e-10;

int n,m;
long double g[MAX_N][MAX_N], dp[2][MAX_N];

int main()
{
    int m, n;
    while(cin >> n >> m && n) {
        for(int i = 0; i < n; i++) 
            for(int j = 0; j < n; j++) 
                cin >> g[i][j];

        for(int i = 0; i < n; i++) {
            dp[0][i] = 1.0;
            dp[1][i] = -1.0;
        }
        
        for(int i = 0; i < m - 1; i++) {
            for(int j = 0; j < n; j++) {
                for(int k = 0; k < n; k++) {
                    dp[(i+1) % 2][k] = max(dp[(i+1) % 2][k], dp[i % 2][j] * g[j][k]);
                }
            }
        }
        long double ret = 0.0;
        for(int i = 0; i < n; i++) 
            ret = max(ret, dp[(m-1) % 2][i]);
        printf("%.2Lf\n", ret);

    }
    
}

Measured memory_bytes: 1100
A,B = [int(i) for i in input().split()]
S=input().strip()

ans=True
if len(S) != A+B+1 or S[A] != '-':
    ans=False
else:
    A_str = S[0:A]
    B_str = S[A+1:A+B+1]
    # print(A_str,B_str)
    if ( not A_str.isdigit() ) or ( not B_str.isdigit() ):
        ans=False

ans_str = 'Yes' if ans==True else 'No'
print(ans_str)


Measured memory_bytes: 3060
b = input().split()
a = [int(b[i]) for i in range(len(b))]

p = []

for j in range(a[0]):
  tmp = input().split()
  tmp = [int(tmp[i]) for i in range(2)]
  p.append((tmp[0], tmp[1]))

c = []

for j in range(a[1]):
  tmp = input().split()
  tmp = [int(tmp[i]) for i in range(2)]
  c.append((tmp[0], tmp[1]))

ans = []

for i in range(a[0]):
  min = (10000000000, 0)
  for j in range(a[1]):
    if(min[0] > abs(p[i][0] - c[j][0]) + abs(p[i][1] - c[j][1])):
      min = (abs(p[i][0] - c[j][0]) + abs(p[i][1] - c[j][1]), j+1)

  ans.append(min[1])

for j in range(a[0]):
  print(ans[j])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define LL long long 
#define N 1000005
using namespace std;
int n,m,ar[N],a,b;
int main()
{
	cin>>a>>b;
	if(b>=0 && a<=0)
		 printf("Zero");
	if(b>0 && a>0)
		printf("Positive");
	if(b<0 && a<0)
	{
		if((a-b)%2)
			printf("Positive");
		else
			printf("Negative");
	}	
}


Measured memory_bytes: 256
class V
  attr_accessor :edges, :cost
  def initialize()
    @cost = Float::INFINITY
    @edges = []
  end
  def add_edge(edge)
    @edges << edge
  end
  def show_edges
    puts @edges.join(" ")
  end
end
vn,e,r = gets.split.map(&:to_i)
$vs = []
vn.times{|i|
  $vs << V.new()
}
$glay = []
$black = []
edges = []
e.times do
  s,t,c = gets.split.map(&:to_i)
  $vs[s].add_edge([s,t,c])
  edges << [s,t,c]
end
$vs[r].cost = 0
queue = $vs
loop do
  flag = true
  edges.each{|edge|
    src = edge[0]
    dst = edge[1]
    cos = edge[2]
    next if $vs[src] == Float::INFINITY
    if $vs[dst].cost > cos + $vs[src].cost
      $vs[dst].cost =  cos + $vs[src].cost
      flag = false
    end
  }
  break if flag
end
$vs.each{|v| puts v.cost==Float::INFINITY ? "INF" : v.cost}



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

int main()

{int t;
cin >> t;
int cnt=0;
bool poss=false;
   while(t--)
   { int a,b;
   cin >> a >> b;
   if(a==b)
   {
       cnt++;
   }
   else if(a!=b)
   {

       cnt=0;
   }
   if(cnt>=3)
   {

       poss=true;
   }
   }
   if(poss)
   {

       cout << "Yes" << endl;
   }
   else
   {

       cout << "No" << endl;
   }


}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;


int L;
void solve() {
    cout << ((double)L * L * L) / 27.0 << endl;
    ;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    cin >> L;


    solve();
    return 0;
}


Measured memory_bytes: 256
package main

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

type stack struct {
	ary []interface{}
}

func (s *stack) push(v interface{}) {
	s.ary = append(s.ary, v)
}

func (s *stack) pop() interface{} {
	i := len(s.ary) - 1
	v := s.ary[i]
	s.ary = s.ary[:i]
	return v
}

type area struct {
	index, value int
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	s1 := stack{}
	s2 := stack{}
	for i, s := range sc.Text() {
		switch string(s) {
		case "\\":
			s1.push(i)
		case "/":
			if len(s1.ary) <= 0 {
				continue
			}
			sindex := s1.pop().(int)
			total := 0
			for {
				if len(s2.ary) <= 0 {
					break
				}
				sarea := s2.pop().(area)
				if sarea.index <= sindex {
					s2.push(area{index: sarea.index, value: sarea.value})
					break
				}
				total += sarea.value
			}
			s2.push(area{index: sindex, value: i - sindex + total})
		case "_":
		}
	}

	sum := 0
	s := strconv.Itoa(len(s2.ary))
	for _, v := range s2.ary {
		area := v.(area)
		sum += area.value
		s += " " + strconv.Itoa(area.value)
	}
	fmt.Println(sum)
	fmt.Println(s)
}



Measured memory_bytes: 6220
alph = ('a'..'z').to_a + ('A'..'Z').to_a
index = Hash[*alph.zip(0..51).flatten]

loop {
    n = gets.to_i
    break if n == 0

    keys = gets.split.map(&:to_i)
    s = gets.chomp

    keys.cycle.with_index{|k, i|
        break if i >= s.size
        s[i] = alph[(index[s[i]] - k) % 52]
    }
    puts s
}

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

int main() {
	set<char> st;
	rep(i, 3) {
		char c;
		cin >> c;
		st.insert(c);
	}
	if(st.size()==1) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
using namespace std;
int A,B,C,D;
char s[100];
int main(){
  scanf("%d %d %d %d",&A,&B,&C,&D);
  if(A*B>C*D)printf("%d\n",A*B);
  else printf("%d\n",C*D);
  return 0;
}


Measured memory_bytes: 764
import itertools
N,M,Q=map(int,input().split())
listA=itertools.combinations_with_replacement(range(1,M+1),N)
ans=0
listQ=[]
for q in range(Q):
  listQ+=[list(map(int,input().split()))]
for i in listA:
  anssub=0
  for a,b,c,d in listQ:
    if i[b-1]-i[a-1]==c:
      anssub+=d
  ans=max(ans,anssub)
print(ans)  

Measured memory_bytes: 9208
#include <iostream>
using namespace std;
int main(){
	char buf;
	cin >> buf;
	if(buf == 'a' || buf == 'b' || buf == 'c' || buf == 'd' || buf == 'e' || buf == 'f' || buf == 'g' || buf == 'h' || buf== 'i'||buf=='j'||buf=='k'||buf=='l'||buf=='m'||buf=='n'||buf=='o'||buf=='p'||buf=='q'||buf=='r'||buf=='s'||buf=='t'||buf=='u'||buf=='v'||buf=='w'||buf=='x'||buf=='y'||buf=='z'){
		cout << 'a';
		return 0;
	}
	cout << 'A';
	return 0;
}


Measured memory_bytes: 3632
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
import std.bigint, std.functional;

void main() {
  auto I = readln.split.to!(long[]);
  auto A = I[0];
  auto B = I[1];
  auto C = I[2];

  bool solve() {
    auto x = C - A - B;
    if (x < 0) return false;

    return 4*A*B < x*x;
  }

  writeln(solve() ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    string s;
    cin>>s;
    int j=0,s1=0,s2=0;
    while(s[j]!='\0'){
          if(s[j]!='h' && s[j]!='i'){
             cout<<"No"<<endl;

             return 0;
          }
          if(s[j]=='h'){
             s1++;
             if(s1!=s2+1){
                ///cout<<s1<<" "<<s2+1<<endl;
                cout<<"No"<<endl;

                return 0;
             }
          }
          if(s[j]=='i'){
             s2++;
             ///cout<<s2<<endl;
             if(s2!=s1){
                cout<<"No"<<endl;

                return 0;
             }
          }
       j++;
    }
    ///cout<<s1<<" "<<s2<<endl;
    if(s1==s2){
       cout<<"Yes"<<endl;
    }
    else{
       cout<<"No"<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
import math
def resolve():

    a,b,c = map(int,input().split())

    target = 2*(a*a*b - c)/a**3
    if (c >= (a**2)*b/2):
        ans = math.degrees(math.atan(target))
        print(ans)
    else:
        ans = math.degrees(math.atan((a*b*b)/(2*c)))
        print(ans)
        
resolve()

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    string s;
    cin >> s;
    int n = size(s);
    int ans = 0;
    REP(i, n/2){
        ans += (s[i] == s[n - 1 - i] ? 0 : 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using ll = long long;
using ull = unsigned long long;
const static unsigned MOD = 998244353;

ull RepeatSquaring(ull N, unsigned P){
	if(P == 0 || N == 1) return 1;
	if(N == -1) return P & 1 ? -1 : 1;
	if(!(P & 1)){
		ull t = RepeatSquaring(N, P >> 1);
		return t*t % MOD;
	}
	//Pが偶数のときN^(P/2)を求めてからそれの2乗を返す
	return N*RepeatSquaring(N, P - 1) % MOD;
	//Pが奇数のときN^((P - 1)/2)を求めてからそれの2乗を返す
}
int main(){
	ull N, M, K;
	scanf("%llu %llu %llu", &N, &M, &K);
	ull ruijou[N];
	ruijou[0] = 1;
	for (int i = 1; i < N; ++i){
		ruijou[i] = ruijou[i - 1]*(M - 1) %MOD;
	}
	ull answer = 0, Combination = 1;
	for (ull i = 0; i <= K; ++i){
		if(i > 0) Combination = Combination*(N - i) %MOD *RepeatSquaring(i, MOD-2) %MOD;
		answer = (answer + M*ruijou[N - i - 1] %MOD *Combination %MOD) %MOD;
	}
	printf("%llu\n", answer);
	return 0;
}

Measured memory_bytes: 3248
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 1000000001
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int N,M; cin >> N >> M;
  vector<pair<int, int>> students(N);
  for(auto& p : students) {
    cin >> p.first >> p.second;
  }

  vector<pair<int,int>> checkpoints(M);
  for(auto& p : checkpoints) {
    cin >> p.first >> p.second;
  }

  for(auto student : students) {
    int imin = MAX_SIZE;
    int min_idx = 0;
    for(int j = 0; j < M; j++) {
      int dist = abs(student.first - checkpoints[j].first) + abs(student.second - checkpoints[j].second);
      if(imin > dist) {
        imin = dist;
        min_idx = j + 1;
      }
    }
    cout << min_idx << endl;
  }
}


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

string s;

long long solve();
bool ch(int x, int y);

int main() {
  cin >> s;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long cnt = 0;
  for(int i = 0; i < s.size() - 2; ++i)
    for(int j = i + 1; j < s.size() - 1; ++j)
      for(int k = j + 1; k < s.size(); ++k) {
        if(ch(0, i) && ch(i + 1, j) && ch(j + 1, k) &&
           ch(k + 1, s.size() - 1))
          ++cnt;
      }
  return cnt;
}

bool ch(int x, int y) {
  if(x > y) return 0;
  if(x != y && s[x] == '0') return 0;
  long long now = 0;
  for(int i = x; i <= y; ++i) {
    now *= 10;
    now += s[i] - '0';
  }
  return now <= 255;
}


Measured memory_bytes: 3200
#include<stdio.h>
int main()
{int n,sum=0,n1;
    scanf("%d",&n);n1=n;
    while(n1!=0){sum=sum+(n1%10);n1=n1/10;}
    if(n%sum==0){printf("Yes\n");}else{printf("No\n");}
    return 0;
}


Measured memory_bytes: 128