akhauriyash/Code-Regression huggingface dataset:
const 
  base = 1000000007;
var
  a,f:array[0..1010,0..1010] of int64;
  n,m,j,i:longint;
  s : ansistring;
BEGIN
  ///assign(input,'a.in'); reset(input);
  readln(n,m);
  for i:=1 to n do begin
    readln(s);
    for j:=1 to m do if s[j]='.' then a[i,j]:=1 else a[i,j]:=0;
  end;
 
  fillchar(f,sizeof(f),0);
  f[1,1] := 1;
  for i:=1 to n do
    for j:=1 to m do
      if a[i,j]=1 then f[i,j] := (f[i,j] + f[i-1,j] + f[i,j-1]) mod base;
  writeln(f[n,m]);
END.

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

#ifdef loc
    #include "loc_debug.h"
#else
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif

typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i, s, n)  for(int i = s; i <= n; ++i)
#define rev(i, n, s)  for(int i = n; i >= s; --i)
#define fore(x, a) for(auto &&x : a)
#define fill(a, x) memset((a), (x), sizeof(a))
#define tcase int __t; cin >> __t; rep(tc, 1, __t)
#define F first
#define S second
#define gc getchar

const int mod = 1000000007;
#define _ %mod
const int N = 200005;

int b[N], n, d[N], tree[N];
string s;
vector<int> c[256];

int read(int x) {
    int ret = 0;
    while(x > 0) {
        ret += tree[x];
        x -= (x & -x);
    }
    return ret;
}

void upd(int x, int v) {
    while(x < N) {
        tree[x] += v;
        x += (x & -x);
    }
}

struct Sort {
    bool operator()(int o1, int o2) {
        int s1 = sz(c[s[o1]]), s2 = sz(c[s[o2]]);
        int a1 = 0, a2 = 0;
        if(o1 >= c[s[o1]][s1 / 2]) {
            a1 = 2;
        }
        if(o2 >= c[s[o2]][s2 / 2]) {
            a2 = 2;
        }
        if((s1 & 1) && o1 == c[s[o1]][s1 / 2]) {
            a1 = 1;
        }
        if((s2 & 1) && o2 == c[s[o2]][s2 / 2]) {
            a2 = 1;
        }
        if(a1 != a2) {
            return a1 < a2;
        }
        int p1 = lower_bound(all(c[s[o1]]), o1) - c[s[o1]].begin(),
            p2 = lower_bound(all(c[s[o2]]), o2) - c[s[o2]].begin();
        int l1 = (a1 == 2) ? c[s[o1]][s1 - 1 - p1] : o1,
            l2 = (a2 == 2) ? c[s[o2]][s2 - 1 - p2] : o2;
        if(a1 == 2) {
            return l1 > l2;
        }
        return l1 < l2;
    }
};

int main() {
    fast_io;
    cin >> s;
    map<char, int> a;
    n = sz(s);
    rep(i, 0, n - 1) {
        a[s[i]]++;
    }
    int odd = 0;
    fore(x, a) {
        odd += (x.S & 1);
    }
    if(odd >= 2) {
        cout << -1 << endl;
        return 0;
    }
    rep(i, 0, n - 1) {
        c[s[i]].eb(i);
    }
    rep(i, 0, n - 1) {
        b[i] = i;
    }
    sort(b, b + n, Sort());
    pra(b, n - 1);
    rep(i, 0, n - 1) {
        d[b[i]] = i + 1;
    }
    ll res = 0;
    rep(i, 0, n - 1) {
        res += read(N - 1) - read(d[i]);
        upd(d[i], 1);
    }
    cout << res << endl;
    return 0;
}


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

