akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lopj(n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

main()
{
    ll n;
    cin>>n;
    if(n>=30) cout<<"Yes";
    else cout<<"No";
}



Measured memory_bytes: 3628
#include<stdio.h>
#include<math.h>
#include<stdlib.h>


int main(){

long long int n, a[200010]={}, x, min=9223372036854775807;
long long int i, j;

scanf("%lld", &n);
for(i=1;i<=n;i++){
  scanf("%lld", &a[i]);
  a[i]+=a[i-1];
}

x=a[n];

for(i=1;i<n;i++){
  if(min>llabs(a[i]-(x-a[i]))) min=llabs(a[i]-(x-a[i]));
}


printf("%lld\n", min);
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
struct edge {int u, v, w;};
vector<edge>G;
int L;
void add(int u, int v, int w) {G.push_back((edge) {u , v , w});}
int main()
{
  cin >> L;
  int t = 1;
  for (int i = 0; i < 21; ++i) if (L & (1 << i)) t = i;
  L--;
  for (int i = 1; i <= t - 1; i++) add(i, i+1, 1 << i-1), add(i, i+1, 0);
  add(t, 20, 0);
  add(t, 20, 1 << t-1);
  int g = 1 << t;
  while (g <= L) {
    t = 1;
    while ((1 << t) <= (L - g + 1)) ++t;
    --t;
    add(t+1, 20 , g);
    g |= 1 << t;
  }
  cout << "20 " << G.size() << endl;
  for (auto it = G.begin(); it != G.end(); ++it) cout << it->u << ' ' << it->v << ' ' << it->w << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define pllu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<P>vecr, vecb;
bool b[100];

void solve(long long N, vector<long long> a, vector<long long> b, vector<long long> c, vector<long long> d){
	rep(i,N) {
		vecr.push_back(P(a[i], b[i]));
		vecb.push_back(P(c[i], -d[i]));
	}
	SORT(vecr);
	SORT(vecb);
	ll res = 0;
	rep(i,N) {
		b[i] = false;
	}
	// rep(i,N) {
	// 	cout << vecr[i].first << " " <<  vecr[i].second << endl; 
	// }
	// rep(i,N) {
	// 	cout << vecb[i].first << " " <<  vecb[i].second << endl; 
	// }
	for (ll i = N-1; i >= 0; i--) {
		ll n = -1, h = 10000;
		rep(j,N) {
			if (vecr[i].first < vecb[j].first && vecr[i].second < -vecb[j].second && !b[j] && -vecb[j].second < h) {
				// cout << i << " " << j << " :" << endl;
				// cout << vecr[i].first << " " <<  vecr[i].second << endl; 
				// cout << vecb[j].first << " " <<  vecb[j].second << endl;
				// cout << b[j] << endl; 
				n = j;
				h = -vecb[j].second ;
			}
		}
		if (n != -1) {
			b[n] = true;
			res++;
		}
	}
	cout << res << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> d(N-1+1);
	vector<long long> c(N-1+1);
	vector<long long> b(N-1+1);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
	}
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&c[i]);
		scanf("%lld",&d[i]);
	}
	solve(N, a, b, c, d);
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main
{
    public static void main(String[] args) throws IOException
    {
        int N = readInt();
        char[] chs = br.readLine().toCharArray();

        int left = 0;
        int right = N - 1;
        int count = 0;

        while (left < right)
        {
            if (chs[left] == 'W')
            {
                if (chs[right] == 'R')
                {
                    left++;
                    right--;

                    count++;
                }
                else
                    right--;
            }
            else
                left++;
        }

        System.out.println(count);
    }

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;

    static int readInt() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
        {
            st = new StringTokenizer(br.readLine());
        }
        return Integer.parseInt(st.nextToken());
    }
}

Measured memory_bytes: 36364
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
# @lru_cache(None)






s=input()
ans=0
for i in range(1,len(s)):
    if(s[i]!=s[i-1]):
        ans+=1
print(ans)


Measured memory_bytes: 5440
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    // 変数一覧
    int a;
    int b;
    int c;
    int d;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        d = sc.nextInt();
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        c -= b;
        if (c < 1) {
            System.out.println("Yes");
            return;
        }
        a -= d;
        if (a < 1) {
            System.out.println("No");
            return;
        }
        solve();
    }
}

