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

int main()
{
  int s, m, now;
  cin >> s;
  vector<int> ch(1000001);
  ch.at(s)++;
  now = s;
  for(m = 1; m < 1000001; m++)
  {
    if(now%2==0)
    {
      now /= 2;
    }
    else
    {
      now *= 3;
      now++;
    }
    ch.at(now)++;
    if(ch.at(now) >= 2)
    {
      break;
    }
  }
  cout << m+1 << endl;
}

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

int main(void){
    int K,S;
    cin >> K >> S;
    int counter = 0;
    for(int i = 0 ; i <= K ; i++){
        for(int j = 0 ; j <= K ; j++){
            for(int k = 0; k <= K ; k++){
                if(S == i + j + k){
                    counter++;
                }
            }
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};


int main()
{
    vector <int> vec(3);
    for(int i = 0; i < 3; i++) cin >> vec[i];
    sort(vec.begin(), vec.end());
    
    cout << (vec[2] - vec[0]) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f1(a,b,c) for(int c=a;c<=b;c++)
#define f2(a,b,c) for(int c=a;c>=b;c--)
#define f3(a,b,c) for(int c=a;c;c=b)
#define so1(a,n) sort(a+1,a+n+1,mycmp);
#define so2(a,n) sort(a+1,a+n+1);
#define re(a,n) reverse(a+1,a+n+1);
#define ll long long
#define itn int
#define ubt int 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
const int twx=2e3+100;
const int inf=0x3f3f3f3f;
ll read()
{
    ll sum=0;
    ll flag=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            flag=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        sum=((sum*10)+c-'0');
        c=getchar();
    }
    return sum*flag;
}
int n,k;
struct LV
{
    int y;
    int Next;
}a[twx<<1];
int X[twx];
int Y[twx];
int Link[twx];
int len;
int cnt;
int ans=inf;
/*
一个显然的结论：
对于一个直径长度为K的树
若K为偶数，那么一定存在一个点，使得每个点到那个点的距离不超过K/2
若K为奇数，那么一定存在一个点，使得每个点到那个点的距离不超过(k-1)/2
*/
void Insert(int x,int y)
{
    a[++len].y=y;
    a[len].Next=Link[x];
    Link[x]=len;
}
void dfs(int x,int fa,int deep)
{
    if(deep>k)
    {
        cnt++;
    }
    f3(Link[x],a[i].Next,i)
    {
        int y=a[i].y;
        if(y!=fa)
        {
            dfs(y,x,deep+1);
        }
    }
}
void init()
{
	n=read();
    k=read();
    f1(1,n-1,i)
    {
        int x=read();
        int y=read();
        X[i]=x;
        Y[i]=y;
        Insert(x,y);
        Insert(y,x);
    }
}
void work()
{
	if(!(k&1))//k为偶数时
	{
		k>>=1;
	    f1(1,n-1,i)
	    {
	        cnt=0;
	        dfs(i,0,0);
	        ans=min(ans,cnt);
	    }
	}
	else//k为奇数时
	{
		k>>=1;
		f1(1,n-1,i)
		{
			cnt=0;
            dfs(X[i],Y[i],0);
            dfs(Y[i],X[i],0);
            ans=min(ans,cnt);
		}
	}
}
void print()
{
	cout<<ans;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	init();
	work();
	print();
	return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int N, S, A[3003];
lint dp[3003][3003];
const lint MOD = 998244353;

void modAdd(lint& a, lint b) {
    a = (a + b) % MOD;
}

lint modMul(lint a, lint b) {
    return (a * b) % MOD;
}

int main() {
    cin >> N >> S;
    for_(i,0,N) cin >> A[i];

    INIT(dp, 0);
    dp[0][0] = 1;

    for_(i,0,N) {
        for_(j,0,S+1) {
            modAdd(dp[i + 1][j], modMul(2, dp[i][j]));
            int k = j - A[i];
            if (k >= 0) modAdd(dp[i + 1][j], dp[i][k]);
        }
    }

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

Measured memory_bytes: 74092
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    LP a[n];
    LP b[2500];
    rep(i, n) cin >> a[i].first >> a[i].second;
    ll int g = 0;
    rep(i, n){
        rep(j, n){
            if(i !=j){
                b[g].first = a[i].first - a[j].first;
                b[g].second = a[i].second - a[j].second;
                g ++;
            }
        }
    }
    ll int max1 = 0;
    int aa[g];
    rep(i, g) aa[i] = 1;
    rep(i, g){
        //cout << b[i].first <<" " << b[i].second << endl;
        rep(j, g){
            if(i != j){

                if(b[i].first == b[j].first && b[i].second == b[j].second) aa[i] ++;
            }
        }
    }
    //rep(i, n) cout << aa[i] << endl;
    sort(aa, aa + g);
    reverse(aa, aa + g);

    //rep(i, n) cout << aa[i] << endl;
    if(n == 1) cout << 1 << endl;
    else if(aa[0] == 0) cout << n - 1 << endl;
    else cout << n - (aa[0])<< endl;


}

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

using namespace std;

typedef long long ll;

int main() {
	int n,m;
	cin >> n >> m;
	int max_l = 1;
	int min_r = n;
	
	for(int i=0; i < m; i++) {
		int l,r;
		cin >> l >> r;
		max_l = max(max_l, l);
		min_r = min(min_r, r);
	}
	
	if(max_l <= min_r) cout << (min_r - max_l) + 1;
	else cout << 0;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int n, i, j, k, ct;
	cin >> n;
	vector<int> a(n + 1);
	for (i = 1; i <= n; i++) cin >> a[i];
	ct = 0;
	for (i = 1; i <= n; i++) {
		if (a[a[i]] == i) ct++;
	}
	cout << ct / 2 << "\n";

	return 0;
}



Measured memory_bytes: 640
#include <cstdio>

struct node {
  int key;
  node *left, *right;
  node(int key) : key(key), left(nullptr), right(nullptr) {}
  ~node() {
    delete left;
    delete right;
  }
};

enum order {
  pre,
  in
};

void rec(node *t, order o) {
  if (!t)
    return;
  if (o == pre)
    printf(" %d", t->key);
  rec(t->left, o);
  if (o == in)
    printf(" %d", t->key);
  rec(t->right, o);
}

int main() {
  node *T(nullptr);
  size_t m;
  scanf("%zu\n", &m);
  for (size_t i = 0; i < m; i++) {
    char s[8];
    scanf("%s", s);
    switch (s[0]) {
      case 'i':
        {
          int k;
          scanf("%d", &k);
          node *x = T, *y = nullptr, *z = new node(k);
          while (x) {
            y = x;
            x = z->key < y->key ? y->left : y->right;
          }
          (y ? z->key < y->key ? y->left : y->right : T) = z;
        }
        break;
      case 'f':
        {
          int k;
          scanf("%d", &k);
          bool found = false;
          for (auto x = T; x; x = k < x->key ? x->left : x->right)
            if (x->key == k) {
              found = true;
              break;
            }
          puts(found ? "yes" : "no");
        }
        break;
      default:
        rec(T, in);
        puts("");
        rec(T, pre);
        puts("");
        break;
    }
  }
  delete T;
  return 0;
}

Measured memory_bytes: 15064
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

const ll inf=998244353;

inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
ll num[3005][3005];
ll f[3005][3005][5];
int main()
{
    ll r,c,k;
    cin>>r>>c>>k;
    for(int i=0;i<k;i++)
    {
        ll a,b,v;
        a=read(),b=read(),v=read();
        num[a][b]=v;
    }
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            f[i][j][0]=max(f[i][j][0],f[i][j-1][0]);
            f[i][j][0]=max(f[i][j][0],max(f[i-1][j][0],max(f[i-1][j][1],max(f[i-1][j][2],f[i-1][j][3]))));
            f[i][j][1]=max(f[i][j][1],f[i][j-1][0]+num[i][j]);
            f[i][j][1]=max(f[i][j][1],f[i][j-1][1]);
            f[i][j][1]=max(f[i][j][1],max(f[i-1][j][0],max(f[i-1][j][1],max(f[i-1][j][2],f[i-1][j][3])))+num[i][j]);
            f[i][j][2]=max(f[i][j][2],f[i][j-1][1]+num[i][j]);
            f[i][j][2]=max(f[i][j][2],f[i][j-1][2]);
            f[i][j][3]=max(f[i][j][3],f[i][j-1][2]+num[i][j]);
            f[i][j][3]=max(f[i][j][3],f[i][j-1][3]);
        }
    }
    cout << max(f[r][c][0],max(f[r][c][1],max(f[r][c][2],f[r][c][3])));
    return 0;
}


Measured memory_bytes: 425840
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
// #define mod 1000000007
// #define mod 163577857 
#define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

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

void solve()            
{
    double a , b;
    cin >> a >> b;
    int x = (int)(a*b);
    cout << x;
}

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

void print_vec(vector<int> vec)
{
  cout << "[";
  for (int i = 0; i < vec.size(); i++)
  {
    cout << vec.at(i) << ", ";
  }
  cout << "]" << endl;
}

int main()
{
  int x;
  cin >> x;
  cout << x * x * x << endl;
}



Measured memory_bytes: 3096
S = list(input())
ans = [""]*9
for bit in range(1<<3):
  a = int(S[0])
  ans = [None]*9
  ans[0]=S[0]
  ans[2]=S[1]
  ans[4]=S[2]
  ans[6]=S[3]
  ans[8]="7"
  ans[7]="="
  for k in range(3):
    if bit&(1<<k):
      a+=int(S[k+1])
      if k==0:
      	ans[1]="+"
      elif k==1:
        ans[3]="+"
      else:
        ans[5]="+"
    else:
      a-=int(S[k+1])
      if k==0:
      	ans[1]="-"
      elif k==1:
        ans[3]="-"
      else:
        ans[5]="-"
  if a==7:
    print("".join(ans))
    exit()

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

namespace AtCoder.Question
{
    public class QuestionC
    {
        public static void Main(string[] args)
        {
            var (x, n) = ReadHelper.ReadValue<int, int>();
            var p = ReadHelper.ReadValues<int>().ToHashSet();
            for (int i = 0; i < int.MaxValue; i++)
            {
                if (!p.Contains(x - i))
                {
                    Console.WriteLine(x - i);
                    break;
                }
                if (!p.Contains(x + i))
                {
                    Console.WriteLine(x + i);
                    break;
                }
            }
        }

        static class ReadHelper
        {
            internal static T ReadValue<T>()
            {
                return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
            }
            internal static (T1, T2) ReadValue<T1, T2>()
            {
                var input = Console.ReadLine().Split(' ');
                return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)));
            }
            internal static (T1, T2, T3) ReadValue<T1, T2, T3>()
            {
                var input = Console.ReadLine().Split(' ');
                return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)));
            }
            internal static (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>()
            {
                var input = Console.ReadLine().Split(' ');
                return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)), (T4)Convert.ChangeType(input[3], typeof(T4)));
            }
            internal static T[] ReadValues<T>()
            {
                var input = Console.ReadLine().Split(' ');
                if (input.Length == 1 && String.IsNullOrEmpty(input[0]))
                {
                    return new T[0];
                }
                return input.Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
            }
        }

        static class MathAlgorithm
        {
            internal static bool IsPrime(long n)
            {
                if (n == 2) return true;
                if (n < 2 || n % 2 == 0) return false;
                var sqrt = Math.Sqrt(n);
                for (int i = 3; i <= sqrt; i += 2) if (n % i == 0) return false;
                return true;
            }
            internal static IEnumerable<long> EnumeratePrimes(long n)
            {
                var i = 2L;
                while (i * i <= n)
                {
                    if (n % i == 0)
                    {
                        n /= i;
                        yield return i;
                    }
                    else
                    {
                        i += i == 2 ? 1 : 2;
                    }
                }
                if (n != 1) yield return n;
            }
        }
    }
}


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