int main() {
    int n, k; cin >> n >> k;
    map<int, long long> m;
    vector<int> v(n+1, 0);
    m[0]++; 
    long long ans = 0; int sum = 0;
    for (int i = 1; i < n+k+1; i++) {
        if (i-k >= 0) {
            m[v[i-k]]--;
            ans += m[v[i-k]];
        }
        if (i <= n) {
            int a; cin >> a;
            sum += a-1; sum %= k;
            m[sum]++; v[i] = sum;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define pb push_back

using namespace std;

int n, m, d[(int)1e5 + 7], ans;
vector<int>g[(int)1e5 + 7], w;

void dfs(int v){
    if(d[v]) return;
    d[v] = 1;
    for(auto to : g[v]){
        dfs(to);
        d[v] = max(d[v], d[to] + 1);
        ans = max(d[v], ans);
    }
}

int main(){
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
    }
    for(int i = 1; i <= n; i++)
        dfs(i);
    cout << ans - 1;
}


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

typedef long long ll;

int main() {
    int N, D;
    cin >> N >> D;
    vector<int> X(N), Y(N);
    rep(i, N) cin >> X[i] >> Y[i];
    two_sat ts(N * 2);
    rep(i, N) {
        ts.add_clause(i * 2, true, i * 2 + 1, true);
    }
    rep(i, N - 1) {
        for (int j = i + 1; j < N; j++) {
            if (abs(X[i] - X[j]) < D) {
                ts.add_clause(i * 2, false, j * 2, false);
            }
            if (abs(X[i] - Y[j]) < D) {
                ts.add_clause(i * 2, false, j * 2 + 1, false);
            }
            if (abs(Y[i] - X[j]) < D) {
                ts.add_clause(i * 2 + 1, false, j * 2, false);
            }
            if (abs(Y[i] - Y[j]) < D) {
                ts.add_clause(i * 2 + 1, false, j * 2 + 1, false);
            }
        }
    }
    if (ts.satisfiable()) {
        cout << "Yes\n";
        auto ans = ts.answer();
        rep(i, N) {
            if (ans[i * 2]) cout << X[i] << "\n";
            else cout << Y[i] << "\n";
        }
    } else {
        cout << "No\n";
    }
}

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

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)
typedef complex<Real> P;

int n,p;
ll dp[52][2];

int main(){
  cin>>n>>p;
  dp[0][0] = 1;
  REP(i,n){
    int a;
    cin>>a;
    a%=2;
    if(a==1){
      dp[i+1][0] = dp[i][0] + dp[i][1];
      dp[i+1][1] = dp[i][0] + dp[i][1];
    }else{
      dp[i+1][0] = 2ll*dp[i][0];
      dp[i+1][1] = 2ll*dp[i][1];
    }
  }
  cout<<dp[n][p]<<endl;
  return 0;
}


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

typedef long long llong;

const int N = 2050;

llong A[N];
llong B[N];

const int inf = (int)1e9 + 42;

int main() {
    int n;
    scanf("%d", &n);
    llong x;
    scanf("%lld", &x);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &A[i]);
    }
    for (int i = 0; i < n; i++) {
        B[i] = inf;
    }
    llong ans = (llong)1e18;
    for (int k = 0; k <= n; k++) {
        llong sum = k * x;
        for (int i = 0; i < n; i++) {
            sum += (B[i] = min(B[i], A[(i + n - k) % n]));
        }
        ans = min(ans, sum);
    }
    printf("%lld\n", ans);
}


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

int main ()
{
	int n, a = 0, b = 0, c = 0, d = 0;
	cin >> n;
	int num[n];
	for (int i = 0; i < n; ++ i)
	{
		cin >> d;
		num[i] = d % 4;
	}
	for (int i = 0; i < n; ++ i)
	{
		switch(num[i])
		{
			case 0: ++ a; break;
			case 1: ++ b; break;
			case 2: ++ c; break;
			case 3: ++ b; break;
		}
	}
	if (b == 0) cout << "Yes" << endl;
	else 
	{
		if (a == 0) cout << "No" << endl;
		else 
		{
			if (c == 0 && a >= b - 1) cout << "Yes" << endl;
			else if (c != 0 && a >= b) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	} 
	return 0;
} 

Measured memory_bytes: 640
n = gets.to_i
word = []
while line = gets
  line.chomp! 
  word.push(line)
end
count = []
ww = []
x = 0
while x < n do
    i = 0
    while i < 3 do
        count.push(word[i][x])
        i += 1
    end
    ww.push(3 - count.count(count.group_by(&:itself).max_by{|_,v| v.size}.first))
    count = []
    x += 1
end
puts ww.inject(:+)

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int h1 = scanner.nextInt();
        int m1 = scanner.nextInt();
        int h2 = scanner.nextInt();
        int m2 = scanner.nextInt();
        int s = scanner.nextInt();

        int duration = 60 - m1 + (h2 - h1 - 1) * 60 + m2;
        int out = (duration - s) > 0 ? duration - s : 0;
        System.out.println(out);
    }
}


