akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF (1<<29)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define REP(i, n) FOR(i, 0, n)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
#define MX (1<<19)
#define MOD (1000000007)
ll pw(ll n,ll k){
    ll r(1);
    while(k){
        if(k&1)r*=n,r%=MOD;
        n*=n,n%=MOD;
        k>>=1;
    }
    return r;
}
int C[MX],A[MX],N;
int go(){
    F(N)++C[A[i]];
    if(N&1){
        F(N)if(A[i]&1)return 0;
        if(*C^1)return 0;
        FT(2,N)if(!(k&1)&&C[k]^2)return 0;
    }else{
        F(N)if(!(A[i]&1))return 0;
        FT(1,N)if(k&1&&C[k]^2)return 0;
    }
    return pw(2,N/2);
}
int main(void){
    scanf("%d",&N),ga(N,A),printf("%d\n",go());
    return 0;
}


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

using namespace std;

double rast(int x1,int y1,int x2,int y2)
{
    return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int main()
{

   // freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int k,x;
    cin >> k >> x;
    for (int i=x-k+1;i<=x;i++)
        cout << i << " ";
    for (int i=x+1;i<x+k;i++)
        cout << i << " ";

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=1e9+7;
#define INF 1e9+7
#define N 200001
#define MAX_V 400010
#define vec vector<int>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<ll,int,custom_hash>
struct pair_hash
{
    template<class T1,class T2>
    size_t operator() (const pair<T1,T2> &p)const{
        return hash<T1>()(p.first)^hash<T2>()(p.second);
    }
};

main(){
    string s;cin>>s;
    int m=1000000;
    rep(i,s.size()-2){
        int a=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        m=min(m,abs(a-753));
    }
    cout<<m;
}

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

using namespace std;

int main() {
  int d;
  string s;
  cin >> d >> s;
  for (auto &c : s) {
    c = (c - 'A' + d) % 26 + 'A';
  }
  cout << s << '\n';
  return 0;
}


Measured memory_bytes: 3608
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let mut x = 1;
    loop {
        if (x+1) * (x+1) > n {
            println!("{}", x*x);
            return;
        }
        x += 1;
    }
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

	int n, x, t;
	cin >> n >> x >> t;

	cout << (n + x - 1) / x * t << endl;
}


Measured memory_bytes: 3540
#![allow(non_snake_case, unused)]
use std::collections::*;

////////// missing functions in 1.15.1 //////////
macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}
/////////////////////////////////////////////////
pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

fn run() {
	let N = read!(usize);
	let hs = read!([i32]);
	let mut dp = vec![0; N];
	dp[1] = (hs[0] - hs[1]).abs();
	for i in 2..N {
		dp[i] = std::cmp::min(dp[i - 1] + (hs[i] - hs[i - 1]).abs(), dp[i - 2] + (hs[i] - hs[i - 2]).abs());
	}
	println!("{}", dp[N - 1]);
}


Measured memory_bytes: 8572
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 11000

int N, a, b, c;
int dp[3], t0, t1, t2;

