akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n, i,p,l,r;
  scanf("%d", &n);
  int a[n];
  for ( i = 1; i <= n; i++ ){
    scanf("%d",&a[i]);
    //printf("%d",a[i]);
  }
  for(i=1;i<=n;i++){
    p=i/2;
    l=2*i;
    r=2*i+1;
    printf("node %d: key = %d, ",i,a[i]);
    if(i!=1){
      printf("parent key = %d, ",a[p]);
    }
    if(l<=n){
      printf("left key = %d, ",a[l]);
    }
    if(r<=n){
      printf("right key = %d, ",a[r]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2044
#[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),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

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

#[allow(unused_imports)]
use std::io::Write;

const MOD: usize = 1e9 as usize + 7;

// n^pow
fn mod_pow(n: usize, pow: usize) -> usize {
    if pow == 0 {
        return 1;
    }

    let mut res = mod_pow(n*n%MOD, pow/2);
    if pow%2 == 1{
        res = res * n % MOD;
    }
    res
}

fn main() {
    input!{
      n: usize,
      aa: [usize; n+1],
    }
    let n = n+1;

    let mut l = 0;
    let mut r = 0;
    let mut used = vec![(false, 0); n];
    for i in 0..n {
        let a = aa[i];
        if used[a].0 {
            l = used[a].1;
            r = i;
            break;
        }
        used[a] = (true, i);
    }


    // 逆元と階乗を事前計算する
    let mut fact = vec![0; n+1];
    let mut inv = vec![0; n+1];
    fact[0] = 1;
    inv[0] = 1;

    for i in 1..n+1 {
        fact[i] = i * fact[i-1] % MOD;
        // inv(k) = (k!)^(m-2)
        // inv(k) = k^(m-2) * inv(k-1)
        inv[i] = mod_pow(i, MOD-2) * inv[i-1] % MOD;
    }

    let combi = |n, k| -> usize {
        if n < k { return 0 };
        ((fact[n] * inv[k] % MOD) * inv[n-k]) % MOD
    };

    for k in 1..n+1 {
        let ans = combi(n, k);
        let dup = combi(l+n-r-1, k-1);
        println!("{}", (ans+MOD-dup)%MOD);
    }
}


Measured memory_bytes: 9340
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXLEVEL 10
#define MAXW 100010

int n, q;
vector<int> ans, qv, ql, v, w, d;
vector<vector<int>> dp;
vector<vector<int>> qlist;

void dfs(int id, int level) {
	if (id > n) return;
	d[level] = id;

	int i, j, k;

	if (level < MAXLEVEL) {
		for (i = 0; i < MAXW; i++) {
			dp[level][i] = dp[level - 1][i];
			if (i - w[id] >= 0) dp[level][i] = max(dp[level][i], dp[level - 1][i - w[id]] + v[id]);
		}
	}

	for (auto qid : qlist[id]) {
		if (level < MAXLEVEL) ans[qid] = dp[level][ql[qid]];
		else {
			int m = level + 1 - MAXLEVEL, mm = 1 << m, sv, sw;
			ans[qid] = 0;
			for (i = 0; i < mm; i++) {
				sv = 0; sw = 0;
				for (j = 0; j < m; j++) {
					if ((1 << j) & i) {
						sv += v[d[level - j]];
						sw += w[d[level - j]];
					}
				}
				if (ql[qid] - sw >= 0) ans[qid] = max(ans[qid], sv + dp[MAXLEVEL - 1][ql[qid] - sw]);
			}
		}
	}

	dfs(id * 2, level + 1);
	dfs(id * 2 + 1, level + 1);
}

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

	int i, j, k;

	cin >> n;
	v.resize(n + 1);
	w.resize(n + 1);
	for (i = 1; i <= n; i++) cin >> v[i] >> w[i];
	
	cin >> q;
	ans.resize(q);
	qv.resize(q);
	ql.resize(q);
	qlist.resize(n + 1);
	for (i = 0; i < q; i++) {
		cin >> qv[i] >> ql[i];
		qlist[qv[i]].push_back(i);
	}

	dp.assign(MAXLEVEL, vector<int>(MAXW, 0));

	d.resize(n + 100);
	dfs(1, 1);

	for (i = 0; i < q; i++) cout << ans[i] << "\n";

	return 0;
}


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

#define lli long long int
#define ld long double
#define DEFO(n) lli n = 0;
#define MAX_L lli max = 9000000000000000000;
#define MIN_L lli min = 9000000000000000000;
#define MAX_D ld max = 4500;
#define MIN_D ld min = -4500;
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LD(n) \
  ld n;       \
  cin > n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define LLIV2(a, b, n)         \
  vector<lli> a(n), b(n);      \
  for (lli i = 0; i < n; i++)  \
  {                            \
    cin >> a.at(i) >> b.at(i); \
  };
#define LDV(a, n)             \
  vector<ld> a(n);            \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define SUM(n) accumulate(n.begin(), n.end(), 0);
#define SORT(n) sort(n.begin(), n.end());
#define REVE(n) reverse(n.begin(), n.end());
#define yes              \
  cout << "Yes" << endl; \
  return 0;
#define no              \
  cout << "No" << endl; \
  return 0;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
//こぴー
/*#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
*/

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli KSum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

//数値反転
bool KReve(lli n)
{
  int reverse = 0;
  int remaind;
  int tmp = n;
  while (tmp != 0)
  {
    remaind = tmp % 10;
    reverse = reverse * 10 + remaind;
    tmp /= 10;
  }
  if (reverse == n)
    return true;
  else
    return false;
}

int main(void)
{
  ios::sync_with_stdio(false);
  LLI(n) LLIV(a, n*3) SORT(a) REVE(a) DEFO(sum)
  for(lli i = 0;i < 2*n;i=i+2) {
    sum += a[i+1];
  }
  OUT(sum)
}


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

int main(){
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> table(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> table.at(i).at(j);
    }
  }
  
  vector<bool> flagH(H,false);
  vector<bool> flagW(W,false);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(table.at(i).at(j)=='#'){
        flagH.at(i)=true;
        flagW.at(j)=true;
      }
    }
  }
  
    for(int i=0;i<H;i++){
      if(flagH.at(i)){
        for(int j=0;j<W;j++){
          if(flagW.at(j))
            cout << table.at(i).at(j);
          if(j==W-1)
            cout << endl;
        }
      }
      
    } 
   
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
    int a[150]={0},num=0;
    char t;
    for(int i=0;i<4;i++)
    {scanf("%c",&t);
    if(a[t]==2) {num++;a[t]+=1;}
    if(a[t]==0) a[t]+=1;
    if(a[t]==1) a[t]+=1;
    if(a[t]==3) a[t]+=1;
    }
    if(num==2)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, K; cin >> N >> K;
	map<ll, ll> m;
	for (int i = 0; i < N;i++) {
		ll a, b; cin >> a >> b;
		m[a] += b;
	}
	ll sum = 0;
	for (auto M : m) {
		sum += M.second;
		if (sum >= K) {
			cout << M.first << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
typedef pair<int, int> pii;

ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
} 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
} 
ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll n, k; cin>>n>>k;
	ll top = 0;
	ll cnt[k+1] = {};
	for(ll i = k; i >= 1; i--){
		ll bound = k/i;
		ll ans1 = exp(bound, n);
		for(ll u = 2*i; u <= k; u += i){
			ans1 = (ans1 - cnt[u] + mod) % mod;
		}
		cnt[i] = ans1;
		//cout<<ans1<<endl;
		top = (top + ans1*i) % mod;
	}
	cout<<top<<endl;
}


