akhauriyash/Code-Regression huggingface dataset:
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;

long long GCD(long long a, long long b) {
	if (a < b) {
		swap(a, b);
	}
	long long r = -1;
	while (r != 0) {
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	for (int i = 1; i < N; i++) {
		cin >> A[i];
	}
	vector<int>ans(N);
	for (int i = 1; i < N; i++){
		ans[A[i] - 1]++;
	}
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio> 

#define nl '\n'

using namespace std;

long long n, k;

int main(){

    cin >> n >> k;

    if(abs((n%k)-k) < abs(abs((n%k)-k)-k)) {
        cout << abs((n%k)-k);
    } else {
        cout << abs(abs((n%k)-k)-k);
    }


}
 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out


//Surely this is going to AC

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <cstring>
using namespace std;
//typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
//define
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

int main(){
    string a;
    cin >> a;
   if(a == "Sunny"){
       puts("Cloudy");
   }else if(a == "Cloudy"){
       puts("Rainy");
   }else{
       puts("Sunny");
   }

 return 0;
}

Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    char S;cin>>S;
    if('a'<=S+0x20&&S+0x20<='z'){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }
    return 0;
}

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

using ll = long long;

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

    ll k,a,b;cin>>k>>a>>b;

    ll ans=1;
    if(k<a)ans+=k;
    else if(b-a>2) 
    {
        ans+=a-1;
        k-=a-1;
        ans+=(b-a)*(k/2)+(k%2);
    }
    else
    {
        ans+=k;
    }

    cout<<ans<<"\n";    

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    int n; cin>>n;
    double v[n];
    for(int i=0; i<n; i++)
        cin>>v[i];
    sort(v, v+n);
    double ans = v[0];
    for(int i=1; i<n; i++){
        ans = (ans+v[i])/2.0;
    }
    OUT(ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int nn[10][10];
int main()
{
	int h,w;
	scanf("%d%d",&h,&w);
	int i,j,k;
	for(i=0;i<10;i++)
		for(j=0;j<10;j++)
			scanf("%d",&nn[i][j]);
	for(k=0;k<10;k++)
		for(i=0;i<10;i++)
			for(j=0;j<10;j++)
				nn[i][j] = min(nn[i][j],nn[i][k]+nn[k][j]);
	int s=0;
	for(i=0;i<h;i++)
		for(j=0;j<w;j++)
		{
			int a;
			scanf("%d",&a);
			if(a == -1)
				continue;
			s += nn[a][1];
		}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include<string.h>
int top,S[1000];
void push(int x)
{
  S[++top] = x;
} 
int pop()
{
  top--;
  return S[top+1];
}
int main()
{
    int a,b;
    char s[100];
    while(scanf("%s",s) != EOF)
    {
      if(s[0] == '+')
       {
         a = pop();
         b = pop();
         push(a+b);
       }
       else if(s[0] == '-')
       {
         b = pop();
         a = pop();
         push(a-b);
       }
       else if(s[0] == '*')
       {
         a = pop();
         b = pop();
         push(a*b);
       }
       else push(atoi(s));
    }
    printf("%d\n",pop());
    return 0;
}



Measured memory_bytes: 2104
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let (n, k) = input_tuple();
    let mut ans: HashSet<u64> = HashSet::new();
    for _ in 0..k {
        let d: u64 = input();
        let a_vec = input_vec();
        for a in a_vec {
            ans.insert(a);
        }
    }
    println!("{}", n - ans.len() as u64);
}


Measured memory_bytes: 2156
// clang-format off
	#define BADSEED random_device{}()
	#include <bits/stdc++.h>
	using namespace std;
	using ll = long long;
	using uint = unsigned int;
	ostream &operator<<(ostream &os, int8_t c) { return os << short(c); }
	istream &operator>>(istream &is, int8_t &c) { short x; is >> x; c = x; return is; }
	#define TM_(...) template <class __VA_ARGS__>
	namespace narut {
	TM_(T) using TupSz = tuple_size<decay_t<T>>;
	TM_(T) constexpr auto spc(T const &t, int) -> decltype((cout << t), 'a') { return ' '; }
	constexpr auto spc(string const &s, int) { return '\n'; }
	TM_(T) constexpr auto spc(T const &t, char) { return '\n'; }
	struct IO {
		TM_(T) static auto out_(ostream &os, T const &t, int) -> decltype(void(os << t)) { os << t; }
		TM_(T, class OS) static auto out_(OS &os, T const &t, int) -> decltype(void(begin(t))) {
			auto it = begin(t), e = end(t);
			if (it != e) out_(os, *it++, 0);
			for (; it != e; out_(os, *it++, 0)) os << spc(*it, 0);
		}
		TM_(T, size_t... Is) static void out_tup(ostream &os, T const &t, index_sequence<Is...>) { (void)initializer_list<int>{0, ((Is == 0) ? 0 : ((os << ' '), 0), (os << get<Is>(t)), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) out_(ostream &os, T const &t, char) { out_tup(os, t, make_index_sequence<TupSz<T>::value>{}); }
		TM_(Sep, class F, class... Ts) static ostream &print(ostream &os, Sep sep, F const &f, Ts const &... ts) { return void(initializer_list<int>{(out_(os, f, 0), 0), (out_(os << sep, ts, 0), 0)...}), os; }
		TM_(T) static auto in_(istream &is, T &t, int) -> decltype(void(is >> t)) { is >> t; }
		TM_(T, class IS) static auto in_(IS &is, T &t, int) -> decltype(void(begin(t))) { for (auto &x : t) in_(is, x, 0); }
		TM_(T, size_t... Is) static void in_tup(istream &is, T &t, index_sequence<Is...>) { (void)initializer_list<int>{0, (in_(is, get<Is>(t), 0), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) in_(istream &is, T &t, char) { in_tup(is, t, make_index_sequence<TupSz<T>::value>{}); }
	};
	} // namespace narut
	#define Cout(...) narut::IO::print(cout, ' ', __VA_ARGS__) << '\n'
	#ifdef NARUT_LOCAL
	#define Debug(...) narut::IO::print(cerr << "\033[0;31m", ", ", __VA_ARGS__) << "\033[0m\n"
	#else
	#define Debug(...) 0
	#endif
	[[maybe_unused]] struct Cin { 
		template <class T> Cin const &operator>>(T &t) const { return narut::IO::in_(cin, t, 0), *this; }
		template <class T> operator T() const { T t; return *this >> t, t;  }	
	} Cin;
	TM_(T) auto operator%(T &t, size_t n) -> decltype(t.resize(n), t)& { return t.resize(n), t; }
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)

// clang-format on





auto Main() {
	int n;
	cin>>n;
	int d = n%10;
	if(d==3) {
		cout << "bon";
	} else if (d==0 or d==1 or d==6 or d==8) {
		cout << "pon";
	} else {
		cout << "hon";
	}
	
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	Main();
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d, n;
    cin >> d >> n;
    int cnt = 0;
    rep(i, 1, 2e8){
        int now = 0;
        int tmp = i;
        while(tmp % 100 == 0){
            tmp /= 100;
            now++;
        }
        if(now == d){
            cnt++;
            if(cnt == n){
                cout << i << 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 N = sc.nextInt();
		int oddCount = 0;
		for (int i = 0; i < N; i++) {
			if (sc.nextInt() % 2 != 0) {
				oddCount++;
			}
		}
		System.out.println(oddCount % 2 == 0 ? "YES" : "NO");
		sc.close();
	}
}

Measured memory_bytes: 48692
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100
using namespace std;
int n,a[MAXN+5],cnt[MAXN+5];
int main()
{
	scanf("%d",&n);
	int x,maxval=-1;
	bool legal=true;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		cnt[x]++;
		maxval=max(maxval,x);
	}
	int mid=(maxval+1)/2;
	for(int i=mid-1;i>=1;i--)
		if(cnt[i]!=0)
		{
			legal=false;
			break;
		}
	for(int i=maxval;i>=mid+1;i--)
		if(cnt[i]<2)
		{
			legal=false;
			break;
		}
	if(maxval%2==1&&cnt[mid]!=2)
		legal=false;
	if(maxval%2==0&&cnt[mid]!=1)
		legal=false;
	if(legal==false)
		printf("Impossible\n");
	else
		printf("Possible\n");
	return 0;
}

Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let a = i.read_vec::<usize>(n);

    writeln!(o, "{}", solve(a)).unwrap();
}
fn counts(a: &[usize]) -> Vec<usize> {
    let mut rs = Vec::with_capacity(a.len() + 1);

    rs.push(0);
    rs.push(0);

    let mut ss = ([0; 16], [0; 16]);
    let mut ss = (&mut ss.0, &mut ss.1);

    for c in 0..ss.0.len() {
        ss.0[c] = c;
    }

    for i in 1..a.len() {
        let mut d = 0isize;
        let mut a0 = a[i - 1];
        let mut a1 = a[i];
        while a0 < a1 {
            a0 *= 4;
            d += 1;
        }
        while a0 >= a1 * 4 {
            a1 *= 4;
            d -= 1;
        }
        for c in 0..ss.1.len() {
            let mut c_next = max(c as isize + d, 0) as usize;
            let mut r = c;
            if c_next >= ss.0.len() {
                let d = c_next - ss.0.len() + 1;
                c_next -= d;
                r += i * d;
            }
            ss.1[c] = r + ss.0[c_next];
        }
        rs.push(ss.1[0]);
        std::mem::swap(&mut ss.0, &mut ss.1);
    }
    rs
}
fn solve(mut a: Vec<usize>) -> usize {
    let cs0 = counts(&a);
    a.reverse();
    let cs1 = counts(&a);

    (0..a.len())
        .map(|x| cs0[x] * 2 + x + cs1[a.len() - x] * 2)
        .min()
        .unwrap()
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


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


int main(){

  vector<int> v(3);
  for (int i = 0; i < 3 ;i++) {
    cin >> v.at(i);
  }

  sort(v.begin(),v.end());
  if (v.at(1)+v.at(0) == v.at(2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {

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


Measured memory_bytes: 256
def getValue(mid):
    return (mid // 2) * 6 + (mid // 2) * 5 + 6 * (bool(mid % 2))

n = int(input())
l, r = 1, 10 ** 15
result = float("inf")
while l <= r:
    mid = (l + r) // 2
    cur = getValue(mid)
    if cur >= n:
        result = mid
        r = mid - 1
    else:
        l = mid + 1
print(result)

Measured memory_bytes: 62000
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

LL n, m, p, d[2500], INF = 1e12;
vector<pair<int, LL>> g[2500];

int main() {
	cin >> n >> m >> p;
	inc(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		c -= p;
		g[a].EB(b, c);
	}
	
	inc(i, n) { d[i] = -INF; }
	d[0] = 0;
	inc(q, 2 * n) {
		bool f = false;
		
		inc(v, n) {
		RF(e, g[v]) {
			bool flag = setmax(d[e.FI], d[v] + e.SE);
			f |= flag;
			if(flag && q >= n && e.FI == n - 1) { cout << -1 << endl; return 0; }
		}
		}
		
		if(! f) { break; }
	}
	
	cout << max(0LL, d[n - 1]) << endl;
	
	return 0;
}


Measured memory_bytes: 512
#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>;
using vv = vector<vector<ll>>;
template <class _t> inline bool chmax (_t& a,_t b){if(a<b){a=b;return true;}return false;}
template <class _t> inline bool chmin (_t& a,_t b){if(a>b){a=b;return true;}return false;}

const long long inf = 1ll << 60;
const long long mod = 1000000007;

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

int main() {
    string s; cin >> s;
    int ans=0;
    for(int i=1;i<=s.size();i++){
	for(int j=0;j<=s.size()-i;j++){
	    bool ok = true;
	    for(int k=0;k<i;k++){
		if(s[j+k]!='A' && s[j+k]!='C' && s[j+k]!='G' && s[j+k]!='T')ok = false;
	    }
	    if(ok)ans=max(ans,i);
	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
void push(int a);
int pop();
int top = 0;
int x[100];

int main(){
  char S[100];
  int a,b;

  while(scanf("%s",S) != EOF){
    if ( S[0] == '+' ){
      push((pop()) + (pop()));
    }
    else if ( S[0] == '-' ){
      a = pop();
      b = pop();
      push(b - a);
    }
    else if ( S[0] == '*' ){
      push((pop()) * (pop()));
    }
    else {
      push(atoi(S));
      
    }
  }
  printf("%d\n",x[1]);
  
  return 0;
  
}
void push(int a){
  top++;
  x[top] = a;
}

int pop(){
  top--;
  return x[top+1];
}




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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,k; cin >> n >> k;
    vl A(n);
    rep(i,n) cin >> A[i];
    sort(rall(A));

    int l = 0, r = n-1;
    ll ans = 1;
    if(k & 1) ans *= A[0], l = 1;
    rep(i,k/2){
        if(A[l] * A[l+1] >= A[r-1] * A[r]) (ans *= A[l] * A[l+1] % mod) %= mod, l += 2;
        else (ans *= A[r] * A[r-1] % mod) %= mod, r -= 2;
    }
    if(ans < 0){
        ans = 1;
        rep(i,k) (ans *= mod + A[i]) %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n,k;cin >> n >> k;
  vint h(n);vin(h);
  if(k>=n){
    cout << 0 << endl;
    return 0;
  }
  sort(all(h),greater<int>());
  cout << accumulate(h.begin()+k,h.end(),0LL) << endl;

}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int a[4], b[4];
    while (cin>>a[0])
    {
        rep(j, 3) cin >> a[j+1];
        rep(j, 4) cin >> b[j];
        int hit = 0, bl = 0;
        rep(i, 4)
        {
            rep(j, 4)
            {
                if (a[i] == b[j])
                {
                    if (i == j)
                        hit++;
                    else
                        bl++;
                }
            }
        }
        cout << hit << ' ' << bl << endl;
    }
    return 0;
}

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

#define ll long long

using namespace std;

int main() {
	int N;
	cin >> N;
	multiset<ll> ms;
	ll cur;
	ll numon = -1, numtwo = -1;

	for (int i = 0; i < N; i++) {
		cin >> cur;
		if (ms.find(cur) != ms.end()) {
			ms.erase(ms.find(cur));
			if (cur >= numon) {
				numtwo = numon;
				numon = cur;
			}
			else if (cur >= numtwo) numtwo = cur;
		}
		else ms.insert(cur);
	}
	if (numon == -1 || numtwo == -1) cout << 0 << endl;
	else cout << numon*numtwo << endl;
	// cin >> N;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> N;
	vector<int>X(N),cX(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		cX[i] = X[i];
	}
	sort(cX.begin(), cX.end());
	ll medlow = cX[N / 2 - 1];
	ll medhigh = cX[N / 2];
	for (int i = 0; i < N; i++) {
		if (X[i] <= medlow)cout << medhigh << endl;
		else cout << medlow << endl;
	}
}

Measured memory_bytes: 3712
#include<iostream>

int main()
{
    int a, b, c, i, count = 0;

    std::cin >> a >> b >> c;

    for (i = a; i <= b; i++) {
        if (c % i == 0) {
            count++;
        }
    }

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


Measured memory_bytes: 3108
program christmas_eve_eve
  implicit none
  integer :: n, p, sum, max, i
  read(*,*) n
  sum = 0
  max = 0
  do i = 1, n
     read(*,*) p
     sum = sum + p
     if (p .gt. max) max = p
  end do
  sum = sum - max/2
  write(*,'(i0)') sum
  stop
end program christmas_eve_eve

Measured memory_bytes: 768
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pli pair<LL, int>
#define pii pair<int, int>
#define piii pair<pii, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

const int N = 1e3 + 5;
int a[N];
bool vis[N*N];
vector<LL> vc;
int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (int l = 1; l <= n; l++) {
		LL s = 0; 
		for (int r = l; r <= n; r++) {
			s += a[r];
			vc.pb(s);
		}
	}
	LL ans = 0;
	for (int i = 45; i >= 0; i--) {
		int cnt = 0;
		for (int j = 0; j < vc.size(); j++) {
			if(!vis[j]) {
				if(vc[j]&(1LL<<i)) cnt++;
			}
		}
		if(cnt >= k) {
			ans |= 1LL<<i;
			for (int j = 0; j < vc.size(); j++) {
				if(!vis[j]) {
					if(vc[j]&(1LL<<i));
					else vis[j] = true;
				}	
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
} 

Measured memory_bytes: 6384
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
a = set(a)
d = [1] + [1]*n
for i in range(1, n):
  if i in a:
    d[i] = 0
    d[i+1] = d[i-1]
  else:
    d[i+1] = d[i] + d[i-1]
    
print(d[n]%1000000007)

Measured memory_bytes: 465832
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    string str;
    cin >> str;
    int l = str.length();
    int k;
    cin >> k;
    set<string> s;
    
    repeat_from_to (i, 1, 5) {
        if (i > l) break;
        repeat_from_to (j, 0, l - i) {
            s.insert(str.substr(j, i));
        }
    }
    
    int i = 0;
    for (auto e : s) {
        ++i;
        if (i == k) {
            cout << e << endl;
            break;
        }
    }
    
    return 0;    
}

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

int main(){

    string s; cin >> s;
    long long cnt = 0;
    long long ans = 0;
    for(int i = 0; i < (int)s.size(); i++){
        if(s[i] == 'B') cnt++;
        else ans += cnt;
    }

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

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define f first
#define s second
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	n *= 2;
	int a[n];
	for(int i =0;i <n ;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll ans =0;
	for(int i =0;i<n;i+=2)
		ans +=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]
from collections import defaultdict
P = defaultdict(lambda: [])
S = []
N,M = inpl()
for i in range(M):
    np,ny = inpl()
    P[np].append([ny,i+1,np,0])

for j in P.values():
    j = sorted(j,key = lambda x: x[0])
    for i in range(len(j)):
        j[i][3] = i+1
        S.append(j[i])
S = sorted(S,key = lambda x: x[1])
for ny,num,np,x in S:
    ans = '0'*(6-len(str(np))) + str(np)\
    + '0'*(6-len(str(x))) + str(x)
    print(ans)
    
        

        

Measured memory_bytes: 45364
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int Sqrt(int N){
	int ans = 0;
	while(ans * ans <= N){
		ans++;
	}
	return ans - 1;
}

int calc(int N, int j, int sqrtN){
	int l = N / (j + 1), r = N / j;
	if(j == sqrtN){
		return r - sqrtN;
	}
	else{
		return r - l;
	}
}

signed main(){
	int N, K, i, j;
	scanf("%lld%lld", &N, &K);
	int sqrtN = Sqrt(N);
//	printf("sqrtN = %lld\n", sqrtN);
//	printf("sqrtN * sqrtN = %lld\n", sqrtN * sqrtN);
//	printf("N / sqrtN = %lld\n", N / sqrtN);
	vector<vector<int>> dp1(K + 1, vector<int>(sqrtN + 1, 0)), dp2(K + 1, vector<int>(sqrtN + 1, 0));
	vector<vector<int>> s1(K + 1, vector<int>(sqrtN + 1, 0)), s2(K + 1, vector<int>(sqrtN + 1, 0));
	dp1[0][1] = 1;
	for(j = 1; j <= sqrtN; j++){
		s1[0][j] = 1;
	}
	for(i = 1; i <= K; i++){
		for(j = 1; j <= sqrtN; j++){
			dp1[i][j] = MOD(s1[i - 1][sqrtN] + s2[i - 1][sqrtN] - s2[i - 1][j - 1]);
			dp2[i][j] = MOD(calc(N, j, sqrtN) * s1[i - 1][j]);
			s1[i][j] = MOD(s1[i][j - 1] + dp1[i][j]);
			s2[i][j] = MOD(s2[i][j - 1] + dp2[i][j]);
		}
	}
/*	for(i = 0; i <= K; i++){
		printf("dp1[%lld]:", i);
		for(j = 0; j <= sqrtN; j++){
			printf("%lld ", dp1[i][j]);
		}
		printf("\n");
		printf("dp2[%lld]:", i);
		for(j = 0; j <= sqrtN; j++){
			printf("%lld ", dp2[i][j]);
		}
		printf("\n");
	}
	for(i = 0; i <= K; i++){
		printf("s1[%lld]:", i);
		for(j = 0; j <= sqrtN; j++){
			printf("%lld ", s1[i][j]);
		}
		printf("\n");
		printf("s2[%lld]:", i);
		for(j = 0; j <= sqrtN; j++){
			printf("%lld ", s2[i][j]);
		}
		printf("\n");
	}
*/	int ans = MOD(s1[K][sqrtN] + s2[K][sqrtN]);
/*	if(sqrtN * sqrtN == N){
		ans -= dp1[K][sqrtN];
	}
*/	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 100360
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
 
const int MAXN=200005;
 
struct node{
    long long num;
    int id;
 
    bool operator<(const node &another)const
    {
        if(num==another.num)return id<another.id;
        return num<another.num;
    }
};
 
int n,k;
long long a[MAXN];
node b[MAXN];
 
int lowbit(int x)
{
    return (x&-x);
}
 
void modify(int x,int num)
{
    if(x==0){
        a[x]+=(long long)num;
        return;
    }
    while(x<=n){
        a[x]+=(long long)num;
        x+=lowbit(x);
    }
}
 
long long sum(int x)
{
    long long ans=a[0];
    while(x>0){
        ans+=a[x];
        x-=lowbit(x);
    }
    return ans;
}
 
int main()
{
    scanf("%d %d",&n,&k);
    b[0].num=0;b[0].id=0;
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        b[i].num=b[i-1].num+(long long)(x-k);
        b[i].id=i;
    }
    sort(b,b+1+n);
    long long cnt=0;
    memset(a,0,sizeof(a));
    for(int i=0;i<=n;i++){
        if(b[i].id>0)cnt+=sum(b[i].id-1);
        modify(b[i].id,1);
    }
    printf("%lld\n",cnt);
    return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
#define u first
#define v second
double gett() {
    return (double)clock()/CLOCKS_PER_SEC;
}   
mt19937 rnd(228);
int n, m;
pair <int, int> e[N];
vector <int> g[N];
bool used[N];
int per[N];
int col[N];
int cur;
bool dfs(int u) {
    col[u] = cur;
    for (int ne : g[u]) {
        if (used[ne]) continue;
        used[ne] = 1;
        int v = e[ne].u ^ e[ne].v ^ u;
        if (col[v] == cur) {
            return 1;
        }   
        if (dfs(v)) {
            return 1;
        }   
    }   
    return 0;
}   
void check() {
    memset(used, 0, sizeof used);
    for (int i = 0; i < n; ++i) col[i] = -1;
    shuffle(per, per + n, rnd);
    for (int i = 0; i < n; ++i) {
        shuffle(g[i].begin(), g[i].end(), rnd);
    }   

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        cur = i;
        cnt += dfs(per[i]);
        if (cnt == 3) {
            cout << "Yes\n";
            exit(0);
        }   
    }   
}   
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> n >> m;
    for (int i = 0; i < n; ++i) per[i] = i;
    for (int i = 0; i < m; ++i) {
        cin >> e[i].u >> e[i].v;
        --e[i].u; --e[i].v;
        g[e[i].u].push_back(i);
        g[e[i].v].push_back(i);
    }   
    for (int i = 0; i < n; ++i) {
        if ((int)g[i].size() & 1) {
            cout << "No\n";
            exit(0);
        }   
    }   
    while (gett() < 1.9) {
        check();
    }   
    cout << "No\n";
}   

Measured memory_bytes: 10368
/* 
   AOJ 1137
   Numeral System
   2015/5/21
*/

#include<stdio.h>

char output_str[10] = {'\0'};

int mcxi_num(char *input_str)
{
  int i, base, num, sum = 0;
 
  for(i = 0; input_str[i] != '\0'; i++)
    {
      if(input_str[i] > 60)
	{
	  switch(input_str[i])
	    {
	    case 'm':
	      sum += 1000;
	      break;
	    case 'c':
	      sum += 100;
	      break;
	    case 'x':
	      sum += 10;
	      break;
	    case 'i':
	      sum += 1;
	      break;
	    }
	}
      else
	{
	  num = input_str[i] - '0';

	  switch(input_str[++i])
	    {
	    case 'm':
	      base = 1000;
	      break;
	    case 'c':
	      base = 100;
	      break;
	    case 'x':
	      base = 10;
	      break;
	    case 'i':
	      base = 1;
	      break;
	    }
	  sum += num * base;
	}
    }

  return sum;
}

void num_mcxi(int num)
{
  int i = 0, j, div, rest = num;
  char inp_ch;
  for(j = 1000; j > 0; j = j / 10)
    {
      div = rest / j;
      rest = rest % j;
      if(div == 0)
	{
	  continue;
	}
      else if(div == 1)
	{
	  switch(j)
	    {
	    case 1000:
	      output_str[i++] = 'm';
	      break;
	    case 100:
	      output_str[i++] = 'c';
	      break;
	    case 10:
	      output_str[i++] = 'x';
	      break;
	    case 1:
	      output_str[i++] = 'i';
	      break;
	    }
	}
      else
	{
	  switch(j)
	    {
	    case 1000:
	      output_str[i++] = div + '0';
	      output_str[i++] = 'm';
	      break;
	    case 100:
	      output_str[i++] = div + '0';
	      output_str[i++] = 'c';
	      break;
	    case 10:
	      output_str[i++] = div + '0';
	      output_str[i++] = 'x';
	      break;
	    case 1:
	      output_str[i++] = div + '0';
	      output_str[i++] = 'i';
	      break;
	    }
	}
    }
  output_str[i] = '\0';

}

int main(void)
{
  int num, i, sum = 0;
  char first[10], second[10];

  scanf("%d", &num);

  for(i = 0; i < num; i++)
    {
      scanf("%s %s", first, second);
      //     scanf("%d", &sum);
      //      num_mcxi(sum);
      
      //    printf("%d\n", mcxi_num(first) + mcxi_num(second));
      num_mcxi(mcxi_num(first) + mcxi_num(second));
      printf("%s\n", output_str);
    }

  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int a,b,c,k,i=0;
    cin>>a>>b>>c>>k;
    while(a>=b&&k){
        b*=2;
        k--;
    }
    rep(i,k)c*=2;
    if(b<c&&a<b)cout<<"Yes";
    else cout<<"No";
	return 0;
}


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ
{
    internal class Program
    {
        public static void Main(string[] args) { new Program().solve(); }
        void solve() {
            var d1 = new DiceClass();
            var d2 = new DiceClass();
            d1.Dice = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            d2.Dice = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var f = d1.IsSameDice(d2.Dice);
            Console.WriteLine(f ? "Yes" : "No");
        }
    }
    class DiceClass
    {
        //above figure is |0|
        //front figure is |1|
        //     N
        //    |0|
        //W |3|1|2|4| E
        //    |5|
        //     S
        public int[] Dice = new int[6];
        public int Above { get { return Dice[0]; } }
        private int[] genArr(params int[] a) {
            return new int[] { Dice[a[0]], Dice[a[1]], Dice[a[2]], Dice[a[3]], Dice[a[4]], Dice[a[5]] };
        }
        public int[] Roll(char dir) {
            switch (dir) {
                case 'N': return genArr(1, 5, 2, 3, 0, 4);
                case 'W': return genArr(2, 1, 5, 0, 4, 3);
                case 'E': return genArr(3, 1, 0, 5, 4, 2);
                case 'S': return genArr(4, 0, 2, 3, 5, 1);
                default: return new int[0];
            }
        }
        //NNNN WNNN WNNN ENNN ENNN WNNN
        public void SetRoll(string dir) {
            foreach (var c in dir) SetRoll(c);
        }
        public void SetRoll(char dir) {
            Dice = Roll(dir);
        }
        public bool IsSameDice(int[] d) {
            foreach(var o in "NNNNWNNNWNNNENNNENNNWNNN") {
                SetRoll(o);
                if (Dice.SequenceEqual(d)) return true;
            }
            return false;
        }
        public void Show() {
            Console.WriteLine("     N");
            Console.WriteLine("    |" + Dice[0] + "|");
            Console.WriteLine("W |" + Dice[3] + "|" + Dice[1] + "|" + Dice[2] + "|" + Dice[4] + "| E");
            Console.WriteLine("    |" + Dice[5] + "|");
            Console.WriteLine("     S");
        }
        public int Right(int above, int front) {
            Func<int, int, bool> f = (a, b) => Dice[a] == above && Dice[b] == front;
            if (f(1, 2) || f(2, 4) || f(4, 3) || f(3, 1)) return Dice[0];
            if (f(0, 3) || f(3, 5) || f(5, 2) || f(2, 0)) return Dice[1];
            if (f(0, 1) || f(1, 5) || f(5, 4) || f(4, 0)) return Dice[2];
            if (f(1, 0) || f(0, 4) || f(4, 5) || f(5, 1)) return Dice[3];
            if (f(0, 2) || f(2, 5) || f(5, 3) || f(3, 0)) return Dice[4];
            return Dice[5];
        }
    }
}


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

int main(){
  int64_t N, D;
  cin >> N >> D;
  vector<int64_t> X(N);
  vector<int64_t> Y(N);
  for(int i = 0; i < N; i++){
    cin >> X.at(i);
    cin >> Y.at(i);
  }
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(X.at(i) * X.at(i) + Y.at(i) * Y.at(i) <= D * D){
      ans += 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6344
#include <iostream>
#include<stdio.h>

using namespace std;
typedef long long ll;
int n,k;
ll f[100003],h[100003];

void DP()
{
    f[1]=0;
    f[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;++i)
    {
        for(int j=1;j<=k;++j)
        {
            if((i-j)>=1)
            {
                f[i]=min(f[i],f[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    printf("%lld",f[n]);
}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;++i)
    {
        scanf("%lld",&h[i]);
    }
    for(int i=1;i<=n;++i)
    {
        f[i]=1e18;
    }
    DP();
    return 0;
}


Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    #[allow(dead_code)]
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    #[allow(dead_code)]
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    #[allow(dead_code)]
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let s: String = sc.read();
    let s: Vec<char> = s.chars().collect();
    let mut ans: String = String::new();
    for i in 0..s.len() {
        if i % 2 == 0 {
            ans.push(s[i]);
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define debug(a) cout<<a<<endl
#define clr(a) memset(a,0,sizeof(a))
#define clrne(a) memset(a,-1,sizeof(a))
#define clrinf(a) memset(a,0x3f,sizeof(a))
#define clrneinf(a) memset(a,0xc0,sizeof(a))
#define pb(a) push_back(a)
#define maxn 20
#define mod 1000000007
#define eps 1e-9
#define inf 0x7fffffff
char mat[maxn][maxn];
int maxi[maxn];
int mini[maxn];
int main()
{
//  freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i = 1; i<=n; i++)
        for (int j  =1; j<=m; j++)
            scanf(" %c",&mat[i][j]);
    clrinf(mini);
    for (int i = 1; i<=n; i++)
    {
        for (int j = 1; j<=m; j++)
            if (mat[i][j]=='#')
            {
                maxi[i] = j;
                mini[i] = min(mini[i],j);
            }
    }
    int flag = 1;
    for (int i = 1; i<=n; i++)
    {
        int cnt = 0;
        for (int j = 1; j<=m; j++)
            if (mat[i][j]=='#') cnt++;
        if (cnt==0) flag = 0;
    }
//    for (int i = 1;i<=n;i++)
//        printf("%d %d\n",maxi[i],mini[i]);
    for (int i = 2; i<=n; i++)
        if (mini[i]!=maxi[i-1]) flag = 0;
    if (flag) printf("Possible\n");
    else printf("Impossible");
    return 0;
}


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

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up

//Start from Here
int main(){
    ll N;
    cin>>N;
    int ans=1000;
    int a;
    for(ll i=1; i*i<=N;i++){
        if(N%i==0){
            int j=0;
            while(pow(10, j)<=i){
                j++;
            }
            int k=0;
            while(pow(10, k)<=N/i){
                k++;
            }
            a=max(j, k);
            ans=min(ans, a);
        }
    }
    cout<<ans<<endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n - 1) cin >> b[i];
    a[0] = b[0];
    int ans = a[0];
    rep(i, n - 1) {
        a[i + 1] = (i < n - 2) ? min(b[i], b[i + 1]) : b[i];
        ans += a[i + 1];
    }
    cout << ans << '\n';
}


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

tail = s[0]
plus = 0
flg = False
if tail == s[-1]:
  tmp_cnt1 = 0
  tmp_cnt2 = 0
  for i in s:
    if tail == i:
      tmp_cnt1 += 1
    else:
      break
  for i in s[::-1]:
    if tail == i:
      tmp_cnt2 += 1
    else:
      break
  if (tmp_cnt1 % 2) == 1 and (tmp_cnt2%2)==1:
    plus = 1
  if tmp_cnt1 == len(s):
    flg = True

cnt=0
if len(s)==1:
  ret = k//2
else:
  tmp=s[0]
  tmp_cnt=0
  for i in s[1:]:
    if tmp==i:
      tmp_cnt+=1
    else:
      cnt+=(tmp_cnt+1)//2
      tmp_cnt=0
    tmp=i
  cnt+=(tmp_cnt+1)//2
  ret=cnt*k
  if plus == 1:
    ret += k-1
  if flg:
    ret = len(s)*k//2
print(ret)

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

template<typename T> bool chmin(T &a,const T b){if(a>b){a=b; return true;}return false;}
template<typename T> bool chmax(T &a,const T b){if(a<b){a=b; return true;}return false;}


int main(){
    char base; cin >> base;
    if(base == 'A') cout << 'T' << endl;
    else if(base == 'T') cout << 'A' << endl;
    else if(base == 'C') cout << 'G' << endl;
    else cout << 'C' << endl;
    return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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 void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll n;
    cin >> n;
    ll mn = LINF;
    ll a;
    REP(i, 5) {
        cin >> a;
        chmin(mn, a);
    }
    cout << (n + mn - 1) / mn + 4 << endl;
}


Measured memory_bytes: 3652