akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int plun1 = n * a;
        int plun2 = b;
        System.out.println(Math.min(plun1,plun2));
    }
}


Measured memory_bytes: 35448
#include<iostream>
#include<vector>
typedef long long ll;
using namespace std;
int k;
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> vec(m);
	for (int i = 0; i < m; i++) {
		 cin >> k;
		vec[i].resize(k);
		for (int j = 0; j < k; j++) {
			cin >> vec[i][j];
			--vec[i][j];
		}
	}
	vector<int>p(m);
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}
	ll ans = 0;
	for (int bit = 0; bit < (1 << n); bit++) {
		bool ok = true;
		for (int j = 0; j < m; j++) {
			int count = 0;
			for (auto v : vec[j]) {
				if (bit & (1 << v)) {
					count++;
				}
			}
			if (count % 2 != p[j]) {
				ok = false;
			}

		}
			if (ok)ans++;
	}
	cout << ans << endl;
	return 0;
}

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

#define dfl(i,a,b)   for(int i=a;i>b;i--)
#define fl(i,a,b)    for(int i=a;i<b;i++)
#define ll           long long
#define ld           long double
#define endl         '\n'
#define pb           push_back
#define ff           first
#define ss           second
#define pii          pair<int,int>
#define pll          pair<ll,ll>
#define vi           vector<int>
#define vll          vector<long long>
#define all(x)       x.begin(),x.end()
#define mod          1000000007 
#define mx           1000005
#define mii          map<int,int>
#define mumii        multimap<int,int> 
#define mx2          65
#define inf          4e18
#define fast         ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define gt           greater<int>()
#define debug(x)     cout<<x<<endl;
#define scan(a,n)    fl(i,0,n)cin>>a[i];

//The ASCII value of the lowercase alphabet is from 97 to 122.
//The ASCII value of the uppercase alphabet is from 65 to 90.

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

void solve()
{
     int n;
     ll int ans=0;
     cin>>n;
     
     vi a(n);
     scan(a,n);
     
     
     fl(i,1,n)
     {
          if(a[i]<a[i-1])
          {
               ans+=(a[i-1]-a[i]);
               a[i]=a[i-1];
          }
          
     }
     
     cout<<ans;
}
int main()
{
	fast;
	int t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    // 各 B[i] について可能な C[i] の数
    int pos = 0;
    vector<int> cnum(N);
    for (int i = 0; i < N; i++) {
        while (B[i] >= C[pos] && pos < N) pos++;
        cnum[i] = N - pos;
    }

    // 可能な C[i] の数の累積和; 引数は可能な B[i] の数
    vector<ll> cnum_sum(N + 1); cnum_sum[0] = 0;
    for (int i = 1; i <= N; i++) {
        cnum_sum[i] = cnum_sum[i - 1] + cnum[N - i];
    }

    // 可能な B[i] の数を求めて足す
    ll ans = 0; pos = 0;
    for (int i = 0; i < N; i++) {
        while (A[i] >= B[pos] && pos < N) pos++;
        int bnum = N - pos;
        ans += (ll)cnum_sum[bnum];
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<cmath>
#include<climits>
#include<algorithm>
#include<string>
#include<math.h>
#include<iomanip>

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

	int len= s.size();

	long long ans=0;

	std::vector<long long> cumSum(len+1, 0);
	for(int i=1; i<len+1; i++)
		cumSum[i]= cumSum[i-1]+i;

	int leftTerm=0;
	int numLeft=0;
	int numRight=0;
	int rightTerm= len;

	for(int i=0; i<len; i++){
		if(s[i]=='<'){			
			ans+= cumSum[numLeft];
			break;
		}

		leftTerm++;
		numLeft++;
	}

	for(int i= len-1; i>0; i--){
		if(s[i]=='>'){			
			ans+= cumSum[numRight];
			break;
		}	

		rightTerm--;
		numRight++;
	}

	numRight=0; 
	numLeft=0;
	for(int i= leftTerm; i< rightTerm; i++){
		if(numRight==0 && s[i]=='<'){
			numLeft++;
		}else if(s[i]=='>'){
			numRight++;
		}else{
			ans+= cumSum[std::max(numRight, numLeft)];
			ans+= cumSum[std::min(numRight, numLeft)-1];
			numRight=0; 
			numLeft= 1;
		}
	}

	ans+= cumSum[std::max(numRight, numLeft)];
	ans+= cumSum[std::min(numRight, numLeft)-1];

	bool isAllSame= true;
	for(int i=1; i<len; i++)
		if(s[i]!=s[i-1])
			isAllSame= false;

	if(isAllSame)
		std::cout<<cumSum[len]<<std::endl;
	else
		std::cout<<ans<<std::endl;

	return 0;
}

Measured memory_bytes: 4740
#include <iostream>
#include <cmath>
#include <vector>
#include <set>

#define N 1000000

typedef long long ll;

using namespace std;

int prime[N + 1];
int D[N + 1];
int used[N + 1];

int main() {
    for (int i = 0; i <= N; ++i) {
        prime[i] = 1;
        D[i] = i;
        used[i] = 0;
    }
    prime[0] = prime[1] = 0;

    int p = 2;
    while (p < sqrt(N)) {
        for (int i = p * 2; i <= N; i += p) {
            prime[i] = 0;
            D[i] = p;
        }

        for (int i = p + 1; i <= N; ++i) {
            if (prime[i] == 1) {
                p = i;
                break;
            }
        }
    }

    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int A;
        cin >> A;

        set<int> s;
        while (A != D[A]) {
            s.insert(D[A]);
            A = A / D[A];
        }
        s.insert(A);
        for (auto it = s.begin(); it != s.end(); ++it) {
            ++used[*it];
        }
    }

    bool pairwise = true;
    bool setwise = true;

    for (int i = 2; i <= N; ++i) {
        if (used[i] >= 2) {
            pairwise = false;
        }
        if (used[i] >= n) {
            setwise = false;
        }
    }

    if (pairwise) {
        cout << "pairwise coprime" << endl;
    }
    else if (setwise) {
        cout << "setwise coprime" << endl;
    }
    else {
        cout << "not coprime" << endl;
    }

    return 0;
}

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