signed main(){
	cout<<fixed<<setprecision(7);
	
	cin>>N;
	
	rep(i,N){
		cin>>a>>b>>c;
		t0 = max(dp[1]+a,dp[2]+a);
		t1 = max(dp[0]+b,dp[2]+b);
		t2 = max(dp[0]+c,dp[1]+c);
		dp[0] = t0, dp[1] = t1, dp[2] = t2;
	}
	
	cout<<max(max(dp[0],dp[1]),dp[2])<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using LL = long long;
const int INF = 1e9;

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

    LL a = max(0LL, A-K);
    LL b = max(0LL, B-(max(0LL, K-A)));
    cout << a << ' ' << b << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  int count=0;
  char a;
   for(int i=1;i<4;i++){
   if(s.at(0)==s.at(i)){
   count++;
     a=s.at(i);
   }
  }
  if(count==1){
  if(s.at(2)==s.at(3)){
  cout<<"Yes"<<endl;
    return 0;
  }
  if(s.at(1)==s.at(2)){
  cout<<"Yes"<<endl;
    return 0;
   }
  if(s.at(1)==s.at(3)){
  cout<<"Yes"<<endl;
   return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
 }

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long int llint;
llint dp[405][405],arr[405],n;
llint rek(int l,int r) {
	if(l==r) return 0;
	if(dp[l][r]!=-1) return dp[l][r];
	llint ret=1e18,mini=min(arr[l],arr[r]),sum1=0,sum2=0;
	for(int i=l;i<=r;i++) sum1+=arr[i];
	for(int i=l;i<r;i++) {
		sum2+=arr[i];
		ret=min(ret,(rek(l,i)+rek(i+1,r)+sum1));
	}
	dp[l][r]=ret;
	return ret;
}
int main()
{
	cin >> n;
	for(int i=0;i<n;i++) {
		cin >> arr[i];
	}
	memset(dp,-1,sizeof(dp));
	cout << rek(0,n-1);
	return 0;
}


Measured memory_bytes: 1536
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
//#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
     int n, m;
     cin >> n >> m;
     string s, t;
     cin >> s >> t;
     int g = __gcd(n, m);
     bool ok = true;
     for(int i = 0; i < g; i++){
	   if (s[i * n / g] != t[i * m / g]) ok = false;	 
	}
	if (!ok) cout << -1 << endl;
	else cout << lcm(n, m) << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 640
A, B, K = map(int, raw_input().replace("\n", "").split(" "))

def calc_ageru(jibun):
    if jibun % 2 == 1:
        ageru = (jibun-1) / 2
    else:
        ageru = jibun / 2
    return ageru, ageru

for i in xrange(K):
    if i % 2 == 0:
        A, ageru = calc_ageru(A)
        B += ageru
    else:
        B, ageru = calc_ageru(B)
        A += ageru
    #print "%i: %d %d" % (i, A, B)

print "%d %d" % (A, B)

Measured memory_bytes: 2568
#include <iostream>
#include <vector>

using namespace std;
using int64 = long long;
int main() {
    int64 a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100;
    b *= 100;

    vector<int64> water;
    for (int64 i=0; i*a<=f; i++) {
        int64 aw = i*a;
        for (int64 j=0; j*b<=f; j++) {
            water.push_back(aw + j*b);
        }
    }

    vector<int64> sugar;
    for (int64 i=0; i*c<=f; i++) {
        for (int64 j=0; j*d<=f; j++) {
            sugar.push_back(i*c + j*d);
        }
    }

    double con = 0;
    int64 water_ans = 0;
    int64 sugar_ans = 0;
    for (auto w : water) {
        for (auto s : sugar) {
            if (w + s > f) continue;
            if (w/(double)100*e < s) continue;
            double c = 100 * s / (double)(w+s);
            if (c + 1e-14 > con) {
                con = c;
                water_ans = w;
                sugar_ans = s;
            }
        }
    }

    cout << water_ans + sugar_ans << " " << sugar_ans << endl;
}

Measured memory_bytes: 5616
#pragma region Template
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

inline int sqr(int x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion

inline int pow5(int x) { return x * x * x * x * x; }

signed main()
{	
	int X;
	cin >> X;

	VI A5(10001), B5(20001);
	rep(a, 10001) {
		A5[a] = pow5(a);
	}
	rng(b, -10000, 10001) {
		B5[b + 10000] = pow5(b);
	}

	int a=0, b;
	rbf(a5, A5) {
		b = -10000;
		rbf(b5, B5) {
			if (X == a5 - b5) {
				cout << a << ' ' << b << endl;
				return 0;
			}
			b++;
		}
		a++;
	}

	return 0;
}

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

using namespace std;

int n;
int a[210000];

bool ok(int x) {
	if (x == 1) {
		for (int i = 1; i < n; i++)
			if (a[i + 1] <= a[i])
				return false;
		return true;
	}
	map <int, int> Map;
	for (int i = 1; i <= n; i++) {
		if (a[i] > a[i - 1]) {
			continue;
		}
		while (!Map.empty() && Map.rbegin()->first >= a[i])
			Map.erase(Map.rbegin()->first);
		int tmp = a[i] - 1;
		while (true) {
			int xx = 1;
			if (Map.count(tmp))
				xx = Map[tmp];
			if (xx + 1 <= x) {
				Map[tmp] = xx + 1;
				break;
			}else {
				if (Map.count(tmp))
					Map.erase(tmp);
			}
			tmp--;
			if (tmp < 0) {
				return false;
			}
		}
	}
	return true;
}

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

	int l = 0, r = 1e9, mid;
	while (l < r - 1) {
		mid = (l + r) / 2;
		if (ok(mid))
			r = mid;
		else
			l = mid;
	}
	printf("%d\n", r);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

const int inf = 1000000000;

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i, n) cin >> x.at(i);

  int L = x.at(0), R = x.at(0);
  rep(i, n) {
    L = min(L, x.at(i));
    R = max(R, x.at(i));
  }
  int ans = inf;

  for (int i = L; i <= R; i++) {
    int cost = 0;
    rep(j, n) cost += (x.at(j) - i) * (x.at(j) - i);
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,h[114514],dp[114514];cin>>N>>h[0]>>h[1];
	dp[0]=0,dp[1]=abs(h[0]-h[1]);
	for(int i=2;i<N;i++)
	{
		cin>>h[i];
		dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
	}
	cout<<dp[N-1]<<"\n";
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    string[] s = Console.ReadLine().Split(' ');
    int N = int.Parse(s[0]);
    int K = int.Parse(s[1]);
    List<int> T = new List<int>();
    for (int i = 0; i < N; i++) { T.Add(int.Parse(Console.ReadLine())); }
    T.Sort();
    List<int> D = new List<int>();
    for (int i = 0; i <= N - K; i++) { D.Add(T[i + K - 1] - T[i]); }
    D.Sort();
    Console.WriteLine(D[0].ToString());
  }
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    ans = (ans + A % 2) % 2;
  }
  if (ans) cout << "NO" << endl;
  else cout << "YES" << endl;
}

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

