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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

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

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll N; cin >> N;
	vll A(N); cin >> A;
	sort(begin(A), end(A));

	if (N & 1) {
		ll sum1l = 0, sum1r = 0;
		for (int i = 0; i < N/2; i++) sum1l += 2*A[i];
		sum1r += A[N/2];
		sum1r += A[N/2+1];
		for (int i = N/2+2; i < N; i++) sum1r += 2*A[i];
		
		ll sum2l = 0, sum2r = 0;
		for (int i = 0; i < N/2-1; i++) sum2l += 2*A[i];
		sum2l += A[N/2-1];
		sum2l += A[N/2];
		for (int i = N/2+1; i < N; i++) sum2r += 2*A[i];

		cout << max(sum2r-sum2l, sum1r-sum1l) << endl;
	} else {
		ll suml = 0, sumr = 0;
		for (int i = 0; i < N/2-1; i++) suml += 2*A[i];
		suml += A[N/2-1];
		sumr += A[N/2];
		for (int i = N/2+1; i < N; i++) sumr += 2*A[i];
		cout << sumr-suml << endl;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3968
fn main() {
    let s = read::<String>();
    let chars: Vec<char> = s.chars().collect();
    println!("{}{}{}", chars[0], s.len()-2, chars[s.len()-1]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

bool isChanged(int *S, int *prevS, int n);

int main() {
    int n;
    int S[12], freq[101], prevS[12];

    while (cin >> n) {
        if(n == 0) break;

        for (int i=0; i<n; i++) {
            cin >> S[i];
        }

        int cont = -1;
        for (int i=0; i<12; i++) prevS[i] = -1;

        while (isChanged(S, prevS, n)) {
            for (int i=0; i<101; i++) freq[i] = 0;

            for (int i=0; i<n; i++) {
                freq[S[i]]++;
                prevS[i] = S[i];
            }

            for (int i=0; i<n; i++) {
                S[i] = freq[S[i]];
            }

            cont++;
        }

        cout << cont << endl;
        for (int i=0; i<n-1; i++) {
            cout << S[i] << " ";
        }
        cout << S[n-1] << endl;
    }

    return 0;
}

bool isChanged(int *S, int *prevS, int n) {
    for (int i=0; i<n; i++) {
        if(S[i] != prevS[i]) return true;
    }

    return false;
}

Measured memory_bytes: 3004
#include <iostream>
#include <math.h>

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

  int N;
  cin >> N;
  long long  ans = 0;
  FOR(i,1,sqrt(N)+2){
    ans = i*i;
    if(ans > N){
      cout << (i-1)*(i-1) << endl;
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#import<iostream>
#define ll long long
int main() {
	ll N, X, p = 0;
	std::cin >> N >> X;
	for (ll i = (ll)(1 << N / 2) * (1 << (N + 3 >> 1));i;i >>= 1, --X) {
      	if (X + 1 >= i) {
			p |= i >> 1;
			X -= i - 2;
		}
	}
	std::cout << p;
	return 0;
}


Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template
#pragma region bit 1.0
template <typename T>
struct bit
{
    ll n;
    vector<T> a;

    bit() {}

    bit(ll n) : n(n)
    {
        a.assign(n + 1, 0);
    }

    void add(ll i, T x)
    {
        ++i;
        while (i <= n)
        {
            a[i] += x;
            i += i & -i;
        }
    }

    T sum(ll i)
    {
        T s = 0;
        while (i > 0)
        {
            s += a[i];
            i -= i & -i;
        }
        return s;
    }
};
#pragma endregion bit

int main()
{
    IN(ll, N);
    IN(ll, M);
    A2IN(ll, l, ll, r, N);
    vvi x(M + 1);
    REP1(i, M)
    {
        for (ll j = i; j <= M; j += i)
        {
            x[j].push_back(i);
        }
    }
    vi L(M + 1);
    vvi R(M + 2);
    REP(i, N)
    {
        ++L[l[i]];
        R[r[i] + 1].push_back(l[i]);
    }
    bit<ll> S(M + 1);
    vi ans(M + 1);
    REP1(i, M)
    {
        S.add(i, L[i]);
        FOR(j, R[i])
        {
            S.add(j, -1);
        }
        FOR(j, x[i])
        {
            ans[j] += S.sum(i + 1) - S.sum(i - j + 1);
        }
    }
    REP1(i, M)
    {
        OUT(ans[i]);
    }
}

Measured memory_bytes: 32248
N_str, q_str = raw_input().split()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0

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

while A:
    name, time = A.pop(0)
    if time <= q:
        total += time
        B.append(name+" "+ str(total))
       
    else:
        time -= q
        total += q
        A.append([name, time])

print '\n'.join(B)

Measured memory_bytes: 17356
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int r=stdIn.nextInt();
		int D=stdIn.nextInt();
		int x=stdIn.nextInt();
		int z=0;
		while(z<10){
			x=x*r-D;
			System.out.println(x);
			z++;
		}
	}
}

Measured memory_bytes: 22228
import fractions

A, B, C, D = map(int, input().split())

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // fractions.gcd(C, D))

print(U - (possible_C + possible_D) + possible_CD)


Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    long ans=1e10;
    for(long i=1;i<h;i++){
        long s1,s2,s3,s4,s5;
        s1=i*w;
        s2=(h-i)*(w/2+w%2);
        s3=(h-i)*(w/2);
        s4=((h-i)/2)*w;
        s5=((h-i)/2+(h-i)%2)*w;
        ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3)));
        ans=min(ans,max(s1,max(s4,s5))-min(s1,min(s4,s5)));
    }
    for(long i=1;i<w;i++){
        long s1,s2,s3,s4,s5;
        s1=i*h;
        s2=(w-i)*(h/2+h%2);
        s3=(w-i)*(h/2);
        s4=((w-i)/2)*h;
        s5=((w-i)/2+(w-i)%2)*h;
        ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3)));
        ans=min(ans,max(s1,max(s4,s5))-min(s1,min(s4,s5)));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [u64; n],
    }
    let mut ans = vec![0; n];
    ans[0] = a.iter().sum::<u64>() - 2 * a.iter().enumerate().filter(|&(i, _)| i % 2 == 1).map(|(_, x)| x).sum::<u64>();

    for i in 0..n-1 {
        ans[i+1] = 2 * a[i] - ans[i]
    }

    for i in 0..n {
        print!("{} ", ans[i])
    }
    println!();
}


