akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main(){

	string str,JOI="JOI",IOI="IOI";
	while(cin>>str){
	int J=0,I=0,c1=0,c2=0,a=-1,b=-1;
	for(int i=0;i<str.size();i++){
		J=str.find(JOI,i);
		I=str.find(IOI,i);
		if(J>=0&&J!=a){
			c1++;
			a=J;
		}
		if(I>=0&&I!=b){
			c2++;
			b=I;
		}
	}
	cout<<c1<<endl<<c2<<endl;
	}
return 0;
}

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

int main() {
    int a, b;
    cin >>a >> b;
    if (a>b) {
        cout << "a > b" << endl;
    } else if ( a == b) {
        cout << "a == b"<<endl;
    } else {
        cout << "a < b"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#!/usr/bin/env python3
from itertools import chain
# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N, A):
    sunukes = [1 for _ in range(N)]
    for a in A:
        for i in a:
            sunukes[i-1] = 0
    return sum(sunukes)

def main():
    N, K = map(int, input().split())
    A = []
    for k in range(K):
        _ = int(input())
        A.append(list(map(int, input().split())))

    answer = solve(N, A)



    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

typedef long long ll;

ll N;

int main() {
	cin >> N;
	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += i * (N + 1 - i);
	}
	for (int i = 0; i < N - 1; i++) {
		ll b, e;
		cin >> b >> e;
		if (b > e)swap(b, e);
		ans -= (N + 1 - e) * b;
	}
	cout << ans << endl;
	return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    string S; cin >> S;
    int N = S.size();

    int ans = INF;
    int tmp = 0;
    REP(i,N){
        if((i&1) && S[i]=='0') tmp++;
        if((i&1)==0 && S[i]=='1') tmp++;
    }

    chmin(ans, tmp);

    tmp = 0;
    REP(i,N){
        if((i&1) && S[i]=='1') tmp++;
        if((i&1)==0 && S[i]=='0') tmp++;
    }

    chmin(ans, tmp);

    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t){
        Main();
    }
    return 0;
}

Measured memory_bytes: 512
import sys

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())

    init = []
    for _ in range(N):
        a, b = map(int, input().split())
        init.append((a, b))

    check = []
    for _ in range(M):
        c, d = map(int, input().split())
        check.append((c, d))

    for i in init:
        pos = 0
        dist = 10**9
        x0, y0 = i[0], i[1]
        for j in range(M):
            x1, y1 = check[j][0], check[j][1]
            if abs(x0 - x1) + abs(y0 - y1) < dist:
                pos = j + 1
                dist = abs(x0 - x1) + abs(y0 - y1)

        print(pos)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            int M = sc.nextInt();
            int N = sc.nextInt();
            if (N == 0) break;
            boolean[] ok = new boolean[8000000];
            int pos = M;
            for (int i = 0; i < N; i++) {
                while (ok[pos]) {
                    pos++;
                }
                for (int j = pos; j < ok.length; j += pos) {
                    ok[j] = true;
                }
            }
            while (ok[pos]) {
                pos++;
            }
            System.out.println(pos);
        }

    }


}

Measured memory_bytes: 53152
import Data.Bifunctor (first)

main :: IO ()
main = do
    _ <- getLine
    [t, a] <- fmap read . words <$> getLine
    xs <- fmap read . words <$> getLine
    answer $ solve t a xs

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: Int -> Int -> [Int] -> Answer
solve t a xs = snd $ minimum $ map (first $ \x -> abs ((a - t) * 1000 + x * 6)) $ zip xs [1..]

Measured memory_bytes: 1276
#include <stdio.h>

int main () {
	char a, b;
	scanf("%c %c", &a, &b);
	bool temp = a == 'H';
	bool temp2 = b == 'H';
	
	if (temp ^ temp2){
		puts("D");
	} else {
		puts("H");
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	char c;
	int a = 0, b = 0;
	for (int i = 0; i < 3; ++i) {
		scanf(" %c", &c);
		if (c == 'A') ++a;
		else ++b;
	}
	if (a && b) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,a,m=0;
  cin>>h>>w;
  int c[10][10];
  for(int i=0;i<10;i++)
  for(int j=0;j<10;j++) cin>>c[i][j];
  for(int k=0;k<10;k++)
    for(int i=0;i<10;i++)
      for(int j=0;j<10;j++)
        c[i][j]=min(c[i][k]+c[k][j],c[i][j]);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a;
      if(a!=-1) m+=c[a][1];
    }
  }
  cout<<m;
}


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

