akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=true;

/*---------------------------------------------------*/

int main(){
  ll n,m;
  cin>>n>>m;
  if(n==1&&m==1){
    cout<<1<<endl;
    return 0;
  }
  ll tmp;
  if(n==1||m==1){
    tmp=2;
  }else{
    tmp=(n*2+m*2-4);
  }
  cout<<n*m-tmp<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	while(cin>>n){
		int num=0;
		for( int i=0;i<10000;i++ ){
			if( (i-i/10*10)+
			    (i-i/100*100)/10+
			    (i-i/1000*1000)/100+
			    i/1000
			    ==n
			){
				num++;
			}
			
		}
		cout<<num<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dead_mon = 0
for i in range(N):
    if A[i]>=B[i]:
        dead_mon +=B[i]
    else:
        if A[i+1]<=B[i]-A[i]:
            dead_mon +=A[i]+A[i+1]
            A[i+1]=0
        else:
            dead_mon +=B[i]
            A[i+1]=A[i+1]-(B[i]-A[i])

print(dead_mon)

Measured memory_bytes: 19156
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    ll a,b,v,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;
    if(abs(a-b)<=t*(v-w)) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define pi 3.14159
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
int main()
{
int h,w,i,j;
scanf("%d %d",&h,&w);
vector<vector<char>> matrix(h, vector<char>(w));
for(i=0;i<h;++i){
        for(j=0;j<w;++j){
            scanf(" %c",&matrix[i][j]);
        }
}
vector<int>removedH,removedW;
for(i=0;i<h;++i){
    int counter=0;
    for(j=0;j<w;++j){
        if(matrix[i][j]=='#'){
            counter++;
        }
    }
    if(counter==0){
        removedH.push_back(i);
    }
}
for(j=0;j<w;++j){
    int counter=0;
    for(i=0;i<h;++i){
        if(matrix[i][j]=='#'){
            counter++;
        }
    }
    if(counter==0){
        removedW.push_back(j);
    }
}
if (removedH.size() || removedW.size()){
    for(i=0;i<h;++i){
        for(j=0;j<w;++j){
            if (find(ALL(removedH), i) != removedH.end()) continue;
			if (find(ALL(removedW), j) == removedW.end()) cout << matrix[i][j];
			if (j==w-1) cout << endl;
        }
    }
}
else{
    for(i=0;i<h;++i){
        for(j=0;j<w;++j){
            cout << matrix[i][j];
			if (j==w-1) cout << endl;
        }
}
}


    return 0;
}


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

int  main()
{
	int a,b; cin >> a >> b;
	if (a > 8 || b > 8)
		cout << ":(";
	else
		cout<< "Yay!";
	return (0);
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int N, X;
vector<int> maisu;
vector<int> maxmaisu;

// l:レベル, x:下から層
int burger(int l, int x){
    if(x == maisu[l]){
        return maxmaisu[l];
    }
    if(x == 1) {
        return 0;
    }
    int han = maisu[l] / 2;
    if(x == han + 1){
        return maxmaisu[l - 1] + 1;
    }
    if(x <= han){
        return burger(l - 1, x - 1);
    }
    if(x > han + 1){
        return maxmaisu[l - 1] + 1 + burger(l - 1, x - (han + 1));
    }
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> X;
    maisu.resize(N + 1);
    maxmaisu.resize(N + 1);
    maisu[0] = 1;
    for (int i = 0; i < N; ++i) {
        maisu[i + 1] = maisu[i] * 2 + 3;
    }
    maxmaisu[0] = 1;
    for (int i = 0; i < N; ++i) {
        maxmaisu[i + 1] = maxmaisu[i] * 2 + 1;
    }
    int ans = burger(N, X);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[1 << 18];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N;
	cin >> N;
	int n = (1 << N);
	int S[1 << 18];
	rep(i, (1 << N)) {
		cin >> S[i];
	}
	pakuri_sort(n, S);
	int A[1 << 17];
	A[0] = S[n - 1];
	int OK = 1;
	rep(i, N - 1) {
		int p = n - (1 << i);
		for (int j = (1 << i) - 1; j >= 0; j--) {
			while (p >= 0 && S[p] >= A[j]) p--;
			if (p < 0) {
				OK = 0;
				break;
			}
			A[j + (1 << i)] = S[p];
			S[p] = 1e9;
			p--;
		}
		if (!OK) break;
		pakuri_sort(n - (1 << i) - p + 1, S + p - 1);
		pakuri_sort(1 << (i + 1), A);
	}
	int i = N - 1;
	int p = n - (1 << i);
	for (int j = (1 << i) - 1; j >= 0; j--) {
		while (p >= 0 && S[p] >= A[j]) p--;
		if (p < 0) {
			OK = 0;
			break;
		}
		S[p] = 1e9;
		p--;
	}

	if (OK) co("Yes");
	else co("No");

	Would you please return 0;
}

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

#define int long long
#define INF 9223372036854775807

int memo[3009][3009];

string a;
string b;

int lcs(int l, int r){
    if(l < 0 || r < 0) return 0;
    else if(memo[l][r] != -1) return memo[l][r];
    else if(a[l] == b[r]){
        memo[l][r] = lcs(l-1,r-1)+1;
    }else{
        memo[l][r] = max(lcs(l-1,r), lcs(l,r-1));
    }
    return memo[l][r];
}
string rep = "";

void backe(int l, int r){
    if(l < 0 || r < 0) return;
    else if(a[l] == b[r]){
        rep = a[l] + rep;
        backe(l-1,r-1);
    }else{
        if(memo[l][r] == lcs(l-1,r)) backe(l-1,r);
        else backe(l,r-1);
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b;
    for(int i = 0; i < 3009; i++){
        for(int j = 0; j < 3009; j++){
            memo[i][j] = -1;
        }
    }
    lcs(a.size()-1, b.size()-1);
    backe(a.size()-1, b.size()-1);
    cout << rep << endl;
}


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

//再帰
int fibonacci(int n){
	if(n==0) return 1; //たぶん本当はフィボナッチ数列はf(0)=0 だと思うのだが、問題文がそうなっていたので１を返す。
	else if(n==1) return 1;
	else return fibonacci(n-2) + fibonacci(n-1);
}

//DP
int fibonacci_dp(int n){
	int i;
	int fib[45];

	fib[0]=1;
	fib[1]=1;

	for(i=2; i<=n; i++){
		fib[i]=fib[i-2]+fib[i-1];
	}
	return fib[n];
}

int main() {
	int n;

	cin >> n;
	//cout << fibonacci(n) << endl;
	cout << fibonacci_dp(n) << endl;

	return 0;
}

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

int main()
{
    long long i, j, k, n, t, x, y, s=0, c=0, l;
    cin >> n;
    int a[n];
    for(i=0; i<n; i++)
        cin >> a[i];
    sort(a, a+n);
    cout << a[n-1]-a[0];
}






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

int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> parent;

    //-1で初期化
    //最初はすべてバラバラ
    UnionFind(int N){
        parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているか(Aの根)を調べる
    int root(int A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
        return -parent[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B) {
    //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        //既にくっついているからくっつけない
        if(A == B) return false; 

        //大きいほう(A)に小さいほう(B)をくっつける
        //大証が逆ならひっくり返す
        if(size(A) < size(B)) swap(A,B);

        //Aのサイズを更新する
        parent[A] += parent[B];
        //Bの親をAに変更する
        parent[B] = A;

        return true;
    }

    //AとBが同じグループならtrueを返す
    bool same(int A, int B){
        return root(A)==root(B);
    } 
};

int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++){
        cin>>v[i].first>>v[i].second;
    }
    int ans=0;

    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = (1<<n-1)-1; bit < (1<<m); bit=next_combination(bit))
    {
        UnionFind uni(n);
        int cnt=0;
        int a[n+1]={};
        for(int i=0;i<m;i++){
            if((bit>>i&1)) {
                a[v[i].first]++;
                a[v[i].second]++;
                uni.connect(v[i].first-1,v[i].second-1);
            } 

        }

        bool ok=true;

  
            if(a[1]!=1) ok=false;

            int t=1;

            for(int i=2;i<n+1;i++){
                if(a[i]==1 && t==1) t=0;
                else if(a[i]!=2) ok=false;
                if(!uni.same(0,i-1)) ok=false;
            }
        

        if(ok) ans++;
    }

    cout<<ans;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  vector<vi> c(3, vi(3));
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> c[i][j];
  if (
    c[0][1] - c[0][0] != c[1][1] - c[1][0] ||
    c[1][1] - c[1][0] != c[2][1] - c[2][0] ||
    c[0][1] - c[0][2] != c[1][1] - c[1][2] ||
    c[1][1] - c[1][2] != c[2][1] - c[2][2] ||
    c[1][0] - c[0][0] != c[1][1] - c[0][1] ||
    c[1][1] - c[0][1] != c[1][2] - c[0][2] ||
    c[1][0] - c[2][0] != c[1][1] - c[2][1] ||
    c[1][1] - c[2][1] != c[1][2] - c[2][2]
  ) No();
  else Yes();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define cin()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int ans;
  if(a+b<2*c){
    ans = a*x + b*y;
  }else{
    ans = 2*c*min(x,y);
    if(x>y){
      if(a<2*c) ans+=a*(x-y);
      else ans+=2*c*(x-y);
    }else{
      if(b<2*c) ans+=b*(y-x);
      else ans+=2*c*(y-x);
    }
  }

  puts(ans);
}

Measured memory_bytes: 256
N,K,D = list(map(int, input().split()))
ans = 0
if N<0:
    N *= -1
    
if int(N/D) > K:
    ans = N - K*D
elif K%2 == int(N/D)%2:
    ans = N%D
else:
    ans = -(N%D-D)
    
print(ans)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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 = in();
  vi a(n);
  rep(i,n) cin >> a[i];
  
  int x = *max_element(rng(a));
  int y;
  int dif = INF;
  rep(i,n) {
    if (a[i] == x) continue;
    if (dif > abs(x/2-a[i])) {
      dif = abs(x/2-a[i]);
      y = a[i];
    }
  }
  printf("%d %d\n", x, y);
  return 0;
}

Measured memory_bytes: 640
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let s=read::<String>().chars().collect::<Vec<char>>();
    let mut c=0;
    let mut f=(0..s.len()).map(|_|0).collect::<Vec<i32>>();
    for i in 0..s.len(){
        let j=s.len()-i-1;
        if s[j]=='B'{c+=1}else if c>0{c-=1}else{f[j]=1}
    }
    for i in 0..s.len(){
        if f[i]==1{print!("{}",s[i])}
    }
}


