akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  vector<int> a(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];
  cout << a[2] << " " << a[0] << " " << a[1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 7;
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n;
    cin >> n;
    nfor(i, -200, 200)nfor(j, -200, 200)if(i * i * i * i * i - j * j * j * j * j == n){cout << i << " " << j << endl;return 0;}
    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

int main()
{
   int A,B,C,D;
   scanf("%d%d%d%d",&A,&B,&C,&D);
   if(A < B)
    {
      if (C < D)
       printf("%d", A+C);
       else
      printf("%d", A+D);
    }
    else
    {
     if (C < D)
       printf("%d", B+C);
       else
      printf("%d", B+D);
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int D;
  cin >> D;

  if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  } else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
  } else {
    cout << "Christmas" << endl;
  }
 
}

Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll h, w; cin >> h >> w;
  ll d1 = (w + 1) / 2;
  ll d2 = w / 2;
  ll ans = d1 * ((h + 1) / 2) + d2 * (h / 2);
  if (h == 1 || w == 1) {
    ans = 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
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; }

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0;
    rep(i,n){
        if (s[i] == 'R') r++;
    } 

    int a = 0, b = r;
    int ans = 2e6;
    rep(i,n+1){
        int sum = max(a, b);
        ans = min(ans, sum);
        if (i == n) break;
        if (s[i] == 'W') a++;
        else b--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3688
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
// uncomment the below code to use int as long long
#define int long long
// uncomment the below code to use float as double
//#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;
const int inf = 9e18;
const int N = 2e5 + 1;
int n;
int arr[N];
int dp[N][3];

int func(int a,int b){
	if(a>=n){
		if(b<1 && n&1) return -inf;
		return 0;
	}
	if(dp[a][b]!=inf) return dp[a][b];
	if(n%2==0){ 
		if(b==1) dp[a][b] = func(a+2,b)+arr[a];
		else dp[a][b] = max(func(a+1,b+1),func(a+2,b)+arr[a]);
	}else{
		if(b==2) dp[a][b] = func(a+2,b)+arr[a];
		else dp[a][b] = max(func(a+1,b+1),func(a+2,b)+arr[a]);
	}
	return dp[a][b];
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	for(int i=0;i<N;i++)for(int j=0;j<3LL;j++) dp[i][j]=inf;
	cin>>n;
	for(int i=0;i<n;i++) cin>>arr[i];
	int ans = func(0,0);
	cout<<ans<<endl;
	return 0;
}



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

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

  vector<int> cnt(100010);
  for (int i = 0; i < n; i++) cnt[a[i]]++;

  int ans = 0;
  for (int i = 1; i < 100000; i++) {
    ans = max(ans, cnt[i] + cnt[i - 1] + cnt[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3880
/**
 *    +--+--+--++--++--In the name of ALLAH--++--++--+--+--+
 *
 *    author:  skmonir
 *    created: 02-Aug-2020 18:15:40
**/

#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define mod                 1000000007LL
#define len(x)              (int) x.size()
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void INT(T &n) {
    n = 0; int f = 1; int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void INT(T &x, W &y) {INT(x), INT(y);}
template <TN T, TN W, TN Q> inline void INT(T &x, W &y, Q &z) {INT(x, y), INT(z);}

const int N = 1e5 + 7;
const int inf = 1e9 + 7;


int solve() {
    int n; cin >> n;
    string s; cin >> s;

    vector<int> pref(n);
    for (int i = 0; i < n; ++i) {
        pref[i] = (s[i] == 'W') + (i > 0 ? pref[i - 1] : 0);
    }

    vector<int> suff(n);
    for (int i = n - 1; i >= 0; --i) {
        suff[i] = (s[i] == 'R') + (i + 1 < n ? suff[i + 1] : 0);
    }

    int res = min(n - suff[0], n - pref[n - 1]);
    for (int i = 0; i < n; ++i) {
        int cur = pref[i] + (i + 1 < n ? suff[i + 1] : 0);
        cur -= min(pref[i], (i + 1 < n ? suff[i + 1] : 0));
        umin(res, cur);
    }

    printf("%d\n", res);

    return 0;
}

int main() {
    int tests = 1, CaseNo = 0;
    // INT(tests);
    while (tests--) {
        //printf("Case %d: ", ++CaseNo);
        solve();
    }
    return 0;
}

Measured memory_bytes: 5240
import java.io.*;
import java.util.*;

public class Main {
    static final String YES = "Yes";
    static final String NO = "No";

    static class Task implements Comparable<Task> {
        final long A;
        final long B;

        Task(final long A, final long B) {
            this.A = A;
            this.B = B;
        }

        @Override
        public int compareTo(Task o) {
            return Long.compare(this.B, o.B);
        }
    }

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        final PriorityQueue<Task> tasks = new PriorityQueue<>();
        for(int i = 0 ; i < N ; i++){
            tasks.add(new Task(sc.nextLong(), sc.nextLong()));
        }

        final Solver solver = new Solver();
        System.out.println(solver.solve(tasks));
    }
}

class Solver {
    public String solve(final PriorityQueue<Main.Task> tasks) {
        long sum = 0;
        while (!tasks.isEmpty()) {
            final Main.Task task = tasks.poll();
            sum += task.A;
            if (sum > task.B) {
                return "No";
            }
        }
        return "Yes";
    }
}



Measured memory_bytes: 103084
import dataclasses
n, a, b, c = list(map(int, input().split(" ")))
m = {"A": a, "B": b, "C": c}
h = ""
if sum(m.values()) == 0:
    print("No")
elif sum(m.values()) == 1:
    for i in range(n):
        x, y = input()
        if m[x] == 0 and m[y] == 0:
            print("No")
            break
        elif m[x] == 0:
            m[x] += 1
            m[y] -= 1
            h += x
        else:
            m[x] -= 1
            m[y] += 1
            h += y
    else:
        print("Yes")
        [print(i) for i in h]
else:
    inp = input()
    x, y = inp
    if m[x] == 0 and m[y] == 0:
        print("No")
    else:
        for i in range(n-1):
            next_inp = input()
            x, y = inp
            if m[x] == 0:
                m[x] += 1
                m[y] -= 1
                h += x
            elif m[y] == 0:
                m[x] -= 1
                m[y] += 1
                h += y
            elif m[x] == 1 and m[y] == 1:
                if x in next_inp:
                    m[x] += 1
                    m[y] -= 1
                    h += x
                else:
                    m[x] -= 1
                    m[y] += 1
                    h += y
            else:
                if m[x] < m[y]:
                    m[x] += 1
                    m[y] -= 1
                    h += x
                else:
                    m[x] -= 1
                    m[y] += 1
                    h += y
            inp = next_inp
        x, y = inp
        h += x if m[x] == 0 else y
        print("Yes")
        [print(i) for i in h]


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

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

const long long INF = 1LL << 60;

int main(){
  int r, g, b;
  cin >> r >> g >> b;

  cout << ((g*10+b)%4 == 0 ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
function main(input){
    input = input.split("\n");
    temp = input[1].split(" ");
    len = input[0];
    min = 1001;
    max = 0;
    for(var i = 0; i < len; i+=1){
        if(min > temp[i]){
            min = temp[i];
        }
        if(max < temp[i]){
            max = temp[i];
        }
    }
    console.log(max - min);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second　   //pairの二つ目の要素

typedef pair<int,int> P;

P f(int x){
  int a=x%10;
  int b=0;
  while(x){
    b=x;
    x/=10;
  }
  return P(a,b);
}

map<P,int> m;

int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        P p=f(i);
        m[p]++; // 存在しないと０が入り、その後１が足される
   }
    ll ans=0;
    for(int i=1;i<=n;i++){
        P p=f(i);
        P q(p.second, p.first);
        ans+=m[q];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back







int main()
{



	string s, t;
	cin >> s >> t;

	int x = s.length();
	int y = t.length();
//	cout << x << " " << y << endl;
	int dp[x + 1][y + 1];

	for (int i = 0; i <= x; i++)
		for (int j = 0; j <= y; j++)
			dp[i][j] = 0;

	for (int i = 1; i <= x; i++)
	{
		for (int j = 1; j <= y; j++)
		{
			if (s[i - 1] == t[j - 1])
				dp[i][j] = dp[i - 1][j - 1] + 1;
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}

	// for (int i = 0; i <= x; i++)
	// {
	// 	for (int j = 0; j <= y; j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	int i = x;
	int j = y;

	string ans = "";

	while (i > 0 && j > 0)
	{
		if (s[i - 1] == t[j - 1])
		{
			ans += s[i - 1];
			i--;
			j--;
		}
		else if (dp[i - 1][j] > dp[i][j - 1])
		{
			i--;
		}
		else
		{
			j--;
		}
	}
	reverse(ans.begin(), ans.end());
	//cout << ans.length() << endl;
	cout << ans << endl;

}





Measured memory_bytes: 35456
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use std::mem::swap;

#[fastout]
fn main() {
    input! {
    n: usize,
    a:[[usize; n - 1]; n]
    }
    let mut a = a;
    for i in 0..n {
        a[i].reverse();
        for j in 0..n -1 {
            a[i][j] -= 1;
        }
    }
    let mut ans = 0;
    let mut q = vec![];
    for i in 0..n {
        check(i , &mut a, &mut q);
    }
    while !q.is_empty() {
        ans += 1;
        q.sort();
        q.dedup();
        let mut prev_q: Vec<_> = vec![];
        swap(&mut prev_q, &mut q);
        for p in prev_q {
            let (i, j) = (p.0, p.1);
            a[i].pop();
            a[j].pop();
            check(i, &mut a, &mut q);
            check(j, &mut a, &mut q);
        }
    }
    for i in a {
        if !i.is_empty() {
            println!("-1");
            return
        }
    }
    println!("{}", ans);
}

fn check(i: usize, a: &mut Vec<Vec<usize>>, q: &mut Vec<(usize, usize)>) {
    if a[i].is_empty() {return;}
    let j  = a[i][a[i].len() - 1];
    if a[j][a[j].len() - 1] == i {
        let mut p = (i , j);
        if p.0 < p.1 {swap(&mut p.0, &mut p.1);}
        q.push(p);
    }
}


Measured memory_bytes: 13724
#include <iostream>
#include <string>
using namespace std;
using Int = int64_t;
template <class T>
constexpr T gcd(T a, T b) noexcept {
    return a % b ? gcd(b, a % b) : b;
}
template <class T>
constexpr T lcm(T a, T b) noexcept {
    return a * b / gcd(a, b);
}
Int solve() {
    Int N, M;
    string S, T;
    cin >> N >> M >> S >> T;
    Int g = gcd(N, M), l = lcm(N, M);
    for (int i = 0; i < g; i++) {
        if (S[i * N / g] != T[i * M / g]) return -1;
    }
    return l;
}
int main() {
    cout << solve() << endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int D, T, S; cin >> D >> T >> S;
  int D2 = T * S;
  if (D2 >= D)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void a_restaurant(void) {
	int n;
	cin >> n;

	int total = 800 * n;
	int y = 0;
	y = 200 * (n / 15);

	cout << total - y << endl;
}

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

Measured memory_bytes: 3644
#include<stdio.h>
const int m = 1000000007;

int grundy[100005];
int n, k, a[101], temp[105];

int main() {
	scanf("%d%d",&n,&k);
	for( int i=0; i<n; ++i )
		scanf("%d", a+i);
	for( int i=1; i<=k; ++i ) {
		for( int j=0; j<103; ++j )
			temp[j] = 0;
		for( int j=0; j<n; ++j ) 
			if( a[j] <= i )
				temp[grundy[i-a[j]]] = 1;
		for( int j=0; ; ++j )
			if( temp[j] == 0 )
			{
				grundy[i] = j;
				break;
			}
	}
	if( grundy[k] == 0 )
		printf("Second\n");
	else
		printf("First\n");
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
//#define NUM 50

int main(){
    int price = 700;
    char s[3 + 1];
    cin >> s;
    for(int i = 0; s[i] != '\0'; i++){
        if(s[i] == 'o'){
            price += 100;
        }
    }
    cout << price << endl;
    return 0;
}

Measured memory_bytes: 256
#coding:utf-8
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

p1 = 0
p2 = 0
p3 = 0

for i in p:
  if i <= a:
    p1 += 1
  elif i >= (a+1) and i <= b:
    p2 += 1
  elif i >= (b+1):
    p3 += 1

print(min(min(p1, p2), p3))


Measured memory_bytes: 3060
x, y = map(int, input().split())
mod = 10**9+7


# comb init
nmax = 10**6 + 1  # change here
fac = [0] * (nmax + 1)
finv = [0] * (nmax + 1)
inv = [0] * (nmax + 1)
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, nmax):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def comb(n, r):
    if n < r:
        return 0
    else:
        return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod


if (x+y) % 3 != 0:
    print(0)
    exit()

if x < y:
    x, y = y, x
if x > 2 * y:
    print(0)
    exit()

n = (x+y) // 3
r = y - n
print(comb(n, r))


Measured memory_bytes: 64876
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int N=scan.nextInt();
    int H=scan.nextInt();
    int W=scan.nextInt();
    int[] A=new int[N];
    int[] B=new int[N];
    int count=0;
    for(int i=0;i<N;i++){
      A[i]=scan.nextInt();
      B[i]=scan.nextInt();
      if(A[i]>=H&&B[i]>=W){
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n, k; cin >> n >> k;
  string s; cin >> s;
  s[k - 1] = s[k - 1] + ('a' - 'A');
  cout << s << endl;
}


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

long long n,W,dp[105][100005],v[105],w[105],ans;

int main(){
    cin >> n >> W;
    for(int i=1;i<=n;i++){
        cin >> w[i] >> v[i];
    }
    for(int i=0;i<=n;i++) dp[i][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=W;j++){
            if(j>=w[i]) dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    for(int i=0;i<=W;i++){
        ans=max(ans,dp[n][i]);
    }
    cout << ans;
}


Measured memory_bytes: 81740
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
 using namespace __gnu_pbds;
 using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0)
#define mod                     1000000007
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
typedef  long long                   ll;
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  unordered_map<int, int>    mii;
typedef  vector<ll>                 vll;

clock_t time_p=clock();
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}



int main()
{
  FIO;
 

 int n;
 cin>>n;
 ll a[n];
 forn(i,n)
  cin>>a[i];
 
 ll ans=-1e10;
 forn(i,n)
 {
  forn(j,n)
  {
    if(i!=j)
    {
      ans=max(ans,abs(a[i]-a[j]));
    }
  }
 }
 cout<<ans;

 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string S;
  cin >> S;
  int l=0;
  int ret=0;
  for(char c: S){
    switch(c){
      case 'A':
      case 'C':
      case 'G':
      case 'T':
        l++;
        break;
      default:
        l=0;
    }
    ret = max(ret, l);
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	dp := make([][]int, 50)
	for i := range dp {
		dp[i] = make([]int, n)
	}

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range dp[0] {
		sc.Scan()
		dp[0][i], _ = strconv.Atoi(sc.Text())
	}

	if k > 42 {
		for _ = range dp[0] {
			fmt.Printf("%d ", n)
		}
		fmt.Println()
		return
	}

	for i := 0; i < k; i++ {
		cs := make([]int, n+1)
		for j := 0; j < n; j++ {
			cs[max(0, j-dp[i][j])] += 1
			cs[min(j+dp[i][j]+1, n)] -= 1
		}
		var c int
		for j := 0; j < n; j++ {
			c += cs[j]
			dp[i+1][j] = c
		}
	}
	for i := range dp[k] {
		fmt.Printf("%d ", dp[k][i])
	}
	fmt.Println()
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 108344
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  ll k;
  cin >> s >> k;
  ll n = s.length();
  if (n == 1) {
    cout << k / 2 << endl;
    return 0;
  }
  ll l = 0, r = 0;
  for (int i = 0; i < n; i++) {
    if (s[0] == s[i]) {
      l++;
    } else {
      break;
    }
  }
  if (l == n) {
    cout << n * k / 2 << endl;
    return 0;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[n - 1] == s[i]) {
      r++;
    } else {
      break;
    }
  }
  if (l + r == n) {
    ll ans = l / 2 * k + r / 2 * k;
    cout << ans << endl;
    return 0;
  }
  ll ans = 0;
  ll c = 1;
  for (int i = l; i < n - r; i++) {
    if (s[i] == s[i + 1]) {
      c++;
    } else {
      ans += c / 2 * k;
      c = 1;
    }
  }
  ans += c / 2 * (k - 1);
  if (s[0] == s[n - 1]) {
    ans += l / 2 + (l + r) / 2 * (k - 1) + r / 2;
  } else {
    ans += l / 2 * k + r / 2 * k;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
while true do
  input = STDIN.gets
  h_w = input.split(" ")
  h = h_w[0].to_i
  w = h_w[1].to_i
  if (h == 0) && (w == 0)
    break
  end
  for i in 1 .. h do
    for j in 1 .. w do
      print "#"
    end
    print "\n"
  end
  print "\n"
end

Measured memory_bytes: 8812
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  string n;
  cin >> n;
  if (n[0] == '7' || n[1] == '7' || n[2] == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a[][] = new int[n][m];
		int b[] = new int[m];
		int temp = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				temp += a[i][j] * b[j];
			}
			System.out.println(temp);
			temp = 0;
		}
	}
}


Measured memory_bytes: 40604
#include<iostream>
using namespace std;
int dy[]={-1,0,1,0,-1,1};
int dx[]={0,1,0,-1,-1,1};
int n,m;
int t[20][20];
int u[20][20];
int cnt,flg;
bool visited[20][20];

void rec(int y,int x,int key){
  if(u[y][x]==0)flg=1;
  if(u[y][x]!=key)return;
  if(visited[y][x])return;
  cnt++;
  visited[y][x]=true;
  for(int i=0;i<6;i++)
    rec(y+dy[i],x+dx[i],key);
}

int check(int y,int x){
  for(int i=0;i<20;i++){
    for(int j=0;j<20;j++){
      u[i][j]=t[i][j];
      visited[i][j]=false;
    }
  }
  u[y][x]=m;
  int res=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=i;j++){
      if(visited[i][j])continue;
      flg=cnt=0;
      rec(i,j,u[i][j]);
      if(flg)continue;
      if(u[i][j]==m)res-=cnt;
      else res+=cnt;
    }
  }
  return res;
}

void init(){
  for(int i=0;i<20;i++)
    for(int j=0;j<20;j++)
      t[i][j]=-1;
}

int main(){
  while(1){
    cin>>n>>m;
    if(n==0&&m==0)break;
    init();
    for(int i=1;i<=n;i++){
      for(int j=1;j<=i;j++){
        cin>>t[i][j];
      }
    }
    int ans=-10000;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=i;j++){
        if(t[i][j]==0){
          ans=max(ans,check(i,j));
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
a, b, c, d = map(int, raw_input().split())
from fractions import gcd
ans1 = b - b/c - b/d + b*gcd(c, d)/(c*d)
ans2 = a - 1 - (a-1)/c - (a-1)/d + (a-1)*gcd(c, d)/c/d
print ans1 - ans2

Measured memory_bytes: 4392
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

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

	int count = 0;
	for(int i = 0; i < n; i++){
		int j = 2;
		int flag = 1;
		while(1){
			if(a[i] % j == 0 && a[i] > 3){
				flag = 0;
			}
		
			if(j >= sqrt(a[i])+1){
				break;
			}
			j++;
		}
		if(flag == 1){
			count++;
		}
	}

	cout << count << endl;
}



Measured memory_bytes: 3136
import numpy as np
N,M = list(map(int,input().split()))
XY = []
D = []
for n in range(N):
  XY.append(tuple(map(int,input().split())))

for m in range(M):
  D.append(tuple(map(int,input().split())))

XY = np.array(XY)
D = np.array(D)
for i in np.argmin(np.sum(np.abs(XY[:,None,:] - D[None,:,:]),axis=2),axis=1):
  print(i+1)

Measured memory_bytes: 12504
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <queue>
#include <stack>
#include <bitset>
#include <set>
#include <chrono>
#include <string>

using namespace std;

#define endl '\n'

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

    long long n, x;
    cin >> n >> x;
    vector<long long> a(2 * n);

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

    long long answer = a[0] * n + x * (n - 1);

    for (int c = 0; c < n; ++c)
    {
        long long cur = c * x;
        deque<int> s;

        for (int i = 0; i < 2 * n; ++i)
        {
            while (!s.empty() && a[s.back()] >= a[i])
            {
                s.pop_back();
            }

            s.push_back(i);

            if (s.front() == i - c - 1)
                s.pop_front();

            if (i >= n)
                cur += a[s.front()];
        }
        answer = min(answer, cur);
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char f[10],buf[1<<17];
sz;
main()
{
	read(0,buf,100000);
	for(;;)
	{
		k=buf[sz++];
		if(sz==100000)read(sz=0,buf,100000);
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(sz==100000)read(sz=0,buf,100000);
			if(k<'0')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		if(!cnt[i])
		{
			buf[sz++]='0';
		}
		else
		{
			if(cnt[i-1]!=cnt[i])
			{
				k=0;
				t=cnt[i];
				while(t)
				{
					f[k++]=t%10;
					t/=10;
				}
				acc=k;
			}
			else k=acc;
			while(k--)buf[sz++]=f[k]+'0';
		}
		buf[sz++]='\n';
		if(sz>=100000)write(1,buf,sz),sz=0;
	}
	write(1,buf,sz);
}

Measured memory_bytes: 3200
<?php
fscanf(STDIN, "%s", $str);
$char_array  = str_split($str);
$count_array = array();
foreach ($char_array as $chr) {
	if (isset($count_array[$chr])) {
		$count_array[$chr] = $count_array[$chr] + 1;
	} else {
		$count_array[$chr] = 1;
	}
}
$is_beauty = true;
foreach ($count_array as $count) {
	if ($count % 2 != 0) {
		$is_beauty = false;
		break;
	}
}

echo $is_beauty == true ? "Yes" : "No";

Measured memory_bytes: 3576
def resolve():
    N = int(input())
    P = [list(map(int, input().split())) for _ in range(N)]
    X, Y, H = zip(*P)

    # Cx, Cyを固定して式に当てはめる
    # 逆算している形になっている為、情報Hと矛盾してないのが答え
    # h[i]=0になっているものは距離が分からないので、中心の高さを求めるのには使わない。
    for cx in range(101):
        for cy in range(101):
            h = 1
            for i in range(N):
                if H[i] > 0:
                    h = H[i] + abs(cx - X[i]) + abs(cy - Y[i])
            ok = True
            for i in range(N):
                res = max(h - abs(cx - X[i]) - abs(cy - Y[i]), 0)
                if res != H[i]:
                    ok = False
            if ok:
                print(cx, cy, h)
                return


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 8892
n = int(input())
s = [input() for _ in range(n)]
l = [0]*5
march=list('MARCH')
for s_ in s:
    for i in range(5):
        if s_[0]==march[i]:
            l[i]+=1
            break
ans = 0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            if i==j or i==k or j==k:
                continue
            else:
                ans += l[i]*l[j]*l[k]
print(ans)

Measured memory_bytes: 9752
#include <iostream>
#include <climits>

void swap(int& x, int& y)
{
	int tmp = x;
	x = y;
	y = tmp;
}

void swap(char& x, char& y)
{
	char tmp = x;
	x = y;
	y = tmp;
}

void stable_merge(char* S, int *A, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	int* L = new int[n1+1];
	int* R = new int[n2+1];
	char* LS = new char[n1+1];
	char* RS = new char[n2+1];
	for (int i=left; i<mid; i++) {
		L[i-left] = A[i];
		LS[i-left] = S[i];
	}
	for (int i=mid; i<right; i++) {
		R[i-mid] = A[i];
		RS[i-mid] = S[i];
	}
	L[n1] = R[n2] = INT_MAX;
	LS[n1] = RS[n2] = CHAR_MAX;
	int l = 0, r = 0;
	for (int k=left; k<right; k++) {
		if (L[l] > R[r]) {
			A[k] = R[r]; S[k] = RS[r]; r++;
		} else {
			A[k] = L[l]; S[k] = LS[l]; l++;
		}
	}
	delete[] L;
	delete[] R;
	delete[] LS;
	delete[] RS;
}

void stable_mergeSort(char* S, int *A, int left, int right)
{
	if (left+1 < right) {
		int mid = (left + right) / 2;
		stable_mergeSort(S, A, left, mid);
		stable_mergeSort(S, A, mid, right);
		stable_merge(S, A, left, mid, right);
	}
}

int partition(char* S, int* A, int p, int r)
{
	int key = A[r];
	int i = p - 1;
	for (int j=p; j<r; j++) {
		if (A[j] <= key) {
			i++;
			swap(A[i], A[j]);
			swap(S[i], S[j]);
		}
	}
	swap(A[i+1], A[r]);
	swap(S[i+1], S[r]);
	return i+1;
}

void quickSort(char* S, int* A, int p, int r)
{
	if (p<r) {
		int q = partition(S, A, p, r);
		quickSort(S, A, p, q-1);
		quickSort(S, A, q+1, r);
	}
}

int main()
{
	int n;
	std::cin >> n;
	
	char* suits = new char[n];
	int *nums = new int[n];
	
	for (int i=0; i<n; i++) std::cin >> suits[i] >> nums[i];
	
	char* suits_cpy = new char[n];
	int *nums_cpy = new int[n];
	
	for (int i=0; i<n; i++) {
		suits_cpy[i] = suits[i];
		nums_cpy[i] = nums[i];
	}
	
	quickSort(suits, nums, 0, n-1);
	stable_mergeSort(suits_cpy, nums_cpy, 0, n);
	
	bool isStable = true;
	for (int i=0; i<n; i++) {
		if (suits[i] != suits_cpy[i]) {
			isStable = false; break;
		}
	}
	
	if (isStable) std::cout << "Stable" << std::endl;
	else std::cout << "Not stable" << std::endl;
	for (int i=0; i<n; i++) {
		std::cout << suits[i] << " " << nums[i] << std::endl;
	}
	
	delete[] suits;
	delete[] nums;
	delete[] suits_cpy;
	delete[] nums_cpy;
	
	return 0;
}




Measured memory_bytes: 4280
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll cnt;

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

	string S;
	cin >> S;
	
	ll N = S.size();
	vector<ll> ans(N + 1);

	rep(i, N) {
		if (S[i] == '<') {
			ans[i + 1] = ans[i] + 1;
		}
	}

	for (ll i = N - 1; i >= 0; i--) {
		if (S[i] == '>') {
			ans[i] = max(ans[i],ans[i + 1] + 1);
		}
	}
	
	rep(i, N+1) {
		cnt += ans[i];
	}

	cout << cnt << endl;
	return 0;
}


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

int main(){

  int a,b,c,d,e,ma;
  scanf("%d %d", &a, &b );

  c=a+b;
  d=a-b;
  e=a*b;
  ma=max(c, max(d,e));

  printf("%d\n",ma);

}


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

namespace _0046
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal n;
            List<decimal> hight = new List<decimal>();
            decimal hightDistance;
            while (decimal.TryParse(Console.ReadLine(),out n))
            {
                hight.Add(n);
            }
            hightDistance = hight.Max() - hight.Min();
            Console.WriteLine(hightDistance);
        }
    }
}



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

int main()
{
  int n,k;
  string s;
  cin >> n >> s >> k;
  int i;
  for(i = 0; i < n; i++)
  {
    if(s.at(i) == s.at(k-1))
    {
      cout << s.at(k-1);
    }
    else
    {
      cout << '*';
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	// your code goes here
	int w,h,x,y,r;
	
	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
	
	if( -100 > x || x > 100 || -100 > y || y > 100 ) {
	 	return 0;
	}
	if( 0 >= w || w > 100 || 0 >= h || h > 100 || 0 >= r || r > 100) {
		return 0;
	}
	
	if( (x - r >= 0) && (x + r <= w) && (y - r >= 0) && (y + r <= h) ) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)


int main() {
	int n, x;
	while (1) {
		cin >> n >> x;
		if (n == 0 && x == 0) {
			break;
		}
		else {
			int cnt = 0;
			FOR(i, 1, n - 2) {
				FOR(j, i + 1, n - 1) {
					FOR(k, j + 1, n) {
						if (i + j + k == x) {
							cnt++;
						}
					}
				}
			}
			pv(cnt)
		}
	}
	return(0);
}


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

int main() {
  char c;
  cin >> c;

  if(c == 'a' || c == 'i'|| c == 'u' || c == 'e'|| c == 'o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long int ll;
static const int MAX_N = 50;
static const long double MAX_V = 1e15;
static const double EPS = 1e-7;

int N, A, B;
ll v[MAX_N];

long double y[MAX_N];

bool C(long double x, int num){
	for(int i = 0; i < N; i++){
		y[i] = (long double)v[i] - x;
	}
	long double sum = 0.0;
	for(int i = 0; i < num; i++){
		sum += y[i];
	}
	return sum > 0.0;
}
ll comb(int n, int r){
	ll res = 1;
	for(int i = 1; i <= r; i++){
		res *= (n - i + 1);
		res /= i;
	}
	return res;
}
int main(){
	cin >> N >> A >> B;
	for(int i = 0; i < N; i++){	
		cin >> v[i];
	}
	sort(v, v + N);
	reverse(v, v + N);
	int num;
	long double ans = 0.0;
	for(int i = A; i <= B; i++){
		long double sum = 0.0;
		for(int j = 0; j < i; j++){
			sum += v[j];
		}
		if(sum / (long double)i > ans){
			ans = sum / (long double)i;
			num = i;
		}
	}
	//ll proper_sum = 0LL;
	//for(int i = 0; i < num; i++) proper_sum += v[i];
	ll cnt = 0LL;
	for(int i = A; i <= B; i++){
		ll sum = 0LL;
		for(int j = 0; j < i; j++){
			sum += v[j];
		}
		if(abs((long double)sum / (long double)i - ans) > EPS) continue;
		int l = 51, r = -1;
		for(int j = 0; j < N; j++){
			if(v[j] == v[i - 1] && j > r) r = j;
			if(v[j] == v[i - 1] && j < l) l = j;
		}
		cnt += comb(r - l + 1, i - l);
	}
	printf("%.7llf\n%lld\n", ans, cnt);
	return 0;
}


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

border = sum(A) / (4 * M)
pnum = 0
for i in range(N):
    test = A[i] - border
    if test >= 0:
        pnum +=1
    else:   #test < 0
        pass
    if pnum >= M:
        break
    else:
        pass

if pnum >= M:
    print('Yes')
else: #pnum < M
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
ll dp[105][10005];
int main(){
  ll n,W;
  cin>>n>>W;
  memset(dp,0,sizeof(dp));
  vll v(n),w(n);
  rep(i,n){
    cin>>v[i]>>w[i];
  }
  rep(i,n)rep(j,W+1){
    if(j>=w[i]){
      dp[i+1][j]=max(dp[i][j],dp[i+1][j-w[i]]+v[i]);
    }
    else{
      dp[i+1][j]=dp[i][j];
    }
  }
  COUT(dp[n][W]);
}


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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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,M;
    scanf("%d%d",&N,&M);
    vector<PLL> V;
    REP(i,N){
    	ll a;
        scanf("%lld",&a);
        V.PB(MP(a,1));
    }

    ll ans = 0;
    REP(i,M){
    	int b;
    	ll c;
        scanf("%d%lld",&b,&c);
        V.PB(MP(c,b));
    }

    sort(V.rbegin(),V.rend());

    ll rest = N;

    REP(i,V.size()){
        ll C = V[i].fst;
        ll B = V[i].snd;
        if (rest <= B){
        	ans += C*rest;
        	break;
        }else{
        	rest -= B;
        	ans += C*B;
        }
    }


    cout << ans << "\n";



}

Measured memory_bytes: 6512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

bool dp[100010];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }

  rep(i,k+1)rep(j,n){
    if ( i - a[j] < 0 ) {
      continue;
    }
    if ( !dp[i - a[j]] ) {
      dp[i] = true;
    }
  }
  cout << (dp[k] ? "First" : "Second") << endl;
}


Measured memory_bytes: 888
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int ans = 1900*M + 100*(N-M);
    for (int i = 0; i < M; i++){
      ans *= 2;
    }
    
    System.out.println(ans);
  }
}

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

using namespace std;

int main(){
  int n; cin >>n;
  vector<string> s(n);
  vector<vector<int> > cnt(26,vector<int>(n,0));
  for(int i=0;i<n;++i){
    cin >> s[i];
    for(int j=0;j<s[i].size();++j) cnt[s[i][j]-'a'][i]++;
  }
  for(int i=0;i<26;++i) {
    for(int j=0;j<*min_element(cnt[i].begin(),cnt[i].end());++j) printf("%c",'a'+i);
  }
  cout <<endl;
  return 0;
}


Measured memory_bytes: 256