Measured memory_bytes: 7420
#include <iostream>
#include <set>
#include <tuple>
#include <vector>

int main() {
  int n, k;
  std::cin >> n >> k;
  std::set<int> s, t;
  for (int i = k; i < k + n; ++i) s.insert(i);
  std::vector<std::tuple<int, int, int>> ans;
  for (int z = k + n + n + n - 1, y = k + n + n - 1; z >= k + n + n; --z) {
    auto it = s.upper_bound(z - y);
    if (it == s.begin()) {
      std::cout << "-1\n";
      return 0;
    }
    int x = *prev(it);
    s.erase(x);
    ans.emplace_back(x, y, z);
    if ((y -= 2) < k + n) y = k + n + n - 2;
  }
  for (auto g : ans) {
    std::cout << std::get<0>(g) << ' ' << std::get<1>(g) << ' '
              << std::get<2>(g) << "\n";
  }
  return 0;
}


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

int main(){
    int n, k, s;
    cin >> n >> k >> s;

    vector<int> x;
    for(int i = 0; i < k; i++){
        cout << s << ' ';
    }
    int a = (s < 10000 ? s + 1 : s - 1);
    for(int i = 0; i < n - k; i++){
        cout << a << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, d = 0;
  	cin >> a >> b;
  	for (int c = 1; c <= 3; ++c)
      d |= a * b * c % 2;
  	cout << (d > 0 ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
import math
for i in range(int(raw_input())):
    (xa, ya, ra, xb, yb, rb) = map(float,raw_input().split())
    dist = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if dist > ra + rb:
        print 0
    elif dist + rb < ra:
        print 2
    elif dist + ra < rb:
        print -2
    else:
        print 1

Measured memory_bytes: 23000
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#define rep(i,x) for(int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

int d = 11,g,sum,cnt = 10000;
vector<int> p(d),c(d);
vector<pair<bool,int>> pd(d);

int dfs(int i, int k){
    int sum = 0;
    rep(j,i){
        if(pd[j].first == 1) sum += pd[j].second;
    }
    if(sum >= g) cnt = min(cnt,k);
    else{
        int temp = 0;
        rep(j,i){
            if(pd[j].first == 0) temp = max(temp,j);
        }
        if(g-sum < p[temp] * (temp+1) * 100) {
            if((g-sum) % ((temp+1) * 100) != 0)cnt = min(cnt,k + (g-sum) / ((temp+1) * 100)+1);
            else cnt = min(cnt,k + (g-sum) / ((temp+1) * 100));
        }
    }
    // cout << i << ' ' << k << ' ' << cnt << ' ' << endl;
    if(i == d) return cnt;
    
    pd[i].first = 0;
    ll ans1 = dfs(i+1,k);
    pd[i].first = 1;
    ll ans2 = dfs(i+1,k + p[i]);
    return min(ans1, ans2);
    
}

int main(){
    cin >> d >> g;
    rep(i,d){
        cin >> p[i] >> c[i];
        pd[i] = make_pair(0,p[i]*(i+1)*100+c[i]);
    }
    int ans = dfs(0,0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::min; using std::max;
using std::swap; using std::sort;
typedef long long ll;

template<typename T>
void read(T &x) {
	int flag = 1; x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= flag;
}

const int _ = 12;
char c[_]; int n; ll a[_], pw[_], ret, s[_];

ll get(int l, int r) {
	return (s[l] - s[r + 1]) / pw[n - r]; 
}

bool vis[_];
void doit(int i) {
	if(i == n) {
		int l = 1; ll now = 0;
		for(int r = 1; r < n; ++r)
			if(vis[r]) now += get(l, r), l = r + 1;
		ret += now + get(l, n);
		return ;
	}
	doit(i + 1), vis[i] = 1; doit(i + 1), vis[i] = 0;
}

int main () {
	scanf("%s", c + 1);
	n = strlen(c + 1), pw[0] = 1;
	for(int i = 1; i <= n; ++i) pw[i] = pw[i - 1] * 10ll;
	for(int i = n; i >= 1; --i) s[i] = s[i + 1] + (c[i] - '0') * pw[n - i];
	doit(1), printf("%lld\n", ret);
	return 0;
} 


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int,int>mp;
    int kanst = 0;
    int counter = 0;
    rep(i,n){
        rep(j,8){
            if (400*j<= a[i] && a[i] <= 400*(j+1)-1){
                mp[j]=1;
            }
            else if (a[i]>=3200) {
                kanst++;
                break;
            }
        }
    }
    for (auto &x :mp){
        if( x.second == 1) counter++;
    }
    if (counter >0)cout << counter << " ";
    else cout << 1 << endl;
    counter+=kanst;
    cout << counter << " ";
    
}


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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<int> c(100001);
    rep(i,N) {
        c[A[i]]++;
    }

    rep(i,100001){
        if(c[i] >= 3){
            if(c[i]%2==0){
                c[i] = 2;
            }else{
                c[i] = 1;
            }
        }
    }

    vector<int> d(3);
    rep(i,100001){
        d[c[i]]++;
    }

    int ans = 0;
    ans += d[1];
    ans += d[2];
    if (d[2] % 2 == 1) ans--;

    cout << ans << endl;

}


Measured memory_bytes: 3976
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <iostream>
#include <cassert>

using namespace std;

#define rank RANK

const int N = 1e5 + 7;
const int LEN = 4e5 + 7;
const int C = 26;
const int LIMIT = 500;

string s[N];
int n;
char buffer[LEN];

struct Node {
	int id, cnt;
	Node* child[C];
	vector<int> ids;
	Node(int id = -1) : id(id) {
		cnt = 0;
		for (int i = 0; i < C; i++) {
			child[i] = NULL;
		}
	}
};

Node pool[LEN << 2];
Node* root;
int rank[C], sa[C], total = 0;
int lcp[1000][1000], num[N];

void insert(string s, int id) {
	Node *tmp = root;
	for (int i = 0; i < s.size(); i++) {
		int idx = s[i] - 'a';
		tmp->cnt++;
		tmp->ids.push_back(id);
		if (tmp->child[idx] == NULL) {
			tmp->child[idx] = new(pool + total++) Node();
		}
		tmp = tmp->child[idx];
	}
	tmp->id = id;
	tmp->ids.push_back(id);
	tmp->cnt++;
}

vector<int> big;

int solve(int k) {
	int ret = 0;
	Node *tmp = root;
	for (int i = 0; i < LIMIT; i++) {
		if (i == s[k].size()) {
			return ret;
		}
		int idx = s[k][i] - 'a';
		ret += (tmp->id != -1);
		assert(tmp->child[idx] != NULL);
		for (int j = 0; j < rank[idx]; j++) {
			int c = sa[j];
			if (tmp->child[c] == NULL) continue;
			ret += tmp->child[c]->cnt;
		}
		tmp = tmp->child[idx];
	}
	for (auto id : tmp->ids) {
		if (id == k) continue;
		int ii = num[id];
		int kk = num[k];
		int p = lcp[ii][kk];
		if (p >= min(s[k].size(), s[id].size())) {
			ret += s[id].size() < s[k].size();
		} else {
			ret += (rank[s[id][p] - 'a'] < rank[s[k][p] - 'a']);
		}
	}
	return ret;
}

int main() {
	root = new Node();
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", buffer);
		s[i] = buffer;
		insert(s[i], i);
		if (s[i].size() >= LIMIT) {
			num[i] = big.size();
			big.push_back(i);
		}
	}
	for (int i = 0; i < big.size(); i++) {
		int a = big[i];
		for (int j = 0; j < i; j++) {
			int b = big[j], k = 0;
			for (; k < s[a].size() && k < s[b].size() && s[a][k] == s[b][k]; k++) {}
			lcp[i][j] = lcp[j][i] = k;
		}
	}
	int q;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		int k;
		scanf("%d %s", &k, buffer);
		for (int j = 0; j < C; j++) {
			rank[buffer[j] - 'a'] = j;
			sa[j] = buffer[j] - 'a';
		}
		printf("%d\n", solve(--k) + 1);
	}
	return 0;
}

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

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define sz(x) ((int) (x).size())
#define ll long long
#define mp make_pair
#define pii pair<int, int >
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define zero(x) memset((x), (0), sizeof (x))
#define zerox(x, y) memset((x), (y), sizeof (x))

using namespace std;

int main()
{
#ifdef PIT
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif //PIT

	ios_base::sync_with_stdio(false); cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(a+b, min(b+c, a+c)) << endl;
	
#ifdef PIT
flush(cout);
cerr << endl << "Time: " << (clock() / double(CLOCKS_PER_SEC)) << endl;
#endif //PIT
	return 0;
}


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

int main()
{
  int num[3];
  cin >> num[0] >> num[1] >> num[2];

  for (int i = 0; i < 3; i++) {
    for (int j = i + 1; j < 3; j++) {
      if (num[i] > num[j]) {
        int tmp = num[i];
        num[i] = num[j];
        num[j] = tmp;
      }
    }
  }

  printf("%d %d %d\n", num[0], num[1], num[2]);

  return 0;
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ll n, k; cin >> n >> k;
	ll r, s, p; cin >> r >> s >> p;
	string t; cin >> t;
	const int N = 1e5 + 5;
	char ar[N];
	for(int i = 0; i < k; i++){
		ar[i] = '0';
	}
	ll ans = 0;
	ll xx = n/k;
	if(n%k != 0){
		xx++;
	}
	for(int i = 0; i < xx; i++){
		for(int j = 0; j < k; j++){
			if(i*k + j >= n)break;
			if(t[i*k + j] == ar[j]){
				ar[j] = '0';
			}else{
				ar[j] = t[i*k + j];
				if(t[i*k + j] == 'r')ans += p;
				if(t[i*k + j] == 's')ans += r;
				if(t[i*k + j] == 'p')ans += s;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
N, K = gets.split.map(&:to_i)

flag = Array.new(N, true)

for i in 0...K 
    d = gets.to_i
    aa = gets.split.map(&:to_i)
    aa.each do |a|
        flag[a-1] = false
    end
end

cnt = 0
flag.each do |f|
    cnt += 1 if f
end

puts cnt

Measured memory_bytes: 14264
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>



using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  string S,T;
  cin >> S >> T;
  int long_s = S.size();
  int long_t = T.size();
  vector<vector<ll>> dp(3010,vector<ll>(3010,0));
  for(int i = 1;i <= long_s;i++){
    for(int j = 1;j <= long_t;j++){
      if(S.at(i-1) == T.at(j-1)){
        dp[i][j] = max(dp[i-1][j-1]+1,dp[i][j]);
    }
        dp[i][j] = max(dp[i][j],dp[i-1][j]);
        dp[i][j] = max(dp[i][j],dp[i][j-1]);
    }
  }
/*
  string ans = "";
  for(int i = 1;i <= long_s;i++){
    for(int j = 1;j <= long_t;j++){
      if(dp[i-1][j-1]+1 == dp[i][j] && dp[i][j] == dp[i-1][j]+1 && dp[i][j] == dp[i][j-1]+1){
        ans += S.at(i-1);
      }
    }
  }
  */

  int i = long_s;
  int j = long_t;
  string ans = "";
  while(i>0 && j>0){
    if(dp[i][j] == dp[i][j-1]){
      j--;
    }else if(dp[i][j] == dp[i-1][j]){
      i--;
    }else{
      ans = ans + S.at(i-1);
      i--;
      j--;
    }
  }
  reverse(ans.begin(),ans.end());

  cout << ans << endl;


}


Measured memory_bytes: 71296
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//#define int long long  ←保留
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

/*signed*/int main() {
    int N; cin >> N;
    vector <int > V(N);
    for (int i = 0; i < N; ++i) {
        cin >> V[i];
    }
    vector <int > C(N);
    for (int i = 0; i < N; ++i) {
        cin >> C[i];
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (V[i] > C[i]) {
            ans += V[i] - C[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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


int main() {
  int n;
  cin >> n;
  vector<ll> d(n+1);
  for(int i = 1; i <= n; i++) {
    int j = 1;
    while(j*i <= n) {
      d[j*i]++;
      j++;
    }
  }
  ll ans = 0;
  for(int i = 1; i <= n; i++) {
    ans += i*d[i];
  }
 
  cout << ans << endl;
  return 0;
}

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


int main(){
	int a, b, n;
	while ( cin >> a >> b >> n ){
		int sum = 0;
		a %= b;
		for ( int i = 0; i < n; ++i ){
			a *= 10;
			sum += a / b;
			a %= b;
		}
		cout << sum << endl;
	}

	return 0;
}

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    ll n;
    cin >> n;
    ll a[n+1] = {};
    for(ll i = 1; i<=n; i++) {
        cin >> a[i];
        if(a[i] == 0) {
            cout << 0;
            return;
        }
    }
    ll inf = 1e18;
    ll ans = 1;
    for(ll i = 1; i<=n; i++) {
        ll x = inf/ans;
        if(x < a[i]) {
            cout << -1;
            return;
        }
        else {
            ans *= a[i];
        }
    }
    cout << ans;
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        char* before = new char [n + 1];
        char* after = new char [n + 1];
        for (int i = 0; i < n; i++) {
            cin >> before[i] >> after[i];
        }
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            char input;
            cin >> input;
            for (int j = 0; j < n; j++) {
                if (input == before[j]) {
                    input = after[j];
                    break;
                }
            }
            cout << input;
        }
        cout << endl;
        delete[] before;
        delete[] after;
    }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli h, k, n, w, R = 0, B = 0, G = 0, ans = 0, count = 0;
  string s, t;
  cin >> n;
  cin >> s;
  rep(i, 0, n)
  {
    if (s[i] == 'R')
    {
      R++;
    }
    if (s[i] == 'G')
    {
      G++;
    }
    if (s[i] == 'B')
    {
      B++;
    }
  }
  ans = R * G * B;
  repe(i, 1, n)
  {
    rep(j, 0, n - 2 * i)
    {
      if (s[j] != s[j + i] && s[j] != s[j + i * 2] && s[j + i] != s[j + i * 2])
        ans--;
    }
  }
  cout << ans << endl;
}

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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int H,W; cin >> H >> W;
  int MAX = (H+W) * 80 + 1;
  int r[H][W];
  int b[H][W];

  bool dp[H][W][MAX+MAX];
  // dp[i][j][k] : i,jで値k-MAXになる場合はtrue;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      for(int k = 0; k < MAX + MAX; k++){
        dp[i][j][k] = false;
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> r[i][j];
    }
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> b[i][j];
    }
  }

  int now;
  now = r[0][0] - b[0][0] + MAX; 
  dp[0][0][now] = true;
  now = b[0][0] - r[0][0] + MAX; 
  dp[0][0][now] = true;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      for(int k = 0; k < MAX + MAX; k++){
        if(dp[i][j][k]){
          if(i+1<H){
            int next;
            next = r[i+1][j] - b[i+1][j];
            dp[i+1][j][k+next] = true;
            next = b[i+1][j] - r[i+1][j];
            dp[i+1][j][k+next] = true;
          }
          if(j+1<W){
            int next;
            next = r[i][j+1] - b[i][j+1];
            dp[i][j+1][k+next] = true;
            next = b[i][j+1] - r[i][j+1];
            dp[i][j+1][k+next] = true;
          }
        }
      }
    }
  }

  int min_val = MAX + MAX;
  for(int k = 0; k < MAX+MAX; k++){
    if(dp[H-1][W-1][k]){
      int val = k - MAX;
      val = abs(val);

      min_val = min(val, min_val);
    }
  }
  cout << min_val << endl;



}


