akhauriyash/Code-Regression huggingface dataset:
from collections import deque

N, U, V = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N - 1)]

tree = [[] for _ in range(N + 1)]
for a, b in X:
    tree[a].append(b)
    tree[b].append(a)

def find_dist(s):
    dist = [-1] * (N + 1)
    dist[s] = 0
    q = deque()
    q.append(s)
    while q:
        u = q.popleft()
        for v in tree[u]:
            if dist[v] >= 0:
                continue
                
            dist[v] = dist[u] + 1
            q.append(v)
            
    return dist


dist_u = find_dist(U)
dist_v = find_dist(V)

ans = 0
for i in range(1, N + 1):
    if dist_u[i] <= dist_v[i]:
        ans = max(ans, dist_v[i] - 1)
        
print(ans)



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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    if((i&1) && (a&1)) ans++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3536
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll S;
  cin >> S;

  llvec frac(6001, 1);
  llvec ifrac(6001, 1);

  rep(i, 6000){
    frac[i+1]=mod(frac[i]*(i+1), MOD);
    ifrac[i+1]=modinv(frac[i+1], MOD);
  }
  auto comb = [frac, ifrac](ll n, ll k){return mod(mod(frac[n]*ifrac[k], MOD)*ifrac[n-k], MOD);};
  
  ll N = S;
  ll ans = 0;
  for(ll i=1;i<=N;i++){
    ll s = S - i*3;
    if(s<0)break;
    ans = mod(ans + mod(mod(frac[s+i-1]*ifrac[s], MOD)*ifrac[i-1], MOD), MOD);
  }
  cout << ans << endl;
  return 0;
  
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define K 100001
#define N 101
#define M ((ll)1e9+7)
using namespace std;
typedef long long ll;

ll n, k, a[N], dp[K], temp[K];

ll ps(int i, int j, ll *arr) {
	if (i<=0) return arr[j];
	return (arr[j]-arr[i-1]+M+M)%M;
}