Measured memory_bytes: 4352
[n,m] = [int(i) for i in input().split()]
if n * 2 >= m:
    print(m // 2)
else:
    if m >= 2:
        ans = n
        m = max(m - n * 2,0)
        ans += m//4
        print(ans)
    else:
        print(0)


Measured memory_bytes: 9056
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>

void b(std::istream& in)
{
    std::string T;
    in >> T;

    std::replace(T.begin(), T.end(), '?', 'D');

    std::cout << T;
}

int main(int, char* [])
{
    b(std::cin);
    return 0;
}



Measured memory_bytes: 3752
#include<stdio.h>
#include<stdlib.h>
#define max(a,b) a>b?a:b

void CountingSort(int a[], int b[], int k, int n){
    int i;
    int *c;
    c=calloc(k+1, sizeof(int));
    for(i=0;i<=k;i++)c[i]=0;

    for(i=0;i<n;i++)c[a[i]]++;
    
    for(i=1;i<=k;i++)c[i]+=c[i-1];

    for(i=n-1;i>=0;i--){
        b[c[a[i]]]=a[i];
        c[a[i]]--;
    }
    free(c);
}

int main(void){
    int i;
    int n;
    int *x;
    int *y;
    int max_n=0;

    scanf("%d",&n);
    x=calloc(n,sizeof(int));
    y=calloc(n+1, sizeof(int));

    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
        max_n=max(max_n,x[i]);
    }

    CountingSort(x,y,max_n, n);

    for(i=1;i<n;i++)printf("%d ", y[i]);
    printf("%d", y[i]);
    printf("\n");
}


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