int main() {
  const auto f = [] { int x; cin >> x; return x; };
  const int N = f();
  const int64_t K = [] { int64_t x; cin >> x; return x; }();
  const auto ab = [f, N] {
    vector<pair<int, int>> ab;
    for (int i = 0; i < N; ++i) {
      const int a = f(), b = f();
      auto pair = make_pair(a, b);
      ab.push_back(pair);
    }
    sort(ab.begin(), ab.end());
    return ab;
  }();
  const auto a = [ab] {
    vector<int> a;
    for (const auto& x : ab) a.push_back(x.first);
    return a;
  }();
  const auto b_cum = [ab] {
    const auto b = [ab] {
      vector<int> b;
      for (const auto& x : ab) b.push_back(x.second);
      return b;
    }();
    vector<int64_t> b_cum(b.begin(), b.end());
    for (int i = 1; i < b_cum.size(); ++i)
      b_cum[i] += b_cum[i - 1];
    return b_cum;
  }();
  const int index = [K, b_cum] {
    const auto bound = lower_bound(b_cum.begin(), b_cum.end(), K);
    return distance(b_cum.begin(), bound);
  }();
  cout << a[index] << endl;
}


Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define FASTIO ios_base::sync_with_stdio(NULL); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define MOD 1000000007

using namespace std;

void init(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin) ;
  freopen("output.txt", "w", stdout) ;
  #endif
}

// code from below
double heads[3000],tails[3000];
double ans=0;
int n;
void rec(int i,int h,int t,double curVal){
    if(h+t > n){
        return;
    }
    if(h+t ==n){
        if(h>t){
            ans+=curVal;
            return;
        }else
            return;
    }
    
    rec(i+1,h+1,t,curVal*(double)heads[i+1]);
    rec(i+1,h,t+1,curVal*(double)tails[i+1]);
}
void solve(){
    ans=0;
    double p;
    cin>>n;
    FOR(i,n){
        cin>>p;
        heads[i+1]=p;
        tails[i+1]=1.0-p;
    }
    // rec(0,0,0,1.0);
    double dp[n][n+1];
    memset(dp,0.0,sizeof(dp));
    // base case col 0, will have 1 coin 1 tail, 2 coin and 2 tails, and so on....
    dp[0][0]=tails[1];
    for(int i=1;i<n;i++){
        dp[i][0]=dp[i-1][0]*tails[i+1];
    }
    // filling the first row,
    dp[0][1]=heads[1];

    // dp[i][j] means after taking i coins what would be probability of getting j heads 
    for(int i=1;i<n;i++){
        for(int j=1;j<=i+1;j++){
            dp[i][j]=dp[i-1][j]*tails[i+1] + dp[i-1][j-1]*heads[i+1];
            // cout<<" at i: "<<i<<" j: "<<j;
            // cout<<" multi "<<tails[i+1]<<"*"<<dp[i-1][j]<<" + "<<heads[i+1]<<"*"<<dp[i-1][j-1]<<" and res: "<<dp[i][j]<<endl;
        }
    }

    // for(int i=0;i<n;i++,cout<<endl)
    //     for(int j=0;j<=n;j++)
    //         cout<<dp[i][j]<<" \t";
    for(int i=ceil((n+1)/2);i<=n;i++)
        ans+=dp[n-1][i];
    cout<<fixed << setprecision(10)<<ans<<endl;
}

int main(){
    int t=1;
    // cin>>t;
    // cin.ignore(numeric_limits<streamsize>::max(),'\n'); 
    while(t--)
        solve();
}

Measured memory_bytes: 74076
#include<stdio.h>
#include<string.h>

