akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <iostream>
//#include <fstream>
//#include <algorithm>
//#include <bitset>
//#include <cassert>
//#include <cctype>
//#include <cstdlib>
//#include <cmath>
//#include <complex>
//#include <cstdio>
//#include <cstring>
//#include <ctime>
//#include <deque>
//#include <iomanip>
//#include <map>
//#include <numeric>
//#include <queue>
//#include <set>
//#include <stack>
//#include <sstream>
//#include <string>
//#include <vector>
//#include <list>

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
ll n;
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n;
	cout<<(n*(n-1)/2);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#define endl "\n"
#define ll long long
using namespace std;

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;

    ll ans;
    if(n < b)
    	ans = (a * n) / b - a * (n / b);
    else
    	ans = (a * (b - 1)) / b - a * ((b - 1) / b);
    cout << ans << endl;
}

Measured memory_bytes: 3636
#define ll long long int
#include <bits/stdc++.h>
//#include <fstream>
using namespace std;
 
#define         ff               first
#define         ss               second
#define         mp               make_pair
#define         pb               push_back
#define         pf               push_front
#define         vi               vector<ll>
#define         pii              pair<ll,ll>
#define         qi               queue<ll>
#define         mem(a,b)         memset(a,b,sizeof(a))
#define         print(a)         cout<<a<<'\n'
#define         sorted(arr)      sort(arr.begin(),arr.end())
#define         gcd(a,b)         gcd((a),(b))
#define         lcm(a,b)         ((a)*(b))/gcd((a),(b))
#define         all(v)           v.begin(),v.end()
#define         read(a)          scanf("%d", &a)
#define         f(a,n)           for(ll i=a;i<n;i++)
#define         in2(n,m,arr)     for(ll i=0;i<n;i++){for(ll j=0;j<m;j++)cin>>arr[i][j];}
#define         debug(a)         cerr<<a<<" ";
#define         debug1(a)        cerr<<a<<'\n'
 
/*typedef tree<int, null_type, less<int>, rb_tree_tag , tree_order_statistics_node_update> Set;*/
 
 
const unsigned ll mod = 1e9 + 7 ;
const ll inf = (ll)1e18 + 2;
const ll N = (ll)1e5 + 2;
//
//template<typename... T>
//void write(T&... args)
//{
//    ((cout << args << ' '), ...);
//}
//ll power ( ll x , ll y)
//{
//    ll res = 1;
//    while (y > 0)
//    {
//        if (y & 1)
//            res = (res * x) ;
//        y = y >> 1;
//        x = (x * x) ;
//    }
//    return res  ;
//}
//
//struct node{
//    ll x , y , z;
//};
//map<pair<ll, ll>,ll> c;
//vector<set<ll>> tree;
//vector<ll> ar ;
//set<ll> s;
//ll get(ll x)
//{
//    if(x == ar[x])
//        return x;
//    return ar[x] = get(ar[x]);
//}
//void merge(ll a ,ll b)
//{
//    a = get(a);
//    b = get(b);
//    if(a == b)
//    {
//        return ;
//    }
//    ar[b] = ar[a];
// }
//
//ll sev[100006];
//vector<ll> pri;
//void seive()
//{
//    for(ll i = 2 ; i < 100006 ; i ++)
//    {
//        if(!sev[i])
//        {
//            for(ll j = i ; j < 100006 ; j += i)
//            {
//                if(!sev[j])
//                    sev[j] = i;
//            }
//        }
//        if(sev[i] == i)
//            pri.pb(i);
//    }
//}