Measured memory_bytes: 35588
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	print(n*(n-1)/2);
	return 0;
}


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

// #define int long long

using namespace std;

signed main(void) {

  int ans = 0;

  int n, k;
  cin >> n >> k;
  // vector<int> v(n);
  deque<int> v(n);
  for (auto it = v.begin(); it != v.end(); ++it)
    cin >> *it;

  for (int a = 0; a <= min(n, k); ++a) {

    for (int b = 0; b <= min(n, k) - a; ++b) {
      deque<int> d = v;
      vector<int> hand(a + b);

      for (int i = 0; i < a; ++i) {
        hand.push_back(d.front());
        d.pop_front();
      }

      for (int i = 0; i < b; ++i) {
        hand.push_back(d.back());
        d.pop_back();
      }

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

      for (int i = 0; i < min(k - (a + b), (int)hand.size()); ++i) {
        if (hand[i] < 0) hand[i] = 0;
        else break;
      }

      int val = accumulate(hand.begin(), hand.end(), 0);
      ans = max(val, ans);
    }
  }
  
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
 	int i;	
  	int ans = 0;
  	int n;
  	int a[100] = {0};
  	int b[100] = {0};
  	int p,q,r;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
  
  
  for(p=0;p<n;p++){
    for(q=p+1;q<n;q++){
    	for(r=q+1;r<n;r++){
          if(a[p]==a[q]||a[q]==a[r]||a[r]==a[p]){
           continue; 
          }
          
    	if(a[p]>a[q]&&a[p]>a[r]){
          if(a[p]<a[q]+a[r]){
            ans++;
          }
        }
         if(a[q]>a[p]&&a[q]>a[r]){
          if(a[q]<a[p]+a[r]){
            ans++;
          }
        }
         if(a[r]>a[p]&&a[r]>a[q]){
          if(a[r]<a[q]+a[p]){
            ans++;
          }
        }
          
       }
    }
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 1732
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    int c = 0;
    for (int i = 1; i <= n; i++) {
      int s = 0;
      for (int j = i; j < n; j++) {
        s += j;
        c += s == n;
      }
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 3072
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N, Ma, Mb;
    std::cin >> N >> Ma >> Mb;

    struct D {
        int64_t a;
        int64_t b;
        int64_t c;
    };

    std::vector<D> d;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t a, b, c;
        std::cin >> a >> b >> c;
        d.push_back({a, b, c});
    }

    // dp[aの総量][bの総量][i個まで(i含む)]
    boost::multi_array<int64_t, 3> dp(boost::extents[N+1][10*N+1][10*N+1]);

    const int64_t INF = 40*N+1;
    std::fill(dp.data(), dp.data() + dp.num_elements(), INF);

    // 配るDP
    dp[0][0][0] = 0;

    #if 1
    for (int64_t i = 0; i < N; ++i) {
        for (int64_t a = 0; a <= 10*N; ++a) {
            for (int64_t b = 0; b <= 10*N; ++b) {
                if (dp[i][a][b] == INF) {
                    // 原点から届かない部分からは次に配らない
                    // この枝切りを入れないと、
                    // すでに a, b がmaxになっているところから先に配ろうとして、
                    // 範囲外アクセスとなる。
                    continue;
                }

                // 自分をいれる
                dp[i+1][a+d[i].a][b+d[i].b] = std::min(dp[i+1][a+d[i].a][b+d[i].b],
                                                       dp[i][a][b] + d[i].c);
                // 自分をいれない
                dp[i+1][a][b] = std::min(dp[i+1][a][b], dp[i][a][b]);
            }
        }
    }
    #endif
    #if 0
    // もらうDP
    for (int64_t i = 0; i < N; ++i) {
        for (int64_t a = 0; a <= 10*N; ++a) {
            for (int64_t b = 0; b <= 10*N; ++b) {
                if (a - d[i].a >= 0 && b - d[i].b >= 0) {
                    dp[i+1][a][b] = std::min(dp[i][a][b], dp[i][a - d[i].a][b - d[i].b] + d[i].c);
                }
                else {
                    dp[i+1][a][b] = dp[i][a][b];
                }
            }
        }
    }
    #endif
    int64_t ans = INF;
    for (int64_t a = 1; a <= 10*N; ++a) {
        for (int64_t b = 1; b <= 10*N; ++b) {
            if (Ma*b == Mb*a) {
                ans = min(ans, dp[N][a][b]);
            }
        }
    }
    if (ans == INF) {
        ans = -1;
    }
    std::cout << ans << std::endl;

    return 0;
}






Measured memory_bytes: 51712
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int s = x%60;
		int h = x/3600;
		int m = x/60-60*h;
		System.out.println(h+":"+m+":"+s);
	}
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

