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



int main(){
    ll A,B,K;
    vector<ll> num(300,0);
    vector<ll> num2(300,0);
    cin >> A >> B >> K;

    for(int i = A; i < min(B ,A + K); i++){
        num[i - A] = 1;
    }
    if(B - A <= 100){
        for(int i = A ; i < min(B ,A + K); i++){
            num[i - A] = 1;
        }
        for(int i =  max(A,B - K + 1); i <= B; i++){
            num[i - A] = 1;
        }


        for(int i = A; i <= B; i++){
            if(num[i - A] == 1) cout << i << endl;
        }
        return 0;
    }else{
        for(int i = B - K + 1; i <= B; i++){
            num2[i - (B - K + 1)] = 1;
        }

        for(int i = A; i <= A + K; i++){
            if(num[i - A] == 1) cout << i << endl;
        }

        for(int i = B - K + 1; i <= B; i++){
            if(num2[i - (B - K + 1)] == 1) cout << i << endl;
        }
    }


}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll h, w; cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    vector<vector<ll>> d(h, vector<ll>(w, INF));
    if(s[0][0] == '.') d[0][0] = 0;
    else d[0][0] = 1;

    queue<P> q;
    q.push(MP(0, 0));
    while(!q.empty()) {
        ll x = q.front().first, y = q.front().second;
        q.pop();
        if(x+1 < h) {
            if(s[x][y] == '.' && s[x+1][y] == '#') {
                if(d[x+1][y] > d[x][y] + 1) {
                    d[x+1][y] = d[x][y] + 1;
                    q.push(MP(x+1, y));
                }
            }
            else {
                if(d[x+1][y] > d[x][y]) {
                    d[x+1][y] = d[x][y];
                    q.push(MP(x+1, y));
                }
            }
        }
        if(y+1 < w) {
            if(s[x][y] == '.' && s[x][y+1] == '#') {
                if(d[x][y+1] > d[x][y] + 1) {
                    d[x][y+1] = d[x][y] + 1;
                    q.push(MP(x, y+1));
                }
            }
            else {
                if(d[x][y+1] > d[x][y]) {
                    d[x][y+1] = d[x][y];
                    q.push(MP(x, y+1));
                }
            }
        }
    }

    cout << d[h-1][w-1] << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3764
#include <stdio.h>

