akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    int n; cin >> n;
    vector<int> edge[n];
    vector<pii> tree;

    irep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
        tree.push_back(pii(a, b));
    }
    
    queue<pii> que;/*root, color*/
    v_bool used(n, false);

    que.push(pii(0, -1));
    used[0] = true;
    map<pii, int> ans;
    int ans_size = -1;

    while(que.size()) {
        pii q = que.front(); que.pop();
        int root = q.first;
        int root_color = q.second;
        int color = 1;
        if(ans_size < (int)edge[root].size()) {
            ans_size = edge[root].size();
        }
        for(auto e : edge[root]) {
            if(used[e]) { continue; }
            if(color == root_color) { color++; }
            if(root > e) { 
                ans[pii(e, root)] = color;
            } else {
                ans[pii(root, e)] = color;
            }
            que.push(pii(e, color++));
        }
        used[root] = true;
    }

    cout << ans_size << endl;
    for(auto t : tree) {
        cout << ans[t] << endl;
    }

    return 0;
}
/** atcoder **/


Measured memory_bytes: 13044
def main():
    n = int(input())
    numbers = sorted(list(map(int, input().split())))
    now = numbers[0]
    count = 0
    answer = 0
    for i in range(n):
        if now == numbers[i] and not i == n - 1:
            count += 1
        elif now < numbers[i] or i == n - 1:
            if i == n - 1:
                count += 1
            if count > now:
                answer += count - now
            elif now > count:
                answer += count
            now = numbers[i]
            count = 1
    print(answer)


if __name__ == '__main__':
    main()

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

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class ALphabet {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        char s;
        in>>s;
        if(isupper(s)) out<<"A\n";
        else out<<"a\n";
    }
};


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


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ll  long long
#define mod 1000000007
#define ve vector
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int inf=1e9+5;


ll power(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b/=2;
	}
	return res;
}





void solve()
{
int a,b;
    cin>>a>>b;
    for(int i=0;i<=a;i++)
    {
     if((i*4+(a-i)*2)==b||(i*2+(a-i)*4==b))
     {
      cout<<"Yes";
         return ;
     }
    }
    cout<<"No";
    
}