using namespace std;

int main()
{
	string s;
	string t;
	string a;
	
	cin >> s >> t;
	
	a = s;
	
	for (int i = 0; i < 101; i++) {
		if (a == t) {
			cout << "Yes" << endl;
			return (0);
		}
		a = a.back() + a;
		a.pop_back();
	}
	
	cout << "No" << endl;
	
	return (0);
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i=0;i<N;++i){
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	cout << A[N-1]-A[0] << endl;

}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int m[n][26] = {};
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; s[j] != '\0'; j++) {
      m[i][s[j] - 'a']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    int cn = 50;
    for (int j = 0; j < n; j++) {
      cn = min(cn, m[j][i]);
    }
    cout << string(cn, i + 'a');
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
// OURL: https://atcoder.jp/contests/abc136/tasks/abc136_a
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b,c;
  cin >> a >> b >> c;
  int d = c-(a-b);
  if (d<=0) {
    cout << 0 << endl;
  } else {
    cout << d << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;

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

	map<string,int> vec;

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		vec[s] =1;
	}

	cout << vec.size() << endl;


	return 0;
}

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

int main(void){
	while( 1 ) {
		int z;
		cin >> z;
		if( z == 0 ) break;
		z = z * z * z;
		int max = 0;
		for(int x = 1; x * x * x < z; x ++)
			for(int y = 1; x * x * x + y * y * y <= z; y++)
				if( max < x * x * x + y * y * y ) max = x * x * x + y * y * y;
		cout << z - max << endl;

	}
	return 0;
}

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