Measured memory_bytes: 163664
def main():
    from itertools import combinations

    N = raw_input()
    K = int(raw_input())
    digit = len(N)
    N = int(N)


    ans = 0

    # １桁目を考慮しない
    ans += len(list(combinations(range(digit - 1), K))) * (9 ** K)

    if K == 3:
        # 同じ長さの数を考える
        for top in range(1, 10):
            if int(str(N)[0]) < top:
                continue

            if int(str(N)[0]) > top:
                ans += len(list(combinations(range(digit - 1), K - 1))) * (9 ** (K - 1))
                continue

            for perm_digit in combinations(range(1, digit), K - 1):
                perm_digit = list(perm_digit)
                for pn1 in range(1, 10):
                    for pn2 in range(1, 10):
                        s = ['0'] * digit
                        s[0] = str(top)
                        s[perm_digit[0]] = str(pn1)
                        s[perm_digit[1]] = str(pn2)

                        if int(''.join(s)) <= N:
                            ans += 1

    elif K == 2:
        # 同じ長さの数を考える
        for top in range(1, 10):
            for perm_digit in combinations(range(1, digit), K - 1):
                perm_digit = list(perm_digit)

                for pn1 in range(1, 10):
                    s = ['0'] * digit
                    s[0] = str(top)
                    s[perm_digit[0]] = str(pn1)
                    if int(''.join(s)) <= N:
                        ans += 1

    elif K == 1:
        ans += int(str(N)[0])

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 49692
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

