akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
    return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

void func(long long H, long long N, std::vector<long long> A)
{
    ll sum = 0;
    int i = 0;
    rep(i, N)
    {
        sum += A[i];
    }
    if (sum >= H)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

int main()
{
    // cout << fixed << setprecision(5);

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


Measured memory_bytes: 1024
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

template <typename T>
struct mat {
    // 行列m
    vector<vector<T>> m;

    mat(int h, int w, T d)
        : m(vector<vector<T>>(h, vector<T>(w, d)))
    {
    }

    mat(int n)
        : m(vector<vector<T>>(n, vector<T>(n)))
    {
        for (int i = 0; i < n; i++) {

            m[i][i] = static_cast<T>(1);
        }
    }

    // 添字演算子
    vector<T> operator[](const int i) const { return m[i]; } //読み取り
    vector<T>& operator[](const int i) { return m[i]; } //書き込み
    // 行数・列数
    int nrow = m.size();
    int ncol = m[0].size();
    // 行列同士の演算
    mat& operator=(const mat& a)
    {
        for (int i = 0; i < nrow; i++) {
            for (int j = 0; j < ncol; j++) {
                m[i][j] = a[i][j];
            }
        }
        return *this;
    }

    mat& operator*=(const mat& a)
    {
        mat<T> m2(nrow, ncol, static_cast<T>(0));
        for (int i = 0; i < nrow; i++) {
            for (int j = 0; j < ncol; j++) {
                for (int k = 0; k < nrow; k++) {
                    m2[i][j] = (m2[i][j] + (m[i][k] * a[k][j]) % MOD) % MOD;
                }
            }
        }
        for (int i = 0; i < nrow; i++) {
            for (int j = 0; j < ncol; j++) {
                m[i][j] = m2[i][j];
            }
        }
        return *this;
    }

    mat operator*(const mat& a) const { return static_cast<mat>(*this) *= a; }
};

int N;
ll K;

mat<ll> powMat(mat<ll> m, ll a);

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

    cin >> N >> K;

    mat<ll> m(N, N, 0);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> m[i][j];
        }
    }

    mat<ll> ans = powMat(m, K);
    ll path = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            path = (path + ans[i][j]) % MOD;
        }
    }

    cout << path << "\n";

    return 0;
}

