akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

public static class Test
{

    public static IEnumerable<S> Scan<T, S>(this IEnumerable<T> ie, S init, Func<S, T, S> predicate)
    {
        var sum = init;
        foreach(var x in ie)
        {
            yield return sum = predicate(sum, x);
        }
    }
    
    public static IEnumerable<T> StartWith<T>(this IEnumerable<T> ie, T init)
    {
        yield return init;
        foreach(var x in ie)
            yield return x;
    }
    
    public static void Main()
    {
        int.Parse(Console.ReadLine());
        IEnumerable<char> directions = Console.ReadLine();
        
        var s0 = new {
                cost = directions.Count(x => x == 'E'),
                prev = 'E'
            };
        
        var costs = directions
            .Scan(
                s0,
                (s, x) => new {
                    cost = (s.cost + (s.prev == 'W' ? 1 : 0) - (x == 'E' ? 1 : 0)),
                    prev = x
                })
            .Select(x => x.cost);
        
        Console.WriteLine(costs.Min());
    }
}


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

int main(){
  int a, b; cin >> a >> b;
  if(a == 1 && b == 2) cout << 3 << endl;
  else if(a == 1 && b == 3) cout << 2 << endl;
  else if(a == 2 && b == 1) cout << 3 << endl;
  else if(a == 2 && b == 3) cout << 1 << endl;
  else if(a == 3 && b == 1) cout << 2 << endl;
  else if(a == 3 && b == 2) cout << 1 << endl;

  return 0;
}


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define fst first
#define snd second
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'

typedef long long ll;

int main() {
  string s;
  cin >> s;
  int n = s.size() - 1;
  if(s[n] == '2' || s[n] == '4' || s[n] == '5' || s[n] == '7' || s[n] == '9') cout << "hon" << endl;
  else if(s[n] == '0' || s[n] == '6' || s[n] == '8' || s[n] == '1') cout << "pon" << endl;
  else cout << "bon" << endl;
  return 0;
}

Measured memory_bytes: 3600
<?php
// Your code here!
    list($a,$b,$c,$d) = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    while(true){
        $c = $c -$b;
        // echo $c;
        if($c<=0){
            echo "Yes\n";
            break;
        }
        $a = $a -$d;
        if($a<=0){
            echo "No\n";
            break;
        }
    }
?>

Measured memory_bytes: 16232
import collections
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        S = input().rstrip()
        K = int(input())

        if len(collections.Counter(S)) == 1:
            print((len(S) * K) // 2)
            exit()

        k1 = self.connection_and_disconnection(S)
        k2 = self.connection_and_disconnection(S * 2)

        ans = k1 + (k2 - k1) * (K - 1)
        print(ans)

    def connection_and_disconnection(self, S: str):
        S = S + '$'
        cont_same_letter = 1
        need_to_change = 0
        for i in range(len(S) - 1):
            if S[i] == S[i + 1]:
                cont_same_letter += 1
            else:
                need_to_change += cont_same_letter // 2
                cont_same_letter = 1
        return need_to_change


# Run main
if __name__ == '__main__':
    AtCoder().main()


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

void solve(long long N, std::vector<long long> h) {
  long long ans = 0;
  // vector<int> deq;
  h.push_back(0);
  for (int i = 0; i < N; i++) {
    long long val = h[i] - h[i + 1];
    if (val > 0) ans += val;
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> h(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &h[i]);
  }
  solve(N, std::move(h));
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);

  if(((A<B) && (A<C) && (C<B)) ||
     ((B<A) && (B<C) && (C<A))) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


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

int n;
int a[100005];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    cout<<a[n/2]-a[n/2-1]<<endl;

    return 0;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            a.add(scanner.nextInt());
        }
        for (int i = a.size() - 1; i >= 0; i--) {
            System.out.print(a.get(i));
            if (i != 0) {
                System.out.print(" ");
            }
        }
        System.out.println("");
    }
}



Measured memory_bytes: 26264
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

const int INF = 1e9;
const int MAX = 1e5*2;