int main() {
  int n;
  std::cin >> n;
  std::vector<std::string> s(2);
  std::cin >> s[0] >> s[1];

  bool flag;
  int64_t ans = 1;
  int i = 0;
  if (s[0][i] != s[1][i]) {
    flag = false;
    ans *= 6;
    i += 2;
  } else {
    flag = true;
    ans *= 3;
    i += 1;
  }

  for (;i < n; i++) {
    if (s[0][i] != s[1][i]) {
      if (flag) {
        ans *= 2;
      } else {
        ans *= 3;
      }
      flag = false;
      i++;
    } else {
      if (flag) {
        ans *= 2;
      } else {
      }
      flag = true;
    }
    ans %= 1000000007;
  }

  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
# your code goes here
#times volume24 2424
Q=int(input())
for i in range(Q):
    N=str(input())
    c=0
    while len(N)>1 and c<15:
        M=0
        for j in range(1,len(N)):
    #        print(N[:j])
            l=int(N[:j])
            r=int(N[j:])
            l*=r
            if M<l:
                M=l
      #      print(M)
        N=str(M)
        c+=1
  #  print(N)
    if c>=15:
        d=[int(N)]
        while len(N)>1 and c>=0 and c<50:
            M=0
        #    print(d)
            for j in range(1,len(N)):
        #        print(N[:j])
                l=int(N[:j])
                r=int(N[j:])
                l*=r
                if M<l:
                    M=l
      #          print(M)
            k=0
            while k<len(d) and M>d[k]:
                k+=1
         #   print(k)
            if k>=len(d):
                k=-1
            elif M==d[k]:
                c=-1
            d.insert(k,M)
            N=str(M)
            c+=1
        #    print(k)
    print(c)

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  vll a(3); rep(i, 3) cin >> a[i];
  sort(all(a));
  fin(a[0]+a[1])
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;
	template<class T>using pair = std::pair<T, T>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<class Range>void sort(Range& rng)
	{
		std::sort(std::begin(rng), std::end(rng));
	}
	template<class Range, class Pred>void sort(Range& rng, Pred pred)
	{
		std::sort(std::begin(rng), std::end(rng), pred);
	}
}

class union_find
{
	mutable std::vector<std::optional<index_t>> parent;
	std::vector<index_t> rank, elem;
	std::set<index_t> tops;
	std::size_t sz;
public:
	union_find(std::size_t N) :parent(N), rank(N), elem(N, 1), tops(), sz(N)
	{
		for (index_t i = 0; i < N; ++i)
		{
			tops.emplace(i);
		}
	}
	index_t find(index_t a)const
	{
		if (!parent[a])
		{
			return a;
		}
		else
		{
			return *(parent[a] = find(*parent[a]));
		}
	}
	void merge(index_t a, index_t b)
	{
		auto x = find(a);
		auto y = find(b);
		if (x != y)
		{
			--sz;
			if (rank[x] < rank[y])
			{
				tops.erase(x);
				parent[x] = y;
				elem[y] += elem[x];
			}
			else if (rank[y] < rank[x])
			{
				tops.erase(y);
				parent[y] = x;
				elem[x] += elem[y];
			}
			else
			{
				tops.erase(y);
				parent[y] = x;
				elem[x] += elem[y];
				++rank[x];
			}
		}
	}
	std::size_t size(std::optional<index_t> index = std::nullopt)const
	{
		return index ? elem[find(*index)] : sz;
	}
	auto begin()const
	{
		return tops.begin();
	}
	auto end()const
	{
		return tops.end();
	}
};