int main() {
	cin>>n>>k;
	for (int i=0; i<n; i++) cin>>a[i];
	for (int j=0; j<=k; j++) dp[j]=1;
	temp[0]=1;
	for (int i=0; i<n; i++) {
		for (int j=k; j>0; j--) temp[j]=ps(j-a[i],j,dp);
		for (int j=1; j<=k; j++) dp[j]=(dp[j-1]+temp[j])%M;
	}
	cout<<ps(k,k,dp)<<endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <math.h>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

int main() {
    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    else if(s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

unordered_map<int, vector<PII>> lefts, rights;
LL tree[810000], tag[810000];
int n, m, x, y, z;

void pushdown(int x) {
    tree[x * 2] += tag[x];
    tag[x * 2] += tag[x];
    tree[x * 2 + 1] += tag[x];
    tag[x * 2 + 1] += tag[x];
    tag[x] = 0;
}

void pushup(int x) {
    tree[x] = max(tree[x * 2], tree[x * 2 + 1]);
}

void update(int x, int l, int r, int ul, int ur, LL delta) {
    if (l > ur || r < ul) {
        return;
    }
    if (ul <= l && r <= ur) {
        tree[x] += delta;
        tag[x] += delta;
        return;
    }
    pushdown(x);
    int mid = (l + r) >> 1;
    update(x * 2, l, mid, ul, ur, delta);
    update(x * 2 + 1, mid + 1, r, ul, ur, delta);
    pushup(x);
}

LL query(int x, int l, int r, int ql, int qr) {
    if (l > qr || r < ql) {
        return LONG_MIN;
    }
    if (ql <= l && r <= qr) {
        return tree[x];
    }
    pushdown(x);
    int mid = (l + r) >> 1;
    return max(query(x * 2, l, mid, ql, qr), query(x * 2 + 1, mid + 1, r, ql, qr));
}

inline void work() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> x >> y >> z;
        lefts[x].emplace_back(y, z);
        rights[y].emplace_back(x, z);
    }
    LL ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (lefts.count(i)) {
            // for (auto& [_, z]: lefts[i]) {
            for (auto& _: lefts[i]) {   // atcoder c++14 only
                int z = _.second;
                update(1, 1, n + 1, 1, i, z);
            }
        }
        LL cur = query(1, 1, n + 1, 1, i);
        ans = max(ans, cur);
        update(1, 1, n + 1, i + 1, i + 1, cur);
        if (rights.count(i)) {
            // for (auto& [x, z]: rights[i]) {
            for (auto& _: rights[i]) {
                int x = _.first, z = _.second;
                update(1, 1, n + 1, 1, x, -z);
            }
        }
    }
    cout << ans << "\n";
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

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

int main(){
	int h,i;
	scanf("%d",&h);
    int a[h+1];
	for(i=1;i<=h;i++)
		scanf("%d",&a[i]);
	for(i=1;i<=h;i++){
		printf("node %d: key = %d, ",i,a[i]);
		if(i>1) printf("parent key = %d, ",a[i/2]);
		if(2*i<=h) printf("left key = %d, ",a[2*i]);
		if(2*i+1<=h) printf("right key = %d, ",a[2*i+1]);
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3204
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2000010
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-6
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
const ll mod = 1e9 + 7;
ll r1, c1, r2, c2;
ll pre[SIZE] = { 1,1 };
ll qpow(ll a, ll b, ll mod) { //快速幂 a ^ b % mod
	ll ans = 1;
	while (b) {
		if (b & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ans;
}

ll C(ll n, ll m) {
	//cout << qpow(n - m, mod - 2ll, mod) << ' ' << qpow(m, mod - 2ll, mod) << '\n';
	return pre[n] * qpow(pre[n - m], mod - 2ll, mod) % mod * qpow(pre[m], mod - 2ll, mod) % mod;
}

ll solve(ll r, ll c) {
	ll ans = 0;
	rep(i, 0, r) ans = (ans + C(i + c + 1ll, c)) % mod;
	return ans % mod;
}

int main() {
	io(); cin >> r1 >> c1 >> r2 >> c2;
	rep(i, 2, (r2 + c2 + 1)) pre[i] = (pre[i - 1] * i) % mod;
	cout << (solve(r2, c2) - solve(r1 - 1, c2) - solve(r2, c1 - 1) + solve(r1 - 1, c1 - 1) + mod) % mod;
}

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

using namespace std;

int main() {
	int k;
	while (cin >> k && k) {
		int sum = 0;
		for (int i = 0; i < k * (k - 1) / 2; i++) {
			int tmp;
			cin >> tmp;
			sum += tmp;
		}
		cout << sum / (k - 1) << endl;
	}

	return 0;
}

Measured memory_bytes: 3096
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++)
            A[i]  = sc.nextInt();
        Arrays.sort(A);
        sc.close();

        long sum1 = 0;
        long sum2 = 0;
        if (N % 2 == 0) {
            for (int i=0; i<N; i++) {
              if (i < N / 2 - 1) {
                sum1 -= 2 * A[i];
              } else if (i == N / 2 - 1) {
                sum1 -= A[i];
              } else if (i == N / 2) {
                sum1 += A[i];
              } else {
                sum1 += 2 * A[i];
              }
            }
            sum2 = sum1;
          } else {
            for (int i=0; i<N; i++) {
              if (i < N / 2) {
                sum1 -= 2 * A[i];
              } else if (i == N / 2 || i == N / 2 + 1) {
                sum1 += A[i];
              } else {
                sum1 += 2 * A[i];
              }
            }
            for (int i=0; i<N; i++) {
              if (i < N / 2 - 1) {
                sum2 -= 2 * A[i];
              } else if (i == N / 2 - 1 || i == N / 2) {
                sum2 -= A[i];
              } else {
                sum2 += 2 * A[i];
              }
            }
          }

        System.out.println(Math.max(sum1, sum2));
    }
}

Measured memory_bytes: 52408
n = int(input())

p = [0 for i in range(n+1)]
for i in range(n):
    p[i],p[i+1] = map(int,input().split())
    
m = [[0 for i in range(n)] for j in range(n)]


for l in range(1,n):
    for i in range(0,n-l):
        j = i + l
        m[i][j] = float("inf")
        for k in range(i,j):
            m[i][j] = min(m[i][j],m[i][k] +m[k+1][j] + p[i]*p[k+1]*p[j+1])   
   
print(m[0][n-1])

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);


int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int l, r, d;
    cin >> l >> r >> d;
    int cnt = 0;
    for(int i = l; i <= r; i++){
        if(i % d == 0){
            cnt++;
            //cout << i << endl;
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans = __gcd(a[0],a[1]);
  rep(i,n) {
    ans = __gcd(ans, a[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    string s,t;
    cin>>s>>t;
    for(int i=0;i<t.size();i++)cout<<s[i]<<t[i];
    if(s.size()>t.size())cout<<s.back();
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_N = 100050;
const int MAX_K = 1000;

std::vector<int> S[MAX_K];

int N;

int main(int argc, char **argv) {
    std::cin >> N;

    int k = 0;
    for (int i = 2; i <= N * 2; i++) {
        if (i * (i-1) / 2 == N) {
            k = i;
            break;
        } else if (i * (i-1) / 2 > N) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    for (int i = 1; i <= k; i++) {
        S[i].clear();
    }

    int n = 1;
    for (int i = 1; i <= k-1; i++) {
        for (int j = i + 1; j <= k; j++) {
            S[i].push_back(n);
            S[j].push_back(n);
            n++;
        }
    }
    //std::cout << n << " " << N << std::endl;
    assert(n - 1 == N);
    std::cout << "Yes" << std::endl;
    std::cout << k << std::endl;
    for (int i = 1; i <= k; i++) {
        std::cout << S[i].size();
        for (int j = 0; j < S[i].size(); j++) {
            std::cout << " " << S[i][j];
        }
        std::cout << std::endl;
    }

    return 0;
}



Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

ll m, a, r, c, h;

int main(void)
{
    ll n, cnt=0;
    cin >> n;
    set<string> st;
    string a="MARCH";
    rep(i,n){
        string s;
        cin >> s;
        rep(j,5) if(s[0] == a[j]) st.insert(s);
    }
    vector<ll> v(5,0);
    for(auto s:st){
        rep(i,5) v[i] += s[0]==a[i];
    }
    rep(i,5)REP(j,i+1,5)REP(k,j+1,5){
        cnt += v[i]*v[j]*v[k];
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 11448
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

void solve(){
	int n,m,k;
	cin >> n >> m >> k;
	rep(a,n+1){
		rep(b,m+1){
			if(k == n*m-a*b-((n-a)*(m-b))){
				cout << "Yes" << endl;
				return;
			}
		}
	}
	cout << "No" << endl;
	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
int main()
{
    ll n;
    cin>>n;
    n%=10;
    if(n==3) cout<<"bon";
    else if(n==2||n==4||n==5||n==7||n==9) cout<<"hon";
    else cout<<"pon";
}


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

using namespace std;

typedef long long ll;

const int MAX = 100010;

int N;
ll A[MAX];
ll dp[MAX][2];

int main() {
    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    
    dp[0][0] = 0;
    dp[0][1] = -1e18;
    
    for (int i=0; i<N; i++) {
        dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i]);
        dp[i+1][1] = max(dp[i][0]-A[i], dp[i][1]+A[i]);                
    }

    cout << dp[N][0] << endl;
}


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

typedef long long ll;

string s, t, u;
int a, b;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s >> t >> a >> b >> u;
    if (u == s)
        --a;
    else
        --b;
    cout << a << ' ' << b << endl;


    return 0;
}



Measured memory_bytes: 256
def main():
  e,M=enumerate,10**9+7
  n,k,*a=map(int,open(0).read().split())
  dp=[[0]*(k+1)for _ in range(n+1)]
  dp[0][0]=1
  for i,(b,d,a)in e(zip(dp,dp[1:],a),1):
    t=0
    for j,v in e(b):
      t+=v
      if j>a:t-=b[~a+j]
      t%=M
      d[j]=t
  print(t)
main()

Measured memory_bytes: 119516
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n; cin >> n;
  vector<ll> a(n);
  rep (i, n) cin >> a[i]; 
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    ans += max(0LL, a[i-1]-a[i]);
    a[i] += max(0LL, a[i-1]-a[i]);
  }
  cout << ans << endl;

  return 0;
}

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

long long qabs(long long x){
	return (x > 0) ? x : -x;
}

int main(){
	long long N, A, B;
	scanf("%lld%lld%lld", &N, &A, &B);
	if((A&1) == (B&1)) cout << qabs(A-B) / 2 << endl;
	else cout << min((2*N - A - B + 1) / 2, (A + B - 2 + 1) / 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;
int main() {
	string x;
	getline(cin, x);
	for (int i = 0; i < x.size(); i++) {
		if ('a' <= x[i] && x[i] <= 'z')cout << (char)(x[i] + ('A' - 'a'));
		else if ('A' <= x[i] && x[i] <= 'Z')cout << (char)(x[i] + ('a' - 'A'));
		else cout << x[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3216
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {l: f64};

    // let x = l % 3;

    // let v = if x == 2 {
    //     l / 3 * (l / 3 + 1) * (l / 3 + 1)
    // } else if x == 1 {
    //     l / 3 * l / 3 * (l / 3 + 1)
    // } else {
    //     l / 3 * l / 3 * l / 3
    // };

    let v = l / 3.0 * l / 3.0 * l / 3.0;

    println!("{}", v);
}


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<bool> vec(102, true);
	rep(i, n){
		int a;
		cin >> a;

		vec[a] = false;
	}

	int sub = x;
	int ans = 0;

	rep(i, vec.size()){
		if(vec[i] && abs(x - i) < sub){
			sub = abs(x - i);
 			ans = i;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3624
import java.io.*;
import java.io.ObjectInputStream.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	//final static long MOD = 998244353;

	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solutionA(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solutionA(String[] args) throws Exception{
		int H = nextInt();
		int W = nextInt();

		int[][] c = new int[10][10];
		for(int i=0;i<10;i++) {
			c[i]=nextInts();
		}
		int[][] A = new int[H][];
		for(int i=0;i<H;i++) {
			A[i]=nextInts();
		}

		int[] to = new int[10];
		Arrays.fill(to,-1);
		to[1]=0;

		boolean[] flg=new boolean[10];
		Arrays.fill(flg,true);
		for(int i=0;i<10;i++) {
			if(i!=1) {
				to[i]=dfs(i,flg,10,c,0);
			}
//			pw.println(to[i]);
//			pw.flush();

		}

		long ans = 0;
		for(int h=0;h<H;h++) {
			for(int w=0;w<W;w++) {
				if(A[h][w]!=-1) {
					ans+=to[A[h][w]];
				}
			}
		}
		pw.println(ans);
	}

	public static int dfs(int n,boolean[] flg,int remain, int[][] c ,int sum) {
		if(remain ==0) {
			return sum;
		}
		int ans=sum+c[n][1];
		for(int i=0;i<flg.length;i++) {
			if(flg[i]) {
				if(c[n][i] < c[n][1]) {
					flg[i]=false;
					ans=Math.min(ans,dfs(i,flg,remain-1,c,sum+c[n][i]));
					flg[i]=true;
				}
			}
		}
		return ans;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}



Measured memory_bytes: 25300
N = list(input())
if len(set(N)) == 1:
    print(''.join(N))
else:
    b = int(N[0])*100+int(N[0])*10+int(N[0])
    real_n = int(N[0])*100+int(N[1])*10+int(N[2])
    
    if real_n < b:
        print(b)
    else:
        print(str(int(N[0])+1)*3)

Measured memory_bytes: 3060
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;

void main()
{
	auto tokens = split(chomp(readln()));
	int[] abc;
	abc ~= to!int(tokens[0]);
	abc ~= to!int(tokens[1]);
	abc ~= to!int(tokens[2]);
	abc.sort();
	
	writeln(abc[2] * 10 + abc[0] + abc[1]);
	stdout.flush();
}

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

using namespace std;

template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for (auto &item : a) {
        in >> item;
    }
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
    for (auto &item : a) {
        out << item << " ";
    }
    return out;
}

template<typename T>
ostream &operator<<(ostream &out, vector<vector<T>> &a) {
    for (auto &item : a) {
        out << item << "\n";
    }
    return out;
}

const int MAXN = (int) 1e7;

struct Fenv {
    int n;
    int t[MAXN];

    Fenv(int n) : n(n) { }

    int sum(int r) {
        int res = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1) res += t[r];
        return res;
    }

    void inc(int i, int d) {
        for (; i < n; i = (i | (i + 1))) t[i] += d;
    }

    int sum(int l, int r) {
        return sum(r - 1) - sum(l - 1);
    }

    void clear() {
        fill_n(t, n, 0);
    }
};

const int INF = (int) 1e9;
const int LOGN = 29;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    int a[n], b[n];
    int have[3 * n * LOGN];
    int haveSz = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        int msk = 0;
        for (int l = 0; l < LOGN; ++l) {
            msk |= 1 << l;
            have[haveSz++] = a[i] & msk;
        }
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
        int msk = 0;
        for (int l = 0; l < LOGN; ++l) {
            msk |= 1 << l;
            have[haveSz++] = b[i] & msk;
        }
    }
    sort(have, have + haveSz);
    haveSz = (int)(unique(have, have + haveSz) - have);
    auto get = [&](int x) {
        return (int) (lower_bound(have, have + haveSz, x) - have);
    };
    int ans = 0;
    Fenv f(haveSz);
    int lsh = 1;
    int msk = 1, ost = 0;
    for (int l = 0; l < LOGN; ++l, lsh <<= 1) {
        msk |= lsh;
        f.clear();
        for (int i = 0; i < n; ++i) {
            f.inc(get(b[i] & msk), 1);
        }
        int res = 0;
        for (int i = 0; i < n; ++i) {
            if ((a[i] >> l) & 1) {
                res += f.sum(get(lsh - (a[i] & ost)) - 1);
                res += f.sum(get(lsh + (lsh - (a[i] & ost))), get(INF));
            } else {
                res += f.sum(get(lsh - (a[i] & ost)),
                             get(lsh + (lsh - (a[i] & ost))));
            }
            res &= 1;
        }
        ans |= res << l;
        ost |= lsh;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 59136
#include <stdio.h>
long long a, b;
char s[5];
int main() {
	scanf("%lld", &a);
	scanf(" %s", s);
	b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + s[3] - '0';
	printf("%lld\n", a * b / 100);
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e6;
const int inf = 1e9;

int main(){
	ios_base::sync_with_stdio(0);
	int a,b,n,T,cas=0;
	cin>>n;
	vector<int> A(n);
	for(int &x: A) {
		cin>>x;
	}
	vector<int> dp(n, inf);
	dp[0]=0;
	for(int i=0;i<n;++i) {
		for(int j=i+1;j<=i+2 && j<n;++j) {
			dp[j] = min(dp[j], dp[i] + abs(A[j]-A[i]));
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif

//改造
typedef long long int ll;
using namespace std;

//ここから編集する

int main() {
    int H, W;
    int N;
    vector<int> a;
    int masu[100][100];
    cin >> H >> W >> N;
    a.push_back(0);
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    int dir = 1;//1,2,3,1,2,3...
    int x = 0, y = 0;

    if(H != 1) {
        for (int i = 1; i <= N; i++) {
            for (int j = 0; j < a[i]; j++) {
                masu[x][y] = i;
                if (dir == 1) {
                    if (y < H - 1) {
                        y++;
                    } else {
                        dir = 2;
                        x++;
                    }
                } else if (dir == 2) {
                    dir = 3;
                    y--;
                } else if (dir == 3) {
                    if (y > 0) {
                        y--;
                    } else {
                        dir = 4;
                        x++;
                    }
                } else if (dir == 4) {
                    dir = 1;
                    y++;
                }
            }
        }
    }else{
        for(int i = 1; i <= N; i++){
            for(int j = 0; j < a[i]; j++){
                masu[x][y] = i;
                x++;
            }
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << masu[j][i] << " ";
        }
        cout << endl;
    }


    return 0;
}

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

using namespace std;

long long int cnt[200005];
long long int cnt2[200005];

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

	int n,t;
	vector <int> a,b;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		a.push_back(t);
		cnt[t]++;
	}

	for(int i=0;i<n;i++)
	{
		cin >> t;
		b.push_back(t);
		cnt2[t]++;
	}

	for(int i=1;i<=n;i++)
	{
		if(cnt[i] + cnt2[i] > n)
		{
			cout << "No" << '\n';
			return 0;
		}
	}

	cout << "Yes" << '\n';

	long long int x = 0;

	for(int i=1;i<=n;i++)
	{
		cnt[i] += cnt[i-1];
		cnt2[i] += cnt2[i-1];
		x = max(x,cnt[i] - cnt2[i-1]);
	}

	for(int i=0;i<n;i++)
	{
		int idx = i + n - x;
		idx%=n;
		cout << b[idx] << ' ';
	}
	cout << '\n';

	return 0;
}


Measured memory_bytes: 8120
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    string arr[n];
    map<string , int> m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        m[arr[i]]++;
    }

    cout<<"AC x "<<m["AC"]<<endl;  
    cout<<"WA x "<<m["WA"]<<endl;  
    cout<<"TLE x "<<m["TLE"]<<endl;  
    cout<<"RE x "<<m["RE"]<<endl;  
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int ans=0;
    rep(i,3){
        if(s[i]=='1') ++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())

C = []
A = []
for i in range(N):
    t = list(map(int, input().split()))
    C.append(t[0])
    A.append(t[1:])

result = -1
for i in range(1 << N):
    t = [0] * M
    c = 0
    for j in range(N):
        if (i >> j) & 1 == 0:
            continue
        c += C[j]
        a = A[j]
        for k in range(M):
            t[k] += a[k]
    if all(x >= X for x in t):
        if result == -1:
            result = c
        else:
            result = min(result, c)
print(result)

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


int solve(vector<int> &v){
	int count =0;
	int n = v.size();
	sort(v.begin() , v.end());
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(v[i] + v[j] <= v[k]){
					break;
				}
				if(v[i] < v[j] + v[k] && v[j] < v[k] + v[i] && v[k] < v[j] + v[i]){
					count++;
				}
			}
		}
	}
	return count;
}


int main(){
	int n;
	cin >> n;
	vector<int>v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	cout << solve(v) << endl;
	return 0;
}

Measured memory_bytes: 256
input = $stdin.read.split("\n")
n,a,b = input.shift.split(" ").map(&:to_i)
s = input.shift

nai = 0
gai = 0

s.chars.each_with_index do |c|
  case c
  when "a"
    if nai + gai < a + b
      puts "Yes"
      nai = nai + 1
    else
      puts "No"
    end
  when "b"
    if nai + gai < a + b && gai < b
      puts "Yes"
      gai = gai + 1
    else
      puts "No"
    end
  when "c"
    puts "No"
  end
end


Measured memory_bytes: 9852
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int N, K;
ll dp[301][301] = {0};
vector<int> h;

int main() {
    cin >> N >> K;
    h.push_back(0);
    for (int i = 1; i <= N; i++) {
        int a;
        cin >> a;
        h.push_back(a);
    }
    h.push_back(0);
    fill(&dp[0][0], &dp[N + 1][K + 1], (ll)1e18);
    dp[0][0] = 0;
    for (int i = 1; i <= N + 1; i++) {
        for (int j = 0; j <= K; j++) {
            for (int k = 0; k <= min(i - 1, j); k++) {
                dp[i][j] = min(dp[i][j], dp[i - k - 1][j - k] + max(h[i - k - 1] - h[i], 0));
            }
            dp[i][j] = min(dp[i][j], dp[i - 1][j] + max(0, h[i - 1] - h[i]));
        }
    }
    cout << dp[N + 1][K] << endl;
}

Measured memory_bytes: 896
a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
n = int(input())
x = 0

for i in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = 0

if (a[0][0] == 0 and a[2][2] == 0 and a[1][1] == 0) or (a[0][2] == 0 and a[2][0] == 0 and a[1][1] == 0): #斜めに揃っていたら
  print("Yes")
  x = 1
for i in range(3):
  if a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0 and x == 0: #横に揃っていたら
    print("Yes")
    x = 1
    break
  elif a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0 and x == 0: #縦に揃っていたら
    print("Yes")
    x = 1
    break
if x == 0:
  print("No")

Measured memory_bytes: 3064
#include <stdio.h>
 
int main(void) {
  char n[3000000];
  int i=0;
  int sum = 0;
  
  fgets(n,sizeof(n),stdin);
  while (n[i] != '\0') {
    if ('0'<=n[i] && n[i]<='9') {
      sum += n[i] - '0';
    }
    i++;
  }
  printf("%s", sum%9==0 ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 1848
#include <stdio.h>

long z(int *a,int *b,int *c,int *d){
    return ((long)b[0]-a[0])*(d[1]-c[1])-((long)d[0]-c[0])*(b[1]-a[1]);
}
int xx(int *a,int *b,int *c,int *d){
    long v,v1,v2;
    v=z(a,b,c,d);
    if(v==0)return 0;
    v1=z(a,c,a,b);
    v2=z(a,c,c,d);
    if(v<0){
        v=-v;
        v1=-v1;
        v2=-v2;
    }
    return 0<=v1&&v1<=v&&0<=v2&&v2<=v;
}
int x(int (*a)[8],int (*b)[8]){
    int i,j;
    int *c,*d,*e,*f;
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            c=&(*a)[i*2];
            d=&(*a)[(i*2+2)%8];
            e=&(*b)[j*2];
            f=&(*b)[(j*2+2)%8];
            if(z(e,f,e,c)>0)break;
        }
        if(j==4)return 1;
    }
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            c=&(*b)[i*2];
            d=&(*b)[(i*2+2)%8];
            e=&(*a)[j*2];
            f=&(*a)[(j*2+2)%8];
            if(z(e,f,e,c)>0)break;
        }
        if(j==4)return 1;
    }
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            c=&(*a)[i*2];
            d=&(*a)[(i*2+2)%8];
            e=&(*b)[j*2];
            f=&(*b)[(j*2+2)%8];
            if(xx(c,d,e,f))return 1;
        }
    }
    return 0;
}

int main(){
    int n,m;
    int a[100],l[100][8],b[100];
    int i,j,k;
    int min,ii,jj,kk;
    while(scanf("%d",&n)&&n){
        while(n--){
            scanf("%d",&m);
            for(i=0;i<m;i++){
                a[i]=i;
                for(j=0;j<8;j++)scanf("%d",&l[i][j]);
            }
            for(i=0;i<m;i++){
                for(j=i+1;j<m;j++){
                    if(x(&l[i],&l[j])){
                        k=0;
                        ii=i;
                        while((b[k++]=ii),a[ii]!=ii)ii=a[ii];
                        jj=j;
                        while((b[k++]=jj),a[jj]!=jj)jj=a[jj];
                        min=ii<jj?ii:jj;
                        for(kk=0;kk<k;kk++)a[b[kk]]=min;
                    }
                }
            }
            for(i=0;i<m;i++){
                j=i;
                while(a[j]!=j)j=a[j];
                a[i]=j;
            }
            k=0;
            for(i=0;i<m;i++){
                for(j=0;j<i;j++){
                    if(a[i]==a[j])break;
                }
                if(j==i)k++;
            }
            printf("%d\n",k);
        }
    }
    return 0;
}

Measured memory_bytes: 604
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;

/*
  ch は大きいほうが良い
 */
struct Trie {
    int val;
    Trie * ch[26];
    Trie() : val(0) {
        fill(ch,ch+26,nullptr);
    }
    ~Trie(){
        for(auto & p : ch) delete p;
    }
};

void insert(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s=='\0'){
            cur->val++;
            break;
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) nxt = new Trie();
            cur = nxt;
            s++;
        }
    }
}

bool erase(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s == '\0'){
            if(cur->val > 0){
                cur->val--;
                return true;
            } else {
                return false;
            }
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) return false;
            cur = nxt;
            s++;
        }
    }
}