void solve()
{
    ll n , di;
    cin >> n >> di;
    cout << di + 100 * (((10 - n) < 0) ? 0 : 10 - n) << '\n';
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t ;
    t = 1;
    //cin >> t;
    //seive();
    while(t --)
    {
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}
 


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

 

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n), b(n), c(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) cin>>c[i];
  
  vsort(a); vsort(b); vsort(c);
  
  ll ans=0;
  rep(i,n){
    ll ac=lower_bound(all(a), b[i])-a.begin();
    ll cc=c.end()-upper_bound(all(c), b[i]);
    // cout<<ac<<' '<<cc<<endl;
    if(ac>0 && cc>0) ans+=ac*cc;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5576
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N=200005;
int n;
struct Node{
	int a,b;
}x[N];
bool pd(){
	for (int i=1;i<=n;i++)
		if (x[i].a!=x[i].b)
			return 0;
	return 1;
}
int main(){
	LL tot=0;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d%d",&x[i].a,&x[i].b);
		tot+=x[i].a;
	}
	if (pd()){
		printf("0");
		return 0;
	}
	int ans=2e9;
	for (int i=1;i<=n;i++)
		if (x[i].a>x[i].b)
			ans=min(ans,x[i].b);
	printf("%lld",tot-ans);
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
	long long int k,n,sum=0,now,temp,a1,max=0;
	scanf("%lld %lld",&k,&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&now);
		if(i==0){
			a1=now;
			temp=now;
		}
		sum+=now-temp;
		max=max>(now-temp)?max:(now-temp);
		temp=now;
	}
	sum+=a1+k-now;
	max=max>(a1+k-now)?max:(a1+k-now);
	printf("%lld",sum-max);
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  long X;
  int flag=1;
  cin>>X;
  long count=X;
  while(1){
    if(count==2 || count==3){
      cout<<count;
      return 0;
    }
    if(count%2==0){
      count++;
      continue;
    }
    for(long i=3;i<=count/3;i+=2){
      if(count%i==0){
        flag=0;
        break;
      }
    }
    if(flag==0){
      count+=2;
      flag=1;
    }else{
      break;
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

int main() {

    LL N, M;
    cin >> N >> M;

    vector<LL> X(M);
    for (int i = 0; i < M; i++) cin >> X[i];

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

    vector<LL> diff(M - 1);
    for (int i = 0; i < M - 1; i++) diff[i] = X[i + 1] - X[i];

    sort(diff.begin(), diff.end());
    LL ans = 0;

    for (int i = 0; i < max(0LL, M - N); i++) ans += diff[i];

    cout << ans << endl;

    return 0;
}





























Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::str::FromStr;

// strange-bank.rs --- Strange Bank
// author: Seong Yong-ju <sei40kr@gmail.com>

#[allow(unused_macros)]
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      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<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
        .map(|t| t.parse::<$t>().unwrap())
        .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Failed to parse token")
}

#[allow(dead_code)]
fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer);
}

fn main() {
    let n = get!(u32);

    let res = (0..n + 1)
        .map(|i| {
            let mut t = i;
            let mut cc = 0;
            while 0 < t {
                cc += t % 6;
                t /= 6;
            }

            t = n - i;
            while 0 < t {
                cc += t % 9;
                t /= 9;
            }

            cc
        })
        .fold(<u32>::max_value(), |res, cc| min(res, cc));

    with_bufwriter(|mut out| writeln!(out, "{}", res).unwrap());
}


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

constexpr int lim = 2000;
ll n, a[lim+1], memo[2][lim+1];

/*
  turn := 手番(X->0, Y->1)
  i := 相手が何番目のカードを持っているか
*/
ll dfs(int id, int turn, int x, int y){ 
  if(n == id) return memo[turn][id] = abs(x-y);

  if(memo[turn][id] >= 0) return memo[turn][id];

  if(turn == 0){
    ll ret = 0;
    for(int i=id; i<n; i++){
      ret = max(ret, dfs(i+1, 1, a[i], y));
    }

    return memo[turn][id] = ret;
  }
  else{
    ll ret = LLONG_MAX;
    for(int i=id; i<n; i++){
      ret = min(ret, dfs(i+1, 0, x, a[i]));
    }

    return memo[turn][id] = ret;
  }
}

