akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  int a;
  cin>>a;
  V<P<double,string>> b(a);
  fo(i,a){
    cin>>b[i].fi>>b[i].se;
  }
  double c=0;
  fo(i,a){
    if(b[i].se=="JPY")
      c+=b[i].fi;
    else
      c+=b[i].fi*380000.0;
  }
  cout<<yuko(6)<<c<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int D = sc.nextInt();
        
        switch(D){
            case 25:
                System.out.println("Christmas");
                break;
            case 24:
                System.out.println("Christmas Eve");
                break;
            case 23:
                System.out.println("Christmas Eve Eve");
                break;
            case 22:
                System.out.println("Christmas Eve Eve Eve");
                break;
        }
    }
}


Measured memory_bytes: 23764
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
R,C=[],[]
x=51
r=range(x*x)
for u,v,a,b in t[:m]:
 for i in r:k=(i+a)*x;R+=k+u,k+v;C+=i*x+v,i*x+u;D+=b,b
i=0
for c,d in t[m:]:
 i+=1
 for j in r:R+=j*x+i,;C+=(j+c)*x+i,;D+=d,
d=csgraph.dijkstra(csr_matrix((D,(R,C)),[8**6]*2),1,min(j,s)*x+1)
for i in range(2,n+1):print(int(min(d[i::x])))

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

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

    ll a[n];
    ll b[n];
    rep(i, 0, n){
        cin >> a[i];
    }
    rep(i, 0, n){
        cin >> b[i];
    }

    ll c[n];
    ll count = 0;
    ll m = 0;
    rep(i, 0, n){
        c[i] = a[i] - b[i];
        if(c[i] < 0){
            m += abs(c[i]);
            count++;
        }
    }

    sort(c, c + n);
    rrep(i, n - 1, 0){
        if(m > 0){
            if(c[i] > 0){
                m -= c[i];
                count++;
            }else{
                cout << -1 << endl;
                return 0;
            }
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <iostream>
#include <complex>
#include <cstdio>
#include <utility>
#include <vector>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;
typedef vector<P> Poly;
#define X real()
#define Y imag()
const double EPS = (1e-10), pi = acos(-1);

namespace std{
  bool operator < (const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
  bool cmp_y(const P &a, const P &b){
    return a.Y != b.Y ? a.Y < b.Y : a.X < b.X;
  }
  bool operator == (const P& a, const P& b){
    return abs(a-b) < EPS;
  }
}

double dot(P a, P b){ return a.X * b.X + a.Y * b.Y;}
double cross(P a, P b){ return a.X * b.Y - a.Y * b.X;}
P projection(P a, P b){ return dot(a, b)/abs(b)/abs(b)*b;}

P intersection(L a, L b){
  //直線aと直線bの交点
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int main(){
  int N;
  cin >> N;
  Poly pol;
  for(int i = 0; i < N; ++i){
    double x, y;
    cin >> x >> y;
    pol.emplace_back(x,y);
  }
  double ans = 1e18;
  P r(cos(-pi/3),sin(-pi/3));
  for(int i = 0; i < N; ++i){
    L l(pol[i],pol[(i+1)%N]);
    P d = pol[(i+1)%N]-pol[i];
    //cerr << d << endl
    double ma = abs(d), mi = 0;
    d /= abs(d);
    for(int j = 0; j < N; ++j){
      if(j == i or j == (i+1)%N) continue;
      L l1(pol[j],pol[j]+d*r), l2(pol[j],pol[j]+d*r*r);
      P a = intersection(l,l1), b = intersection(l,l2);

      ma = max(ma,dot(a-pol[i],d));
      ma = max(ma,dot(b-pol[i],d));
      mi = min(mi,dot(a-pol[i],d));
      mi = min(mi,dot(b-pol[i],d));
    }
    ans = min(ans,ma-mi);
  }
  printf("%.12f\n",ans);
}



Measured memory_bytes: 3352
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define inf 10000000000000007
#define eps 1e-13
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.9lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define ios ios::sync_with_stdio(false); cin.tie(0) ; cout.tie(0)
#define endl '\n'
using namespace std;

int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll k=(n-1LL)*a+b;
    ll u=(n-1LL)*b+a;
    cout<<max(u-k+1LL,0LL)<<endl;




}




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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

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

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K, Q;
    cin >> N >> K >> Q;
    vec A(Q);
    REP(i,0,Q) cin >> A[i];

    vec S(N, 0);
    REP(i,0,Q) ++S[A[i]-1];
    REP(i,0,N) {
        if(K-(Q-S[i]) > 0) PR("Yes");
        else PR("No");
    }

    return 0;
}

/*



*/

Measured memory_bytes: 4772
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	if s[:1] != "A" {
		fmt.Println("WA")
		return
	}
	if len(s) == 4 {
		if s[2:3] != "C" {
			fmt.Println("WA")
			return
		}
	} else if strings.Count(s[2:len(s)-1], "C") != 1 {
		fmt.Println("WA")
		return
	}
	s = s[1:]
	for _, v := range s {
		if strings.Index("Cabcdefghijklmnopqrstuvwxyz", string(v)) == -1 {
			fmt.Println("WA")
			return
		}
	}
	fmt.Println("AC")
}


Measured memory_bytes: 640
import sys
import math

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,k=map(int,input().split())

A=[]
cnt=0
def count(i,k):
    cnt=0
    while k>i:
        i=i*2
        cnt+=1
        
    return cnt

pro=0

for i in range(1,n+1):
	pro+=(1/2)**count(i,k)
print(pro/n)

Measured memory_bytes: 39152
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int[] C = GetInts(N);

		int[] next = new int[N];
		int[] keep = new int[200001];
		for(int i = N - 1; i >= 0; i--)
		{
			if(keep[C[i]] != 0)
				next[i] = keep[C[i]];
	
			keep[C[i]] = i;
		}

		var dp = new ModInt[N + 1];
		dp[0] = new ModInt(1);
		for(int i = 0; i < N; i++)
		{
			dp[i + 1] += dp[i];
			if(next[i] > i + 1)
				dp[next[i]] += dp[i];
		}

		Console.WriteLine(dp[N].Val);
	}
}