int main () {
  int N , K ;
  cin >> N >> K ;
  int ans = 0 ;
  for(int i = 0 ; i < N ; i++ ){
    int x ;
    cin >> x ;
    ans += min(abs(x),abs(K-x)) ;
  }
  ans *= 2 ;
  cout << ans << endl ;
}

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

int main(){
    std::vector<char> vec(9);
    for(int i = 0; i < 9; ++i){
        std::cin >> vec.at(i);
    }

    std::cout << vec.at(0) << vec.at(4) << vec.at(8) << std::endl;

    return 0;
}


Measured memory_bytes: 256
import std.array;
import std.conv;
import std.math;
import std.algorithm;
import std.string;
import std.stdio;

void main() {
	int n = readln.chomp.to!int;
	auto steps = readln.chomp.split(' ').map!(to!int).array;

	auto dp = new int[n];
	dp[1] = abs(steps[0] - steps[1]);

	foreach (i;2..n) {
		dp[i] = min(
			dp[i - 2] + abs(steps[i - 2] - steps[i]),
			dp[i - 1] + abs(steps[i - 1] - steps[i]));
	}

	writeln(dp[n - 1]);
}


Measured memory_bytes: 4124
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = (1 << 31) - 1;


int main() {
	string s;
	cin >> s;
	if (s == "keyence") {
		cout << "YES" << endl;
		return 0;
	}
	rep(i, s.size()) {
		rep(j, s.size() - i - 1) {
			string t = s;
			rep(k, j + 1) {
				t.erase(t.begin()+i);
			}
			if (t == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import math
import random
import itertools
N=int(input())
P=[int(x) for x in input().split()]
S=[int(x) for x in input().split()]

r=random.sample(range(1, N+1), k=N)
#p = itertools.permutations(r, N)
#print(r,p)
a=[]
p=0
s=0
for i in range(N):
    p+=P[i]*10**(N-i-1)
    s+=S[i]*10**(N-i-1)
for v in itertools.permutations(r, N):
    c=0
    for j in range(N):

        c+=v[j]*10**(N-j-1)
    a.append(c)
a.sort()
pin=a.index(p)
sin=a.index(s)
print(abs(pin-sin))


Measured memory_bytes: 5248
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

int main()
{   
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll p1 = a*c;
    ll p2 = b*d;
    ll p3 = a*d;
    ll p4 = c*b;
    cout<<max({p1,p2,p3,p4})<<endl;
    return 0;
}   
    

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define all(v) (v).begin(),(v).end()
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int> ans;
    rep(i,0,n)cin>>v[i];
    
    rep(i,0,n){
        if(i%2==0)ans.insert(ans.begin(),v[i]);
        else ans.pb(v[i]);
    }
    if(n%2==0)reverse(all(ans));
    rep(i,0,n){
        if(i)cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;
    
    
    
    return 0;
}



Measured memory_bytes: 3828
module MakeBinaryHeap (M : sig type t val compare : t -> t -> int end) = struct
  type t = { node : M.t array; mutable size : int }

  let make n (init : M.t) = { node = Array.make n init; size = 0 }

  let empty_p t = if t.size = 0 then true else false

  let pop t =
    let ret = t.node.(1) in
    t.node.(1) <- t.node.(t.size);
    t.size <- t.size - 1;
    let rec max_heapify i =
      let l = 2*i in
      let r = 2*i + 1 in
      let m = if l <= t.size && M.compare t.node.(l) t.node.(i) > 0 then l else i in
      let m = if r <= t.size && M.compare t.node.(r) t.node.(m) > 0 then r else m in
      if m <> i then begin
        let tmp = t.node.(i) in t.node.(i) <- t.node.(m); t.node.(m) <- tmp;
        max_heapify m
      end in
    max_heapify 1;
    ret

  let push x t =
    t.size <- t.size + 1;
    t.node.(t.size) <- x;
    let parent i = int_of_float (floor (float_of_int i) /. 2.) in
    let rec doit i =
      if i > 1 && M.compare t.node.(parent i) t.node.(i) < 0 then begin
        let tmp = t.node.(i) in t.node.(i) <- t.node.(parent i); t.node.(parent i) <- tmp;
        doit (parent i)
      end in
    doit t.size
end

module H = MakeBinaryHeap(struct type t = (int * int) let compare x y = fst x - fst y end)

let dijkstra g n =
  let h = H.make 100000 (0, 0) in
  let d = Array.make n max_int in
  let b = Array.make n false in
  d.(0) <- 0;
  b.(0) <- true;
  H.push (0, 0) h;
  let rec doit () =
    if not (H.empty_p h) then begin
      let (x, u) = H.pop h in
      b.(u) <- true;
      if d.(u) >= (-x) then duduwa u g.(u);
      doit ()
    end
  and duduwa u = function
    | [] -> ()
    | (v, _) :: tl when b.(v) = true -> duduwa u tl
    | (v, c) :: tl when d.(v) <= d.(u) + c -> duduwa u tl
    | (v, c) :: tl ->
      begin
        d.(v) <- d.(u) + c;
        H.push ((-d.(v)), v) h;
        duduwa u tl
      end in
  doit ();
  d

let rec make_pair acc = function
  | [] -> acc
  | f :: t :: tl -> make_pair ((f, t) :: acc) tl
  | _ -> exit 1

let () =
  let n = read_int () in
  let g = Array.make n [] in
  let rec read i =
    if i < n then
      match List.map int_of_string (Str.split (Str.regexp " ") (read_line ())) with
      | u :: _ :: l -> (g.(u) <- make_pair [] l; read (i + 1))
      | _ -> exit 1
  in read 0;
  Array.iteri (fun i e -> Printf.printf "%d %d\n" i e) (dijkstra g n)

Measured memory_bytes: 30764
#include <stdio.h>
int main(void) {
    int height,width,tile[101][101],i,j;
    char floor[101][101];
    while (1) {
        scanf("%d %d\n",&height,&width);
        if (height==0&&width==0) break;
        for (i=0; i<height; i++) {
            for (j=0; j<width; j++) tile[i][j]=0;
        }
        for (i=0; i<height; i++) scanf("%s",floor[i]);
       i=0,j=0;
        while (floor[i][j]!='.'&&tile[i][j]!=1) {
            tile[i][j]=1;
            if (floor[i][j]=='>') {
                j++;
            } else if (floor[i][j]=='<') {
                j--;
            } else if (floor[i][j]=='^') {
                i--;
            } else {
                i++;
            }
        }
        if (tile[i][j]==0) {
            printf("%d %d\n",j,i);
        } else {
            printf("LOOP\n");
        }
    }
    return 0;
}

Measured memory_bytes: 668
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 100;
    vector<int> last(26, -1);
    // 最後に出現するindex.
    vector<int> Max(26, 0);
    // 左側を全てcharにするのに必要な操作回数.

    rep(i, s.size()) {
        int c = s[i] - 'a';
        Max[c] = max(Max[c], i - last[c] - 1);
        last[c] = i;
    }

    rep(i, 26){
        Max[i] = max(Max[i], (int)s.size() - last[i] - 1);
    }

    cout << *min_element(Max.begin(), Max.end()) << endl;

    return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split(" "))

def judge(t):
    if int(t)%2 == 1:
        return "d"
    else:
        return int(t)

field = [["n" for i in range(w+1)]]
for i in range(1,h+1):
    field.append(list(map(judge,input().split(" "))))
    field[i] = ["n"] + field[i]
d_num = 0
for i in range(1,h+1):
    for j in range(1,w+1):
        if field[i][j] == "d":
            d_num += 1

ans_a = []
ans_a2 = []
pri = False
for i in range(1,h+1):
    if i%2 == 1:
        dir_j = [i+1 for i in range(w)]
    else:
        dir_j = [w-i for i in range(w)]
    for j in dir_j:
        if field[i][j] == "d" and d_num >= 2:
            if pri:
                pri = False
                ans_a.append([i,j])
                for k in range(len(ans_a)-1):
                    ans_a2.append(ans_a[k]+ans_a[k+1])
                ans_a = []
            else:
                pri = True
        if pri:
            ans_a.append([i,j])

print(len(ans_a2))
for i in ans_a2:
    print(" ".join(list(map(str,i))))

Measured memory_bytes: 25576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll a, b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>k;
    a = 0;
    REP(i,k) {
        a = a * 10 + 7;
        a %= k;
        if (a == 0) {
            cout<<i+1<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

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

int main(){
long long a,b,c,d,e,g,i,j,k,n,l;
cin>>k>>n;
long long m[n];
for(i=0;i<n;i++)
    cin>>m[i];
a=m[0]-0;
b=a+k-m[n-1];l=0;
l=max(l,b);
for(i=0;i<n;i++){
    if(i>0){
        b=m[i]-m[i-1];
        l=max(l,b);
    }
}
cout<<k-l<<endl;


}








Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
using namespace std;


void insertionSort(int *A, int N);
void display(int *A, int N);

int main(){
  int A[1000];
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  insertionSort(A, N);
}

void insertionSort(int *A, int N){
  for(int i=1; i< N; i++){
    display(A, N);
    int v, j;
    v = A[i];
    j = i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1] = v;
  }
  display(A, N);
}

void display(int *A, int N){
  for(int i=0; i<N-1 ;i++){
    cout <<A[i] << " ";
  }
  cout << A[N-1] << endl;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define int long long
#define re(i,n) for(i=0;i<n;i++)
#define bre(i,n) for(i=n;i>0;i--)
#define rep(i,l,r) for(i=l;i<r;i++)
#define brep(i,l,r) for(i=r;i>l;i--)
const int inf=1145141919810893;
const int mod=1000000007;
using namespace std;
template<class T>bool chmin(T &a,const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}
template<class T>bool chmax(T &a,const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}
template<class T>void debug(T *a,int l,int r,const char *name){
	for(int i=l;i<r;i++)
		cout<<name<<"["<<i<<"]="<<a[i]<<endl;
}
template<int H,int W>int wa(int x1,int y1,int x2,int y2,int(&p)[H][W]){
	return p[y2][x2]-p[y2][x1]-p[y1][x2]+p[y1][x1];
}
struct Node{
	vector<pair<int,int>> e;
} node[114514];
int A,B,C,D,N,M,K,T,H,W;
int q[114514],r[114514];
signed main(){
	int i,j,k;
	cin>>N>>M;
	re(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		a--;
		b--;
		node[a].e.push_back({b,c});
		node[b].e.push_back({a,-c});
	}
	fill(r,r+N,-1);
	queue<int> qu;
	re(i,N){
		if(q[i])
			continue;
		r[i]=0;
		q[i]=1;
		qu.push(i);
		while(!qu.empty()){
			auto a=qu.front();
			qu.pop();
			for(auto x:node[a].e){
				if(r[x.first]==-1)
					r[x.first]=r[a]+x.second;
				else if(r[x.first]!=r[a]+x.second){
					cout<<"No"<<endl;
					return 0;
				}
				if(q[x.first]==0){
					q[x.first]=1;
					qu.push(x.first);
				}
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 15232
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;
int main(){
  int n,m;
  while(cin>>n>>m,n+m){
    vector<p> da;
    for(int i=0;i<m;++i)
      da.push_back(p(0,i));
    for(int i=0;i<n;++i){
      for(int j=0;j<m;++j){
        int a;
        cin>>a;
        if(a) da[j].first++;
      }
    }
    for(int i=0;i<m-1;++i){
      for(int j=m-1;j>i;--j){
        if(da[j-1].first<da[j].first) swap(da[j-1],da[j]);
      }
    }
  for(int i=0;i<m;++i)
    cout<<da[i].second+1<<(i==m-1?"\n":" ");
  }
  return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s;
    cin>>s;
    int i,ans=0;
    for (i=0;i<s.size()-1;i++)
        ans+=s[i]!=s[i+1];
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline void p(int x,int y){
	printf("%d %d\n",x,y);
}
int main(){
	int n;
	scanf("%d",&n);
	int u=1;
	while(u<=n){
		if(u==n){puts("No"); return 0;}
		u<<=1;
	}
	puts("Yes");
	p(1,2);
	p(2,3);
	p(3,n+1);
	p(n+1,n+2);
	p(n+2,n+3);
	if(n&1){
		for(int i=4;i<=n;i+=2){
			p(i,i+1);
			p(i+1,1);
			p(1,n+i);
			p(n+i,n+i+1);
		}
	}else{
		for(int i=4;i<n;i+=2)if(i!=(n^(n&-n))){
			p(i,i+1);
			p(i+1,1);
			p(1,n+i);
			p(n+i,n+i+1);
		}else{
			p(i,(n&-n));
			p(i+1,i);
			p((n&-n)+1,n+i+1);
			p(n+i,n+i+1);
		}
		p(n,(n&-n));
		p(n+n,n^(n&-n));
	}
	return 0;
}

Measured memory_bytes: 2176
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    double l;
    cin >> l;
    l/=3;
    printf("%.8f",l*l*l);
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

#define NUM 3
//#define NUM 10

int main(int argc, char *args[])
{
	int a[NUM] = {0,0,0};
//	int a[NUM] = {0,0,0,0,0,0,0,0,0,0};
	int t = 0;
	int i,j;

	scanf("%d %d %d", &a[0], &a[1], &a[2]);
//	scanf("%d %d %d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6], &a[7], &a[8], &a[9]);

	for( i=1; i<=(NUM-1); i++) {
		for( j=0; j<=((NUM-1)-i); j++) {
			if(a[j] > a[j+1]) {
				t = a[j+1];
				a[j+1] = a[j];
				a[j] = t;
			}
//	printf("%d %d %d %d %d %d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);
		}
//	printf("\n");
	}

	printf("%d %d %d\n", a[0], a[1], a[2]);
//	printf("%d %d %d %d %d %d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);

	return 0;
}

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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
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;}

int main(){
int a,b;
cin >> a >> b;
if(a == b){
cout << "Draw" << endl;
return 0;
}
if(a == 1){
cout << "Alice" << endl;
return 0;
}
if(b == 1){
cout << "Bob" << endl;
return 0;
}
if(a < b){
cout << "Bob" << endl;
return 0;
}
cout << "Alice" << endl;
}


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

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  bool can=true;
  if(n%2==1){
    cout << "No" << endl;
  }else{
    for(int i=0;i<n/2;i++){
      if(s[i]!=s[i+n/2]){
        can=false;
        break;
      }
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

#define int long long

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

#define len(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int N = 2e5 + 7;
const int M = 998244353;

int binpow(int val, int n) {
    int res = 1;
    while (n > 0) {
        if (n & 1) res = res * val % M;
        val = val * val % M;
        n /= 2;
    }
    return res;
}

int inv(int val) {
    return binpow(val, M - 2);
}

int fact[N];

int C(int n, int k) {
    return fact[n] * inv(fact[k]) % M * inv(fact[n - k]) % M;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    fact[0] = 1;
    for (int i = 1; i < N; i++) fact[i] = fact[i - 1] * i % M;
    int n, m, k;
    cin >> n >> m >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (n - 1 - i <= k) {
            ans += C(n - 1, i) * m % M * binpow(m - 1, i) % M;
            if (ans >= M) ans -= M;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 5164
#include <iostream>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  ll x;
  cin >> x;
  
  ll have = 100;
  ll year = 0;
  while(1){
    if (have >= x)
      break;
    have += have * 0.01;
    year++;
  }
  
  cout << year << endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n,i;
 cin>>n;
 int arr[n];
 for(i=0; i<n; i++)
 cin>>arr[i];
 int count=1;
 int max=arr[0];
 for(i=1; i<n; i++)
{
  if(arr[i]>=max)
  {
    max=arr[i];
    count++;
  }
}
cout<<count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
#define enl << endl
using namespace std;
using ll = long long;
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(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


const int MAXN = 200010;

class SegmentTree {
public:
    ll dat[2*MAXN - 1];
    ll n;

    SegmentTree(ll nn){
        n = 1;
        while(n < nn) n*=2;
        rep(i, 2*n-1){
            dat[i] = 0;
        }
    }

    void update(ll k, ll x){
        k += n-1;
        dat[k] = x;
        while(k > 0){
            k = (k-1)/2;
            dat[k] = max(dat[2*k+1], dat[2*k+2]);
        }
    }

    ll getmax(ll a, ll b, ll k, ll l, ll r){
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return dat[k];
        else{
            ll v1 = getmax(a, b, 2*k+1, l, (l+r)/2);
            ll v2 = getmax(a, b, 2*k+2, (l+r)/2, r);
            return max(v1, v2);
        }
    }

    ll get(ll a, ll b){
        //cout << n << endl;
        return getmax(a, b, 0, 0, n);
    }
};

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

    ll n, t, tmpa;
    vector<ll> a;

    cin >> n >> t;
    rep(i, n){
        cin >> tmpa;
        a.push_back(tmpa);
    }

    SegmentTree tree(n);

    rep(i, n){
        tree.update(i, a[i]);
    }

    ll res[100010];
    reps(i, 0, n-2){
        res[i] = tree.get(i+1, n) - a[i];
    }
    res[n-1] = -a[n-1];

    //adebug(res, n);

    ll maxres = 0;
    ll maxcnt = 0;
    rep(i, n){
        if(res[i] > maxres){
            maxres = res[i];
            maxcnt = 1;
        }else if(res[i] == maxres){
            maxcnt++;
        }
    }

    //cout << maxres << endl;
    cout << maxcnt << endl;

    return 0;
}


Measured memory_bytes: 4980
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
            cnt++;
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3408
h,w=map(int,input().split())
mod=10**9+7
W0=[list('#'*(w+2))]
Wh=[list('#'*(w+2))]
HW=W0+[list('#'+input()+'#') for i in range(h)]+Wh
# dp[i][j]をi,jまでの組み合わせ
dp=[[0]*(w+1) for i in range(h+1)]
for i in range(1,h+1):
    for j in range(1,w+1):
        if i==1 and j==1:
            dp[i][j]=1
        else:
            if HW[i][j]=='.':
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod
            else:
                dp[i][j]=0
print(dp[h][w])

Measured memory_bytes: 87664
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(LL)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat 
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int INF=1<<30;
const int BITSIZE=1<<17;
const LL p=7+1e9;
const int SIZE=5+1e5;
LL x[SIZE];
Vpr nums;
int main(){
	int N;
	cin >> N;
	cin.tie(0);
	REP(i,N){
		cin >> x[i];
		nums.PB(pr(x[i],i));
	}
	sort(ALL(nums));
	int ans=0;
	REP(i,N){
		if((i^nums[i].second)&1) ans++;
	}
	cout << ans/2 << endl;
	return 0;
}


Measured memory_bytes: 1912
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long long a = 1, b = 1;
    int n;
    cin >> n;
    while (n--) {
        long long t0, t1;
        cin >> t0 >> t1;
        long long v = max((a - 1) / t0 + 1, (b - 1) / t1 + 1);
        a = v * t0;
        b = v * t1;
    }
    cout << a + b << endl;
}



Measured memory_bytes: 384
n = int(raw_input())

arr = []
for i in xrange(n):
    a = int(raw_input())
    arr.append(a)

max = -1
sum = 0
for i in xrange(n):
    if arr[i] > max:
        max = arr[i]
    sum += arr[i]

sum -= max/2

print sum

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

using namespace std;

typedef long long ll;

int main(){
int N; cin >> N;
  vector<int> A(N+ 1);
  for(int i = 1; i <= N; i++){
    cin >> A[i];}
  vector<int> vec(N + 1,0);
  vector<int> ans;
  for(int j = N ; j >= 1; j--){
    //vec[j]
    ll res = 0;
    for(int k = 2; j * k <= N; k++){
      res += vec[ j * k]; res %= 2;}
    if( A[j] != res){ vec[j] = 1; ans.push_back(j);}
    else{
      vec[j] = 0;} }
  
  reverse(ans.begin(),ans.end());
  
 cout << (int)ans.size() << endl;

for(int i = 0; i < (int) ans.size(); i++){
  cout << ans[i] << " " ;}
return 0;}

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

int main(void){
    string s;
    cin >> s;
    int a = (s[0] - '0')*10 + (s[1] - '0');
    int b = (s[2] - '0')*10 + (s[3] - '0');
    if((1 <= a && a <= 12) && (1 <= b && b <= 12))cout << "AMBIGUOUS";
    else if(1 <= a && a <= 12)cout << "MMYY";
    else if(1 <= b && b <= 12)cout << "YYMM";
    else cout << "NA";
}

Measured memory_bytes: 256