int main(void){
  int a, b;
  scanf("%d %d", &a, &b);
  
  if(a > b){
  	for(int i = 0; i < a; i++){
      printf("%d", b);
    }
  }else{
    for(int i = 0; i < b; i++){
      printf("%d", a);
    }
  }
  return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	//ios::sync_with_stdio(false);
	ll N,P;
	while(cin>>N>>P) {
		VI A(N);
		REP(i, N) cin>>A[i];
		VVI dp(N, VI(2));
		dp[0][0] += 1;
		dp[0][A[0]%2] += 1;
		RANGE(i, 1, N) {
			REP(mi, 2) {
				dp[i][mi] += dp[i-1][mi];
//				int pmi = (A[i-1]%2)==(A[i]%2) ? mi : 1-mi;
				int pmi = A[i]%2==0 ? mi : 1-mi;
				dp[i][mi] += dp[i-1][pmi];
			}
		}
//		DD(dp);
		
		cout<<dp[N-1][P]<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
typedef long long ll;
int n;
ll ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		if(n%i==0) ans+=n/i-1;
		else ans+=n/i;
	printf("%lld\n",ans);
	return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  ll n,a,b; cin>>n>>a>>b;
  vector<ll> x(n, 0);
  rep(i,n) cin>>x[i];
  ll ans=0;
  for (int i=1; i<n; i++) {
    ll t = (x[i]-x[i-1])*a;
    if (t<b) ans+=t;
    else ans+=b;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 1024
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n = int(input())
aaa = get_nums_l()

now = 1
ans = 0
for i in range(n):
    a = aaa[i]
    if a != now:
        ans += 1
    else:
        now += 1
if ans == n:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 74588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

map<ll, ll> fact;

void factorize(ll n) {
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    while (n%i == 0) {
        n /= i;
        fact[i]++;
    }
  }
  if (n != 1) fact[n]++;
}

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

    rep(i, 1, n+1){
        factorize(i);
    }

    ll c75 = 0;
    ll c25 = 0;
    ll c15 = 0;
    ll c5 = 0;
    ll c3 = 0;
    fore(i, fact){
        if(i.second >= 74){
            c75++;
        }
        if(i.second >= 24){
            c25++;
        }
        if(i.second >= 14){
            c15++;
        }
        if(i.second >= 4){
            c5++;
        }
        if(i.second >= 2){
            c3++;
        }
    }
    ll res = 0;
    if(c5 >= 2 && c3 >= 3){
        res += (c3 - 2) * (c5 * (c5 - 1) / 2);
    }
    if(c25 >= 1 && c3 >= 2){
        res += (c3 - 1) * c25;
    }
    if(c15 >= 1 && c5 >= 2){
        res += (c5 - 1) * c15;
    }
    if(c75 >= 1){
        res += c75;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            //すべての和を求める
            for(int i = 0;i < n ;i++)
            {
                int temp = int.Parse(input[i]);

                if(temp % 2 == 0)
                {
                    if(temp % 3 != 0 && temp % 5 != 0)
                    {
                        Console.WriteLine("DENIED");
                        return;
                    }
                }
            }

            Console.WriteLine("APPROVED");
    
        }
    }

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// https://ja.stackoverflow.com/questions/53484/%E3%82%A2%E3%83%83%E3%83%88%E3%82%B3%E3%83%BC%E3%83%80%E3%83%BC%E3%81%AE%E5%95%8F%E9%A1%8C%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6-colorful-subsequence
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    map<char, ll> cnt;
    REP(i, N) { cnt[S[i]]++; }
    ll ans = 1LL;
    for(auto hoge : cnt) {
        ans *= (hoge.second + 1LL);
        ans %= MOD;
    }
    ans = (ans - 1 + MOD) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
int min(int n,int m){
    if(n<m) return n;
    else return m;
}
int main(void){
    int n,i,sum=0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    int ans=sum,g=0;
    for(i=0;i<n;i++){
        g+=a[i];
        sum-=a[i];
        ans = min(ans,abs(sum-g));
    }
    printf("%d",ans);
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, int> di;

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<di> q;
    int copy_q[n];

    rep(i, n)
    {
        int a;
        cin >> a;
        q.push(make_pair(a, i));
        copy_q[i] = a;
    }

    ll sum = 0;
    int cnt[n] = {};
    while (1)
    {
        if (n == 1)
        {
            cnt[0] = m;
            break;
        }
        di t = q.top();
        q.pop();
        int y = ceil(log2(t.first / q.top().first));
        if (y == 0)
            y = 1;

        if (y <= m)
        {
            q.push(di(t.first / pow(2, y), t.second));
            cnt[t.second] += y;
            m -= y;
        }
        else
        {
            break;
            q.push(di(t));
        }
    }
    rep(i, n)
    {
        sum += copy_q[i] / pow(2, cnt[i]);
    }
    OP(sum);
    return 0;
}

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

int main() {
  int n, x;
  while (true) {
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    }

    int i, j, k, res;
    res = 0;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= n; j++) {
        for (k = 1; k <= n; k++) {
          if (i < j && j < k) {
            int sum = i + j + k;
            if (sum == x) {
              res++;
            }
          }
        }
      }
    }
    cout << res << endl;
  }

  return 0;
}



Measured memory_bytes: 3120
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[200010];
    ll cnt[200010] = {};
    rep(i,0,N-1){
        cin >> A[i];
        cnt[A[i]]++;
    }
    rep(i,1,N+1){
        print(cnt[i]);
    }
    
}


Measured memory_bytes: 6800
function getdivisors(n::Int)::Set{Int}
    ret = Set{Int}(n)
    for i=2:floor(Int, √n)
        if n % i == 0
            push!(ret, i)
            push!(ret, n÷i)
        end
    end
    ret
end


function solve()
    N = parse(Int, readline())
    ks = Set{Int}()
    if N > 2
        union!(ks, getdivisors(N-1))
    end
    for d in getdivisors(N)
        n = N
        while n % d == 0
            n ÷= d
        end
        if n % d == 1
            push!(ks, d)
        end
    end
    println(length(ks))
end

solve()


Measured memory_bytes: 161512
import java.lang.Math

fun main(args: Array<String>)
{
    val n = readLine()!!.toInt()

    var flag = false
    for (i in 1..9) {
        val q = n / i
        val r = n % i
        if(q <= 9 && r == 0) {
            flag = true
            break
        }
    }

    println(if(flag) "Yes" else "No")
}


Measured memory_bytes: 33732
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <deque>

using namespace std;

const int maxn = 1e5 + 5;

long long sum[maxn << 2], col[maxn << 2];
long long num[maxn << 2], cor[maxn << 2];