public struct ModInt
{
	public long Mod { get; private set; }
	public long Val { get; private set; }

	public ModInt(long v)
	{
		Mod = 1000000007;
		Val = v;
	}

	public static ModInt operator+(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val + y.Val;
		if(tmp >= mod)
			tmp -= mod;
		return new ModInt(tmp);
	}


	public static ModInt operator-(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val;
		if(tmp < y.Val)
			tmp += mod;
		tmp -= y.Val;
		return new ModInt(tmp);
	}

	public static ModInt operator*(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		return new ModInt((x.Val * y.Val) % mod);
	}

	public static ModInt operator/(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long pow = mod - 2;
		long yy = y.Val;
		long inv = 1;
		while(pow > 0)
		{
			if((pow & 1) == 1)
				inv = (inv * yy) % mod;
			yy = (yy * yy) % mod;
			pow >>= 1;
		}
		return new ModInt((x.Val * inv) % mod);
	}

	public static ModInt operator+(ModInt x, long y) => x + new ModInt(y);
	public static ModInt operator-(ModInt x, long y) => x - new ModInt(y);
	public static ModInt operator*(ModInt x, long y) => x * new ModInt(y);
	public static ModInt operator/(ModInt x, long y) => x / new ModInt(y);
	public static ModInt operator++(ModInt x) => x + new ModInt(1);
	public static ModInt operator--(ModInt x) => x - new ModInt(1);
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("file.1", "r", stdin);

