akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto K = RD;
	auto P = RDA;

	/*auto N = 10;
	auto K = uniform(2, N+1);
	long[] P;
	foreach (i; 0..N)
	{
		P ~= i;
	}
	randomShuffle(P);
	debug writeln(N, " ", K);
	debug writeln(P);
	bool[long[]] set;
	foreach (i; 0..N-K+1)
	{
		auto arr = P[i..i+K].dup;
		arr.sort();
		auto a = (P[0..i] ~ arr ~ P[i+K..$]).idup;
		if (set.get(a, false) == false)
			writeln("pos:", i+K-1);
		set[a] = true;
	}
	debug writeln("ans:", set.keys.length);*/

	auto rbt = redBlackTree!(true)(new long[](0));
	foreach (i; 0..K)
	{
		rbt.stableInsert(P[i]);
	}

	long ans = 1;
	foreach (i; K..N)
	{
		auto s = rbt.front;
		auto b = rbt.back;
		debug writeln(rbt[]);
		if (P[i-K] != s)
		{
			++ans;
			debug writeln(i, " s");
		}
		else if (P[i] < b)
		{
			++ans;
			debug writeln(i, " b");
		}
		rbt.removeKey(P[i-K]);
		rbt.stableInsert(P[i]);
	}

	long cnt, sorted;
	foreach (i; 1..K)
	{
		if (P[i-1] <= P[i])
			++cnt;
	}
	if (cnt == K-1)
		++sorted;
	foreach (i; K..N)
	{
		if (P[i-1] <= P[i])
			++cnt;
		if (P[i-K] <= P[i-K+1])
			--cnt;
		if (cnt == K-1 && !(P[i-1] <= P[i] && P[i-K] <= P[i-K+1]))
			++sorted;
	}
	ans -= max(sorted-1, 0);

	writeln(ans);
	stdout.flush();
	debug readln();
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

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

  ll result=0;
  rep1(i, n){
    if(i%3!=0 && i%5!=0)result+=i;
  }

  cout<<result<<endl;

  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define vsort(v) sort(v.begin(), v.end());
#define vsort_reverse(v) sort(v.begin(), v.end(), greater<int>());
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	set<int> s;
	for(int i = 0; i < N; i++) {
		int x;
		cin >> x;
		s.insert(x);
	}

	cout << s.size() << endl;
}


Measured memory_bytes: 256
#!python3

from time import perf_counter
limit = 1.92
tick = perf_counter()

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from random import randrange
from bisect import bisect


def resolve():
    G = 26
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(G)]
    S = [[next(it) for i in range(G)] for i in range(D)]
    L = [[-1] for i in range(G)]
    T = [0] * D

    def update(di, qi):
        score = 0
        t0 = T[di]
        score += S[di][qi]-S[di][t0]

        a1 = li = L[t0][:]
        ii = li.index(di)
        la = D if len(li)-1 == ii else li[ii+1]
        score -= C[t0] * (di-li[ii-1])*(la-di)
        li.pop(ii)

        a2 = li = L[qi][:]
        ii = bisect(li, di)
        li.insert(ii, di)
        la = D if len(li)-1 == ii else li[ii+1]
        score += C[qi] * (di-li[ii-1])*(la-di)

        return score, (a1, a2)

    U = 7
    def calc(i, j):
        score = S[i][j]
        for k in range(G):
            u = k - L[k][-1]
            score -= C[k] * (u + u + U) * U // 2
        score += C[k] * U * (i-L[j][-1])
        return score

    def dswap(di, dj):
        qi, qj = T[di], T[dj]
        swap0 = (L[qi], L[qj])

        score, swap1 = update(di, qj)
        T[di] = qj
        L[qi], L[qj] = swap1
        diff, swap2 = update(dj, qi)

        score += diff

        if score > 0:
            T[dj] = qi
            L[qj], L[qi] = swap2
        else:
            score = 0
            T[di], T[dj] = qi, qj
            L[qi], L[qj] = swap0
        return score

    def fullscore():
        score = 0
        last = [-1] * 26
        for i, ti in enumerate(T):
            score += S[i][ti]
            last[ti] = i
            for ci, la in zip(C, last):
                score -= ci * (i-la)
        return score

    for di in range(D):
        i, score = 0, calc(di, 0)
        for qi in range(1, G):
            x = calc(di, qi)
            if x > score:
                i, score = qi, x
        T[di] = i
        L[i].append(di)


    print(*(i+1 for i in T), sep="\n")



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 78932
NIL = -1
n = int(input())

class Node():
    def __init__(self):
        self.id = NIL
        self.left = NIL
        self.right = NIL
        self.parent = NIL
        
    def __str__(self):
        return "id : {}, left : {}, right : {}, parent : {}".format(self.id, self.left, self.right, self.parent)

tree = [Node() for i in range(n)]
for i in range(n):
    row = list(map(int,input().split()))
    tree[row[0]].id = row[0]
    tree[row[0]].left = row[1]
    tree[row[0]].right = row[2]
    
    if(row[1] != NIL):
        tree[row[1]].parent = row[0]
    if(row[2] != NIL):
        tree[row[2]].parent = row[0]


