akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(ALL(v));
  cout << v[n/2] - v[n/2-1] << endl;

}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var k, n int
	fmt.Fscan(r, &k)
	fmt.Fscan(r, &n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &as[i])
	}

	ds := make([]int, n)
	for i := 0; i < n-1; i++ {
		ds[i] = as[i+1] - as[i]
	}
	ds[n-1] = k - as[n-1] + as[0]

	mx := 0
	for i := 0; i < n; i++ {
		mx = max(mx, ds[i])
	}

	fmt.Println(k - mx)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


Measured memory_bytes: 5504
import sys, math

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

A, B, X = MAP()
V = A* A * B - X

if V < X:
    # Y = 2 * vacant / A / A
    if V > 0:
        ans = 90 - math.degrees(math.atan(A**3 / (2*V)))
    else:
        ans = 0
else:
    # Y = 2 * X / A / B
    ans = 90 - math.degrees(math.atan(2 * X / (A*B*B)))
print(ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std; 
  
typedef long long int ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef priority_queue <ll> pqb;
typedef priority_queue <ll, vector<ll>, greater<ll>> pqs;
double EPS = 1e-9; 
long long INF = 1000000000000000005ll; 
double PI = acos(-1); 
#define M 1000000007ll
#define D 998244353ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound  
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a))
#define GCD(a,b) __gcd(a,b)
#define setbits(x)   __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x) 
#define ps(x,y)  fixed<<setprecision(y)<<x
#define endl '\n'
#define ff first 
#define ss second 
#define mp make_pair  
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
  