  int N;
  cin >> N;
  vector<map<string, ll>> a(N + 1);
  a[0]["TTT"] = 1;
  for (int i = 0; i < N; i++) {
    for (auto& c1 : { "A", "C", "G", "T" }) {
      for (auto& c2 : { "A", "C", "G", "T" }) {
        for (auto& c3 : { "A", "C", "G", "T" }) {
          string key = "";
          key += c1;
          key += c2;
          key += c3;
          if (a[i][key] == 0)
            continue;
          // NG combination
          // AGC
          // ACG
          // GAC
          // AG?C
          // A?GC
          for (auto& nc : { "A", "C", "G", "T" }) {
            if (nc == "C" && c1 == "G" && c2 == "A")
              continue;
            if (nc == "G" && c1 == "C" && c2 == "A")
              continue;
            if (nc == "C" && c1 == "A" && c2 == "G")
              continue;
            if (nc == "C" && c2 == "G" && c3 == "A")
              continue;
            if (nc == "C" && c1 == "G" && c3 == "A")
              continue;
            string nkey = "";
            nkey += nc;
            nkey += c1;
            nkey += c2;
            a[i + 1][nkey] += a[i][key];
            a[i + 1][nkey] %= MOD;
          }
        }
      }
    }
  }
  ll ans = 0;
  for (auto& c1 : { "A", "C", "G", "T" }) {
    for (auto& c2 : { "A", "C", "G", "T" }) {
      for (auto& c3 : { "A", "C", "G", "T" }) {
        string key = "";
        key += c1;
        key += c2;
        key += c3;
        ans += a[N][key];
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

int func(int n) {
    if(n < 10) return n;
    return func(n / 10) + n % 10;
}

int main() {
    int n;
    cin >> n;
    int fn = func(n);
    if(n % fn == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  int dx = tx-sx;
  int dy = ty-sy;
  string ans = "";
  rep(i,dy) {
    ans += "U";
  }
  rep(i,dx) {
    ans += "R";
  }
  rep(i,dy) {
    ans += "D";
  }
  rep(i,dx) {
    ans += "L";
  }
  ans += "D";
  rep(i,dx+1) {
    ans += "R";
  }
  rep(i,dy+1) {
    ans += "U";
  }
  ans += "L";
  ans += "U";
  rep(i,dx+1) {
    ans += "L";
  }
  rep(i,dy+1) {
    ans += "D";
  }
  ans += "R";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
primeCount = [0 for i in range(25)]

def searchSingle():
    res = 0
    for i in range(len(primeCount)):
        if primeCount[i] >= 74:
            res += 1
    return res

def searchDouble():
    res = 0
    for i in range(len(primeCount)):
        for j in range(len(primeCount)):
            cnt_i = primeCount[i]
            cnt_j = primeCount[j]
            if cnt_i >= 14 and cnt_j >= 4 and i != j:
                res += 1
            if cnt_i >= 24 and cnt_j >= 2 and i != j:
                res += 1
    return res

def searchTriple():
  res=0
  for i in range(len(primeCount)):
    for j in range(len(primeCount)):
      for k in range(j+1,len(primeCount)):
        if primeCount[i] >=2 and primeCount[j] >=4 and primeCount[k] >=4 and i!=j and j!=k and i!=k:
          res+=1
  return res

for i in range(2, n+1):
    cnt=i
    for j in range(len(prime)):
        if cnt % prime[j] == 0:
            while cnt % prime[j] == 0:
                cnt//= prime[j]
                primeCount[j] += 1
print(searchSingle() + searchDouble() + searchTriple())

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

#include <algorithm>

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N;
  cin >> N;
  vector<vector<int>> G(N);
  vector<pair<int, int>> vp;
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a, b);
  }
  int ans = 0;
  queue<int> que;
  vector<int> visited(N, 0);
  vector<int> cs(N, 0);
  map<pair<int, int>, int> mp;
  visited[0] = 1;
  que.emplace(0);
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    int c = 1;
    ans = max(ans, (int)G[u].size());
    for (int v : G[u]) {
      if (visited[v]) continue;
      if (c == cs[u]) c++;
      cs[v] = mp[make_pair(u, v)] = mp[make_pair(v, u)] = c++;
      visited[v] = 1;
      que.emplace(v);
    }
  }
  cout << ans << endl;
  for (auto p : vp) cout << mp[p] << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
const int mod = 1e9 + 7;


int main() {
    int n, m; cin >> n >> m;
    V<int> v(m);
    for(int i = 0; i < m; i++) cin >> v[i];

    V<int> dp(n + 1, 0);
    for(int i = 0; i < m; i++){
        dp[v[i]] = -1;
    }

    dp[0] = 1;
    for(int i = 1; i <= n; i++){
        if(dp[i] < 0) continue;
        if(0 <= dp[i - 1])dp[i] += dp[i - 1];
        if(1 < i && 0 <= dp[i - 2]) dp[i] += dp[i - 2];
        dp[i] %= mod;
    }
    cout << dp[n] << endl;



    return 0;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

vector<int> g[200005];
bool vis[200005];

void dfs(int x) {
	vis[x] = 1;
	for (int h : g[x]) if (!vis[h]) dfs(h);
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, k; read(n, k);
	vector<int> v(n);
	rep(i, 0, n) read(v[i]);

	set<int> s;
	rep(i, 0, k) s.insert(v[i]);
		
	rep(i, k, n) {
		int e1 = v[i - k], e2 = v[i];
		s.erase(e1);
		if (e1 < *s.begin() && *s.rbegin() < e2) g[i - k].push_back(i - k + 1), g[i - k + 1].push_back(i - k);
		s.insert(e2);
	}

	vector<int> sind;
	int lpos = 0;
	rep(i, 1, n) {
		if (v[i - 1] > v[i]) {
			rep(j, lpos, i - k + 1) sind.push_back(j);
			lpos = i;
		}
	}
	rep(j, lpos, n - k + 1) sind.push_back(j);
	if (sind.size()) {
		rep(i, 1, sz(sind)) {
			g[sind[0]].push_back(sind[i]);
			g[sind[i]].push_back(sind[0]);
		}
	}

	int ans = 0;
	rep(i, 0, n - k + 1) if (!vis[i]) dfs(i), ans++;

	die(ans);
}


Measured memory_bytes: 20088
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define INF 1073741824
#define ll long long
#define PI (2*acos(0.0))
#define p1(n) printf("showing %d\n",n)
#define p2(m,n) printf("showing %d %d\n",m,n)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define on(val,pos) val|(1<<pos)
#define off(val,pos) val&(~(1<<pos))
#define check(val,pos) (val&(1<<pos))
#define all(n) n.begin(),n.end()
//first four adjacent,second four corner
//int row[8]={0,-1,0,1,1,-1,-1,1};
//int col[8]={-1,0,1,0,-1,-1,1,1};
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main(){
    int i,j,k,n,m,val,t=0,test;
    //freopen("000input.txt","r",stdin);
    cin>>n;
    map<string,int>mapped;
    string s;
    for(i=0;i<n;i++){
        cin>>s;
        mapped[s]++;
    }
    printf("AC x %d\n",mapped["AC"]);
    printf("WA x %d\n",mapped["WA"]);
    printf("TLE x %d\n",mapped["TLE"]);
    printf("RE x %d\n",mapped["RE"]);
    //free();   //if pointer array
    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	vector<string> ss(n);
	for (auto &&s : ss)
	{
		cin >> s;
	}

	vector<string> ts = {"AC", "WA", "TLE", "RE"};
	vector<int> cnt(4, 0);

	for (auto &&s : ss)
	{
		for (int i = 0; i < 4; i++)
		{
			if (s == ts[i])
			{
				cnt[i]++;
			}
		}
	}

	for (int i = 0; i < 4; i++)
	{
		cout << ts[i] << " x " << cnt[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 6360
#include <iostream>
#include <vector>

using namespace std;

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

const int N = 2e5;
int a[N], r[N], b[N+1];
vector<int> e[N];

int find(int v) {
  int l = 0, r = N;
  while(l + 1 < r) {
    int m = (r + l) / 2;
    if(b[m] < v) l = m;
    else r = m;
  }
  if(v <= b[l]) return l;
  else return r;
}

int dfs(int c, int p) {
  int x = find(a[c]), y = b[x];
  b[x] = a[c];
  r[c] = find(1e9+1);
  for(auto i : e[c]) {
    if(i != p) dfs(i, c);
  }
  b[x] = y;
  return 0;
}

int main() {
  int n;
  cin >> n;
  rep(i,n) cin >> a[i];
  rep(i,n-1) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    e[u].push_back(v);
    e[v].push_back(u);
  }

  rep(i,N+1) b[i] = 1e9+1;
  dfs(0, -1);

  rep(i,n) cout << r[i] << endl;
  return 0;
}

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

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

int field[15][15];
int dp[15][15];
int x, y;

int calc_pattern()
{
	int pattern = 0;

	loop(i, 0, x)
	{
		if( field[0][i] != 1 )
		{
			dp[0][i] = 1;
		}
		else
		{
			dp[0][i] = 0;
		}
	}

	loop(i, 0, y - 1)
	{
		loop(j, 0, x)
		{
			if( field[i][j] == 0 )
			{
				if( j >= 1 && j < x - 1 )
				{
					dp[i + 1][j - 1] += field[i + 1][j - 1] == 0 ? dp[i][j] : 0;
					dp[i + 1][j    ] += field[i + 1][j    ] != 1 ? dp[i][j] : 0;
					dp[i + 1][j + 1] += field[i + 1][j + 1] == 0 ? dp[i][j] : 0;
				}
				else if( j == 0 )
				{
					dp[i + 1][j    ] += field[i + 1][j    ] != 1 ? dp[i][j] : 0;
					dp[i + 1][j + 1] += field[i + 1][j + 1] == 0 ? dp[i][j] : 0;
				}
				else if( j == x - 1 )
				{
					dp[i + 1][j - 1] += field[i + 1][j - 1] == 0 ? dp[i][j] : 0;
					dp[i + 1][j    ] += field[i + 1][j    ] != 1 ? dp[i][j] : 0;
				}
			}
			else if( field[i][j] == 1 )
			{
				dp[i][j] = 0;
			}
			else if( field[i][j] == 2 )
			{
				if( i != y - 2 )
				{
					dp[i + 2][j] += field[i + 2][j] != 1 ? dp[i][j] : 0;
				}
				else
				{
					pattern += dp[i][j];
				}
			}
		}
	}
	loop(i, 0, x)
	{
		pattern += dp[y - 1][i];
	}

	return pattern;
}

int main()
{
	int pattern;
	while( 1 )
	{
		scanf("%d%d", &x, &y);
		if( x == 0 && y == 0 )break;
		
		loop(i, 0, 15)
		{
			loop(j, 0, 15)
			{
				field[i][j] = 0;
				dp[i][j] = 0;
			}
		}
		loop(i, 0, y)
		{
			loop(j, 0, x)
			{
				field[i][j] = in();
			}
		}

		pattern = calc_pattern();
		printf("%d\n", pattern);
	}
	return (0);
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
int main(){
  lli A,B,C=INF,D=0,E=0,F=0,G=0,H=0,N,M;
  cin >> N >>M;
  vector<string>P(N);
  rep(i,0,N)cin >> P[i];
  Sort(P);
  rep(i,0,N)NeOut(P[i]);
  cout << endl;
}

Measured memory_bytes: 256
n, a, b, c, d = map(int, input().split())
if n % a == 0:
    x = n // a
else:
    x = n // a + 1
if n % c == 0:
    y = n // c
else:
    y = n // c + 1
ans = min(x * b, y * d)
print(ans)



Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {
    char abc[3] = {'a', 'b', 'c'};
    map<char, string> mp;
    for(int i=0; i<3; i++) {
        string str;
        cin >> str;
        
        mp[abc[i]] = str;
    }

    // cout << mp['a'] << endl;
    // cout << mp['b'] << endl;
    // cout << mp['c'] << endl;
    
    char cur_pr='a', next_pr;
    string card=mp[cur_pr];
    // cout << card << endl;
    while(card.size()!=0) {
        next_pr = card[0];
        // cout << next_pr << endl;
        mp[cur_pr].erase(0, 1);
        // cout << mp[cur_pr] << endl;
        card = mp[next_pr];
        cur_pr = next_pr;

        // cout << cur_pr << endl;
    }
    // cout << endl;
    
    // cout << cur_pr << endl;
    cout << (char)(cur_pr + ('A'-'a')) << endl;

    return 0;
    
}

Measured memory_bytes: 256
# coding:utf-8
# 找第二大的数的个数
n = input()
array = map(int, raw_input().split())
e_list = [array[i] for i in range(0, n, 2)]
o_list = [array[i] for i in range(1, n+1, 2)]


def process(arr):
    arr.sort()
    num = arr[0]
    counter = 0
    amt_arr = []
    arr.append(0)
    max = 0
    max_amt_num = []
    for i in arr:
        if i == num:
            counter += 1
        else:
            if counter > max:
                max_amt_num = [num]
                max = counter
            elif counter == max:
                max_amt_num.append(num)
                max = counter
            num = i
            amt_arr.append(counter)
            counter = 1
    if len(amt_arr) == 1:
        amt_arr.append(0)
    if len(max_amt_num) > 1:
        max_amt_num = "haha"
    amt_arr.sort()

    return amt_arr[-1], amt_arr[-2], max_amt_num
v1, v2, a1 = process(e_list)
v3, v4, a2 = process(o_list)
if a1 != a2 and a1 != "haha":
    result = len(array) - v1 - v3
else:
    result = len(array) - max(v1+v4, v2+v3)
print result



Measured memory_bytes: 11328
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var arr = new[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine(arr[n - 1]);
    }
}


Measured memory_bytes: 13140
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main(){    
  char b;
  cin >> b;

  
  if(b == 'A'){
    cout << "T" << endl;
  }
  else if(b == 'T'){
    cout << "A" << endl;
  }
  else if(b == 'C'){
    cout << "G" << endl;
  }
  else if(b == 'G'){
    cout << "C" << endl;
    }
  
}


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

using namespace std;

int h, w, n;

void masprint(char mas[30][30])
{
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++) cout << mas[i][j];
    cout << endl;
  }
  return;
}

void mascpy(char src[30][30], char dst[30][30])
{
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++) dst[i][j] = src[i][j];
  }
  return;
}

bool isNoBlock(char mas[30][30])
{
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(mas[i][j] != '.') return false;
    }
  }
  return true;
}