int main(void)
{
   int i, f;
   char s[27];

   scanf("%s",s);

   for(i=0;i<strlen(s)-1;i++)
      for(f=i+1;f<strlen(s);f++)
         if(s[i]==s[f]){
            printf("no\n");
            return 0;
         }

   printf("yes\n");
   return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define N 5050
const int mod=1e9+7;
using namespace std;
int n,f[N],dp[N][N],sz[N];
int he[N],ne[N<<2],to[N<<2],tot;
inline void addedge(int x,int y){
	to[++tot]=y;ne[tot]=he[x];he[x]=tot;
}
inline void dfs(int g,int fa){
	sz[g]=1;dp[g][1]=1;
	for(int i=he[g];i;i=ne[i])if(to[i]!=fa){
		dfs(to[i],g);
		for(int j=sz[g];j;--j){
			for(int k=1;k<=sz[to[i]];++k)
				dp[g][j+k]=(1ll*dp[g][j]*dp[to[i]][k]+dp[g][j+k])%mod;
			dp[g][j]=1ll*dp[g][j]*dp[to[i]][0]%mod;
		}
		sz[g]+=sz[to[i]];
	}
	if(sz[g]&1)return;
	for(int i=2;i<=sz[g];++i)dp[g][0]=(mod+dp[g][0]-1ll*f[i]*dp[g][i]%mod)%mod;
}
int main(){
	scanf("%d",&n);
	f[0]=1;for(int i=2;i<=n;i+=2)f[i]=1ll*f[i-2]*(i-1)%mod;
	for(int i=1,x,y;i<n;++i)
		scanf("%d%d",&x,&y),addedge(x,y),addedge(y,x);
	dfs(1,0);
	cout<<mod-dp[1][0]<<endl;
	return 0;
}

Measured memory_bytes: 58344
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int a,b;
  cin >> a>> b;
  if(a < 6) cout << 0 << endl;
  else if(a < 13) cout << b /2 << endl;
  else cout << b << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
int n;
long long x[55], lo, hi, mi, u;
 
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", x + i);
		hi += x[i];
	}
	lo = max((long long)0, hi - n * (n - 1));
	hi++;
	for (mi = lo; mi < hi; mi++) {
		u = 0;
		for (int i = 0; i < n && u != -1; i++)
			if ((x[i] + mi) % (n + 1) == n)
				u = -1;
			else
				u += (x[i] + mi) / (n + 1);
		if (u == mi) {
			printf("%lld\n", mi);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

# In[14]:

import numpy as np


# In[11]:

N = raw_input()
N = int(N)


# In[16]:

A = []
B = []
for i in range(N):
    x = raw_input()
    x = x.split(' ')
    x = [int(d) for d in x]
    A.append(x[0])
    B.append(x[1])


# In[17]:

A = np.array(A)
B = np.array(B)


# In[22]:

max_index = np.argmax(A)
max_num = np.max(A)


# In[24]:

print(max_num + B[max_index])


# In[ ]:

Measured memory_bytes: 26976
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    ll W,H,x,y;
    cin >> W >> H >> x >> y;
    int ans = 0;
    double S = (double)(W) * H / 2;
    if (W == 2*x && H == 2*y)ans = 1;

    cout << fixed << setprecision(10) << S << " " << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	int x[110], y[110]; long long h[110];
	long long H;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> h[i];
	}
	bool flag;
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			flag = true;
			for (int k = 0; k < n; k++) {
				if (h[k] >= 1) {
					H = h[k] + abs(x[k] - i) + abs(y[k] - j);
					break;
				}
			}
			for (int k = 0; k < n; k++) {
				if (h[k] >= 1) {
					if (H != h[k] + abs(x[k] - i) + abs(y[k] - j)) {
						flag = false;
						break;
					}
				}
			}
			for (int k = 0; k < n; k++) {
				if (h[k] == 0) {
					if (abs(x[k] - i) + abs(y[k] - j) < H) {
						flag = false;
						break;
					}
				}
			}
			if (flag == true) {
				cout << i << ' ' << j << ' ' << H << endl;
			}
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

struct combi {
public:
	vector<bigint>facto;
	combi(const int N) :facto(N) {
		facto[0] = 1;
		REP(i, 1, N)facto[i] = facto[i - 1] * i;
	}
	bigint get_combi(const int N, const int C) {
		//combination(N+C,C)を求めて返す。
		if (int(facto.size()) <= N + C) {
			bigint a = facto.size();
			facto.resize(N + C + 1);
			REP(i, a, N + C + 1)facto[i] = facto[i - 1] * i;
		}
		return facto[N + C] / (facto[N] * facto[C]);
	}
};


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

	int N, P;
	cin >> N >> P;
	vector<int>A(N);
	rep(i, N)cin >> A[i];
	int even = 0, odd = 0;
	rep(i, N) {
		if (A[i] % 2 == 0)even++;
		else odd++;
	}

	combi f(51);

	if (P == 0) {
		//evenを好きなだけ選び、oddを偶数個選ぶ
		bigint ans = 0;
		for (int i = 0; i <= even; i++)for (int j = 0; j <= odd; j += 2) {
			ans += f.get_combi(even - i, i)*f.get_combi(odd - j, j);
		}
		cout << ans << endl;
	}
	else {
		//evenを好きなだけ選び,oddを基数個選ぶ
		bigint ans = 0;
		for (int i = 0; i <= even; i++)for (int j = 1; j <= odd; j += 2) {
			ans += f.get_combi(even - i, i)*f.get_combi(odd - j, j);
		}
		cout << ans << endl;
	}



	return 0;
}





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

typedef unsigned long long		ull;
typedef long long				ll;
typedef long double				ld; // GCC - long double, but VS - double

template<typename T> using vv	= vector<vector<T>>;
template<typename T> using pp   = pair<T, T>;

#define fr(i, n)                for(int i = 0; i < n; ++i)
#define rep(i, a, b)            for(int i = a; i <= b; ++i)
#define all(a)                  a.begin(), a.end()
#define rall(a)                 a.rbegin(), a.rend()
#define pb                      push_back
#define nl                      '\n'
#define file(name1, name2)      freopen(name1, "r", stdin); freopen(name2, "w", stdout);
#define zp_v(v)                 for(int i = 0; i < v.size(); ++i) cin >> v[i]
#define zp_vv(v)                fr(i, v.size())fr(j, v[i].size()) cin >> v[i][j];
#define print_v(v)              for (auto& u : v){ cout << u << ' '; }
#define print_vv(v)             for (auto& u : v){ for (auto& q : u) cout << q << ' '; cout << nl;}
#define int ll
const int INF = 1e15;
vector<int> v, dp;