int main(){
  ll z, w;
  cin >> n >> z >> w;
  for(int i=0; i<n; i++) cin >> a[i];
  
  memset(memo, -1, sizeof(memo));

  cout << dfs(0, 0, z, w) << endl;
  
  return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int n, m;
int a[5005], b[5005][205][13];
int lg[5005];
ll sum[5005];
ll ans = 0;

ll query(int l, int r){
    ll ans = 0;
    for(int j=1;j<=m;j++){
        ans += max(b[l][j][lg[r-l+1]], b[r-(1<<lg[r-l+1])+1][j][lg[r-l+1]]);
    }
    return ans;
}
void dfs(int s, int e, int optl, int optr){
    if(s > e) return;
    int mid = (s+e)/2;
    ll res = -1e18, opt = mid;
    for(int i=max(mid, optl);i<=max(mid, optr);i++){
        ll tmp = query(mid, i);
        if(res < tmp - (sum[i] - sum[mid])){
            res = tmp - (sum[i] - sum[mid]);
            opt = i;
        }
    }
    ans = max(ans, res);
    dfs(s, mid-1, optl, opt);
    dfs(mid+1, e, opt, optr);
}
int main(){
    scanf("%d%d", &n, &m);
    for(int i=2;i<=n;i++){
        scanf("%d", &a[i]);
        sum[i] = sum[i-1] + a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d", &b[i][j][0]);
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=0;j<13;j++){
            if((1<<j) <= i) lg[i] = j;
        }
    }
    for(int j=1;j<=m;j++){
        for(int k=1;k<13;k++){
            for(int i=1;i<=n;i++){
                b[i][j][k] = b[i][j][k-1];
                if(i+(1<<(k-1)) <= n) b[i][j][k] = max(b[i][j][k], b[i+(1<<(k-1))][j][k-1]);
            }
        }
    }
    dfs(1, n, 1, n);
    printf("%lld\n", ans);
}

Measured memory_bytes: 55956
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand((unsigned)time(NULL));
  ll N;
  cin >> N;
  vll a(N);
  ll num = 0;
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    num ^= a.at(i);
  }
  for(int i = 0; i < N; i++){
    cout << (num ^ a.at(i));
    if(i != N-1) cout << ' ';
    else cout << endl;
  }

}

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

int main(){
    int n;
    cin >> n;
    vector<int> b(n+1, 0);
    for(int i=0; i<3; i++){
        int m;
        cin >> m;
        for(int j=0; j<m; j++){
            int a;
            cin >> a;
            b[a] |= 1<<i;
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++){
        if(b[i]==4 || b[i]==6 || b[i]==7){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
const int N = 1e5 + 5;
ll n, ans, a[N];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 0;i < n + 1;++i)
        cin >> a[i];
    for(int i = 0;i < n;++i)
    {
        ll x;
        cin >> x;
        ll mn = min(x, a[i]);
        x -= mn;
        a[i] -= mn;
        ans += mn;
        mn = min(x, a[i + 1]);
        x -= mn;
        a[i + 1] -= mn;
        ans += mn;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
	if (a%b==0)return(b);
	else return(gcd(b,a%b));
}
 
int main(){
    ll n, m;
    cin >> n >> m;
 
    ll a[n];
    rep(i, n)cin >> a[i];
    ll g = 1;
    rep(i, n){
        g = (g*a[i])/gcd(g, a[i]);
        if(g/2 > m){
            cout << 0;
            return 0;
        }
    }
    
    g /= 2;

    rep(i, n)if(g%a[i] == 0){
        cout << 0;
        return 0;
    }
    
    ll ans = m/g + 1;
    cout << ans/2 << endl;

 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 小数のときは，精度の設定する．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int64_t N; cin >> N;
VI A(N);
rep(i, 0, N) cin >> A[i];
VI a = A;
sort(ALL(a), greater<int64_t>());
int maxi = a[0], se = a[1];

rep(i, 0, N){
    if (A[i] == maxi) cout << se <<"\n";
    else cout << maxi <<"\n";
}

}

// 境界，出力文字列 チェック



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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RE return 0;
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int a,b;
  cin >> a >> b;
  rep(i,4) if(a*b*i%2){cout << "Yes" << endl; RE;}
  cout << "No" << endl;
  return 0;
}


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

using namespace std;

const int maxn = 2e5 + 5;

int a[maxn];

int main() {
	int n;
	ios::sync_with_stdio(0);
	cin >> n;
	for(int i = 0 ; i < n ; i++)cin >> a[i];
	int ma = a[0];
	long long ans = 0;
	for(int i = 1 ; i < n ; i++) {
		if(ma > a[i]) {
			ans += ma - a[i];
		}
		else {
			ma = max(ma , a[i]);
		}
	}
	cout << ans << "\n";
	return 0;
}

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

#define AA 100001
 
int main(){
  int N, a, b, temp[AA+100] = {}, ma = 0;

  cin>>N;

  for(int i = 0; i < N; i++){
    cin>>a>>b;
    temp[a]++;
    temp[b+1]--;
  }

  temp[0] = 1;

  for(int i = 1; i <= AA; i++){
    temp[i]+= temp[i-1];
    if(temp[i] >= i){
      ma = i;
    }
    // cout<<temp[i]<<" ";
  }

  cout<<ma-1<<endl;
  
  return 0;
}



Measured memory_bytes: 3496
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	ls := make([]int, n)
	for i := 0; i < n; i++ {
		ls[i] = eGetInt(scanner)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(ls)))
	count := 0
	for i := 0; i < n-2; i++ {
		a := ls[i]
		for j := i + 1; j < n-1; j++ {
			b := ls[j]
			for k := j + 1; k < n; k++ {
				c := ls[k]
				if b+c > a {
					count++
				} else {
					break
				}
			}
		}
	}
	fmt.Println(count)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


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

ll modPow(ll a, ll n) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}
ll modComb(ll n,ll a){
  ll x=1,y=1;
  rep(i,a){
    x*=n-i;
    x%=MOD;
    y*=i+1;
    y%=MOD;
  }
  y=modPow(y,MOD-2);
  return (x*y)%MOD;
}