void PushUp(long long *s, int v) {
    s[v] = s[v << 1] + s[v << 1 | 1];
}

void PushDown(long long *s, long long *c, int m, int len) {
    if (c[m]) {
        c[m << 1] += c[m];
        s[m << 1] += 1ll * (len - (len >> 1)) * c[m];
        c[m << 1 | 1] += c[m];
        s[m << 1 | 1] += 1ll * (len >> 1) * c[m];
        c[m] = 0;
    }
}

#define lson l, m, v << 1
#define rson m + 1, r, v << 1 | 1

void update(long long *s, long long *c, int L, int R, int val, int l, int r, int v) {
    if (L <= l && r <= R) {
        s[v] += 1ll * (r - l + 1) * val;
        c[v] += 1ll * val;
        return;
    }
    int m = (l + r) >> 1;
    PushDown(s, c, v, r - l + 1);
    if (L <= m) update(s, c, L, R, val, lson);
    if (R >  m) update(s, c, L, R, val, rson);
    PushUp(s, v);
}

long long query(long long *s, long long *c, int L, int R, int l, int r, int v) {
    if (L <= l && r <= R) return s[v];
    int m = (l + r) >> 1;
    PushDown(s, c, v, r - l + 1);
    long long ans = 0;
    if (L <= m) ans += query(s, c, L, R, lson);
    if (R >  m) ans += query(s, c, L, R, rson);
    return ans;
}

int n, m;
int a[maxn];

