akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
from collections import *

ai, ao, _, aj, al, _, _ = map(int, input().split())
ans = ao+ai//2*2+aj//2*2+al//2*2

if ai>=1 and aj>=1 and al>=1:
    ans_ = ao+(ai-1)//2*2+3
    ans_ += (aj-1)//2*2+(al-1)//2*2
    ans = max(ans, ans_)

print(ans)

Measured memory_bytes: 38384
import math
from decimal import *
import random

def pf(n):
    rn = int(n)
    ans = []
    while(n%2==0):
        if(2 not in ans):
            ans.append(2)
        n//=2
    for i in range(3, int(math.sqrt(rn)), 2):
        while(n%i==0):
            if(i not in ans):
                ans.append(i)
            n//=i
            if(n==1):
                break
        if(n==1):
            break
    if(n>2):
        ans.append(n)
    return sorted(ans)
n = int(input())
d = pf(n)
if(d=={}):
    print(1)
else:
    ans = 0
    for i in range(len(d)):
        cnt = 1
        while(n >= d[i]**cnt):
            if(n%(d[i]**cnt)==0):
                n//=(d[i]**cnt)
                ans+=1
            cnt+=1
    print(ans)


Measured memory_bytes: 83744
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

const ll INF = 1LL << 50;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> X(N), Y(N), P(N);
    rep(i, 0, N) {
        cin >> X[i] >> Y[i] >> P[i];
    }
    vector<ll> x, y;
    rep(i, 0, N) {
        x.push_back(X[i]);
        y.push_back(Y[i]);
    }
    sort(all(x));
    sort(all(y));
    x.erase(unique(all(x)), x.end());
    y.erase(unique(all(y)), y.end());
    int xn = (int)x.size();
    int yn = (int)y.size();
    vector<int> yoko_idx(N);
    vector<int> tate_idx(N);
    rep(i, 0, N) {
        rep(j, 0, xn) {
            if (X[i] == x[j]) {
                yoko_idx[i] = j;
                break;
            }
        }
        rep(j, 0, yn) {
            if (Y[i] == y[j]) {
                tate_idx[i] = j;
                break;
            }
        }
    }
    vector<vector<ll>> yoko_dist(1 << xn, vector<ll>(N, INF));
    vector<vector<ll>> tate_dist(1 << yn, vector<ll>(N, INF));
    rep(mask, 0, 1 << xn) {
        rep(i, 0, xn) {
            if (!((mask >> i) % 2)) {
                continue;
            }
            rep(j, 0, N) {
                chmin(yoko_dist[mask][j], llabs(X[j] - x[i]));
            }
        }
    }
    rep(mask, 0, 1 << yn) {
        rep(i, 0, yn) {
            if (!((mask >> i) % 2)) {
                continue;
            }
            rep(j, 0, N) {
                chmin(tate_dist[mask][j], llabs(Y[j] - y[i]));
            }
        }
    }
    rep(i, 0, N) {
        rep(mask, 0, 1 << xn) {
            chmin(yoko_dist[mask][i], llabs(X[i]));
        }
        rep(mask, 0, 1 << yn) {
            chmin(tate_dist[mask][i], llabs(Y[i]));
        }
    }
    int max_mask = 1;
    rep(i, 0, N) {
        max_mask *= 3;
    }
    vector<ll> ans(N + 1, INF);
    rep(i, 0, max_mask) {
        int mask = i;
        int yoko_mask = 0;
        int tate_mask = 0;
        rep(j, 0, N) {
            if (mask % 3 == 1) {
                yoko_mask |= 1 << yoko_idx[j];
            } else if (mask % 3 == 2) {
                tate_mask |= 1 << tate_idx[j];
            }
            mask /= 3;
        }
        ll now_ans = 0;
        rep(j, 0, N) {
            now_ans += P[j] * min(yoko_dist[yoko_mask][j], tate_dist[tate_mask][j]);
        }
        mask = i;
        int cnt = 0;
        rep(j, 0, N) {
            if (mask % 3) {
                ++cnt;
            }
            mask /= 3;
        }
        chmin(ans[cnt], now_ans);
    }
    rep(i, 0, N + 1) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12912
#include "bits/stdc++.h"

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define DOUBLE fixed << setprecision(10)
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}


ll  n, m, r, l, k, h, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

void INIT() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << DOUBLE;
}

