akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;
 
int N,K,a[200020],s[200020];
int ans=0;
struct LazySegmentTree{
    private:
    int n;
    vector<ll> node,lazy;


    public:
    LazySegmentTree(vector<ll> v){
        int sz = (int)v.size();
        n = 1;while(n < sz)n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1,0);

        for(int i=0;i<sz;i++)node[i+n-1] = v[i];
        for(int i=n-2;i>=0;i--)node[i]=node[2*i+1]+node[2*i+2];
    }

    void eval(int k,int l,int r){
        if(lazy[k] != 0){
            node[k] += lazy[k];

            if(r-l > 1){
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a,int b,ll x,int k=0,int l=0,int r=-1){
        if(r<0)r = n;

        eval(k,l,r);
        if(b <= l || r <= a)return;

        if(a <= l && r <= b){
            lazy[k] += (r - l) * x;
            eval(k,l,r);
        }
        else{
            add(a,b,x,2*k+1,l,(l+r)/2);
            add(a,b,x,2*k+2,(l+r)/2,r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }
    ll getsum(int a,int b,int k=0,int l=0,int r=-1){
        if(r < 0)r = n;
        eval(k,l,r);
        if(b <= l || r <= a)return 0;
        if(a <= l && r <= b)return node[k];
        ll vl = getsum(a,b,2*k+1,l,(l+r)/2);
        ll vr = getsum(a,b,2*k+2,(l+r)/2,r);
        return vl + vr;
    }
};
//LazySegmentTree seg(vector<int>(N,0));

signed main() {
    IOS();
    cin>>N>>K;
    rep(i,0,N){
        cin>>a[i];
        a[i]-=K;
        s[i+1]=s[i]+a[i];
    }
    sort(s,s+N+1);
    
    map<int,int>mp;
    int cnt=0;
    rep(i,0,N+1){
        if(i==0)mp[s[i]]=cnt;
        else{
            if(s[i-1]!=s[i])mp[s[i]]=cnt;
            else continue;
        }
        cnt++;
    }
    
    int sum=0;
    LazySegmentTree seg(vector<int>(N,0));
    rep(i,0,N+1){
        int x=mp[sum];
        ans+=seg.getsum(0,x+1);
        seg.add(x,x+1,1);
        sum+=a[i];
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 25600
package main

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

var sc = bufio.NewScanner(os.Stdin)

func bi(a []byte) (n int) {
	for _, v := range a {
		n = n*10 + int(v-48)
	}
	return
}

func r() int {
	sc.Scan()
	b := sc.Bytes()
	if b[0] == 45 {
		return -bi(b[1:])
	} else {
		return bi(b)
	}
}

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = r()
	}

	// 初項が正の場合
	var x int // コスト
	var sum int
	for i, v := range a {
		sum += v
		switch i % 2 {
		case 0: // 偶数項
			if sum < 1 {
				x += (1 - sum)
				sum = 1
			}
		case 1: // 奇数項
			if sum > -1 {
				x += (1 + sum)
				sum = -1
			}
		}
	}

	// 初項が負の場合
	var y int // コスト
	sum = 0
	for i, v := range a {
		sum += v
		switch i % 2 {
		case 0:
			if sum > -1 {
				y += (1 + sum)
				sum = -1
			}
		case 1:
			if sum < 1 {
				y += (1 - sum)
				sum = 1
			}
		}
		if y >= x {
			break
		}
	}

	fmt.Println(smaller(x, y))
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}
 
int main() {
    string a, b;
    cin >> a >> b;
    a += b;
    int n;
    n = stoi(a);
    if(n / (int)sqrt(n) == sqrt(n)) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100001
using namespace std;

int main() {
  int a,b;
  string s;
  cin >> a >> b >> s;
  bool flag=true;
  for(int i=0;i<a;i++) {
    if(s[i]<'0' || s[i]>'9') {
      flag=false;
      break;
    }
  }
  if(s[a]!='-') flag=false;
  for(int i=a+1;i<s.size();i++) {
    if(s[i]<'0' || s[i]>'9') {
      flag=false;
      break;
    }
  }
  if(flag) cout(__TRUE);
  else cout(__FALSE);
}

Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        a: [[usize1; n - 1]; n],
    }
    let mut g = vec![vec![]; n * n];
    let mut d = vec![0; n * n];
    for i in 0..n {
        for j in 1..(n - 1) {
            let v = std::cmp::max(i, a[i][j - 1]) * n + std::cmp::min(i, a[i][j - 1]);
            let u = std::cmp::max(i, a[i][j]) * n + std::cmp::min(i, a[i][j]);
            g[v].push(u);
            d[u] += 1;
        }
    }
    let mut s = vec![];
    for i in 0..(n * n) {
        if d[i] == 0 {
            s.push(i);
        }
    }
    let mut used = 0;
    let mut ans = 0;
    while used < n * n {
        if s.len() == 0 {
            println!("-1");
            return;
        }
        let mut next = vec![];
        while let Some(v) = s.pop() {
            used += 1;
            for &u in g[v].iter() {
                d[u] -= 1;
                if d[u] == 0 {
                    next.push(u);
                }
            }
        }
        s = next;
        ans += 1;
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

#define ll long long
#define pii pair <int, int>
#define x first
#define y second

using namespace std;

int h, n;
int dp[10001];
pii v[1001];

inline bool cmp(pii a, pii b) {
    return (float)(a.x / a.y) > (float)(b.x / b.y);
}

inline int solve(int life) {
    if (life <= 0)
        return 0;
    if (dp[life]) return dp[life];
    int rez = INT_MAX;
    for (int i = 1; i <= n; ++i)
        rez = min(rez, v[i].y + solve(life - v[i].x));
    return dp[life] = rez;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> h >> n;
    for (int i = 1; i <= n; ++i) cin >> v[i].x >> v[i].y;
    cout << solve(h);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long 
using namespace std;
int arr[100100];
int dp[100100];
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		cin >> arr[i];
	}
	
	for (int i = 1; i < k; i++){
		dp[i] = abs(arr[i] - arr[0]);
	}
	/////////////////////////////////
	for (int i = k; i < n; i++){
		int ans = 9999999999;
		for (int j = i-k; j < i; j++){
			int tmp;
			tmp = dp[j] + abs(arr[j] - arr[i]);
			ans = min(ans, tmp);
		}
		dp[i] = ans;
	}
	cout << dp[n-1];
	return 0;
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n;

int main()
{
	IOS;
	cin >> n;
	int r = n/100;
	int s = r * 100 + r * 10 + r;
	if (n <= s) cout << s << endl;
	else cout << r+1 << r+1 << r+1 << endl;
	return 0;
}



Measured memory_bytes: 256
<?php
$first  = trim(fgets(STDIN));
$second = trim(fgets(STDIN));
$third  = trim(fgets(STDIN));

$num   = trim(fgets(STDIN));
$n  = array();
for ($i = 0; $i < $num; $i++) {
    $n[] = trim(fgets(STDIN));
}

$matrix = array();
$matrix[] = explode(" ", $first);
$matrix[] = explode(" ", $second);
$matrix[] = explode(" ", $third);

function isBingo(array $matrix, $nums)
{
    if (isBingoCol1($matrix, $nums)) return true;
    if (isBingoCol2($matrix, $nums)) return true;
    if (isBingoCol3($matrix, $nums)) return true;
    if (isBingoRow1($matrix, $nums)) return true;
    if (isBingoRow2($matrix, $nums)) return true;
    if (isBingoRow3($matrix, $nums)) return true;
    if (isBingoCross1($matrix, $nums)) return true;
    if (isBingoCross2($matrix, $nums)) return true;
    return false;
}
function isBingoCol1(array $matrix, $nums)
{
    $line = $matrix[0];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoCol2(array $matrix, $nums)
{
    $line = $matrix[1];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoCol3(array $matrix, $nums)
{
    $line = $matrix[2];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoRow1(array $matrix, $nums)
{
    $line[] = $matrix[0][0];
    $line[] = $matrix[1][0];
    $line[] = $matrix[2][0];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoRow2(array $matrix, $nums)
{
    $line[] = $matrix[0][1];
    $line[] = $matrix[1][1];
    $line[] = $matrix[2][1];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoRow3(array $matrix, $nums)
{
    $line[] = $matrix[0][2];
    $line[] = $matrix[1][2];
    $line[] = $matrix[2][2];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoCross1(array $matrix, $nums)
{
    $line[] = $matrix[0][0];
    $line[] = $matrix[1][1];
    $line[] = $matrix[2][2];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}
function isBingoCross2(array $matrix, $nums)
{
    $line[] = $matrix[0][2];
    $line[] = $matrix[1][1];
    $line[] = $matrix[2][0];
    for ($i = 0; $i < 3; $i++) {
        if (!in_array($line[$i], $nums)) {
            return false;
        }
    }
    return true;
}

if (isBingo($matrix, $n)) {
    echo 'Yes';
} else {
    echo 'No';
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007


int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> S(2002, vector<char>(2002));
  rep(i, H) {
    rep(j, W) {
      cin >> S[i][j];
    }
  }

  vvi a(2002, vi(2002, 0)), hashx(2002, vi(2002, 0));
  rep(i, H) {
    int res = 0;
    rep(j, W) {
      if (S[i][j] == '#') {
        res++;
      }
      else if (S[i][j] == '.') {
        a[i][j] = res;
        hashx[i][res]++;
      }
    }
  }

  vvi b(2002, vi(2002, 0)), hashy(2002, vi(2002, 0));
  rep(j, W) {
    int res = 0;
    rep(i, H) {
      if (S[i][j] == '#') {
        res++;
      }
      else if (S[i][j] == '.') {
        b[i][j] = res;
        hashy[res][j]++;
      }
    }
  }
  int ans = 1;
  rep(i, H) {
    rep(j, W) {
      if (S[i][j] == '.') {
        int tmp = hashx[i][a[i][j]] + hashy[b[i][j]][j] - 1;
        ans = max(tmp, ans);
      }
    }
  }
  cout << ans << endl;

}





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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin >> s;
  int n = s.size();
  int cnt[3] = {};
  rep(i, n) {
    cnt[s[i]-'a']++;
  }
  int a = abs(cnt[0]-cnt[1]);
  int b = abs(cnt[1]-cnt[2]);
  int c = abs(cnt[2]-cnt[0]);
  if(a <= 1 && b <= 1 && c <= 1) cout << "YES" << endl;
  else cout << "NO"<<endl;

  return 0;
}


Measured memory_bytes: 512
def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    for i in range(m):
        l, r, d = map(int, input().split())
        g[l - 1].append((r - 1, d))
        g[r - 1].append((l - 1, -d))
    dis = [0] * n
    visited = [False] * n
    stack = list(range(n))
    while len(stack):
        v = stack[-1]
        stack.pop()
        if visited[v]:
            continue
        visited[v] = True
        for u, d in g[v]:
            if not visited[u]:
                dis[u] = dis[v] + d
                stack.append(u)
    for v in range(n):
        for u, d in g[v]:
            if dis[v] + d != dis[u]:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()


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

void bubbleSort();

int A[100];
int X;
int count = 0;

int main() {
	cin >> X;
	for(int i=0; i<X; i++){
		cin >> A[i];
	}
	bubbleSort();
	for(int i=0; i<X; i++){
		if(i==X-1){
			cout << A[i];
		}else{
			cout << A[i] << " ";
		}
	}
	cout << endl;
	cout << count << endl;
	return 0;
}

void bubbleSort(){
  for(int i=0; i<X; i++){
  	for(int j=X-1; j>i; j--){
  		if(A[j]<A[j-1]){
  			swap(A[j], A[j-1]);
  			count++;
  		}
  	}
  }
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a;
  cin >> a;
  if (a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

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

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define rep(i,e) for(int i=0; i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long int ll;
using graph = vector<vector<int>>;
using edgedp = vector<vector<pair<int,ll>>>;
constexpr int INF=1000000;
//constexpr int MOD=998244353;
constexpr int MOD=1e9+7;




int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >>s;

    if(s=="ARC"){
        cout << "ABC" << "\n";
    }else{
        cout << "ARC" << "\n";
    }

}   




Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string s;
    cin>>s;
    if(s[0]!='A'){
        cout<<"WA";
        return 0; 
    }
    int a=0;
    for(int i=2;i<s.size()-1;i++){
        if(s[i]=='C'){
            a++;
        }
    }
    if(a!=1){
        cout<<"WA";
        return 0;
    }
    int b=0;
    REP(i,s.size()){
        if(s[i]>='a'&&s[i]<='z'){
            b++;
        }
    }
    if(b==s.size()-2){
        cout<<"AC";
    }else{
        cout<<"WA";
    }
    return 0;
}


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

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
string	st;
int	ans;
bool	flag = true;
int main()
{
	cin >> st;
	int L=0,R = st.size() - 1;
	while ( L <= R )
	{
		if ( L == R ) break;
		if ( st[L] == st[R] ) {L++,R--;continue;}
		if ( st[L] == 'x' ) {L++,ans++;continue;}
		if ( st[R] == 'x' ) {R--,ans++;continue;}
		flag = false; break;
	}
	ans = flag ? ans : -1;
	cout << ans ;
	return(0);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,m;
  cin >> n >> m;
  vi G[100005];
  rep(i,n){
    int a,b;
    cin >> a >> b;
    if(m-a>=0)G[m-a].push_back(b);
  }
  priority_queue<int> q;
  ll ans = 0;
  drep(i,m){
    for(auto x:G[i])q.push(x);
    if(q.empty())continue;
    ans+=q.top();
    q.pop();
  }
  cout<<ans<<endl;
  return 0;
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          string w = Input.ScanStr();
          string c="CODEFESTIVAL2016";
          int res=0;
          for(int i=0;i<16;i++)
            if(w[i]!=c[i]) res++;
          
          Console.WriteLine(res);
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long L, R;
    cin >> L >> R;
    if(R-L>=2018) cout << 0 << endl;
    else {
        long long ans = 2019;
        for(long long i = L; i <= R; i++) {
            for(long long j = i+1; j <= R; j++) {
                ans = min(ans, (i*j)%2019);
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            String tmp = sc.next();
            s[i] = convert(tmp);
        }
        sc.close();

        Map<String, Integer> map = new HashMap<>();
        long ans = 0;
        for (int i = 0; i < n; i++) {
//            System.out.println(s[i]);
            if (map.keySet().contains(s[i])) {
                ans += map.get(s[i]);
            } else {
                map.put(s[i], 0);
            }
            map.put(s[i], map.get(s[i]) + 1);
        }
        System.out.println(ans);

    }

    static String convert(String input) {
        List<Character> list = new ArrayList<>();
        for (int i = 0; i < input.length(); i++) {
            list.add(input.charAt(i));
        }
        Collections.sort(list);
        String result = list.stream().map(e -> String.valueOf(e)).collect(Collectors.joining(""));
        return result;
    }
}


Measured memory_bytes: 89292
#include <bits/stdc++.h>
//#define mp make_pair
using namespace std;
typedef pair<int, int> pii;

int x, y;
char data[105][105];

int main() {
	cin>> x >> y;
	for(int i = 0; i < x; i++)
		for(int j = 0; j < y; j++)
			cin>> data[i][j];
	for(int i = 0; i < x + 2; i++) {
		for(int j = 0; j < y + 2; j++) {
			if(i == 0 || i == x + 1)
				cout<< "#";
			else {
				if(j == 0 || j == y + 1)
					cout<< "#";
				else
					cout<< data[i - 1][j - 1];
			}
		}
		cout<< endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#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;

int d[100010];

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	rep(i, 0, n){
		int a, b;
		cin >> a >> b;
		d[a]++;
		d[b + 1]--;
	}
	rep(i, 1, 100010){
		d[i] += d[i - 1];
	}
	int ans = 0;
	rep(i, 0, 100010){
		if(d[i] >= i - 1) chmax(ans, i - 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3928
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
      x: usize,
    }
    if x == 7 || x == 5 || x == 3 {
        println!("{}", "YES");
    } else {
        println!("{}", "NO");
    }
}


Measured memory_bytes: 4352
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vint n;
  int v;
  rep(i,4){
    cin>>v;
    vpush(n,v);
  }
  sort(all(n));
  cout<<(n[0]==1 && n[1]==4 && n[2]==7 && n[3]==9 ? "YES" :"NO");
  return(0);
}


Measured memory_bytes: 256
li_a = input().split()

li_b = input().split()

li_a = [int(i) for i in li_a]
i = 0
li_b = [int(i) for i in li_b]

li_c = sorted(li_b,reverse=True)

for j in range(li_a[1]):
    if j == len(li_b):
        break
    li_c[j] = 0

print(sum(li_c))

Measured memory_bytes: 26764
S = list(input())
N = len(S)
S_2 = S[0 : int((N - 1) / 2)]
S_3 = S[int((N + 3) / 2)-1 :]

if S == S[::-1] and S_2 == S_2[::-1] and S_3 == S_3[::-1]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include<cstdio>

const int MAX_V = 45;
int fib_array[MAX_V]{0};
void make_fib_array(){
  fib_array[0]=1;
  fib_array[1]=1;
  for(int i=2;i<MAX_V;i++)
    fib_array[i]=fib_array[i-1]+fib_array[i-2];
}
int main(){
  make_fib_array();
  int n; scanf("%d",&n);
  printf("%d\n",fib_array[n]);
}

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

ll x;

int main(){
	cin >> x;
 
	ll x11 = x / 11;
	x -= x11 * 11;
	ll times = x11 * 2;
	if(x >= 7 && x <= 10) times += 2;
	else if(x <= 6 && x >= 1) times += 1;
 
	cout << times << endl;
 
	return 0;
}


Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: u64 = sc.read();
    let mut ans = n;
    for i in 1..1000001 {
        if n % i == 0 {
            let j = n / i;
            ans = cmp::min(ans, i - 1 + j - 1);
        }
    }

    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <stdio.h>


int main()
{
	int N;
	int A[1000];
	int i, j, k;


	scanf("%d", &N);

	for(i = 0; i < N; i++)
		scanf("%d", &A[i]);

	// 表示
	for(i = 0; i < N; i++){
		printf("%d", A[i]);
		if(i != N - 1)
			printf(" ");
		else
			printf("\n");
	}


	// ソート
	for(i = 1; i < N; i++){
		j = i;
		while(j >= 1 && A[j - 1] > A[j]){
			A[j] ^= A[j - 1];
			A[j - 1] ^= A[j];
			A[j] ^= A[j - 1];
			j--;
		}
		// 表示
		for(k = 0; k < N; k++){
			printf("%d", A[k]);
			if(k != N - 1)
				printf(" ");
			else
				printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2104
n, t = map(int, input().split())
a = list(map(int, input().split()))

m = a[0]
d = 0
c = 1

for i in range(1, n):
    if a[i] - m > d:
        d = a[i] - m
        c = 1
    elif a[i] - m == d:
        c += 1
    elif a[i] < m:
        m = a[i]

print(c)

Measured memory_bytes: 15020
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 100000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	vector<pair<pii, int>> Va;
	
	int v = 1;
	for (int i = 1; i <= 12; i++) {
		Va.emplace_back(pii(i, i + 1), 0);
		Va.emplace_back(pii(i, i + 1), 1*v);
		Va.emplace_back(pii(i, i + 1), 2*v);
		v *= 3;
	}

	int N;
	scanf("%d", &N);
	
	int cur = 0;
	v = 1;
	for (int i = 1; i <= 13; i++) {
		int c = N % 3;
		for (int j = 1; j <= c; j++) {
			Va.emplace_back(pii(i, 14), cur);
			cur += v;
		}
		N /= 3;
		v *= 3;
	}

	printf("14 %d\n", (int)Va.size());
	for (auto it : Va) printf("%d %d %d\n", it.first.first, it.first.second, it.second);
	return 0;
}

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




public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7);
	static long cf = 998244353;
    static final long MAX = (long) 1e18;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static int col = 32;
    public static int[] Bit;
    public static long[] dp;
    public static long[] fac,inv;
	public static void main(String[] args) {
	
	FastReader sc = new FastReader();
	
	int n = sc.nextInt();
	int m = sc.nextInt();
	if(n == m) out.print("Yes");
	else out.print("No");
	
	out.close();
}
}

Measured memory_bytes: 23252
import math
from collections import defaultdict

def main():
    _ = int(input())
    nums = list(map(int, input().split()))
    n = len(nums)
    nums.sort()

    nums_cnt = defaultdict(int)
    for num in nums:
        nums_cnt[num] += 1

    cnt = 0
    #print(num_bin_digits)

    for cur in reversed(range(n)):
        num = nums[cur]
        if nums_cnt[num] <= 0:
            continue

        power_of_2 = 1 << math.ceil(math.log2(num))

        pair = power_of_2 - num


        if pair != 0 and nums_cnt[pair] > 0:
            nums_cnt[pair] -= 1
            nums_cnt[num] -= 1
            cnt += 1
        elif pair == 0 and nums_cnt[num] >= 2:
            nums_cnt[num] -= 2
            cnt += 1


        '''
        idx = bisect.bisect_left(nums, pair)
        if idx >= cur or nums[idx] != pair:
            #print('continue',pair, idx)
            continue

        while used[idx]:
            idx += 1

        if nums[idx] == pair:
            used[idx] = True
            cnt += 1

        #print(idx, num, power_of_2, pair)
        #print(cnt, nums, used)
        '''

        #print(nums_cnt)

    print(cnt)

    return

main()

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


using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/


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

    int n;
    cin>>n;
    vector<int> a(3*n);
    for (int i = 0; i<3*n; i++) cin>>a[i];
    sort(a.begin(), a.end());
    ll total = 0;
    for (int i = 0; i<n; i++) total+=a[n + 2*i];
    cout<<total;

}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 100001

ll dp[MAXN][3];
ll n;
ll a[MAXN][3];
ll maxv = -1;


int main() {

    cin >> n;
    for(ll i=0; i<n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }

    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for(ll i=1; i<n; i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i][0];
        dp[i][1] = max(dp[i-1][2], dp[i-1][0]) + a[i][1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + a[i][2];
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;
}


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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    string ans = "Yes";
    if (A==B and B==C and C==A) {
        ans = "No";
    }
    else if (A!=B and B!=C and C!=A) {
        ans = "No";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	public static int UNDISCOVERED = 0;
	public static int DISCOVERED = 1;
	public static int COMPLETED = 2;
	private ArrayList<Node> nodes = new ArrayList<Node>();
	private int nodesNum = 0;
	private int edgesNum = 0;
	private ArrayList<Node> roots = new ArrayList<Node>();
	
	/* Main Method */
	public static void main(String[] args) {
		Main graph = new Main();
		graph.initialize();
		boolean flag = false;
		for(int i = 0; i < graph.nodesNum; i++) {
			Node target = graph.nodes.get(i);
			if(target.getStatus() > UNDISCOVERED) continue;
			else if(graph.dfs(target)) flag = true;
		}
		if(flag) System.out.println("1");
		else System.out.println("0");
	}

	/* Read the input, generate nodes and initialize with edges */
	private void initialize() {
		Scanner scanner = new Scanner(System.in);
		this.nodesNum = scanner.nextInt();
		this.edgesNum = scanner.nextInt();
		this.generateNodes(nodesNum);
		for(int i = 0; i < edgesNum; i++) {
			int origin = scanner.nextInt();
			int destination = scanner.nextInt();
			Node originNode = this.nodes.get(origin);
			Node destinationNode = this.nodes.get(destination);
			originNode.edges.add(new Edge(originNode, destinationNode));
		}
	}	
	
	/* Depth first search function */
	private boolean dfs(Node u) {
		u.discover();
		boolean detection = false;
		for(int i = 0; i < u.edges.size(); i++) {
			Node destination = u.edges.get(i).getDestination();
			if(destination.getStatus() == DISCOVERED) return true;
			if(destination.getStatus() == UNDISCOVERED) if(dfs(destination)) return true;;
		}
		u.complete();
		return false;
	}
	
	/* Generate the given number of Nodes */
	private void generateNodes(int num) {
		for(int i = 0; i < num; i++) nodes.add(new Node(Integer.toString(i)));
	}
	
	/* Node class */
	private class Node {
		private String name = "";
		private boolean marked = false;
		public ArrayList<Edge> edges = new ArrayList<Edge>();
		private int status = UNDISCOVERED;
		
		public Node(String name) {
			this.name = name;
		}
		public String getName() {
			return this.name;
		}
		public void discover() {
			this.status = DISCOVERED;
		}
		public void complete() {
			this.status = COMPLETED;
		}
		public int getStatus() {
			return this.status;
		}
	}
	
	/* Edge class */
	private class Edge {
		private Node origin;
		private Node destination;
		public Edge(Node ori, Node dest) {
			this.origin = ori;
			this.destination = dest;
		}
		public Node getDestination() {
			return this.destination;
		}
		public Node getOrigin() {
			return this.origin;
		}
	}
}



Measured memory_bytes: 31664
S = input()

ans = ""

for i in range(len(S)):
    if S[i] == 'B':
        if len(ans) > 0: 
            ans = ans[:-1]
    elif S[i] == '0':
        ans = ans + "0"
    elif S[i] == '1':
        ans = ans + "1"
        
print(ans)

Measured memory_bytes: 3060
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif


const int N = 2e5 + 10;

// bool vis[N << 2];

int dis[N << 2], h[N], tot;

struct edge {
  int v, nxt;
} G[N];

void addedge(int u, int v) {
  G[tot] = {v, h[u]}; h[u] = tot++;
}

void Main() {
  for(int i = 0; i < (N << 2); i++) dis[i] = -3;
  memset(h, 0xff, sizeof h);
  tot = 0;
  int n, m; cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int u, v; cin >> u >> v;
    addedge(u, v);
  }
  int s, t; cin >> s >> t;
  queue<int> q;
  // vis[s << 2] = 1;
  dis[s << 2] = 0;
  q.push(s << 2);
  while(!q.empty()) {
    const int cur = q.front();
    q.pop();
    const int u = cur >> 2, p = cur & 3;
    // debug(u, p, cur);
    for(int i = h[u]; ~i; i = G[i].nxt) {
      const int v = G[i].v, np = (p + 1) % 3;
      const int nxt = (v << 2) | np;
      if(dis[nxt] == -3) {
        // vis[nxt] = true;
        dis[nxt] = dis[cur] + 1;
        // debug(dis[nxt], dis[u]);
        q.push(nxt);
      }
    }
  }
  // debug(dis[t << 2]);
  cout << dis[t << 2] / 3 << "\n";
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll H, N;
  cin >> H >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  ll S = accumulate(A.begin(), A.end(), 0LL);
  cout << ((S >= H) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        for(int i = 0;i < 3;i++){
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        System.out.println(list.get(0)+list.get(1));
    }
}


Measured memory_bytes: 21844
N = int(input())
A = list(map(int, input().split()))
neg_cnt = sum(a < 0 for a in A)
A = sorted(a if a >= 0 else -a for a in A)
if neg_cnt % 2:
    print(sum(A) - 2 * A[0])
else:
    print(sum(A))


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

int main()
{
    map < ll , ll> m;
    map < ll , ll> ::iterator it;
    ll n,a;
    cin>>n;
    for(ll i =1; i<=n ; i++){
        cin>>a;
        m[a]++;
    }
    ll count=0;
    for( it = m.begin(); it!=m.end() ; it++){
        if(it->first>it->second)
            count+=it->second;
        else if(it->first<it->second)
            count+=it->second-it->first;
    }


    cout<<count<<endl;
}


Measured memory_bytes: 9620
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a[] = new int[3];
        for (int i=0;i<3;i++){
            a[i]=sc.nextInt();
        }
        if (a[0]==1&&a[1]==1){
            System.out.println("Open");
        }else if (a[2]==1){
            System.out.println("Open");
        }else{
            System.out.println("Close");
        }
    }
}

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

int main()
{
	int A, B, C, K;
	cin >> A >> B >> C >> K;

	int max;

	if (A >= K)
	{
		max = K;
	}
	else
	{
		if (B >= K - A)
		{
			max = A;
		}
		else
		{
			// A + (K - A - B) * (-1)
			max = A * 2 + B - K;
		}
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<math.h>
int main()
{
    int i,j,k=0,l,m=0,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            if((i+j)%2!=0)
            {
                k++;
            }
        }
    }
    printf("%d",k);
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    if ( s == t ) {
        cout << n << endl;
        return 0;
    }
    rep(i, n) {
        bool ok = true;
        rep(j, n-i) {
            if ( s[i+j] == t[j] ) continue;
            else {
                ok = false;
                break;
            }
        }
        if ( ok ) {
            cout << n + i << endl;
            return 0;
        }
    }
    cout << 2 * n << endl;
    return 0;
}


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

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;

    if (v-w > 0 && (v-w)*t >= abs(a-b)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

/*
 * a-b  == iw - iv
 * a-b == i(w-v)
 */

Measured memory_bytes: 3104
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int sLen = s.length();
        int tLen = t.length();

        int i = sLen - tLen;
        for(; i>= 0; i--) {
            if(isValid(s, i, t))
                break;
        }
        if(i == -1)
            System.out.println("UNRESTORABLE");
        else {
            String str = mkResult(s, t, i);
            System.out.println(str);
        }
    }

    private static String mkResult(String s, String t, int idx) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < s.length(); i++) {
            if(idx <= i && i < idx + t.length())
                sb.append(t.charAt(i - idx));
            else if(s.charAt(i) == '?')
                sb.append('a');
            else
                sb.append(s.charAt(i));
        }
        return sb.toString();
    }

    private static boolean isValid(String s, int idx, String t) {
        int i = 0;
        while(i < t.length()) {
            if(s.charAt(idx+i) == '?' || s.charAt(idx+i) == t.charAt(i)) {
                i++;
            } else {
                break;
            }
        }
        return i == t.length();
    }
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	double n, m, d;
	cin >> n >> m >> d;
	double ans = (d == 0 ? n : 2 * (n - d)) / (n * n);
	ans *= m - 1;
	printf("%.10f\n", ans);
}



Measured memory_bytes: 256
#!ruby -na
n,*a,d=$F.map &:to_i
e={}
f=->n{e[n]||=(*r=e[n]=n*d
[2,3,5].zip(a){|y,a|r<<f[n/y]+a+n%y*d<<f[0--n/y]+a+-n%y*d}
r.min)}
p f[n]if d

Measured memory_bytes: 17840
#include <bits/stdc++.h>
#include<unordered_map>
#define lli long long int
using namespace std;

int main() {

	std::ios::sync_with_stdio(0);
	std::cin.tie(0);

	//freopen("text.in", "r", stdin);
	//freopen("text.out", "w", stdout);

	int n, d, counter = 0;
	cin >> n >> d;
	while (n > 0) {
		counter++;
		n -= (d * 2) + 1;
	}
	cout << counter << '\n';
	return 0;
}

Measured memory_bytes: 256