def preParse(u, res):
    if(u == NIL):
        return 
    res += [u]
    preParse(tree[u].left, res)
    preParse(tree[u].right, res)
    return res

def inParse(u, res):
    if(u == NIL):
        return
    inParse(tree[u].left, res)
    res += [u]
    inParse(tree[u].right, res)
    return res

def postParse(u, res):
    if(u == NIL):
        return
    postParse(tree[u].left, res)
    postParse(tree[u].right, res)
    res += [u]
    return res

for i in range(n):
    if(tree[i].parent == -1):
        print("Preorder")
        print(" {}".format(" ".join([str(ss) for ss in preParse(tree[i].id, [])])))
        
        print("Inorder")
        print(" {}".format(" ".join([str(ss) for ss in inParse(tree[i].id, [])])))
        
        print("Postorder")
        print(" {}".format(" ".join([str(ss) for ss in postParse(tree[i].id, [])])))
        
        break


Measured memory_bytes: 5624
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	vll x(5);
	ll ans;
	rep(i, 0, 5) {
		std::cin >> x[i];
		if (x[i] == 0) {
			ans = 1 + i;
		}
	}
	std::cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3592
/**
 * @author yuzining
**/
#ifdef local
#include "D:\vscode\acm\local.hpp"
#else
#include<bits/stdc++.h>
using namespace std;
#define debug(...) do { } while(false)
void Main();
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
  return 0;
}
#endif