vector<bool> IsPrime;

void sieve(ll max) {
	if (max + 1 > IsPrime.size()) {     // resizeで要素数が減らないように
		IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
	}
	IsPrime[0] = false; // 0は素数ではない
	IsPrime[1] = false; // 1は素数ではない

	for (ll i = 2; i*i <= max; ++i) // 0からsqrt(max)まで調べる
		if (IsPrime[i]) // iが素数ならば
			for (ll j = 2; i*j <= max; ++j) // (max以下の)iの倍数は
				IsPrime[i*j] = false;      // 素数ではない
}


int main() {
	INIT();
	cin >> n;
	vll v(n);
	rep(i, n) cin >> v[i];
	flag = true;
	REP(i, 1, n) {
		if (v[i] > v[i - 1]) v[i]--;
		else if (v[i] == v[i - 1]) continue;
		else flag = false;
	}
	Yes(flag);
}

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

typedef long long int ll;
#define INF 10000000000000
using namespace std;

int t[100005], x[100005], y[100005];

int main()
{
	int N;

	cin >> N;

	t[0] = x[0] = y[0] = 0;

	for (int i = 1; i <= N; i++)
		cin >> t[i] >> x[i] >> y[i];

	for (int i = 1; i <= N; i++)
	{
		if (t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]))
		{
			cout << "No" << endl;
			return 0;
		}
		else
		{
			if ((t[i] - t[i - 1]) % 2 == (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2)
				continue;
			else
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[][] c = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if((i < b && j < a) || (b <= i && a <= j)) c[i][j] = 1;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                sb.append(c[i][j]);
            }
            sb.append("\n");
        }
        System.out.println(sb.toString());
        sc.close();

    }

}


Measured memory_bytes: 33876
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll inf = 1e9 + 7;
const ll Mod = 998244353;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);


int main(){
  int A, B; cin >> A >> B;
  if (A <= 8 && B <= 8){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#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 SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#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 pb push_back
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);}
typedef long long ll;
typedef pair<int, int> pii;

int solve(ll n){
    int flag = 0;
    while (n) {
        switch (n%10) {
            case 7:
                flag |= 0b0001;
                break;
            case 5:
                flag |= 0b0010;
                break;
            case 3:
                flag |= 0b0100;
                break;

            break;

            default:
                return 0;
            break;
        }
        n /= 10;
    }
    if(flag == 0b0111) return 1;
    else return 0;
}

int dfs(ll s, ll n){
    if(s > n) return 0;
    return solve(s) + dfs(s*10 + 7, n) + dfs(s*10 + 5, n) + dfs(s*10 + 3, n);
}

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

    pr(dfs(0,n));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,z,y;
    cin>>x>>y;
    if(x==y)
    {
        cout<<x*2<<endl;
    }
    else
   {
       a=max(x,y);
    z=a+(a-1);
    cout<<z<<endl;
   }
    return 0;
}


Measured memory_bytes: 256
let cnt = ref 0

let insertion_sort (a : int array) n g =
  for i = g to n - 1 do
    let v = a.(i) in
    let j = ref (i - g) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+g) <- a.(!j);
      j := !j - g;
      incr cnt;
    done;
    a.(!j+g) <- v;
  done

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  let g = generate_g n in
  List.iter (fun g -> insertion_sort a n g) g;
  g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  let g = shell_sort a n in
  print_int (List.length g);
  print_newline ();
  match g with
  | [] -> assert false;
  | hd :: tl -> print_int hd; List.iter (fun x -> print_string " "; print_int x) tl;
  print_newline ();
  print_int !cnt;
  print_newline ();
  Array.iter (fun n -> print_int n; print_newline ()) a

Measured memory_bytes: 12408
#include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int main()
{
    int nn;
    cin>>nn;
    int h[nn], hmm[nn];
    int minh;
    for (int i = 0; i<nn;i++) {
        cin>>h[i];
    }

    for (int i = 0; i<nn-1;i++) {
        if(i==0)
        {
            hmm[i+1]=abs(h[i]-h[i+1]);
            hmm[i+2]=abs(h[i]-h[i+2]);
            minh=min(hmm[i+1], hmm[i+2]);
        }
        else if(i==nn-2)
        {
            hmm[i+1]=min(abs(h[i]-h[i+1])+hmm[i], hmm[i+1]);
            minh=hmm[i+1];
        }
        else
        {
            hmm[i+1]=min(abs(h[i]-h[i+1])+hmm[i], hmm[i+1]);
            hmm[i+2]=abs(h[i]-h[i+2])+hmm[i];
            minh=min(hmm[i+1], hmm[i+2]);
        }
    }

    cout << minh;
    return 0;

}