Measured memory_bytes: 27048
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

const string YES = "YES";
const string NO = "NO";

void solve(std::string S) {
  ll lose = 0;
  for (ll n = 0; n < S.length(); n++) {
    if (S[n] == 'x') {
      lose++;
    }
  }

  if (lose > 7) {
    print(NO);
  } else {
    print(YES);
  }
}

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
	llong N;
	map<string, llong> m;
	string X;

	cin >> N;

	string s;
	llong t;
	llong sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> s >> t;
		sum += t;
		m[s] = sum;
	}

	cin >> X;

	cout << m[s] - m[X] << endl;

	return 0;
}

Measured memory_bytes: 256
/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
signed main()
{
    fastio;
    int n;
    cin>>n;
    vi a(n+1);
    for(int i=1;i<n;i++)
    {
        a[i]++;
        for(int j=2;j*i<n;j++)
        {
            a[i*j]++;
        }
    }
    int ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=a[i];
        //cout<<i<<" "<<a[i]<<endl;
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
}



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

using namespace std;

template<typename T>
struct UnionFind{
    vector<T>data;
    UnionFind(T n):data(n,-1){}
    void unite(T x,T y){
        x=root(x);y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];data[y]=x;
        }
    }
    T root(T x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    bool same(T x,T y){
        return root(x)==root(y);
    }
    T size(T x){
        return -data[root(x)];
    }
};

int main(){
    int n,q;
    cin>>n>>q;
    UnionFind<int>uf(n);
    for(int i=0;i<q;++i){
        int com,x,y;
        cin>>com>>x>>y;
        if(com)uf.same(x,y)?cout<<"1"<<endl:cout<<"0"<<endl;
        else uf.unite(x,y);
    }
    return 0;
}

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

int st[50][2];
int cp[50][2];


int main(void) {

	int i, j;
	int n, m;
	int disx, disy, distance;
	int mindis;
	int checkpoint;

	scanf("%d%d", &n, &m);

	for (i = 0; i < n; i++) {
		scanf("%d%d", &st[i][0], &st[i][1]);
	}

	for (i = 0; i < m; i++) {
		scanf("%d%d", &cp[i][0], &cp[i][1]);
	}

	//各学生から一番近いチェックポイントを求めて各自出力する//
	for (i = 0; i < n; i++) {//iは学生番号を表す//
		mindis = -1;
		for (j = 0; j < m; j++) {//jはチェックポイントを表す//
			if (st[i][0] > cp[j][0]) {
				disx = st[i][0] - cp[j][0];
			}
			else {
				disx = cp[j][0] - st[i][0];
			}

			if (st[i][1] > cp[j][1]) {
				disy = st[i][1] - cp[j][1];
			}
			else {
				disy = cp[j][1] - st[i][1];
			}

			distance = disx + disy;

			if (mindis < 0) {
				mindis = distance;
				checkpoint = 1;
			}

				if (distance < mindis) {
					mindis = distance;
					checkpoint = j + 1;
				}

					   
		}
		printf("%d\n", checkpoint);

	}

	
	return 0;
}

Measured memory_bytes: 128
n = int(input())
H = list(map(int, input().split(' ')))

def max_heapify(i):
    l = (i+1)*2-1
    r = (i+1)*2
    largest = i
    if l < n and H[l] > H[i]:
        largest = l
    else:
        largest = i
    if r < n and H[r] > H[largest]:
        largest = r

    if largest != i:
        H[i], H[largest] = H[largest], H[i]
        max_heapify(largest)

def print_elements(lst):
    for ele in lst:
        print(' {}'.format(ele), end='')
    print('')

for i in range(int(n/2), -1, -1):
    max_heapify(i)

print_elements(H)



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