int main(int argc, char const *argv[]) {
    
    cin >> n >> m;

    memset(sum, 0, sizeof(sum));
    memset(num, 0, sizeof(num));

    for (int i = 1; i <= n; i ++)
        scanf("%d", a + i);

    for (int i = 2; i <= n; i ++) {
        int s = a[i - 1], t = a[i];

        if (s < t) {
            update(sum, col, 1, s, t - s, 1, m, 1);
            update(sum, col, s + 1, t, t + 1, 1, m, 1);
            update(num, cor, s + 1, t, 1, 1, m, 1);
            if (t + 1 <= m)
                update(sum, col, t + 1, m, t - s, 1, m, 1);
        }
        else if (s > t) {
            swap(s, t);
            update(sum, col, s + 1, t, s + m - t, 1, m, 1);
            update(sum, col, 1, s, s + 1, 1, m, 1);
            update(num, cor, 1, s, 1, 1, m, 1);
            if (t + 1 <= m) {
                update(sum, col, t + 1, m, s + m + 1, 1, m, 1);
                update(num, cor, t + 1, m, 1, 1, m, 1);
            }
        }
    }

    long long ans = 1e18;
    for (int i = 1; i <= m; i ++) {
        long long tmp1 = query(sum, col, i, i, 1, m, 1);
        long long tmp2 = query(num, cor, i, i, 1, m, 1);
        long long res = tmp1 - tmp2 * i;
        // cout << tmp1 << " " << tmp2 << endl;
        ans = min(ans, res);
        // cout << i << " " << res << e1ndl;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13184
str = gets.chomp
spell = gets.chomp
t = Array.new(spell.size+1, 0)
t[0] = 1
str.each_char do |c|
    new_t = Array.new(spell.size+1, 0)
    (0..spell.size).each do |i|
        if i < spell.size && c == spell[i]
            new_t[i+1] += t[i]
        end
        new_t[i] += t[i]
    end
    t = new_t.map {|k| k % 1_000_000_007}
end
p t[-1]


Measured memory_bytes: 7528
#include<stdio.h>
typedef struct Node *link;
struct Node{
        int key;
        link parent;
        link left;
        link right;
    };
link insert(link,link);
void find(link,int);
void inorder(link);
void preorder(link);
int main(void){
    int N,i,n,now=0,count=0;
    char word[10];
    link r = NULL;
    link L[1000];
    scanf("%d",&N);
    while(count<N){
        count++;
        scanf("%s",word);
        if(word[0] == 'p'){
            inorder(r);
            printf("\n");
            preorder(r);
            printf("\n");
            continue;
        }
        else if(word[0] == 'f'){
            scanf("%d",&n);
            find(r,n);
            continue;
        }
        else{
            scanf("%d",&n);
            L[now]  = malloc(sizeof(*L[now]));
            L[now]->key = n;
            r = insert(L[now],r);
            now++;
        }
    }
    return 0;
}
link insert(link z,link root){
    link x,p;
    p = NULL;
    x = root;
    while(x != NULL){
        p = x;
        if(z->key < x->key){
            x = x->left;
        }
        else{
            x = x->right;
        }
    }
    z->parent = p;
    if(p == NULL){
        root = z;
    }
    else if(z->key < p->key){
        p->left = z;
    }
    else{
        p->right = z;
    }
    return root;
}
void find(link root,int key){
    link x;
    int flag=0;
    x = root;
    while(x != NULL){
        if(key == x->key){
            flag = 1;
            break;
        }
        if(key < x->key){
            x = x->left;
        }
        else{
            x = x->right;
        }
    }
    if(flag==1) printf("yes\n");
    else printf("no\n");
}
void inorder(link n){
    if(n == NULL) return;
    inorder(n->left);
    printf(" %d",n->key);
    inorder(n->right);
}
void preorder(link n){
    if(n == NULL) return;
    printf(" %d",n->key);
    preorder(n->left);
    preorder(n->right);
}


Measured memory_bytes: 20480
#include<bits/stdc++.h>
using namespace std;
int n, x, a, b, yig, erg, sg;
int main() {
	cin >> n >> a >> b;
	int i;
	for(i = 1; i <= n; ++i) { cin >> x; if(x <= a) ++yig; if(x > a && x <= b) ++erg; if(x > b) ++sg;}
	cout << min(yig, min(erg, sg));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int A, B;
	cin >> A >> B;

	cout << (A + B) % 24;

	return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  long a[4],b[4];
  cin>>a[0]>>a[1]>>a[2]>>a[3];
     b[0]=a[1]*a[3];
   b[1]=a[0]*a[2];
  b[2]=a[0]*a[3];
   b[3]=a[1]*a[2];
  sort(b,b+4);
  cout<<b[3];
}

Measured memory_bytes: 3580
# include <bits/stdc++.h>
using namespace std;
# define pb push_back
const int N = 100005;
# define MOD 1000000007
typedef long long i64;

int a[N];
i64 A[N];

i64 pow_mod(i64 a, i64 n, i64 mod){
    i64 ret=1, tmp=a%mod;
    while (n) {
        if (n&1) ret=ret*tmp%MOD;
        tmp=tmp*tmp%MOD;
        n>>=1;
    }
    return ret;
}
i64 inv(i64 a, i64 mod){return pow_mod(a,mod-2,mod);}
i64 C(int x, int y) {
    return A[x]*inv(A[y], MOD)%MOD*inv(A[x-y], MOD)%MOD;
}
int main ()
{
    int n, k;
    cin >> n >> k;
    A[0] = 1;
    for (int i = 1; i <= n; ++i) A[i] = A[i-1]*i%MOD;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + n + 1);
    i64 ans = 0;
    for (int i = 1; i <= n-k+1; ++i) {
        ans = (ans - a[i] * C(n-i, k-1) % MOD)%MOD;
    }
    for (int i = n; i >= k; --i) {
        ans = (ans + a[i] * C(i-1, k-1) % MOD)%MOD;
    }
    cout << (ans + MOD)%MOD << endl;
    return 0;
}


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

string s;
ll ans = 0;

void noa(ll p, ll q, ll r){
	if(p == s.size()){
		ans += q + r;
		return;
	}
	noa(p+1, q+r, s[p] - '0');
	noa(p+1, q, r*10+s[p] - '0');
}

int main(){
	cin >> s;
	noa(1, 0, s[0]-'0');
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
n = int(input())
for i in range(n):
    t = input().split()
    a, b = map(int, t[1:3])
    if t[0] == 'print':
        print(s[a:b+1])
    elif t[0] == 'reverse':
        r = s[a:b+1]
        s = s[0:a] + r[::-1] + s[b+1:]
    else:
        p = t[3]
        s = s[0:a] + p + s[b+1:]



Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, l, r;
  cin >> n ;

  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> l >> r ;
    sum += r - (l-1);
  }

  cout << sum << endl;
}


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