bool find(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s == '\0'){
            return cur->val > 0;
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) return false;
            cur = nxt;
            s++;
        }
    }
}

int main(){
    int n;
    cin >> n;
    Trie * root = new Trie();
    rep(i,n){
        char com[15], str[15];
        cin >> com >> str;
        if(com[0] == 'i'){
            insert(str,root);
        } else {
            puts(find(str,root) ? "yes" : "no");
        }
    }
    delete root;
}

Measured memory_bytes: 77236
h,w=map(int,input().split())
while h!=0 or w!=0:
    for j in range(h):
        for i in range(w):
            if j%2==0:
                if i%2==0:
                    print("#",end="")
                else:
                    print(".",end="")
            else:
                if i%2!=0:
                    print("#",end="")
                else:
                    
                
                
                    print(".",end="")
        print()
            
    print()
    h,w=map(int,input().split())
        
        
        
    
    
        
        
        
    
    
    
        


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}



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

	ll a=1,b=1;
	int parity=1;
	ll res=n;
	ll ans=INF*INF;
	for (ll i = 1; i*i <= n; i++){
		// while(res%i==0){
		// 	if(parity>0)a*=i;
		// 	else b*=i;
		// 	res/=i;
		// 	parity*=-1;
		// }
		if(n%i==0)ans=min(ans,i+n/i-2);
	}
	// if(parity>0)a*=res;
	// else b*=res;
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
N = int(input())