void fallBlock(char mas[30][30])
{
  for(int i = h-1; i > 0; i--){
    for(int j = 0; j < w; j++){
      if(mas[i][j] == '.'){
	for(int k = i-1; k >= 0 && mas[i][j] == '.'; k--) swap(mas[i][j], mas[k][j]);
      }
    }
  }
  return;
}

bool eraseAll(char mas[30][30])
{
  bool erase = false;
  do{
    fallBlock(mas);
    erase = false;
    bool emas[30][30] = {false};
    if(isNoBlock(mas)) return true;
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	if(mas[i][j] == '.') continue;
	int cnt = 0;
	while(j + cnt < w && mas[i][j] == mas[i][j+cnt]) cnt++;
	if(cnt >= n){
	  cnt--;
	  erase = true;
	  while(cnt >= 0) emas[i][j+cnt] = true, cnt--;
	}
      }
    }
    for(int j = 0; j < w; j++){
      for(int i = 0; i < h; i++){
	if(mas[i][j] == '.') continue;
	int cnt = 0;
	while(i + cnt < h && mas[i][j] == mas[i+cnt][j]) cnt++;
	if(cnt >= n){
	  cnt--;
	  erase = true;
	  while(cnt >= 0) emas[i+cnt][j] = true, cnt--;
	}
      }
    }
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	if(!emas[i][j]) continue;
	mas[i][j] = '.';
      }
    }
  }while(erase);
  return false;
}