Measured memory_bytes: 1024
import collections
import math
n = int(input())
s_list = []
for _ in range(n):
    s = input()
    s = "".join(sorted(s))
    s_list.append(s)
ans = 0
s_dict = collections.Counter(s_list)
for i in s_dict.values():
    ans += i * (i - 1)
print(ans // 2)

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

int main(){
  int N,a,b;
  cin>>N;
  a=N/10;
  b=N/100;
  if(N%10==7){
    cout<<"Yes"<<endl;
  }
  else if(a%10==7){
    cout<<"Yes"<<endl;
  }
  else if(b==7){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3624
Tmp = []
Tmp = input().rstrip().split(' ')

N = int(Tmp[0])
M = int(Tmp[1])

Ans = 0

if (N==1) and (M==1):
    Ans = 1
elif (N==2) or (M==2):
    Ans = 0
elif (N==1):
    Ans= M - 2
elif (M==1):
    Ans= N - 2
else:
    Ans = (N - 2)*(M - 2)
    

print(Ans)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int UCLN(int a, int b)
{
    return (b == 0) ? a : UCLN(b, a % b);
}
int main()
{
    int a, b;
    cin >> a >> b;
    cout << UCLN(a, b)<<endl;
    return 0;
}


Measured memory_bytes: 3104
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        N: usize,
        A: [f64; N],
    }
    let mut heap: BinaryHeap<Rev<Total<f64>>> = BinaryHeap::new();

    for a in A {
        heap.push(Rev(Total(a)));
    }

    for _ in 0..N-1 {
        let Rev(Total(a)) = heap.pop().unwrap();
        let Rev(Total(b)) = heap.pop().unwrap();
        let res = Rev(Total((a + b) / 2f64));
        heap.push(res);
    }

    let Rev(Total(ans)) = heap.pop().unwrap();
    println!("{}", ans);
}

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

using namespace std;

int D = 365, c[26], s[365][26];

struct State {
	int ans[365];
};

class SimulatedAnnealing {
private:
	chrono::system_clock::time_point begin_;
	bool opt_mode_;
	double s_temp_;
	double e_temp_;
	double time_limit_;

	void init(State &state){
		for(int i = 0; i < D; ++i) state.ans[i] = (rand()%26)+1;
	}
	void next(State &state){
		state.ans[rand()%D] = (rand()%26)+1;
	}
	long long score(State &state){
		long long res = 0;
		for(int d = 0; d < D; ++d) res += s[d][state.ans[d]-1];
		for(int d = 0; d < D; ++d){
			long long sum = 0;
			for(int i = 0; i < 26; ++i){
				int lastdi = 0;
				for(int j = 0; j <= d; ++j){
					if(state.ans[j] == (i+1)) lastdi = (j+1);
				}
				sum += c[i] * ((d+1) - lastdi);
			}
			res -= sum;
		}
		return res;
	}
	void start(){
		begin_ = chrono::system_clock::now();
	}
	double now(){
		return static_cast<double>(chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now()-begin_).count()/1.0e6);
	}

public:
	// 初期スコア, 最適化モード("maximize" or "minimize"), 制限時間, 開始時温度, 終了時温度
	SimulatedAnnealing(string opt_mode, double time_limit, double s_temp, double e_temp){
		opt_mode_ = (opt_mode == "maximize");
		time_limit_ = time_limit;
		s_temp_ = s_temp;
		e_temp_ = e_temp;
	}
	void solve(){
		start();

		random_device rnddev;
		mt19937 mt(rnddev());
		uniform_real_distribution<double> rnd(0.0, 1.0);

		State now_state;
		init(now_state);

		long long best_score_ = 0;
		State best_state_;
		init(best_state_);

		long long now_score = score(now_state), next_score;
		while(true){
			if(now() > time_limit_) break;
			State next_state = now_state;
			next(next_state);
			next_score = score(next_state);
			double temp = (e_temp_-s_temp_)*now()/time_limit_+s_temp_;
			double prob = exp((now_score-next_score)/temp);
			if(now_score < next_score || rnd(mt) < prob){
				now_state = next_state;
				now_score = next_score;
			}
			if(best_score_ < now_score){
				best_state_ = now_state;
				best_score_ = now_score;
			}
		}

		for(int i = 0; i < D; ++i){
			if(i == D-1){
				printf("%d", best_state_.ans[i]);
				break;
			}
			printf("%d\n", best_state_.ans[i]);
		}
	}
};