const int N = 2e5 + 5;
ll a[N];

int main() {
	int n, k;
	cin >> n >> k;
	ll sm = 0;
	for(int i=0; i<n; ++i) {
		cin >> a[i];
		sm += a[i];
	}
	sort(a, a+n, greater<ll>());
	if(k >= n) {
		cout << 0 << "\n";
		return 0;
	}
	cout << sm - accumulate(a, a+k, 0ll) << endl;
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;

int h;

int left(int i) {
  return (i * 2);
}
int right(int i) {
  return ((i * 2) + 1);
}


void maxh(int *a, int i){
//xs  cout << a[1] << endl;
  int largest = 0;
  int l = left(i);
  int r = right(i);

  if(l <= h && a[l] > a[i]) largest = l;
  else largest = i;

  if(r <= h && a[r] > a[largest]) largest = r;

  if(largest != i) {
    swap(a[largest],a[i]);
    maxh(a,largest);
  }



}
int main(){

  int a[500000] = {};
  cin >> h;

  for(int i = 1;i <= h;i++){
    cin >> a[i];
  }

  for(int i = (h/2); i >= 1;i--) maxh(a,i);

  for(int i = 1;i <=h;i++) cout <<" " << a[i];
  cout << endl;

}

Measured memory_bytes: 5012
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int iNum = Integer.parseInt(br.readLine());
    int sum = 0, n = 1;
    if (iNum % 2 == 0) {
      sum += iNum / 2;
      n = 2;
    }
    for (int i = iNum - n; i > 0; i -= 2) {
      sum += i;
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 21204
public class Main {
  private static void solve() {
    int n = ni();
    int[] a = na(n);
    
    int left = 0;
    int right = 0;
    int now = 0;
    long ret = 0;
    while (left < n) {
      
      while (right < n && (now & a[right]) == 0) {
        now |= a[right ++];
      }
      ret += right - left;
      
      now ^= now & a[left ++];
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




Measured memory_bytes: 43516
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define int long long
map<string, bool> sb;
map<string, bool> sa;
signed main(){
    int N;
    cin >> N;
    map<string, int> s;
    string S[200020];
    for(int i = 0;i < N;i++){
        cin >> S[i];
        s[S[i]]++;
    }
    int max = 0;
    for(int i = 0;i < N;i++){
        if(sb[S[i]] == false){
            if(s[S[i]] > max)max = s[S[i]];
            sb[S[i]] = true;
        }
    }
    sort(S, S+N);
     for(int i = 0;i < N;i++){
        if(sa[S[i]] == false){
            if(s[S[i]] == max)cout << S[i] << endl;
            sa[S[i]] = true;
        }
    }
}

Measured memory_bytes: 51712
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    int MAX = 0;
    int sum = 0;
    rep(i, N) {
        MAX = max(L[i], MAX);
        sum += L[i];
    }
    sum -= MAX;
    if (MAX < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  long a[7],b,ans=0;
  for(int i=0;i<7;i++)
    scanf("%ld",&a[i]);
  ans+=a[1];
  ans+=a[0]/2*2;
  ans+=(a[3]/2+a[4]/2)*2;
  if(a[0]&&a[3]&&a[4]){
    b=a[1];
    b+=(a[0]-1)/2*2;
    b+=((a[3]-1)/2+(a[4]-1)/2)*2;
    b+=3;
    ans=max(ans,b);
  }
  printf("%ld\n",ans);
}

Measured memory_bytes: 128
S=input()
T=input()
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
A=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
count=0
for i in range(len(S)):
    if S[i] in a:
        S=S.replace(S[i],A[count])
        count+=1
        
cnt=0
for j in range(len(T)):
    if T[j] in a:
        T=T.replace(T[j],A[cnt])
        cnt+=1

if S==T:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pi pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,a,b) for(int i = a ; i <= b;i++)
using namespace std;
void debug(int x){
    cerr<<x<<endl;
}
void debug(vector<int> v){
    for(int i = 0 ; i<v.size(); i++) cerr<<v[i]<<" ";
    cerr<<"\n";
}
void debug(int *A, int N){
    for(int i = 0 ; i < N;i++) cerr<<A[i]<<" ";
    cerr<<endl;
}
void debug(int *A, int i, int j){
    for(int k = i;k<=j;k++) cerr<<A[k]<<" ";
    cerr<<endl;
}
void scan(vector<int> &h,int N){
    for(int i = 0 ; i < N;i++){
        scanf("%d",&h[i]);
    }
}
int dp[100005];
int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    vector<int> h(N);
    scan(h,N);
    rep(i,0,N){
        dp[i] = INT_MAX;
    }
   // debug(h);
    dp[1] = 0; //initializing solution for 0
    rep(i,1,N){
         //for any i
     //    cout<<"cases for i = "<<i<<endl;
         rep(j,1,K){
             //run j from i to K
             if(i+j <=N) {
       //         cerr<<"udpating "<<(i+j)<<" to ";
                 dp[i+j] = min(dp[i+j],abs(h[i+j-1] - h[i-1]) + dp[i]);
         //        cerr<<dp[i+j]<<"\n";
             }
         }
 //        cerr<<"\n";
    }
    // debug(dp,1,N);
    cout<<dp[N]<<"\n";
}

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

string str;
int judge(int ch1, int ch2, int ch3){
	if(str[ch1]==str[ch2] &&str[ch2]==str[ch3]){
			if(str[ch1]=='o'){
				return 1;
			}else if(str[ch1]=='x'){
				return 2;
			}else{
				return 0;
			}
	}
	return 0;
}

int main(){
	int ans;
	while(cin>>str){
		do{
			if((ans = judge(0,1,2))!=0)break;
			if((ans = judge(3,4,5))!=0)break;
			if((ans = judge(6,7,8))!=0)break;
			if((ans = judge(0,3,6))!=0)break;
			if((ans = judge(1,4,7))!=0)break;
			if((ans = judge(2,5,8))!=0)break;
			if((ans = judge(0,4,8))!=0)break;
			if((ans = judge(2,4,6))!=0)break;
		}while(0);
		if(ans==1){
			cout<<"o\n";
		}else if(ans==2){
			cout<<"x\n";
		}else{
			cout<<"d\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define MAX 1003
int size[MAX];
int root (int Arr[ ] ,int i)
{
    while(Arr[ i ] != i)
    {
        Arr[ i ] = Arr[ Arr[ i ] ] ; 
		i = Arr[ i ]; 
    }
	return i;
}
void initialize( int Arr[ ],int size[],int N)
{
    for(int i = 0;i<N;i++)
    {
		Arr[ i ] = i ;
		size[ i ] = 1;
	}
}
void weighted_union(int Arr[ ],int size[ ],int A,int B)		
{
    int root_A = root(Arr,A);	
	/*modified union function where we connect the elements by changing the root of one of the element */
    int root_B = root(Arr,B);
    if(size[root_A] < size[root_B ])
    {
		Arr[ root_A ] = Arr[root_B];
		size[root_B] += size[root_A];
	}
    else
    {
		Arr[ root_B ] = Arr[root_A];
		size[root_A] += size[root_B];
	}
}
bool find(int Arr[],int A,int B)
{
    if( root(Arr,A)==root(Arr,B) )       //if A and B have same root,means they are connected.
    return true;
    else
    return false;
}
int main(){
	int n,q;
	cin>>n>>q;
	int a[n],s[n];
	initialize(a,s,n);
	while(q--){
		int l,u,v;
		cin>>l>>u>>v;
		if(l==0){
			weighted_union(a,s,u,v);
		}
		else{
			cout<<find(a,u,v)<<endl;
		}
	}
}

Measured memory_bytes: 5040
n=int(input())
d=[]
for i in range(n):
    a,b=map(int,input().split())
    d.append((b,a))
d.sort()
chk=0
for i in d:
    chk+=i[1]
    if chk>i[0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 67160
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, K, a[4009][4009], b[4009][4009], x, y; string s;
int sa(int lx, int ly, int rx, int ry) { return a[rx][ry] + a[lx][ly] - a[rx][ly] - a[lx][ry]; }
int sb(int lx, int ly, int rx, int ry) { return b[rx][ry] + b[lx][ly] - b[rx][ly] - b[lx][ry]; }
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> x >> y >> s; x %= 2 * K; y %= 2 * K; x++, y++;
		if (s == "W") a[x][y]++, a[x + 2 * K][y]++, a[x][y + 2 * K]++, a[x + 2 * K][y + 2 * K]++;
		if (s == "B") b[x][y]++, b[x + 2 * K][y]++, b[x][y + 2 * K]++, b[x + 2 * K][y + 2 * K]++;
	}
	for (int i = 0; i <= 4 * K; i++) {
		for (int j = 1; j <= 4 * K; j++) {
			a[i][j] += a[i][j - 1];
			b[i][j] += b[i][j - 1];
		}
	}
	for (int i = 1; i <= 4 * K; i++) {
		for (int j = 0; j <= 4 * K; j++) {
			a[i][j] += a[i - 1][j];
			b[i][j] += b[i - 1][j];
		}
	}
	int ret = 0;
	for (int i = 0; i < 2 * K; i++) {
		for (int j = 0; j < 2 * K; j++) {
			ret = max(ret, sa(i, j, i + K, j + K) + sa(i + K, j + K, i + 2 * K, j + 2 * K) + sb(i, j + K, i + K, j + 2 * K) + sb(i + K, j, i + 2 * K, j + K));
		}
	}
	cout << ret << '\n';
	return 0;
}

Measured memory_bytes: 125696
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	n := readInt()
	c := []byte(readString())

	ans := 0
	l, r := 0, n-1
	for {
		for l < r && c[l] != 'W' {
			l++
		}
		for l < r && c[r] != 'R' {
			r--
		}
		if l >= r {
			break
		}
		c[l], c[r] = c[r], c[l]
		ans++
	}

	fmt.Println(ans)
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 2648
n, k = map(int, input().split())
p = list(map(int, input().split()))

list_buy = []

for i in range(k):
    min = 1001
    for j in range(n):
        if p[j] < min:
            min = p[j]
            ind = j
    list_buy.append(min)
    p[ind] = 1000

print(sum(list_buy))


Measured memory_bytes: 9144
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;;
import java.util.stream.Stream;
public class Main {
  public static void main (String args[]) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int inpLen = Integer.parseInt(br.readLine());
    String[] inpArr = br.readLine().split(" ");
    int[]  disInpArr= Stream.of(inpArr).distinct().mapToInt(Integer::parseInt).toArray();
    if(inpLen == disInpArr.length){
      System.out.print("YES");
    }else{
      System.out.print("NO");
    }
  }
}

Measured memory_bytes: 62180
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
  vector<int> v;
  int n, d;
  
  scanf("%d", &n);
  for (int i=0; i<n; i++){
    int t;
    scanf("%d", &t);
    v.push_back(t);
  }
  sort(v.begin(), v.end());
  d = 0;
  for (int i=0; i<n; i++){
    d += v[i] * (i%2?1:-1);
  }
  printf("%d\n", d<0?-d:d);
  return 0;
}

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

#define ll long long
#define pb push_back
#define pii pair<ll, ll>
#define sz size()

// make sure :
// 1. pii is set to <ll, ll> 
// 2. n = 1 is taken care of
vector<pii> factorize(ll n) 
{
	vector<pii> ret;
	int count = 0;
	while(n % 2LL == 0)
	{ 
		n /= 2LL;
		count++; 
	}

	if(count) ret.pb({2, count});

	for(ll i=3;i*i<=n;i+=2)
	{ 
		count = 0; 
		while(n % i == 0)
		{ 
			count++; 
			n /= i; 
		}
		
		if(count) ret.pb({i, count});
	}
	if(n > 2) ret.pb({n, 1});
	return ret;
}

int main()
{
	ios::sync_with_stdio(0);
	int i, j, k;

	ll n;
	cin >> n;

	if(n == 1)
	{
		cout << '0';
		return 0;
	}

	vector<pii> fac = factorize(n);

	ll ans = 0;
	for(auto x : fac)
	{
		int l = 1, r = 42, bs;
		while(l <= r)
		{
			int mid = (l + r) >> 1;
			if(mid * (mid + 1) / 2 <= x.second)
				bs = mid, l = mid + 1;
			else
				r = mid - 1;
		}

		ans += bs;
	}

	cout << ans << "\n";

	return 0;
}

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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;
  int l[N];
  for (int i = 0; i < N; i++) cin >> l[i];

  sort(l, l + N);
  int sum = accumulate(l, l + (N - 1), 0);

  cout << (l[N-1] < sum ? "Yes" : "No") << endl;
  return 0;
}



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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
int main(){
    int n,m;cin>>n>>m;
    //回数の期待値2^m
    ll e=1<<m;
    cout<<e*(100*(n-m)+1900*m)<<endl;
}


Measured memory_bytes: 256
def main():
    n, m, x = map(int, input().split())
    a_list = list(map(int, input().split()))
    cnt = 0

    for a in a_list:
        if a < x:
            cnt += 1
        if x < a:
            break

    print(min(cnt, m - cnt))


if __name__ == "__main__":
    main()


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

using namespace std;

bool used[8];
int roads[201][201];
int visitTowns[8];
int minDist=1<<29;

void gen(int (&soFar)[8], int depth, int n)
{
    //generate all permutations
    if (depth == n)
    {
        //calculate distance
        int dist=0;
        for (int i = 0; i < n-1; i++)
        {
            dist += roads[visitTowns[soFar[i]]][visitTowns[soFar[i+1]]];
        }
        minDist = min(minDist, dist);
    } else
    {
        for (int i = 0; i < n; i++)
        {
            if (!used[i])
            {
                soFar[depth] = i;
                used[i]=true;
                gen(soFar, depth+1, n);
                used[i] = false;
            }
        }
    }
}

int main()
{
    for (int i = 0; i < 8; i++)
    {
        used[i] = false;
    }

    int towns, numRoads, n;
    cin >> towns >> numRoads >> n;

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

    for (int i = 1; i <= 200; i++)
    {
        for (int j = 1; j <= 200; j++)
        {
            if (i == j)
            {
                roads[i][j] = 0;
            } else
            {
                roads[i][j] = 1<<29;
            }
        }
    }

    for (int i = 0; i < numRoads; i++)
    {
        int from, to, dist;
        cin >> from >> to >> dist;
        //if (roads[from][to] > dist)
        //{
            roads[from][to] = dist;
            roads[to][from] = dist;
        //}
    }

    //floyd-warshall
    for (int k = 1; k <= towns; k++)
    {
        for (int i = 1; i <= towns; i++)
        {
            for (int j = 1; j <= towns; j++)
            {
                roads[i][j] = min(roads[i][j], roads[i][k]+roads[k][j]);
            }
        }
    }

    /*for (int i = 1; i <= towns; i++)
    {
        for (int j = 1; j <= towns; j++)
        {
            cout << roads[i][j] << " ";
        }
        cout << endl;
    }*/

    int x[8];
    gen(x, 0, n);

    cout << minDist << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
 
 public class Main
{
  public static void main(String []args)
  {
    Scanner sc = new Scanner(System.in);
      int l = sc.nextInt();
    int r = sc.nextInt();
    int d = sc.nextInt();
    System.out.println(r/d - (l-1)/d);
  }
}

Measured memory_bytes: 35608
package main

import "fmt"

func MakeMatrix(w int, h int) [][]int {
	r := make([][]int, w)
	for x := 0; x < w; x++ {
		r[x] = make([]int, h)
	}
	return r
}

func Solve(N int, K int, X []int, Y []int, C []byte) int {
	K2 := K * 2
	m := MakeMatrix(K*3, K*3)
	for i := 0; i < N; i++ {
		x, y := X[i], Y[i]
		if C[i] == 'W' {
			y += K
		}
		x1, y1 := x%K2, y%K2
		x2, y2 := x1+K, y1+K
		m[x1][y1]++
		m[x2][y2]++
		m[x1][y2]--
		m[x2][y1]--
		x1, y1 = (x+K)%K2, (y+K)%K2
		x2, y2 = x1+K, y1+K
		m[x1][y1]++
		m[x2][y2]++
		m[x1][y2]--
		m[x2][y1]--
	}

	ms := MakeMatrix(K2, K2)
	for y := 0; y < K2; y++ {
		for x := 0; x < K2; x++ {
			c := m[x][y]
			if x > 0 {
				c += ms[x-1][y]
			}
			if y > 0 {
				c += ms[x][y-1]
			}
			if x > 0 && y > 0 {
				c -= ms[x-1][y-1]
			}
			ms[x][y] = c
		}
	}

	rmax := 0
	for y := K; y < K2; y++ {
		for x := K; x < K2; x++ {
			r := ms[x][y]
			if rmax < r {
				rmax = r
			}
			if rmax < N-r {
				rmax = N - r
			}
		}
	}

	return rmax
}

func main() {
	var N int
	var K int
	fmt.Scanf("%d %d\n", &N, &K)
	X := make([]int, N)
	Y := make([]int, N)
	C := make([]byte, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d %c\n", &X[i], &Y[i], &C[i])
	}
	fmt.Println(Solve(N, K, X, Y, C))
}


Measured memory_bytes: 110336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
vector<int> graph[100000],tpa;
int ptr;


void dfs(int u,bool *vis)
{
    if(vis[u])
        return;
    vis[u]=true;
    for(auto v:graph[u]){
        if(!vis[v]){
            dfs(v,vis);
        }
    }
    tpa[ptr]=u;
    ptr--;
}

void top_sort(int n)
{
    bool vis[n]={false};
    ptr=n-1;
    tpa.resize(n);
    for(int i=0;i<n;i++){
        if(!vis[i]){
            dfs(i,vis);
        }
    }
}


int main(){

    int n,m;
    cin>>n>>m;
    while(m--){
        int u,v;
        cin>>u>>v;
        u--;
        v--;
        graph[u].push_back(v);
    }
    top_sort(n);
    vector<int> dis(n);
    for(int u=0;u<n;u++){
        for(int v:graph[tpa[u]]){
            dis[v]=max(dis[v],1+dis[tpa[u]]);
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,dis[i]);
    }
    cout<<ans;




return 0;
}


Measured memory_bytes: 11560
//
// Created by 绔ユ闃?on 2018/9/14.
//
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 200010;
const ll MOD = 1000000007;
int h, w, a, b;
ll fac[N], inv[N];
void init() { //棰勫鐞嗛樁涔樺拰闃朵箻鐨勯€嗗厓
    fac[0] = inv[0] = 1;
    for (int i = 1; i < N; i++) {
        fac[i] = fac[i-1] * i %MOD;
    }
    inv[1] = 1;
    for (int i = 2; i < N; i++) {
        inv[i] = 1ll * (MOD - MOD/i) * inv[MOD%i] %MOD;
    }
    for (int i = 1; i < N; i++) {
        inv[i] = inv[i-1] * inv[i] %MOD;
    }
}
inline ll C(int n, int k) { //璁＄畻缁勫悎鏁癈(n,k)=n! / (k! * (n-k)!)
    return fac[n] * inv[k] %MOD * inv[n-k] %MOD;
}
int main() {
    init();
    cin >> h >> w >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= h-a; i++) {
        ans += 1ll * C(i+b-2, i-1) * C(h-i+w-b-1, h-i) %MOD;
        ans %= MOD;
    }
    cout << ans;
    return 0;
}


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

int main() {
  int N;
  cin>>N;
  for(int i=1;i<=9;i++){
    if(N % i == 0 && N/i <= 9){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
void print_missing_card(int c[], char mark) //無いカードを表示
{
    for (int i = 0; i < 13; i++)
    {
        if (c[i] == 0)
        {
            printf("%c %d\n", mark, i + 1);
        }
    }
}
void substitution_exist_card(int c[], int n) //入力したカードに１を代入する関数
{
    c[n - 1] = 1;
}
int main(void)
{
    int num; //全カードの枚数
    int c[4][13] = {0};
    char m; //カードのマーク
    int n;  //カードの数字

    scanf("%d", &num); //手元にあるカードの枚数を入力

    for (int i = 0; i < num; i++) //全カードの枚数の数だけ入力を繰り返す
    {
        scanf("%c", &m);        //改行を読み込む
        scanf("%c %d", &m, &n); //カードのマークと数字を読み込む

        switch (m)
        { //入力したカードに１を代入
        case 'S':
            substitution_exist_card(c[0], n);
            break;
        case 'H':
            substitution_exist_card(c[1], n);
            break;
        case 'C':
            substitution_exist_card(c[2], n);
            break;
        case 'D':
            substitution_exist_card(c[3], n);
            break;
        }
    }

    print_missing_card(c[0], 'S');
    print_missing_card(c[1], 'H');
    print_missing_card(c[2], 'C');
    print_missing_card(c[3], 'D');

    return 0;
}


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


int main(){
    int r;
    cin >> r;
    int ans = 0;
    ans = 3*r*r;
    cout << ans <<endl;
    
    return 0;
}
















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define VMAX 100000
#define MAXLOOP 200000000
void solve(long long N, long long W, vector<long long> w, vector<long long> p){
  long long vmax = (MAXLOOP/N)/15;
  vector<vector<long long>> dp(N, vector<long long>(vmax+1, LLONG_MAX));
  dp[0][0] = 0;
  dp[0][p[0]] = w[0];

  for(long long i = 1; i < N; i++) {
    for(long long j = 0; j <= vmax; j++) {
      long long source = j - p[i];
      if(source < 0 || dp[i-1][source] == LLONG_MAX) {
        dp[i][j] = dp[i-1][j];
        continue;
      }

      dp[i][j] = min(dp[i-1][j], dp[i-1][source] + w[i]);
    }
  }


  #ifdef DEBUG
  for(long long i = 0; i < N; i++) {
    for(long long j = 0; j <= VMAX; j++) {
      if(dp[i][j] != LLONG_MAX) {
        cout << "[" << i << "][" << j << "]=" << dp[i][j] << " ";
      }
    }

    cout << endl;
  }
  #endif

  for(long long j = vmax; j >= 0; j--) {
    if(dp[N-1][j] <= W) {
      cout << j << endl;
      break;
    }
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long W;
  scanf("%lld",&W);
  vector<long long> ws;
  vector<long long> ps;
  long long w, p;
  for(int i = 0 ; i < N ; i++){
    cin >> w >> p;
    ws.push_back(w);
    ps.push_back(p);
  }
    solve(N, W, std::move(ws), std::move(ps));
    return 0;
}


Measured memory_bytes: 208512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		
		for(int i=0;i<n;i++) {
			
			System.out.print("ACL");
		}
		sc.close();
		}
	}

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

int main(){
    int N;
    cin >> N;
    vector<pair<int,int>> A(N);
    rep(i,N){
        cin >> A.at(i).first;
        A.at(i).second = i+1;
    }

    sort(A.begin(), A.end());

    rep(i,N)
        cout << A.at(i).second << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 1536
//14, 07, 2018, 09:16:22 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;

typedef unsigned long long ull;
int n;
const int N = 110;
int dp[N], used[N];
int a[N];

int solve(int i){
    if(i >= n - 1){
        return 0;
    }

    if(used[i]){
        return dp[i];
    }

    used[i] = 1;

    if(a[i] == a[i + 1]){
        return dp[i] = min(1 + solve(i + 1), 1 + solve(i + 2));
    }else{
        return dp[i] = solve(i + 1);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n;

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

    cout << solve(0) << endl;

    return 0;
}

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

int main(void)
{
    string x;
    cin>>x;
    int a[27];
    memset(a,0,sizeof(a));
    for(int i=0;i<x.length();i++)
    {
        a[x[i]-'a']++;
    }
    for(int i=0;i<27;i++)
    {
        if(a[i]%2==1)
        {
            cout <<"No"<<endl;
            return 0;
        }
    }
    cout <<"Yes"<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int main(){
  int f[45];
  f[0]=f[1]=1;
  r(i,2,45)f[i]=f[i-1]+f[i-2];
  int a;cin>>a;
  cout<<f[a]<<endl;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define fto(i, x, y) for (int i=(x); i <= (y); ++i)
#define fdto(i, x, y) for (int i=(x); i >= (y); --i)
#define forit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define forrit(it, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)
#define pb push_back
#define mp make_pair
#define ii pair<int, int>
#define vi vector<int>
#define fi first
#define se second
#define ll long long
#define oo 1000000007
#define maxN 100005

const double pi = acos(-1);

using namespace std;

int pos = -1;
bool ok;
string s, t;

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    fto(i, 0, n-1){
        if (s[i] == t[0] || s[i] == '?'){
            ok = true;
            fto(j, 1, m-1){
                if (s[i+j] == t[j] || s[i+j] == '?') continue;
                ok = false;
            }
            if (ok) pos = i;
        }
    }
    if (pos == -1){
        puts("UNRESTORABLE");
        return 0;
    }
    fto(j, 0, m-1){
        s[pos+j] = t[j];
    }
    fto(i, 0, n-1) if (s[i] == '?') s[i] = 'a';
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    using ll = long long;
    using P = pair<int,int>;
    
    
    int main() {
   
     int n;
     string s;
     cin >> n >> s;
     ll r = 0;
     ll g = 0;
     ll b = 0;
     
     rep(i,n){
     	if(s[i]=='R') r++;
     	else if(s[i]=='G') g++;
     	else          b++;
     }
     
     
     ll sum = r*g*b;
     
     ll sub = 0;
     
     for(int i = 0; i < n; i++){
     	for(int j = i+1; j < n; j++){
     		if(s[i]==s[j])	continue;
     		int k = 2*j - i;
     		if(k>=n ||s[k]==s[j] || s[k] == s[i])	continue;
     		else	sub++;
        }
     }
    
      cout << sum - sub << '\n';
     
     return 0;
    }

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

void solv() {
    int N;
    cin >> N;
    int vari = 0;
    cout << pow(N, 3) << endl;
}

int main() {
    solv();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse
const int MAX = 1000010;
// const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// int main() {
//     // 前処理
//     COMinit();

//     // 計算例
//     cout << COM(100000, 50000) << endl;
// }

map<ll,ll> ma;
ll a[200010];

int main () {

    int n;cin>>n;

    rep(i,n) {
        ll b;cin>>b;
        a[i]=b;
        if (!ma.count(b)) {
            ma[b]=1;
        } else {
            ma[b]++;
        }
    }
    // COMinit();

    ll sum=0;
    for(auto it = ma.begin();it!=ma.end();it++) {
        sum+=(it->second)*(it->second - 1)/2;
    }

    rep(i,n) {
        cout<<sum-(ma[a[i]]-1)<<endl;
    }

}

Measured memory_bytes: 11008