signed main()
{
#ifdef LOCAL_DEBUG
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	++n;
	v.resize(n + 1);
	rep(i, 2, n)
		cin >> v[i];

	dp.resize(n + 1, INF);
	dp[2] = 0;

	rep(i, 3, n)
	{
		int res1 = abs(v[i] - v[i - 1]) + dp[i - 1];
		int res2 = abs(v[i] - v[i - 2]) + dp[i - 2];

		dp[i] = min(res1, res2);
	}
	cout << dp[n];
	return 0;
}

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

int main(){
    int A;
    int B; 
    cin >>A;
    cin >>B;
    int c = A + B;
    if (c == 3) {
        cout <<  3 << endl;
    }else if (c==4){
        cout << 2 << endl;
    }else if (c==5){
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int yen;
    scanf("%d",&yen);
    int x=yen/500;
    int hp=1000*x;
    int y=yen%500;
    int z=y/5;
    int hpp=5*z;
    int sum=hp+hpp;
    printf("%d",sum);

}


Measured memory_bytes: 128
n = int(input())
otosidamas = [[]*2]*n
BTCtoJPY = 380000.0
sum = 0

for i in range(len(otosidamas)):
    otosidamas[i] = input().split()
    otosidamas[i][0] = float(otosidamas[i][0])
    if otosidamas[i][1] == "BTC":
        sum += BTCtoJPY * otosidamas[i][0]
    else:
        sum += otosidamas[i][0]


print(sum)


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

typedef long long ll;
#define mod 1000000007
#define PRINTV(v) for(int z = 0; z < (v).size(); z++){cout<<v[z]<<" ";}cout<<"\n";

template<typename T>
void deb(initializer_list<T> &l)
{
    for (auto &e : l)
        cout << e << ' ';
    cout << endl;
}
void solve(){
    char c;
    cin>>c;
    if(isupper(c)){
        cout<<'A';
    } else{
        cout<<'a';
    }

}

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

    int t = 1;
    // cin>>t;
    while(t--)
        solve();
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int h,w;
  cin>>h>>w;
  char s[h][w];
  rep(i,h){
    rep(j,w)
      cin>>s[i][j];
  }
  bool flag=true;
  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++){
      if(s[i][j]=='#'&&s[i][j-1]!='#'&&s[i+1][j]!='#'&&s[i][j+1]!='#'&&s[i-1][j]!='#'){
	flag=false;
	//cout<<"i=="<<i<<"j=="<<j<<endl;
      }
    }
  }
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L.sort()

count = 0
for k in range(2, N):
  for j in range(1,k):
    for i in range(j):
      if L[i] + L[j] > L[k] and L[i] != L[j] and L[j] != L[k]:
        count += 1
      else:
        continue
        
print(count)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int c[10] = {};
    int N;
    cin >> N;
    while(N--) {
        int a;
        cin >> a;
        a /= 400;
        c[min(8, a)]++;
    }

    int cnt = 0;
    for(int i = 0; i < 8; ++i) {
        if(c[i] != 0) ++cnt;
    }

    if(c[8] != 0 && c[7] == 0) cout << cnt + 1 << " " << cnt + c[8];
    else if(c[8] != 0) cout << cnt << " " << cnt + c[8] << endl;
    else cout << cnt << " " << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
import itertools

N = int(input())

xy_ls = []
for i in range(N):
    A = int(input())
    xy = [list(map(int,input().split())) for j in range(A)]
    xy_ls.append(xy)

ans_ls = list(itertools.product([0,1], repeat=N))

max_ans = 0
for ans in ans_ls:
    flg = True
    for i in range(len(ans)):
        if ans[i]==1:
            for xy in xy_ls[i]:
                if ans[xy[0]-1] == xy[1]:
                    pass
                else:
                    flg = False
                    break
    if flg == True:
        max_ans = max(max_ans,sum(ans))

print(max_ans)

Measured memory_bytes: 80496
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int a=0;a<n;a++){
        double p,q,r,s,t,u;
        cin>>p>>q>>r>>s>>t>>u;
        double A,B,C;
        A=r;
        B=u;
        C=sqrt((p-s)*(p-s)+(q-t)*(q-t));
        if(B+C<A)cout<<"2";
        else if(A+C<B)cout<<"-2";
        else if(C>A+B)cout<<"0";
        else cout<<"1";
        cout<<endl;
         
    }
    return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	char c;
	cin>>c;
	if(c=='A')cout<<'T'<<endl;
	else if(c=='T')cout<<'A'<<endl;
	else if(c=='G')cout<<'C'<<endl;
	else if(c=='C')cout<<'G'<<endl;
	
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}







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