int main(){
	// Input
	cin >> D;
	for(int i = 0; i < 26; ++i) cin >> c[i];
	for(int i = 0; i < D; ++i) for(int j = 0; j < 26; ++j) cin >> s[i][j];

	SimulatedAnnealing sa("maximize", 1.98, 50, 20);
	sa.solve();
}

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

int arr[109];
int dp[100009];
int n, k;

int solve(int k) {
	if(k == 0)
		return 0;
	int ans = 0;
	int curr;
	if(dp[k] != -1)
		return dp[k];
	for(int i = 0; i < n; i++){
		if(arr[i] > k) break;
		curr = !solve(k - arr[i]);
		ans |= curr;
	}
	return dp[k] = ans;
}

int main() {
	cin>>n>>k;
  	memset(dp, -1, sizeof(dp));
	for(int i = 0; i <n ;i++){
		cin>>arr[i];
	}
	sort(arr, arr+n);
	if(solve(k)) cout<<"First\n";
	else cout<<"Second\n";
	return 0;
}

Measured memory_bytes: 5376
#include <iostream>

int main(void) {
    int n, m;
    std::cin >> n >> m;
    int a[m];
    int count = 0;
    for (int i = 0; i < m; i++) {
        std::cin >> a[i];
        count += a[i];
    }
    int days = n - count;
    if (days >= 0) {
        std::cout << days << std::endl;
    } else {
        std::cout << -1 << std::endl;
    }
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  int N, K; cin >> N >> K;
  vector<int> A(N); REP(i, N) cin >> A[i];
  sort(all(A));
  int ans = 0;
  for(int i = 0; i < K; ++i) {
    ans += A[i];
  }
  cout << ans << endl;
}

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

x = list(map(int,input().split()))
y = list(map(int,input().split()))

din = [0,0,0,0]

for i in range(n):
	din[0] += abs(x[i] - y[i])
	din[1] += abs(x[i] - y[i])**2
	din[2] += abs(x[i] - y[i])**3
	din[3] = max(din[3],abs(x[i] - y[i]))
din[1] = din[1]**(1/2)
din[2] = din[2]**(1/3)
for i in range(4):
	print('{:.6f}'.format(din[i]))


Measured memory_bytes: 5652
readints=lambda:map(int,input().split(' '))
n=int(input())
a=list(readints())
ans=0
for i in range(1,n-1):
  arr=[a[i-1],a[i],a[i+1]]
  arr.sort()
  if a[i]==arr[1]:
    ans+=1
print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int h = parseInt(sc.next());
		int n = parseInt(sc.next());
		int[] a = new int[n];
		int sum = 0;
		for (i = 0; i < a.length; i++) {
			a[i] = parseInt(sc.next());
			sum+=a[i];
		}
		sc.close();
		out.println(h<=sum?"Yes":"No");
	}
}


Measured memory_bytes: 48828
import sys, math
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())), key=lambda x: abs(x))[::-1]
P = int(1e9+7)
ans = 1
hu = None
sei = None
flg = False
for a in A:
    flg = a > 0
    if flg:
        break
if not flg:
    if K%2==1:
        for i in range(1, K+1):
            ans = (ans * A[-i]) % P
    else:
        for i in range(K):
            ans = (ans * A[i]) % P
    print(ans)
    sys.exit()
if K == N:
    for a in A:
        ans = (ans * a) % P
    print(ans)
    sys.exit()

for i, a in zip(range(K), A):
    if a > 0:
        if sei:
            ans = (ans * sei) % P
        sei = a
    else:
        if hu is None:
            hu = a
        else:
            ans = (ans * a * hu) % P
            hu = None