from itertools import product

N = I()
a,b = Line(N-1,2)
M = I()
u,v = Line(M,2)

def edges_to_pt(s,t,n,directed=False):
    pt = [[] for _ in range(n)]
    for i in range(len(s)):
        pt[s[i]-1].append(t[i]-1)
        if directed==False:
            pt[t[i]-1].append(s[i]-1)
    return pt

#木の最短パス
def shortest_path(pt,s,t):
    n = len(pt)
    used = [False]*n
    pre = [-1]*n
    q = [s]
    while q:
        q1 = []
        for i in q:
            for j in pt[i]:
                if not used[j]:
                    used[j] = True
                    pre[j] = i
                    q1.append(j)
        q = q1

    if used[t]:
        path = [t]
        p = t
        while True:
            p = pre[p]
            path.append(p)
            if p == s:
                break
        return list(reversed(path))
    else:
        return []

d = defaultdict(int)
count = 0
for i in range(N-1):
    x,y = min(a[i]-1,b[i]-1),max(a[i]-1,b[i]-1) 
    if not d[(x,y)]:
        d[(x,y)] = count
        d[(y,x)] = count
        count += 1

pt = edges_to_pt(a,b,N)
h_index = [[] for _ in range(M)]
for i in range(M):
    p = shortest_path(pt,u[i]-1,v[i]-1)
    for j in range(len(p)-1):
        x,y = p[j],p[j+1]
        h_index[i].append(d[(x,y)])