def solve(S: str):
    ans=0
    for i in range(len(S)//2):
        if S[i] != S[(i+1)*(-1)]:
            ans+=1
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, n, ans = 0, t, ta, be;
  scanf("%lld%lld", &n, &t);
  for(i = 0; i < n; ++i) {
    scanf("%d", &ta);
    if(i) {
      ll tmp = ta - be;
      ans += (tmp < t ? tmp : t);
      be = ta;
    } else ans += t, be = 0;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans=0;
  string s,t;
  cin>>s>>t;
  for(ll i=0;i<3;i++){
    if(s[i]==t[i])ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

template <class T = usize> class rep {
	const T f, l;

public:
	class itr {
		friend rep;
		T i;
		itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
template <class T = usize> class revrep {
	const T f, l;

public:
	class itr {
		friend revrep;
		T i;
		itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <algorithm>
#include <iostream>
#include <utility>
#include <numeric>

int main() {
	usize n;
	::std::cin >> n;
	::std::vector<u64> a(n);
	for (auto &e : a)
		::std::cin >> e;
	::std::sort(a.begin(), a.end());
	const u64 base =
		::std::accumulate(a.crbegin(), a.crbegin() + n / 2, u64(0)) -
		::std::accumulate(a.cbegin(), a.cbegin() + n / 2, u64(0));
	if (n & 1) {
		const u64 l = a[n / 2 - 1];
		const u64 m = a[n / 2];
		const u64 g = a[n / 2 + 1];
		::std::cout << base * 2 - ::std::min(g - m, m - l) << ::std::endl;
	}
	else {
		const u64 l = a[n / 2 - 1];
		const u64 g = a[n / 2];
		::std::cout << base * 2 - g + l << ::std::endl;
	}
	return 0;
}


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

namespace abc073_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int ret = 0;
            for (int i = 0; i < n; i++)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                ret += x[1] - x[0] + 1;
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef signed long long lint;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  vector< int > cnt(4);
  for (int i=0; i<n; ++i) {
    string s;
    cin >> s;
    if (s=="AC") cnt[0]++;
    if (s=="WA") cnt[1]++;
    if (s=="TLE") cnt[2]++;
    if (s=="RE") cnt[3]++;
  }
  cout << "AC x " << cnt[0] << endl;
  cout << "WA x " << cnt[1] << endl;
  cout << "TLE x " << cnt[2] << endl;
  cout << "RE x " << cnt[3] << endl;
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
using namespace std;
typedef long long ll;
int dp[30][30][30];
int main() {
	int n, i;
	cin >> n >> i;
	cout << n + 1 - i << endl;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 504
from collections import Counter
N,K = map(int,input().split())
A = list(map(int,input().split()))
C = Counter(A).most_common()
C.sort(key=lambda x:x[1])
if len(C)<=K:print(0)
else:
    ans = 0
    for i in range(len(C)-K):
        ans += C[i][1]
    print(ans)

Measured memory_bytes: 39320
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int a,b,c,d,p,x,y;
	cin>>a>>b>>c>>d>>p;
	x=a*p;
	y=(p>c)?b+(p-c)*d:b;
	o(min(x,y));
}

Measured memory_bytes: 1160
S=str(input())
D=0
if S[0]=='A': #p1
  #print('_1')
  for i in range(2, len(S)-1):
    if S[i]=='C':
      D+=1
  if D==1: #p2
    #print('_2')
    for j in range(len(S)):
      if S[j]!='A' and S[j]!='C' and S[j].isupper():
        print('WA')
        exit()
    
    print('AC')
    exit()

print('WA')

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String strN = Integer.toString(N);
        
        String first = strN.substring(0,1);
        int fnum = Integer.valueOf(first);
        int compare = Integer.valueOf(first + first + first);
        
        if( compare >= N){
            System.out.println(compare);
        }else{
            String second = String.valueOf(fnum+1) + String.valueOf(fnum+1) + String.valueOf(fnum+1);
            System.out.println( second );
        }
        
        
        
    }
}


Measured memory_bytes: 23636
# coding: utf-8

a, b, K = map(int,input().split())

for i in range(K):
    if i % 2 == 0:
        if a % 2 != 0:
            a -= 1
        b += a // 2
        a //= 2
    else:
        if b % 2 != 0:
            b -= 1
        a += b // 2
        b //= 2

print(a,b)

Measured memory_bytes: 2940
#include<iostream>
#include<numeric>
#include<vector>
using namespace std;

long long gcd(long long a,long long b){
  if(a == 0){
    return b;
  }
  return gcd(b % a,a);
}

long long findGCD(vector<long long> &arr, int n){ 
  long long result = arr[0]; 
  for (int i = 1; i < n; i++) 
    result = gcd(arr[i], result);
  return result; 
}

vector<long long> A;
int N;
int main(){
  cin >> N;
  A.resize(N);

  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  cout << findGCD(A,N) << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define io_optimized ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
 
int main () {
	io_optimized
	int a,b;
	while(cin>>a>>b)
	{
		if(a>b)
		{
			while(a--)
			{
				cout<<b;
			}
		}
		else
		{
			while(b--)
			{
				cout<<a;
			}
		}
		cout<<"\n";
	}
 
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <complex>

using namespace std;

using Point=complex<double>;

static const double PI=3.141592653589793;

int main() {
    Point arg=polar(1.0, PI/2);
    Point target=0.0+0.0i;
    while (true) {
        double d, a;
        scanf("%lf, %lf", &d, &a);

        if (d == 0.0 && a == 0.0)
            break;

        target += d*arg;
        arg *= polar(1.0, -a*PI/180);
    }

    int x=target.real(), y=target.imag();

    printf("%d\n", x);
    printf("%d\n", y);
    return 0;
}

Measured memory_bytes: 2884
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <tuple>

using namespace std;

#define int long long

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) begin(a), end(a)

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 
#ifdef int
#define INF 1001001001001001001LL
#else
#define INF 1001001001
#endif

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int h,w;

int dfs (int i, int j, const vector<vector<bool>> & field, vector<vector<bool>> & done) {
    if(!field[i][j]) {
        return 0;
    }
    if(done[i][j]) {
        return 0;
    }
    int ans=0;
    done[i][j]=true;
    rep(k,4){
        if(dx[k]+i<0||dx[k]+i>=h||dy[k]+j<0||dy[k]+j>=w) continue;
        ans+=dfs(dx[k]+i, dy[k]+j, field, done);
    }

    return ans+1;
}


signed main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    while(cin>>w>>h,w||h){
        vector<vector<bool>> field(h,vector<bool>(w,false));
        vector<vector<bool>> done(h,vector<bool>(w,false));
        int si, sj;
        rep(i,h)rep(j,w){
            char c;
            cin>>c;
            field[i][j] = c=='#'?false:true;
            if(c == '@') {
                si=i;
                sj=j;
            }
        }

        cout<<dfs(si, sj, field, done)<<endl;
    }

	return 0;
}


Measured memory_bytes: 3112
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc074/tasks/abc074_b

N = int(input())
K = int(input())
X = list(map(int, input().split()))

ans = 0
for x in X:
    if x > abs(K-x):
        ans += abs(K-x)*2
    else:
        ans += x*2
print(ans)


Measured memory_bytes: 9148
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define PI acos(-1)
#define MM int m=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) ((x+mo_num)%mo_num)
#define vc vector
#define vct vector<int>
#define fa(i,V) for(auto i:V)
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
//#define P pair<int,int>
using namespace std;
const int INF=LLONG_MAX;
const int maxn=1e6+5;
const int mo_num=1e9+7;
int n,m,a[maxn];
int Pow(int b) {
    int ans = 1, base = 2;
    while (b != 0) {
        if (b & 1 != 0)
            ans *= base;
        base *= base;
        b >>= 1;
    }
    return ans;
}
int32_t main()
{
    IOS
    cin>>n>>m;
    double ans;
    cout<<setprecision(9)<<fixed;
    fun(i)
    {
        int now=i,time=0;
        while(now<m)
        {
            now*=2;
            time++;
        }
        a[time]++;
    }
    fu(i,0,30)
    {
        if(a[i])
            ans+=(double)a[i]/(double)(Pow(i));
    }
    cout<<(double)ans/(double)n;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int velo_a,velo_b,kyori_all,i;
	int st[10];
	double butukaru;
	
	while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&st[0],&st[1],&st[2],&st[3],&st[4],&st[5],&st[6],&st[7],&st[8],&st[9],&velo_a,&velo_b) != EOF){
		kyori_all = 0;
		for(i=0;i < 10;i++){
			kyori_all += st[i];
		}
		butukaru = 1.0*kyori_all * ( velo_a*1.0 / (velo_a+velo_b) );
		
		for(i=0;i < 10;i++){
			butukaru -= 1.0*st[i];
			if(butukaru <= 0.0) break;
		}
		printf("%d\n",i+1);
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, ans[1000000], max=0, k, l=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> k;
		ans[k]++;
		ans[k-1]++;
		ans[k+1]++;
		if(l<k) l=k;
	}
	for(int i=0;i<=l;i++){
		if(max<ans[i]) max = ans[i];
	}
	cout << max << endl;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

#define lam [&]


signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int N; scanf("%d", &N);
    vector<set<int>> children(N);
    vector<int> P(N);
    times(N, i) {
        scanf("%d", &P[i]);
        --P[i];
        children[P[i]].insert(i);
    }

    vector<char> is_loop(N, 0);
    function<bool(int)> check_loop = lam(int i) {
        if(is_loop[i] == 2) {
            is_loop[i] = 3; // loop start
            return true;
        }
        is_loop[i] = 2; // visited
        bool loop = check_loop(P[i]);
        bool start = is_loop[i] == 3;
        is_loop[i] = loop;
        return loop && !start;
    };
    check_loop(0);

    if(debug) { times(N, i) cout << 0+is_loop[i] sp; cout ln; }

    vector<int> val(N, -1);
    function<void(int)> update_val = lam(int i) {
        if(is_loop[i] || val[i] != -1) return;
        set<int> s;
        for(int j : children[i]) {
            update_val(j);
            s.insert(val[j]);
        }
        upto(0, s.size(), v) {
            if(s.find(v) == s.end()) {
                val[i] = v;
                return;
            }
        }
    };
    times(N, i) update_val(i);

    if(debug) { times(N, i) cout << val[i] sp; cout ln; }

    vector<int> loops(1);
    times(N, i) if(is_loop[i]) {
        loops[0] = i;
        break;
    }
    while(true) {
        int i = P[loops.back()];
        if(i == loops[0]) break;
        loops.push_back(i);
    }

    int vs[2] = {-1};
    {
        set<int> s0;
        int i0 = loops.back();
        for(int j : children[i0]) s0.insert(val[j]);
        upto(0, s0.size() + 1, v) {
            if(s0.find(v) == s0.end()) {
                if(vs[0] == -1) {
                    vs[0] = v;
                } else {
                    vs[1] = v;
                    break;
                }
            }
        }
    }

    times(2, g) {
        int v = vs[g];

        for(int i : loops) {
            int v0 = v;
            set<int> si = {v0};
            for(int j : children[i]) si.insert(val[j]);
            upto(0, si.size(), w) {
                if(si.find(w) == si.end()) {
                    v = w;
                    break;
                }
            }
            if(debug) cout << v sp;
        }

        if(v == vs[g]) {
            cout << "POSSIBLE";
            return 0;
        }
    }

    cout << "IMPOSSIBLE";

    return 0;
}


Measured memory_bytes: 29304
import numpy as np
n, k, q = map(int, input().split())
points = np.full(n, k)
z = np.full(n, 0)
points = points - q
for i in range(q):
    a = int(input())
    z[a - 1] += 1
points = points + z
for point in points:
    if point > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 20632
import math
from collections import deque
from collections import defaultdict
import itertools as it

#自作関数群
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()
def factorization(n):
  res = []
  if n%2==0:
    res.append(2)
  for i in range(3,math.floor(n//2)+1,2):
    if n%i==0:
      c = 0
      for j in res:
        if i%j==0:
          c=1
      if c==0:
        res.append(i)
  if len(res)==0:
    res = [n]
  return res
def fact2(n):
  p = factorization(n)
  res = []
  for i in p:
    c=0
    z=n
    while 1:
      if z%i==0:
        c+=1
        z/=i
      else:
        break
    res.append([i,c])
  return res
def fact(n):#階乗
  ans = 1
  m=n
  for _i in range(n-1):
    ans*=m
    m-=1
  return ans
def comb(n,r):#コンビネーション
  if n<r:
    return 0
  l = min(r,n-r)
  m=n
  u=1
  for _i in range(l):
    u*=m
    m-=1
  return u//fact(l)
def combmod(n,r,mod):
  return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
  r=copyQueue(q)
  ans=[0]*r.qsize()
  for i in range(r.qsize()-1,-1,-1):
    ans[i] = r.get()
  print(ans)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1]*n

  def find(self, x): # root
    if self.parents[x]<0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)

    if x==y:
      return

    if self.parents[x]>self.parents[y]:
      x,y = y,x

    self.parents[x]+=self.parents[y]
    self.parents[y]=x

  def size(self,x):
    return -1*self.parents[self.find(x)]

  def same(self,x,y):
    return self.find(x)==self.find(y)

  def members(self,x): # much time
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i)==root]

  def roots(self):
    return [i for i,x in enumerate(self.parents) if x<0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
  x = 1
  zero = "0"*n
  ans = []
  ans.append([0]*n)
  for i in range(2**n-1):
    ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
    x+=1
  return ans;
def arrsSum(a1,a2):
  for i in range(len(a1)):
    a1[i]+=a2[i]
  return a1
def maxValue(a,b,v):
  v2 = v
  for i in range(v2,-1,-1):
    for j in range(v2//a+1): #j:aの個数
      k = i-a*j
      if k%b==0:
        return i
  return -1
def copyQueue(q):
  nq = queue.Queue()
  n = q.qsize()
  for i in range(n):
    x = q.get()
    q.put(x)
    nq.put(x)
  return nq
def get_sieve_of_eratosthenes(n):
  data = [2]
  #data = [0,0,0]
  for i in range(3,n+1,2):
    data.append(i)
    data.append(0)
  for i in range(len(data)):
    interval = data[i]
    if interval!=0:
      for j in range(i+interval,n-1,interval):
        data[j] = 0
  ans = [x for x in data if x!=0]
  #ans = data[:]
  return ans


a,b = readInts()

#print(a+b)
print(a*b)

Measured memory_bytes: 9604
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let h: usize = read();
    let w: usize = read();

    println!("{}", (n-h+1) * (n-w+1));
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

int main() {
    
    long long x,k,d;
    cin >> x >> k >> d;
    
    x = abs(x);
    long long dv = x / d;

    x -= min(dv,k) * d;
    k -= min(dv,k);

    if(k) {
        if(k % 2 == 0) cout << x << "\n";
        else cout << min(abs(x - d), abs(x + d)) << "\n";
    } else cout << x << "\n";
    return 0;
}


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

bool isOK(int N){
    for (int c7 = 0; c7 <= N; c7 += 7){
        if (((N - c7) % 4) == 0) return true;
    }
    return false;
}

int main(){
    int N;
    cin >> N;
    if (isOK(N)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A,B=map(int,input().split())
*P,=map(int,input().split())

count=[0]*3
for i in range(N):
  if P[i]<=A:
    count[0] += 1
  if A<P[i]<=B:
    count[1] += 1
  if B<P[i]:
    count[2] += 1
    
print(min(count))

Measured memory_bytes: 9064
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
#include<cmath>
#define dot complex<double>
using namespace std;
int main(){
  int n;
  while(cin >>n,n){
    vector<dot > num;
    for(int i=0; i<n; i++){
      double a,b;
      cin >>a>>b;
      num.push_back(dot(a,b));
    }
    int ans = 1;
    for(int i=0; i<n; i++){
      for(int j=i+1; j<n; j++){
	dot v = num[j]-num[i],o;
	if(abs(v) >= 2) continue;
	v/=2;
	int f = 0;
	double r = sqrt(1-abs(v)*abs(v))/abs(v);
	o = num[i]+v+dot(v.imag(),-v.real())*r;
	for(int k=0; k<n; k++){
	  dot vv = num[k]-o;
	  if(abs(vv)<1) f++;
	}
	ans = max(ans,f);
	f = 0;
	o = num[i]+v-dot(v.imag(),-v.real())*r;
	for(int k=0; k<n; k++){
	  dot vv = num[k]-o;
	  if(abs(vv)<=1.00000001) f++;
	}
	ans = max(ans,f);
      }
    }
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1272
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
cnt = 1
ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        cnt += 1
    else:
        if cnt %2: ans+= 1
        cnt = 1
print(ans+cnt%2)


Measured memory_bytes: 50264
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] dislike = new int[K];
		int answer = 0;

		for (int i = 0; i < K; i++) {
			dislike[i] = sc.nextInt();
		}

		boolean flg = true;
		for (int i = N; i <= 10 * N; i++) {
			flg = true;
			for (int j = 0; j < K; j++) {
				if (String.valueOf(i).contains(String.valueOf(dislike[j]))) {
					flg = false;
				}
				if (j == K - 1 && flg) {
					answer = i;
				}
			}
			if (answer != 0) break;
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 56252
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <unordered_map> 
#include<list>

using namespace std;

int main(void) {

	int N, T;

	cin >> N >> T;

	vector<int> costs(N);

	for (int i = 0; i < N; i++) {

		int c_tmp, t_tmp;

		cin >> c_tmp >> t_tmp;

		if (t_tmp > T) {
			costs[i] = 1e4;
		}
		else {
			costs[i] = c_tmp;
		}
	}

	int c_min, num;
	c_min = 1e6;
	num = 0;


	for (int i = 0; i < N; i++) {
	
		if (costs[i] <= c_min) {
			c_min = costs[i];
			num = i;
		}
	}

	if (c_min > 1e3) {
		cout << "TLE";
	}
	else {
		cout << c_min;
	}

	return 0;
}

Measured memory_bytes: 256