ptn1, ptn2 = -math.inf, -math.inf
if hu:
    if sei:
        for i in range(K, N):
            if A[i] > 0:
                ptn1 = sei * A[i]
                break
        for i in range(K, N):
            if A[i] <= 0:
                ptn2 = hu * A[i]
                break
        ans = (ans * max(ptn1, ptn2)) % P
    else:
        for i in range(K, N):
            if A[i] > 0:
                ans = (ans * A[i]) % P
                break
else:
    if sei:
        ans = (ans * sei) % P
print(ans % P)


Measured memory_bytes: 102764
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
#define dwn(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n;
	cin >> n;
	int maxi = 0, ans;
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		if (maxi < a) {
			maxi = a;
			ans = a + b;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define PB push_back

int partition(int*,int,int);

int main(int argc,char* arg[]){
  int n;
  int arr[100000];

  cin>>n;
  for(int i=0;i<n;i++)
    cin>>arr[i];

  int key=partition(arr,0,n-1);

  for(int i=0;i<n;i++){
    if(i==key) printf("[");
    printf("%d",arr[i]);
    if(i==key) printf("]");
    if(i!=n-1) printf(" ");
  }
  puts("");
  return 0;
}

int partition(int *arr,int p,int r){
  int x=arr[r],j;
  int i=p-1;
  for(j=p;j<r;j++){
    if(arr[j]<=x){
      i+=1;
      swap(arr[i],arr[j]);
    }
  }
  swap(arr[i+1],arr[j]);
  return i+1;
}

Measured memory_bytes: 1540
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

int n;
int a[3010];
int b[3010];

vi ans;
vi G[3010];

int res[3010];

bool dfs( int x , int p ){
  if( b[x] == 0 ){
    return 0;
  }
  b[x]--;
  YYS( w , G[x] ){
    if( w != p and b[w] <= b[x] ){
      if( not dfs( w , x ) ){
        return true;
      }
    }
  }
  return false;
}

bool check( int x ){
  if( a[x] == 0 ){
    return false;
  }
  REP( i , n ){
    b[i] = a[i];
  }
  return dfs( x , -1 );
}

int main(){

  n = in();
  REP( i , n ){
    a[i] = in();
  }

  REP( i , n-1 ){
    int x = in() - 1;
    int y = in() - 1;
    G[x].pb( y );
    G[y].pb( x );
  }

  REP( i , n ){
    if( check( i ) ){
      ans.pb( i );
    }
  }
  
  REP( i , SZ(ans) ){
    if( i != 0 ){
      printf( " " );
    }
    printf( "%d" , ans[i]+1 );
  }
  printf( "\n" );

  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		long K = long.Parse(str[1]);
		string[] str2 = Console.ReadLine().Split();
		long[]A = new long[N];
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str2[i]);
		}
		int[]B1 = new int[40];
		int[]B2 = new int[40];
		for(var i=0;i<N;i++){
			long t = 1;
			for(var j=0;j<40;j++){
				long x = A[i]/t%2;
				if(x==0){
					B1[j]++;
				} else {
					B2[j]++;
				}
				t *= 2;
			}
		}
		long t2 = (long)Math.Pow(2,39);
		long[]D1 = new long[40];
		long[]D2 = new long[40];
		long ansf = 0;
		long ans = 0;
		bool flag = false;
		for(var i=39;i>=0;i--){
			if(flag){
				if(B1[i] > B2[i]){
					D1[i] = D1[i+1] + B1[i] * t2;
					if(K >= t2+ansf){
						ansf += t2;
						ans += B1[i] * t2;
					} else {
						ans += B2[i] * t2;
					}
				} else {
					D1[i] = D1[i+1] + B2[i] * t2;
					ans += B2[i] * t2;
				}
				D2[i] = ans;
			} else if(K >= t2){
				D1[i] = ans + B2[i] * t2;
				flag = true;
				if(B1[i] > B2[i]){
					ansf += t2;
					ans += B1[i] * t2;
				} else {
					ans += B2[i] * t2;
				}
				D2[i] = ans;
			} else {
				ans += B2[i] * t2;
				D2[i] = ans;
			}
			t2 /= 2;
		}
		Console.WriteLine(Math.Max(D1[0],ans));
	}
}

Measured memory_bytes: 30300
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    string str;
    cin >> str;

    if (str > "2019/04/30") {
        cout << "TBD" << endl;
    } else {
        cout << "Heisei" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define P pair<int,string>
#define ll long long
const ll INF=1e18;
int main(){
    ll n,ans=0,bef=-1,h,tmp=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>h;
        if(h<=bef)tmp++;
        else{
            ans=max(ans,tmp);
            tmp=0;
        }
        bef=h;
    }
    ans=max(ans,tmp);
    cout<<ans<<endl;

}