bit_h = [0]*M
for i in range(M):
    bits = 0
    for h in h_index[i]:
        bits += 2**h
    bit_h[i] = bits

ans_r = 0
A = list(product([0,1],repeat=M))
for a in A[1:]:
    bits = 0
    edge_num = 0
    for i in range(M):
        if a[i]:
            bits |= bit_h[i]
            edge_num += 1
    one_count = 0
    for i in range(count+1):
        if bits>>i&1:
            one_count += 1
    ans_r += (-1)**(edge_num-1)*2**(N-1-one_count)

print(2**(N-1)-ans_r)

Measured memory_bytes: 258776
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

//int frq[123];
int main(){
	Lancer();
	ll n, div, odd = 0;
	cin >> n;
	for (int i = 1; i <= n; i++){
		if (i % 2 != 0){
			div = 0;
			for (int j = 1; j <= sqrt(i); j++){
				if (i%j == 0){
					if (i / j != j) div += 2;
					else div++;
				}
			}
			if (div == 8)
				odd++;
		}
	}
	cout << odd;
	cout << endl;
	return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#define ll long long int
int main(void){
  ll N,X;
  std::cin >> N >> X;

  ll a[2];
  a[0] = X;
  a[1] = N;

  ll dist = 0;
  while(a[0] != a[1]){
    if(a[1] > a[0]*1000005){
      a[1] -= a[0]*1000000;
      dist += a[0]*3000000;
    }
    a[1] -= a[0];
    std::sort(a, a+2);
    dist += a[0]*3;
  }
  std::cout << dist << std::endl;
}

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

string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename T> string to_string(T v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }
template <typename T, typename U> string to_string(pair<T, U> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
void print_debug() { cerr << endl; }
template <typename T, typename... U> void print_debug(T t, U... u) { cerr << " " << to_string(t); print_debug(u...); }
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", print_debug(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int n;
  cin >> n;
  cout << (n+1)/2;
}


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

class Program
{
    static void Main(string[] args)
    {
        long n = int.Parse(Console.ReadLine());
        long sum = 0;
        for(int i = 1; i <= n; i++)
        {
            if (i % 3 != 0 && i % 5 != 0) sum += i;
        }
        Console.WriteLine(sum);


    }


}



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

const ll mod = 1000000007;
ll pow(ll b, ll e) {
  if(e == 0)
    return 1LL;
  if(e % 2 == 1)
    return pow(b, e - 1) * b % mod;
  ll m = pow(b, e >> 1);
  return m * m % mod;
}

ll inv(ll a) {
  return pow(a, mod - 2);
}

int main(void) {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> fact(n + 1);
  rep(i, n + 1) {
    if(i == 0) {
      fact[i] = 1LL;
      continue;
    }
    fact[i] = fact[i - 1] * i % mod;
  }
  vector<ll> ifact(n + 1);
  rep(i, n + 1) {
    if(i == 0) {
      ifact[i] = 1LL;
      continue;
    }
    ifact[i] = ifact[i - 1] * inv(i) % mod;
  }
  sort(a.begin(), a.end());
  ll smin = 0;
  ll smax = 0;
  rep(i, n - k + 1) {
    ll comb = fact[n - 1 - i] * ifact[k - 1] % mod;
    comb = comb * ifact[n - i - k] % mod;
    ll min = a[i] * comb % mod;
    smin = (smin + min) % mod;
    ll max = a[n - 1 - i] * comb % mod;
    smax = (smax + max) % mod;
  }
  ll ans = (smax - smin) % mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = [[v, i + 1] for i, v in enumerate(list(map(int, input().rstrip('\n').split())))]
    a.sort()
    print(*[a[i][1] for i in range(n)])


if __name__ == '__main__':
    slove()


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

typedef long long ll;
using namespace std;
int main()
{
	string str;
	cin >> str;
	if (str == "a" || str == "i" || str == "u" || str == "e" || str == "o") {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int a, b, c, d;

signed main() {
	cin >> a >> b >> c >> d;
	int x = (c + b - 1) / b;
	int y = (a + d - 1) / d;
	if (x <= y)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    long *A = (long *)a;
    long *B = (long *)b;
    if (*A > *B) return -1;
    if (*A < *B) return 1;
    return 0;
}
int main() {
    long n, m, i, j, k,l, x[1001], y[1001], z[1001],p[1001];
    long t, ans=0;
    scanf("%lld%lld", &n, &m);
    for (i = 0; i < n; i++)
        scanf("%ld%ld%ld", &x[i], &y[i], &z[i]);
    for (i = 0; i < 2; i++) {
        for (j = 0; j < 2; j++) {
            for (k = 0; k < 2; k++) {
                t = 0;
                for (l = 0; l < n; l++) {
                    p[l] = 0;
                    if (i == 0)
                        p[l] += x[l];
                    else
                        p[l] -= x[l];
                    if (j == 0)
                        p[l] += y[l];
                    else
                        p[l] -= y[l];
                    if (k == 0)
                        p[l] += z[l];
                    else
                        p[l] -= z[l];
                }
                qsort(p, n, sizeof(long), compare_int);
                for (l = 0; l < m; l++)
                    t += p[l];
                if (t > ans)
                    ans = t;
            }
        }
    }
    printf("%ld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin >> str;
    for (int i = 0; i < str.size(); i++)
    {
        if(str[i]=='?'){
            str[i] = 'D';
        }
    }
    cout << str <<endl;

}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

#define INF 1000000000

using namespace std;

int main() {
    int n;
    string s;
    vector<int> a(26, INF), c(26);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        fill(c.begin(), c.end(), 0);
        cin >> s;
        for (int j = 0; j < s.size(); ++j) ++c.at(s.at(j) - 'a');
        for (int j = 0; j < 26; ++j) a.at(j) = min(a.at(j), c.at(j));
    }
    for (int i = 0; i < 26; ++i) for (int j = 0; j < a.at(i); ++j) cout << char('a' + i);
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) ((v).begin(), (v).end())
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    string s;
    cin >> s;
    cout << (s=="ARC"?"ABC":"ARC") << endl;
    return 0;
}

Measured memory_bytes: 3536
s=""
li=[str(i) for i in xrange(10)]
while 1:
    try:
        s+=raw_input()
    except:
        ans=0
        num=""
        for i in s:
            if i in li:
                num+=i
            else:
                if num!="":
                    ans+=int(num)
                    num=""
        print(ans)
        break

Measured memory_bytes: 6404
char *S[]={"No","Yes"};
char f;
char c[6];
int i;
int main(){
  scanf("%s", c);
  while(c[++i]);
  f+=i>=2&&c[0]=='A'&&c[1]=='C';
  f+=i>=3&&c[1]=='A'&&c[2]=='C';
  f+=i>=4&&c[2]=='A'&&c[3]=='C';
  f+=i>=5&&c[3]=='A'&&c[4]=='C';
  f=f!=0;
  puts(S[f]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#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> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define lld 			long long 
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
  c_p_c();
  lld n;
  cin >> n;
  lld sum =((n*(n+1))>>1);
  lld p = floor(n/3);
  lld q = floor(n/5);
  lld r = floor(n/15);
  lld a = ((p*(p+1))/2)*3 + ((q*(q+1))/2)*5 - ((r*(r+1))/2)*15;
  cout<<sum - a<<endl;
  return 0; 
}


Measured memory_bytes: 3656