#define mod 1e9+7;
#define inf 1e18+7;

typedef long long ll;

int main() {

    string s,t;
    cin>>s>>t;

    int size=s.size();

    rep(i,size){
        s=s[size-1]+s;
        s.pop_back();
        if(s==t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    
}


Measured memory_bytes: 764
n = int(input())
spi = sorted([list(input().split())+[i+1] for i in range(n)])
ans = []
before = ""
for s,p,i in spi:
    if ans == []:
        ans = [[int(p),i]]
        before = s
    else:
        if before == s:
            ans.append([int(p),i])
        else:
            for j in sorted(ans)[::-1]: print(j[1])
            ans = [[int(p),i]]
            before = s
if ans:
    for i in sorted(ans)[::-1]: print(i[1])

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;
vector<vl> Adj;
vector<vl> BAdj;
vector<ll> CCNum;
vector<bool> visited;
ll cc = 1;

void Explore(ll v)
{
	visited[v] = true;
	CCNum[v] = cc;
	for(ll u : Adj[v])
	{
		if(!visited[u])
		{
			Explore(u);
		}
	}
}
void dfs(ll n)
{
	pragi(1,n + 1)
	{
      if(!visited[i])
	  {cc++;Explore(i);}
	}
}
void Compute(ll n,ll m,ll k)
{
	KAKA
	Adj.resize(n + 1);
	BAdj.resize(n + 1);
	CCNum.resize(n + 1);
	visited.resize(n + 1,false);
	pragi(0,m)
	{
		ll u,v;
		cin>>u>>v;
		Adj[u].eb(v);
		Adj[v].eb(u);
	}
	pragi(0,k)
	{
		ll u,v;
		cin>>u>>v;
		BAdj[u].eb(v);
		BAdj[v].eb(u);
	}
  dfs(n);
  map<ll,ll> mp;
  pragi(1,n + 1)
  {
	  mp[CCNum[i]]++;
  }
  vector<ll> vec(n + 1);
  pragi(1,n + 1)
  {
	  ll temp = 0;
	  temp += mp[CCNum[i]];
	  temp--;
	  temp -= Adj[i].size();
	  ll diff = 0;
	  for(ll v : BAdj[i])
	  {
		  if(CCNum[v] == CCNum[i]) diff++;
	  }
	  temp -= diff;
	  vec[i] = temp;
  }
  pragi(1,n + 1)
  cout<<vec[i]<<" ";
  cout<<"\n";

}
int main()
{
	KAKA
	ll n,m,k;
	cin>>n>>m>>k;
	Compute(n,m,k);
}

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

int main(){
  string S,T;
  int count=0;
  cin >> S >> T;
  for(int i=0;i<3;i++){
  	if(S.at(i)==T.at(i)){
    	count++;
  	}
  }
  cout << count << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BPapersPlease {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N);
        REP(i, N) cin >> A[i];

        bool ok = true;
        REP(i, N) {
            if (A[i] % 2 == 0) {
                if (A[i] % 3 == 0) {

                } else if (A[i] % 5 == 0) {

                } else {
                    ok = false;
                }
            }
        }
        if (!ok) {
            cout << "DENIED" << endl;
            return;
        }
        cout << "APPROVED" << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BPapersPlease solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

// #define fisier 1

using namespace std;

typedef long long ll;


int add(int a, int b)
{
    int x = a+b;
    if(x >= mod)
        x -= mod;
    if(x < 0)
        x += mod;
    return x;
}
ll mul(ll a, ll b)
{
    return (a*b) % mod;
}

ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
    long long a = rng();
    return a;
}

vector<int> v[200002];

int dp[200002];
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int r;
    cin >> r;
    double ans = 2 * dancila * r;
    cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 8496
fun main(args: Array<String>) {
    val s = readLine()!!
    println(Math.min(f(s), f(s.reversed())))
}

private fun f(s: String): Int {
    if (s.length == 1) {
        return 0
    }

    var c = s[0]

    return s.substring(1).map {
        if (c == it) {
            c = if (c == '0') '1' else '0'
            1
        } else {
            c = it
            0
        }
    }.sum()
}

Measured memory_bytes: 36500
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
    string s;
    cin>>s;
    int count=0;
    for(int i=0;i<3;i++)
    if(s[i]=='1') count++;
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
n, k = (int(i) for i in input().split())
x = [int(i) for i in input().split()]

a = []

for i in range(n-k+1):
    l = x[i]
    r = x[i+k-1]
    h = abs(l-r)
    s = min(h + abs(l), h + abs(r))
  #  print(s)
    a.append(s)

#print(a)           
print(min(a))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n;
    cin >> n;
    map<int, int> d;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        if (d.count(tmp))
            d[tmp]++;
        else
            d[tmp] = 1;
    }
    int m;
    cin >> m;
    vector<int> T(m);
    map<int, int> t;
    for (int i = 0; i < m; i++) {
        int tmp;
        cin >> tmp;
        T[i] = tmp;
        if (t.count(tmp))
            t[tmp]++;
        else
            t[tmp] = 1;
    }
    string ans = "YES";
    for (int i = 0; i < m; i++) {
        if (!d.count(T[i])) {
            ans = "NO";
        } else if (d.at(T[i]) < t.at(T[i])) {
            ans = "NO";
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  int c;
  if ((a == 1 && b == 2) || (a == 2 & b== 1)){
    c = 3;
  } else if ((a == 2 && b == 3) || (a == 3 && b == 2)){
    c = 1;
  } else {
    c = 2;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
int n, cnt[N];
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int x;
		scanf("%d", &x);
		cnt[x]++;
	}
	for (int i = 1; i <= n; i++)printf("%d\n", cnt[i]);
	return 0;
}

Measured memory_bytes: 4548
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		long A=scan.nextLong();
		long B=scan.nextLong();


		long[] two = new long[61];
		two[0]=1;
		for(int i=1;i<61;i++){
			two[i]=two[i-1]*2;

		}

		int maxk=0;
out:	for(int j=60;j>=0;j--){
		for(int i=j;i>=0;i--){
			if(A<=two[i]&&B>=two[i]){
				maxk=i;
				break out;
			}//else if(A>two[i]&&B>two[i])
			if(i==0){
				for(int k=1;k<=60;k++){
					if(A<two[k]){
						A-=two[k-1];
						B-=two[k-1];
						break;
					}

				}

			}
		}
		}



//		System.out.println(two[maxk]);

		long ans = two[maxk]-A;
		B-=two[maxk];
//		if(B<A){
			int maxk_=0;
			//Bの残り全部数え上げてよい
			for(int i=0;i<=60;i++){
				if(B<two[i]){
					maxk_=i;
					break;
				}
			}
			ans +=two[maxk_];

			if(two[maxk_]<=A){
				ans+=two[maxk]-A;
			}else{
				ans+=two[maxk]-two[maxk_];
			}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18
#define eps 1e-14

int main() {
    long double a, b, c;
    cin >> a >> b >> c;
    long double l = sqrt(a) + sqrt(b), r = sqrt(c);
    if (l + eps < r)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا
/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ

#include <bits/stdc++.h>
#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld  double

#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define S second
#define F first
#define PI acos(-1)
#define MAX 5000005
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);


int main() {
    HabdModeActive
    int n;
    cin>>n;
    ll arr[n+2];
    ll gcdL[n+2],gcdR[n+2];
    for(int i=0 ;i<n;i++)
    {
        cin>>arr[i];
    }
    gcdL[0] = arr[0];
    for(int i=1 ; i<n; i++)
    {
        gcdL[i] = __gcd(arr[i],gcdL[i-1]);
    }
    gcdR[n-1] = arr[n-1];
    for(int i=n-2; i>=0 ; i--)
    {
        gcdR[i] = __gcd(arr[i],gcdR[i+1]);
    }
    ll mx = 0;
    for(int i= 0 ;i<n ; i++)
    {
        if(i==0)
        {
            mx = max(mx,gcdR[i+1]);
        }
        else if(i==n-1)
        {
            mx = max(mx,gcdL[i-1]);
        }
        else{
            mx = max(mx,__gcd(gcdL[i-1],gcdR[i+1]));
        }
    }
    cout<<mx;

    return 0;
}


Measured memory_bytes: 5964
//Code Author:-code_kika //
//Institution:-IIT(BHU)  //
#include<bits/stdc++.h>
using namespace std;

//io
#define sf(x) scanf("%d",&x);
#define sf2(x,y) scanf("%d %d",&x,&y);
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z);
#define pf(x) printf("%d",x);
#define pf2(x,y) printf("%d %d",x,y);
#define pf3(x,y,z) printf("%d %d %d",x,y,z);
#define sfl(x) scanf("%lld",&x);
#define sfl2(x,y) scanf("%lld %lld",&x,&y);
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z);
#define pfl(x) printf("%lld",x);
#define pfl2(x,y) printf("%lld %lld",x,y);
#define pfl3(x,y,z) printf("%lld %lld %lld",x,y,z);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//basic
#define pb push_back
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007LL