inline string IntToString(ll a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline ll StringToInt(string a) 
{ 
    char x[100]; 
    ll res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  
 
inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
}

bool cmp(pll a,pll b)
{
  ll as=a.ff-a.ss;
  ll bs=b.ff-b.ss;
    return (as>bs);
}

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

vl v[100005];
vector <bool> vis(100005);
ll ma=0;
void dfs(ll u,ll d){
	//vis[u]=1;
	ma=max(ma,d);
	for(int ch:v[u]){
			dfs(ch,d+1);
	}
}

int main() {
    FAST
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	ll n;
   	cin>>n;
   	double p[n];
   	for(ll i=0;i<n;i++){
   		cin>>p[i];
   	}
   	double dp[n+1][n+1];
   	memset(dp,0,sizeof dp);
   	dp[1][0]=1-p[0];
   	for(ll i=2;i<=n;i++){
   		dp[i][0]=dp[i-1][0]*(1-p[i-1]);
   	}
   	dp[1][1]=p[0];
   	for(ll i=2;i<=n;i++){
   		for(ll j=1;j<=n;j++){
   			dp[i][j]+=p[i-1]*dp[i-1][j-1];
   			dp[i][j]+=(1-p[i-1])*dp[i-1][j];
   		}
   	}
   	double ans=0;
   	for(ll i=n/2+1;i<=n;i++){
   		ans+=dp[n][i];
   	}
   	cout<<ps(ans,10)<<endl;
    return 0; 
}

Measured memory_bytes: 76432
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

bool check(string s , ll start , ll end) {

    while(start < end) {
        if(s[start] != s[end]) {
            return false;
        }
        start++;
        end--;
    }

    return true;
}

int main()
{   
    //#ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif

    
    string s;
    cin >> s;

    ll n = s.length();
    //string s1 = s.substr(0 , (n-1)/2) , s2 = s.substr((n+3)/2 - 1 , )
    if(check(s , 0 , (n-1)/2-1) && check(s , (n+3)/2 - 1 , n-1) && check(s , 0 , n-1)) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}

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

const int N = 1e5 + 10;

int n, k, q, a[N], b[N];
int check(int mn, int mx) {
    int c1 = 0, c2 = 0;
    int ret = 0;
    for(int i = 1; i <= n; i++) {
        if(a[i] < mn) {
            ret += min(c1, max(0, c1 + c2 - k + 1));
            c1 = 0; c2 = 0;
        } else if(a[i] >= mn && a[i] <= mx) c1++;
        else c2++;
    }
    if(a[n] >= mn) ret += min(c1, max(0, c1 + c2 - k + 1));
    // printf("%d %d %d\n", mn, mx, ret);
    return ret;
}

int main() {
    cin >> n >> k >> q;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b + 1, b + 1 + n);
    // for(int i = 1; i <= n; i++) {
    //     printf("b[%d]:%d\n", i, b[i]);
    // }
    int ans = 2e9;
    if(q == 1) ans = 0;
    for(int i = 1; i < n; i++) {
        int l = i + 1, r = n, res = -1;
        while(l <= r) {
            int mid = l + r >> 1;
            if(check(b[i], b[mid]) >= q) {
                res = mid;
                r = mid - 1;
            } else l = mid + 1;
        }
        if(res != -1) {
            ans = min(ans, b[res] - b[i]);
            // cout << b[res] - b[i] << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (A%2==0||B%2==0) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
string S;
int n,d,c;
int main(){
	cin>>n>>S;
	for(int i=0;i<S.size();i++)
	{
		if(S[i]=='(')c++;
		else c--;
		d=min(d,c);
	}
	for(int i=0;i<-d;i++)
		cout<<"(";
	cout<<S;
	for(int i=0;i<c-d;i++)
		cout<<")";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

std::vector<VI> g;
VI topo;
std::vector<bool> vis;

void dfs(int v){
	vis[v] = true;
	TRAV(ch, g[v]){
		if(!vis[ch]) dfs(ch);
	}
	topo.push_back(v);
}

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	std::string s;
	std::cin >> s;
	g.resize(SZ(s)+1);
	FOR(i, SZ(s)){
		if(s[i] == '>') g[i].push_back(i+1);
		else g[i+1].push_back(i);
	}
	vis.resize(SZ(s)+1);
	FOR(i, SZ(s)+1){
		if(!vis[i]) dfs(i);
	}
	ll ans = 0;
	std::vector<int> dp(SZ(s)+1);
	TRAV(i, topo){
		TRAV(ch, g[i]){
			dp[i] = std::max(dp[i], dp[ch]+1);
		}
		ans += dp[i];
	}
	std::cout << ans;
	return 0;
}


Measured memory_bytes: 56084
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    string s, t;
    cin >> s >> t;
    int n = s.length();
    vector<int> table_st(26, -1), table_ts(26, -1);
    for(int i = 0; i < n; ++i){
        int foo = s[i] - 'a', bar = t[i] - 'a';
        if(table_st[foo] == -1){
            table_st[foo] = bar;
        }
        else{
            if(table_st[foo] != bar){
                cout << "No\n";
                return 0;
            }
        }
        if(table_ts[bar] == -1){
            table_ts[bar] = foo;
        }
        else{
            if(table_ts[bar] != foo){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 916
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int N = 0;
		int candy = 0;
		Scanner scan = new Scanner(System.in);
		
		N = scan.nextInt();
		
		for(int i = 1; i <= N; i++) {
			candy += i;
		}
		System.out.println(candy);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

#define MAXN 200000

int n;
int d[MAXN];
bool seen[MAXN];

void dfs(Graph &G, int v) {
    seen[v] = 1;
    for (auto nv : G[v]) {
        if (seen[nv]) continue;
        d[nv] += d[v];
        dfs(G, nv);
    }
}


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    int q;
    cin >> n >> q;
    Graph G(n);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i, q) {
        int p, x;
        cin >> p >> x;
        --p;
        d[p] += x;
    }

    dfs(G, 0);

    rep(i, n) {
        cout << d[i];
        if (i != n - 1) cout << " ";
    }
    cout << endl;

    return 0;
}

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

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

    for(int i=0; i<s.size()-1; i++){
        if(s.at(i) == s.at(i+1)) {
            cout << "Bad" << endl;
            return 0;
        }
        if(i==s.size()-2){
            cout << "Good" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <atcoder/math>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
int main() {
	int T;
	cin >> T;
	for (int i = 0; i < T; ++ i) {
		int n, m, a, b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(n, m, a, b) << endl;
	}
}


Measured memory_bytes: 3608
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

int N;
ll A, B;
ll h[100005];

ll ceil(ll x, ll y){
    return x/y + ((x%y)!=0);
}

bool ok(ll T){
    ll hit = 0;

    ll th[100005];
    FOR(i,N) th[i] = h[i] - B*T;
    FOR(i,N){
        if(th[i] <= 0) continue;
        hit += (th[i] + (A-B) - 1) / (A-B);
    }
    return hit <= T;
}

int main(){

    ios :: sync_with_stdio(false);
    
    cin >> N >> A >> B;
    ll upr = 0ll;
    FOR(i,N) cin >> h[i], upr = max(upr, h[i]);

    ll lo = 0, hi = 1e9, mid, ans = 1e15;
    while(lo <= hi){
        mid = (lo + hi)/2;
        if(ok(mid)){
            ans = mid;
            hi = mid-1;
        }
        else lo = mid+1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
string N;
long long dp[1000010][2];
int main () {
    cin >> N;
    dp[0][0] = 0, dp[0][1] = 1;
    int l = N.length();
    for (int i = 1; i <= l; i++) {
        for (int f = 0; f < 2; f++) {
            int k = N[i-1] - '0' + f;
            if (k == 10) {
                dp[i][f] = dp[i-1][1];
            }
            else {
                dp[i][f] = min(dp[i-1][1]+(10-k), dp[i-1][0]+k);
            }
        }
    }
    cout << dp[l][0] << endl;
}

Measured memory_bytes: 17028
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;

int N, M;
int ANS[50];

int main(){
  cin >> N >> M;
  rep(i, N){
    int k;
    cin >> k;
    rep(j, k){
      int a;
      cin >> a;
      // 0インデックスに揃える
      a--;
      ANS[a]++;
    }
  }

  int ans = 0;
  rep(i, M){
    if (ANS[i]==N) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3600
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def dist(x, y): 
    return (x**2+y**2)**0.5
def main():
    N, D = map(int, readline().split())
    cnt = 0
    for _ in range(N):
        x, y = map(int, readline().split())     
        if dist(x, y) <= D:
            cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()


Measured memory_bytes: 9524
import java.util.*;
public class Main{
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       String ans="Close";
       String s =sc.nextLine();
   if(s.equals("1 1 0")) ans="Open";
   else if(s.equals("0 0 1")) ans="Open";
	   System.out.println(ans);
   }
}

Measured memory_bytes: 17116
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


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

  for (int bit=0; bit<(1<<3); bit++){
    int sum = s.at(0) - '0';
    for (int i=0; i<3; i++){
      if (bit & (1<<i)) sum += s.at(i+1) - '0';
      else sum -= s.at(i+1) - '0';
    }
    if (sum == 7){
      cout <<s.at(0);
      for (int i=0; i<3; i++){
        if (bit & (1<<i)) cout <<"+";
        else cout <<"-";
        cout <<s.at(i+1);
      }
      cout <<"=7" <<endl;
      break;
    }
  }
}

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

using namespace std;

int N;
int A,B,C;

  long long brute_force_search(int cnt, int a, int b, int c, int L[]) {
    long long INF = std::pow(10, 9.0);
    if (cnt==N) {
      //return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      
      if ((a!=0)&&(b!=0)&&(c!=0)){
        return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      } else {
        return INF;
      }
    }
    vector<long long> ansc(4);
    ansc[0] = brute_force_search(cnt+1, a, b, c, L);
    ansc[1] = brute_force_search(cnt+1, a+L[cnt], b, c, L)+10;
    ansc[2] = brute_force_search(cnt+1, a, b+L[cnt], c, L)+10;
    ansc[3] = brute_force_search(cnt+1, a, b, c+L[cnt], L)+10;
    int min = *std::min_element(ansc.begin(), ansc.end());
    return min;
  }

int main() {
  cin >> N >> A >> B >> C;
  
  int len[N];
  for (int i; i<N;i++){
    cin >> len[i];
  } 
  
  long long ans;
  ans = brute_force_search(0, 0, 0, 0, len);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int t = 1;
		while (t-->0) {
		    double l = sc.nextDouble();
		    double p = Math.pow(l,3)/(27.0);
		    System.out.println(p);
		}
	}
	static boolean isPalin(String s){
	    int n = s.length();
	    boolean ok = true;
		for(int i=0;i<n/2;i++){
		     if(s.charAt(i)!=s.charAt(n-i-1)){
		            ok = false;
		            break;
		    }
		}
		return ok;
	}
	static class Query {
		int x1, x2, y, id;
		public Query(int c, int d, int e, int a){
			x1 = c;
			x2 = d;
			y = e;
			id = a;
		}
	}
	static class Compare1 implements Comparator<Query>{
		@Override
		public int compare(Query q1, Query q2){
			if(q1.x2==q2.x2) return q1.x1-q2.x1;
			return q1.x2-q2.x2;
		}
	}
	static class Pair implements Comparable<Pair>{
		int a, b;
		public Pair(int c, int d){
			a = c;
			b = d;
		}
		public int compareTo(Pair p){
		    return a-p.a;
		}
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}
		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

Measured memory_bytes: 20820
#include<iostream>
#include<string>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3600
a,b,k = map(int,input().split())

#a,b,k=8,12,2

c = 0
ans = 0
for i in range(min(a,b),0,-1):
  if(a%i == 0 and b%i == 0):
    c += 1
    if(c == k):
      ans = i
      break

print(ans)

Measured memory_bytes: 3060
N = int(input())
P = [1,1]

for i in range(N):
  Q = list(map(int,input().split()))
  t = Q[0]
  a = Q[1]
  m = max(P[0]//t,P[1]//a,1)
  while True:
    t = Q[0] * m
    a = Q[1] * m
    if t >= P[0] and a >= P[1]:
      P[0] = t
      P[1] = a
      break
    m += 1

print(sum(P))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    bool a[n];
    char c1[26]={},c2[26]={};
    bool ans=true;
    for(int i=0;i<n;i++){
        c1[s.at(i)-'a']++;
    }
    for(int i=0;i<n;i++){
        c2[t.at(i)-'a']++;
    }
    int n1=0,n2=0;
    for(int i=0;i<26;i++){
        if(c1[i]>0) n1++;
        if(c2[i]>0) n2++;
    }
    if(n1!=n2) ans=false;
    for(int i=0;i<n;i++) a[i]=true;
    for(int i=0;i<n;i++){
        if(s.at(i)!=t.at(i)&&a[i]){
            for(int j=i;j<n;j++){
                    if(s.at(j)==s.at(i)&&t.at(j)!=t.at(i)){
                        ans=false;
                        a[j]=false;
                    }
                    else if(s.at(j)==s.at(i)){
                        a[j]=false;
                    }
            }
        }
            
        }
    if(ans) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 904
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define N 200005
using namespace std;
inline int read()
{
	char c=getchar(); int num=0,f=1;
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c<='9'&&c>='0') { num=num*10+c-'0'; c=getchar(); }
	return num*f;
}
int n,p[N],ans;
int main()
{
	n=read();
	for (int i=1;i<=n;i++) p[read()]=i;
	int tmp=0;
	for (int i=1;i<=n;i++)
	{
		if (p[i]>p[i-1]) tmp++;
		 else tmp=1;
		ans=max(ans,tmp);
	}
	printf("%d",n-ans);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
	int a[101]={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;
	cin>>n;
	cout<<a[n-1];
}
 

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

int main(void){
    double a,b,x;
    cin >> a >> b >> x;
    x /= a;
    double PI = acos(-1);
    double t1 = atan(2.0/a * (b - x/a));
    double t2 = atan(b*b/(2*x));
    printf("%.10f\n",  ( b <= a * tan(t2) ? t2 : t1) * 180.0/PI);
    return 0;
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
S = input()
check = a+b
rank_b = 0
cnt = 0
for i in range(len(S)):
    if S[i] == 'a':
        if cnt<check:
            cnt+=1
            print('Yes')
        else:
            print('No')
    elif S[i] == 'b':
        rank_b += 1
        if cnt<check and rank_b<=b:
            cnt+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 4016
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}


int main(void){

    ll n;
  cin>>n;
  vector<ll> s(n);
  ll sum = 0;
  REP(i, n){
    ll x;
    cin>>x;
    s[i] = x;
    sum += x;
  }
  if(sum%10!=0) cout<<sum<<endl;
  else{
    ll sub;
    sort(s.begin(), s.end());
    ll sub_sum = s[0];
    ll count = 0;

    while(1){
      if(count>=n){
        cout<<"0"<<endl;
        return 0;
      }
      
      if(s[count]%10!=0){
        sub = min(sub_sum, s[count]);
        break;
      }else{
        sub_sum += s[count];
      }
      count++; 
    }
    cout<<sum-sub<<endl;
  }
  
  
  
}

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

int main() {
int n,m;
cin >> n >> m;
cout << n*(n-1)/2 + m*(m-1)/2 << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;

int n;
int a[3000];

signed main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	
	int ans = 0;
	for (i = 0; i < n; i++) {
		ans += a[i] - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
const ll inf = 1e9 + 7;
ll a[N],sp[N],n,k,sl = 0;
int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        if (a[i] == 0) sl++;
    }
    sort(a + 1,a + 1 + n);
    for (int i = 1; i <= n; i++) sp[i] = (a[i] < 0) ? sp[i - 1] + 1 : sp[i - 1];
    //for (int i = 1; i <= n; i++) cout << sp[i] << " " ; cout << "\n";
    int getmax = 0 , q = ((sp[n] - sp[n - k]) % 2 == 0) ? 1 : -1;
    long double fr = 1 , nr = 1;
    for (int i = 1 , j = n - k + 2; i <= k; i++ , j++){
        int temp = ((sp[i] + sp[n] - sp[j - 1]) % 2 == 0) ? 1 : -1;
        ll c = (ll)2e18 / fr , d = (ll)2e18 / nr;
        if (c >= abs(a[i]) && d >= abs(a[j - 1])) fr = fr * abs(a[i]) , nr = nr * abs(a[j - 1]);
        else fr = fr / abs(a[j - 1]) , nr = nr / abs(a[i]);
        //cout << fr << " " << nr << "\n";
        if (temp > q){
            getmax = i;
            q = temp;
        }
        else 
        if (temp == q && temp == 1){
            if (fr > nr) getmax =  i;
            fr = 1; nr = 1;
        }
        else
        if (temp == q && temp == -1){
            if (fr < nr) getmax = i;
            fr = 1; nr = 1;
        }
        //cout << i << " " << j << "\n";
    }
    long long  ans = 1;
    for (int i = 1; i <= getmax; i++) ans = (ans * abs(a[i])) % inf; 
    for (int i = n - k + getmax + 1; i <= n; i++) ans = (ans * abs(a[i])) % inf;
    if ((sp[getmax] + sp[n] - sp[n - k + getmax]) % 2 == 0) cout << ans;
    else cout << (-ans + inf + inf) % inf;
    return 0;
}

Measured memory_bytes: 6664
#include<bits/stdc++.h>
using namespace std;
int n;
bool g[444][444];
int main(){
	int m;
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++)if(i!=j)
		g[i][j] = true;
	while(m--){
		int x,y;
		scanf("%d%d",&x,&y);
		if(g[x][y]){
			g[x][y] = g[y][x] = false;
			for(int i=1; i<=n; i++)if(x!=i)
				if(!g[x][i])
					g[i][y] = g[y][i] = false;
			for(int i=1; i<=n; i++)if(y!=i)
				if(!g[y][i])
					g[i][x] = g[x][i] = false;
		}else
		for(int i=1; i<=n; i++)
			g[x][i] = g[i][x] = g[y][i] = g[i][y] = false;
	}
	int res=0;
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
			if(g[i][j]){
				res++;
			}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}



int main(void){
   
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,k,b,count1=0,a2,b2;
char a[10000];
scanf("%lld%lld%s",&n,&k,a);
k--;
for(i=0;i<n;i++){
    if(i==k){
        a[i]=a[i]-65+97;
        break;
    }
   
}
printf("%s",a);
return 0;
}


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

int main() {
  int x;
  cin >> x;
  int c500 = x/500;
  x -= c500*500;
  int c5 = x/5;
  int ans = c500*1000 + c5*5;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n,ac=0,wa=0,tle=0,re=0;
    cin>>n;
    string s;
    for(int i=0;i<n;++i){
        cin>>s;
        if(s=="AC") ac++;
        else if(s=="WA") wa++;
        else if(s=="TLE") tle++;
        else {
            re++;
        }
    }
    cout<<"AC"<<" x "<<ac<<endl;
    cout<<"WA"<<" x "<<wa<<endl;
    cout<<"TLE"<<" x "<<tle<<endl;
    cout<<"RE"<<" x "<<re<<endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int> a(n);
	for (int i=0; i<n; i++) cin>>a[i];
	sort(a.begin(), a.end());
	cout << a[n-1]-a[0] << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long f[100009], ef[100009], depe[100009], pas[100009];
vector<long long> ve[123456];
long long M;
void deefes(long long x){
    ef[x] = 1;
    depe[x] =1;
    for(auto y : ve[x]){
        if(ef[y]) continue;
        deefes(y);
        depe[x] = depe[x] * depe[y] % M;
    }
    depe[x] ++;
}
void dfs(long long x, long long ze){
    f[x] = 1;
    pas[x] = ze;
    vector<pair<long long,long long> > v;
    for(auto y : ve[x]){
        if(f[y]) continue;
        v.push_back({y, depe[y]});
        pas[x] = pas[x] * depe[y] % M;
    }
    if(v.size() == 0) return;
    v.push_back({-1, ze});
    vector<long long> pre(v.size()+2);
    vector<long long> suf(v.size()+2);
    pre[0] = 1;
    for(long long i = 0; i < v.size(); i++)
        pre[i+1] = pre[i] * v[i].second % M;
    suf[v.size() + 1] = 1;
    for(long long i = v.size(); i >= 1; i--)
        suf[i] = suf[i + 1] * v[i - 1].second % M;
    for(long long i =0 ; i < v.size() - 1; i++){
        dfs(v[i].first, (pre[i] * suf[i + 2]  + 1) % M);
    }

}
pair<long long,long long> x[100009];
 main(){
    long long n;
    cin >> n >> M;
    for(long long i = 0; i < n - 1; i ++){
        long long a, b;
        cin >> a >> b;
        ve[a].push_back(b);
        ve[b].push_back(a);
    }
    deefes(1);
    dfs(1, 1);
    for(long long i = 1; i <= n; i++)
        cout << pas[i] << endl;
}


Measured memory_bytes: 27776
import java.util.*;
import java.io.*;
import java.lang.*;


public class Main{
	public static void main(String[] args) throws IOException{
        int n = sc.nextInt();
        int[][] arr = new int[n][3];
        for(int i=0;i<n;++i)
            for(int j=0;j<=2;++j) arr[i][j] = sc.nextInt();
        int[][] dp = new int[n][3];
        dp[0][0] = arr[0][0];
        dp[0][1] = arr[0][1];
        dp[0][2] = arr[0][2];
        for(int i=1;i<n;++i){
            for(int j=0;j<3;++j){
                if (j==0)
                    dp[i][j] = Math.max(arr[i][0] + dp[i-1][1],arr[i][0] + dp[i-1][2]);
                if (j==1)
                    dp[i][j] = Math.max(arr[i][1] + dp[i-1][0],arr[i][1] + dp[i-1][2]);
                if (j==2)
                    dp[i][j] = Math.max(arr[i][2] + dp[i-1][1],arr[i][2] + dp[i-1][0]);
            }
        }
        int max = -1;
        for(int i=0;i<3;++i)
            if (dp[n-1][i] > max) max = dp[n-1][i];
        System.out.println(max);
	}
}

class sc{
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tokenizer = new StringTokenizer("");
    static String next() throws IOException{
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    static double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
    static long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    static float nextFloat() throws IOException{
    	return Float.parseFloat(next());
    }
}

Measured memory_bytes: 50064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

void solve();
int sum(vector<int>::iterator,vector<int>::iterator);

int main() {

   solve();
   return 0;

}

void solve() {

   string a,b,c;

   cin >> a >> b >> c;

   cout << (char)(a[0]-32) << (char)(b[0]-32) << (char)(c[0]-32) << endl;

}

int sum(vector<int>::iterator b, vector<int>::iterator e) {

   int ans=0;

   for (; b < e; b++) {

      ans+=*b;

   }

   return ans;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 6
using namespace std;
int h,w,tmmp,ans,k;
int a[maxn][maxn],b[maxn][maxn];
char tmp;
int main(){
	cin>>h>>w>>k;
	for(int i=0;i<h;++i)
		for(int j=0;j<w;++j){
		cin>>tmp;
		if(tmp=='#') a[i][j]=1,b[i][j]=1;
		if(tmp=='.') a[i][j]=0,b[i][j]=0;
		}
	for(int i=0;i<(1<<h);++i){
		for(int j=0;j<(1<<w);++j){
			for(int x=0;x<h;++x)
				for(int y=0;y<w;++y)
				if(((1<<x)&i)||((1<<y)&j)) {b[x][y]=0;}
			tmmp=0;
			for(int x=0;x<h;++x)
				for(int y=0;y<w;++y)
				if(b[x][y]==1) tmmp++;
			if(tmmp==k) {ans++;}
			for(int x=0;x<h;++x)
				for(int y=0;y<w;++y)
				b[x][y]=a[x][y];
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3552
#include <stdio.h>

int main(void)
{
		int a,b,c,t;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	if(a>c){
		t=a;
		a=c;
		c=t;
	}
	if(b>c){
		t=b;
		b=c;
		c=t;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
import sys
input = sys.stdin.readline
from heapq import *
Q = int(input())
L, R = [], []
ans = 0
for _ in range(Q):
    a = [int(a) for a in input().split()]
    if a[0] == 1:
        ans += a[2]
        if len(L) == 0 or a[1] <= -L[0]:
            heappush(L, -a[1])
            ans += -L[0] - a[1]
        else:
            heappush(R, a[1])
            ans += a[1] + L[0]
        if len(R) > len(L):
            ans -= R[0] + L[0]
            heappush(L, -heappop(R))
        elif len(L) - len(R) >= 2:
            heappush(R, -heappop(L))
    else:
        print(-L[0], ans)

Measured memory_bytes: 76632
#include<iostream>
#include<string>
using namespace std;
int main(){
	double n,x[10],ans=0;
	string u[10];
	cin>>n;
	for(int a=0;a<n;a++){
		cin>>x[a]>>u[a];
		if(u[a]=="BTC"){
			x[a]=x[a]*380000;
			}
		ans=ans+x[a];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_;i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define INF 10000000

int main(){
    int a, b;
    cin >> a >> b;

    if (a >= 13){
        cout << b << endl;
    }else if (a >= 6 && a <= 12){
        cout << b / 2 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);

int main()
{
    unsigned ll n, a, b;
    cin >> n >> a >> b;
    unsigned ll sub = b - a, ans = 0;
    if (sub % 2 == 0)
    {
        ans = sub / 2;
        // even
    }
    else
    {
        ans = min(a-1, n - b)+1+((b-a-1)/2);
    }
    cout << ans << endl;
    return 0;
}

/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
using namespace std;
typedef size_t ll;
int main(void) {
  int N;
  cin >> N;
  vector<ll> A(N);
  ll x = 0;
  for (size_t i = 0; i < N; i++) {
    cin >> A[i];
    x ^= A[i];
  }
  for (size_t i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << (x ^ A[i]);
  }
  cout << endl;
  return 0;
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if((a+b)>(c+d)){cout<<"Left"<<endl;}
  else if((a+b)<(c+d)){cout<<"Right"<<endl;}
  else{cout<<"Balanced"<<endl;}
  
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
  char str_s[128];
  char *str_c="2019/04/30";
  char *str;
  scanf("%127s",str_s);
  str=str_s;
  if(strcmp(str,str_c)==0||strcmp(str,str_c)<0)
  {
    printf("Heisei");
  }
  else
  {
    printf("TBD");
  }
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define MAX 1000000
const int MOD = 1e9+7;

long long int fac[MAX], finv[MAX], inv[MAX];

// 前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i-1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
}

long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	int X, Y;
	scanf("%d %d", &X, &Y);
	COMinit();
	if ((X + Y) % 3 != 0) printf("0\n");
	else {
		int cnt_1 = X, cnt_2 = 0;
		while (2*cnt_1 + 1* cnt_2 != Y) {
			cnt_1 -= 2;
			cnt_2 += 1;
		}
		printf("%lld\n", COM(cnt_1 + cnt_2, cnt_1));
	}
	return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	string s; cin >> s;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D') {
				cnt++;
			}
		}
		else {
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D') {
				cnt++;
			}
		}
	}
	if (cnt == s.size()) cout << "Yes" << endl;
	else cout << "No" << endl;



	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int m,f,r;
	char grade;
	while(true){
		scanf("%d %d %d",&m,&f,&r);
		if(m == -1 && f == -1 && r == -1) break;
		if(m == -1 || f == -1){
			grade = 'F';
		}else if(m+f >= 80){
			grade = 'A';
		}else if(m+f >= 65){
			grade = 'B';
		}else if(m+f >= 50){
			grade = 'C';
		}else if(m+f >= 30){
			grade = (r >= 50)? 'C':'D';
		}else{
			grade = 'F';
		}
		printf("%c\n",grade);
	}
}



Measured memory_bytes: 2712
#include <stdio.h>
#include <stdlib.h>

int main(void) {

  long a,v,b,w,t;
  scanf("%ld %ld %ld %ld %ld", &a, &v, &b, &w, &t);
  if (w >= v) {
    printf("NO\n");
    return 0;
  }
  if ((v-w)*t >= labs(a-b)) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int A[n];
    
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int mn=A[0],mx=A[0];
    
    for(int i=1;i<n;i++){
        if(mn>A[i]){
            mn=A[i];
        }
        if(mx<A[i]){
            mx=A[i];
        }
    }
    cout<<mx-mn<<endl;



return 0;
}

Measured memory_bytes: 256
S=input()
T=input()
t = len(T)
s = len(S)
res = t
mid = 0
for i in range(s-t+1):
  mid=0
  for j in range(i,i+t):
    if S[j] == T[j-i]:
      mid += 1
  res = min(t-mid,res)
print(res)

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int h,w,k;
    cin>>h>>w>>k;
    char c[10][10];
    rep(i,0,h){
        rep(j,0,w){
            cin>>c[i][j];
        }
    }

    int ans=0;
    for(int i=0;i<(1<<h);i++){
        for(int j=0;j<(1<<w);j++){
            int cnt=0;
            rep(a,0,h){
                rep(b,0,w){
                    if(i&(1<<a) || j&(1<<b) )continue;
                    if(c[a][b]=='#')cnt++;
                }
            }
            if(cnt==k)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;


int n;

int main() {
	cin >> n;
	while (n) {
		if (n % 10 == 7) {
			cout << "Yes";
			return 0;
		}
		n /= 10;
	}
	cout << "No";
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,gs=0,i,j,k;
    cin>>n;
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
        for(k=1;k<=n;k++)
        gs+=__gcd(i,__gcd(j,k));
    cout<<gs<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <utility>
#include <stdint.h>
#include <set>
#include <map>
#include <vector>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;

  map<int, vector<bool>> submissions;

  for (int m=0; m<M; ++m) {
    int p;
    string S;

    cin >> p >> S;
    submissions[p].push_back(S=="AC");
  }

  int ac = 0, penalty = 0;
  
  for (auto &x : submissions) {
    vector<bool> &problem = x.second;
    int wa = 0;
    for (bool s : problem) {
      if (s) {
	++ac;
	penalty += wa;
	break;
      } else {
	++wa;
      }
    }
  }

  cout << ac << ' ' << penalty << endl;

  return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <map>
#include <cmath>

using namespace std;


int main() {
    map<string, int> mp;
    int N;
    cin >> N;
    
    int maxN=0;
    for(int n=0; n<N; n++) {
        string str;
        cin >> str;
        mp[str]++;
        maxN = max(maxN, mp[str]);
    }
    
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) {
        if(itr->second==maxN) {
            cout << itr->first << endl;
        }
    }


    return 0;
    
}

Measured memory_bytes: 25216
#include<stdio.h>
int main (void){
  int n,i,a=0,w=0,t=0,r=0;
  char s[3];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",&s);
    if(s[0]=='A')a++;
    if(s[0]=='W')w++;
    if(s[0]=='T')t++;
    if(s[0]=='R')r++;
  }
  printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",a,w,t,r);
  
}

Measured memory_bytes: 1716
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ABC11X_A();
		ABC11X_B();
		// ABC11X_C();
		// ABC11X_D();
	}

	private static void ABC11X_A() {
		Scanner scanner = null;
		int nenrei = 0;

		try {
			scanner = new Scanner(System.in);
			nenrei = scanner.nextInt();

			switch (nenrei) {
			case 1:
				System.out.println("Hello World");
				break;
			case 2:
				int numA = scanner.nextInt();
				int numB = scanner.nextInt();
				System.out.println(numA + numB);
				break;
			default:
				break;
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private static void ABC11X_B() {
		Scanner scanner = null;
		int numN = 0;
		int numT = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numT = scanner.nextInt();

			int[] costArray = new int[numN];
			int[] timeArray = new int[numN];
			int minCost = Integer.MAX_VALUE;
			for (int i = 0; i < numN; i++) {
				costArray[i] = scanner.nextInt();
				timeArray[i] = scanner.nextInt();
				if (numT >= timeArray[i] && minCost > costArray[i]) {
					minCost = costArray[i];
				}
			}

			if (minCost == Integer.MAX_VALUE) {
				System.out.println("TLE");
			} else {
				System.out.println(minCost);
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private static void ABC11X_C() {
		Scanner scanner = null;
		int lineAB = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println();

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private static void ABC11X_D() {
		Scanner scanner = null;
		int lineAB = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println();

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

int main() {
int K, X;
  cin >> K >> X;
  rep(i, 2*K -1){
  cout << X-K+1+i << " ";
  }
  cout << endl;
}

Measured memory_bytes: 256