void Main() {
  long long ans = 0;
  int n; cin >> n;
  for (int i = 1; i <= n; i++) {
    ans += 1ll * i * (i + 1) / 2;
  }
  for (int i = 1; i < n; i++) {
    int u, v; cin >> u >> v;
    if (u > v) swap(u, v);
    ans -= 1ll * u * (n - v + 1);
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
    using namespace std;
    using Graph = vector<vector<int>>;
    #define ll long long
    #define _GLIBCXX_DEBUG
    const ll MOD = 1000000007;
    const int MAX = 510000;
     
    int main() {
      ll N;
      string S;
      cin >> N >> S;
      ll numR = count(S.begin(), S.end(), 'R');
      ll numG = count(S.begin(), S.end(), 'G');
      ll numB = count(S.begin(), S.end(), 'B');
      ll res = numR*numG*numB;
      for (ll i=0; i<N; i++) {
        for (ll j=i+1; j<N; j++) {
          if (j<2*j-i&&2*j-i<N) {
            ll k = 2*j-i;
            if (S[i]!=S[j]&&S[i]!=S[k]&&S[j]!=S[k]) res--;
          }
        }
      }
      cout << res << endl;
    }

Measured memory_bytes: 3620
#pragma warning(disable:4996)
#include "bits/stdc++.h"
using namespace std;

//template
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,a,b) for(int i=(int)(b) - 1;i>=(int)(a);i--)
#define rrep(i,n) RREP(i,0,n)
#define each(i, ctn) for (auto &&i : (ctn))

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
#define all(a) (a).begin(),(a).end()
template<typename A, typename T>
void assign2d(A&arr, ll H, ll W, T t) {
	arr.resize(H);
	for (ll i = 0; i < H; i++) {
		arr[i].assign(W, t);
	}
}
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T in() { T x; cin >> x; return x; }

//pair
using P = pair<ll, ll>;
#define mp make_pair



int main() {
	ll N;
	N = in();
	vl A(N), B(N), C(N);
	rep(i, N)A[i] = in();
	rep(i, N)B[i] = in();
	rep(i, N)C[i] = in();
	sort(all(A));
	sort(all(C));

	ull ans = 0;
	each(b, B) {
		ll x = lower_bound(all(A), b) - begin(A);
		ll y = end(C) - upper_bound(all(C), b);
		ans += x * y;
	}
	
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int K;

int main(){
    cin>>K;

    int ans;
    if(K%2==1){
        ans=K/2*(K/2+1);
    }else{
        ans=K*K/4;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
<?php
$result_x = array();
$result_y = array();

$num = 0;

while (true) {
	$stdin = trim(fgets(STDIN));

	if ($stdin == '') {
		for ($i=0; $i < $num; $i++) { 
			echo number_format($result_x[$i], 3).' '.number_format($result_y[$i], 3)."\n";
		}
		return;
	}

	$input = explode(' ', $stdin);

	$a = intval($input[0]);
	$b = intval($input[1]);
	$c = intval($input[2]);
	$d = intval($input[3]);
	$e = intval($input[4]);
	$f = intval($input[5]);

	$result_x[] = ($c*$e-$f*$b) / ($a*$e-$d*$b);
	$result_y[] = ($a*$f-$d*$c) / ($a*$e-$d*$b);

	$num++;
}

Measured memory_bytes: 6648
package main

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

func readInt(sc *bufio.Scanner) int {
	sc.Scan()
	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return num
}

func isPrimeNumber(num int) bool {
	if num < 2 {
		return false
	}
	if num == 2 {
		return true
	}
	if num%2 == 0 {
		return false
	}

	sqrtNum := math.Sqrt(float64(num))
	max := int(math.Floor(sqrtNum))

	for i := 3; i <= max; i += 2 {
		if num%i == 0 {
			return false
		}
	}

	return true
}

func main() {
	var sc = bufio.NewScanner(os.Stdin)

	count := readInt(sc)

	primeCount := 0
	for i := 0; i < count; i++ {
		num := readInt(sc)
		if isPrimeNumber(num) {
			primeCount++
		}
	}

	fmt.Println(primeCount)
}



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

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

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

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
ll n,k,q;
int main(){
    cin>>n>>k>>q;
    vector<int> a(q);
    vector<int> score(n);
    rep(i,q) cin>>a.at(i);
    rep(i,q) score.at(a.at(i)-1)++;
    rep(i,n){if(score.at(i)+k>q)cout<<"Yes"<<endl;else cout<<"No"<<endl;}
    return 0;
}




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

int main(){
  int N,A;
  cin>>N>>A;
  if(N<500 && N<=A){
    cout<<"Yes"<<endl;
  }
  else if(N<500 && N>A){
    cout<<"No"<<endl;
  }
  else if(N>500 && N%500<=A){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
  

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 
 int main(){
  ll n , d ; cin>>n>>d ;
  vector<ll> A(n),B(n) ;
  ll ans=0 ;
  rep(i,n){
    cin>>A[i]>>B[i] ;
    if((A[i]*A[i]+B[i]*B[i])<=d*d) ans++ ;
  }
  cout<<ans<<endl ;
   return 0 ;
 }



Measured memory_bytes: 6408
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

struct uf_tree {
	std::vector<int> parent;
	int __size;
	uf_tree(int size_) : parent(size_, -1), __size(size_) {}
	void unite(int x, int y) {
		if ((x = find(x)) != (y = find(y))) {
			if (parent[y] < parent[x]) std::swap(x, y);
			parent[x] += parent[y];
			parent[y] = x;
			__size--;
		}
	}
	bool is_same(int x, int y) { return find(x) == find(y); }
	int find(int x) { return parent[x] < 0 ? x : parent[x] = find(parent[x]); }
	int size(int x) { return -parent[find(x)]; }
	int size() { return __size; }
};



//!!!問題をちゃんと読む!!!
//!!!問題をちゃんと読め!!!
//!!!問題は読みましたか？!!!


signed main() {
	int N, K;
	cin >> N >> K;
	string s;
	cin >> s;
	s[K - 1] ^= 32;
	cout << s<<"\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll INF = 1<<29;
int main(){
 int n;cin>>n;
 int h[n];
 rep(i,n){
 cin>>h[i];
 }
 int ans=0;
 int cnt=0;
 rep(i,n-1){
     if(h[i]>=h[i+1])cnt++;
     else cnt=0;
     ans=max(ans,cnt);
 }
cout<<ans<<endl;
}

Measured memory_bytes: 640
def matrix_chain_order(p):
    n = len(p)
    m = {}
    for length in range(1, n + 1):
        for i in range(n - length + 1):
            j = i + length - 1
            if i == j:
                m[(i, j)] = 0
            else:
                q = None
                for k in range(i, j):
                    c = m[(i, k)] + m[(k+1, j)] + p[i][0] * p[k][1] * p[j][1]
                    if q is None or c < q:
                        q = c
                m[(i, j)] = q
    return m[(0, n-1)]

if __name__ == '__main__':
    import sys

    p = []
    n = int(input())
    for _ in range(n):
        p.append(tuple(map(int, sys.stdin.readline().split())))
    print(matrix_chain_order(p))



Measured memory_bytes: 6164
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=1e6+5;
const int mod=998244353;

int main(){
	int x,y;
	scanf("%d%d",&x,&y);
	printf("%d\n",max({x+y,x-y,x*y}));
	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

	public static void main(String[] args) {
		int W = sc.nextInt();
		int H = sc.nextInt();
		int[] P = new int[W];
		int[] Q = new int[H];
		for (int i = 0; i < W; ++i) {
			P[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < H; ++i) {
			Q[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(P);
		Arrays.sort(Q);
		long ans = 0;
		int pi = W - 1;
		int qi = H - 1;
		while (pi >= 0 || qi >= 0) {
			boolean useP;
			if (pi < 0) {
				useP = false;
			} else if (qi < 0) {
				useP = true;
			} else {
				useP = P[pi] > Q[qi];
			}
			if (useP) {
				ans += (long) P[pi] * (H - qi);
				--pi;
			} else {
				ans += (long) Q[qi] * (W - pi);
				--qi;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 47784
import math

A, B, H, M = map(int, input().split())
p = math.pi

hour_x = A * math.cos(2*p*(H + M/60) /12)
hour_y = A * math.sin(2*p*(H+ M/60)/ 12)

minuit_x = B * math.cos(2*p*M/60)
minuit_y = B * math.sin(2*p*M/60)

x_dis = (hour_x - minuit_x) ** 2
y_dis = (hour_y - minuit_y) ** 2

print(math.sqrt(x_dis + y_dis))

Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
int main() {
	int n;
	cin >> n;
	VI a(n);
	REP(i, n)
		cin >> a[i];
	VI sb(n);
	sb[0] = a[0];
	REP(i, n - 1)
		sb[i + 1] = __gcd(sb[i], a[i + 1]);
	VI se(n);
	se[n - 1] = a[n - 1];
	for(int i = n - 1;i > 0;i--)
		se[i - 1] = __gcd(se[i], a[i - 1]);
	int ans;
	for (int i = 0; i < n; i++) {
		if (i == 0)
			ans = se[i + 1];
		else if (i == n - 1)
			ans = max(ans, sb[i - 1]);
		else
			ans = max(ans, __gcd(sb[i - 1], se[i + 1]));
	}
	cout << ans;
}

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

signed main(){
	int n,ans = 2;
	cin >> n;
	for(int i = 0;i < n;i++) ans = ans * 2 + 2;
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    
    int n,x;cin>>n>>x;
    if(x==1 || x==2*n-1){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    if(n==2){
        cout<<1<<endl;
        cout<<2<<endl;
        cout<<3<<endl;
        return 0;
    }
    if(x==2){
        vector<int> ret(2*n);
        int idx=5;
        ret[n-1]=4;ret[n]=2;ret[n+1]=1;ret[n+2]=3;
        for(int i=1;i<=2*n-1;i++){
            if(n-1<=i && i<=n+2) continue;
            ret[i]=idx;idx++;
        }
        for(int i=1;i<=2*n-1;i++) cout<<ret[i]<<endl;
        return 0;    
    }
    if(x==2*n-2){
        vector<int> ret(2*n);
        int idx=1;
        ret[n-1]=2*n-4;ret[n]=2*n-2;ret[n+1]=2*n-1;ret[n+2]=2*n-3;
        for(int i=1;i<=2*n-1;i++){
            if(n-1<=i && i<=n+2) continue;
            ret[i]=idx;idx++;
        }
        for(int i=1;i<=2*n-1;i++) cout<<ret[i]<<endl;
        return 0; 
    }
    vector<int> res(2*n);
    int num=1;
    res[n-2]=x+2;res[n-1]=x-1;res[n]=x;res[n+1]=x+1;res[n+2]=x-2;
    for(int i=1;i<=2*n-1;i++){
        if(n-2<=i && i<=n+2) continue;
        if(num==x-2) num+=5;
        res[i]=num;
        num++;
    }
    for(int i=1;i<=2*n-1;i++) cout<<res[i]<<endl;
}


Measured memory_bytes: 2304
#include<stdio.h>
#include<stdlib.h>
    
int main(int argc, const char * argv[]){
    int i,j,k,ex1,ex2,ex3,ex4,n,a;
    int dice[101][7];
    int w;
        
    scanf("%d",&n);
        
    for(i = 1;i <= n;i++)
        for(j = 1;j <= 6;j++)
            scanf("%d",&dice[i][j]);
        
    for(i = 1;i <= n;i++){
        for(j = i + 1;j <= n;j++){
            for(k = 0;k < 10000;k++){
                w = rand() % 4;
                if(w == 0){
                    ex1 = dice[i][1];
                    ex2 = dice[i][2];
                    ex3 = dice[i][5];
                    ex4 = dice[i][6];
                    dice[i][1] = ex3;
                    dice[i][2] = ex1;
                    dice[i][5] = ex4;
                    dice[i][6] = ex2;
                }else if(w == 1){
                    ex1 = dice[i][1];
                    ex2 = dice[i][2];
                    ex3 = dice[i][5];
                    ex4 = dice[i][6];
                    dice[i][1] = ex2;
                    dice[i][2] = ex4;
                    dice[i][5] = ex1;
                    dice[i][6] = ex3;
                }else if(w == 2){
                    ex1 = dice[i][1];
                    ex2 = dice[i][3];
                    ex3 = dice[i][4];
                    ex4 = dice[i][6];
                    dice[i][1] = ex3;
                    dice[i][3] = ex1;
                    dice[i][4] = ex4;
                    dice[i][6] = ex2;
                }else if(w == 3){
                    ex1 = dice[i][1];
                    ex2 = dice[i][3];
                    ex3 = dice[i][4];
                    ex4 = dice[i][6];
                    dice[i][1] = ex2;
                    dice[i][3] = ex4;
                    dice[i][4] = ex1;
                    dice[i][6] = ex3;
                }
                for(a = 1;a <= 6;a++)
                    if(dice[i][a] != dice[j][a])
                        break;
                    if(a == 7){
                        printf("No\n");
                        return 0;
                    }
                }
            }
        }
        printf("Yes\n");
        return 0;
    }


Measured memory_bytes: 2104
#include<iostream>
#include <string>

using namespace std;

int main(void)
{
	int A, B;
	cin >> A >> B;

	int cnt = 0;
	for (int i = A; i <= B; i++){
		string str = to_string(i);
		bool flag = true;
		for (int j = 0; j < str.size(); j++){
			if (str[j] != str[str.size() - j - 1]){
				flag = false;
			}
		}
		if (flag) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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



int main(void) {
    string s;
    cin >> s;
    string ref = "CODEFESTIVAL2016";
    int count = 0;
    for(int i = 0;i < s.size();i++){
        if(s[i] != ref[i])count ++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
  long long int N,K,S;
  scanf("%lld %lld",&N,&K);
  if(N>=K){
    N=N%K;
  }
  
  
  
  if(N<(double)(K/2)+1){
    S=N;
  }else{
    S=K-N;
  }
  printf("%lld\n",S);
  return 0;
}
    
  


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


const int mod = 1000000007;
//const int mod = 998244353;
const int INF = 1001001001;
const int di[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dj[] = {0, -1, 0, 1, -1, 1, -1, 1};

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    clock_t begin, end;
    begin = clock();
    ll a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    while(true){
        if(a%2 || b%2 || c%2) break;
        ll a_tmp, b_tmp, c_tmp;
        a_tmp = a/2;
        b_tmp = b/2;
        c_tmp = c/2;
        a = b_tmp + c_tmp;
        b = a_tmp + c_tmp;
        c = a_tmp + b_tmp;
        cnt++;
        //cout << a << " " << b << " " << c << endl;
        end = clock();
        if(double(end - begin)/CLOCKS_PER_SEC > 1.6){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

typedef pair<int,int> P;
int N,M;
vector<int> G[20002];
vector<int> rG[20002];
bool used[20002];
int cmp[20002];
vector<int> vs;

void init(int size){
  vs.clear();
  for(int i=0;i<size;i++) {
    G[i].clear();
    rG[i].clear();
    cmp[i] = -1;
    used[i] = 0;
  }
}

void add_edge(int a,int b){//a->b
  G[a].push_back( b );
  rG[b].push_back( a );
}
void dfs(int id){
  if( used[id] ) return;
  used[id] = true;
  for(int i=0;i<(int)G[id].size();i++)
    dfs(G[id][i]);
  vs.push_back( id );
}
void rdfs(int id,int k){
  if( used[id] ) return;
  used[id] = true;
  cmp[id]=k;
  for(int i=0;i<(int)rG[id].size();i++)
    rdfs(rG[id][i],k);  
}

int scc(int size){
  memset(used,0,sizeof(used));
  for(int i=0;i<size;i++)
    dfs(i);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=(int)vs.size()-1;i>-1;i--){
    if( used[vs[i]] ) continue;
    rdfs(vs[i],k++);
  }  
  return k;
}

int rev(int a){
  if( a & 1 ) return --a;
  else return ++a;
}

void view(int size){
  for(int i=0;i<size;i++){
    if( G[i].empty() ) continue;
    cout << i << endl;
    for(int j=0;j<(int)G[i].size();j++){
      cout << " -> " << G[i][j] << endl;
    }
  }
}

//?????????a,~a,b,~b,c,~c...,?????????0,1,2,3,4,5...??¨????????????
bool two_SAT(const vector<P>& v,int size){
  // cout << "2-sat :" << size << endl;
  init( size );
  for(int i=0;i<(int)v.size();i++){
    //cout << v[i].first << " V " << v[i].second << endl;
    //aVb
    add_edge( rev(v[i].first), v[i].second );//~a->b
    add_edge( rev(v[i].second), v[i].first );//~b->a
  }
  //  view(size);
  scc(size);
  //x??¨~x?????°???????????£?????????????????????????????????
  for(int i=0;i<size;i+=2){
    //cout << i << " " << cmp[i] << ", " << cmp[i+1] << endl;
    if( cmp[i] == cmp[i+1] ) return false;
  }
  return true;
}

vector<int> V[20001];
int main(){
  
  while(cin >> N  >> M){
    for(int i=0;i<M;i++){
      int num1,num2;
      string d1,d2,bf;
      cin >> num1 >> d1 >> bf >> num2 >> d2;
      if( num1 > num2 ){
	swap(num1,num2);
	swap(d1,d2);
      }
      int a = 2*num1, b = 2*num2;
      if( d1 == "left" ) a++;
      if( d2 == "right" ) b++;
      V[a].push_back( b );      
    }
    for(int i=2;i<2*N;i++){
      V[i].push_back(i);
      sort(V[i].begin(),V[i].end());
      V[i].erase(unique(V[i].begin(),V[i].end()),V[i].end());
    }
    int st = 1, ed = N;
    int res = 1;
    while( st <= ed ){
      int h = (st+ed)/2;
      vector<P> nv;
      for(int i=2;i<2*h;i+=2){
	int n = (int)V[i].size(), m = (int)V[i+1].size();
      int x,y;
      for(x=0;x<n;x++)
	if( V[i][x] >= 2*h ) break;
      for(y=0;y<m;y++)
	if( V[i+1][y] >= 2*h ) break;
      for(int j=0;j<x;j++)
	for(int k=0;k<y;k++)
	  nv.push_back(P(V[i][j],V[i+1][k]));	      
      }
      if( two_SAT(nv,h*2) ){
	res = max( res, h );
	st = h + 1;
      } else {
	ed = h - 1;
      }
    }
    cout << res << endl;
    for(int i=0;i<2*N;i++) V[i].clear();
  }
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

ll n, d[300001] = {0};

bool check() {
  ll a = d[0];
  FOR(i, 1, n) {
    if (a < i * 10) return false;
    if (a < i * 10 + d[i]) a = i * 10 + d[i];
  }
  return true;
}

signed main() {
  cin >> n;
  rep(i, n) {
    cin >> d[i];
  }
  if (check()) {
    reverse(d, d + n);
    if (check()) {
      cout << "yes" << endl;
      return 0;
    } 
  }
  cout << "no" << endl;
	return 0;
}


Measured memory_bytes: 5524
n = int(input())

def three_points(p1,p2):
    q1 = ((2*p1[0]+p2[0])/3, (2*p1[1]+p2[1])/3)
    q2 = ((p1[0]+2*p2[0])/3, (p1[1]+2*p2[1])/3)
    dx,dy = p2[0]-p1[0], p2[1]-p1[1]
    q3 = (p1[0]+dx/2-3**0.5/6*dy, p1[1]+dy/2+3**0.5/6*dx)
    return [q1,q3,q2]

m = [(0,0),(100,0)]
for i in range(n):
    tmpm = []
    for j in range(len(m)-1):
        tmpm += [m[j]] + three_points(m[j],m[j+1])
    tmpm += [m[-1]]
    m = tmpm

for x in m:
    print(x[0], x[1])


Measured memory_bytes: 6208
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi A, B;
string S, T;

void input() {
  int x, y, z;
  cin >> N;
  ;
}
vector<pair<long long, long long>> prime_factorize(long long n) {
  vector<pair<long long, long long>> res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) {
      ++num;
      n /= p;
    }
    res.push_back(make_pair(p, num));
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

map<int, int> mp;
void solve() {
  rep(i, 1, N) {
    auto v = prime_factorize(i);
    for (auto x : v) {
      mp[x.first] += x.second;
    }
  }
  int ans = 1;
  rep(i, 1, N) {
    ans *= mp[i] + 1;
    ans %= MOD;
  }
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int[][] costs;
    static int[] cities;
    static int[][] dp;
    static int r;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		r = sc.nextInt();
		cities = new int[r];
		for (int i = 0; i < r; i++) {
		    cities[i] = sc.nextInt() - 1;
		}
		costs = new int[n][n];
		for (int i = 0; i < n; i++) {
		    Arrays.fill(costs[i], Integer.MAX_VALUE / 10);
		    costs[i][i] = 0;
		}
		for (int i = 0; i < m; i++) {
		    int a = sc.nextInt() - 1;
		    int b = sc.nextInt() - 1;
		    int c = sc.nextInt();
		    costs[a][b] = c;
		    costs[b][a] = c;
		}
		for (int i = 0; i < n; i++) {
		    for (int j = 0; j < n; j++) {
		        for (int k = 0; k < n; k++) {
		            costs[j][k] = Math.min(costs[j][k], costs[j][i] + costs[i][k]);
		        }
		    }
		}
		dp = new int[r][1 << r];
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < r; i++) {
		    min = Math.min(min, dfw(i, (1 << r) - 1));
		}
		System.out.println(min);
    }
    
    static int dfw(int start, int key) {
        int nextkey = key ^ (1 << start);
        if (nextkey == 0) {
            return 0;
        }
        if (dp[start][key] != 0) {
            return dp[start][key];
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < r; i++) {
            int next = (1 << i);
            if ((nextkey & next) == 0) {
                continue;
            }
            min = Math.min(min, dfw(i, nextkey) + costs[cities[start]][cities[i]]);
        }
        dp[start][key] = min;
        return min;
    }
}



Measured memory_bytes: 47608
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
	unordered_map<int, int> cnt;
  	int val;
  	for(int i = 0; i < 3; i++) {
    	cin >> val;
      	cnt[val] += 1;
    }
  	for(auto p: cnt) {
    	if(p.second == 2) {
        	cout << "Yes" << endl;
          	return 0;
        }
    }
  	cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
using namespace std;
typedef long long int llint;
const llint big=((llint)1<<(llint)30);
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pub push_back
#define res resize
//JOI 2017 semiexp O(NlogN)
//3:25~4:40
//Tmin 
int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	if(b+b==a+c){cout<<"YES"<<endl;}
	else{cout<<"NO"<<endl;}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    ll a[N];
    for (int i = 0; i < N; ++i) cin >> a[i];
    ll t = 0;
    for (int i = 0; i < N; ++i) t = t ^ a[i];

    if (t == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1024
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 08/08/2017 12:20:10
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	string s;
	cin>>s;
	int n = s.size();
	for(int i = n-2; i >= 0; i--){
		if(i % 2 == 0){
			string s1 = "", s2 = "";
			for(int j = 0; j < i/2; j++) s1 += s[j];
			for(int j = i/2; j < i; j++) s2 +=s[j];
			if(s1 == s2) {
				cout<<i<<endl;
				break;
			}
		}
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
  ll L; cin >> L;
  ll R; cin >> R;
  ll _L = L % 2019;
  ll _R = R % 2019;
  if (R-L >= 2019) _R += 2019;
  if (_L > _R) swap(_L, _R);
  ll m = 1000000000;
  for (ll j=_L; j <= _R; ++j) {
    for (ll k=j+1; k <= _R; ++k) {
      m = min(m, (j*k)%2019);
    }
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cctype>
#include<algorithm>
#include<cmath>
using namespace std;
bool List[300005]={};
int N;
char ch=0;
int Ans=0;
int MnC=2147483647;
int main()
{
	scanf("%d",&N);
	while(!isalpha(ch))ch=getchar();
	for(int i=1;i<=N;++i)
	{
		List[i]=(ch=='E')?1:0;
		Ans+=List[i];
		ch=getchar();
	}
	for(int le=0,lw=0,i=1;i<=N;++i)
	{
		if(List[i]==1)++le;
		MnC=min(MnC,lw+Ans-le);
		if(List[i]==0)++lw;
	}
	printf("%d",MnC);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>

const int m=998244353;
using namespace std;

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}





int32_t main(){
	
	//FIO();
	
		int n,k;cin>>n>>k;
		int array[n],dp[n];
		for(int i=0; i<n; i++){
			cin>>array[i];
		}
		for(int i=0; i<n; i++)
			dp[i]=1e9;
		dp[0]=0;
		for(int i=0; i<n; i++){
			for(int j=1; j<=k && i+j<n; j++){
				dp[i+j]=min(dp[i+j],dp[i]+abs(array[i]-array[i+j]));
			
			}
			
		}
		cout<<dp[n-1]<<"\n";
	

	

	return 0;
		
	
		
		
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define speed ios::sync_with_stdio(0); cin.tie(0);
int const N = 1e5 + 1;

int main(){
	speed
	int n, a, b, ans1 = 0, ans2 = 0, ans3 = 0;
	cin >> n >> a >> b;
	f(i, 0, n){
		int x;
		cin >> x;
		if (x <= a)ans1++;
		else if (x >= a + 1 && x <= b)ans2++;
		else if (x >= b + 1)ans3++;
	}
	cout << min(ans1, min(ans2, ans3)) << endl;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n, m, q; cin >> n >> m >> q;

    vector<vector<int>> c(n, vector<int>(n, 0));
    for (int i = 0; i < m; ++i) {
        int l, r; cin >> l >> r;
        --l; --r;

        c[l][r]++;
    }

    // 2次元累積和
    vector<vector<int>> sum(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + c[i][j];
        }
    }

    for (int i = 0; i < q; ++i) {
        int l, r; cin >> l >> r;
        --l; --r;

        cout << sum[r + 1][r + 1] - sum[r + 1][l] - sum[l][r + 1] + sum[l][l] << endl;
    }
}

Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N,K;
    cin >> N >> K;
    int m = ((N-1)*(N-2))/2;
    if(m < K){
        pr(-1);
        return 0;
    }

    vector<pii> ans;
    Rep(i,2,N+1){
        ans.pb({1,i});
    }
    Rep(i,2,N){
        Rep(j,i+1,N+1){
            if(m==K){
                //終了
                pr(ans.size());
                for(auto&& a:ans) pr(a.fi, a.se);
                return 0;
            }
            ans.pb({i,j});
            m--;
        }
    }
                    pr(ans.size());
                for(auto&& a:ans) pr(a.fi, a.se);
}

Measured memory_bytes: 3672
e=Hash.new [];n=gets.to_i;(n-1).times{|i|a,b=gets.split;e[a]+=[i];e[b]+=[i]};a=[0]*(n-1);(1..n).map{|w|u={};e[v=w.to_s].map{|j|u[a[j]]=1};t=1;e[v].map{|j|1>a[j]&&(t+=1until u[t]==$\;a[j]=t;t+=1)}};p a.max;$><<a*$/

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

int main() {
  std::vector<int> ans = {0,0,0};
  int a, b;
  std::cin >> a >> b;
  if (a==1 || b==1) {
    ans[0] = 1;
  }
  if (a==2 || b==2) {
    ans[1] = 1;
  }
  if (a==3 || b==3) {
    ans[2] = 1;
  }
  
  for (int i=0;i<3;i++){
    if (ans[i]==0)
      std::cout << i+1 << std::endl;
  }
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#define SIZE 200005
#define INF 10000000000000000LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
typedef pair <ll,P> PP;

struct UF
{
	int par[SIZE],rank[SIZE];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x)
	{
		if(par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]) par[x]=y;
		else
		{
			par[y]=x;
			if(rank[x]==rank[y]) rank[x]++;
		}
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
}uf;
ll A[SIZE];
ll D;
vector <PP> edge;

void solve(int l,int r)
{
	if(l==r) return;
	int m=(l+r)/2;
	ll mn=INF;
	int pl=-1;
	for(int i=l;i<=m;i++)
	{
		ll vl=A[i]-D*(ll) i;
		if(mn>vl)
		{
			mn=vl;
			pl=i;
		}
	}
	mn=INF;
	int pr=-1;
	for(int i=m+1;i<=r;i++)
	{
		ll vl=A[i]+D*(ll) i;
		if(mn>vl)
		{
			mn=vl;
			pr=i;
		}
	}
	for(int i=l;i<=m;i++)
	{
		ll vl=A[i]-D*(ll) i;
		ll vr=A[pr]+D*(ll) pr;
		edge.push_back(PP(vl+vr,P(i,pr)));
	}
	for(int i=m+1;i<=r;i++)
	{
		ll vl=A[pl]-D*(ll) pl;
		ll vr=A[i]+D*(ll) i;
		edge.push_back(PP(vl+vr,P(pl,i)));
	}
	solve(l,m);
	solve(m+1,r);
}
int main()
{
	int n;
	scanf("%d %lld",&n,&D);
	for(int i=0;i<n;i++) scanf("%lld",&A[i]);
	solve(0,n-1);
	sort(edge.begin(),edge.end());
	uf.init(n+2);
	ll ret=0;
	for(int i=0;i<edge.size();i++)
	{
		P p=edge[i].second;
		if(!uf.same(p.first,p.second))
		{
			uf.unite(p.first,p.second);
			ret+=edge[i].first;
		}
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 69344
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  vi a(n);
  REP(i, n) { cin >> a[i]; }

  vi gcdl(n, 0), gcdr(n, 0);
  gcdl[0] = a[0];
  gcdr[n - 1] = a[n - 1];
  FOR(i, 1, n - 1) {
    gcdl[i] = __gcd(gcdl[i - 1], a[i]);
    gcdr[n - 1 - i] = __gcd(gcdr[n - i], a[n - 1 - i]);
  }
  int ans = max(gcdl[n - 2], gcdr[1]);
  FOR(i, 1, n - 1) { ans = max(ans, __gcd(gcdl[i - 1], gcdr[i + 1])); }

  cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>    
#define pb push_back

#define FOR(x,to) for(int x=0;x<(to);x++)
#define F0R(x,in,to) for(int x=(in);x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))

typedef long long ll;
using namespace std;
ll MOD = 998244353;

typedef pair<int,int> ii;
typedef struct {int a,b,c;}iii;
typedef vector<int> vi;

void mosA(vector<int> a){
	for(int i=0; i<a.size(); i++) printf("%d ",a[i]);
	printf("\n");
}
void mosP(vector<ii> a){
	for(int i=0; i<a.size(); i++) printf("%d %d\n",a[i].first,a[i].second);
	printf("\n");
}

ll min_especial(ll a, ll b){
  if(a!=-1 && b!=-1) return min(a,b);
  else return max(a,b);
}
/*
bool ord(ii a, ii b){
	if(a.first == b.first){
		return a.second < b.second;
	}
	return a.first < b.first;
}*/

bool ord(ll a, ll b){
	return a>b;
}

int ans = 0;
int a,n,nn,w,t,k,m,z,q,l,r,x,b,y;
char A[200005],B[200005];

int main(){
	scanf("%d%d%d",&n,&m,&nn);
	int f,c;
	scanf("%d%d",&f,&c);
	scanf(" %s %s",A,B);

	

	for(int i=0, cont = c; i<nn; i++){
		if(A[i] == 'R')cont++;
		//cout<<cont<<endl;
		if(cont>m) return !printf("NO");
		if(B[i] == 'L')cont=max(1,cont-1);
	}

	for(int i=0, cont = c; i<nn; i++){
		if(A[i] == 'L')cont--;
		if(cont<1) return !printf("NO");
		if(B[i] == 'R')cont=min(m,cont+1);
	}

	for(int i=0, cont = f; i<nn; i++){
		if(A[i] == 'U')cont--;
		if(cont<1) return !printf("NO");
		if(B[i] == 'D')cont=min(n,cont+1);
	}

	for(int i=0, cont = f; i<nn; i++){ 	 	
		if(A[i] == 'D')cont++;
		if(cont>n) return !printf("NO");
		if(B[i] == 'U')cont=max(1,cont-1);
	}

	return !printf("YES");

}




// REVISATE ESTO:
// - memset(A,-1,SIZEOF()*n)
// - (x-y+MOD)%MOD
// - int o ll?

Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long D = sc.nextLong();
		long E = C*D;
		long F = Math.max(C,D);
		long G = Math.min(C,D);
		for( long i=1; i*i<=G; i++ ){
			if( G%i==0 ){
				if( F%(G/i)==0 ){
					E = (C*D)/(G/i);
					break;
				}
				if( F%i==0 ){
					E = (C*D)/i;
				}
			}
		}    
		System.out.println( (B-A+1) - (B/C+B/D-B/E) + ((A-1)/C+(A-1)/D-(A-1)/E) );     
	}
}


Measured memory_bytes: 23764
<?php
$stdin = trim(fgets(STDIN));

$num = explode(" ",$stdin);
$a = $num[0];
$b = $num[1];

if($a < $b){
  echo"a < b";
}

if($a > $b) {
  echo"a > b";
} 

if($a == $b){
  echo"a == b";
}

?>

Measured memory_bytes: 9192