signed main()
{
//#ifndef ONLINE_JUDGE
    //  freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
//#endif
    FAST;

     int t=1;
   //  cin>>t;
     while(t--)
    	solve();
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1e18;

ll f(ll a){
    if(a%4==0){
        return a;
    }else if(a%4==1){
        return 1;
    }else if(a%4==3){
        return 0;
    }else{
        return a^1;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll A,B;
    cin >> A >> B;
    if(A >= 1){
        cout << (f(A-1) ^ f(B)) << endl;
    }else{
        cout << f(B) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#define ll long long
#define INF 0x3f3f3f3f
#define SIS std::ios::sync_with_stdio(false)
using namespace std;

int main()
{
    ll n,a,b;
    while(cin>>n>>a>>b)
    {
        ll ans=0;
        ans+=a*(n/(a+b));
        if(n%(a+b)>a)
            ans+=a;
        else
            ans+=n%(a+b);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
S = input()
ACGT = ["A", "C", "G", "T"]
s = ""
l = []

for i in S:
    if i in ACGT:
        s += i
        l.append(s)
    else:
        l.append(s)
        s = ""

l2 = map(len, l)
print(max(l2))

Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <sstream>
#include <time.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define lson l,m,rt*2
#define rson m+1,r,rt*2+1
#define mt(A,B) memset(A,B,sizeof(A))
using namespace std;
typedef long long LL;
//const double PI = acos(-1);
const int N=1e6+10;
const LL mod=1e9+7;
const int inf = 0x3f3f3f3f;
const LL INF=0x3f3f3f3f3f3f3f3fLL;
map<pair<int,int>,int> Q;
int pre[N],pra[N];
void init()
{
    for(int i=1;i<N;i++)
    {
        pre[i]=i;
        pra[i]=i;
    }
}
int found1(int x)
{
    if(pre[x]==x)return x;
    else return pre[x]=found1(pre[x]);
}
int found2(int x)
{
    if(pra[x]==x)return x;
    else return pra[x]=found2(pra[x]);
}
void unite1(int x,int y)
{
    int fx=found1(x);
    int fy=found1(y);
    if(fx!=fy)pre[fx]=fy;
}
void unite2(int x,int y)
{
    int fx=found2(x);
    int fy=found2(y);
    if(fx!=fy)pra[fx]=fy;
}
int main()
{
#ifdef Local
    freopen("data.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int u,v,n,k,l;
    cin>>n>>k>>l;
    init();
    for(int i=0;i<k;i++)
    {
        cin>>u>>v;
        unite1(u,v);
    }
    for(int i=0;i<l;i++)
    {
        cin>>u>>v;
        unite2(u,v);
    }
    for(int i=1;i<=n;i++)
    {
        Q[mp(found1(i),found2(i))]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(i==n)cout<<Q[mp(found1(i),found2(i))]<<endl;
        else cout<<Q[mp(found1(i),found2(i))]<<" ";
    }
#ifdef Local
    cerr << "time: " << (LL) clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
}


Measured memory_bytes: 19968
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include <string.h>
using namespace std;
int n;
map<int,int> a;
int main() {
	cin >> n;
	int t;
	for (int i = 0; i < n; i++) {
		cin >> t;
		a[t]++;
	}
	int res = 0;
	for (auto kv : a) {
		if (kv.first > kv.second) {
			res += kv.second;
		}
		else if (kv.first < kv.second) {
			res += (kv.second - kv.first);
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    long L0 = 2;
    long L1 = 1;
    if (N == 1) {
      System.out.println(L1);
      return;
    }
    long L2 = 3;
    for (int i = 2; i <= N; i++) {
      L2 = L1 + L0;
      L0 = L1;
      L1 = L2;
    }
    System.out.println(L2);
  }
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	
	
	int tmp=max(a,max(b,c));
	int ans=(a+b+c)-tmp;
	
	for(int i=0;i<k;i++) tmp*=2;

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    int tgt = 1;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] == tgt) tgt++;
        else ans++;
    }

    cout << (ans == N ? -1 : ans) << endl;
}


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

int main() {
	int n,ans;
	cin>>n;
	int A[n][3],dp[n][3];
	for(int i=0;i<n;i++)
	{
		cin>>A[i][0]>>A[i][1]>>A[i][2];
	}
	dp[0][0]=A[0][0];
	dp[0][1]=A[0][1];
	dp[0][2]=A[0][2];
	for(int i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1]+A[i][0],dp[i-1][2]+A[i][0]);
		dp[i][1]=max(dp[i-1][0]+A[i][1],dp[i-1][2]+A[i][1]);
		dp[i][2]=max(dp[i-1][0]+A[i][2],dp[i-1][1]+A[i][2]);
	}
	ans=max(dp[n-1][0],dp[n-1][1]);
	ans=max(ans,dp[n-1][2]);
	cout<<ans;
	return 0;
}

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

#define int long long 
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pi> 
#define vvpii vector<vpii>
#define all(V) V.begin(),V.end()
#define mpii map<int,int> 
#define mpci map<char,int> 
#define fi first
#define si second
#define pb(V) push_back(V)
#define mp(a,b) make_pair(a,b)
#define mt(a,b,c) make_tuple(a,b,c)
#define forn(i,n) for (int i = 0; i < int(n); ++i)


const int N = 4010;
const int mod = 1e9 + 7;
vi fact(N,0);

int binpow(int a,int b)
{
	int res = 1;
	while(b)
	{
		if(b & 1)
		{
			res = (res*a)%mod;
		}
		b >>= 1;
		a = (a*a)%mod;
	}
	return res%mod;
}
void precompute()
{
	fact[0] = 1;
	for(int i = 1; i < N; ++i)
	{
		fact[i] = (fact[i-1]*i)%mod;
	}
}

int nCr(int n, int r)
{
	if(n < r)
	return 0;
	int num = fact[n]%mod;
	int div = (fact[r]*fact[n-r])%mod;
	int inv = binpow(div,mod-2);
	inv %= mod;
	return (num*inv)%mod;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	precompute();
	//~ cout << fact[6] << " ";
	//~ cout << nCr(5,2);
	for(int i = 1; i <= k; ++i)
	{
		
			int x = nCr(k-1,i-1);
			int y = nCr(n-k+1,i);
			if((x*y)%mod < 0)
			{
				cout << 0 << '\n';
			}
			else
			cout << (x*y)%mod << '\n';
		
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;  
ll n,t,c,m,sum,x,y,mx,mn,avg;
map<ll,ll>mp ;
int cum[100002];
bool isPrime(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}
int main(void) 
{ 
   SpeeD;
ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
cin>>n;
cout<<a[n-1];
}
    

Measured memory_bytes: 256
#include <iostream>
using namespace std;
bool isPrime[1000000];
void initErt() {
	fill(isPrime, isPrime + 1000000, true);
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i * i <= 1000000; i++) {
		if (!isPrime[i]) continue;
		for (int j = (i << 1); j < 1000000; j += i) {
			isPrime[j] = false;
		}
	}
}
int main () {
	initErt();
	int n;
	while (cin >> n, n) {
		int count = 0;
		for (int i = 2; i <= n / 2; i++) {
			if (isPrime[i] && isPrime[n - i]) {
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 2136
import fractions
a,b,c,d = map(int, input().split())
e = a-1
gcd = fractions.gcd(c,d)
def lcm(x, y):
    return (x * y) // gcd
lcm = lcm(c,d)
less_than_e = e - (e//c) - (e//d) + (e//lcm)
less_than_b = b - (b//c) - (b//d) + (b//lcm)
print(less_than_b - less_than_e)

Measured memory_bytes: 5048
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int ans = 0;
        if(a>b){
            for(int i = 0;i<a;i++){
                ans += b*(Math.pow(10,i));
            }
            System.out.println(ans);
        }
         if(a<=b){
            for(int i = 0;i<b;i++){
                ans += a*(Math.pow(10,i));
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 21588
import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        long[] a = new long[n+1];
        long[] sum = new long[n+1];
        for(int i=1;i<=n;i++){
            a[i] = sc.nextInt();
            sum[i] = (sum[i-1]+a[i]);
        }
        //
        // sum[j]%k-j+k = sum[i]-i
        HashMap<Long,Queue<Integer>> rec = new HashMap<>(n/2);
        rec.put(0L, new LinkedList<>());
        rec.get(0L).add(0);
        long ans = 0;
        for(int j=1;j<=n;j++){
            // first, find sum[j]%k-j = sum[i]%k-i
            long key = sum[j]%k-j;
            Queue<Integer> curQueue = rec.get(key);
            if(curQueue!=null){
                ans += curQueue.size();
            }
            Queue<Integer> q2 = rec.get(key+k);
            if(q2!=null){
                while(q2.size()>0 && q2.peek()<=j-k) q2.poll();
                ans += q2.size();
            }
            if(curQueue!=null) curQueue.add(j);
            else{
                Queue<Integer> next = new LinkedList<>();
                next.add(j);
                rec.put(key, next);
            }
        }
        return ans;
    }
}



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

#define SIZE 1001
#define MAX_W 1001

int main(void) {
    int V[SIZE][MAX_W] = {};
    int v[SIZE];
    int w[SIZE];
    int W, N;
    int ans_v, ans_w;
    int n = 1;
    
    while(true) {
        cin >> W;
        if(W == 0)   break;
        
        cin >> N;
        for(int i = 0; i < N; ++i) {
            scanf("%d,%d", &v[i], &w[i]);
        }
        
        for(int i = 1; i <= N; ++i) {
            for(int j = 1; j <= W; ++j) {
                if(w[i - 1] > j) {
                    V[i][j] = V[i - 1][j];
                } else {
                    V[i][j] = max(V[i - 1][j], V[i - 1][j - w[i - 1]] + v[i - 1]);
                }
            }
        }
        
        ans_w = W;
        while(V[N][ans_w] == V[N][W]) {
            --ans_w;
        }
        ++ans_w;
        ans_v = V[N][ans_w];
        
        printf("Case %d:\n", n);
        cout << ans_v << endl << ans_w << endl;
        
        ++n;
    }
    
    return 0;
}


Measured memory_bytes: 7136
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(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 = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

  ll a, b;
  cin >> a >> b;
  ll c = a ^ b, d = (a - 1) ^ b, e = a % 4;
  if(a % 2){
    if(b % 4 == e) cout << a << endl;
    if(b % 4 == (e + 1) % 4) cout << c << endl;
    if(b % 4 == (e + 2) % 4) cout << a - 1 << endl;
    if(b % 4 == (e + 3) % 4) cout << d << endl;
    return 0;
  }
  else{
    if(b % 4 == e) cout << b << endl;
    if(b % 4 == (e + 1) % 4) cout << 1 << endl;
    if(b % 4 == (e + 2) % 4) cout << b + 1 << endl;
    if(b % 4 == (e + 3) % 4) cout << 0 << endl;
    return 0;
  }
}


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

int fill_land(int y,int x,int h,int w,vector<vector<int>> &c);

int main()
{

	for (;;)
	{
		int w,h;
		cin >> w >> h;
		if ((w==0)&&(h==0))
		{
			return 0;
		}

		vector<vector<int>> c(h,vector<int>(w));

		for (int i=0;i<h;++i)
		{
			for (int j=0;j<w;++j)
			{
				cin >> c[i][j];
			}
		}

		int count=0;
		for (int i=0;i<h;++i)
		{
			for (int j=0;j<w;++j)
			{
				if (c[i][j]!=0)
				{
					// land
					++count;
					c[i][j]=0;
					fill_land(i,j,h,w,c);
				}
			}
		}
		cout << count << endl;
	}
}

int fill_land(int y,int x,int h,int w,vector<vector<int>> &c)
{
	stack<pair<int,int>> st;

	st.push(make_pair(y,x));
	while (st.empty()==0)
	{
		auto p=st.top();
		st.pop();

		if ( (p.first>0) && (c[p.first-1][p.second]!=0) )
		{
			c[p.first-1][p.second]=0;
			st.push(make_pair(p.first-1,p.second));
		}
		if ( (p.first<h-1) && (c[p.first+1][p.second]!=0) )
		{
			c[p.first+1][p.second]=0;
			st.push(make_pair(p.first+1,p.second));
		}
		if ( (p.second>0) && (c[p.first][p.second-1]!=0) )
		{
			c[p.first][p.second-1]=0;
			st.push(make_pair(p.first,p.second-1));
		}
		if ( (p.second<w-1) && (c[p.first][p.second+1]!=0) )
		{
			c[p.first][p.second+1]=0;
			st.push(make_pair(p.first,p.second+1));
		}
		if ( (p.first>0) && (p.second>0) && (c[p.first-1][p.second-1]!=0) )
		{
			c[p.first-1][p.second-1]=0;
			st.push(make_pair(p.first-1,p.second-1));
		}
		if ( (p.first>0) && (p.second<w-1) && (c[p.first-1][p.second+1]!=0) )
		{
			c[p.first-1][p.second+1]=0;
			st.push(make_pair(p.first-1,p.second+1));
		}
		if ( (p.first<h-1) && (p.second>0) && (c[p.first+1][p.second-1]!=0) )
		{
			c[p.first+1][p.second-1]=0;
			st.push(make_pair(p.first+1,p.second-1));
		}
		if ( (p.first<h-1) && (p.second<w-1) && (c[p.first+1][p.second+1]!=0) )
		{
			c[p.first+1][p.second+1]=0;
			st.push(make_pair(p.first+1,p.second+1));
		}
	}
	return 0;
}








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

using namespace std;
using ll = long long;
using vi = vector<int>;
using graph = vector<vector<ll>>;

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

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

	int n, m;
	cin >> n >> m;

	vector<ll> h(n);

	rep(i, n) cin >> h[i];
	
	graph g(n);

	for (int i = 0; i < m; i++) {
		ll a, b;
		cin >> a >> b;
		g[a - 1].emplace_back(b);
		g[b - 1].emplace_back(a);
	}
  
	ll ans = 0;
	for (int i = 0; i < g.size(); i++) {
		ll cnt = 0;
		for (int j = 0; j < g[i].size(); j++) {
			if (h[i] > h[g[i][j] - 1])cnt++;		
		}
		if (cnt == g[i].size())ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 9800
program main
  implicit none
  integer :: n, m, res
  integer, allocatable :: x(:), y(:)
  read (*, *) n, m
  allocate (x(m), y(m - 1))
  read (*, *) x(:)

  call quicksort(x)
  y(:) = x(2:) - x(:m - 1)
  call quicksort(y)

  res = sum(y(:m - n))
  write (*, "(i0)") res

  contains

  recursive subroutine quicksort(a)
    integer, intent(inout) :: a(:)
    integer :: pivot, i, j, k, tmp, n
    real(4) :: r
    n = size(a)
    if (n <= 1) return
    i = 1
    j = n
    call random_number(r)
    k = 1 + floor(r * n)
    k = max(1, min(k, n))
    pivot = a(k)
    do
      do while (.not. pivot <= a(i))
        i = i + 1
      end do
      do while (.not. a(j) <= pivot)
        j = j - 1
      end do
      if (i >= j) exit
      tmp = a(i)
      a(i) = a(j)
      a(j) = tmp
      i = i + 1
      j = j - 1
    end do
    call quicksort(a(1:i - 1))
    call quicksort(a(j + 1:n))
  end subroutine quicksort
end program main


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
const int maxn=3005;
const int mod=998244353;
int n,s,a[maxn],dp[maxn][3];
inline void add(int &x,int y) {
    x+=y;
    if (x>=mod) x-=mod;
}
int main()
{
    scanf("%d%d",&n,&s);
    for (int i=1;i<=n;++i) scanf("%d",&a[i]);
    dp[0][0]=1;
    for (int i=1;i<=n;++i) for (int j=s;j>=0;--j) {
        if (j>=a[i]) {
            add(dp[j][1],dp[j-a[i]][1]);
            add(dp[j][1],dp[j-a[i]][0]);
        }
        add(dp[j][1],dp[j][0]);
        add(dp[j][2],dp[j][1]);
    }
    printf("%d\n",dp[s][2]);
    return 0;
}


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

using namespace std;

using ll = long long;

int main()
{
    int A,B;
    cin >> A >> B;

    if((A+B)%2==0)
    {
        cout << (A+B)/2 << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int n, k;
int a[110];

ll dp[110][100100];

ll sum[100100];

signed main() {

    cin >> n >> k;

    for(int i = 0; i < n; i++)
        cin >> a[i];
    dp[0][0] = 1;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= k; j++)
            sum[j+1] = sum[j] + dp[i][j];
        for(int j = 0; j <= k; j++) {
            dp[i+1][j] = sum[j+1] - sum[max(0,j-a[i])];
            dp[i+1][j] %= SMOD;
        }
    }
    
    cout << dp[n][k] << endl;
  
    return 0;
}



Measured memory_bytes: 79360
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

const ll limit = 50;
bool graph[limit][limit];
bool visited[limit];

void dfs(ll v) {
    visited[v] = true;
    for(ll v2 = 0; v2 < limit; ++v2) {
        if(!graph[v][v2]) continue;
        if(visited[v2]) continue;
        dfs(v2);
    }
}

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> a(M);
    vector<ll> b(M);
    rep(i, M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }
    ll ans = 0;
    rep(i, M) {
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
        for(ll j = 0; j < limit; j++) visited[j] = false;
        dfs(0);
        for (ll j = 0; j < N; ++j) {
            if (!visited[j]) {
                ans++;
                break;
            }
        }
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val n = scala.io.StdIn.readInt()
  val readH =  scala.io.StdIn.readLine()
  val h = readH.split(" ").map(_.toInt).toVector
  var result = 0
  var tempResult = -1
  var beforeValue = -1

  h.foreach { i =>
    if (i <= beforeValue) {
      beforeValue = i
      tempResult += 1
      if (tempResult > result) {
        result = tempResult
      }
    } else {
      tempResult = 0
      beforeValue = i
    }
  }
  println(result)
}

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

int main() {
char c;
  cin >> c;
  if (c == 'a'|| c == 'e' || c == 'i' || c == 'o' || c == 'u')
    cout << "vowel" << endl;
 else
   cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a[101],n,i,sum=0,min=1000000,m;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
        if(a[i]<min)
            min=a[i];
    }
    printf("%d",n+(m-sum)/min);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int x, i = 1;
    
    while(true){
        cin >> x;
        if(x == 0) break;
        cout << "Case " << i << ": " << x << endl;
        i++;
    }
    
    return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>

using namespace std;


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

	if (s[2] == s[3]) {
		if (s[4] == s[5]) {
			cout << "Yes";
		}
		else {
			cout << "No";
		}
	}
	else {
		cout << "No";
	}
}

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

int dp[100001];
signed main() {
	int n, w; cin >> n >> w;
	for (int i = 0; i < n; i++) {
		int x, y; cin >> x >> y;
		for (int j = w; j >= x; j--) {
			dp[j] = max(dp[j], dp[j - x] + y);
		}
	}
	int ans = 0;
	for (int i = 1; i <= w; i++) {
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
namespace AtCoderCS
{
    using System;
    using System.IO;
    using System.Text;
    using static System.Console;
    using static System.Math;

    class Program
    {
        void Solve()
        {
            var N = cin.Int;
            WriteLine(N % 2 == 0 ? N / 2 : N / 2 + 1);
        }

        private SimpleInput cin = new SimpleInput();
        private SimpleOutput cout = new SimpleOutput();

        void Stream()
        {
            Solve();
            cout.Flush();
        }

        static void Main(string[] args)
            => new Program().Stream();
    }

    #region IO

    class SimpleInput
    {
        private string[] _nextBuffer;
        private int _bufferCnt;
        private readonly char[] _cs = new char[] {' ', '"', ','};

        public SimpleInput()
        {
            _nextBuffer = new string[0];
            _bufferCnt = 0;
        }

        string Next()
        {
            if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
            var st = ReadLine();
            while (st == string.Empty) st = ReadLine();
            if (st != null) _nextBuffer = st.Split(_cs, StringSplitOptions.RemoveEmptyEntries);
            _bufferCnt = 0;
            return _nextBuffer[_bufferCnt++];
        }

        public string String => Next();
        public char Char => char.Parse(String);
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
    }

    class SimpleOutput
    {
        private readonly StreamWriter _sw = new StreamWriter(OpenStandardOutput())
        {
#if DEBUG
            AutoFlush = true
#else
            AutoFlush = false
#endif
        };

        public SimpleOutput()
        {
            SetOut(_sw);
        }

        public void Flush() => Out.Flush();
    }

    #endregion
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], T = l[1];
            var dp = new int[N+1,T+3001];
            var ab = new int[N][];
            for (var i = 0; i < N; i++)
               ab[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            ab = ab.OrderBy(z => z[0]).ToArray();
            for (var i = 1; i <= N; i++) {
               int a = ab[i-1][0], b = ab[i-1][1];
               for (var j = 0; j <= T+3000; j++) {
                  if (j - a >= 0&&j-a<T) {
                     dp[i,j] = Math.Max(dp[i-1,j],dp[i-1,j-a]+b);
                  }
                  else dp[i,j]=dp[i-1,j];
               }
               //for (var v=0;v<T+3000;v++)
               //    Console.Write(dp[i,v]+ " ");
                //Console.WriteLine();
            }
            
            var max = 0;
            for (var i = T + 3000; i >= 0; i--)
            {
                if (dp[N,i]>0) {
                  max = Math.Max(dp[N,i],max);
                  // return; 
                }
            }
            Console.WriteLine(max);
        }
    }
}


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

def ii(): return int(input())
def iis(): return input().split()
def imi(): return map(int,iis())
def iil(): return list(imi())


factmemo={0:1} #階乗
def fact(n):
    if n in factmemo:
        return factmemo[n]
    k = n*fact(n-1)
    factmemo[n]=k
    return k

def comb(a,b):
    if a-b < 0:
        return 0
    return fact(a)//(fact(a-b)*fact(b)) #組み合わせ

def aaa(n,k):
    r = len(str(n))-1
    st = str(n)
    ans = 0
    if k==1 and r>=0:
        ans += 9*r \
               + int(st[0])
    elif k==2 and r>=1:
        ans += 9**2 * comb(r, 2) \
               + (int(st[0])-1) * 9**1 * comb(r, 1) \
               + aaa(n%(10**r), k-1)
    elif k==3 and r>=2:
        ans += comb(r, 3)*9**3\
               +comb(r, 2)*9**2*(int(st[0])-1)\
               +aaa(n%(10**r), k-1)
    return ans

n = int(input())
k = int(input())
ans = aaa(n,k)
print(ans)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import sys

def main():
	A = int(input())
	B = int(input())
	C = int(input())
	X = int(input())
	
	ans = 0
	for a in range(A+1):
		for b in range(B+1):
			for c in range(C+1):
				if (a * 500) + (b * 100) + (c * 50) == X:
					ans += 1
	print(ans)
		
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <functional>
#include <iterator>     
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int n, m, x;
string s, t;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
    vector<int> v1;
    vector<int> v2;
    for(int i=0; i<n; ++i){
        int a; cin >> a;
        v1.push_back(a);
        v2.push_back(a);
    }
    sort(v2.begin(), v2.end());
    int ave = (v2[n/2]+v2[n/2-1])/2;
    for(int i=0; i<n; ++i){
        if(v1[i]<=ave) cout << v2[n/2] << endl;
        else cout << v2[n/2-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3948
# coding: utf-8

n = int(input())
(t, a) = [int(i) for i in input().rstrip().split(" ")]

point_list = [int(i) for i in input().rstrip().split(" ")]

ans = -1
nearest = 100000

for i in range(n):
    kion = abs(t - (point_list[i] * 0.006) - a)
    if kion < nearest:
        ans = i + 1
        nearest = kion

print(ans)


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

int main(){
	int n ;
  	cin>> n;
    int k ;
    cin>>k;
  	vector <int> a(n) , dp(n , INF);
  	for(auto &i : a) 
      	cin>>i;
 	
  	dp[0] = 0;
  	
    for(int i = 0 ; i <n ; i++)
    {
        for(int j= i + 1 ; j <= i + k ; j++)
        {
            if(j < n )
            dp[j] = min(dp[j] , dp[i] + abs(a[i] - a[j]));
        }
    }
  
  	cout<<dp[n-1]<<endl;
	return 0;
}

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

int main(){

	int n;
	int sd[3];
	int max,m=-1;
	bool isRect=false;
	bool isTri=true;

	cin>>n;

	for(int i=0;i<n;++i){
		cin>>sd[0]>>sd[1]>>sd[2];
		//長辺の判定
		max=0;
		for(int i=0;i<3;++i){
			if(sd[i]==0){isTri=false;}
			if(sd[i]>max){m=i;max=sd[i];}
		}

		//直角三角形の判定
		if(isTri){
			switch(m){
			case 0:
				if(sd[0]*sd[0] == (sd[1]*sd[1] + sd[2]*sd[2])){isRect=true;}else{isRect=false;}
				break;
			case 1:
				if(sd[1]*sd[1] == (sd[0]*sd[0] + sd[2]*sd[2])){isRect=true;}else{isRect=false;}
				break;
			case 2:
				if(sd[2]*sd[2] == (sd[1]*sd[1] + sd[0]*sd[0])){isRect=true;}else{isRect=false;}
				break;
			}
		}

		if(isRect){cout<<"YES\n";}else{cout<<"NO\n";}

	}
}

Measured memory_bytes: 1120
#include <bits/stdc++.h> // imports every library in c++
using namespace std; // ; is essential | says that you are USING the libraries

// PRACTICE //

int H, W, h, w;

int main() {
    cin >> H;
    cin >> W;
    cin >> h;
    cin >> w;
    int size = H * W;
    int black = h * W + (H * w - h * w);
    cout << size  - black;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof x)
#define copy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair < int, int > pa;

inline int read()
{
	int sc = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') sc = sc * 10 + ch - '0', ch = getchar();
	return sc * f;
}

const int MAXN = 1005;
const int mod = 1e9 + 7;

int n, dep[MAXN], fa[MAXN], S, T, dia, cg, cg2, f[MAXN][MAXN], ans;
vector < int > G[MAXN];

inline void inc(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline void dec(int &x, int y) { x -= y; if (x < 0) x += mod; }

inline void dfs(int x, int d)
{
	dep[x] = d;
	for (auto y : G[x]) if (y ^ fa[x]) fa[y] = x, dfs(y, d + 1);
}

inline void find_dia()
{
	dfs(1, 0);
	fill(fa, 0);
	for (int i = 1; i <= n; i ++) if (dep[i] > dep[S]) S = i;
	dfs(S, 0);
	for (int i = 1; i <= n; i ++) if (dep[i] > dep[T]) T = i;
	dia = dep[cg = T];
	for (int i = 1; i <= dep[T] >> 1; i ++) cg = fa[cg];
	if (dep[T] & 1) cg2 = fa[cg];
}

inline void dp(int x, int fa, int dep, int len)
{
	for (auto y : G[x]) if (y ^ fa) dp(y, x, dep + 1, len);
	for (int i = dep - len; i <= len - dep; i ++)
	{
		f[x][i + 502] = 1;
		for (auto y : G[x]) if (y ^ fa) f[x][i + 502] = 1LL * f[x][i + 502] * (f[y][i + 1 + 502] + f[y][i - 1 + 502]) % mod;
	}
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = read();
	for (int i = 1, x, y; i < n; i ++) x = read(), y = read(), G[x].pb(y), G[y].pb(x);
	find_dia();
	if (dia & 1)
	{
		dp(cg, cg2, 0, dia >> 1); dp(cg2, cg, 0, dia + 1 >> 1);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) inc(ans, 1LL * f[cg][i + 502] * (f[cg2][i + 1 + 502] + f[cg2][i - 1 + 502]) % mod);
		fill(f, 0);
		dp(cg, cg2, 0, dia + 1 >> 1); dp(cg2, cg, 0, dia >> 1);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) inc(ans, 1LL * f[cg2][i + 502] * (f[cg][i + 1 + 502] + f[cg][i - 1 + 502]) % mod);
		fill(f, 0);
		dp(cg, cg2, 0, dia >> 1); dp(cg2, cg, 0, dia >> 1);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) dec(ans, 2LL * f[cg][i + 502] * f[cg2][i + 502] % mod);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) dec(ans, 1LL * f[cg][i + 502] * f[cg2][i + 2 + 502] % mod);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) dec(ans, 1LL * f[cg][i + 502] * f[cg2][i - 2 + 502] % mod);
		return printf("%d\n", ans), 0;
	}
	else
	{
		dp(cg, 0, 0, dia >> 1);
		for (int i = - (dia >> 1); i <= (dia >> 1); i ++) inc(ans, f[cg][i + 502]);
		return printf("%d\n", ans), 0;
	}
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int h,n;
	cin>>h>>n;
	int sum=0;
	rep(i,n){
		int a;
		cin>>a;
		sum+=a;
	}
	if(sum>=h){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	re 0;
}

Measured memory_bytes: 256
//control+option+n to run!
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector <long long>
#define sll set <long long>
#define ld long double
#define inf 1000000000000000000;
#define mll multiset <long long>
#define nn <<"\n"
#define F(i,b) for (ll i=0, i<b; i++)
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18

//ALL FUNCTIONS SHOULD BE LL!!!!
long long power(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = power(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}


ll log(ll base, ll number)
{

  int x = base;
  int count = 1;
  while (base < number)
  {
    base *= x;
    count++;
  }
  return count;
}

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

  ll n,k;
  cin>>n>>k;
  vll v(n);
  FOR (i,0,n){
    cin>>v[i];
  }

  sort (v.begin(),v.end());
  ll ans=0;

  FOR (i,0,k){
    ans+=v[i];
  }
  cout<<ans;

  cout << "\n"; //GET RID OF THIS FOR THE ACTUAL PROGRAM!!!!
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
/*using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) (int)s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
//int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
bool is(string &s)
{
    string t = s;
    reverse(all(t));
    return (s==t);
}
signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
       long double x;
       cin>>x;
       x = x*x*x;
       x/=27.0;
       cout<<fixed<<setprecision(8)<<x<<el;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,x[100010],y[100010],a[100010],b[100010],Ysum=0;
    ll X[100010],Y[100010],ans=0;
    cin>>n>>m;
    rep(i,n) cin>>x[i];
    rep(i,m) cin>>y[i];
    rep(i,n-1){
        a[i]=(i+1)*(n-1-i)%MOD;
        // cout<<a[i]<<endl;
    }
    rep(i,m-1){
        b[i]=(i+1)*(m-1-i)%MOD;
        // cout<<b[i]<<endl;
    }
    rep(i,n-1){
        X[i]=(x[i+1]-x[i])*a[i];
        X[i]%=MOD;
        // cout<<X[i]<<endl;
    }
    rep(i,m-1){
        Y[i]=(y[i+1]-y[i])*b[i];
        Y[i]%=MOD;
        Ysum+=Y[i];
        // cout<<Y[i]<<endl;
    }
    Ysum%=MOD;
    // cout<<endl;
    rep(i,n-1){
        ans+=(X[i]*Ysum);
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

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

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

	int ans = 0;
	for (int i = 1; i <= n; i+=2) {
		int cnt = 0;
		for (int j = 1; j <= i; j+=2) {
			if (i%j == 0) cnt++;
		}
		if (cnt == 8) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> //std::priority_queue<int> que; // 4, 3, 2, 1 (defualt, less) : 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>  // std::accumulate(m.begin(), m.end(), 0LL);
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  ll N, M; std::cin >> N >> M;
 
  if ( N >= 3 && M >= 3 ) {
    std::cout << (N-2) * (M-2) << std::endl;
  }
  else {
    int ans = 0;
    for(int i=0; i<N; i++) {
      for(int j=0; j<M; j++) {
        int cnt = 1;
        if ( i-1>=0 ) cnt++;
        if ( i-1>=0 && j+1<M  ) cnt++;
        if ( i-1>=0 && j-1>=0 ) cnt++;
        if ( j-1 >= 0 ) cnt++;
        if ( j+1 < M ) cnt++;
        if ( i+1 < N ) cnt++;
        if ( i+1 < N && j+1<M) cnt++;
        if ( i+1 < N && j-1>=0) cnt++;
        if ( cnt % 2 == 1 ) ans++;
      }
    }
    std::cout << ans << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

    int N = sc.nextInt();
    int[] sumArray = new int[101];
    int d;
    int count = 0;

    for (int i=0; i < N; i++) {
      d = sc.nextInt();
      sumArray[d] += 1;
    }

    for (int i=0; i < 101; i++) {
      if (sumArray[i] != 0) {
        count += 1;
      }
    }

    System.out.println(count);
  }
}


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

int main() {
  int n; cin >> n;
  int a[20], x[20][20], y[20][20];
  rep(i, n) {
    cin >> a[i];
    rep(j, a[i]) {
    cin >> x[i][j] >> y[i][j]; x[i][j]--;
    }
  }
  int ans = 0;
  for (int s = 0; s < (1<<n); s++) {
    bool flog = 1;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (s & (1<<i)) {
        cnt++;
        for (int j = 0; j < a[i]; j++) {
          if (y[i][j] && !(s & 1<<x[i][j])) flog = 0;
          if (!y[i][j] && (s & 1<<x[i][j])) flog = 0;
        }
      }
    }
    if (flog) ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		int cnt = 1;
		while (x * 2 <= y) {
			cnt++;
			x *= 2;
		}
		System.out.println(cnt);
	}
}


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

using static Input;
//using static Util;
class Program
{
    static long N;
    static long K;
    static void INPUT()
    {
        N = NextLong();
        K = NextLong();
    }
    static void OUT()
    {
        var hs = new HashSet<long>();
        var n = N % K;
        while (hs.Add(n)) n = Math.Abs(n - K);
        
        Console.WriteLine(hs.Min());
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}




Measured memory_bytes: 13396
n = int(input())
sqrt = round(n ** 0.5) + 1
f_min = float('inf')
for i in range(1, sqrt + 1):
    if not n % i:
        a = str(i)
        b = str(n // i)
        f = max(len(a), len(b))
        f_min = min(f_min, f)
print(f_min)

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

using namespace std;

const int MAXN = 1e5 + 10;

int n;
long long arr[MAXN];
vector<int> adj[MAXN];
bool CANT = false;

long long dfs(int v, int par = 0) {
	long long all = 0, mx = 0;
	for (auto e : adj[v]) 
		if (e != par) {
			long long g = dfs(e, v);
			all += g;
			mx = max(mx, g);
		}
	if (adj[v].size() == 1)
		return arr[v];
	if (all < arr[v]) {
		CANT = true;
		return 0;
	}
	long long needed = all - arr[v];
	long long nmat = 0;
	if ((all - mx) < mx)
		nmat = all - mx;
	else
		nmat = all / 2;
	if (nmat < needed) {
		CANT = true;
		return 0;
	}
	return all - 2 * needed;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	for (int i = 1; i < n; i++) {
		int u, v; cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	if (n == 2) {
		if (arr[1] == arr[2])
			return cout << "YES\n", 0;
		return cout << "NO\n", 0;
	}
	for (int i = 1; i <= n; i++)
		if (adj[i].size() > 1) {
			if (dfs(i) || CANT) 
				return cout << "NO\n", 0;
			return cout << "YES\n", 0;
		}
	return 0;
}

Measured memory_bytes: 13184