if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:
    print("hon")
elif N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print("pon")
elif N%10==3:
    print("bon")


Measured memory_bytes: 9036
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

long long powmod(lint a,lint b){
  return b?powmod(a*a%MOD,b/2)*(b%2?a:1)%MOD:1;
}

long long fac[510000],finv[510000],inv[510000];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<510000;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
long long COM(int n,int k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
long long facdiv(lint n,lint k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return (fac[n]*finv[k])%MOD;
}


int main(void){
    COMinit();
    lint N,A,B;
    cin >> N >> A >> B;
    lint ans=powmod(2,N);
    lint minus1=1,minus2=1;
    for(int i=N;i>N-A;i--){
        minus1=(((minus1*i)%MOD)*powmod(N-i+1,MOD-2))%MOD;
    }
    for(int i=N;i>N-B;i--){
        minus2=(((minus2*i)%MOD)*powmod(N-i+1,MOD-2))%MOD;
    }
    ans=(ans+MOD*100LL-minus1-minus2-1)%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 12160
#include<cstdio>
using namespace std;
int main()
{
	int n,x[101],m,a,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x[i]);
	}
	scanf("%d",&m);
	for(i=1;i<=m;i++){
		scanf("%d",&a);
		if(x[a]+1!=x[a+1]&&x[a]!=2019){
			x[a]++;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}



Measured memory_bytes: 2764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a=0;cin>>n;
  vector<int>p(n),q(n);
  for(int i=0;i<n;i++){
    cin>>p.at(i);
    q.at(i)=p.at(i);
  }
  sort(q.begin(),q.end());
  for(int i=0;i<n;i++){
    if(p.at(i)!=q.at(i))a++;
  }
  if(a<3)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

#include <map>
#include <string>

#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cinttypes>


using namespace std;

int main()
{
	long double n, k;
	cin >> n >> k;

	int ans = 0;
	long double v = 1.0;

	while (v-1 < n)
	{
		v *= k;
		++ans;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
s=input()



"""
◆エッセンス1：割り切れるとは、二つに分けた数字のmodが一緒
例)
1817181712114の
18171が2019で割り切れるかどうかを判断する。

18171は(181712114-2114)/10000となるので、
181712114mod2019＝2114mod2019の時、2019で割り切れる。

1817181712114mod2019
 817181712114mod2019
  17181712114mod2019
   7181712114mod2019
    181712114mod2019
     81712114mod2019
      1712114mod2019
       712114mod2019
    　　・・・・
とmodを調べていき、値が同じペアは割り切れる。
"""

"""
◆エッセンス2：大きい数字は都度modを取る

これだけでもループは1回になるんだけど、
|S|が長すぎてTLEとなってしまう（|S|は10**5）
1234567 mod 2019
=(1*10**7)mod2019 + (234567mod2019)
=(1*10mod2019 * 10**6mod2019)+ (234567mod2019)

10**nを毎回modを取ることで、計算する数字の長さを短くする。

"""



#modの値を保持する配列
cnt=[0]*2019
#mod2019 =0 は、それ一つで割り切れるので。引き算をする必要が無い。
cnt[0]=1

#10の倍数を保持する
fac=1
ss=0
for i in range(len(s)):
    #後ろの数字から順番にとってくる
    ss += int(s[len(s)-i-1])*fac
    ss%=2019
    fac=fac*10
    fac%=2019
    cnt[ss]+=1
    

result=0
for c in cnt:
    result+=c*(c-1)//2

print(result)





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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;

  vector<pair<int, int> > list(M);
  int a, b;
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    list[i] = make_pair(b, a);
  }
  sort(list.begin(), list.end());

  int ans = 0;
  int p = -1;
  for (int i = 0; i < list.size(); i++) {
    if (p < list[i].second) {
      p = list[i].first - 1;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1152
n=int(input())
cnt=0
flg=False
for _ in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        cnt+=1
    else:
        cnt=0
    if cnt>=3:
        flg=True
        break
print("Yes") if flg else print("No")

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

using namespace std;
int main() {
    int n;
    cin >> n;
    
    string str;
    cin >> str;
    
    int Left{};
    int Right{};
        for(int i = 0; i < n; ++i){
            char c = str[i];
            switch(c) {
                case '(':
                    ++Left;
                    break;
                case ')' :
                    if(Left != 0) {
                        --Left;
                    }
                    else {
                        ++Right;
                    }
                    break;
            }
        }
    
    while(Right!= 0) {
        cout << '(';
        Right--;
    }
    cout << str;
    while(Left!= 0) {
        cout << ')';
        Left--;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var N: Long
    N = sc.nextLong()
    var K: Long
    K = sc.nextLong()
    solveAbc126C(N, K)
}

fun solveAbc126C(N: Long, K: Long) {
    var res = 0.0

    for (i in 1 .. N) {
        var k = 0L
        var s = i

        while (s < K) {
            s *= 2
            k++
        }

        res += Math.pow(0.5, k.toDouble()) / N
    }

    System.out.printf("%.15f\n", res)
}



Measured memory_bytes: 31264