//typedefs
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vll vector<ll>
#define vi vector<int>

//functions
#define all(c) c.begin(),c.end()
#define fill(c,val) memset(c,val,sizeof(c))

//debug
#ifdef TRACE
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace(x)
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
ll arr[300006],arr2[300006];
int main(){
	ll n,i,a[300005],ab,sum=0,sum2=0,ans=-(1e18);

	sfl(n);
	for(i=0;i<3*n;i++){
		sfl(a[i]);
	}
	priority_queue<ll, vector<ll >, greater<ll>  > pq;
	for(i=0;i<n;i++){
		pq.push(a[i]);
		sum+=(a[i]);
	}
	arr[0]=sum;
	for(i=0;i<n;i++){
		ab=pq.top();
		if(ab>=a[n+i]){
			arr[i+1]=sum;
		}
		else{
			sum-=ab;
			sum+=(a[n+i]);
			pq.pop();
			pq.push(a[n+i]);
			arr[i+1]=sum;
		}
	}
	priority_queue<ll> pq2;
	for(i=0;i<n;i++){
		pq2.push(a[3*n-1-i]);
		sum2+=a[3*n-1-i];
	}
	arr2[0]=sum2;
	for(i=0;i<n;i++){
		ab=pq2.top();
		if(a[2*n-1-i]>=ab){
			arr2[i+1]=sum2;
		}
		else{
			sum2-=ab;
			sum2+=(a[2*n-1-i]);
			arr2[i+1]=sum2;
			pq2.pop();
			pq2.push(a[2*n-1-i]);
		}
	}
	for(i=0;i<=n;i++){
		//trace5(ans,arr[i]-arr2[n-i],arr[i],arr2[n-i],i);
		ans=max(arr[i]-arr2[n-i],ans);
	}
	pfl(ans);
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] H = cin.arrayInt();
        int max = 0;
        int ret = 0;

        for (int i = 0; i < H.Count(); i++)
        {
            if (H[i] >= max)
            {
                ret++;
                max = H[i];
            }
        }

        Console.WriteLine(ret);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }

    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

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