void Main()
{
	std::size_t N, M;
	std::cin >> N >> M;
	union_find uf(N);
	for (auto i : boost::irange(M))
	{
		std::size_t a, b;
		std::cin >> a >> b;
		uf.merge(a - 1, b - 1);
	}
	std::size_t max = 0;
	for (auto i : boost::irange(N))
	{
		max = std::max(max, uf.size(i));
	}
	std::cout << max << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 18728
s = input()
n = len(s)
c = []
ci = ""
nowR = True
nowL = False
for i in range(n-1):
  if s[i] != s[i+1]:
    ci += s[i]
    c.append(ci)
    ci = ""
  else:
    ci += s[i]
ci += "L"
c.append(ci)
cnt = [0]*n
j = -1
for i in range(len(c)):
  if i % 2 == 0:
    # R
    cil = len(c[i])
    j += cil
    cnt[j] += cil - cil//2
    cnt[j+1] += cil//2
  else:
    # L
    cil = len(c[i])
    cnt[j] += cil//2
    cnt[j+1] += cil - cil//2
    j += cil
print(*cnt)
    


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

typedef long long ll;
typedef long double ld;

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

    ll N, A, B;
    cin >> N >> A >> B;

    vector<double> v(N);

    for(int i = 0; i < N; i++) cin >> v[i];

    sort(v.begin(), v.end(), greater<double>());

    double sum = 0;

    for(int i = 0; i < A; i++) sum += v[i];

    cout << fixed << setprecision(10) << sum / A << endl;

    double x = v[A - 1];

    ll front = 0;
    ll count = 0;

    for(int i = 0; i < N; i++) {
        if(v[i] > x) front++;
        else if(v[i] == x) count++;   
    }

    if(front == 0) {
        ll ans = 0;
        for(ll i = A; i <= min(count, B); i++) {
            ll a = 1LL;
            vector<ll> s(50);
            for(ll j = count; j > i; j--) {
                ll n = j;
                for(ll k = 2LL; k * k <= n; k++) {
                    while(n % k == 0) {
                        s[k]++;
                        n /= k;
                    }
                }
                if(n != 0) s[n]++;
            }
            for(ll j = count - i; j > 1LL; j--) {
                ll n = j;
                for(ll k = 2LL; k * k <= n; k++) {
                    while(n % k == 0) {
                        s[k]--;
                        n /= k;
                    }
                }
                if(n != 0) s[n]--;
            }
            for(ll j = 0; j < 50; j++) {
                for(ll k = 0; k < s[j]; k++) {
                    a *= j;
                }
            }
            cerr << a << endl;
            ans += a;
        }
        cout << ans << endl;
    } else {
        ll ans = 1;
        vector<ll> s(50);
        for(ll j = count; j > A - front; j--) {
            ll n = j;
            for(ll k = 2LL; k * k <= n; k++) {
                while(n % k == 0) {
                    s[k]++;
                    n /= k;
                }
            }
            if(n != 0) s[n]++;
        }
        for(ll j = count - (A - front); j > 1LL; j--) {
            ll n = j;
            for(ll k = 2LL; k * k <= n; k++) {
                while(n % k == 0) {
                    s[k]--;
                    n /= k;
                }
            }
            if(n != 0) s[n]--;
        }
        for(ll j = 0; j < 50; j++) {
            for(ll k = 0; k < s[j]; k++) {
                ans *= j;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N,X,Y,tmp;
cin>>N>>X>>Y;

long long ans[N];
for(int k=1;k<N;++k){
    ans[k]=0;
}
for(long long i=1;i<=N-1;++i){
    for(long long j=i+1;j<=N;++j){
        if(i<=X && j<=X){
            ans[j-i]+=1;
        }
        else if(X<i && i<=Y && X<j && j<=Y){
            tmp=min(j-i,((Y-j)+(i-X)+1));
            ans[tmp]+=1;
        }
        else if(Y<i && Y<j){
            ans[j-i]+=1;
        }
        else if(i<=X && Y<j){
            ans[(j-Y)+1+(X-i)]+=1;
        }
        else if(i<=X && X<j && j<=Y){
            tmp=min(j-i,((Y-j)+(X-i)+1));
            ans[tmp]+=1;
        }
        else if(X<i && i<=Y && Y<j){
            tmp=min(j-i,((j-Y)+(i-X)+1));
            ans[tmp]+=1;
        }

    }
}
for(int k=1;k<N;++k){
    cout<<ans[k]<<"\n";
}
return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }

  while (a % b != 0) {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

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

ll A, B, C, D;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> A >> B >> C >> D;
  A--;

  ll l = lcm(C, D);
  ll ans = B - (B / C) - (B / D) + (B / l);
  ans -= (A - (A / C) - (A / D) + (A / l));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    rep(i,0,(m+1)/2){
        cout << i+1 << " " << m+1-i << endl;
    }
    rep(i,0,m/2){
        cout << m+2+i << " " << 2*m+1-i << endl;
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int a,b;
    cin >> a >> b;
    int cnt = 1;
    while(1){
       if(b / 2 >= a){
           b /= 2;
           cnt++;
       }
        else {
        cout << cnt << endl;
        return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    int k1=k;
    vector<int> start,end;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='o')
        {
            start.push_back(i);
            k--;
            i+=c;
        }
        if(k==0)
        {
            break;
        }
    }
    for(int i=s.length()-1;i>=0;i--)
    {
        if(s[i]=='o')
        {
            end.push_back(i);
            k1--;
            i-=c;
        }
        if(k1==0)
        {
            break;
        }
    }
    reverse(end.begin(),end.end());
    vector<int> v;
    for(int i=0;i<start.size();i++)
    {
        if(start[i]==end[i])
        {
            v.push_back(start[i]+1);
           
        }
    }
    for(auto i:v)
    {
        cout<<i<<"\n";
    }
    return 0;
}


Measured memory_bytes: 6480
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String w = stdIn.next();
		int count = 0;
		
		while(true){
			String t = stdIn.next();
			if(t.equals("END_OF_TEXT")){
				break;
			}
			if(w.equalsIgnoreCase(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


struct UnionFindWithSize {
    int n;
    vector<int> p;
    vector<int> size;
    UnionFindWithSize(int nn) {
        n = nn + 1; // 1-based safe
        p.resize(n);
        size.resize(n);
        rep(i, n) p[i] = i;
        rep(i, n) size[i] = 1;
    }
    int root(int x) {
        return p[x] == x ? x : (p[x] = root(p[x]));
    }
    void unite(int x,int y) {
        x = root(x); y = root(y);
        if(x != y) {
            p[y] = x;
            size[x] += size[y];
        }
    }
    bool query(int x,int y){
        return root(x) == root(y);
    }
    int query_size(int x) {
        return size[root(x)];
    }
};



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

    int N, M, K; cin >> N >> M >> K;
    vector<int> A(M), B(M); rep(i, M) cin >> A[i] >> B[i];
    vector<int> C(K), D(K); rep(i, K) cin >> C[i] >> D[i];
    rep(i, M) A[i]--;
    rep(i, M) B[i]--;
    rep(i, K) C[i]--;
    rep(i, K) D[i]--;
    UnionFindWithSize uf(N);
    rep(i, M) uf.unite(A[i], B[i]);

    vector<int> friends(N);
    rep(i, M) {
        friends[A[i]]++;
        friends[B[i]]++;
    }
    vector<vector<int>> blocks(N);
    rep(i, K) {
        blocks[C[i]].push_back(D[i]);
        blocks[D[i]].push_back(C[i]);
    }
    vector<int> n_block(N);
    vector<int> ans(N);
    rep(i, N) {
        for(int b : blocks[i]) {
            if(uf.query(i, b)) n_block[i]++;
        }
        ans[i] = uf.query_size(i) - n_block[i] - 1 - friends[i];
    }

    rep(i, N) cout << ans[i] << (i == N - 1 ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 9856
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;


int main(){
  while(1){
    ll a,b,n;
    cin>>b>>a;
    if(a==0&&b==0) break;
    bool con[20][20];
    cin>>n;
    for(int i=0; i<=20; i++){
      for(int j=0; j<=20; j++){
        con[i][j]=false;
      }
    }
    for(int i=0; i<n; i++){
      int c,d;
      cin>>c>>d;
      con[c][d]=true;
    }
    
    
//    for(int i=a; i>=1; i--){
//      for(int j=1; j<=b; j++){
//        if(con[j][i]) cout<<'*';
//        else cout<<'.';
//      }
//      cout<<en
//    }
    
    ll ans=0;
    queue<P> michi;
    michi.push(mk(1,1));
    while(!michi.empty()){
      P p=michi.front(); michi.pop();
      for(int i=0; i<2; i++){
        int x=p.first+dx[i],y=p.second+dy[i];
        if(x==b&&y==a) ans++;
        if(!con[x][y]&&x<=b&&y<=a){
          michi.push(mk(x,y));
        }
      }
    }
    
    cout<<ans<<en
  }
  RE
}





Measured memory_bytes: 9168
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;



int main(){
	int dt[10003];
	dt[0]=dt[1]=0;
	loop(i,2,10003)dt[i]=1;
	dt[10001]=dt[10002]=0;
	for(int i=2;i<100;i++){
		if(dt[i]==1){
			for(int j=2;i*j<10000;j++){
				dt[i*j]=0;
			}
		}
	}
	int n;
	while(1){
		cin>>n;
		if(n==0)break;
		int ans=0;
		rep(i,n-1){
			if(dt[i]==1 && dt[i+2]==1){
				ans=i;
			}
		}
		cout<<ans<<" "<<ans+2<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  int max_get, V[N], bag[N];
  if (N < K) max_get = N;
  else max_get = K;
  for (int i=0; i<N; i++) scanf("%d", &V[i]);

  int max_value = 0, sum;
  for (int a=0; a<max_get+1; a++) {
    for (int b=0; b<max_get+1-a; b++) {
      for (int i=0; i<a; i++) bag[i] = V[i];
      for (int i=0; i<b; i++) bag[i+a] = V[N-i-1];
      sort(bag, bag+a+b);
      sum = 0;
      for (int i=0; i<a+b; i++) {
        if (bag[i] < 0 and i < (K-a-b)) continue;
        sum += bag[i];
      }
      if (sum > max_value) max_value = sum;
    }
  }
  printf("%d\n", max_value);
}


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

using namespace std;
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long

const int N=1e6+1,MOD=1e9+7,MAX=1e5;

string str;
int k,x;
bool a[11];
int  main()
{
           
           cin>>str>>k;

           for(int i=0;i<k;i++){
              cin>>x;
              a[x]=1;
           }
         bool flag = false,khemjet=false;
      for(int i=0;str[i];i++){
             
              if(!a[str[i]-'0'])
                 continue;

          if(flag){

             for(char j='0';j<='9';j++){
                 if(!a[j-'0']){
                   str[i] = j;
                    break;
                 }
             }
          }
          else{

             for(char j=str[i];j<='9';j++){

                 if(!a[j-'0']){
                    str[i]=j;
                    break;
                 }
             }

             if(a[str[i]-'0']){
                 for(char j='0';j<='9';j++){
                 if(!a[j-'0']){
                   str[i] = j;
                    break;
                 }
             }

               khemjet=true;
             }

             flag = true;
          }
          
      }

       if(khemjet){

           for(char i='0';i<='9';i++){

              if(!a[i-'0']){
                  str.pb(i);
                  break;
              }
           }

        }

      cout<<str<<"\n";
            
       
 return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string w[n];
    set<string> s;


    rep(i, n){
        cin >> w[i];
        s.insert(w[i]);
    }

    if(s.size() != n){
        No();
        return 0;
    }

    rep(i, n-1){
        if(w[i][w[i].size()-1] != w[i+1][0]){
            No();
            return 0;
        }
    }

    Yes();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
//const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    ll MOD;
    cin >> MOD;
    //pw[i][j]:=i^j, comb[i][j]:=iCj
    ll pw[MOD][MOD], comb[MOD][MOD];
    rep(i, MOD){
        pw[i][0] = 1;
        rep2(j, 1, MOD-1) pw[i][j] = pw[i][j-1]*i%MOD;
    }
    fill(comb[0], comb[MOD], 0);
    comb[0][0] = 1;
    rep(i, MOD-1){
        rep(j, i+1){
            comb[i+1][j] += comb[i][j], comb[i+1][j] %= MOD;
            comb[i+1][j+1] += comb[i][j], comb[i+1][j+1] %= MOD;
        }
    }
    int A[MOD];
    rep(i, MOD) cin >> A[i];
    ll B[MOD];
    fill(B, B+MOD, 0);
    int cnt = 0;
    ll sum[MOD];
    fill(sum, sum+MOD, 0);
    rep(i, MOD){
        if(A[i] == 1) continue;
        cnt++;
        int j = (MOD+1-i)%MOD;
        rep(k, MOD){
            sum[k] += pw[j][k], sum[k] %= MOD;
        }
    }
    rep(i, MOD){
        rep(j, i+1){
            B[j] += comb[i][j]*sum[i-j], B[j] %= MOD;
        }
    }
    B[0] += MOD+1-cnt, B[0] %= MOD;
    rep(i, MOD) cout << B[i] << ' ';
    cout << endl;
}

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

class Program
{
    long gcd_l(long a, long b)
    {
        long q = a % b;
        if (q == 0)
        {
            return b;
        }
        else
        {
            return gcd_l(b, q);
        }
    }
    long lcm_l(long a, long b)
    {
        long n = a / gcd_l(a, b);
        return n * b;
    }
    void solve()
    {
        long lcm = 1;
        int N = int.Parse(Console.ReadLine());

        for (int i = 0; i < N; ++i)
        {
            long T = long.Parse(Console.ReadLine());
            lcm = lcm_l(lcm, T);
        }
        Console.WriteLine(lcm);
    }

    public static int Main()
    {
        bool loop = false;
#if ES_DEBUG
        loop = true;
#endif
        do
        {
            new Program().solve();
        } while (loop);
        return 0;
    }
}


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

bool check(int p,int x,int y){
  int c = 0;
  while(p > 0){
    c += p % 10;
    p /= 10;
  }
  if(x <= c && c <= y){
    return true;
  }
  return false;
}
 
int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int res = 0;
  for(int i = 1; i <= n; ++i){
    if(check(i,a,b)){
      res += i;
    }
  }
  cout << res;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        String s = sc.next();
        char sArr[] = s.toCharArray();
        for(int i = 0; i < 3; i++){
            System.out.print(sArr[i]); 
        }
        System.out.println();
    }
}

Measured memory_bytes: 35620
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

int main() {
	int N;
	int X[100];
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> X[i];
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans += X[i] * X[i];
	}

	for (int i = 0; i <= 100; i++) {
		int s = 0;
		for (int j = 0; j < N; j++) {
			s += (X[j] - i) * (X[j] - i);
		}
		if (s < ans) { ans = s; }
	}

	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 100005


int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   ll d,t,s;cin>>d>>t>>s;
   if(t*s>=d) cout<<"Yes\n";
   else cout<<"No\n";

   return 0;
}



Measured memory_bytes: 3644
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;

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

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

int32_t main(){
  int n, k;
  cin >> n >> k;
  map<int, int> hash;
  vector<int> v(n);
  for(int i=0; i<n; i++){
    cin >> v[i];
  }
  vector<int> cycle;
  int curr = 0;
  int cidx = 0;
  while(true){
    if(hash.find(curr) != hash.end())
      break;
    cycle.push_back(curr);
    hash[curr] = cidx++;
    curr = v[curr]-1;
  }
  if(k < hash[curr]){
    cout << cycle[k]+1 << "\n";
  } else {
    k = k - hash[curr];
    int cs = cycle.size()-hash[curr];
    k = k % cs;
    cout << cycle[hash[curr] + k]+1 << "\n";
  }
}

Measured memory_bytes: 18464
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(scan.nextInt());
		}
		scan.close();

		for (int i = n - 1; i >= 0; i--) {
			if (i != 0) {
				System.out.print(list.get(i) + " ");
			} else {
				System.out.print(list.get(i) + "\n");
			}
		}
	}

}

Measured memory_bytes: 26372
//https://www.youtube.com/watch?v=8LusJS5-AGo
//https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/
#include<bits/stdc++.h>
#define int long long
#define scf(n) scanf("%lld",&n)
#define rep1(n) for(int i=1;i<=n;i++)
#define prf(n) printf("%lld",n)
#define sci(n) scanf("%lld",&n)
#define pri(n) printf("%lld",n)

#define nl printf("\n")
#define spc printf(" ")
#define file freopen("in.txt","rt",stdin)
#define pii pair<int,int>
#define piii pair<pii,int>
#define MOD 10000007
const int INF = 1e18L + 5;
using namespace std;

/*bool sortBySec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}*/
void faster(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
/******************************************/
int dp[100009];
int32_t main()
{
    /***********************************/
//#ifdef ONPC
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//#endif

    //faster();
    /*********************************/

    for(int i=1;i<=100009;i++)
    {
        dp[i] = INF;
    }
    vector<pii>v;
    int n,w;
    sci(n);
    sci(w);
    int sum = 0;
    for(int i=1;i<=n;i++)
    {
        int weight,cost;
        sci(weight);
        sci(cost);
        v.push_back(make_pair(weight,cost));
        sum+=cost;
    }
    for(auto x : v)
    {
        for(int i=sum-x.second;i>=0;i--)
        {
            dp[i+x.second] = min(dp[i+x.second],dp[i]+x.first);
        }
    }
    int ans = 0;
    for(int i=0;i<=sum;i++)
    {
        if(dp[i]<=w)
        {
            ans = max(ans,i);
        }
    }
    pri(ans),nl;





    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
 
int main()
{
  int n;
  cin >> n;
  
  string count;
  switch(n % 10)
  {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    count = "hon";
  	break;
  case 0:
  case 1:
  case 6:
  case 8:
    count = "pon";
  	break;
  case 3:
    count = "bon";
  	break;
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

typedef long long int ll;

const ll MAX = 9000000000000000000;

#define fin(ans) cout << (ans) << endl;

ll mod_pow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x; cin >> x;
  ll ans = 1;
  for(ll i = 2;i < x;i++)
  {
    for(ll j = 2;mod_pow(i, j) <= x;j++)
    {
      ans = max(ans, mod_pow(i, j));
    }
  }
  fin(ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
using namespace std;
const int INF = 2147483647;

template<class M> struct SegmentTree
{
	// 要素数
	int n;
	// 扱いたい大きさ(要素数)より大きい2冪として持つ
	int size;
	// tree 本体に乗っている値．2*size のノードを持つ．
	// data[1] を root として data[0] は使用しない
	vector<M> data;
	// モノイド上の演算
	const function<M(M, M)> op;
	// 単位元
	const M ID;

	// n は要素の数．init_vals の size は n 以下であること（足りない分は単位元で初期化される）
	SegmentTree(int n, function<M(M, M)> op, M id, const vector<M> &init_vals=vector<M>()) : n(n), op(op), ID(id) {
		size = 1;
		while (size < n) size <<= 1;
		data.assign(size * 2, ID);
		for (int i = 0; i < init_vals.size(); i++) data[size+i] = init_vals[i];
		for (int i = size-1; i > 0; i--) data[i] = op(data[2*i], data[2*i+1]);
	}
	
	// idx 番目の要素を x に変更
	// O( log(size) )
	void update(int idx, M x) {
		idx += size;
		data[idx] = x;
		// 親のノードたちも更新
		while (idx /= 2) {
			data[idx] = op(data[2*idx], data[2*idx+1]);
		}
	}

	// 区間 [l,r) で演算した結果を返す
	// O( log(size) )
	M query(int l, int r) {
		M L = ID, R = ID;
		for (l += size, r += size; l < r; l /= 2, r /= 2) {
			if (l & 1) L = op(L, data[l]), l++;
			if (r & 1) r--, R = op(data[r], R);
		}
		return op(L, R);
	}

	// idx 番目の要素を返す
	M val(int idx) {
		return data[size + idx];
	}

	// 要素の vector を返す
	vector<M> val_vec() {
		vector<M> res(n);
		for (int i = 0; i < n; i++) res[i] = data[size+i];
		return res;
	}
};

int mymin(int l, int r) {
	return min(l, r);
}

int main() {
	int n, q;
	cin >> n >> q;
	SegmentTree<int> st(n, mymin, INF);
	for (int query = 0; query < q; query++) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			st.update(x, y);
		} else {
			int ans = st.query(x, y+1);
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3840
from sys import exit, stdin
from itertools import combinations
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
dp = [False]*(10**6)
dp2 = [0]*(10**6)
dp[1] = True
for i in range(N):
    dp2[i+1] = 1
for i in range(M):
    x, y = map(int, stdin.readline().rstrip().split())
    if dp[x]:
        dp[y] = True
    dp2[x] -= 1
    dp2[y] += 1
    if not dp2[x]:
        dp[x] = False
ans = 0
for i in range(N):
    if dp[i+1]:
        ans += 1
print(ans)

Measured memory_bytes: 18804
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }

    long long res = 0;
    sort(begin(v), end(v));
    for (int i = 1; i < n; ++i)
    {
        // cout << n - (i / 2) << endl;
        res += v[n - (i / 2) - 1];
    }
    cout << res << endl;
}

Measured memory_bytes: 4776
#include <stdio.h>
#include <string.h>
#include <map>
using namespace std;

int get_choise_game(map<int,int> vote_data,int length){
  int buff = 0;

  for(int i = 1; i <= length; i++) {
    if(buff < vote_data[i]) buff = vote_data[i];
  }

  for(auto itr = vote_data.begin(); itr != vote_data.end(); itr++)
    if(itr->second == buff) return itr->first;

  return 0;
}

int main(){
  int game_qty,member;
  int member_aim;

  scanf("%d%d",&game_qty,&member);

  int game_cost[game_qty];
  map<int,int> vote_data;
 
  for(int i = 1; i <= game_qty; i++) vote_data[i] = 0; 

  for(int i = 0; i < game_qty; i++) scanf("%d",&game_cost[i]);

  for(int i = 0; i < member; i++){
    scanf("%d",&member_aim);
    for(int j = 0; j < game_qty; j++){
      if(member_aim >= game_cost[j]){
        vote_data[j + 1]++; 
        break;
      }
    }
  }

  printf("%d\n",get_choise_game(vote_data,game_qty));
}

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

int main(){
	string s="aeiou"s;
	char c;
	cin>>c;
	s+=c;
	int i=0;
	while(s.at(i)!=c)++i;
	if(i!=s.size()-1)cout<<"vowel\n"s;
	else cout<<"consonant\n"s;
}

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

bool contain[100005];
int numball[100005];
int n,m;

int main(){
contain[1] = true;
scanf("%d%d",&n,&m);
for (int x = 1; x<=n; x++){
    numball[x] = 1;
}
for (int x = 0; x<m; x++){
    int a,b;
    scanf("%d%d",&a,&b);
    if (contain[a]){
        contain[b]= true;
    }

    if (numball[a]==1){
        contain[a] = false;
    }
    numball[a]--;
    numball[b]++;
}
int ans = 0;
for (int x = 1; x<=n; x++){
    if (contain[x]) ans++;
}
printf("%d",ans);
}


Measured memory_bytes: 768
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
    string S;
    cin >> S;
    int A = 0;
    int B = 0;

    for (int i = 0; i < S.size(); i++) {
        if (S.at(i) == '+') {
            A++;
        }
        else {
            B++;
        }
    }
    cout << A - B << endl;
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  map<int, int> q;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    q[x]++;
  }
  long long ans = 0;
  long long b1 = 0;
  long long b2 = 0;
  for (auto &i : q) {
    if (i.second >= 4) {
      ans = std::max(ans, 1LL * i.first * i.first);
    }
    if (i.second >= 2) {
      if (b1 < i.first) {
        b2 = b1;
        b1 = i.first;
      } else if (b2 < i.first) {
        b2 = i.first;
      }
    }
  }
  ans = std::max(ans, b1 * b2);
  printf("%lld\n", ans);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

int N, A, B, C;
int l[1000];
ll ans=1e9;

void dfs(ll cur, ll a, ll b, ll c, ll s) {
	if (cur==N) {
		if (a!=0&&b!=0&&c!=0) {
			ll t=s-30;
			t+=abs(a-A)+abs(b-B)+abs(c-C);
			ans = min(ans,t);
		}
		return;
	}
	
	dfs(cur+1, a, b, c, s);
	dfs(cur+1, a+l[cur], b, c, s+10);
	dfs(cur+1, a, b+l[cur], c, s+10);
	dfs(cur+1, a, b, c+l[cur], s+10);
}

int main()
{
	FAST;

	cin>>N>>A>>B>>C;

	for(ll i=0;i<N;i++) cin>>l[i];

	dfs(0,0,0,0,0);

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c, d, e;
	int time = 0;
	
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	scanf("%d", &e);
	
	if (a < 0){
		time = a * -1 * c;
		time += d;
		time = (time + e * b);
	}
	else {
		time = e * (b - a);
	}
	
	printf("%d\n", time);
	
	return (0);
}


Measured memory_bytes: 2044
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
		int i = 1;
			do {
				int x = i;
				if(x%3 == 0){
					System.out.print(" "+i);
				}else{
					do{
						if(x%10 == 3){
							System.out.print(" "+i);
							break;
						}
						x /= 10;
					}while(x != 0);
				}
			}while(++i <= n);
			System.out.println();
		
	}
}

Measured memory_bytes: 28344
a = list(map(int,input().split()))
b= []
b.append(abs(a[0]-a[1])+abs(a[1]-a[2]))
b.append(abs(a[0]-a[2])+abs(a[1]-a[2]))
b.append(abs(a[0]-a[1])+abs(a[0]-a[2]))
print(min(b))

Measured memory_bytes: 3064
n, a, b = map(int, input().split())

mod = 10 ** 9 + 7

ans = pow(2, n, mod) - 1
for i in [a, b]:
    num = 1
    den = 1
    for p in range(n, n-i, -1):
        num = num * p % mod
    for q in range(1, i+1):
        den = den * q % mod
    cmb = num * pow(den, mod-2, mod) % mod
    ans -= cmb
    ans %= mod
print(ans)

Measured memory_bytes: 8908
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n, h, w;
	cin >> n >> h >> w;
	int a, b;
	int ans = 0;
	rep(i, n) {
		cin >> a >> b;
		if (h <= a&&w <= b) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;
 
int main(){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n) {
        int a; cin >> a;
        if(a >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616