Measured memory_bytes: 256
import math
N, D = map(int, input().split(' '))
X = [[0 for _ in range(N + 10)] for _ in range(D + 10)]
res = 0
for i in range(N):
  X[i] = list(map(int, input().split(' ')))
for i in range(N - 1):
  for j in range(i + 1, N):
    dist = 0
    for k in range(D):
      dist += (X[i][k] - X[j][k])**2
    dist = math.sqrt(dist)
    if dist == int(dist):
      res += 1
print(res)

Measured memory_bytes: 3064
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
typedef struct{int nod,par;}dat;
#define datm pair<int,int>
#define dm(a,b) make_pair(a,b)
#define inp(a,b) scanf("%d %d",&a,&b)
#define INF (100000)
main(){
  int n,m,s,t;
  inp(n,m);
  vector<vector<int>> Ga(n);
  for(int i=0;i<m;++i){
    int p,q;
    inp(p,q);
    p--;q--;
    Ga[p].push_back(q);
  }
  inp(s,t);
  s--;t--;
  vector<vector<int>> dist(n,vector<int>(3,INF));
  queue<dat> que;
  que.push({s,0});
  dist[s][0]=0;
  //cerr<<s<<"->"<<t<<"\n";
  while(!que.empty()){
    dat p=que.front(); que.pop();
    //cerr<<p.nod<<","<<p.par<<","<<p.dis<<"("<<que.size()<<")\n";
    for(auto i:Ga[p.nod]){
      int pn=(p.par+1)%3;
      if(dist[i][pn]!=INF)continue;
      dist[i][pn]=dist[p.nod][p.par]+1;
      que.push({i,pn});
    }
  }
  printf("%d",dist[t][0]==INF?-1:dist[t][0]/3);
}

Measured memory_bytes: 11136
import heapq

N, K = map(int, input().split())
H = list(map(int, input().split()))

minus_H = [i * (-1) for i in H]
heapq.heapify(minus_H)

for i in range(min(N, K)):
    heapq.heappop(minus_H)

ans = - sum(minus_H)

print(ans)