int main()
{
    int N, ans;
    string S;

    cin >> N;
    cin >> S;
    ans = N;

    for (int i = 0; i < N - 1; i++)
    {
        if (S[i] == S[i + 1])
        {
            ans--;
        }
    }
    cout << ans << endl;
}

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

const static int MAX = 200000;
int main()
{
    int n{ 0 };
    cin >> n;

    int maxDiv = -2000000000;
    int minv = 0;
    
    cin >> minv;
    for (int i = 1; i < n; i++) {
        int R{ 0 };
        cin >> R;
        maxDiv = max(maxDiv, R - minv);
        minv = min(minv, R);
    }
    cout << maxDiv << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const int64_t MOD = 998244353L;

int64_t dpow(int64_t x, int64_t y)
{
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return dpow(x * x % MOD, y / 2);
    } else {
        return x * dpow(x, y - 1) % MOD;
    }
}

uint64_t inv(uint64_t x)
{
    return dpow(x, MOD - 2);
}

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

    vector<int> d(n, 0);
    vector<int> a(n, 0);
    rep(i, n)
    {
        cin >> d[i];
    }

    if (d[0] != 0) {
        cout << 0 << endl;
        return 0;
    }
    int m = 0;
    rep(i, n)
    {
        if (i != 0 && d[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        m = max(m, d[i]);
        a[d[i]]++;
    }

    int64_t result = 1;
    for (int i = m; i > 0; i--) {
        result *= dpow(a[i - 1], a[i]);
        result %= MOD;
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    reverse(ALL(s));
    cout << s << endl;
    return 0;
}


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

int main(){
 int N,a,b; cin>>N>>a>>b; 
if(b-a+1>=N){cout<<"OK"<<endl;}
  else if(a%N==0){cout<<"OK"<<endl;}
  else if(b%N==0){cout<<"OK"<<endl;}
  else if(a/N!=b/N){cout<<"OK"<<endl;}
  else{cout<<"NG"<<endl;}
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
//const int MOD = 1e9+7;
const auto INF = 0x3f3f3f3f;
const int N = 1e5+5;

int num[40];

int main() {
    int n;
    scanf("%d", &n);
    int ans1 = 0, ans2 = 0;
    for(int i=1; i<=n; i++) {
        int x;
        scanf("%d", &x);
        int temp = 0;
        while(x%2 == 0) {
            temp++;
            x /= 2;
        }
        if(temp == 0)
            ans1++;
        if(temp > 1)
            ans2++;
        num[temp]++;
    }
    if(ans1 <= ans2) {
        printf("Yes\n");
        return 0;
    }
    if(ans1 - ans2 == 1 && ans1+ans2 == n) {
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
}





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

using namespace std;

int main()
{
  int N, M; cin >> N >> M;
  vector<pair<int, int>> itv(M);
  for(int i = 0; i < M; i++)
    cin >> itv[i].second >> itv[i].first;
  sort(itv.begin(), itv.end());
  
  int ans = 0, t = 0;
  for(int i = 0; i < M; i++) {
    if(t <= itv[i].second) {
      ans++;
      t = itv[i].first;
    }
  }
  cout << ans << endl;
  
  return 0;
}
  

Measured memory_bytes: 1024
using System;
using System.Linq;

namespace ABC104B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().ToCharArray().ToList();
            if(S[0] != 'A')
            {
                Console.WriteLine("WA");
                return;
            }
            int count = 0;
            int cp = 0;
            for(var i = 2; i < S.Count -1; i++)
            {
                if(S[i] == 'C')
                {
                    count++;
                    cp = i;
                }
            }
            if(count != 1)
            {
                Console.WriteLine("WA");
                return;
            }

            for(var i=0; i < S.Count; i++)
            {
                if(i != 0 && i != cp && Char.IsUpper(S[i]))
                {
                    Console.WriteLine("WA");
                    return;
                }
            }
            Console.WriteLine("AC");
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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 mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};




int main(){
    int n,k;cin >> n >> k;
    vector<int> a(26,0);
    for (int i = 0; i < n; i++) {
        string s;cin >> s;
        a[s[0] - 'A']++;
    }
    int ans = 0;
    while(true){
        sort(RALL(a));
        if(a[k-1] == 0) break;
        ans++;
        for (int j = 0; j < k; j++) {
            a[j]--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    ll h, n;
    cin >> h >> n;
    vector<pair<int,int>>z(n);
    for (int i = 0; i < n; i++) {
        cin >> z.at(i).first >> z.at(i).second;
    }
    vector<int> dp(h+1);
    dp.at(0) = 0;
    for (int i = 1; i < h+1; i++) {
        int h = 1341398495;
        for (int j = 0; j < n; j++) {
            h = min(h, dp.at(max(0, i - z.at(j).first))+z.at(j).second);
        }
        dp.at(i) = h;
    }
    cout << dp.at(h) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <cctype>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>


using namespace std;
typedef long long ll;

ll a[100005];
int main()
{
    ll n,i,sum=0,k,c;
    scanf("%lld %lld %lld",&n,&c,&k);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+n+1);
    ll t=a[1]+k,m=1,ans=1;
    for(i=2;i<=n;i++)
    {
        if(a[i]>t||m==c)
        {
            ans++;
            t=a[i]+k;
            m=1;
        }
        else
        {
            m++;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
a = list(map(int, input().split()))
b = []
rainbow = 0
for i in range(N):
    if a[i] >= 3200:
        rainbow += 1
    else:
        b.append(a[i]//400)
color = set(b)
min = len(color)
max = min + rainbow
if rainbow == N:
    min = 1

print(str(min)+" "+str(max))


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;

int N;
int q[210000];
int dat[2][300000];   //偶数位置
int MA = 3e6;
int halfN;
int n;

class T{
public:
  int a;
  int b;
  int c;
  int d;
  int i;

  T(int aa, int bb, int cc, int dd, int ii):a(aa), b(bb), c(cc), d(dd), i(ii){}

};

bool comp(T p, T q){
  if(p.c < q.c) return false;
  else return true;
}

priority_queue<T, vector<T>, decltype(&comp)> pq(&comp);

void init(int n_, int* da){
  n = 1;
  while(n < n_) n *= 2;

  for(int i = 0; i < 2*n-1; i++){
    da[i] = MA;
  }
}

//k番目をaに変更
void update(int k, int a, int* da){
  k += n-1;
  da[k] = a;
  while(k > 0){
    k = (k-1)/2;
    da[k] = min(da[k*2+1], da[k*2+2]);
  }
}

int query(int a, int b, int k, int l, int r, int* da){
  if(r <= a || b <= l) {
    //cout << 40 << endl;
    return MA;
  }
  if(a <= l && r <= b){
    //cout << 43 << " " << dat[k] << endl;
    return da[k];
  }
  else{
    int vl = query(a, b, k*2+1, l, (l+r)/2, da);
    int vr = query(a, b, k*2+2, (l+r)/2, r, da);
    //cout << "vl vr" << vl << " " << vr << endl;
    return min(vl, vr);
  }
}

void deal(){
  if(pq.empty())  return;
  T t = pq.top();
  cout << t.c << " " << t.d << " ";
  int s = t.a, e = t.b;
  pq.pop();

  int m1, m2;
  int i = t.i;
  m1 = query(s/2, q[t.c]/2, 0, 0, n, dat[i]);
  if (m1 < MA) {
    m2 = query((q[m1]+i)/2, (q[t.c]+i)/2, 0, 0, n, dat[1-i]);
    if(m2 < MA && s < q[t.c]) pq.push(T(s, q[t.c], m1, m2, i));
  }

  i = 1 - t.i;
  m1 = query((q[t.c]+1)/2, q[t.d]/2, 0, 0, n, dat[i]);
  if(m1 < MA){
    m2 = query((q[m1]+i)/2, (q[t.d]+i)/2, 0, 0, n, dat[1-i]);
    if(m2 < MA && q[t.c]+1 < q[t.d]) pq.push(T(q[t.c]+1, q[t.d], m1, m2, i));
  }

  i = t.i;
  m1 = query((q[t.d]+1)/2, e/2, 0, 0, n, dat[i]);
  if(m1 < MA){
    m2 = query((q[m1]+i)/2, (e+i)/2, 0, 0, n, dat[1-i]);
    if(m2 < MA && q[t.d]+1 < e) pq.push(T(q[t.d]+1, e, m1, m2, i));
  }

  deal();

  /*if(e <= s)  return ;

  //cout << 58 << endl;
  //cout << s/2 << " " << e/2 << endl;
  int m1 = query(s/2, e/2, 0, 0, n, dat[i]);
  if(m1 == MA)  return;
  //cout << 53 << endl; //cout << m1 << endl;
  int m2 = query((q[m1]+i)/2, (e+i)/2, 0, 0, n, dat[1-i]);
  if(m2 == MA)  return;
  //cout << 54 << " " << m2 << endl;
  pq.push(T(s, e, m1, m2));
  //cout << 66 << endl;
  //cout << q[m1] << " " << q[m2] << endl;
  deal(i, s, q[m1]);
  deal(1-i, q[m1]+1, q[m2]);
  deal(i, q[m2]+1, e);*/
}

int main(){
  cin >> N;
  init(N/2, dat[0]);
  init(N/2, dat[1]);
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    update(i/2, x, dat[i%2]);
    q[x] = i;
  }

  int m1 = query(0, N/2, 0, 0, n, dat[0]);
  int m2 = query((q[m1]+1)/2, N/2, 0, 0, n, dat[1]);
  pq.push(T(0, N, m1, m2, 0));
  deal();

/*
  for(int i = 0; i < N/2; i++){
    if(pq.empty())  break;
    T p = pq.top();
    cout << p.c << " " << p.d << " ";
    pq.pop();
  }
  */
  cout << endl;

  return 0;
}


Measured memory_bytes: 22516
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int K,S;
    cin>>K>>S;
    int ans=0;
    for(int i=0;i<=K;i++){
        for(int j=0;j<=K;j++){
            if(S-i-j<=K&&S-i-j>=0) ans++;
        }
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

D = []
change = sorted(change,key=lambda x:x[1],reverse=True)
for i in range(M):
    b,c = change[i]
    D += [c]*b
    if len(D) > N:
        break

A.sort()
tmp = sum(A)
for i in range(min(N,len(D))):
    diff = D[i] - A[i]
    if diff > 0:
        tmp += diff
    else:
        break
print(tmp)


Measured memory_bytes: 31332
N = int(input())
A = list(map(int,input().split()))
L = [0]*N
for i in range(N):
  L[i] = A[i]-i-1
L.sort()
S = 0
if len(L)%2 != 0:
  k = L[len(L)//2]
  for i in range(len(L)):
    S += abs(L[i]-k)
else:
  k = (L[len(L)//2-1]+L[len(L)//2])//2
  for i in range(len(L)):
    S += abs(L[i]-k)
print(S)


Measured memory_bytes: 25708
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1

n = readInt()
d = defaultdict(int)
for i in range(n):
	d[readInt()]+=1
ans = 0
for i in d.values():
	if i%2==1:
		ans+=1
print(ans)

Measured memory_bytes: 19916
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <algorithm>
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1 |1
#define lowbit(x) x&(-x)
#define LL long long
using namespace std;
const int maxn = 1e5;
char str[maxn+10];
int a[30];
int main()
{
    int len;
    while(~scanf("%s", str)) {
        memset(a, 0, sizeof(a));
        len = strlen(str);
        for(int i = 0;i < len;i++) {
            a[str[i]-'a' ]++;
        }
        for(int i = 0;i < 26;i++) {
            if(a[i] == 0) {
                printf("%c\n", 'a'+i);
                break;
            }
            if(i == 25) {
                printf("None\n");
            }
        }
    }
    return 0;
}


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

using namespace std;

const int mod = 1007050321;
const int base = 521;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int inf = 2e9;

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

    int a,b,c;
    cin >> a >> b >> c;
    swap(a,b);
    swap(a,c);
    cout << a << " " << b << " " << c;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

void printList(int *a, int n){
    for(int c = 0; c < n; c++){
        if(c == n-1){
            std::cout << a[c] <<std::endl;
        }else{
            std::cout << a[c] << " ";
        }
    }
}

int main(){

    int n;
    int tmp;
    std::cin >> n;

    int a[n];

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

    printList(a, n);


    for(int i = 1; i < n; i++){
        tmp = a[i];

        int j = i;
        
        while(j-1 >= 0 && a[j-1] > tmp){
            a[j] = a[j-1];
            j--;
        }
        a[j] = tmp;

        printList(a, n);
    }
}


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

int main () {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  ll x = n / (a + b);
  ans += x * a;
  n -= x * (a + b);
  if (n - a > 0) ans += a;
  else ans += n;
  cout << ans << endl;
}

Measured memory_bytes: 256