int n, A, B, C, D;
string a;
int main()
{
	int i;
	cin >> n >> A >> B >> C >> D;
	cin >> a;
	a = ' ' + a;
	if (C < D) {
		for (i = B + 1; i <= D; i++) {
			if (a[i] == '#' && a[i - 1] == '#') {
				cout << "No";
				return 0;
			}
		}
		for (i = A + 1; i <= C; i++) {
			if (a[i] == '#' && a[i - 1] == '#') {
				cout << "No";
				return 0;
			}
		}
		cout << "Yes";
		return 0;
	}
	for (i = B + 1; i <= D; i++) {
		if (a[i] == '#' && a[i - 1] == '#') {
			cout << "No";
			return 0;
		}
	}
	for (i = A + 1; i <= C; i++) {
		if (a[i] == '#' && a[i - 1] == '#') {
			cout << "No";
			return 0;
		}
	}

	for (i = A + 2; i <= C; i++) {
		if (i >= B && i <= D && a[i] != '#' && a[i - 1] != '#' && a[i +1] != '#') {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	return 0;
}


Measured memory_bytes: 772
#include<iostream>
#include<string>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)

int main() {

	int N; cin >> N;

	vi a(N);

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

	int cnt = 0;
	ll ans = 0;
	
	int i = 0;
	while (i <= N-1) {
		if (a[i] == i + 1) {
			ans++;
			i += 2;
		}
		else {
			i++;
		}
	}
		
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  vector<int> v;
  for(int i=0; i<3; i++) {
    int x;
    cin>>x;
    v.push_back(x);
  }
  int ans=1000000;
  for(int i=0; i<3; i++) {
    for(int j=i+1; j<3; j++) {
      ans = min(ans, v[i]+v[j]);
    }
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>

using namespace std;

int Count(vector<vector<char> > &vv, int x, int y) {
  int H = vv.size();
  int W = vv[0].size();
  int cnt = 0;
  for (int dx = -1; dx<= +1; ++dx) {
    for (int dy = -1; dy <= +1; ++dy) {
      if (dx == 0 and dy == 0) continue;
      if (x+dx < 0 or x+dx >= H or y+dy < 0 or y+dy >= W) continue;
      if (vv[x + dx][y + dy] == '#') ++cnt;
    }
  }
  return cnt;
}

int main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<char> > vv(H, vector<char> (W));
  for (int i = 0; i < H; ++i) {
    string S;
    cin >> S;
    for (int j = 0; j < W; ++j) {
      vv[i][j] = S[j];
    }
  }

  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (vv[i][j] == '#') cout << '#';
      else cout << Count(vv, i, j);
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
heights = gets.split.map(&:to_i)
roads = []
count = 0
m.times do
  roads << gets.split.map(&:to_i)
end

towers = {}

roads.each do |road|
  if towers[road[0]]
    towers[road[0]] << road[1]
  else
    towers[road[0]] = [road[1]]
  end

  if towers[road[1]]
    towers[road[1]] << road[0]
  else
    towers[road[1]] = [road[0]]
  end
end

tower_count = 0
towers.each do |key, value|
  tower_count += 1
  tower_height = heights[key-1]
  if value.all?{|v| heights[v-1] < tower_height}
    count += 1
  end
end

puts count + (n-tower_count)

Measured memory_bytes: 34308
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    int ans = min(b,d)-max(a,c);
    if(ans>-1)
        cout<<ans;
    else
        cout<<0;
    return 0;
}


Measured memory_bytes: 3548
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
ii a[N];
int main() {
  int n;
  int64 m;
  scanf("%d%lld", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &a[i].first, &a[i].second);
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    if (m <= a[i].second) {
      printf("%d\n", a[i].first);
      break;
    }
    m -= a[i].second;
  }

  return 0;
}


Measured memory_bytes: 1024
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def make_row_group(grid):
    row_group = []
    current_group = []
    first_stb = True
    group_cnt = 0
    for ridx, row in enumerate(grid):
        if not "#" in row:
            current_group.append(ridx)
        else:
            if first_stb:
                first_stb = False
                current_group.append(ridx)
            else:
                row_group.append(current_group)
                current_group = [ridx]

    row_group.append(current_group)
    return row_group

def stb_in_col(grid, rows, cidx):
    for ridx in rows:
        if grid[ridx][cidx] == "#":
            return True
    return False

def set_number(grid, rows, cnt):
    w = len(grid[0])
    first_stb = True
    for cidx in range(w):
        if not stb_in_col(grid, rows, cidx):
            for ridx in rows:
                ans_grid[ridx][cidx] = cnt
        else:
            if not first_stb:
                cnt += 1
            else:
                first_stb = False

            for ridx in rows:
                ans_grid[ridx][cidx] = cnt

    return cnt


h, w, k = li()
grid = [lc() for _ in range(h)]

# 行をグループ化
row_group = make_row_group(grid)

# 各行グループについて、列にいちごが現れるまで数字を置く
ans_grid = [[-1 for _ in range(w)] for _ in range(h)]
cnt = 1
for rows in row_group:
    cnt = set_number(grid, rows, cnt)
    cnt += 1

for row in ans_grid:
    print(*row)


Measured memory_bytes: 8272
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e12;


int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> p(n),c(n),j(n);
    vector<vector<mp> > g(n);
    for(int i=0;i<n;i++)cin>>p[i];
    for(int i=0;i<n;i++)cin>>c[i];
    for(int i=0;i<n;i++)cin>>j[i];
    for(int i=0;i<m;i++){
	ll u,v,t;
	cin>>u>>v>>t;
	u--,v--;
	g[u].push_back( mp(t,v) );
	g[v].push_back( mp(t,u) );
    }
    vector<ll> dis(n,inf);
    dis[0] = 0;
    priority_queue<mp,vector<mp> ,greater<mp> > q;
    q.push( mp(0,0) );
    while( !q.empty() ){
	mp now = q.top();
	q.pop();
	ll nn = now.second;
	ll cost = now.first;
	if( dis[nn] != cost ) continue;
	for(int i=0;i<g[nn].size();i++){
	    ll next = g[nn][i].second;
	    ll ncost = cost + g[nn][i].first;
	    if( dis[next] <= ncost )continue;
	    dis[next] = ncost;
	    q.push( mp( ncost, next) );
	}
    }
    vector<ll> pan(n,-inf);
    //for(int i=0;i<n;i++)cout<<dis[i]<<endl;
    priority_queue<mp > que;
    for(int i=0;i<n;i++){
	pan[i] = p[i]-dis[i];
	que.push( mp(  p[i]  -dis[i], i) );
    }
    while( !que.empty() ){
	mp now = que.top();
	que.pop();
	ll nn = now.second;
	ll cost = now.first;
	if( pan[nn] > cost ) continue;
	for(int i=0;i<g[nn].size();i++){
	    ll next = g[nn][i].second ;
	    ll ncost = cost - g[nn][i].first ;
	    if( pan[next] >= ncost )continue;
	    pan[next] = ncost;
	    que.push( mp( ncost, next) );
	}
    }
    vector<ll> ans(k,-inf);
    for(int i=0;i<n;i++){
	//cout<<pan[i]<<' '<<dis[i]<<' '<<i<<endl;
	ans[c[i]-1] = max( ans[c[i]-1] , pan[i] - dis[i] + j[i] ) ;
    }

    for(int i=0;i<k;i++)cout<<ans[i]<<endl;
    

    return 0;
}



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

vector<long> div(long n) {
  vector<long> v;
  for (long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i * i != n) v.push_back(n / i);
    }
  }
  sort(begin(v), end(v));
  return v;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long N;
  cin >> N;
  vector<long> A(N);
  for (long i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  set<long> SE;
  set<long> NG;
  for (long i = 0; i < N; i++) {
    if (SE.count(A.at(i))) {
      NG.insert(A.at(i));
    }
    if (NG.count(A.at(i))) {
      continue;
    }
    for (auto a : div(A.at(i))) if (SE.count(a)) goto NG;
    SE.insert(A.at(i));
    NG:;
  }
  int ans = 0;
  for (auto se : SE) if (!NG.count(se)) ans++;
  cout << ans << "\n";
}