Measured memory_bytes: 4360
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>

#define ll long long

using namespace std;

int main()
{
    int K, S; cin >> K >> S;
    int cnt = 0;
    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S - x - y;
            if (z >= 0 && z <= K) {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;
const int inf = 100000 * 10000 + 100;

int main(){
	int V, E, r;
	cin >> V >> E >> r;
	vector<int> cost(V, inf);
	cost[r] = 0;
	vector<int> s(E);
	vector<int> t(E);
	vector<int> d(E);
	for(int i = 0; i < E; i++){
		cin >> s[i] >> t[i] >> d[i];
	}
	
	for(int i = 0; i < V; i++){
		bool update = false;
		for(int j = 0; j < E; j++){
			if(cost[s[j]] < inf && cost[s[j]] + d[j] < cost[t[j]]){
				cost[t[j]] = cost[s[j]] + d[j];
				update = true;			}
		}
		if (!update) break;
	}
	for(int i = 0; i < V; i++){
		if(cost[i] < inf)
			cout << cost[i] << endl;
		else
			cout << "INF" << endl;
	}
}

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

using namespace std;
typedef long long ll;
long long mod = 1000000007;
const int INF = 1001001001;

int main(){
  int n; cin >> n;
  vector<int> count_1(60,0);
  for(int i=0;i<n;i++){
    ll a; cin >> a;
    for(int j=0;j<60;j++){
      int x = a & (ll)1;
      count_1.at(j) += x;
      a >>= 1;
      if(a == 0) break;
    }
  }
  ll ans = 0;
  for(int i=0;i<60;i++){
    ll a = (ll)count_1.at(i) * ((ll)n - count_1.at(i)) % mod;
    for(int j=0;j<i;j++){
      a = a * 2 % mod;
    }
    ans = (ans + a) % mod; 
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
	int n=0;
	int ma=0;
	int mi=0;
	cin >> n;
	{
		int buf=0;
		cin >> buf;
		ma=buf;
		mi=buf;
	}
	for(int i=1;i<n;i++){
		int temp=0;
		cin >> temp;
		ma=max(temp,ma);
		mi=min(temp,mi);
	}
	cout << ma-mi;
	return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[0])
else:
    l = lcm(t[0], t[1])
    for i in range(1, n):
        l = lcm(l, t[i])
    print(l)


Measured memory_bytes: 3064
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <typeinfo>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;



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

    rep(i,n){
        string s;
        getline(cin,s);
        for(int i=0;i<s.size();i++){
            if(s[i]=='H' && s[i+1]=='o' && s[i+2]=='s' && s[i+3]=='h' && s[i+4]=='i' && s[i+5]=='n' && s[i+6]=='o'){
                s[i+6]='a';
            }
        }
        cout<<s<<endl;
    }
     return 0;
 }

Measured memory_bytes: 1208
#include <iostream>
#include <string.h>
using namespace std;
int a[30];
string s;

int main(){
 	cin >> s;
  	for(int i=0;i<s.size();i++) a[s[i]-'a']++;
	for(int i=0;i<30;i++) if(a[i]%2){cout << "No" << endl; return 0;}
  	
  	cout << "Yes" << endl;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("ip1.txt", "r", stdin);
  freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
  return (a.second < b.second);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int prime(int n) {
  int flag = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {flag = 0; break;}
  }
  return flag;
}
int power(int x, int y)
{
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
  else
    return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}

int32_t main()
{
  k_007();
  int n;
  cin >> n;
  int a[n + 1];
  vi ans(n + 1);
  for (int i = 2; i <= n; i++)
  {
    cin >> a[i];
    ans[a[i]]++;
  }

  for (int i = 1; i <= n; i++)
  {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 6380
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int l,r;
    cin >> l >> r;
    int s = l/2019, t = r/2019;
    vi ans;
    loop(i,l,min(r,l+2019)){
        loop(j,i+1,min(r+1,i+2020)){
            ans.push_back(i*j%2019);
        }
    }
    sort(all(ans));
    cout << ans[0] << endl;
}


Measured memory_bytes: 34916
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	vector<int> X(n), Y;
	for (int i = 0; i < n; ++i) cin >> X[i];
	Y = X;
	sort(Y.begin(), Y.end());
	int l_mid = Y[n / 2 - 1];
	int r_mid = Y[n / 2];

	for (int i = 0; i < n; ++i) {
		if (X[i] <= l_mid) cout << r_mid << endl;
		else cout << l_mid << endl;
	}
	return 0;
}

Measured memory_bytes: 3712
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
if a - b <= 0:
    print(0)
else:
    print(a-b)

Measured memory_bytes: 5144
N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
if K >= N
    puts 1 ; exit
end
if (N - K) % (K - 1) == 0
    puts (N - K) / (K - 1) + 1
else
    puts (N - K) / (K - 1) + 1 + 1
end

Measured memory_bytes: 8068
//#include <bits/stdc++.h>
//using namespace std;
//
//typedef long long int ll;
//typedef pair <int, int> pii;
//const int mod = 1e9+7;
//
//ll v(int n){
//    ll ans = 0;
//    for(ll i=1;i<=n;i++){
//        for(ll j=1;j<=n;j++){
//            for(ll k=1;k<=n;k++){
//                ll temp = __gcd(i,j);
//                temp = __gcd(temp,k);
//                ans+=temp;
//            }
//        }
//    }
//    return ans;
//}
//
//int main(){
//    int n;
//    scanf("%d",&n);
//    ll count = (n*n*n);
//    ll ans = 0;
//    for(int i=1;i<=n;i++){
//        ans += (i*(n/i)*(n/i));
//        count -= (1*(n/i)*(n/i));
//    }
//    ans+=count;
//
//    printf("%lld %lld\n",ans,v(n));
//	return 0;
//}


#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair <int, int> pii;
const int mod = 1e9+7;

int main(){
    ll n;
    scanf("%lld",&n);
    ll ans = (n*(n+1))/2LL;
    ll th = (n/3LL);
    ll three = (3LL*th*(th+1LL))/2LL;
    ll fv = (n/5LL);
    ll five = (5LL*fv*(fv+1LL))/2LL;
    ll fif = (n/15LL);
    ll fifteen = (15*fif*(fif+1LL))/2LL;

    ll res = ans-(three+five)+fifteen;
    printf("%lld\n",res);
	return 0;
}


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

int main() {
  int n, x;
  cin >> n >> x;
  int loc = 0;
  int ans = 0;
  int l[100];
  l[0] = 0;
  for(int i = 0; i < n; i++) {
    cin >> l[i+1];
  }

  for(int i = 1; i <= n+1; i++) {
    if(i == n+1) {
      ans = n+1;
      break;
    }

    loc = loc + l[i];
    if(loc > x) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
	int N, K;
	string s;
	cin >> N >> K;
	cin >> s;
	if (s[K-1] == 'A') s[K - 1] = 'a';
	else if (s[K-1] == 'B') s[K - 1] = 'b';
	else if (s[K-1] == 'C') s[K - 1] = 'c';
	cout << s << endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	x=0;
	while(x*x<=N) x++;
	cout<<(x-1)*(x-1);
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200010;

int n,v[MAXN],e[MAXN],d[MAXN];
long long int resp;

int main ()
{
	scanf("%d",&n);

	for(int i=1;i<=n;i++)
		scanf("%d",&v[i]);

	v[0]=-1,	v[n+1]=-1;

	for(int i=1;i<=n;i++)
	{
		int cur=i-1;
		while(v[cur]>v[i])	cur=e[cur];
		e[i]=cur;
	}

	for(int i=n;i>0;i--)
	{
		int cur=i+1;
		while(v[cur]>v[i])	cur=d[cur];
		d[i]=cur;
	}

	for(int i=1;i<=n;i++)
	{
		long long int r1=d[i]-i-1;
		long long int r2=i-e[i]-1;
		resp+=(r1*r2+r1+r2+1)*v[i];
	}

	printf("%lld\n",resp);
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define HANI (1000001)
int n,m;
int x[HANI];
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        x[a]++;
        x[b]++;
    }
    for(int i=1;i<=n;i++){
        if(x[i]%2!=0){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>

int main(void){
	long N,P,ans=1;
	scanf("%ld %ld",&N,&P);
	
	if(N==1){
		printf("%ld",P);
		return 0;
	}
	
	int div=0;
	while(P%2==0){
		P/=2;
		div++;
		if(div>=N) {
			ans*=2;
			div-=N;
		}
	}
	
	for(int i=3;P>1&&i<=sqrt(P);i+=2){
		div=0;
		while(P%i==0){
			P/=i;
			div++;
			if(div>=N) {
				ans*=i;
				div-=N;
			}
		}
		
	}
	
	printf("%ld",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

std::string reversed(std::string str)
{
    std::string ret;
    int len;
    
    len = str.length();
    for (int i = 0; i < len; i++){
        ret.append(str, len - 1 - i, 1);
    }
    
    return ret;
}

int main()
{
    std::string str;
    
    std::cin >> str;
    
    std::cout << reversed(str) << std::endl;
    
    return 0;
}

Measured memory_bytes: 1176
N = int(input())
s = []
for i in range(N):
    s.append(input())
M = int(input())
t = []
for i in range(M):
    t.append(input())

score = 0
for word in s:
	n = s.count(word)
	m = t.count(word)
	if n > m:
		score = max(score, n-m)

print(score)

Measured memory_bytes: 3064
import scala.io.StdIn.{readInt,readLine}

object Main extends App {
  val n = readInt
  val a = readLine.split(" ").map(_.toInt).sorted
  var max = 0D;var ab=0;var cd=0;var r=0D
  for(i<-1 to n-3) {
    cd = a(i) - a(i-1)
    ab = a(n-1)+a(n-2)
    r = ab.toDouble/cd.toDouble
    if(max<r) max = r
  }
  cd = a(n-2)-a(n-3)
  ab = a(n-1)+a(n-4)
  r = ab.toDouble/cd.toDouble
  if(max<r) max = r
  cd = a(n-1)-a(n-2)
  ab = a(n-3)+a(n-4)
  r = ab.toDouble/cd.toDouble
  if(max<r) max = r
  printf("%.5f\n",max)
}

Measured memory_bytes: 44628
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n>=400 && n<=599)
            System.out.println(8);
        else if(n>=600 && n<=799)
            System.out.println(7);
        else if (n>=800 && n<=999)
            System.out.println(6);
        else if(n>=1000 && n<=1199)
            System.out.println(5);
        else if(n>=1200 && n<=1399)
            System.out.println(4);
        else if(n>=1400 && n<=1599)
            System.out.println(3);
        else if(n>=1600 && n<=1799)
            System.out.println(2);
        else if(n>=1800 && n<=1999)
            System.out.println(1);
        
    }
    }

Measured memory_bytes: 27040
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<char,ll> mp;
ll n,cnt,ans,N;
string s;
vector<ll> v;
ll f(ll x){
    if(x==0)return 1;
    return f(x-1)*x;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s[0]=='M'||s[0]=='A'||s[0]=='R'||s[0]=='C'||s[0]=='H')
        mp[s[0]]++;
    }
    N=mp.size();
    if(N<=2){
        cout<<0<<endl;
        return 0;
    }
    for(auto x:mp){
        v.push_back(x.second);
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                ans+=v[i]*v[j]*v[k];
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdint>

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

	if (n <= 9) {
		std::cout << n << std::endl;
		return 0;
	}

	int dig = 0, msd = 0, m = n;
	while (m != 0) {
		++dig;
		msd = m;

		m /= 10;
	}

	auto pow10 = [](int a) {
		if (a < 0)
			return 0;

		int ret = 1;
		for (int i = 0; i < a; ++i)
			ret *= 10;

		return ret;
	};

	auto count = [=](int x, int y) -> std::int64_t {
		if (x < msd)
			return (pow10(dig - 1) - 1) / 9 + (x == y ? 1 : 0);

		if (x > msd)
			return (pow10(dig - 2) - 1) / 9 + (x == y ? 1 : 0);

		return (pow10(dig - 2) - 1) / 9 + n / 10 - msd * pow10(dig - 2) + (y <= n % 10 ? 1 : 0) + (x == y ? 1 : 0);
	};

	std::int64_t ans = 0;
	for (int i = 1; i <= 9; ++i)
		for (int j = 1; j <= 9; ++j)
			ans += count(i, j) * count(j, i);

	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
def main():
    H = int(input())
    W = int(input())
    N = int(input())
    cnt = 0
    while N > 0:
        if H > W:
            N -= H
            W -= 1
        else:
            N -= W
            H -= 1
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
long long int calc(long long int m, vector<int> &A){
  int n = A.size();
  for(int i = 0; i < n; ++i){
    m /= A[i];
    m *= A[i];
  }
  return m;
}

int main(){
  int K;
  cin >> K;
  vector<int> A(K);
  for(int i = 0; i < K; ++i) cin >> A[i];
  long long int INF = 100000000000000000, ok = -1, ng = INF;
  while(ng - ok > 1){
    long long int m = (ok + ng)/2;
    if(calc(m,A) >= 2) ng = m;
    else ok = m;
  }
  if(calc(ok+1,A) !=  2){
    cout << -1 << endl;
    return 0;
  }
  cout << ok + 1 << " ";
  ok = -1, ng = INF;
  while(ng - ok > 1){
    long long int m = (ok + ng)/2;
    if(calc(m,A) > 2) ng = m;
    else ok = m;
  }
  cout << ok << endl;
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;

int main() {
  int n; cin >> n;
  VVI f(n, VI(10));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 10; j++) cin >> f[i][j];
  }
  VVI p(n, VI(11));
  for (int i = 0; i < n; i++) {
    for (int c = 0; c <= 10; c++) cin >> p[i][c];
  }
  int ans = -1000000000;
  for (int x = 1; x < 1024; x++) {
    int price = 0;
    for (int i = 0; i < n; i++) {
      int c = 0;
      for (int j = 0; j < 10; j++) {
        int y = f[i][j];
        if (x & y << j) c++;
      }
      price += p[i][c];
    }
    ans = max(ans, price);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,s,count=0;
int digits[10];
void dfs(int cur,int start){
if(cur==n){
	int sum=0;
	for(int i=0;i<n;i++){
		sum+=digits[i];
	}
	if(sum==s){
		count++;
	}
	return;
}

for(int i=start;i<10;i++){
	digits[cur]=i;
    
	dfs(cur+1,i+1);
}
}

int main(void){
while(1){
scanf("%d %d",&n,&s);
if(n==0&&s==0){ 
    break;
    }
count=0;
dfs(0,0);
printf("%d\n",count);
}
return(0);
}


Measured memory_bytes: 2028
N, K = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)
MOD = 10**9 + 7

t1 = 0
0.upto(N-2) do |i|
  (i+1).upto(N-1) do |j|
    t1 += 1 if A[i] > A[j]
  end
end
t1 = (t1 * K) % MOD

t2 = 0
if K > 1
  ns = 0
  0.upto(N-1) do |i|
    ns += A.count {|a| a < A[i] }
  end
  t2 = ns * K * (K-1) / 2
end
puts (t1 + t2) % MOD


Measured memory_bytes: 3836
# AGC002A - Range Product
def main():
    a, b = tuple(map(int, input().rstrip().split()))
    if a <= 0 <= b:
        print("Zero")
    elif 0 < a:
        print("Positive")
    else:
        l = abs(a - b) + 1
        print("Positive" if l % 2 == 0 else "Negative")


if __name__ == "__main__":
    main()

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

int main()
{
	char X, Y;
	cin >> X >> Y;
	if (int(X) < int(Y))
	{
		cout << '<' << endl;
	}
	else if (int(X) > int(Y))
	{
		cout << '>' << endl;
	}
	else cout << '=' << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>
#include<limits.h>

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	char sakoda[3];
  scanf("%s",sakoda);
  if(strcmp(sakoda,"ABC") == 0) {
    printf("ARC");
  }
  else {
    printf("ABC");
  }
  
}
  
  

Measured memory_bytes: 1720
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct maps
{
   long long w;
   int v,vv;
}a[5];
bool cmp(maps a,maps b)
{
    return a.w<b.w;
}
int main()
{
    int i,j,w[5],v[5]={25,50,100,200},vv[5]={8,4,2,1};
    for(i=0;i<4;i++)
    {
        scanf("%lld",&a[i].w);
        a[i].w=a[i].w*vv[i];
        a[i].v=v[i];
        a[i].vv=vv[i];
    }
    long long s=0,n;
    sort(a,a+4,cmp);
    scanf("%lld",&n);
    n=n*100;
    for(i=0;i<4&&n>0;)
    {
        if(n>=a[i].v)
        {
            int xx=n/a[i].v;
            //printf("** %d\n",xx);
            s+=(a[i].w*xx)/a[i].vv;
            n%=a[i].v;
        }
        else
        {
            i++;
        }
    }
    printf("%lld\n",s);
	return 0;
}


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

void vprn(vector<int> v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",":"\n"); }

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

	vector<int> h(n+1);
	for(int i=0; i<n; i++){
		cin>>h[i+1];
	}
	h[0] = h[1];
	// vprn(h);

	vector<int> dp(n+1);
	for(int i=2; i<n+1; i++){
		dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
		// vprn(dp);
	}
	cout<< dp[n] <<endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int kagamimochi = int.Parse(Console.ReadLine());
            int[] mochiSize = new int[kagamimochi];
            for (int i = 0; i < kagamimochi; i++)
            {
                mochiSize[i] = int.Parse(Console.ReadLine());
            }

            Array.Sort(mochiSize);
            int difMochiSize = 1;
            int nowMochiSize = mochiSize[0];
            for (int i = 1; i < kagamimochi; i++)
            {
                if (nowMochiSize != mochiSize[i])
                {
                    difMochiSize++;
                }
                nowMochiSize = mochiSize[i];
            }

            Console.WriteLine(difMochiSize);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
typedef pair<int, int> P;
long long n,i,j,p,mx,q,k;
int m[300000],tx[300000];
vector<int> ky[300000];
int main(void)
{
	priority_queue<int> qu; //降順
	P p;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>m[i];
		for(j=0;j<m[i];j++){
			cin>>k;
			if(tx[i]<k) tx[i]=k;
			ky[i].push_back(k);
		}
	}
	for(i=0;i<n;i++) tx[i]=0;
	mx=0;
	for(i=n-1;i>=0;i--){
		for(j=0;j<ky[i].size();j++){
			qu.push(ky[i][j]);
		}
		q=qu.top();
		if(tx[i]<q){
			tx[i]=q;
			qu.pop();
		}
		mx+=tx[i];
	}
	cout<<mx<<endl;
	return 0;
}


Measured memory_bytes: 21860
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let n: usize = parse_line().unwrap();
    let mut a: Vec<isize> = parse_line().unwrap();
    a.insert(0, 0);
    a.push(0);

    let mut time = 0;
    for i in 0..(n + 1) {
        time += (a[i] - a[i + 1]).abs();
    }

    for i in 1..=n {
        println!(
            "{}",
            time - (a[i] - a[i - 1]).abs() - (a[i] - a[i + 1]).abs() + (a[i - 1] - a[i + 1]).abs()
        );
    }
}


Measured memory_bytes: 3540
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include <cfenv>
#include <cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    ll n;
    cin >> n;
    ll count = 0;
    ll change2=0;
    ll change = 0;
    bool flag = true;
    REP(i,s.length()-1){
         if(s[i]!=s[i+1]){
            flag = false;
        }
    }
    if(flag){
        cout << (long long)ceil((((double)s.length() * n)-1) /2) << endl;
        return 0;
    }
    REP(i,s.length()-1){
        if(s[i]==s[i+1]){
            count++;
        }else{
            change += (count+1)/2;
            count=0;
        }
    }
    change += (count+1)/2;
    count=0;
    string tmp = s+s;
    REP(i,tmp.length()-1){
        if(tmp[i]==tmp[i+1]){
            count++;
        }else{
            change2 += (count+1)/2;
            count=0;
        }
    }
    change2 += (count+1)/2;
    
    change2 -= 2*change;
    ll answer = change * n + change2 * (n-1);
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc178/tasks/abc178_f
#include <bits/stdc++.h>

using namespace std;

const int MAXN=2e5+4;
long long a[MAXN];
long long b[MAXN];

int main() {
    int n;
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>a[i];
    }
    for (int i=0; i<n; i++) {
        cin>>b[i];
    }

    reverse(b, b+n);

#if 0
    cout<<"\n";
    for (int i=0; i<n; i++) {
        cout<<a[i]<<" ";
    }
    cout<<"\n";
    for (int i=0; i<n; i++) {
        cout<<b[i]<<" ";
    }
    cout<<"\n";
#endif

    //寻找重合的区间
    int c=-1;
    int l=n;
    int r=-1;
#if 1
    for (int i=0; i<n; i++) {
        if (-1==c && a[i]==b[i]) {
            //第一次出现相等
            c=a[i];
            l=i;
            r=i;
        } else if (-1!=c && a[i]==b[i]) {
            //最后一次出现相等
            r=i;
        }
    }
    //cout<<l<<" "<<r<<"\n";
#else
    l=n;
    r=-1;
    for (int i=0; i<n; i++) {
        if (a[i]==b[i]) {
            c=a[i];
            break;
        }
    }
    for (int i=0; i<n; i++) {
        if (c==a[i] && c==b[i]) {
            l=min(l, i);
            r=max(r, i);
        }
    }
    cout<<l<<" "<<r<<"\n";
#endif

    //交换数据
    for (int i=0; i<n; i++) {
        if (c!=a[i] && c!=b[i] && l<=r) {
            swap(b[i], b[l]);
            l++;
        }
    }

    if (l<=r) {
        cout<<"No\n";
    } else {
        cout<<"Yes\n";
        for (int i=0; i<n; i++) {
            cout<<b[i]<<" ";
        }
    }

    return 0;
}

Measured memory_bytes: 6772
main :: IO ()
main = do
    [d,t,s] <- (map read . words) <$> getLine
    let ans = getAns d t s
    putStrLn ans
    
getAns :: Double -> Double -> Double -> String
getAns d t s = 
    if wariwari d s <= t
        then "Yes"
        else "No"

wariwari :: Double -> Double -> Double
wariwari d s = d/s

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

int main(){
    int n;cin>>n;
    int niz[n];
    for(auto&a:niz){
        cin>>a;
    }
    long long zbr=0;
    for(int i=0;i<n-1;i++){
        if(niz[i]>niz[i+1]){
            zbr+=niz[i]-niz[i+1];
            niz[i+1]=niz[i];
        }
    }
    cout << zbr<<endl;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n,m; cin >> n >> m;
    vl a(n);
    rep(i,n) cin >> a[i];
    ll sum = accumulate(all(a),0);
    double limit = sum * 1.0/ (4.0 * m);
    sort(all(a),greater<ll>());
    rep(i,m){
        if(a[i] < limit){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

int main() {

	double N, M;
	cin >> N >> M;

	double all = 0;
	vector<double>A(N);
	for (int i = 0; i < N;++i) {
		cin >> A[i];
		all += A[i];
	}

	double border = all / (4 * M);
	int count = 0;
	for (int i = 0; i < N; ++i) {
		if (border <= A[i])count++;
	}
	string ans = M <= count ? "Yes" : "No";
	cout << ans << endl;
}



Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var re = int.MaxValue;
        for (var j = 0; j < 2; j++)
        {
            var m = 0;
            var isW = j == 0;
            for (var i = 0; i < str.Length; i++)
            {
                if (isW && str[i] == 'B')
                {
                    isW = !isW;
                    m++;
                }
                else if (!isW && str[i] == 'W')
                {
                    isW = !isW;
                    m++;
                }
            }
            re = Min(re, m);
        }
        WriteLine(re);
    }

    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11232
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    var num = input.split('\n');
    var N = num[0];
    var A = num[1].split(' ');
    var count = 0;
    for (var i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            A[i] = A[i] / 2;
        } else {
            i = N;
        }
        if (i == N - 1) {
            count += 1;
            i = 0;
        }
    }
    console.log(count);     
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

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

int main() {
  int n;cin>>n;
  map<int,int> list;
  for (int i=0;i<n;i++) {
    int temp;
    cin >> temp;
    for (int j=temp-1;j<temp+2;j++) {
      if(list.count(j)) {
        list.at(j)++;
      }
      else {
        list[j]=1;
      }
    }
  }
  int count=0;
  for (auto p:list) {
    count = max(count,p.second);
  }
  cout << count << endl;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
 
#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;
const int N=505;
int n,m;
char a[N][N],b[N][N],s[N];
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,n) For(j,1,m) a[i][j]=b[i][j]='.';
	For(i,1,n) a[i][1]=b[i][m]='#';
	For(i,1,n) For(j,2,m-1)
		i&1?a[i][j]='#':b[i][j]='#';
	For(i,1,n){
		scanf("%s",s+1);
		For(j,1,m) if (s[j]=='#') a[i][j]=b[i][j]='#';
	}
	For(i,1,n) puts(a[i]+1); puts("");
	For(i,1,n) puts(b[i]+1);
}

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

using namespace std;
const int MAXN = 100005;

vector<int> G[MAXN];

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];
  vector<int> indices(n);
  iota(indices.begin(), indices.end(), 0);
  sort(indices.begin(), indices.end(), [&h](size_t i1, size_t i2) {
      return h[i1] > h[i2];
    });

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  vector<bool> used(n, false);

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int idx = indices[i];
    if (!used[idx]) {
      bool ok = true;
      for (int v: G[idx]) {
	if (h[idx] <= h[v]) {
	  ok = false;
	} else {
	  used[v] = true;
	}
      }
      if (ok) {
	ans++;
      }
      used[idx] = true;
    }
  }

  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 9244
#include <iostream>
using namespace std;
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i)
		if (s[i] == 'A' && s[i + 1] == 'C') {
			cout << "Yes";
			return 0;
		}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int N, Z, W;
int a[2010];
int mem[2010][2];


int solve(int p = 0, bool t = false, int x = Z, int y = W){
	if(p == N) return abs(x-y);
	if(mem[p][t]) return mem[p][t];
	int res = !t ? -INF : INF;
	rep(i, p, N)
		if(!t) chmax(res, solve(i+1, !t, a[i], y));
		else chmin(res, solve(i+1, !t, x, a[i]));
	return mem[p][t] = res;
}


signed main(){
	cin >> N >> Z >> W;
	rep(i, 0, N) cin >> a[i];

	if(N == 1) cout << abs(a[0]-W) << endl;
	else cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 384