int main(){
  ll N,K,U=1,D=1,ans=0;
  cin >> N >> K;
  vector<ll> A(N),comb(N);
  rep(i,N) cin >> A.at(i);
  sort(A.begin(),A.end());
  comb.at(N-1)=modComb(N-1,K-1);
  for(ll i=1;i<N-K+1;i++){
    comb.at(N-i-1)=((comb.at(N-i)*(N-K+1-i))%MOD)*modPow(N-i,MOD-2);
    comb.at(N-i-1)%=MOD;
  }
      
  rep(i,N-K+1){
    U+=((MOD+A.at(N-i-1))%MOD)*comb.at(N-i-1);
    U%=MOD;
  }
  rep(i,N-K+1){
    D+=((MOD+A.at(i))%MOD)*comb.at(N-i-1);
    D%=MOD;
  }
  ans=(U+MOD-D)%MOD;
  cout << ans << endl;
  
  
  
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main(){
    int i, n, ina;
    cin >> n;
    int a[n] = {};
    for(i=0; i<n-1; i++){
        cin >> ina;
        a[ina-1]++;
    }
    for(i=0; i<n; i++){
        cout << a[i] << "\n";
    }
    return 0;
}

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

int main() {
  int N, M;  
  
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
	cin >> s.at(i);
  }
  
  cin >> M;
  vector<string> t(M);
  for (int j = 0; j < M; j++) {
	cin >> t.at(j);
  }

  vector<int> p(N);
  
  for (int i = 0; i < N; i++) {
	for (int j = 0; j < N; j++) {
      if ( s.at(j) == s.at(i) ) {
         p.at(i) = p.at(i) + 1;
      }
    }
    for (int k = 0; k < M; k++) {
      if ( t.at(k) == s.at(i) ) {
         p.at(i) = p.at(i) - 1;
      }
    }
  }
  
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  
  cout << max (p.at(0),0) << endl;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    char s[20], t[20], u[20];
    int a, b;
    
    scanf("%s %s", s, t);
    scanf("%d %d", &a, &b);
    scanf("%s", u);
    
    if(strcmp(s,u) == 0){
        printf("%d %d", a-1, b);
    }
    else{
        printf("%d %d", a, b-1);
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int k;
	cin >> k;
	cout << k/2*(k/2+k%2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
const int N = 1300;
int main()
{
	char str[N];
	while(fgets(str, 1300, stdin))
	{
		for(int i = 0;i < strlen(str);i++)
		{
			if(str[i] >= 'A' && str[i] <= 'Z')
			{
				printf("%c", str[i] + 32);
			} 
			else if(str[i] >= 'a' && str[i] <= 'z')
			{
				printf("%c", str[i] - 32);
			}
			else
			{
				printf("%c", str[i]);
			}
		}
	}
	return 0;
 } 


Measured memory_bytes: 2540
#include <iostream>

using namespace std;

int main()
{
    int h, w;
    while (cin >> h >> w)
    {
        if ((h == 0) && (w == 0))
        {
            return (0);
        }
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if((i == 0) || (i == (h-1)))
                {
                    cout << "#";
                }
                else
                {
                    if((j == 0) || (j == (w - 1)))
                    {
                        cout << "#";
                    }
                    else
                    {
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 2972
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define A 1000

void push(int);
int pop(void);

int lead, array[A];

int main(){
  int i, j, k;
  lead = 0;
  char l[A];
  while( scanf("%s", l) != EOF ){
    if ( l[0] == '+' ){
      i = pop();
      j = pop();
      push(i + j);
    } else if ( l[0] == '-' ){
      j = pop();
      i = pop();
      push(i - j);
    } else if ( l[0] == '*' ){
      i = pop();
      j = pop();
      push(i * j);
    } else {
      k = atoi(l);
      push(k);
    }
  }
  
  printf("%d\n", pop());

  
  return 0;
}

int pop(){
  --lead;
  return array[lead+1];
}

void push(int k){
  array[++lead] = k;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
int a[100],b[100],n,f[100],c[100];
int lowbit(int x){
	return x&(-x);
}
void add(int x){
	while(x<=n){
		c[x]+=1;
		x+=lowbit(x);
	}
}
int pre(int x){
	int sum=0;
	while(x){
		sum+=c[x];
		x-=lowbit(x);
	}
	return sum;
}
void init(){
	f[0]=1;
	for(int i=1;i<=30;++i){
		f[i]=f[i-1]*i;
	}
}
int cantor_exp(int *p){
	int sum=0;
	for(int i=n;i>=1;--i){
		int a=pre(p[i]-1);
		sum+=a*f[n-i];
		add(p[i]);
	}
	return sum;
}
int main()
{
	ios;
	cin>>n;
	init();
	for(int i=1;i<=n;++i) cin>>a[i];
	for(int i=1;i<=n;++i) cin>>b[i];
	int s1,s2;
	s1=cantor_exp(a);
	memset(c,0,sizeof c);
	s2=cantor_exp(b);
	cout<<abs(s1-s2)<<'\n';
}

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

using namespace std;

#define MAX 55

string s;
string memo[MAX][MAX];

string get_max(string a, string b)
{
    int alen = a.size(), blen = b.size();
    if (alen > blen) {
        return a;
    } else if (alen < blen) {
        return b;
    }
    return (a > b ? a : b);
}

bool is_pare(int l, int r)
{
    int p = l + 1;
    if (r - l < 5) return 0;
    return ((s[p] == '?' || s[p] == '(') &&
            (s[r] == '?' || s[r] == ')'));
}

string dfs(int l, int r)
{
    string &res = memo[l][r];
    if (res != "*") return res;    
            
    if (s[l] == 'L' || s[l] == 'R' || s[l] == '?') {        
        if (is_pare(l, r)) {
            for (int i = l+3; i <= r-2; i++) {
                if (s[i] == ',' || s[i] == '?') {
                    if (s[l] == 'L' || s[l] == '?') {
                        if (dfs(i+1, r-1) != "/") {
                            res = get_max(res, dfs(l+2, i-1));      
                        }
                    }
                    if (s[l] == 'R' || s[l] == '?') {
                        if (dfs(l+2, i-1) != "/") {
                            res = get_max(res, dfs(i+1, r-1));                   
                        }
                    }
                }
            }
        }
    }
    string ss;
    for (int i = l; i <= r; i++) {
        if (isdigit(s[i])) {
            ss += s[i];
        } else if (s[i] == '?') {
            ss += "9";
        } else {
            ss = "/";
            break;
        }           
    }
    if (!ss.empty() && ss[0] == '0' && ss.size() > 1) {
        ss = "/";
    }
    res = get_max(res, ss);
    return res;
}

void init_table()
{
    for (int i = 0; i < MAX; i++) {
        for (int j = 0; j < MAX; j++) {
            memo[i][j] = "*";
        }        
    }
}

int main()
{
    cin >> s;
    init_table();
    string res = dfs(0, s.size()-1);
    if (res == "/" || res == "*") {
        cout << "invalid" << endl;
    } else {
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1392
point = 0
point2 =None
N = int(input())
A =[int(x) for x in input().split()]
B =[int(x) for x in input().split()]
C =[int(x) for x in input().split()]
for x in range(0,int(N)):
    point =  point + B[x]
    if point2 == A[x]-1:
        point = point + C[point2-1]
    point2 = A[x]
print(point)

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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

const int M = 1 << 26;

int dp[M + 7];

int main()
{
    _upgrade
    string s; cin >> s;
    for(int i = 1; i < M; i++)
        dp[i] = 1e9;
    int mask = 0;
    for(int i = 0; i < sz(s); i++)
    {
        int b = s[i] - 'a';
        mask ^= (1 << b);
        for(int j = 0; j < 26; j++)
        {
            int mask2 = (mask ^ (1 << j));
            dp[mask] = min(dp[mask], dp[mask2] + 1);
        }
    }
    cout << max(dp[mask], 1) << "\n";
    return 0;
}


Measured memory_bytes: 262804
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

m = sum(B) - sum(A)
cnt_a, cnt_b = 0, 0

for a, b in zip(A, B):
    if a > b:
        cnt_b += 1
    elif a < b:
        if (b-a) % 2 == 0:
            cnt_a += (b-a)//2
        else:
            cnt_a += (b-a)//2 + 1

if max(cnt_a, cnt_b) <= m:
    print('Yes')
else:
    print('No')

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define PB push_back
#define MP make_pair

#define sd(n) scanf("%lld", &n)
#define pdn(n) printf("%lld\n", n);
#define pds(n) printf("%lld ", n);
#define endl '\n'

#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define len(stuff) (int) stuff.size()

#define int long long
// #define float long double 
#define ll long long
#define ld long double

using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const int inf = (int) 1e16;
const int upper = (int) 2e5 + 50;
const int M = (ll) 1e9 + 7;
const int mod = (ll) 998244353;
const double eps =  1e-8;

long double prob = 0;
signed main () {
	start_routine();
	speed();
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);	 
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif	
	int n, k;
	cin >> n >> k;
	long double prob1 = (long double) 1 / (long double) n;
	for (int i = 1; i <= n; i += 1) {
		int req = 0;
		int cur = i;
		while (cur < k) {
			cur *= 2;
			req++;
		}
		long double prob2 = pow(2, -req);
		prob += prob2 * prob1;
	}
	cout.precision(20);
	cout << prob;
 	end_routine();		
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]", d: "List[int]"):
    for i in range(N):
        mn = 1e9
        idx = -1
        for j in range(M):
            dis = abs(a[i] - c[j]) + abs(b[i] - d[j])
            if dis < mn:
                mn = dis
                idx = j+1
        print(idx)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (N)  # type: "List[int]" 
    b = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    c = [int()] * (M)  # type: "List[int]" 
    d = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        c[i] = int(next(tokens))
        d[i] = int(next(tokens))
    solve(N, M, a, b, c, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5308
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int AB = A-B;
        C -= AB;
        if(C<0){
            C =0;
        } 
        System.out.println(C);
    }

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

Measured memory_bytes: 23124
#import numpy as np
#import math
import heapq

n, m = map(int, input().split())
#a = list(map(int, input().split()))
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    MAX = heapq.heappop(a)  # −１かけたリストのMin　＞Max
    heapq.heappush(a, (-1) * (-MAX // 2))

ans = (sum(a)) * (-1)  # そのままリストでOK
print(ans)

Measured memory_bytes: 14184
#include<iostream>
#include<algorithm>
using namespace std;
const int N=2e3+10;
int a[N];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	long long ans=0;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			int l=j+1,r=n-1,x=a[i]+a[j];
			while(l<r){
				int m=l+r+1>>1;
				if(a[m]<x) l=m;
				else r=m-1;
			}
			if(x>a[l]) ans+=l-j;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
const int N=9e5+10;
const LL mod=1e9+7;
int n,m,k;
LL fac[N]={1},inv[N]={1,1},pw[N]={1},ans,j=1;
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline void swp(I&a,I&b){a^=b; b^=a; a^=b;}
inline LL C(int nn,int mm){return fac[nn]*inv[mm]%mod*inv[nn-mm]%mod;}
int main()
{
//	freopen("Card Game for Three.in","r",stdin);
	read(n,m,k);
	if(k>m) swp(k,m);
	for(RG int i=2;i<=n+k+m;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for(RG int i=1;i<=n+k+m;i++) fac[i]=fac[i-1]*i%mod, (inv[i]*=inv[i-1])%=mod, pw[i]=pw[i-1]*3%mod;
	for(RG int i=0;i<=m+k;i++)
	{
		(ans+=C(n+i-1,n-1)*pw[m+k-i]%mod*j%mod)%=mod;
		if(i<k) (j<<=1)%=mod;
		else if(i>=m) (j+=j-C(i,k)+mod-C(i,m)+mod)%=mod;
		else (j+=j-C(i,k)+mod)%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

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


int main() {
int N;
cin >> N;
int slime[100];
for(int i = 0;i<N;i++)cin>>slime[i];
int count = 0;
for(int i = 0;i<N-1;i++){
if(slime[i] == slime[i+1]) count++, i++;
}
cout << count << endl;
}


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

if len(set(s)) == 1:
    print((len(s)*k)//2)
    exit()

def n_change(sss):
    s = sss.copy()
    x = 0
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            s[i] = "X"
            x += 1
    return x

print(n_change(s) + (k-1) * (n_change(2*s) - n_change(s)))

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

using namespace std;

const int N = 3e5 + 7;

int a[N];

int main() {
	int n; cin >> n;
	for(int i = 0;i < n * 2;i++){
		cin >> a[i];
	}
	sort(a, a + n * 2);
	int k = 0, sum = 0;
	for(int i = 0;i < n;i++){
		sum += a[k];
		k += 2;
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		if(N == 1){
			Console.WriteLine(0);
			return;
		}
		var di = new Dictionary<int,int>();
		for(int i=2;i<=N;i++){
			var pf = PrimDec(i);
			foreach(var k in pf.Keys){
				if(!di.ContainsKey(k)) di.Add(k,0);
				di[k] += pf[k];
			}
		}
		
		int ans = 0;
		foreach(var i in di.Keys){
			if(di[i] >= 74) ans += 1;
		}
//Console.WriteLine(String.Join(" ",di));
		foreach(var i in di.Keys){
			foreach(var j in di.Keys){
				if(di[i] >= 3 - 1 && di[j] >= 25 - 1 && i != j) ans++;
				if(di[i] >= 5 - 1 && di[j] >= 15 - 1 && i != j) ans++;
			}
		}
//Console.WriteLine(ans);
		int ans0 = 0;
		foreach(var i in di.Keys){
			foreach(var j in di.Keys){
				foreach(var k in di.Keys){
					if(di[i] >= 3 - 1 && di[j] >= 5 - 1 && di[k] >= 5 - 1){
						if(i != j && j != k && k != i){
//Console.WriteLine("{0} {1} {2}",i,j,k);
							ans0++;
						}
					}
				}
			}
		}
		ans0 /= 2;
		Console.WriteLine(ans + ans0);
		
	}
	int N;
	public Sol(){
		N = ri();
	}
	
	Dictionary<int,int> PrimDec(int A){
	 	Dictionary<int,int> D=new Dictionary<int,int>();
	 	if(A==1)return null;
	 	int rem=A;
	 	for(int i=2;i<=(int)Math.Sqrt((double)A);i++){
	 		if(rem%i==0){
	 			int cnt=0;
	 			while(rem%i==0){cnt++;rem/=i;}
	 			D.Add(i,cnt);
	 		}
	 		if(rem==1)break;
	 	}
	 	if(rem!=1)D.Add(rem,1);
	 	return D;
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main()
{
    int A,B,f = 0;
    cin >> A;
    cin >> B;
    if(A > 9)
    {
        f = 1;
    }
    if(B > 9)
    {
        f = 1;
    }
    if(f == 1)
    {
        cout << -1;
    }
    else
    {
        cout << A * B;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    ll n;cin>>n;
    ll sum=0;
    REP(i,1,n+1)if(i%3&&i%5)sum+=i;
    out(sum);
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stdio.h>
#include<cmath>

using namespace std;

int main(void)
{
	int r, g;
	cin >> r >> g;

	double ans;

	ans= g * 2.0 - r;
	cout << ans;
		return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

vector<int> total(51),patty(51);
void init()
{
	total[0]=1;
	For(i,1,50) total[i]=total[i-1]*2+3;
	patty[0]=1;
	For(i,1,50) patty[i]=patty[i-1]*2+1;
}

int eat(int layer,int &lim)
{
	if(lim<=0) return 0;
	if(lim>=total[layer])
	{
		lim-=total[layer];
		return patty[layer];
	}
	int ans=0;
	lim--;
	ans+=eat(layer-1,lim);
	if(lim>0) lim--,ans++;
	ans+=eat(layer-1,lim);
	lim--;
	return ans;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	init();
	int n,k; cin>>n>>k;
	cout<<eat(n,k)<<"\n";
	return 0;
}















Measured memory_bytes: 256
n=int(input())
num=[]
def ap(num1):
    num.append(num1)
for i in range(n):
    ap(list(map(int,input().split())))
num2=0
str1= lambda val: val[1]
num.sort(key=str1)
ans=0
for i in range(n):
    num2+=num[i][0]
    if num2>num[i][1]:
        ans=1
        break
if ans==1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 53708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    string S;cin>>S;
    int N=S.size();
    
    if(N%2){
        bool ok=true;
        int to=1;
        for(int i=0;i<(N-1)/2;i++){
            if(S[i]!=S[N-2-i]) ok=false;
            if(S[i]=='1') to=i+1;
        }
        if(S[0]=='0') ok=false;
        if(S[N-1]=='1') ok=false;
        if(!ok) cout<<-1<<endl;
        else{
            int before=2,now=3;
            cout<<"1 2"<<endl;
            for(int i=1;i<to;i++){
                if(S[i]=='1'){
                    cout<<before<<" "<<now<<endl;
                    before=now;
                    now++;
                }else{
                    cout<<before<<" "<<now<<endl;
                    now++;
                }
            }
            for(int i=to;i<N-1;i++){
                cout<<before<<" "<<now<<endl;
                now++;
            }
        }
    }else{
        bool ok=true;
        int to=1;
        for(int i=0;i<=(N-1)/2;i++){
            if(S[i]!=S[N-2-i]) ok=false;
            if(S[i]=='1') to=i+1;
        }
        if(S[0]=='0') ok=false;
        if(S[N-1]=='1') ok=false;
        if(!ok) cout<<-1<<endl;
        else{
            int before=2,now=3;
            cout<<"1 2"<<endl;
            for(int i=1;i<to;i++){
                if(S[i]=='1'){
                    cout<<before<<" "<<now<<endl;
                    before=now;
                    now++;
                }else{
                    cout<<before<<" "<<now<<endl;
                    now++;
                }
            }
            for(int i=to;i<N-1;i++){
                cout<<before<<" "<<now<<endl;
                now++;
            }
        }
    }
    
}



Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    int INF = 1e9 + 7;
    long long ans = 1;
    for(int i = 2; i < n+1; i++) {
        ans = (ans*i)%INF;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
    a[i] += a[i-1]
for i in range(1,m):
    b[i] += b[i-1]
a = [0]+a
b = [0]+b

ans = 0
ALL = 0
from bisect import bisect
for i in range(n+1):
    ALL = a[i]
    if ALL > k:
        continue
    else:
        idx = bisect(b,k-ALL)
    #print(i,ALL,idx)
        ans = max(ans,i+idx-1)
print(ans)

Measured memory_bytes: 40616