void hantei(vector<int> &p,vector<int> &c,vector<int> r,int i,int &N,int n,int &G,int sum){
  if(i<p.size()-1)hantei(p,c,r,i+1,N,n,G,sum);
  sum+=100*p[i]*(i+1)+c[i];
  n+=p[i];
  r[i]=p[i];
  int k=0,j;
  for(j=p.size()-1;j>=0;j--)if(!r[j]){k=j;break;}
  if(sum>=G)N=min(n,N);
  else if(sum+100*(k+1)*(p[k]-1)<G&&i<p.size()-1)hantei(p,c,r,i+1,N,n,G,sum);
  else if(sum+100*(k+1)*p[k]>=G){
    n+=(G-sum)/(100*(k+1));
    if(((G-sum)%(100*(k+1))))n++;
    N=min(n,N);
    r[k]=(G-sum)/(100*(k+1));
  }
  //for(int a=0;a<p.size();a++)cout <<r[a]<<"/"<<p[a]<<",";cout<<"A."<< n <<endl;
}

int main() {
  int D,i,G,N=1000;
  cin>>D>>G;
  vector<int> p(D),c(D),r(D);//p:100i点の問題数,c:完答ボーナス,r:100i点の問題の正当数
  for(i=0;i<D;i++)cin>>p[i]>>c[i];
  int n=0;
  if(100*D*p[D-1]>=G){
    n+=G/(100*D);
    if(G%(100*D))n++;
    N=min(n,N);
  }
  hantei(p,c,r,0,N,0,G,0);
  cout << N <<endl;
}

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

int main() {
  int n, y;
  cin >> n >> y;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; i + j <= n; ++j) {
      int k = n - i - j;
      if (10000 * i + 5000 * j + 1000 * k == y) {
        printf("%d %d %d\n", i, j, k);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define eni(x) template < class c > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
template < class c > struct rge { c b, e; };
template < class c > rge<c> range(c i, c j) { return rge<c>{i, j}; }
template < class c > auto dud(c* x) -> decltype(cerr << *x, 0);
template < class c > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; return * this; }
eni(==) return * this << range(begin(i), end(i)); }
template < class c, class b > debug & operator <<(pair < b, c > d) {
  return * this << "(" << d.first << ", " << d.second << ")";
}
template < class c > debug & operator <<(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  return * this << "]";
}
#else
template < class c > debug & operator <<(const c&) { return * this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000050
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll n;
    cin>>n;
    pll a[n];
    ll x=2e9,y=-2e9,ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i].ff>>a[i].ss;
        x=min(x,a[i].ff+a[i].ss);
        y=max(y,a[i].ff+a[i].ss);
    }
    ans=y-x;
    x=2e9,y=-2e9;
    for(int i=0;i<n;i++){
        x=min(x,a[i].ff-a[i].ss);
        y=max(y,a[i].ff-a[i].ss);
    }
    ans=max(ans,y-x);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6776
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int[] A=new int[100001];
		for(int i=1;i<=n;i++){
			A[i]=scanner.nextInt();
			
		}
		
		for(int i=1;i<=n;i++){
			StringBuilder builder=new StringBuilder();
			builder.append("node "+i+": key = "+A[i]+", ");
			if(i/2>=1)
				builder.append("parent key = "+A[i/2]+", ");
			if(2*i<=n)
				builder.append("left key = "+A[2*i]+", ");
			if(2*i+1<=n)
				builder.append("right key = "+A[2*i+1]+", ");
			//builder.append("\n");
			System.out.println(builder);
		}
	}

}



Measured memory_bytes: 28276
import java.util.*;
class Main {
	public static void main(String[] agrs) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		while(n-->0) {
			double[] A = new double[]{in.nextDouble(), in.nextDouble()};
			double[] B = new double[]{in.nextDouble(), in.nextDouble()};
			double[] C = new double[]{in.nextDouble(), in.nextDouble()};
			double[] D = new double[]{in.nextDouble(), in.nextDouble()};
			double dist1 = (A[0] - B[0]) * (C[1] - D[1]);
			double dist2 = (C[0] - D[0]) * (A[1] - B[1]);
			System.out.println(dist1-dist2==0.0?"YES":"NO");
		}
	}
}

Measured memory_bytes: 12000
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 10, M = 1e3 + 10;
const int INF = INT_MAX;
const db PI = acos(-1);

vi g[N];
bool vis[N];

void test();
int bfs(int s);

int main() {
    fast_io();
    test();
    return 0;
}

void test() {
    int n, m;
    cin >> n >> m;
    for (int i = 0, x, y, z; i < m; ++i) {
        cin >> x >> y >> z;
        g[x].pb(y);
        g[y].pb(x);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (!vis[i]) {
            ans += bfs(i);
        }
    }
    cout << ans << "\n";
}