mat<ll> powMat(mat<ll> m, ll a)
{
    mat<ll> ans(N);
    while (a > 0) {
        if (a & 1) {
            ans = ans * m;
        }
        m = m * m;
        a >>= 1;
    }
    return ans;
}

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

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

    int ans = 999;
    for (int i = 0; i + 2 < s.length(); i++) {
        ans = min(ans, abs(753 - (s[i] - '0') * 100 - (s[i+1] - '0') * 10 - (s[i+2] - '0')));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define inf 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll n,sum=0,ans=0,a[200000]={};
    cin>>n;
    REP(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sum%=1000000007;
    REP(i,n){
        sum-=a[i];
        sum=(ll)(sum+1e9+7)%(ll)(1e9+7);
        ans+=a[i]*sum;
        if(ans>=1000000007) ans%=1000000007;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5172
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 3e5+5;
const int mod = 1e9+7;
using namespace std;

ll a[maxn],dp[maxn];

const int N=300010;

struct TR
{
    int l;
    int r;
    int sum;
    int maxv;
}tr[4*N];
int w[N];
int n,m;

void pushup(int u){
    tr[u].sum=tr[u<<1].sum+tr[u<<1|1].sum;
    tr[u].maxv=max(tr[u<<1].maxv,tr[u<<1|1].maxv);
}

void build(int u,int l,int r){
    if(l==r) tr[u]={l,r,w[r],w[r]};
    else{
        int mid=(l+r)>>1;
        tr[u]={l,r};
        build(u<<1,l,mid);
        build(u<<1|1,mid+1,r);
        pushup(u);
    }
}

int query(int u,int l,int r){
    if(tr[u].l>=l&&tr[u].r<=r) return tr[u].sum;
    int mid=(tr[u].r+tr[u].l)>>1;
    int sum=0;
    if(l<=mid) sum+=query(u<<1,l,r);
    if(r>mid) sum+=query(u<<1|1,l,r);
    return sum;
}

void modify(int u,int x,int v){
    if(tr[u].l==tr[u].r){
        tr[u].sum=v;//直接把一点的值进行修改而不需要像树状数组那样+一个值再-一个值 
        tr[u].maxv=v;
    }else{
        int mid=(tr[u].l+tr[u].r)>>1;
        if(x<=mid) modify(u<<1,x,v);
        else modify(u<<1|1,x,v);
        pushup(u);
    }
}

int qmax(int u,int l,int r){//查找一段区间中的最大值 
    if(tr[u].l>=l&&tr[u].r<=r) return tr[u].maxv;
    int mid=(tr[u].l+tr[u].r)>>1;
    int Max=-1;
    if(l<=mid) Max=qmax(u<<1,l,r);
    if(r>mid) Max=max(Max,qmax(u<<1|1,l,r));

    return Max;
}

void solve() {
	ll n,k,ans=1; cin >> n >> k;
	rep(i,0,n) {
		cin >> a[i];
	}
	build(1,1,300006);
	//dp[0]=1;
	rep(i,0,n) {
		ll t = qmax(1,max(a[i]+1ll-k,1ll), min(a[i]+1ll+k,300006ll));
		//cout << i << ' ' << t << '\n';
		dp[i] = t + 1;
		modify(1,a[i]+1,dp[i]);
	}
	rep(i,0,n) {
		ans = max(dp[i], ans);
	}
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}


Measured memory_bytes: 24696
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn =new Scanner(System.in);
		int n = scn.nextInt(), m = scn.nextInt(), o = scn.nextInt();
		int min = Math.min(Math.min(n,m),o);
		int max = Math.max(Math.max(n, m), o);
		System.out.println(max-min + "\n");
		scn.close();
	}
}


Measured memory_bytes: 21972
#include<iostream>
using namespace std;
int main()
{
int h;
int a;

cin>>h;
cin>>a;
if(h<1 || h>10000 || a<1 || a>10000)
{
    return 0;
}
int save=a;
int result=1;
while(h>a)
{

    a=save+a;
    result=result+1;
}
cout<<result<<endl;
}


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

int main() {
  // 入力
  string S;
  cin >> S;

  string result = "No";
  if (S[0]!=S[1] || S[1]!=S[2]) {
    result = "Yes";
  }

  // 出力
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, S, X[N];
long long P[N];
int main() {
	scanf("%d%d", &n, &S);
	for (int i = 1; i <= n; i++) {
		scanf("%d%lld", &X[i], &P[i]);
	}
	long long ans = 0;
	int lastd = 0, L = 1, R = n;
	while (true) {
		if (X[L] >= S) {
			ans += X[R] - S;
			break;
		}
		if (X[R] <= S) {
			ans += S - X[L];
			break;
		}
		if (P[L] >= P[R]) {
			if (lastd != 1) {
				lastd = 1;
				ans += X[R] - X[L];
			}
			P[L] += P[R];
			R--;
		} else {
			if (lastd != 2) {
				lastd = 2;
				ans += X[R] - X[L];
			}
			P[R] += P[L];
			L++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
  int n, out[6]={0};
  double d;
  cin >> n;
  while(n--){
    cin >> d;
    if(d<165.0)
      out[0]++;
    else if(d<170.0)
      out[1]++;
    else if(d<175.0)
      out[2]++;
    else if(d<180.0)
      out[3]++;
    else if(d<185.0)
      out[4]++;
    else
      out[5]++;
  }
  for(int i=0; i<6; i++){
    cout << i+1 << ":";
    for(int j=0; j<out[i]; j++)
      cout << "*";
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,f=0,mini=INF;
    ll sum=0,maxi=0;
    string str,sub;
    ll h,w;
    ll m,k,d;
    cin>>n;
    vector<pair<ll,ll>> p(n);
    rep(i,n) {
        cin>>a>>b;
        p[i]=make_pair(b,a);
    }
    sort(p.begin(),p.end());
    cout<<endl;
    //priority_queue<ll, vector<ll>,greater<ll>> q;
    ll days=0;
    rep(i,n){
        //        cout<<p[i].first<<" "<<p[i].second<<" "<<days<<endl;

        if(p[i].second+days>p[i].first){
            
            No;
            return 0;
        }
        days+=p[i].second;
        //cout<<p[i].first<<" "<<p[i].second<<" "<<days<<endl;
    }
    Yes;
    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int N;
    cin >> N;
    int count = 0;
    for (int i=1; i<=N; i++) {
        int n;
        cin >> n;
        if (i % 2 != 0 && n % 2 != 0) {
            count += 1;
        }

    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3620
n=int(input())
a=[list(map(int,input().split())) for _ in [0]*n]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if a[i][j] > a[i][k] + a[k][j]:
                print(-1)
                exit()
ans=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(n):
            if i != k and j != k and a[i][j] == a[i][k] + a[k][j]:
                break
        else:
            ans += a[i][j]
    
print(ans)

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    string s; cin >> s;

    int ans;

    for (int i = 1; i < s.size(); ++i) {
        string t = s;
        t.erase(i);

        if (t.size() % 2 != 0) {
            continue;
        }

        string a, b;
        a = t.substr(0, t.size()/2);
        b = t.substr(t.size()/2, t.size()/2);

        if (a == b) {
            ans = t.size();
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import itertools
a,b,c,d = map(int,list(input()))

def change_pnsign(op):
    if op == 1:
        op = "+"
        return op
    else:
        op = "-"
        return op


list = [1,-1]
for op1,op2,op3 in itertools.product(list,list,list):
    ans = a+op1*b+op2*c+op3*d
    if ans == 7:
        OP1=change_pnsign(op1)
        OP2=change_pnsign(op2)
        OP3=change_pnsign(op3)
        print(f"{a}{OP1}{b}{OP2}{c}{OP3}{d}=7")
        sys.exit()



Measured memory_bytes: 9192
#include<iostream>
#include<vector>
using namespace std;
string S;
long long K;

int main(){
  cin >> S >> K;
  int n = S.length();
  for(int i=0; i<n-1; i++){
    if('z'-S[i]+1 <= K && S[i] != 'a'){
      K -= 'z'-S[i]+1;
      S[i] = 'a';
    }
  }
  K = K % 26;
  for(int i=0; i<K; i++){
    if(S[n-1] == 'z') S[n-1] ='a';
    else S[n-1]++;
  }
  cout << S << endl;
}


Measured memory_bytes: 640
class Node:
    def __init__(self, id):
        self.id = id
        self.parent = -1
        self.right = -1
        self.left = -1
        self.sibling = -1
    def getDegree(self):
        count=0
        if self.right is not -1:
            count += 1
        if self.left is not -1:
            count += 1
        return count
    def getDepth(self):
        count = 0
        parent= self.parent
        while parent is not -1:
            count += 1
            parent = parent.parent
        return count
    def getType(self):
        if self.parent == -1:
            return 'root'
        elif self.left is -1 and self.right is -1:
            return 'leaf'
        else:
            return 'internal node'
    def getHeight(self, node, count =0):
        if node == -1:
            return -1
        if (node.left == -1 and node.right == -1):
            return 0
        else:
            return max(self.getHeight(node.left, count+1)+1, self.getHeight(node.right,count+1)+1)
n = int(input())
nodes = [Node(i) for i in range(n)]
for i in range(n):
    id, left, right = map(int, input().split())
    if left != -1:
        nodes[id].left = nodes[left]
        nodes[left].parent = nodes[id]
    if right != -1:
        nodes[id].right = nodes[right]
        nodes[right].parent = nodes[id]
    if left != -1 and right != -1:
        nodes[left].sibling = nodes[right]
        nodes[right].sibling = nodes[left]

for i in nodes:
    output = ""
    output +=f'node {i.id}: '
    output +=f'parent = {i.parent if i.parent == -1 else i.parent.id}, '
    output +=f'sibling = {i.sibling if i.sibling == -1 else i.sibling.id}, '
    output +=f'degree = {i.getDegree()}, '
    output +=f'depth = {i.getDepth()}, '
    output +=f'height = {i.getHeight(i)}, '
    output +=f'{i.getType()}'
    print(output)
    


Measured memory_bytes: 5640
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define ff fflush(stdout)
using namespace std;
ll freq[30];
int main () {
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	str A;
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> A; a = A.length();
	SET(freq, 0);
	for (i = 0; i < A.length(); i++) {
		freq[A[i] - 'a']++;
	}
	ll sub = 0;
	for (i = 0; i < 26; i++) {
		sub += freq[i] * (freq[i] - 1) / 2;
	}
	ll all = a * (a - 1) / 2;
	printf("%lld\n", all - sub + 1);
	return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

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

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<pii> vpii;
typedef vector<vint> det1;
typedef vector<vpii> det2;

const ll INF = 10000000001;
ll X, Y, Z, K;

const int MAXN = 1024;
ll xs[MAXN], ys[MAXN], zs[MAXN];

struct Vertex
{
    ll xi, yi, zi, value;

    Vertex(ll xxi, ll yyi, ll zzi)
    : xi(xxi), yi(yyi), zi(zzi), value(xs[xxi] + ys[yyi] + zs[zzi])
    {}
};

bool operator< (const Vertex& a, const Vertex& b)
{
    return a.value < b.value;
}

bool dp[MAXN][MAXN][MAXN];

int main()
{
    cin >> X >> Y >> Z >> K;

    rep(i, X) { cin >> xs[i]; }
    rep(i, Y) { cin >> ys[i]; }
    rep(i, Z) { cin >> zs[i]; }

    std::sort(xs, xs + X, std::greater<ll>());
    std::sort(ys, ys + Y, std::greater<ll>());
    std::sort(zs, zs + Z, std::greater<ll>());

    std::priority_queue<Vertex> Q;

    const auto push = [&](ll xi, ll yi, ll zi) {
        if (xi >= X || yi >= Y || zi >= Z) { return; }
        if (dp[xi][yi][zi]) { return; }
        
        Q.push(Vertex(xi, yi, zi));
        dp[xi][yi][zi] = true;

    };

    Q.push(Vertex(0, 0, 0));
    dp[0][0][0] = true;

    rep(i, K)
    {
        if (Q.empty()) { break; }

        const Vertex v = Q.top();
        Q.pop();

        cout << v.value << endl;

        push(v.xi + 1, v.yi, v.zi);
        push(v.xi, v.yi + 1, v.zi);
        push(v.xi, v.yi, v.zi + 1);
    }

    return 0;
}


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

main()
{
  while(1){
    int n,p; cin >> n >> p;
    if(n == 0) break;
    vi m(n);
    int pos = 0;
    int tmp = p;
    while(1){
      if(tmp > 1){
	tmp--;
	m[pos]++;
      }else if(tmp == 1){
	tmp--;
	m[pos]++;
	if(m[pos] == p){
	  cout << pos << endl;
	  break;
	}
      }else{
	tmp = m[pos];
	m[pos] = 0;
      }
      pos++;
      pos %= n;
    }	
  }
}


Measured memory_bytes: 2968
class UnionFind:
    def __init__(self, n):
        self.par =[i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
n,m=map(int,input().split())
x=UnionFind(n)
lists=list(map(int,input().split()))          
for i in range(m):
    a,b=map(int,input().split())
    x.union(a,b)
uselist=[0]*n
for i in range(1,n+1): 
    uselist[i-1]=x.find(i)
grouplist=[[]for i in range(n+1)]
sublist=[[]for i in range(n+1)]
for i in range(n):
    grouplist[uselist[i]].append(lists[i])
    sublist[uselist[i]].append(i+1)
ans=0
for i in range(n+1):
    x=set(grouplist[i]) & set(sublist[i])
    ans+=len(x)
print(ans)

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

using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	vector<int>count(3);
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if (x <= a)count[0]++;
		else if (x <= b)count[1]++;
		else count[2]++;
	}
	int ret = n; for (int i = 0; i < 3; i++)ret = min(ret, count[i]);
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int div2cnt(int x)
{
    int cnt = 0;
    while(0 == x % 2)
    {
        cnt++;
        x /= 2;
    }

    return cnt;
}

int main()
{
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        ans += div2cnt(a[i]);
    }

    cout << ans << endl;


    return 0;
}


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

void allprint(int*,int);

int main(){
    int n;
    int *heap;

    scanf("%d",&n);
    heap=malloc(sizeof(int)*n+1);

    for(int i=1;i<=n;i++){
        scanf("%d",&heap[i]);
    }

    allprint(heap,n);

    return 0;
}

void allprint(int* heap,int max){
    int parent;
    int right;
    int left;

    for(int i=1;i<=max;i++){
        parent=i/2;
        right=i*2+1;
        left=i*2;
        printf("node %d: key = %d, ",i,heap[i]);
        if(parent>0){
            printf("parent key = %d, ",heap[parent]);
        }
        if(left<=max&&right<=max){
            printf("left key = %d, right key = %d, \n",heap[left],heap[right]);
        }
        else if(left>max&&right<=max){
            printf("right key = %d, \n",heap[right]);
        }
        else if(right>max&&left<=max){
            printf("left key = %d, \n",heap[left]);
        }
        else{
            printf("\n");
        }
    }
}



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

int main(){
  int h, w;
  while (true){
    cin >> h >> w;
    if(h==0 && w == 0){break;}
    for (int i = 0; i < h; i++){
      for (int a = 0; a < w; a++){
        cout << "#";
      }
      cout << "\n";
    }
    cout << "\n";
  }
}


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

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

int main(){
    long long int a,b,k;
    cin>>a>>b>>k;
    
    long long int c=b-a+1;
    
    if(c>=2*k){
        for(long long int i=0;i<k;i++){
            cout<<a+i<<endl;
        }
        for(long long int i=k-1;i>=0;i--){
            cout<<b-i<<endl;
        }
    }
            
    else rep(i,c)cout<<a+i<<endl;
    
}

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

def string_two_numbers_spliter():
    a, b = [int(i) for i in input().split()]
    return a, b


def main():
    a, b = string_two_numbers_spliter()

    if a < b:
        print('a < b')
    elif a > b:
        print('a > b')
    else:
        print('a == b')


if __name__ == '__main__':
    main()

Measured memory_bytes: 7748
#include<bits/stdc++.h>
using namespace std;
#define mod             1000000007
#define w(x)            int x; cin>>x; while(x--)
#define mk(arr,n,type)  type *arr=new type[n];
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int t, p = 360, i = 2;
	cin >> t;
	while (p % t != 0) {
		p = 360 * i;
		i = i + 1;
	}
	cout << p / t << endl;
	return 0;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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


void Calc() {

  int x = in;
  int cnt = 0;
  ll now = 0;
  rep(i, 1, x+1) {
    now += i;
    cnt++;
    err(now, cnt,now>=x,x);
    if (now  >= x)break;
  }
  cout << (cnt) << endl;
}


Measured memory_bytes: 256
a,b = gets.split.map(&:to_i)  
arr = gets.split.map(&:to_i)

if b == 0
  puts a
else
	unless arr.include?(a)
  		puts a
	else
      for n in 1..b do
        unless arr.include?(a-n)
            puts (a-n)
            break
        end  
        unless arr.include?(a+n) 
            puts (a+n)
            break
        end
      end
    end
end

Measured memory_bytes: 14256
n = int(input())
a = []
b = []
c = []
for i in range(n):
    A,B,C = map(int,input().split())
    a.append(A)
    b.append(B)
    c.append(C)

dp = [[0]*n for _ in range(3)]

dp[0][0] = a[0]
dp[1][0] = b[0]
dp[2][0] = c[0]

for i in range(1,n):
    for j in range(3):
        if j==0:
            dp[j][i] = max(dp[1][i-1] + a[i], dp[2][i-1] + a[i])
        elif j==1:
            dp[j][i] = max(dp[0][i-1] + b[i], dp[2][i-1] + b[i])
        else:
            dp[j][i] = max(dp[0][i-1] + c[i], dp[1][i-1] + c[i])

print(max(dp[0][n-1], dp[1][n-1], dp[2][n-1]))


Measured memory_bytes: 27136
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;  //このネームスペースを使う

int main(){
  int A ,B, C ;

  cin >> A >> B >> C ;
  
  if(C - (A-B) > 0){
    cout << C-(A-B) << endl;
  }
  else{
     cout << 0 << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool eaten[101];
int main(){
    int n,k,d;
    int cnt=0;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        cin>>d;
        int a;
        for(int u=0;u<d;u++){
            cin>>a;
            eaten[a]=true;
        }
    }
    for(int i=1;i<=n;i++){
        if(eaten[i]==false){
            cnt++;
        }
       
    }
     cout<<cnt<<"\n";
    // for(int i=1;i<=n;i++){
        // cout<<i<<" "<<eaten[i]<<"\n";
    // }
}

Measured memory_bytes: 3612
n, d = gets.chomp.split.map(&:to_i)
ans = 0

n.times do
  # スペース区切りの整数の入力
x, y = gets.chomp.split.map(&:to_i)
  if  ( x * x + y * y) ** (1/2.0) <= d
    ans += 1
  end
end

# 出力
puts ans

Measured memory_bytes: 14980
char S[12];
char out[2<<20];
int outsz,Slen;
main()
{
	int N,K;
	scanf("%d%d ",&N,&K);
	gets(S);
	Slen=strlen(S);
	S[Slen++]='\n';
	for(int i=0;i<K;i++)
	{
		write(1,S,Slen);
	}
	for(int i=K;i<N;i++)
	{
		out[outsz++]='7';
		out[outsz++]='\n';
	}
	write(1,out,outsz);
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main(){
    int H,W;
    cin>>H>>W;
    vector<string> Grid(H);
    for(int i=0; i<H; ++i) cin>>Grid[i];
    vector<vector<long long>> Dp(H, vector<long long>(W,0));
    Dp[0][0]=1;
    vector<int> r = {0,-1};
    vector<int> c = {-1,0};
    for(int i=0; i<H; ++i){
        for(int j=0; j<W; ++j){
            if(Grid[i][j]=='.'){
                long long temp=0;
                for(int k=0; k<2; ++k){
                    int rr = i+r[k], cc = j+c[k];
                    if(rr>=0 && rr<H && cc>=0 && cc<W && Grid[rr][cc]=='.') temp=((temp)%mod+(Dp[rr][cc])%mod)%mod;
                }
                Dp[i][j]=max(Dp[i][j],temp);
            }
            else Dp[i][j]=0;
        }
    }
    int ans = Dp[H-1][W-1];
    cout<<ans<<"\n";
    // for(vector<long long> s: Dp){
    //     for(long long x: s) cout<<x<<" ";
    //     cout<<"\n";
    // }
}

Measured memory_bytes: 13004
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<(a!=c)<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
fff = []
ppp = []
for i in range(n):
    fff.append(na())
for i in range(n):
    ppp.append(na())
ans = -9999999999999999999999
for b in range(1, 1<<10):
    s = 0
    for i in range(n):
        c = 0
        for j in range(10):
            if (b >> j & 1) and (fff[i][j] == 1):
                c += 1
        s += ppp[i][c]
    if ans < s:
        ans = s
print(ans)


Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
int main(){
  int r,g,b,n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  for(int i=0;i<n/r+1;i++){
    int nn = n-r*i;
    for(int j=0;j<nn/g+1;j++){
      int nnn = nn-g*j;
      if(nnn%b==0){
        ans++;
      }
    }
  }
  cout << ans << endl;
}


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

class Program
{
    static void Main()
    {
        var nd = Console.ReadLine().Split(' ').Select(x=>Int32.Parse(x)).ToArray();
        var N = nd[0];
        var D = nd[1];

        var ableCount = D * 2 + 1;
        var ans = (N+(ableCount-1))/ableCount;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n;
	ll a[n];
	ll xy[n][n];
	memset(xy, 0, sizeof(xy));
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		for(ll j = 0; j < a[i]; j++){
			ll x, y;
			cin >> x >> y;
			if(y == 1){
				xy[i][x-1] = 1;
			}
			else{
				xy[i][x-1] = -1;
			}
		}
	}
	
	//rep(i, 0, n-1){rep(j, 0, n-1){cout << xy[i][j];}cout << endl;}
	
	ll ans = 0;
	for(ll bit = 0; bit < (1 << n); bit++){
		bool flag = true;
		for(ll i = 0; i < n; i++){
			for(ll j = 0; j < n; j++){
				if(xy[i][j] == 1){
					if((bit & (1 << i)) && !(bit & (1 << j))){
						flag = false;
					}
				}
				if(xy[i][j] == -1){
					if((bit & (1 << i)) && (bit & (1 << j))){
						flag = false;
					}
				}
			}
		}
		//cout << bit << " " << flag << endl;
		if(flag){
			ans = max(ll(__builtin_popcount(bit)), ans);
		}
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(){
  int max = 0;
  string str,maxs;
  map<string,int> M;
  while( cin >> str ){
    if(max < (int)str.size()){
      max = str.size();
      maxs = str;
    }
    M[str]++;
  }
  string fs;
  int m = 0;
  for( map<string,int>::iterator it = M.begin(); it != M.end(); it++ ){
    if(m < (*it).second){
      m = (*it).second;
      fs = (*it).first;
    }
  }
  cout << fs << " " << maxs << endl;
}

Measured memory_bytes: 1196
s=gets.chomp.split("")
s.sort!
lists=s.uniq
flag=0
lists.each{|i|
	count=0
	while s[0]==i do
		count+=1
		s.delete_at(0)
	end
	if count%2!=0 then
		puts("No")
		flag=1
		break
	end
	
}
if flag==0 then
	puts("Yes")
end

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

using namespace std;
const int N = 1e5 + 3;
vector<int> adj[N];

struct State {
	int node, cost, mod;
	bool const operator<(const State &e) const {
		return e.cost < cost;
	}
};

int dist[N][4];
int dijkstra(int source, int destination) {
	memset(dist, 0x3f, sizeof dist);
	priority_queue<State> q;
	q.push({source, 0, 0});
	while (!q.empty()) {
		auto cur = q.top();
		q.pop();
		if (dist[cur.node][cur.mod] < cur.cost)
			continue;
		for (auto child: adj[cur.node]) {
			int nC = cur.cost + (cur.mod == 0), nM = (cur.mod + 1) % 3;
			if (dist[child][nM] > nC) {
				dist[child][nM] = nC;
				q.push({child, nC, nM});
			}
		}
	}
	if (dist[destination][0] < 1e9)
		return dist[destination][0];
	return -1;
}
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	int n, m;
	scanf("%d %d", &n, &m);
	while (m--) {
		int u, v;
		scanf("%d %d", &u, &v);
		adj[u].push_back(v);
	}
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", dijkstra(a, b));
	return 0;
}

Measured memory_bytes: 7540
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <set>

using namespace std;

long long N;
map<long long, long long> m;
long long p2s[32];
vector<long long> A;

int main()
{
    p2s[0] = 1;
    for (int i = 1; i < 31; i++)
    {
        p2s[i] = p2s[i - 1] * 2;
    }
    cin >> N;
    A.resize(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        if (m.find(A[i]) == m.end())
        {
            m[A[i]] = 1;
        }
        else
        {
            m[A[i]]++;
        }
    }

    sort(A.begin(), A.end(), greater<long long>());
    int ans = 0;

    for (int i = 0; i < N;i++)
    {
        long long f = A[i];
        if(m.find(f) == m.end())
        {
            continue;
        }
        m[f]--;
        if(m[f] <= 0)
        {
            m.erase(f);
        }

        for (int i = 30; i >= 1; i--)
        {
            long long key = p2s[i] - f;
            if(key <= 0)
            {
                break;
            }
            auto it = m.find(key);
            if (it != m.end())
            {
                ans++;
                m[key]--;
                if(m[key] <= 0)
                {
                    m.erase(key);
                }
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int A,B,C;

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

    int ans = max(abs(A - B), abs(B - C));

    ans = max(ans, abs(C - A));

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTA(a,n) sort(a,a+n)
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
	int a,b;
  	cin >> a >> b;
  	//処理
    //出力
    if((a%3==0 || b%3==0) || (a+b)%3==0) cout << "Possible" << ENT;
    else cout << "Impossible" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	vector<string> s(10000);
	cin >> s[int('a')] >> s[int('b')] >> s[int('c')];
	int dex = int('a');
	while(1){
		if(s[dex] == ""){
			cout << char((dex)-('a'-'A')) << endl;
			break;
		}
		int dex1 = dex;
		dex = int(s[dex][0]);
		s[dex1] = s[dex1].substr(1, s[dex1].length()-1);
	}
 	return 0;
}

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

int main(void){
    int n, k, c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    vector<int> ball(k);
    vector<int> ball2(k);
    int now=0;
    int bef=-INF;
    int idx=0;
    int ballidx=0;
    map<int, int> mp;
    while(now<k){
        if(s[idx]=='o' && idx-bef>c) {
            now++;
            ball[ballidx]=idx;
            ballidx++;
            bef=idx;
        }
        idx++;
    }

    now=0;
    reverse(s.begin(), s.end());
    idx=0;
    bef=-INF;
    ballidx--;
    while(now<k){
        if(s[idx]=='o' && idx-bef>c) {
            now++;
            ball2[ballidx]=s.size()-1-idx;
            ballidx--;
            bef=idx;
        }
        idx++;
    }
    rep(i, k){
        if(ball[i]==ball2[i]) cout<<ball[i]+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3332
local mfl = math.floor

local function llprint(llnumber)
  --usage: llprint(2 * 1234567890123456LL)
  local str = tostring(llnumber):gsub("LL", "")
  print(str)
end

local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

x = io.read()
x = lltonumber(x)
a = 100LL
cnt = 0
while a < x do
  a = a + a / 100LL
  cnt = cnt + 1
end
print(cnt)


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

using namespace std;

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

  int minv = 1e9;
  for (int i = 0; i < N; i++) {
    int a, cnt = 0;
    cin >> a;
    while(a % 2 == 0) {
      a /= 2;
      cnt++;
    }
    minv = min(minv, cnt);
  }
  cout << minv << endl;
  return 0;
}

Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
a.sort!
a.reverse!

ans = 0
ans += a.first

count = (n-2)/2
count.times do |i|
  ans += a[i+1] * 2
end
if n.odd?
  ans += a[(n-1)/2]
end

puts ans



Measured memory_bytes: 31920
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
int fact(int n){
  int m;
  if (n == 0)
      return 1;
  m = fact(n - 1);    
  return n * m;       
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  vector<int> bit[100100];
  rep(i,n){
      int a,b;
      cin>>a>>b;
      bit[a].push_back(b);
  }
  priority_queue<int> que;
  int ans=0;
  for(int i=1;i<=m;i++){
      for(auto v:bit[i]){
	  que.push(v);
      }
      if(!que.empty()){
	  int res=que.top();
	  que.pop();
	  ans+=res;
      }
  }
  cout<<ans<<'\n';
  return(0);
}


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

#define ff first
#define ss second
#define pb push_back

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

const int N = 300005;

int dp[20][100005];
int mark[20][100005];
int num[N];
int v[N], w[N];
vector<ii> qry[N];
int n;
int ans[100005];

int f(int x, int l){
	if(x == 0) return 0;
	int id = num[x];
	if(mark[id][l] == x) return dp[id][l];
	mark[id][l] = x;
	dp[id][l] = f(x/2, l);
	if(w[x] <= l){
		dp[id][l] = max(dp[id][l], f(x/2, l - w[x]) + v[x]);
	}
	return dp[id][l];
}	

void dfs(int x, int id = 0){
	if(x > n) return;
	num[x] = id;
	for(ii i : qry[x]){
		ans[i.ss] = f(x, i.ff);
	}
	dfs(2*x, id+1);
	dfs(2*x+1, id+1);
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d", v+i, w+i);
	}
	int q;
	scanf("%d", &q);
	for(int i = 0; i < q; i++){
		int x, l;
		scanf("%d %d", &x, &l);
		qry[x].pb({l, i});
	}
	dfs(1);
	for(int i = 0; i < q; i++){
		printf("%d\n", ans[i]);
	}
	return 0;
}


Measured memory_bytes: 30872
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    if(A == B){
        cout << C << endl;
    }else if(B == C){
        cout << A << endl;
    }else{
        cout << B << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    char X, Y;
    cin >> X >>Y;
    if(X > Y){
        cout << ">\n"; 
    }
    else if(X == Y)
        cout << "=\n";
    else
        cout << "<\n";
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<cmath>
/*
for(i=0;i<n;i++)
{
scanf("%lld",&arr[i]);
}
scanf("%lld",&n);
*/


using namespace std;
int main()
{
	long long int t,x;
	scanf("%lld %lld",&t,&x);
	long double s=(long double)t/(long double)x;
	cout << s;
	
		
		
		
		
		
		
	return 0;
}					

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

v=[[]]*n
for i in range(n):
    tmp=list(map(int,input().split()))
    tmp=[i-1 for i in tmp[2:]]
    v[i]=tmp

time=1
D=[-1 for _ in range(n)]
F=[-1 for _ in range(n)]

def dfs(src):
    global time
    D[src]=time
    time+=1
    for dst in v[src]:
        if D[dst]==-1:#未訪問
            dfs(dst)
    F[src]=time
    time+=1

for root in range(n):
    if D[root]==-1:
        dfs(root)

for i in range(n):
    print(i+1,D[i],F[i])


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

int main() {
  int n, x;
  cin>>n>>x;
  int m[n];
  for (int i=0; i<n; i++) cin>>m[i];

  int ans = n;
  for (int i=0; i<n; i++) {
    x -= m[i];
  }
  sort(m, m + n);
  cout<<ans+x/m[0]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define MAX 1000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a+b+c >= 22)
    	cout << "bust" << '\n';
    else
    	cout << "win" << '\n';
    return ;
}
int32_t main() {
    FO;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    int a,b;
    while (cin >> a >> b) {
        int c = a*b;
       if (c%2 == 0)
            cout << "Even" << endl;
        else
            cout << "Odd" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define SIZE 100
using namespace std;
using ll = long long int;

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

  // input
  ll n, k;
  cin >> n >> k;
  deque<ll> dq;
  for (size_t _ = 0; _ < n; _++) {
    ll vi;
    cin >> vi;
    dq.push_back(vi);
  }

  ll ans = 0;
  for (size_t a = 0; a <= k; a++) {
    for (size_t b = 0; b <= k - a; b++) {
      deque<ll> d = dq; // 宝石の deque
      priority_queue<ll, vector<ll>, greater<ll>> pq; // 持つ宝石
      const int n_cnt = k - a - b;

      // 左から a 個取る
      for (size_t _ = 0; _ < a; _++) {
        if (!d.empty()) {
          ll v = d.front();
          d.pop_front();
          pq.push(v);
        }
      }

      // 右から b 個取る
      for (size_t _ = 0; _ < b; _++) {
        if (!d.empty()) {
          ll v = d.back();
          d.pop_back();
          pq.push(v);
        }
      }

      for (size_t cnt = 0; cnt <= n_cnt; cnt++) {
        auto p = pq;
        // 持ってる宝石を小さい方から cnt 個捨てる
        for (size_t i = 0; i < cnt; i++) {
          if (!p.empty()) {
            p.pop();
          }
        }
        // 持ってる宝石の価値の合計を計算する
        ll sum = 0;
        while (!p.empty()) {
          sum += p.top();
          p.pop();
        }
        ans = max(ans, sum);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double d = sc.nextDouble();
		double t = sc.nextDouble();
		double s = sc.nextDouble();
		if(d / s <= t)
		System.out.println("Yes");
		else
		System.out.println("No");
	}
}

Measured memory_bytes: 37216
using System;
using System.Linq;

namespace _9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var sum = 0;
            while(true)
            {
                var t1 = Console.ReadLine();
                if (t1 == "END_OF_TEXT") break;
                var t2 = t1.ToLower();
                var str = t2.Split(' ');
                sum += str.Count(x => x == s);
            }
            Console.WriteLine(sum);
        }
    }
}



Measured memory_bytes: 20212