Measured memory_bytes: 14204
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
		while(true){
            String x = sc.next();
			int ans = 0;
			if(x.equals("0")){
				break;
			}else{
				for(int i=0; i<x.length(); i++){
					ans += Integer.parseInt(String.valueOf(x.charAt(i)));
				}
			}
			System.out.println(ans);
		}
	}
}



Measured memory_bytes: 26704
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
ll dp[110000];
int main()
{
    int n,W;
    cin >> n >> W;
    rep(i,n){
        int w;ll v;
        cin >> w >> v;
        for(int j = W;j >= 0;j--){
            if(j+w<=W)dp[j+w] = max(dp[j+w],dp[j]+v);
        }
    }
    cout << dp[W] << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

    static class Edge {
        int from, to;

        public Edge(int from, int to) {
            this.from = from;
            this.to = to;
        }
    }

    static void bfs() {
        visited = new boolean[N];
        visited[0] = true;
        dist = new int[N];
        Arrays.fill(dist, -1);
        dist[0] = 0;
        Deque<Integer> deq = new ArrayDeque<>();
        deq.offer(0);

        while (!deq.isEmpty()) {
            Integer node = deq.poll();

            for (Edge e : graph.get(node)) {
                if (visited[e.to]) continue;
                dist[e.to] = dist[node] + 1;
                visited[e.to] = true;
                deq.offer(e.to);
            }
        }
    }

    static int N;
    static List<List<Edge>> graph;
    static boolean[] visited;
    static int[] dist;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = Integer.parseInt(sc.next());
        graph = new ArrayList<>();
        for (int i = 0; i < N; ++i) graph.add(new ArrayList<>());

        for (int i = 0; i < N; ++i) {
            int id = Integer.parseInt(sc.next());
            int degree = Integer.parseInt(sc.next());
            for (int j = 0; j < degree; ++j) {
                int v = Integer.parseInt(sc.next());
                graph.get(i).add(new Edge(i, v-1));
            }
        }

        bfs();

        for (int i = 0; i < N; ++i) {
            System.out.println((i+1) + " " + dist[i]);
        }
    }
}


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