int bfs(int s) {
    queue < int > q;
    q.push(s);
    vis[s] = true;
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (auto &x: g[v]) {
            if (!vis[x]) {
                vis[x] = true;
                q.push(x);
            }
        }
    }
    return 1;
}


Measured memory_bytes: 6648
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0}; //次に行くところ
int dx[] = {0,1,0,-1}; //s上に同じ

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int k,n;
  cin >> k >> s;
  n = s.size();
  if (n > k){
    for (int i = 0; i < k; i++){
      cout << s[i];
    }
    cout << "...\n";
  }else{
    cout << s << '\n';
  }
  
  
  
  return 0;
}

Measured memory_bytes: 3624
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int ans = 0;
            Console.WriteLine(n > k ? k * x + (n - k) * y : n * x);
        }
    }
}

Measured memory_bytes: 11092
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

const int INF = INT_MAX / 2;

vector<int> acc_e;
vector<int> acc_w;

int main(void) {
    int N;
    cin >> N;
    string S;
    cin >> S;
    const int slen = (int) S.size();

    acc_e.resize(slen + 1, 0);
    acc_w.resize(slen + 1, 0);

    for (int i = 0; i < slen; i++) {
        acc_e[i + 1] = acc_e[i];
        acc_w[i + 1] = acc_w[i];
        if (S[i] == 'E') {
            acc_e[i + 1] += 1;
        } else {
            acc_w[i + 1] += 1;
        }
    }

    int ans = INF;

    for (int i = 0; i < N; i++) {
        chmin(ans, acc_w[i] + (acc_e[slen] - acc_e[i + 1]));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
typedef int weight;
struct edge
{
	int to; weight cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
typedef vector<vector<edge>> Graph;
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///


void dijkstra(Graph &g, vector<weight> &d, int s)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}


int main()
{
	int n, m, l;
	while (cin >> n >> m >> l, n)
	{
		Graph g(n*l+n);
		REP(i, m)
		{
			int a, b, d, e;
			cin >> a >> b >> d >> e;
			a--; b--;
			REP(j, l + 1)
			{
				int ta = j*n + a;
				int tb = j*n + b;
				g[ta].push_back(edge{ tb, e });
				g[tb].push_back(edge{ ta, e });
			}
			FOR(j, d, l + 1)
			{
				int ta = j*n + a;
				int tb = (j-d)*n + b;
				g[ta].push_back(edge{ tb, 0 });
				ta = (j - d)*n + a;
				tb = j*n + b;
				g[tb].push_back(edge{ ta, 0 });
			}
		}
		vector<weight> d(n*l + n);
		dijkstra(g, d, l*n);
		int ans = INF;
		REP(i, l + 1)
		{
			chmin(ans, (int)d[i*n + n - 1]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 6972
from math import sin, cos, radians, sqrt

a, b, C = map(float, input().split())
C = radians(C)
S = a * b * sin(C) * 0.5
h = 2.0 * S / a
c = sqrt(a ** 2 + b ** 2 - 2 * a * b * cos(C))
L = a + b + c
print("{:.10f}".format(S))
print("{:.10f}".format(L))
print("{:.10f}".format(h))



Measured memory_bytes: 5692
public class Main {

  private static void solve() {
    int n = ni();
    int a = ni();
    int b = ni();
    int[] t = na(n);
    
    int count = 0;
    for (int v : t) {
      if (a <= v && v < b) {
        count ++;
      }
    }
    out.println(n - count);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}


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

  lint ans=0;
  sort(l.begin(),l.end());
  for(int i=0;i+2<n;i++) {
    for(int j=i+1;j+1<n;j++) {
      for(int k=j+1;k<n;k++) {
        if(l[i]+l[j] > l[k]) { ans++; }
        else { break; }
      }
    }
  }

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int x = rei();
	int y = rei();
	if(x >= y){
		cout << 10 << endl;
	}
	else{
		cout << 0 << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
n = int(input())
tasks = [[int(x) for x in input().split()] for _ in range(n)]
tasks_sorted = sorted(tasks, key=lambda x:x[1])
task = 0
ret = "Yes"
for i in range(len(tasks_sorted)):
    task += tasks_sorted[i][0]
    if task > tasks_sorted[i][1]:
        ret = "No"
        break
print(ret)

Measured memory_bytes: 89860
input_int = int(input())
input_list = list(map(int,input().split()))
count_2 = 0
count_3_5 = 0

for i in input_list:
    if i % 2 == 0:
        count_2 += 1
        if i % 3 == 0 or i % 5 == 0:
            count_3_5 += 1

if count_2 == count_3_5:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
/*input
5
0 0 0 0 0
*/
#include <bits/stdc++.h>
using namespace std;
#define TEMPLATE

#ifdef TEMPLATE
	typedef long long ll;
	typedef long double ld;
	typedef complex<ld> cd;

	typedef pair<int, int> pi;
	typedef pair<ll,ll> pl;
	typedef pair<ld,ld> pd;

	typedef vector<int> vi;
	typedef vector<vi> vii;
	typedef vector<ld> vd;
	typedef vector<ll> vl;
	typedef vector<vl> vll;
	typedef vector<pi> vpi;
	typedef vector<vpi> vpii;
	typedef vector<pl> vpl;
	typedef vector<cd> vcd;
	typedef vector<pd> vpd;
	typedef vector<bool> vb;
	typedef vector<vb> vbb;
	typedef std::string str;
	typedef std::vector<str> vs;

	#define x first
	#define y second
	#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"

	const int MOD = 1000000007;
	const ll INF = std::numeric_limits<ll>::max();
	const int MX = 100101;
	const ld PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270L;

	template<typename T>
	pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x + b.x, a.y + b.y); }
	template<typename T>
	pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x - b.x, a.y - b.y); }
	template<typename T>
	T operator*(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.x + a.y * b.y); }
	template<typename T>
	T operator^(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.y - a.y * b.x); }

	template<typename T>
	void print(vector<T> vec, string name = ""){
		cout << name;
		for(auto u: vec)
			cout << u << ' ';
		cout << '\n';
	}

#endif

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N;
	cin >> N;
	vi sk(N+1);
	for (int i = 1; i <= N; ++i)
		cin >> sk[i];
	vi ats(N+1);
	for (int i = N; i > 0; i--)
	{
		int jau = 0;
		for (int j = 2*i; j <= N; j += i)
			jau ^= ats[j];

		if(jau != sk[i])
			ats[i] = 1;
	}
	vi visi;
	for (int i = 1; i <= N; ++i)
		if(ats[i])
			visi.push_back(i);

	printf("%d\n", visi.size());
	for(auto u: visi)
		printf("%d\n", u);
}

/* Look for:
* special cases (n=1?)
* overflow (ll vs int?)
* the exact constraints (multiple sets are too slow for n=10^6 :( ) 
* array bounds
*/
	

Measured memory_bytes: 3192
N, M = map(int, input().split())

edge = []
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    edge.append((a, b))
    graph[a].append(b); graph[b].append(a)

def dfs(now):
    searched[now] = True
    for next in graph[now]:
        if searched[next]:
            continue
        if min(now, next) == a and max(now, next) == b:
            continue
        dfs(next)

ans = M
for i in range(M):
    a, b = edge[i]
    searched = [False] * N
    dfs(0)
    if sum(searched) == N:
        ans -= 1

print(ans)


Measured memory_bytes: 9160
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    int h, w;
    scanf ("%d %d", &h, &w);
    int i, j;
    char* s = (char*)malloc (sizeof(char) * 10);
    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++) {
            scanf (" %s", s);
            if (strcmp (s, "snuke") == 0) {
                printf ("%c%d\n", 'A' + j, i + 1);
            }
        }
    }
    return 0;
}


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