bool solve(char mas[30][30])
{
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w-1; j++){
      if(mas[i][j] == '.' && mas[i][j+1] == '.') continue;
      char tmp[30][30];
      mascpy(mas, tmp);
      swap(tmp[i][j], tmp[i][j+1]);
      if(eraseAll(tmp)) return true;
    }
  }
  return false;
}

int main()
{
  cin >> h >> w >> n;
  char mas[30][30];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++) cin >> mas[i][j];
  }
  if(solve(mas)) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void)
{
    int N, A[20], B[20], C[20] = {};
    int ans = 0;

    scanf("%d", &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    for (size_t i = 0; i < N; i++) {
        scanf("%d", &B[i]);
    }
    for (size_t i = 0; i < N; i++) {
        scanf("%d", &C[i]);
    }

    for (size_t i = 0; i < N; i++) {
        ans += B[A[i] - 1];
        if (((i + 1) < N) && (A[i] == (A[i + 1] - 1))) {
            ans += C[A[i] - 1];
        }
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <stack>

using namespace std;

int main() {
	string s;
	stack<double> st;
	while (getline(cin, s)) {
		int tail;
		while (1) {
			tail = s.find(' ');
			string ss = s.substr(0, tail);
			int val = atoi(ss.c_str());
			if (val != 0 || ss[0] == '0')
				st.push((double)val);
			else {
				double b = st.top(); st.pop();
				double a = st.top(); st.pop();
				switch (ss[0]) {
					case '+': st.push(a+b); break;
					case '-': st.push(a-b); break;
					case '*': st.push(a*b); break;
					case '/': st.push(a/b); break;
				}
			}

			if (tail == string::npos)
				break;
			s = s.substr(tail+1);
		}

		printf("%.6f\n", st.top());
		while (!st.empty())
			st.pop();
	}
	return 0;
}

Measured memory_bytes: 0
//AtCoder ABC103 C - Modulo Summation
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
ll lcm(ll num1,ll num2){
    return num1 / __gcd(num1,num2) * num2; //gcc拡張
}
int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N; cin>>N;
    vector<ll> an(N);
    for(auto&& a:an){
        cin>>a;
    }
    ll m=lcm(an[0],an[1]);
#if LOCAL
    cout<<an[0]<<","<<an[1]<<endl;
    cout<<m<<endl;
#endif
    for(ll i=2;i<N;++i){
        m=lcm(m,an[i]);
    }
    --m;
#if LOCAL
    cout<<m<<endl;
#endif
    ll ans=0;
    for(const auto& a:an){
        //ans+=(m%a);
        ans+=(a-1); //結局最大はa-1余るので
    }
    cout<<ans<<endl;
    return 0;
}

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


class Program
{
    static void Main(string[] args)
    {
        string[] ABCD = Console.ReadLine().Split(' ');
        int A = int.Parse(ABCD[0]);
        int B = int.Parse(ABCD[1]);
        int C = int.Parse(ABCD[2]);
        int D = int.Parse(ABCD[3]);

        int tWin = C / B; //切り捨てられる
        int aWin = A / D;

        if(C % B != 0) tWin += 1;
        if(A % D != 0) aWin += 1;

        if(tWin <= aWin) {
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 27524
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s,t;
    cin>>s>>t;
    map<char,char> mp,mp2;
    REP(i,s.size()){
        if(mp.count(s[i])){
            if(mp[s[i]]!=t[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            mp[s[i]]=t[i];
        }
        if(mp2.count(t[i])){
            if(mp2[t[i]]!=s[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            mp2[t[i]]=s[i];
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 776
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//236
	vi arr(5);
	int k;
	for(int &i:arr)cin>>i;
	cin>>k;
	int cnt = 0;
	REP(i,0,4)
	REP(j,i+1,4)
		if(abs(arr[i]-arr[j])>k)cnt++;
	if(cnt==0)cout<<"Yay!";
	else cout<<":(";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main(){
  long long N, M;
  cin >> N >> M;
  long long L[M], R[M];
  for(int i = 0; i < M; i++){
    cin >> L[i];
    cin >> R[i];
  }
  long long maxL = 0;
  long long minR = 999999;
  for(int i = 0; i < M; i++){
    maxL = max(maxL, L[i]);
    minR = min(minR, R[i]);
  }
  long long ans = minR - maxL + 1;
  if(ans >= 0) cout << ans << endl;
  else cout << 0 << endl;
}
  

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
    long long int A,B,K;
    scanf("%lld %lld %lld",&A,&B,&K);

    if(A>=K){
        printf("%lld %lld",A-K,B);
    }
    else if(A<=K && (A+B)>=K){
        printf("0 ");
        printf("%lld",(B-(K-A)));
    }
    else if((A+B)<=K){
        printf("0 0");
    }

}

Measured memory_bytes: 1736
#include <iostream>

using namespace std;

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

    bool f = true;
    int count = 0;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;

        if(s == "A"){
            count++;
        }else{
            count--;
            if(count < 0){
                f = false;
            }
        }
    }

    if(f && count == 0){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }

    return 0;
}


Measured memory_bytes: 3140
n, k = map(int, input().split())
a = map(int, input().split())
f = map(int, input().split())
a = sorted(a)
f = sorted(f)[::-1]


def c(x):
    # x決めると必要な修行回数も決まる
    res = 0
    for O, K in zip(a, f):
        d = max(0, O * K - x)
        res += (d + K - 1) // K
    return res <= k


l = -1
r = 1 << 60
while r - l > 1:
    mid = (l + r) >> 1
    if c(mid):
        r = mid
    else:
        l = mid
print(r)


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(),x.end()
auto& errStream=cerr;
#ifdef LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%"  SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read();
	int a=read(),b=read();
	vi cnt(3,0);
	REP(_,n){
		int x=read();
		if(x<=a)
			cnt[0]++;
		else if(x<=b)
			cnt[1]++;
		else
			cnt[2]++;
	}
	print(min({cnt[0],cnt[1],cnt[2]}));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n,d;
    cin >> n >> d;
    int ans = 1;
    while(true){
        if(n>ans*(2*d+1)) ans++;
        else{break;}
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
}

Measured memory_bytes: 24408
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const ll MOD = 1e9 + 7;

ll s[100001] = {};
ll t[100001] = {};
ll c[100001] = {};
ll m[31][200001] = {};
ll ans[200001] = {};

int main()
{
	ll n, C; cin >> n >> C;

	repe(i, 1, n) {
		ll x, y, z; cin >> x >> y >> z;
		s[i] = 2 * x - 1;
		t[i] = 2 * y;
		c[i] = z;
	}
	repe(i, 1, n) {
		m[c[i]][s[i]]++;
		m[c[i]][t[i]]--;
	}
	repe(i, 1, 30) {
		repe(j, 1, 200001) {
			m[i][j] += m[i][j - 1];
			//m[i][j] = min((ll)1, m[i][j]);
		}
	}

	ll maxV = 0;
	rep(i, 1, 200001) {
		ll sum = 0;
		repe(j, 1, 30) {
			if (m[j][i] >= 1) {
				sum++;
			}
		}
		ans[i] = sum;
		maxV = max(ans[i], maxV);
	}
	cout << maxV << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;
const int INF = 1e9;
const llint llINF = 1e18;

int main () {
    int n; cin >> n;
    vint v(n), c(n);
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];
    vint cost(n);
    rep(i, n) {
        cost[i] = v[i] - c[i];
        //cout << cost[i];
    }
    sort(all(cost));
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (cost[i] < 0) continue;
        else ans += cost[i];
    }

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

Measured memory_bytes: 256
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int n, m;
int a[1001], b[1001];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (true) {
		cin >> n >> m;
		if (n == 0 && m == 0) { break; }
		roop(i, n) {
			cin >> a[i];
		}
		roop(i, m) {
			cin >> b[i];
		}
		int now = 0;
		roop(i, m) {
			if (now >= n - 1) {
				cout << i << endl;
			break;
			}
			now += b[i];
			if (now >= n - 1) {
				cout << i + 1 << endl;
			break;
			}
			now += a[now];
		}
		}return 0;


}


Measured memory_bytes: 3180
let n, t0 = Scanf.scanf " %d %d" @@ fun a b -> a, b
let cts = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let ans = Array.fold_left (fun m (c, t) -> if t <= t0 then min m c else m) max_int cts
let _ = if ans = max_int then print_endline "TLE" else Printf.printf "%d\n" ans

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

int a,b,c;
bool flag;

namespace WalkerV {
	void Read() {
		scanf("%d%d%d",&a,&b,&c);
		return;
	}

	void Solve() {
		if(a==b&&a!=c) {
			flag=true;
			return;
		}
		if(a==c&&a!=b) {
			flag=true;
			return;
		}
		if(b==c&&b!=a) {
			flag=true;
			return;
		}
		flag=false;
		return;
	}

	void Print() {
		if(flag) {
			printf("Yes");
		}
		else {
			printf("No");
		}
		return;
	}
}

int main()
{
	WalkerV::Read();
	WalkerV::Solve();
	WalkerV::Print();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.size()<=k) cout << s << endl;
  else {
    string ans = s.substr(0,k);
    ans += "...";
    cout << ans << endl;
  }

  return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  string s;
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
}


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

int main(){
  int K;
  cin >> K;
  vector<int> vec(32);
  vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << vec.at(K-1);
}

Measured memory_bytes: 256
n = int(input())
s = input()

ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if k < n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)

Measured memory_bytes: 9136