bool isPrime(int n){
    if(n<2) return false;
    else if(n==2) return true;
    else if(n%2==0) return false;

    int border = sqrt(n);
    for(int i=3;i<border;i+=2){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

int main(){
    int x;
    cin>>x;

    int ans=x;
    for(int i=x;;i++){
        if(isPrime(i)){
            ans = i;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

vector<ll> fact(1e5+1, 1), inv(1e5+1), invf(1e5+1, 1);

ll nck(ll n, ll k) {
    ll tmp = (MOD + fact[n] * invf[k]) % MOD;
    return (MOD + tmp * invf[n-k]) % MOD;
}

int main() {
    ll n, k; cin>>n>>k;
    vector<ll> v(n);
    for (int i = 0; i < n; ++i) cin>>v[i];
    sort(v.begin(), v.end());

    for (int i = 1; i <= n; ++i) {
        fact[i] = (i * fact[i-1]) % MOD;
        inv[i] = (i == 1) ? 1 : (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;
        invf[i] = (inv[i] * invf[i-1]) % MOD;
    }

    ll smax = 0LL, smin = 0LL;
    for (int i = 0; i < n; ++i) {
        if (i >= k - 1)
            smax = (smax + ((MOD + v[i] * nck(i, k-1)) % MOD)) % MOD;
        if (i <= n - k)
            smin = (smin + ((MOD + v[i] * nck(n-i-1, k-1)) % MOD)) % MOD;
    }

    cout << (MOD + smax - smin) % MOD << endl;


    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int a[7] = {1,3, 5, 7, 8, 10, 12};
int b[4] = {4, 6, 9, 11};
int main()
{
  int x, y;
  cin >> x >> y;
  if(x == 2 || y == 2){
    cout << "No" << endl;
    return 0;
  }
  int x1;
  int y1;
  REP(i,7){
    if(a[i] == x){
      x1 = 1;
    }
    if(a[i] == y){
      y1 = 1;
    }
  }
  REP(i,4){
    if(b[i] == x){
      x1 = 2;
    }
    if(b[i] == y){
      y1 = 2;
    }
  }
  cout << ((x1 == y1)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int i = 1;
        int tem;
        for(i=1;i<=num;i++){
            if(i%3==0){
                System.out.print(" "+i);
                continue;
            }
            tem=i;
            for(int count =0;tem>0;count++){
                if(tem%10==3){
                    System.out.print(" "+i);
                    break;
                }
                tem /= 10;
            }
        }
         System.out.println("");
    }
}


Measured memory_bytes: 28524
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  string a;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0') a.push_back('0');
    else if(s[i]=='1') a.push_back('1');
    else if(s[i]=='B' && a.size()>0)a.pop_back();
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
using namespace std;
 
signed main(){
    int N;cin>>N;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];
    long long ans=LLONG_MAX;
    int sig[2]={1,-1};
    REP(j,2){ 
        long long sum=0;
        long long count=0;
        REP(i,N){
            sum+=A[i];
            if(i%2==0&&sig[j]*sum<=0){
                count+=llabs(sum-sig[j]*1);
                sum=sig[j]*1;
            }
            if(i%2==1&&sig[j]*sum>=0){
                count+=llabs(sum+sig[j]*1);
                sum=-1*sig[j];
            }
        }
        ans=min(ans,count);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long mod = 1000000007;

template<typename T>
void max_self(T& a, T b)
{
	a = max(a, b);
}
int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	string s, t;
	cin >> s >> t;
	vvi dp(sz(s) + 1, vi(sz(t) + 1));
	for (int i = 0; i < sz(s); i++)
	{
		for (int j = 0; j < sz(t); j++)
		{
			if (s[i] == t[j])
				max_self(dp[i + 1][j + 1], dp[i][j] + 1);
			max_self(dp[i + 1][j], dp[i][j]);
			max_self(dp[i][j + 1], dp[i][j]);
		}
	}
	int ic = sz(s), jc = sz(t);
	int max_cur = INT_MIN;
	for (int i = 0; i < sz(dp); i++)
		for (int j = 0; j < sz(dp[i]); j++)
		{
			if (dp[i][j] > max_cur)
			{
				max_cur = dp[i][j];
				ic = i;
				jc = j;
			}
		}
	
	vector<char> res;

	while (ic > 0 && jc > 0)
	{
		if (s[ic - 1] == t[jc - 1])
		{
			res.push_back(s[ic - 1]);
			ic--; jc--;
		}
		else if (dp[ic - 1][jc] > dp[ic][jc - 1])
			ic--;
		else
			jc--;
	}
	reverse(all(res));
	for (int i = 0; i < sz(res); i++)
		cout << res[i];
	return 0;
}

Measured memory_bytes: 35584
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define int long long
#define pb emplace_back
#define eb pb
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<ppr, Vppr,greater<ppr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 330;
const int SIZE = SIZE2;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
typedef pair<ld, ut> pld;
#define endl "\n" //インタラクティブでは消す
ut N, M, K, L, Q, D, H, W;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;

VI edges[SIZE];
LL vals[SIZE], maps2[SIZE2][SIZE2], answer = zero;
LL maps[SIZE2][SIZE2];
int C[SIZE];
LL solve() {
	int N;
	cin >> N;
	LL A, B;
	cin >> A >> B;
	REP(i, N) {
		int x;
		cin >> x;
		if (x <= A)
			C[0]++;
		else if (x <= B)
			C[1]++;
		else
			C[2]++;
	}
	cout << min(C[0], min(C[1], C[2])) << endl;
	return 0;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(0);
	solve();
	cin >> N;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>

int N;

void func(std::string s, int n) {
    if (s.size() == N) {
        std::cout << s << std::endl;
    } else {
        for (int i = 0; i < n + 1; ++i) {
            auto s_ = s;
            s_ += 'a' + i;
            func(s_, std::max(n, i + 1));
        }
    }
}

int main() {

    std::cin >> N;

    func("", 0);

    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long double ld;

const int MAX = 501,IINF = INT_MAX;
const ld LDINF = 1e100;
int H,W,sx,sy,gx,gy;
ld mincost[MAX][MAX][2]; // mincost[][][0] => from start, [1] = > from star
char c[MAX][MAX];
bool ban[MAX][MAX];
vector<int> star,plane;
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

inline bool isValid(int x,int y) { return 0 <= x && x < W && 0 <= y && y < H; }

inline void bfs(vector<int> sp,vector<int> Forbidden,int type){
  rep(i,H)rep(j,W) mincost[i][j][type] = LDINF, ban[i][j] = false;
  queue<int> que;
  rep(i,(int)sp.size()) que.push(sp[i]), mincost[sp[i]/W][sp[i]%W][type] = 0;
  rep(i,(int)Forbidden.size()) ban[Forbidden[i]/W][Forbidden[i]%W] = true;

  while(!que.empty()){
    int cur = que.front(); que.pop();
    rep(i,4){
      int nx = cur % W + dx[i], ny = cur / W + dy[i];
      if( c[ny][nx] == '#' ) continue;
      if( ban[ny][nx] ) continue;
      if( mincost[ny][nx][type] == LDINF ) {
        mincost[ny][nx][type] = mincost[cur/W][cur%W][type] + 1;
        que.push(nx+ny*W);
      }
    }
  }
}

bool check(ld E){
  ld T = 0;

  rep(i,(int)plane.size()){
    int x = plane[i] % W, y = plane[i] / W;
    T += min(mincost[y][x][0],mincost[y][x][1]+E);
  }

  ld len = plane.size();
  return len * E > T;
}

int main(){
  cin >> W >> H;
  rep(i,H)rep(j,W){
    cin >> c[i][j];
    if( c[i][j] == 's' ) sx = j, sy = i, c[i][j] = '.';
    if( c[i][j] == 'g' ) gx = j, gy = i;
    if( c[i][j] == '*' ) star.push_back(j+i*W);
    if( c[i][j] == '.' ) plane.push_back(j+i*W);
  }

  vector<int> sp,forbidden;
  sp.push_back(gx+gy*W);
  forbidden = star;
  forbidden.push_back(gx+gy*W);
  bfs(sp,forbidden,0);

  sp = star;
  forbidden.push_back(gx+gy*W);
  //forbidden.clear();
  bfs(sp,forbidden,1);

  ld L = 0, R = 1e20, M = 0;
  rep(i,100){
    M = ( L + R ) * (ld)0.5;
    if( check(M) ) R = M;
    else           L = M;
  }

  cout << setiosflags(ios::fixed) << setprecision(20) << min((ld)mincost[sy][sx][0],(ld)mincost[sy][sx][1]+L) << endl;

  return 0;
}

Measured memory_bytes: 10456
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

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

    bool ret = false;
    for (int i = 0; i <= 7; i++) {
        string a = s.substr(0, i), b = s.substr(s.size() - (7 - i), 7 - i);
        if (a + b == "keyence")ret = true;
    }

    cout << (ret ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        for(int i = 0; i < 3; i++)
            ans += (s.charAt(i) == '1') ? 1 : 0;
        System.out.println(ans);
    }
}

Measured memory_bytes: 22868