using namespace std;


int C[3][3] = {};

bool ok(int a, int b, int c) {
    return a + b + c == -3;
}

int main() {
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> C[i][j];
        }
    }
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        for (int y = 0; y < 3; y++)
            for (int x = 0; x < 3; x++)
                if (C[y][x] == b) {
                    C[y][x] = -1;
                }
    }
    bool res = false;
    res |= ok(C[0][0], C[0][1], C[0][2]);
    res |= ok(C[1][0], C[1][1], C[1][2]);
    res |= ok(C[2][0], C[2][1], C[2][2]);
    res |= ok(C[0][0], C[1][0], C[2][0]);
    res |= ok(C[0][1], C[1][1], C[2][1]);
    res |= ok(C[0][2], C[1][2], C[2][2]);
    res |= ok(C[0][0], C[1][1], C[2][2]);
    res |= ok(C[0][2], C[1][1], C[2][0]);
    if(res){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod
 
signed main() {
    int N; cin>>N;
    vector<int> P(N);
    REP(i, N) cin>>P[i];
    int ans =0;
    int minP = P[0];
    FOR(i, 0, N){
        if(minP>=P[i]){
            ans++;
            minP = P[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
from copy import deepcopy
n,x = map(int,input().split())
a = list(map(int,input().split()))
a *= 2
als = deepcopy(a[:n])
ans = [sum(als)]
for k in range(1,n):
  for i in range(n):
    als[i] = min(als[i],a[n+i-k])
  ans.append(sum(als)+x*k)
print(min(ans))

Measured memory_bytes: 43780
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int maxn = 1e7 + 5;
const int MAX = 10000000;

int a,b;

int main()
{
   cin>>a>>b;
   if(a<=8&&b<=8)
   {
    puts("Yay!");
   }
   else 
   {
    puts(":(");
   }
    return 0;
}

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

const ll MAX_N = 110;
const ll MAX_W = 1000000010;
const ll MAX_V = 100010;
const ll inf = 1000000000000;
ll N, W;
ll w[MAX_N];
ll v[MAX_N];

ll dp[MAX_N][MAX_V];

ll rec(ll i, ll j) {
  if (dp[i][j] != inf) return dp[i][j];
  ll res;
  if (i == 0 && j == 0) res = 0;
  else if (i == 0) res = inf-1;
  else if (j < v[i-1]) res = rec(i-1, j);
  else res = min(rec(i-1, j), rec(i-1, j-v[i-1]) + w[i-1]);
  return dp[i][j] = res;
}

int main() {
  cin >> N >> W;
  for (ll i = 0; i < N; i++) cin >> w[i] >> v[i];

  for (ll i = 0; i < MAX_N; i++) {
    for (ll j = 0; j < MAX_V; j++) {
      dp[i][j] = inf;
    }
  }
  
  for (ll i = 0; i < MAX_V; i++) rec(N, i);
  ll ans;
  for (ll i = 0; i < MAX_V; i++) {
    if (dp[N][i] <= W) ans = i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 86144
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn main() {
    let N = get!(usize);
    let (A, B) = get!(usize, usize);
    let P = get!(Vec<usize>);

    let ans = cmp::min(
        cmp::min(
            P.iter().filter(|&p| p <= &A).count(),
            P.iter().filter(|&p| &A < p && p <= &B).count()
        ),
        P.iter().filter(|&p| p > &B).count()
    );

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>

int main(){

int n,i,j,k,h,b,f,r,v;
int a[4][3][10] = {0};
v = 0;
scanf("%d",&n);

for(i = 0; i < n; i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
a[b-1][f-1][r-1] += v;
}

for(h = 0; h < 4; h++){
  for(k = 0; k < 3; k++){
    for(j = 0; j < 10; j++){
    printf(" %d",a[h][k][j]);
    }
  printf("\n");
  }
if(h < 3){
printf("####################\n");
}
}
return 0;
}


Measured memory_bytes: 2044
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_7_A&lang=jp
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
inline void my_io() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cout << fixed << setprecision(10);
}
/*
2 2 3
0 1
0 0
1 1
*/
int x, y, e;
vector<vector<int>>G;//グラフの隣接リスト表現
vector<int>match;//マッチングのペア
vector<bool>used;//辺の反転のためのフラグ
//uとvを結ぶ辺をグラフに追加する
void add_edge(int u, int v) {
	G[u].push_back(v);
	G[v].push_back(u);
}
//増加パスをDFSで探す
bool bi_dfs(int v) {
	used[v] = true;
	for (int i = 0; i<G[v].size(); i++) {
		int u = G[v][i], w = match[u];
		if (w < 0) {
			match[v] = u;
			match[u] = v;
			return true;
		}
		else if (used[w] == false) {
			if (bi_dfs(w)) {
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
	}
	return false;
}
//二部グラフの最大マッチングを求める
int bipartitea_matching() {
	int res = 0;
	fill(match.begin(), match.end(), -1);
	for (int v = 0; v<x+y; v++) {
		if (match[v]<0) {//頂点vのマッチングのペアが現時点でない場合
			fill(used.begin(), used.end(), false);
			if (bi_dfs(v)) {
				res++;
			}
		}
	}
	return res;
}

signed main() {
	cin >> x >> y >> e;
	G.resize(x + y);
	match.resize(x + y);
	used.resize(x + y);
	for (int i = 0; i < e; i++) {
		int u, v;
		cin >> u >> v;
		v += x;
		add_edge(u, v);
	}
	cout << bipartitea_matching() << endl;
	return 0;
}




Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	int N,ans=0;
	cin >> N;
	if(N%2){
		ans = N/2;
	}else{
		ans = N/2-1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long INF=1000000000000;

//関数

long F(long x,long y){//正の整数
    long sizex=1,sizey=1;
    while(x>9){
        sizex++;
        x/=10;
    }
    while(y>9){
        sizey++;
        y/=10;
    }
    
    return max(sizex,sizey);
}


int main() {
    
    
    //入力
    long N;
    cin>>N;
    
    //計算
    long rootN=1;//floor
    while(rootN*rootN<=N){
        rootN++;
    }
    
    
    long ans=INF;
    for(int i=1;i<=rootN;i++){
        if(N%i==0) ans=min(ans,F(i,N/i));
    }
    
    //出力
    cout<<ans<<endl;
}

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

int main() {
	int L, R;
	cin >> L >> R;
	int ans = 2018;
	bool ok = true;
	for (int i = L; i < R; i++){
		for (int j = i + 1; j <= R; j++){
			ans = min(((i%2019)*(j%2019))%2019, ans);
			if (ans == 0) {
				ok = false;
				break;
			}
		}
		if (!ok) break;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=1e5+100;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int fa[N];inline int find(int x) { return fa[x]==x?x:find(fa[x]); }
struct E{ int u,v,w; }e[N];
LL tag[N];
int siz[N];
int main()
{
	int n=gi(),i,a,b;LL ans;
	for (i=1;i<n;i++) e[i].u=gi(),e[i].v=gi(),e[i].w=gi();
	sort(e+1,e+n,[&](E a,E b){return a.w>b.w;});
	for (i=1;i<=n;i++) fa[i]=i,siz[i]=1;
	for (i=1;i<n;i++) {
		a=find(e[i].u),b=find(e[i].v);
		if (siz[a]<siz[b]) swap(a,b);
		tag[a]+=1LL*e[i].w*siz[b];tag[b]+=1LL*e[i].w*siz[a]-tag[a];
		fa[b]=a;siz[a]+=siz[b];
	}
	for (i=1;i<=n;i++) {
		for (ans=0,a=i;;a=fa[a]) {
			ans+=tag[a];
			if (a==fa[a]) break;
		}
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 4480
/**
  @file c.cpp
  @title C - Anti-Division
  @brief https://atcoder.jp/contests/abc131/tasks/abc131_c
**/

#include <bits/stdc++.h>
using namespace std;

template <class T>
void show(vector<T>& v) {
  for (uint i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << "\n";
}

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

  return gcd(b, a % b);
}

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

int main() {
  long long A, B, C, D;
  cin >> A >> B >> C >> D;

  long long min_divC  = (A - 1) / C;
  long long max_divC  = (B + 0) / C;
  long long min_divD  = (A - 1) / D;
  long long max_divD  = (B + 0) / D;
  long long min_divCD = (A - 1) / lcm(C, D);
  long long max_divCD = (B + 0) / lcm(C, D);

  long long ans = B - A + 1;
  if (min_divC == 0 && max_divC == 0) {
    // do nothing
  } else {
    ans -= (max_divC - min_divC);
  }

  if (min_divD == 0 && max_divD == 0) {
    // do nothing
  } else {
    ans -= (max_divD - min_divD);
  }

  if (min_divCD == 0 && max_divCD == 0) {
    // do nothing
  } else {
    ans += (max_divCD - min_divCD);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
"use strict";

const main = arg => {

    const input = arg.trim().split(" ");

    const a = parseInt(input[0]);
    const b = parseInt(input[1]);

    const mx = Math.max(a, b);
    const mn = Math.min(a, b);

    if ((mx - mn) % 2 == 0) {
        console.log((mx + mn) / 2);
    } else {
        console.log("IMPOSSIBLE");
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30288