int main()
{
    int n,k;
    cin>>n>>k;
    vector<pair<int,int> >v;
    for(int i=0;i<k;i++)
    {
        int a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(),v.end());
    int maxa=v[k-1].first;
    long long dp[n+maxa+5];
    memset(dp,0,sizeof dp);

    for(int i=1;i<=n+maxa;i++)
    {
        for(int j=0;j<k;j++)
        {
            long long a=v[j].first;
            long long b=v[j].second;
            if(i-a>=0)
            {
                if(dp[i]==0)dp[i]=dp[i-a]+b;
                else dp[i]=min(dp[i-a]+b,dp[i]);
            }
            else
            {
                if(dp[i]==0)dp[i]=b;
                else dp[i]=min(dp[i],b);
            }
        }
    }
    long long ans=1e9+5;
    for(int i=n;i<=n+maxa;i++)ans=min(ans,dp[i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 384
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[int(input())-1])


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    vector<int> alphabet(26);

    for(int in=0;in<s.size();in++) {
        if(alphabet.at(s.at(in)-'a')==0) alphabet.at(s.at(in)-'a') = 1;
    }

    for(int iab=0;iab<26;iab++) {
        if(alphabet.at(iab)==0) {
            char c = 'a'+iab; 
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


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

using namespace std;

const int N = 2000;

int used[N];

int main(){
	int n = 1407;
	int k = 38;
	// int n, k;
	// cin >> n >> k;
	cout << n << ' ' << k << endl;
	for(int i = 0; i < k; ++i){
		printf("1");
		used[1] += 1;
		for(int j = 2; j <= k; ++j){
			printf(" %d", j + i * (k - 1));
			used[j + i * (k - 1)] += 1;
		}
		printf("\n");
	}
	for(int i = 2; i <= k; ++i){
		printf("2");
		used[2] += 1;
		for(int j = 1; j < k; ++j){
			printf(" %d", i + j * (k - 1));
			used[i + j * (k - 1)] += 1;
		}
		printf("\n");
	}
	for(int i = 3; i <= k; ++i){
		int add = (i - 2);
		memset(used, 0, sizeof(used));
		for(int j = 0; j + 1 < k; ++j){
			printf("%d", i);
			used[i] += 1;
			int cur = j;
			for(int r = 2; r <= k; ++r){
				printf(" %d", r + (cur + 1) * (k - 1));
				assert(!used[r + (cur + 1) * (k - 1)]);
				used[r + (cur + 1) * (k - 1)] += 1;
				cur += add;
				cur %= (k - 1);
			}
			printf("\n");
		}
	}
//	for(int i = 1; i <= n; ++i) assert(used[i] == k);
	return 0;
}


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

int main() {
  char a,b;
  cin>>a>>b;
  if(a==b){
    cout<<'='<<endl;
  }
  else if(a>b){
    cout<<'>'<<endl;
  }
  else{
    cout<<'<'<<endl;
  }
  cout<<endl;
}

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

using namespace std;

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

    int n, m;
    cin >> n >> m;
    int x;
    vector <int> a;
    for (int i = 0; i < m; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    bool test = true;
    for (int  i = 0; i < m; i++)
    {
        n -= a[i];
        if (n < 0)
        {
            test = false;
            break;
        }
        
    }
    if (test)
    {
        cout << n;  
    }
    else
    {
        cout << -1;
    }
    
    
    
}

Measured memory_bytes: 3764
#include<iostream>
#include<map>
using namespace std;
int main(){
    int N, M;
    int ans = 0;
    cin >> N;
    string s[N];
    for(int i = 0; i < N; i++) cin >> s[i];
    cin >> M;
    string t[M];
    for(int i = 0; i < M; i++) cin >> t[i];

    map<string, int> money;
    for(int i = 0; i < N; i++) money[s[i]];
    for(int i = 0; i < M; i++) money[t[i]];

    for(auto p : money){
        auto k = p.first;
        for(int i = 0; i < N; i++){
            if(k == s[i]) money[k]++;
        }
        for(int i = 0; i < M; i++){
            if(k == t[i]) money[k]--;
        }
    }
    for(auto p : money){
        auto v = p.second;
        if(v > ans) ans = v;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.Scanner;

//Cutting Down Water Bills
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int w = sc.nextInt();
			if(w==-1)break;
			int s = 1150;
			if(w>10)s+=Math.min((w-10)*125, 1250);
			if(w>20)s+=Math.min((w-20)*140, 1400);
			if(w>30)s+=(w-30)*160;
			System.out.println(4280-s);
		}
	}
}

Measured memory_bytes: 12000
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#include<map>
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=100010;
int n;
map<int,int>M;
int main() {
	n=read();
	rep(i,1,n) {
		int x=read();
		M[x]++;
	}
	int ans=0;
	for(map<int,int>::iterator it=M.begin();it!=M.end();it++) {
		int x=it->first,y=it->second;
		if(y<x) ans+=y;
		else ans+=min(y,y-x);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4736
#include<stdio.h>
#include<ctype.h>

int main(){

  char s[100], p[100];
  int i, j, k, zisuus, zisuup, hantei;
  
  
  scanf("%s", s);
  scanf("%s", p);
  
  zisuus = 0;
  while(s[zisuus]){
    zisuus++;
  }
  
  zisuup = 0;
  while(p[zisuup]){
    zisuup++;
  }
  
  for(i = 0; i < zisuus; i++){
/* i???s[]????§????????????? */
    hantei = 0;
    k = i;    
    for(j = 0; j < zisuup; j++){
/* p???????????°?????????????????? */
      if(s[k] == p[hantei]){
        hantei++;
        if(hantei == zisuup){ /*break????????£??????*/
          printf("Yes\n");
          i = i + zisuus;
          j = j + zisuus;
        }
      }
      k++;
      if( k == zisuus ){
        k = 0;
      }
    }
  }
  
  if(hantei != zisuup){
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#include <map>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef pair< int , pair<int, int> > pip;
typedef unsigned long long ull;
const double EPS = 10e-6;
const int MMM=1000000007;
ull gcd(ull m,ull n)
{
	if(m<n)swap(m,n);
	if(n==0)return m;
	return gcd(n,m%n);
}
ull lcm(ull m,ull n)
{
	return m*n/gcd(m,n);
}

bool a[50000000]={};
int main()
{
	ull n,ans=n,ori;
	cin>>n;
	ans=n;
	ori=n;
	a[0]=a[1]=true;
	for(ull i=1;i<50000000;i++)
	{
		if(a[i]==false)
		{
			for(ull l=i+i;l<50000000;l+=i)a[l]=true;
		}
	}
	for(ull i=1;i<50000000;i++)
	{
		if(a[i]==false&&ori%i==0)
		{
			ans*=i-1;
			ans/=i;
			n/=i;
		}
	}
	if(n==ori)ans=n-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 49984
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    string S; cin >> S;
    int K; cin >> K;

    string ans = "";
    char ch = S[K - 1];
    for(char c : S){
        if (c != ch) ans += "*";
        else ans += c;
    }
  
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define MAXCHAR 255

using namespace std;

int main()
{
	string input;
	cin >> input;
	if (input[1] == 'B')
	{
		input[1] = 'R';
	}
	else
	{
		input[1] = 'B';
	}
	cout << input << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using vc=vector<char>;
using vvc=vector<vc>;
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using tiii = tuple<int,int,int>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vi a(N);
  rep(i,N) cin >> a[i];
  
  int ans=0;
  rep(i,N) {
    if((!(i%2))&&(a[i]%2)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3556
s = input()
s2 = []
for i in range(len(s)):
    if s[i] != 'x':
        s2.append(s[i])
if s2 != s2[::-1]:
    print(-1)
    exit()
lis = []
j = 0
cnt = 0
for i in range(len(s)):
    if s[i] == 'x':
        cnt += 1
    else:
        lis.append(cnt)
        cnt = 0

lis.append(cnt)
ans = 0
for i in range(len(lis)//2):
    ans += abs(lis[i]-lis[-(i+1)])
print(ans)


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


int main() {
    int n, nd;
    cin >> n;
    nd = n;
    int sum = 0, i = 0;
    while(n){
        int curr = n%10;
        sum += curr;
        i++;
        n = n/10;
    }
    // cout<<sum<<endl;
    if(nd%sum == 0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    
	return 0;
}






Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

#pragma gcc target ("avx2")
#pragma gcc optimization ("o3")
#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}
#define nopf(T) [](T a){return a;}
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	string s;
	scans(s);
	bool b = true;
	rep(i, s.length()) {
		if (!(s[i] == 'h' && s[i + 1] == 'i'))b = false;
		++i;
	}
	printyn(b);

	Please AC;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
long extgcd( long a)
{
  //拡張ユークリッドの互除法でaのmod b(prime)での逆元をもとめる
  long b = (long)1E9+7;
  long u, v, q, tmp; 
  long x = 1;
  long y = 0; u = 0; v = 1;
  while ( b > 0 ) {
    q = a / b; 
    tmp = u; u = x - q * u; x = tmp;
    tmp = v; v = y - q * v; y = tmp;
    tmp = b; b = a - q * b; a = tmp;
  }
  x %= (long int)1E9+7;
  while (x<0)
    x+=(long)1E9+7;
  return x;
}
long comb(long n,long k)
{
	long t = 1;
	long j = k;
	for(long i = n; i  >= n-k+1; i--) {
		t *= i;
		t %= (long)1E9+7;
		t *= extgcd(j);
		j--;
		t %= (long)1E9+7;
	}
	return t;
}
int main()
{
	long H,W,a,b;
	cin >> H >> W >> a >> b;
	long count = 0;
	long t = comb(b+H-a-1,b);
	long t2 = comb(W-b-1+a-1,W-b-1);
	long tmp;
    for(int i = b + 1; i <= W; i++) {
		if(i!=b+1) {
    	t *= i-1+H-a-1;
      	t %= (long)1E9+7;
		t *= extgcd(i-1);
      	t %= (long)1E9+7;
		
		t2 *= W-i+1;
		t2 %= (long)1E9+7;
		t2 *= extgcd(W-i+a);
      	t2 %= (long)1E9+7;
        }
		tmp = t* t2;
      	tmp %= (long)1E9+7;
		count += tmp;
		count %= (long)1E9+7;
	}
	cout << count << endl;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, k;
    vector<double> p(n + 1);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        double x;
        cin >> x;
        double cur = (x + 1) * x * 1.0 / (2 * x);
        //DBG(cur);
        p[i] = cur;
    }
    double ans = 0;
    for (int i = 2; i <= n; i++)
    {
        p[i] += p[i - 1];
        //DBG(p[i]);
    }
    p[0] = 0;
    for (int i = k; i <= n; i++)
    {
        ans = max(ans, p[i] - p[i - k]);
        //DBG(ans);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 33024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;

// Modint
struct Mint {
	static const ll mod = (ll)(1e9 + 7);
	ll val;

	Mint() { val = 0; }
	Mint(ll a) {
		val = a;
		verify_value();
	}

	void verify_value() {
		if (val >= mod) val %= mod;
		if (val < 0) val %= mod, val += mod;
	}

	Mint pow(ll p) const {
		Mint cur = Mint(val), ret = 1;
		while (p > 0) {
			if (p & 1) ret *= cur;
			cur *= cur;
			p >>= 1LL;
		}
		return ret;
	}
	Mint inv() const {
		if (val == 0) cerr << "CAUTION: inv() is called with 0." << endl;
		return pow(mod - 2);
	}

	Mint operator+() const { return *this; }
	Mint operator-() const { return Mint(mod - val); }

	Mint operator+=(const Mint &a) {
		val += a.val;
		if (val >= mod) val -= mod;
		return Mint(val);
	}
	Mint operator*=(const Mint &a) {
		val *= a.val;
		if (val >= mod) val %= mod;
		return Mint(val);
	}
	Mint operator-=(const Mint &a) { return *this += -a; }
	Mint operator/=(const Mint &a) { return *this *= a.inv(); }

	Mint operator++() { return *this += Mint(1); }
	Mint operator--() { return *this -= Mint(1); }
	Mint operator++(int) {
		Mint ret = *this;
		++(*this);
		return ret;
	}
	Mint operator--(int) {
		Mint ret = *this;
		--(*this);
		return ret;
	}

	operator ll() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
	ll ret = a.val + b.val;
	if (ret >= Mint::mod) ret -= Mint::mod;
	return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
	ll ret = a.val * b.val;
	if (ret >= Mint::mod) ret %= Mint::mod;
	return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

ostream &operator<<(ostream &out, const Mint &a) { return out << a.val; }
istream &operator>>(istream &in, Mint &a) {
	in >> a.val;
	a.verify_value();
	return in;
}

int main() {
	string s; cin >> s;
	int n = s.size();
	vector<Mint> a(n + 2), c(n + 2), q(n + 2);
	for (int i = 0; i < n; i++) {
		a[i + 1] = a[i].val + (s[i] == 'A');
		c[i + 1] = c[i].val + (s[i] == 'C');
		q[i + 1] = q[i].val + (s[i] == '?');
	}
	Mint ans = 0, iv3 = Mint(1)/Mint(3);
	for (int i = 1; i < n - 1; i++) {
		if (s[i] != 'B' && s[i] != '?') continue;
		ans += (s[i] == 'B' ? Mint(1) : iv3)*(a[i] + iv3*q[i])*(c[n] - c[i + 1] + iv3*(q[n] - q[i + 1]));
	}
	ans *= Mint(3).pow(q[n]);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 2816
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cost=min(a)+min(b)
for i in range(M):
    x,y,c=map(int,input().split())
    cost=min(cost,a[x-1]+b[y-1]-c)
print(cost)

Measured memory_bytes: 18612
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations
from itertools import accumulate
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

h,w,n=map(int,input().split())
src=list(map(int,input().split()))
s=input()
t=input()
lrud=["L","U","D","R"]
dic={"L":[0,-1],"R":[0,1],"U":[-1,0],"D":[1,0]}
for i in range(4):
    tmp=src[:]
    # print(lrud[i],lrud[-1-i])
    for j in range(n):
        if s[j]==lrud[i]:
            tmp[0]+=dic[s[j]][0]
            tmp[1]+=dic[s[j]][1]
        if lrud[i]=="L" and tmp[1]==0:
            print("NO")
            quit()
        if lrud[i]=="R" and tmp[1]==w+1:
            print("NO")
            quit()
        if lrud[i]=="U" and tmp[0]==0:
            print("NO")
            quit()
        if lrud[i]=="D" and tmp[0]==h+1:
            print("NO")
            quit()
        # print(tmp)
        if t[j]==lrud[-1-i]:
            if 0<tmp[0]+dic[t[j]][0]<=h:
                tmp[0]+=dic[t[j]][0]
            if 0<tmp[1]+dic[t[j]][1]<=w:
                tmp[1]+=dic[t[j]][1]
else:
    print("YES")

Measured memory_bytes: 74096
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()

	var re float64
	nn := float64(n)
	for i := 1; i <= n; i++ {
		if i >= k {
			re += 1 / nn
			continue
		}

		x := math.Ceil(math.Log2(float64(k) / float64(i)))
		re += (1 / nn) * (1 / math.Pow(2, x))
	}

	fmt.Printf("%.15f\n", re)
}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int N;
int x;
int a[110];
int ans;
int main() {
    cin>>N>>x;
    REP(i,0,N){
        cin>>a[i];
    }
    sort(a,a+N);
    REP(i,0,N){
        if(x<a[i]) break;
        ans++;
        x-=a[i];
    }
    if(x>0&&ans==N) ans--;
    p(ans);
    return 0;
}

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

int gcd(int x, int y) {
    int t = x%y;

    if(x == -1)
        return y;

    if(x < y)
        swap(x, y);
    
    while(t != 0) {
        t = x % y;
        x = y;
        if(t != 0)
            y = t;
    }

    return y;
}

int main() {
    int N,X,i,r=-1,t;
    cin >> N >> X;

    for(i=0; i<N; i++) {
        cin >> t;
        r = gcd(r,abs(t-X));
    }

    cout << r << endl;
}

Measured memory_bytes: 256
k = gets.to_i
d = k % 10
if d % 2 == 0 || d == 5
  puts -1
  exit
end

table = {
  1 => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
  3 => [0, 7, 4, 1, 8, 5, 2, 9, 6, 3],
  7 => [0, 3, 6, 9, 2, 5, 8, 1, 4, 7],
  9 => [0, 9, 8, 7, 6, 5, 4, 3, 2, 1],
}

num = 7
cnt = 1
i = 0
while true do
  m = table[d][num % 10]
  p = k * m
  while num < p do
    num += 7 * 10 ** (cnt - i)
    cnt += 1
  end
  num -= p
  raise 'oops' unless num % 10 == 0
  num /= 10
  break if num == 0
  i += 1
end
puts cnt


Measured memory_bytes: 14340
/*-----------------------------------------------,
|  __                                       __   |
| |  |--.-----.---.-.----.----.-----.-----.|  |_ |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _||
| |_____|_____|___._|____|____|_____|   __||____||
|                                   |__|         |
`-----------------------------------------------*/
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long lint; typedef long double ldouble ;using namespace std;
#define INF 1000000000000
#define MOD 10000007
#define rep(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){cin.tie(0);ios::sync_with_stdio(0); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int n,m,x;
  cin>>n>>m>>x;
  vector<int> a(m);
  rep(i,m)cin>>a[i];
  int ans=MOD;
  int sum=0;
  rep(i,m){
    if(a[i] < x)sum++;
  }
  ans=min(ans,sum);
  sum=0;
  rep(i,m){
    if(a[i] > x)sum++;
  }
  ans=min(ans,sum);
  cout<<ans<<endl;


}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int a[210][210];
int b[210];
const int MAX=1e9;
int main()
{
    int n,m,t;
    cin>>n>>m>>t;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        a[i][j]=MAX;
    for(int i=1;i<=t;i++)
        cin>>b[i];
    int x,y,s;
    while(m--)
    {
        cin>>x>>y>>s;
        if(a[x][y]>s)
        {
            a[x][y]=s;
            a[y][x]=s;
        }
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            for(int k=1;k<=n;k++)
                a[j][k]=min(a[j][k],a[j][i]+a[i][k]);
    sort(b+1,b+1+t);
    int min1=1e9;
    do {
		int s = 0;
		for (int i = 1; i < t; i++)
            s += a[b[i]][b[i + 1]];
		min1 = min(min1, s);
	} while (next_permutation(b+1, b + t+1));
	cout<<min1<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

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

    int a,b;
    cin>>a>>b;
    cout<<max(0,a-2*b)<<endl;

    return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


int main()
{
	ld a,b,h,m;
	cin>>a>>b>>h>>m;
	ld rh=pi/6,rm=2*pi,time=h+m/60,diff=(rm-rh)*time;
	cout<<setprecision(20)<<sqrt(a*a+b*b-2*a*b*cos(diff));
}

Measured memory_bytes: 15884
using System;

namespace AtCoder
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            if (n == m) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 11092
w = input()
t = []
tmp = input()
while tmp != "END_OF_TEXT":
    lst = tmp.split(' ')
    for i in range(len(lst)):
        t.append(lst[i])
    tmp = input()

ans = 0
for i in range(len(t)):
    count = 0
    if (len(t[i]) == len(w)):
        for j in range(len(w)):
            if (t[i][j] == w[j]):
                count += 1
            elif (ord(t[i][j]) + ord("a") - ord("A") == ord(w[j])):
                count += 1
        if count == len(w):
            ans += 1
print(ans)



Measured memory_bytes: 5568
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/10000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, m, x, y, z;
vector<int> vec[100010];
bool used[100010];
void dfs(int s) {
	used[s] = true;
	for (int i : vec[s]) {
		if (!used[i])dfs(i);
	}
}
signed main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> x >> y >> z;
		vec[x].push_back(y);
		vec[y].push_back(x);
	}
	int ans = 0;
	REP(i, n) {
		if (!used[i]) {
			ans++;
			dfs(i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
#include <unordered_map>
#include <queue>
#include <set>

using namespace std;

int main() {
    int N,K,i,a,b;
    vector<pair<long long , long long > > sushi;
    cin>>N>>K;
    for(i=0;i<N;i++){
        cin>>a>>b;
        sushi.push_back(make_pair(b,a));
    }
    int used[100001]={0,};
    long long ans=0,sushiCnt=0;
    priority_queue<pair<long long ,long long >, vector<pair<long long ,long long int> >, greater<pair<long long ,long long > > > pq;
    sort(sushi.rbegin(),sushi.rend());
    for(i=0;i<N;i++){
        if(used[sushi[i].second]==0){
            pq.push(make_pair(sushi[i].first,sushi[i].second));
            used[sushi[i].second]=1;
            sushi[i].first=-1;
            sushiCnt++;
        }
    }
    sort(sushi.rbegin(),sushi.rend());
    if(pq.size()>K){
        while(pq.size()!=K){
            pq.pop();
            sushiCnt--;
        }
    }
    for(i=0;i<N;i++){
        if(sushi[i].first==-1)continue;
        if(pq.size()<K){
            pq.push(make_pair(sushi[i].first,sushi[i].second));
            continue;
        }
        long long sushiPow1=sushiCnt*sushiCnt,sushiPow2=(sushiCnt-1)*(sushiCnt-1);
        if(pq.top().first+sushiPow1<sushi[i].first+sushiPow2){
            pq.pop();
            pq.push(make_pair(sushi[i].first,sushi[i].second));
            sushiCnt--;
        }
    }
    for(i=0;i<K;i++){
        ans+=pq.top().first;
        // cout<<"aa = "<<pq.top().first<<endl;
        pq.pop();
    }
    cout<<ans+(sushiCnt*sushiCnt);

    return 0;
}
// 5 3
// 1 9
// 1 7
// 2 6
// 2 5
// 3 1
// 1 2 3
// 9 6 1

Measured memory_bytes: 5232