Measured memory_bytes: 25896
#include <iostream>
#include <algorithm>
using namespace std;
struct team{
	int n;
	long long int t;
};
team a[1000000];
bool comp(const team &t1,const team &t2){
	return t1.t < t2.t;
}
int main(){
	int n,i,c,m1,s1,m2,s2,m3,s3,m4,s4,t;
	team x;
	while(cin >> n && n){
		for(i = 0;i < n;i++){
			cin >> c >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
			t = (m1 * 60 + s1) + (m2 * 60 + s2) + (m3 * 60 + s3) + (m4 * 60 + s4);
			x.n = c;
			x.t = t;
			a[i] = x;
		}
		sort(a,a+n,comp);
		cout << a[0].n << "\n" << a[1].n << "\n" << a[n - 2].n << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#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)>=1;--i)
#define pb push_back
#define fr first
#define sc second
typedef int ss;
#define int long long

typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;

ll N, K;

ss main()
{
  cin>>N>>K;
  N++;
  N/=2LL;
  if(N >= K) puts("YES");
  else puts("NO");
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val n = next()
    val v = when {
        n[0] > n[1] -> {
            n[0]
        }
        n[0] < n[1] -> {
            n[0].toString().toInt() + 1
        }
        else -> {
            if (n[1] >= n[2]) n[0] else n[0].toString().toInt() + 1
        }
    }
    println("$v$v$v")
}

Measured memory_bytes: 33800
#include <bits/stdc++.h>
using namespace std;
 
#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main() {
    int N,K,x;
    int ans = 0;

    cin >> N >> K;
    REP(i, N) {
        cin >> x;
        ans += min(x*2, (K-x)*2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>

using namespace std;

int gcd(int n, int m) {
    if (n == 0)
        return m;
    return gcd(m % n, n);
}

int bit_count(int i) {
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    i = (i + (i >> 4)) & 0x0f0f0f0f;
    i = i + (i >> 8);
    i = i + (i >> 16);
    return i & 0x3f;
}

int main() {
    int x, a;
    cin >> x >> a;
    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
}


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

int main(){
    int n,m; cin>>n>>m;
    if(n==m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b,k = (int(_) for _ in input().split())


while(k >= 1):
    if(a%2 != 0):
        a -= 1
    b += int(a/2)
    a = int(a/2)
    k -= 1
    if(k == 0):
        break
    if(b%2 != 0):
        b -= 1
    a += int(b/2)
    b = int(b/2)
    k -= 1
    
print(a,b)

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

int main() {
  int N,M;
  cin >> N >> M;
  set<int> a;
  for (int i=0;i<M;i++){
    int x;
    cin >> x;
    a.insert(x);
  }
  vector<int> dp(N+1);
  dp[0]=1;
  if (a.count(1)){
    dp[1]=0;
  }
  else {
    dp[1]=1;
  }
  for (int i=2;i<N+1;i++){
    if (a.count(i)){
      dp[i]=0;
    }
    else {
      dp[i]=(dp[i-1]+dp[i-2])%1000000007;
    }
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 5376
using System;
using System.Collections.Generic;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int health = int.Parse(input[0]);
            int count = int.Parse(input[1]);

            string[] input1 = Console.ReadLine().Split(' ');
            int total = 0;
            for (int i = 0; i < count; i++)
            {
                total += int.Parse(input1[i]);
            }

            if (health - total <= 0)
            {
                Console.WriteLine("Yes");

            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 16480
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll h,w,k;cin>>h>>w>>k;
  string s[h];
  for(int i=0;i<h;i++)cin>>s[i];
  ll ans = 0;
  for(ll i=0;i<BITLE(h);i++){
    for(ll j=0;j<BITLE(w);j++){
      ll sum = 0;
      for(ll ii=0;ii<h;ii++){
        if(BITLE(ii) & i)continue;
        for(ll jj=0;jj<w;jj++){
          if(BITLE(jj) & j)continue;
          if(s[ii][jj] == '#')sum++;
        }
      }
      ans += (sum == k);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3568
n = int(input())
h_list = list(map(int,input().split()))
count_list = []
i = 0
counter = 0
for i in range(n-1):
    if h_list[i] >= h_list[i + 1]:
       count_list.append(1)
    else :
       count_list.append(0)
result_list = []
result = 0
for m in count_list:
    if m == 1:
        result += 1
        result_list.append(result)
        
    else :
        result = 0
        result_list.append(result)
        
if result_list == []:
    print(0)
else:
    print(max(result_list)) 
  
    
    
    
  


Measured memory_bytes: 14228
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  vst A={"dream","dreamer","erase","eraser"};
  st s;
  	ci(s);
  REV(s);
  FOR(i,0,4){
    REV(A[i]);
  }
  bl can=true;
  FOR(i,0,s.sz){
    bl can2=true;
    FOR(j,0,4){
      if(s.substr(i,A[j].sz)==A[j]){
        i+=A[j].sz-1;
        can2=false;
      }
    }
    if(can2){
      can=false;
      break;
    }
  }
  if(can) co("YES")
    else co("NO")
    }

Measured memory_bytes: 512
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

c = [0] * n
for ele in a:
	c[ele-1] += 1

for ele in c:
	point = k - q + ele
	if point > 0:
		print("Yes")
	else:
		print("No")


Measured memory_bytes: 8640
#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>

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


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)

inline vll move(vll p, char d) {
	if (d == 'U') {
		p[0]--;
	}
	else if (d == 'D') {
		p[0]++;
	}
	else if (d == 'R') {
		p[1]++;
	}
	else if (d == 'L') {
		p[1]--;
	}
	return p;
}

int main() {
	ll s;
	in(s);
	const ll max=pow(10,9);
	vector<vll> ans(3, vll(3,0));

	ans[1][0] = max;
	ans[1][1] = 1;

	ans[2][0] = s % max;
	ans[2][1] = s / max;
	if (ans[2][0] != 0) {
		ans[2][1]++;
		ans[2][0] = ans[1][0] - ans[2][0];
	}

	rep(i, 0, 3) {
		rep(j, 0, 2) {
			outs(ans[i][j]);
		}
	}
	outn("");
	return 0;

}


Measured memory_bytes: 256
#include <iostream>                                             
#include <cmath>                                                
using namespace std;                                            
                                                                
bool isprime(int x) {                                           
  if (x==2) {                                                   
    return true;                                                
  }                                                             
  if (x<2 || x%2==0) {                                          
    return false;                                               
  }                                                             
  int i = 3;                                                    
  while (i<=sqrt(x)) {                                          
    if (x%i==0) {                                               
      return false;                                             
    }                                                           
    i = i+2;                                                    
  }                                                             
  return true;                                                  
}                                                               
                                                                
int main(void) {                                                
  int n;                                                        
  cin >> n;                                                     
  int x[n], ans=0;                                              
  for (int i=0; i<n; i++) {                                     
    cin >> x[i];                                                
    if (isprime(x[i])) {                                        
      ans++;                                                    
    }                                                           
  }                                                             
  cout << ans << endl;                                          
  return 0;                                                     
}                                                               
                                                                
                    

Measured memory_bytes: 3068
#include<stdio.h>
#define AMAX 1000

void insertionSort(int *,int); 

main(){
  
  int i,n,num[AMAX],x /* xは要素数 */;
  
  scanf("%d",&n);
  
  for(i = 0 ; i < n ; i++){
    
    scanf("%d",&num[i]);
    
  }
  
  x = i;

  insertionSort(num,x);

    for(i = 0 ; i < x ; i++){
      printf("%d",num[i]);
      if(i != x-1)printf(" ");
    }

    printf("\n");

  return 0;
}

void insertionSort(int *num, int x){

  int i,j,k,key;


  for(i = 1 ; i <= x-1 ; i++){

    for(k = 0 ; k < x ; k++){
      printf("%d",num[k]);
      if(k != x-1)printf(" ");
    }

   printf("\n");


    key = num[i];
    j = i-1;

    while(j >= 0 && num[j] > key){

      num[j+1] = num[j];
      j--;
    }

    num[j+1] = key;

  }
  
}

Measured memory_bytes: 608
N = int(input())


A = list(map(int,input().split()))
ok = [0]*pow(10,6)
Q = int(input())

li = [list(map(int,input().split())) for i in range(Q)]

for i in range(N):
    ok[A[i]]+=1
memo1=0
memo2=0

S = sum(A)
for i in range(Q):

    S+=ok[li[i][0]]*(li[i][1]-li[i][0])
    print(S)
    a = ok[li[i][0]]
    ok[li[i][1]]+=a
    ok[li[i][0]]=0
  

Measured memory_bytes: 39260
R,G,B,N=map(int,input().split())
c=0
for r in range(0, N//R+1):
    for g in range(0, N//G+1):
        rg = r*R + g*G
        if rg > N:
            continue
        if rg == N or (N-rg)%B == 0:
            c += 1
print(c)


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

using namespace std;

const  int N = 1e5+20;

int a[N],b[N],c[N],f[N][4];

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)	cin>>a[i]>>b[i]>>c[i];
	f[1][0]=a[1],f[1][1]=b[1],f[1][2]=c[1];
	for(int i=2;i<=n;i++)
	{
		f[i][0]=max(f[i-1][1]+a[i],f[i-1][2]+a[i]);
		f[i][1]=max(f[i-1][0]+b[i],f[i-1][2]+b[i]);
		f[i][2]=max(f[i-1][0]+c[i],f[i-1][1]+c[i]);
	}
	cout<<max(f[n][0],max(f[n][1],f[n][2]));
	
}

Measured memory_bytes: 2944
#include "bits/stdc++.h"
using namespace std;
long double dp[3000][3000] , Array[3000];

int main(){
    int N , i , j;
    scanf( "%d" , &N );

    for( i = 1 ; i <= N ; ++i )
        scanf( "%Lf" , Array + i );
    
    dp[0][0] = (long double)1;

    for( i = 1 ; i <= N ; ++i ){
        dp[i][0] = ( (long double)1 - Array[i] ) * dp[i - 1][0];

        for( j = 1 ; j <= i ; ++j )
            dp[i][j] = Array[i] * dp[i - 1][j - 1] + ( (long double)1 - Array[i] ) * dp[i - 1][j];
    }

    long double Ans = (long double)0;
    
    for( i = ( N + 1 ) >> 1 ; i <= N ; ++i )
        Ans += dp[N][i];

    printf( "%0.15Lf\n" , Ans );
    return 0;
}

Measured memory_bytes: 139136