int main() {
    int n;
    cin >> n;
    vector<int> w;
    for (int i = 1; i <= n; i *= 6) w.push_back(i);
    for (int i = 9; i <= n; i *= 9) w.push_back(i);
    int x = w.size(), dp[MAX];
    fill(dp, dp+MAX, INF);
    dp[0] = 0;
    for (int i = 0; i < x; i++) {
        for (int j = w[i]; j <= n; j++) {
            chmin(dp[j], dp[j - w[i]] + 1);
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)



typedef long long ll;
template<int um> class UF { // from kmjp
public:
	vector<int> par;
	UF() { par = vector<int>(um, 0); rep(i, 0, um) par[i] = i; }
	int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
	void operator()(int x, int y)
	{
		x = operator[](x); y = operator[](y);
		if (x != y) par[x] = y;
	}
};
//-----------------------------------------------------------------
int N, M;
tuple<int, int, int> buf[404040];
int D[4040][4040];
UF<4040> uf;
vector<pair<int, int>> E[4040];
//-----------------------------------------------------------------
void dfs(int st, int cur, int par, int ma) {
	D[st][cur] = ma;

	for (auto p : E[cur]) if (p.first != par) dfs(st, p.first, cur, max(ma, p.second));
}
//-----------------------------------------------------------------
int main() {
	cin >> N >> M;
	rep(i, 0, M) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		buf[i] = make_tuple(c, a, b);
	}
	sort(buf, buf + M);

	ll sm = 0;
	rep(i, 0, M) {
		int a = get<1>(buf[i]);
		int b = get<2>(buf[i]);
		int c = get<0>(buf[i]);

		if (uf[a] != uf[b]) {
			uf(a, b);
			E[a].push_back(make_pair(b, c));
			E[b].push_back(make_pair(a, c));
			sm += c;
		}
	}

	rep(i, 1, N + 1) dfs(i, i, -1, 0);

	int Q; cin >> Q;
	rep(i, 0, Q) {
		int s, t;
		scanf("%d %d", &s, &t);

		ll ans = sm - D[s][t];
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 69632
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

unordered_map<int, int> m;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int s;
    cin >> s;
    m[s] = 1;
    for (int i = 2; i <= 1000000; ++i)
    {
        if (s % 2)
            s = 3 * s + 1;
        else
            s = s / 2;
        if (m[s])
            return cout << i, 0;
        m[s] = 1;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;  
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int N, Z, W;
  cin >> N >> Z >> W;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  if (N == 1)
    cout << abs(a[0]-W) << endl;
  else
    cout << max({abs(a[N-1]-W), abs(a[N-2]-a[N-1])}) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define fi first
#define se second 
#define pb push_back
#define sci(x) scanf("%d",&(x))
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
const int N=2e5+10,M=1e6+10,INF=0x3f3f3f3f,mod=1e9+7;//998244353
vector<int>e[N],deg[2];
queue<int>now[3];
int n,u,v,len[3],du[2],ans[N];
bool used[N];
void dfs(int u,int fa,int d){
	deg[d%2].pb(u);
	for(int v:e[u]){
		if(v==fa)continue;
		dfs(v,u,d+1);
	}
}
void out(){
	rep(i,1,n){
		printf("%d%c",ans[i]," \n"[i==n]);
	}
}
void solve(){
	//odd:du[0] even:du[1] 
	if(len[1]<=du[0]&&du[0]<=len[1]+len[0]){
		for(int i:deg[0]){
			if(now[1].size())ans[i]=now[1].front(),now[1].pop();
			else if(now[0].size())ans[i]=now[0].front(),now[0].pop();
		}
		for(int i:deg[1]){
			if(now[2].size())ans[i]=now[2].front(),now[2].pop();
			else if(now[0].size())ans[i]=now[0].front(),now[0].pop();
		}
		out();
		return;
	}
	if(len[1]<=du[1]&&du[1]<=len[1]+len[0]){
		for(int i:deg[1]){
			if(now[1].size())ans[i]=now[1].front(),now[1].pop();
			else if(now[0].size())ans[i]=now[0].front(),now[0].pop();
		}
		for(int i:deg[0]){
			if(now[2].size())ans[i]=now[2].front(),now[2].pop();
			else if(now[0].size())ans[i]=now[0].front(),now[0].pop();
		}
		out();
		return;
	}
	if(len[0]>=du[0]){
		for(int i:deg[0]){
			ans[i]=now[0].front(),now[0].pop();
		} 
		for(int i:deg[1]){
			if(now[0].size())ans[i]=now[0].front(),now[0].pop();
			else if(now[1].size())ans[i]=now[1].front(),now[1].pop();
			else if(now[2].size())ans[i]=now[2].front(),now[2].pop();
		}
		out();
		return;
	}
	if(len[0]>=du[1]){
		for(int i:deg[1]){
			ans[i]=now[0].front(),now[0].pop();
		} 
		for(int i:deg[0]){
			if(now[0].size())ans[i]=now[0].front(),now[0].pop();
			else if(now[1].size())ans[i]=now[1].front(),now[1].pop();
			else if(now[2].size())ans[i]=now[2].front(),now[2].pop();
		}
		out();
		return;
	}
	puts("-1");
}
int main(){
	scanf("%d",&n);
	rep(i,1,n-1){
		scanf("%d%d",&u,&v);
		e[u].pb(v);
		e[v].pb(u);
	}
	rep(i,1,n){
		now[i%3].push(i);
	}
	dfs(1,-1,0);
	rep(i,0,1){
		du[i]=(int)deg[i].size();
	}
	rep(i,0,2){
		len[i]=(int)now[i].size();
	}
	solve();
	return 0;
}

Measured memory_bytes: 22260
#include <iostream>

using namespace std;

int main()
{
	string str;
	int count = 0;
	int index = 0;

	cin >> str;
	while (str[index])
		if (str[index++] == 'x')
			++count;

	str = (count > 7) ? "NO" : "YES";
	cout << str << endl;
}

Measured memory_bytes: 256
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int N;

bool judge(vector<int> a, vector<int> b){
    rep(i, N){
        if(a[i] != b[i]){
            return false;
        }
    }

    return true;
}

int main()
{
    int a = 0,b = 0,c = 0;
    cin >> N;
    vector<int> p(N);
    vector<int> q(N);

    rep(i, N){
        cin >> p[i];
    }

    rep(i, N){
        cin >> q[i];
    }

    vector<int> order(N);
    rep(i, N){
        order[i] = i + 1;
    }

    do{
        c++;
        if(judge(p,order)){
            a = c;
        }

        if(judge(q,order)){
            b = c;
        }
    }while(next_permutation(all(order)));

    cout << abs(a - b) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N: int, M: int, a: "List[int]"):
    if(len(a) >= 2):
        l = [a[i+1]-a[i] for i in range(M-1)]
        if(len(l) and min(l)<=1):
            print(0)
            exit()

    dp = [1] * (N+1)
    dp[1] = 1
    if(N >= 2):
        dp[2] = 2
    x = 0
    # if(M == 0):
    #     for i in range(2,N+1)
    
    for i in range(2,N+1):
        if(len(a) and a[x] == i-1):
            dp[i] = dp[i-2] % MOD
            # x = min(x+1,M-1)
        elif(len(a) and a[x] == i-2):
            dp[i] = dp[i-1] % MOD
            x = min(x+1,M-1)
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD
    
    print(dp[N])
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 7848
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);


int main (){
  ll x;
  cin>>x;
  x=x*x*x;
  cout<<x<<endl;
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

bool check(int num)
{
	string s = to_string(num);

	for (int i = 0; i <= s.size() / 2; i++)
	{
		if (s[i] != s[s.size() - i - 1])
		{
			return false;
		}
	}

	return true;
}

int main()
{
	int A, B;
	int ans = 0;
	cin >> A >> B;

	for (int i = A; i <= B; i++)
	{
		if (check(i))
		{
			ans++;
		}
	}

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

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int N;
int P[111111];

signed main(){
	cin>>N;
	rep(i,N)cin>>P[i];
	vint ord(N);iota(all(ord),0);
	sort(all(ord),[&](int i,int j){
		return P[i]>P[j];
	});

	set<int>idx;
	int ans=0;
	for(auto i:ord){
		vint v(4);
		auto it=idx.lower_bound(i);
		if(it==idx.end())v[2]=v[3]=N;
		else{
			v[2]=*it;
			it++;
			if(it==idx.end())v[3]=N;
			else v[3]=*it;
		}
		it=idx.lower_bound(i);
		if(it==idx.begin()){
			v[0]=v[1]=-1;
		}
		else{
			it--;
			v[1]=*it;
			if(it==idx.begin())v[0]=-1;
			else{
				it--;
				v[0]=*it;
			}
		}
		ans+=(v[3]-v[2])*(i-v[1])*P[i];
		ans+=(v[2]-i)*(v[1]-v[0])*P[i];
		idx.insert(i);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6528
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

cnt = 0

lose_flag = [0] * n
for j in range(m):
    if h[a[j]-1] < h[b[j]-1]:
        lose_flag[a[j]-1] = 1
    elif h[a[j]-1] > h[b[j]-1]:
        lose_flag[b[j]-1] = 1
    elif h[a[j]-1] == h[b[j]-1]:
        lose_flag[a[j]-1] = 1
        lose_flag[b[j]-1] = 1

cnt += lose_flag.count(0)

print(cnt)

Measured memory_bytes: 21808
H, W = map(int, input().split())
while not (H==0 and W==0):
    print("#"*W)
    for i in range(H-2):
        print("#",end="")
        print("."*(W-2),end="")
        print("#")
    print("#"*W)
    print()
    H, W = map(int, input().split())



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

int main()
{
	long long int k, a, b;

	cin >> k >> a >> b;

	long long int diff = b - a;

	if (b - a <= 2) {
		cout << k + 1 << endl;
	}
	else {
		if (k - 2 + 1 < a) {
			cout << k + 1 << endl;
		}
		else {
			long long int ans = a;

			k -= a - 1;

			long long int p = k / 2;

			ans += diff * p;

			if (k % 2 == 1) {
				ans++;
			}

			cout << ans << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  int a,b;
  cin >> a >> b;
  cout << a*b << " " << (a+b)*2 << endl;
}


Measured memory_bytes: 3088
// atcoder/abc162/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int n;
  while (cin >> n) {
    lli sum = 0;
    for (int i = 1; i <= n; ++i) {
      if (i % 3 == 0) continue;
      if (i % 5 == 0) continue;
      sum += i;
    }
    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<limits>
#include<tuple>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define ll long long int

int main() {
	int n, k;
	cin >> n >> k;
	vi c(n + 1, 1);
	for (int i = 1; i <= n; i++) {
		int j = i;
		while (j < k) {
			j *= 2;
			c[i]++;
		}
	}

	long double s = 0.0;

	for (int i = 1; i <= n; i++) {
		s += pow(0.5, (double)(c[i]) - 1);
	}

	s /= n;

	cout << setprecision(10) << s << endl;

}


Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
	int n,a,x;
	scanf("%d %d",&n,&a);
	x=n/500;
	n=n%500;
	if(a<n){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 128
eval(%w(
          TRE
         ES,MA
        KE   UP
      =ge     ts.
     ch        omp
    .sp         li
    t(32.chr).map(&
    :to         _i)
    ;he         igh
    t=[         ];m
    
    
         in=nil;
      TREES.times{;
    hei          ght<
   <ge            ts.t
  o_i;             };he
  ight                 
  .sor                 
   t!;0            .upt
    o(TR          EES-
      MAKE      UP){
         |i|;if(

    min=   =nil   )||(
    (hei   ght[   i+MA
    KEUP   -1]-   heig
    ht[i   ])<m   in);
    min=   heig   ht[i
    +MAK   EUP-   1]-h
    eigh   t[i]   ;end

    ;};p   uts(   min);

).join)
#AC

Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; 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 INF 999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
4
1 -3 1 0
)");
#define cin input
#endif

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

	ll count1, count2, sum1, sum2;
	count1 = count2 = sum1 = sum2 = 0;
	vector<ll> a(n);
	REP(i,n)
		cin >> a[i];
	ll a0 = a[0];

	while (a[0]<=0)
	{
		a[0]++;
		count1++;
	}
	sum1 = a[0];
	FOR (i, 1, n)
	{
		sum1 += a[i];
		if (i%2==1)
		{
			while (sum1>=0)
			{
				sum1--;
				count1++;
			}
		}
		else
		{
			while (sum1<=0)
			{
				sum1++;
				count1++;
			}
		}
	}
	a[0] = a0;

	while (a[0]>=0)
	{
		a[0]--;
		count2++;
	}
	sum2 = a[0];
	FOR (i, 1, n)
	{
		sum2 += a[i];
		if (i%2==1)
		{
			while (sum2<=0)
			{
				sum2++;
				count2++;
			}
		}
		else
		{
			while (sum2>=0)
			{
				sum2--;
				count2++;
			}
		}
	}

	if (count1 >= count2)
		cout << count2 << endl;
	else
		cout << count1 << endl;
}
	

Measured memory_bytes: 1024
def main():
    n = int(input())
    A = list(map(int, input().split()))

    A = sorted(A)
    x = A[-1]
    del A[-1]
    b = x / 2

    m = 10**9
    y = A[0]
    for a in A:
        mm = abs(a - b)
        if mm < m:
            m = mm
            y = a

    print(x, y)


main()


Measured memory_bytes: 14428
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	int N;
	int[]a;
	int[]b;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		a=new int[N-1];
		b=new int[N-1];
		ArrayList<Integer>[] path=new ArrayList[N];
		int []dist_1=new int[N];
		int []dist_N=new int[N];
		boolean[] visited=new boolean[N];
		dist_1[0]=0;
		dist_N[N-1]=0;
		for(int i=0;i<N;i++){
			path[i]=new ArrayList<Integer>();
		}
		for(int i=0;i<N-1;i++){
			a[i]=sc.nextInt()-1;
			b[i]=sc.nextInt()-1;
			path[a[i]].add(b[i]);
			path[b[i]].add(a[i]);
		}
		
		Queue<Integer> nowq=new LinkedList<Integer>();
		
		nowq.add(0);
		int count=0;
		boolean flag=true;
		
		while(flag){
			flag=false;
			Queue<Integer> nextq=new LinkedList<Integer>();
			while(!nowq.isEmpty()){
				int now=nowq.poll();
				visited[now]=true;
				dist_1[now]=count;
			
				for(int i=0;i<path[now].size();i++){
					int to=path[now].get(i);
					if(!visited[to]){
						nextq.add(to);
						flag=true;
					}
				}
			}
			
			nowq=nextq;
			count++;
		}
		
		nowq.add(N-1);
		count=0;
		flag=true;
		Arrays.fill(visited, false);
		while(flag){
			flag=false;
			Queue<Integer> nextq=new LinkedList<Integer>();
			while(!nowq.isEmpty()){
				int now=nowq.poll();
				visited[now]=true;
				dist_N[now]=count;
			
				for(int i=0;i<path[now].size();i++){
					int to=path[now].get(i);
					if(!visited[to]){
						nextq.add(to);
						flag=true;
					}
				}
			}
			
			nowq=nextq;
			count++;
		}
		
		int snukeCount=0;
		int fennecCount=0;
		for(int i=0;i<N;i++){
			if(dist_1[i]<=dist_N[i])fennecCount++;
			else snukeCount++;
		}
		
		if(fennecCount>snukeCount)System.out.println("Fennec");
		else System.out.println("Snuke");
		
	}
}


Measured memory_bytes: 106860
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=5e5+5,M=5e3+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
ll fac[N],ifac[N];
il ll C(int n,int m){
	if(n<0||m<0||n<m)return 0;
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
ll H,W,A,B;
int main(){
	read(H,W);read(A,B);int lim=2e5;
	fac[0]=1;rep(i,1,lim)fac[i]=fac[i-1]*i%mod;
	ifac[lim]=qpow(fac[lim],mod-2,mod);
	repd(i,lim-1,0)ifac[i]=ifac[i+1]*(i+1)%mod;
	ll res=0,x=H-A,y=B+1;
	while(1){
		(res+=C(x-1+y-1,x-1)*C(H-x+W-y,W-y))%=mod;
		x--;y++;
		if(!x||y>W)return printf("%lld\n",res),0;
	}
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
//vvi(n, vector<int>(m, -1))
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()
#define out(x) cout << (x) << endl;

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n;
  ll a[100005];
  rep(i, n) cin >> a[i];

  ll sum = 0;
  f = 0;
  rep(i, n){
    sum += abs(a[i]);
    if(a[i] < 0){
      a[i] *= -1;
      f++;
    }
    
  }

  sort(a, a+n);

  if(f%2 == 0) cout << sum << endl;
  else cout << sum - a[0]*2 << endl;

  

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n;
    cin >> n;
    if (n>1799)
        cout << 1 << endl;
    else if (n>1599)
        cout << 2 << endl;
    else if (n>1399)
        cout << 3 << endl;
    else if (n>1199)
        cout << 4 << endl;\
    else if (n>999)
        cout << 5 << endl;
    else if (n>799)
        cout << 6 << endl;
    else if (n>599)
        cout << 7 << endl;
    else
        cout << 8 << endl;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <time.h>
#include <vector>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <memory.h>
#include <cstdlib>
#include <queue>
#include <iomanip>
// #include <unordered_map>
#define P pair<int, int>
#define LL long long
#define LD long double
#define PLL pair<LL, LL>
#define mset(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for (int i = a; i < b; i++)
#define PI acos(-1.0)
#define random(x) rand() % x
#define debug(x) cout << #x << " " << x << "\n"
using namespace std;
const int inf = 0x3f3f3f3f;
const LL __64inf = 0x3f3f3f3f3f3f3f3f;
#ifdef DEBUG
const int MAX = 1e4 + 50;
#else
const int MAX = 1e6 + 50;
#endif
const int mod = 1e9 + 7;

int a[MAX];
int main(){
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    int n;
    scanf("%d", &n);
    int Max = 0;
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        Max = max(Max, a[i]);
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        cnt += a[i] == Max;
    }
    int Max2 = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] < Max){
            Max2 = max(Max2, a[i]);
        }
    }
#ifdef DEBUG
    debug(MAX);
    debug(Max2);
#endif
    for(int i = 1; i <= n; i++){
        if(a[i] == Max){
            printf("%d\n", cnt == 1 ? Max2 : Max);
        }
        else printf("%d\n", Max);
    }
    return  0;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

vector<ll> a;
map<P,ll> mem[20][20];
ll dfs(ll l,ll r,ll xl,ll xr){
  if(mem[l][r].count(P(xl,xr)))return mem[l][r][P(xl,xr)];

  if(l+1==r){
    return 0;
  }

  ll res=INF;
  repl(i,l+1,r){
    minch(res,dfs(l,i,xl,xl+xr)+dfs(i,r,xl+xr,xr)+(xl+xr)*a[i]);
  }

  return mem[l][r][P(xl,xr)]=res;
}

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

  ll n;
  cin>>n;
  a.resize(n);
  rep(i,n)cin>>a[i];

  cout<<dfs(0,n-1,1,1)+a[0]+a[n-1]<<endl;

  return 0;
}


Measured memory_bytes: 16640
import java.util.Scanner;

public class Main {
	
	public int search(int[] s, int value) {
		int left = 0;
		int right = s.length - 1;
		while( left <= right) {
			int med = (left+right) / 2;
			
			if(value == s[med]) {
				return 1;
			}
			if(value < s[med]) {
				right = med - 1;
			}
			else {
				left = med + 1;
			}
		}
		return 0;
	}
	
	
//	public boolean prime(int x) {
//		
//		if(x < 2) {
//			return false;
//		}
//		if(x == 2) {
//			return true;
//		}
//		for(int i = 2; i <= Math.sqrt(x); i++) {
//			if(x % i == 0) {
//				return false;
//			}
//		}
//		return true;
//	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Main program = new Main();
		int results = 0;
		//System.out.println("enter");
		
		int ssize = in.nextInt();
		int[] s = new int[ssize];
		for(int i= 0; i < ssize; i++) {
			s[i] = in.nextInt();
		}
		
		int tsize = in.nextInt();
		int[] t = new int[tsize];
		for(int i = 0; i < tsize; i++) {
			t[i] = in.nextInt();
		}
		
		for(int i =0; i < tsize; i++) {
			if((program.search(s, t[i])) == 1){
				results++;
			}
		}
		
		System.out.println(results);
		
//		for(int i = 0; i < size; i++) {
//			int value = in.nextInt();
//			if(program.prime(value) == true) {
//				results++;
//			}
//		}
//		System.out.println(results);
	}
}



Measured memory_bytes: 68764
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t N;
	std::cin >> N;
	std::vector<int64_t> A(N);
	for(int64_t i = 0; i < N; i++) {
		std::cin >> A[i];
	}

    std::vector<size_t> indices(A.size());
    std::iota(indices.begin(), indices.end(), 0);

	std::sort(indices.begin(), indices.end(), [&A](size_t i1, size_t i2) {
	return A[i1] < A[i2];
	});

    for (auto v : indices) {
	    std::cout << v + 1 << " ";
	}
    std::cout << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 2432
#ifndef _WIN32
#include<iostream>
#endif

using namespace std;
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<string.h>


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

typedef vector<int> V;
typedef vector<V> VV;
typedef long long LL;
template<typename T>
bool chmin(T &l, T r) {
	bool f = l > r; if (f)l = r; return f;
}
template<typename T>
bool chmax(T &l, T r) {
	bool f = l < r; if (f)l = r; return f;
}
VV wrap(VV vs, int c) {
	int R = vs.size();
	int C = vs[0].size();
	VV ret(R + 2, V(C + 2, c));
	REP(i, R)REP(j, C)ret[i + 1][j + 1] = vs[i][j];
	return ret;
}
const int dr[] = { 0,0,-1,1 ,1,1,-1,-1 };
const int dc[] = { -1,1,0,0, -1,1,-1,1 };
string S;
int id;
VV g;
LL rep[1123];
LL len[1123];
char type[1123];
LL parseInt() {
	LL ret = 0;
	while (isdigit(S[id])) {
		ret *= 10;
		ret += S[id] - '0';
		id++;
	}
	return ret;
}
V parse() {
	V ret;
	id++;
	while (S[id] != ')') {
		g.push_back({});
		int v = g.size();
		ret.push_back(v);
		if (isdigit(S[id])) {
			rep[v] = parseInt();
			if (S[id] == '(') {
				type[v] = '-';
				g[v] = parse();
			}
			else {
				type[v] = S[id++];
			}
		}
		else {
			rep[v] = 1;
			type[v] = S[id++];
		}
	}
	id++;
	return ret;
}
const LL INF = 1e9;
LL dfs(int v) {
	if (type[v] == '-') {
		len[v] = 0;
		for (auto &it : g[v])len[v] += dfs(it);
		chmin(len[v], INF);
	}
	else {
		len[v]=1;
	}
	return min(len[v]*rep[v],INF);
}
char f(int v,LL x){
	if (type[v] == '-') {
		x %= len[v];
		for (auto &u : g[v])
			if (x < len[u] * rep[u])return f(u, x);
			else x -= len[u] * rep[u];
	}
	else {
		return type[v];
	}

}
int main() {
	LL x;
	while (cin >> S >> x, S != "0") {
		S = "(" + S + ")";
		id = 0;
		g.clear();
		g.push_back({});
		rep[0] = 1;
		type[0] = '-';
		g[0] = parse();
		LL all=dfs(0);
		if (all <= x)cout << 0 << endl;
		else cout << f(0,x) << endl;
	}




}

Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 1;
  for (int i = 0; i < N - 1; i++) {
    if (S.at(i) != S.at(i + 1)) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3732
#include <cstdio>
using namespace std;

int main(void)
{
    int n;
    int ans1, ans2;
    while(1) {
        scanf("%d", &n);
        if(n == 0) break;
        ans1 = ans2 = 0;
        for(int i=0; i<n; i++) {
            int a, b;
            scanf("%d %d", &a, &b);
            if(a > b) {
                ans1 += a + b;
            } else if(a < b) {
                ans2 += a + b;
            } else {
                ans1 += a;
                ans2 += a;
            }
        }
        printf("%d %d\n", ans1, ans2);
    }
    return 0;
}

Measured memory_bytes: 1024
X, Y = [int(s) for s in input().strip().split()]

is_found = False

for t in range(101):
    for k in range(101):
        if t + k == X and 2*t + 4*k == Y:
            is_found = True
            break

    if is_found:
        break

if is_found:
    print("Yes")
else:
    print("No")


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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );

    int N, M; cin >> N >> M; ll a, sum = 0, pairs = 0; map< ll, ll > count;

    for( int i = 0; i < N; i++ )
        count[ cin >> a, sum += a, sum %= M ]++;

    for( auto p: count )
    {
        ll k = p.second;

        if ( p.first == 0 )
            k *= k + 1;
        else
            k *= k - 1;

        k >>= 1, pairs += k;
    }

    cout << pairs;
}


Measured memory_bytes: 4224
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>      //文字列の代入に使う
#include <bits/stdc++.h> //piの利用で必要(M_PI)
#include <algorithm>

int main()
{

    int K;

    std::cin >> K;
    std::string SS;
    //    std::vector<char> S;

    std::cin >> SS;

    int size = SS.size();

    /*   char temp;
    int count = 0;
    while (std::cin >> temp)
    {
        if (&temp == NULL)
            break;
        S.push_back(temp);
        count++;
    }*/

    if (K < size)
    {

        for (int i = 0; i < K; ++i)
        {
            std::cout << SS[i];
        }
        std::cout << "..." << std::endl;
    }
    else
    {
        std::cout <<SS<<std::endl;
    }
    /*   if (count > S.size())
    {

        for (int i = 0; i < K; i++)
        {
            std::cout << S.at(i);
        }
        std::cout << "..." << std::endl;
    }

    else
    {
        for (int i = 0; i < S.size(); i++)
        {
            std::cout << S.at(i);
        }
    }*/

    //std::cout << -1 << std::endl;
    return 0;
}


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

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

int N;
struct edge{vector<int> to, cost;};
edge G[MAX_N];
vector<int> d(MAX_N);
vector<int> color(MAX_N);

void input(){
    cin >> N;
    REP(i,N-1){
        int s, t, u;
        cin >> s >> t >> u;
        s--;
        t--;
        G[s].to.push_back(t);
        G[t].to.push_back(s);
        G[s].cost.push_back(u);
        G[t].cost.push_back(u);
    }
}

void dfs(int V, int iro){
    color[V] = iro;
    REP(i,G[V].to.size()){
        if(color[G[V].to[i]] >= 0)
            continue;
        else{
            d[G[V].to[i]] = d[V] + G[V].cost[i];
            if(d[G[V].to[i]] % 2)
                dfs(G[V].to[i], 1);
            else
                dfs(G[V].to[i], 0);
        }
    }
}

void solve(){
    input();
    fill(color.begin(), color.end(), -1);
    dfs(0,0);
    REP(i,N)
        cout << color[i] << endl;
}

int main(){
    solve();
    return 0;
}


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

using namespace std;

int main()
{
    long long int n, a, i, cnt;
    set<long long int> s;
    set<long long int>::iterator itr;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> a;
        itr= s.find(a);
        if(itr== s.end()){
            s.insert(a);
        } else {
            s.erase(a);
        }

    }

    cout << s.size();
    return 0;
}


Measured memory_bytes: 8100
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <utility>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
   	double n; cin >> n;
   	double ans = n * n * n / 27;
   	printf("%.12lf\n", ans);
	return 0;
} 

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

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

  string ans;
  for (int i = 0; i < s.length(); i++) {
    char c = s.at(i);
    switch (c) {
      case '0':
        ans += c;
        break;
      case '1':
        ans += c;
        break;
      case 'B':
        if (ans.length() > 0) ans = ans.substr(0, ans.length() - 1);
        break;
      default:
        break;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3640
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    int X, N;
    cin >> X >> N;
    vector<int> P, M;

    rep(i, N){
        int p;
        cin >> p;
        int tmp = p - X;
        if(tmp >= 0) P.push_back(tmp);
        if(tmp <= 0) M.push_back(-tmp);
    }

    sort(all(P));
    sort(all(M));
    int m = 0, index = 0;
    while(1){
        if(index == M.size() ||m != M[index]){
            cout << X - m << endl;
            return 0;
        }
        if(index == P.size() || m != P[index]){
            cout << X + m << endl;
            return 0;
        }
        m++;
        index++;
    }
}

Measured memory_bytes: 3632
def main():
	import sys
	readline = sys.stdin.readline

	#s = tuple(input())
	s = input().rstrip()
	n = len(s)

	dp = [[0]*13 for _ in range(n)]
	MOD = 10**9+7

	if s[-1] == '?':
		for i in range(10):
			dp[0][i] = 1
	else:
		dp[0][int(s[-1])] = 1

	a = 1
	for i in range(1,n):
		a = 10 * a % 13
		if s[-(i+1)] != '?':
			num = int(s[-(i+1)])
			for j in range(13):
				dp[i][(a*num+j)%13] += dp[i-1][j] % MOD
		else:
			for j in range(10):
				for k in range(13):
					dp[i][(a*j+k)%13] += dp[i-1][k] % MOD

	print(dp[-1][5] % MOD)

if __name__ == '__main__':
	main()

Measured memory_bytes: 61788
n = int(input())
a = list(map(int,input().split()))
while True:    
  a = set(a)-{0}
  a = sorted(list(a))  
  if (a[0]==sum(a)) or (a[0]==1):    
    print(a[0])
    break
  a = [ai%a[0] for ai in a[1:]] + [a[0]]  

Measured memory_bytes: 16552
from sys import stdin


def main():
    n, k = list(map(int, input().split()))
    A = list(map(int, stdin.readline().split()))
    roots = [1]
    position = 0
    for _ in range(n):
        position = A[roots[-1]-1]
        A[roots[-1]-1] = - position
        if position < 0:
            break
        roots.append(position)

    x = roots.index(-position)
    y = len(roots) - x

    if k <= x:
        print(roots[k])
    elif k > x:
        print(roots[x + ((k-x) % y)])


if __name__ == '__main__':
    main()


Measured memory_bytes: 31328
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(input())
    k = len(str(n))
    c=0
    for i in range(k-1):
        if i % 2 ==0:
            c+=9*(10**i)
    if k % 2 !=0:
        c+=n-10**(k-1)+1
    print(c)




Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    cout << (ll)ceil((a+b)/2.0) << endl;
}

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

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

    uint32_t ans = 0;
    for (size_t i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) ++ans;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3912
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <map>
 
#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
 
using namespace std;
 
using ll = long long;
 
typedef stack<int> IntStack;
typedef queue<int> IntQueue;
typedef vector<int> IntVector;
typedef list<int> IntList;
 
typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  
  string ans;
  while(1){
    C = C-B;
    if(C <= 0){
      ans = "Yes";
      break;
    }
    A = A-D;
    if(A <= 0){
      ans = "No";
      break;
    }
  }
  
  cout << ans << endl;   
}

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

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  int n, k;
  cin >> n >> k;
  mint ans;
  vector<mint> d(k + 1);
  for (int i = k; i >= 1; --i) {
    d[i] = mint(k / i).pow(n);
    for (int j = i * 2; j <= k; j += i) {
      d[i] -= d[j];
    }
  }

  for (int i = 1; i <= k; ++i) ans += d[i] * i;

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

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  int h1,h2,k1,k2,a,b,c,d;
  cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
  int d1=h1*a+h2*b+h1/10*c+h2/20*d;
  int d2=k1*a+k2*b+k1/10*c+k2/20*d;
  if(d1>d2) {
  cout << "hiroshi" << endl;
  }
  else if(d1<d2) {
  cout << "kenjiro" << endl;
  }
  else cout << "even" << endl;
  return 0;
}


Measured memory_bytes: 3096
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
const int maxn = 11;
int n, d, ans;
int point[maxn][maxn];
int main()
{
    scanf("%d%d", &n, &d);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= d; j++)
            scanf("%d", &point[i][j]);
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
        {
            double ju = 0;
            for (int k = 1; k <= d; k++)
                ju += pow(point[i][k] - point[j][k], 2);
            ju = sqrt(ju);
            ju -= (int)ju;
            if (!ju)
                ans++;
        }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 256