akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll maxx = 4004, maxn = 2e5 + 20, mod = 1e9 + 7, gaam = 2001;

ll dp[maxx][maxx], fac[maxn], a[maxn], b[maxn], n;

ll pw(ll a, ll b)
{
	if (!b) return 1ll;
	ll x = pw(a, b / 2);
	x = (x * x) % mod;
	if (b % 2) x = (x * a) % mod;
	return x;
}

ll sel(ll a, ll b)
{
	ll x = 1ll;
	x = (x * fac[a]) % mod;
	x = (x * pw(fac[b], mod - 2)) % mod;
	x = (x * pw(fac[a-b], mod - 2)) % mod;
	return x;
}




int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	fac[0] = 1ll;
	for(ll i = 1; i < maxn; i++) fac[i] = (fac[i - 1] * 1ll * i) % mod;
	cin >> n;
	for(ll i = 0; i < n; i++) cin >> a[i] >> b[i], dp[-a[i] + gaam][-b[i] + gaam] += 1;
	for(ll i = -gaam; i <= gaam; i++)
		for(ll j = -gaam; j <= gaam; j++)
	//		if (dp[i + gaam][j + gaam] == 0)
				dp[i + gaam][j + gaam] = (dp[i + gaam][j + gaam] + ((i + gaam) ? dp[i-1 + gaam][j + gaam] : 0ll) 
															 + ((j + gaam) ? dp[i + gaam][j-1 + gaam] : 0ll)) % mod;
//			cout << i << " " << j << "   " << dp[i + gaam][j + gaam] << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i++) ans = (ans + dp[a[i] + gaam][b[i] + gaam]) % mod, 
							   ans = (((ans - sel(a[i]*2 + b[i]*2, a[i]*2)) % mod) + mod) % mod;
	ans = (ans * pw(2, mod - 2)) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 130176
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,c=0;
    cin>>n;
    while(n)
    {
        int x=n%10;
        if(x==7)
        {
            c=1;
            cout<<"Yes"<<endl;
            break;
        }
        n=n/10;
    }
    if(c==0)
    {
        cout<<"No"<<endl;

    }
}


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

using namespace std;

int main()
{
    int A, B, C, X;
    cin>>A>>B>>C>>X;
    int ans = 0;
    for(int i = 0; i <= A; ++i)
        for(int j = 0; j <= B; ++j)
            for(int k = 0; k <= C; ++k)
            {
                int tmp = i * 500 + j * 100 + k * 50;
                if(tmp == X)
                    ans++;
            }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define parity(n)               __builtin_parity(n)
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define endl                    "\n"
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;


void solve()
{

    ll a;
    long double b;
    cin>>a>>b;
    ll ans=(100*b+0.5);
    ans=(ans*a)/100;
    cout<<(ll)ans<<endl;
}

int32_t main()
{
    FAST_IO();
    //TEST_CASES()
        solve();
}




Measured memory_bytes: 3724
def f(n, s, max)
  # s????????????max?????????
  max_min = ((2*s/n.to_f+n-1)/2)
  if n == 1
    # n=1?????¨??????s???????????´??°?????????????????????0???????????????
    if max >= s and s != 0
      return 1
    else
      return 0
    end
  elsif max < max_min
    return 0
  else
    result = 0
    max = s if s < max
    for i in (max_min.ceil)..max
      result += f(n-1, s-i, i-1)
    end
    return result
  end
end
while (n, x = gets.split(" ").map(&:to_i)) != [0,0]
  puts f(3, x, n)
end

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

int n, m;
int a[1000];

int main() {
	
	while (cin >> n >> m) {
		if (!n) break;
		for (int i = 0; i < n; i++) cin >> a[i];
		int ans = -1;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (a[i] + a[j] <= m) {
					ans = max(ans, a[i] + a[j]);
				}
			}
		}
		
		if (ans == -1) { cout << "NONE" << endl; }
		else { cout << ans << endl; }
	}
	return 0;
}

Measured memory_bytes: 3020
#include <iostream>
#include <set>

using namespace std;

int main() {

    int N, L, a[1000000];

    cin >> N >> L;

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

    //solve
    multiset<int> ms;

    for (int i = 0; i < L; i++) {
        ms.insert(a[i]);
    }

    cout << *ms.begin();

    for (int i = L; i < N; i++) {
        ms.insert(a[i]);
        ms.erase(ms.find(a[i - L]));
        cout << ' ' << *ms.begin();
    }

    cout << endl;
}


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

int main()
{
  int N;
  cin>>N;
  bool flag=true;
  vector<string> W(N);
  set<string> st;
  for(int i=0;i<N;i++){
    cin>>W[i];
    st.insert(W[i]);
  }
  if(st.size()!=N) flag=false;
  for(int i=0;i<N-1;i++){
    char finish = *(W[i].end()-1);
    char start = *(W[i+1].begin());
    if(start!=finish) {
      flag=false;
      break;
    }
  }
  cout<<((flag)? "Yes":"No")  ;
  
  
}
  

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

int main(){
  while(true){
    double a[100000], data, total=0;
    cin >> data;
    if(data == 0) break;
    for(int i=0; i<data; i++){
      cin >> a[i];
      total += a[i];
    }
    double ave = total/data;
    int n=0;
    for(int i=0; i<data; i++){
      if(a[i]<=ave) n++;
    }
    cout << n << endl;
  }
  return 0;
}



Measured memory_bytes: 3292
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int inf = 1e6;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  vector<int> v(inf+1);
  rep(i,n) v[a[i]]++;
  
  vector<bool> p(inf+1);
  rep(i,inf+1){
    if(v[i]==0) continue;
    if(v[i]>1) p[i]=true;
    for(int d=2*i;d<=inf;d+=i){
      p[d]=true;
    }
  }
  int ans = 0;
  rep(i,n) if(!p[a[i]]) ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 8008
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
	ll x;
	cin>>x;
	ll no_one = x/500;
	ll rem=x-(no_one*500);
	ll se = rem/5;
	ll ans = no_one*1000+se*5;
	cout<<ans<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds; 
using ll = long long int;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order() - 0 indexing
// order_of_key() - number of elements strictly smaller
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
//---------------------------------------GL HF------------------------------------------------------
// -------------------------------------ManavJ07----------------------------------------------------
signed main()
{
	fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--)
	{
		ll N;
		cin>>N;
		ll ar[N];
		cn(ar,N);
		ll val=0;
		for(ll i=0;i<N;i++)
			val^=ar[i];
		for(ll i=0;i<N;i++){
			cout<<(val^ar[i])<<" ";
		}
	}
}

Measured memory_bytes: 5084
import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List

main :: IO()
main = do
    ia <- getLine
    ib <- getLine
    ic <- getLine
    ix <- getLine
    printf "%d" $ length $ filter (== (read ix :: Integer)) [500*a+100*b+50*c|a <-[0..(read ia :: Integer)], b <-[0..(read ib :: Integer)], c <-[0..(read ic :: Integer)]]

Measured memory_bytes: 1020
N,M=map(int,input().split())
ab= [list(map(int, input().split())) for i in range(M)]

def root(val):
    if parent[val]==val:
        return val
    else:
        parent[val]=root(parent[val])
        return parent[val]

def same(x,y):
    return root(x)==root(y)

def unite(x,y):
    xr=root(x)
    yr=root(y)
    if xr==yr :return
    if rank[xr]<rank[yr]:
        parent[xr]=yr
    else:
        parent[yr]=xr
        if rank[xr]==rank[yr]:
            rank[xr]+=1
ct=0
for i in range(M):
    parent=list(range(N))
    rank = [0]*N
    for a,b in (ab[:i]+ab[i+1:]):
        unite(a-1,b-1)
    for j in range(1,N):
        if not same(0,j):
            ct+=1
            break
print(ct)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    bool ans = false;
    rep(i, s.size()) {
      if (s == t) {
        ans = true;
        break;
      }
      s = s.back() + s.substr(0, s.size() - 1);
    }
    if (ans) {
      cout << "Yes" << '\n';
    } else {
      cout << "No" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int x;
	
	cin >> x;

	if (x < 1200)
	{
		cout << "ABC" << endl;
	}
	else
	{
		cout << "ARC" << endl; 
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int memo[505][505];
int n, m, q;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m >> q;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    memo[a][b]++;
  }

  REP(i, n) FOR(j, i, n - 1) {
    memo[i][j + 1] += memo[i][j];
  }

  REP(i, n) RREP(j, n - 1) {
    memo[j][i] += memo[j + 1][i];
  }

  REP(i, q) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    cout << memo[a][b] << endl;
  }
}


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

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

    int ans = 1;
    for (int i = 1; i < n; i++)
    {
        if (s[i] != s[i - 1])
        {
            ans++;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3760
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, L;
    cin >> N >> L;

    int mn = INF;
    int base = N * (2 * L + N - 1) / 2;
    int ans = -1;

    for (int i = L; i <= L + N - 1; i++) {
        int next = base - i;
        if (abs(next - base) < mn) {
            mn = abs(next - base);
            ans = i;
        }
    }

    cout << base - ans << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  var chars = input.trim().split('\n');

  var alfa = '0ABCDEFGHIJKLMNOPQRSTUVWXYZ';

  var migi = Math.floor(chars[0]);
  var str = chars[1].split('');

  var nums = [];
  var ans = '';

  str.forEach(n => {
    var temp = alfa.indexOf(n);
    temp += migi;
    while (temp >= 27) {
      temp -= 26;
    }
    nums.push(temp);
  });

  nums.forEach(n => {
    ans += alfa[n];
  });

  console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7624
//package Beginner121;

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long b = s.nextLong();

//        System.out.println(func(a, b));
        System.out.println(func1(b) ^ func1(a - 1));
    }

    private static long func(long from, long num) {
        long xor = 0;
        for (long i = from; i <= num; i++) {
            xor ^= i;
        }
        return xor;
    }

    static long previousPowerOf2(long n)
    {
        // do till only one bit is left
        while ((n & n - 1) !=0)
            n = n & n - 1;	// unset rightmost bit

        // n is now a power of two (less than or equal to n)
        return n;
    }

    private static long func1(long num) {

        if(num <= 3) {
            long xor = 0;
            for (int i = 1; i <= num; i++) {
                xor ^= i;
            }
            return xor;
        } else {
            long num1 = num % 4;
            long from = num - num1;
            long xor = 0;
            for (long i = from; i <= num; i++) {
                xor ^= i;
            }
            return xor;
        }
    }
}

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

int main() {
  ll n; cin >> n; 
  vector<string>v(n);
  rep(i,n){
    cin >> v[i];
  }
  ll ac = 0;
  ll wa = 0;
  ll tle = 0;
  ll re = 0;
  rep(i,n){
    if(v[i]=="AC") ac++;
    if(v[i]=="WA") wa++;
    if(v[i]=="TLE") tle++;
    if(v[i]=="RE") re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
    
  return 0;
}





Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;
constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n,m,x;
    cin>n>m>x;
    int l=0,r=0;
    REP(i,m){
        int a;
        cin>a;
        if(a>x)r++;
        else l++;
    }
    cout<min(l,r)<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     string str;
     cin>>str;
     if(str[2]==str[3] && str[4]==str[5])
        cout<<"Yes"<<endl;
     else
        cout<<"No"<<endl;

}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(Math.abs(A-x)>Math.abs(B-x)){
			System.out.println("B");
		}else{
			System.out.println("A");
		}
	}
}

Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sct(tc) scanf("%lld",&tc)
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
int main()
{
   ll N,K,ar[1000],i,price=0;
   scanf("%lld %lld",&N,&K);
   for(i=0;i<N;i++)
   scanf("%lld",&ar[i]);
   sort(ar,ar+N);
   for(i=0;i<K;i++)
   price+=ar[i];
   printf("%lld\n",price);
}

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

int main() {
  string T;
  cin >> T;
  for(int i=0; i<T.size(); i++) {
    if(T.at(i)=='P'||T.at(i)=='D') {
      cout << T.at(i);
    }
    else {
      cout << 'D';
    }
  }
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#define PB push_back
#define MP make_pair
#define ll long long
#define ull unsigned long long 
#define pii pair<int,int>
#define all(X) (X).begin(),(X).end()
#define F first
#define S second
#define endl cout<<'\n';
#define __IO ios::sync_with_stdio(false),cin.tie(0);
using namespace std;
#define int long long
int dp[100005] , s[100005];
main(){
__IO
	int n , k;
	cin >> n >> k;
	for(int i=0 ; i<n ; ++i) cin >> s[i];
	for(int i=1 ; i<n ; ++i){
		dp[i] = LLONG_MAX;
		for(int j=1 ; j<=k && i-j>=0 ; ++j)
			dp[i] = min(dp[i-j] + abs(s[i] - s[i-j]) , dp[i]);
	}
	cout << dp[n-1] <<'\n';
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k; cin >> n >> k;
    vector<int> cnt(n, 0);
    while (k--) {
        int m; cin >> m;
        while (m--) {
            int v; cin >> v;
            v--;
            cnt[v]++;
        }
    }
    int ans = 0;
    for (int i = 0 ; i < n ; i++)
        if (cnt[i] == 0)
            ans++;
    cout << ans << '\n';

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

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

   int ans = 0;
   rep(l, 0, k + 1) rep(r, 0, k - l + 1) {
      if (l + r > n) continue;
      int d = k - l - r;
      int now = 0;
      vector<int> s;
      rep(i, 0, l) {
         now += a[i];
         s.push_back(a[i]);
      }
      rep(i, n - r, n) {
         now += a[i];
         s.push_back(a[i]);
      }
      sort(s.begin(), s.end());
      rep(i, 0, d) {
         if (i >= s.size()) break;
         if (s[i] >= 0) break;
         now -= s[i];
      }
      ans = max(ans, now);
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin >> s;
    if(s[1] == 'R') s[1] = 'B';
    else s[1] = 'R';
    cout << s;

    return 0;

}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	long h,w;
	cin>>h>>w;
	if(h==1||w==1)cout<<1<<"\n"s;
	else cout<<((h+1)/2)*((w+1)/2)+(h/2)*(w/2)<<"\n"s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1000001];
int main()
{
	int n,m,i;
	cin>>n>>m;
	for(i=1;i<=m;i++)
	{
		scanf("%d",&a[i]);
		n-=a[i];
	}
	if(n>=0)cout<<n;
	else cout<<-1;
	return 0;
}

Measured memory_bytes: 3764
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN=100005;

int ans,n,k;
bool vis[MAXN];
vector<int> E[MAXN];

int dfs(int u,int f){
	int re=0;
	for(int i=0;i<(int)E[u].size();i++){
		int v=E[u][i];
		if(v!=f){
			re=max(re,dfs(v,u));
		}
	}
	re++;
	if(vis[u]==0&&re>=k){
		re=0;
		ans++;
	}
	return re;
}

int main(){
	scanf("%d %d",&n,&k);
	int a;
	scanf("%d",&a);
	if(a!=1)
		ans=1;
	for(int i=2;i<=n;i++){
		scanf("%d",&a);
		E[a].push_back(i);
		E[i].push_back(a);
		if(a==1)
			vis[i]=1;
	}
	vis[1]=1;
	dfs(1,0);
	printf("%d\n",ans);
}

Measured memory_bytes: 13568
#pragma GCC optimize("O3")
/*{{{*/
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define assrt(...) debug(\
if (not (__VA_ARGS__)) \
    exit((cerr << __LINE__ << ": " << #__VA_ARGS__ << '\n', 0));\
)
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std; using ll = long long;
template < typename t > using V = vector< t >;
template < typename t, size_t s > using A = array< t, s >;
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{ while (a != b) cout << (*a++) << ' '; cout << '\n';}
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__ << ": "; print_range(__VA_ARGS__))
/*}}}*/

constexpr int nax = 2e5;

int n, tab[nax + 1];

bool rps()
{
    for (int i = 1; i <= n; ++i)
        if (tab[i] <= tab[i - 1])
            return false;
    return true;
}

bool spr(const int q)
{
    if (q == 1) return rps();

    stack< pair< int, int > > S;

    for (int i = 1; i <= n; ++i)
    {
        if (tab[i] > tab[i - 1])
            continue;
        while (not S.empty() and S.top().st > tab[i])
            S.pop();
        int v = tab[i];
        while (v >= 1 and not S.empty() and S.top().st == v and S.top().nd == q)
            S.pop(), --v;
        if (v == 0) return false;
        if (not S.empty() and S.top().st == v)
            ++S.top().nd;
        else S.push({v, 2});
    }
    return true;
}

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

    cin >> n;

    for (int i = 1; i <= n; ++i)
        cin >> tab[i];

    int lo = 1, hi = n;
    while (lo < hi)
    {
        int mi = (lo + hi) / 2;
        if (spr(mi))
            hi = mi;
        else
            lo = mi + 1;
    }

    print(lo);
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int main() {
  int n, k;
  while(cin >> n >> k, n||k) {
    int a[n];
    REP(i, n) cin >> a[i];
    int Ck = 1;
    REP(ii, n-k+1) {
      int tmp = 1;
      REP(jj, k) {
        tmp *= a[ii+jj];
      }
      Ck = max(tmp, Ck);
    }

    int ma = -1;
    REP(i, n) {
      REP(j, i) {
        swap(a[i], a[j]);
        int t = 1;
        REP(ii, n-k+1) {
          int tmp = 1;
          REP(jj, k) {
            tmp *= a[ii+jj];
          }
          t = max(tmp, t);
        }
        if (t >= Ck) {
          ma = max(ma, t-Ck);
        }
        swap(a[i], a[j]);
      }
    }
    if (ma == -1) {
      cout << "NO GAME" << endl;
    } else {
      cout << ma << endl;
    }
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int r;
	cin >> r;

	cout << r * r << "\n";


}


Measured memory_bytes: 256
n = int(input())
max = 100000
#dp[n] = min(1+dp[n-1], 1+dp[n-6], 1+dp[n-6**2],....1+dp[n-9],1+dp[n-9**2]...)
dp = [float("INF")] * (max+1)
dp[0] = 0
for i in range(1,max+1):
  power = 1
  while power <= i:
    dp[i] = min(dp[i], dp[i-power]+1)
    power *= 6
  power = 9
  while power <= i:
    dp[i] = min(dp[i], dp[i-power]+1)
    power *= 9
print(dp[n])


Measured memory_bytes: 3828
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;

lint res[15];
int n;
pi ps[100005];
set<pi> corner;
int w,h;
int main(){
  cin>>h>>w>>n;
  REP(i,n){
    scanf("%d%d",&ps[i].fr,&ps[i].sc);
    --ps[i].fr;--ps[i].sc;
    REP(y,3) REP(x,3) corner.insert({ps[i].fr-y,ps[i].sc-x});
  }
  sort(ps,ps+n);
  res[0]=(h-2)*(lint)(w-2);
  for(auto p:corner){
    if(p.fr>=0 && p.sc>=0 && p.fr+3<=h && p.sc+3<=w){
      int cnt=0;
      REP(y,3) REP(x,3) if(binary_search(ps,ps+n,mp(p.fr+y,p.sc+x))) ++cnt;
      ++res[cnt];
      --res[0];
    }
  }
  REP(i,10) cout<<res[i]<<endl;
  return 0;
}





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

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

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
p = LI()

p_sorted = sorted(p)

cnt = 0
for i in range(len(p)):
    if p[i] != p_sorted[i]:
        cnt += 1
if cnt ==2 or cnt == 0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 6476
#include <string>
#include <vector>
#include <map>
#include <iostream>
#define ll long long
using namespace std;


int main() {
    vector<int> deg(4,0);
    
    for(int i=1;i<=3;i++) {
        int u,v;
        cin>>u>>v;
        u--;
        v--;
        deg[u]++;
        deg[v]++;
    }
    
    for(int i=0;i<4;i++) {
        if (deg[i]>2) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    
}

Measured memory_bytes: 256
fn main() {
    let s = {
        let mut s = String::new(); // バッファを確保
        std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
        s.trim_right().to_owned() // 改行コードが末尾にくっついてくるので削る
    };

    let (n, m) = {
        let mut ws = s.split_whitespace(); // 空白区切りの単語に分解する
        let n: i32 = ws.next().unwrap().parse().unwrap(); // イテレータから値を取り出して整数に
        let m: i32 = ws.next().unwrap().parse().unwrap();
        (n, m)
    };

    println!("{} {}", n * m, m * 2 + n * 2);
}


Measured memory_bytes: 5032
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long
#define F first 
#define S second
#define P make_pair 

signed main(void){
    int ans=0;
    int n,m,q,p;
    cin>>n;
    int l[n];
    rep(i,0,n){ cin>>l[i];ans+=l[i];}
    p=0;
    q=LLONG_MAX;
    rep(i,0,n-1){
        p+=l[i];
        int t=max(p+p-ans,ans-p-p);
        if(t<q){
            q=t;
        }
    }
    
    cout<<q<<endl;
    
    
    
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
 os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif


#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"



const ll INF = 1e9;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll n;
	cin>>n;
	string s;cin>>s;
	ll ans = INF;
	vll pr(n);ll tot=0;ll i;
	for(i=0;i<n;i++){
		if(i==0){
			if(s[i]=='#')pr[i] = 1,tot++;
			else pr[i]=0;
		}
		else{
			if(s[i]=='.')pr[i] = pr[i-1];
			else pr[i] = 1+pr[i-1], tot++;
		}
	}
	ans = n-tot;
	for(i=0;i<n;i++){
		ll cu = pr[i];
		cu += (n-1-i) - (tot-pr[i]);
		ans= min(ans,cu); 
	}
	cout<<ans;
}


Measured memory_bytes: 2196
using System;
/*using System.Collections;
using System.Collections.Generic;*/
using System.Linq;

class Management
{
    static void Main(string[] args)
    {

        var people = int.Parse(Console.ReadLine());

        var number = Console.ReadLine().Split(' ');

        int[] intArray = number.Select(int.Parse).ToArray();

        int[] n = new int [people];

        foreach (int c in intArray)
        {
            n[c - 1]++;
        }

        foreach(int ans in n)
        {
            Console.WriteLine(ans);
        }

    }
}

Measured memory_bytes: 40144
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n;
    cin >> n;
    vector<pair<ll, int>> prime;
    for (ll i = 2; i * i <= n; ++i) {
        int cnt = 0;
        while(1) {
            if (n % i != 0) break;
            n /= i;
            ++cnt;
        }
        if (cnt != 0) {
            prime.emplace_back(i, cnt);
        }
    }
    if (n != 1) {
        prime.emplace_back(n, 1);
    }
    //for (auto p: prime) {
    //    cout << p.first << " " << p.second << endl;
    //}
    int ans = 0;
    for (auto p: prime) {
        ll prime_num = p.first;
        int prime_cnt = p.second;
        int next_num = 1;
        while(1) {
            if (prime_cnt < next_num) break;
            ++ans;
            prime_cnt -= next_num;
            ++next_num;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)

int main(){
    string S,T;
    ll A,B;
    string U;
   cin >> S >> T;
   cin >> A >> B;
   cin >> U;

   if(S == U){
       cout << A - 1 <<" "<< B << endl;
    
   }else if(T == U)
   {
       cout << A <<" "<< B - 1 << endl;
       
   }
   
    return 0;
}

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

using namespace std;

#define vi vector<int>
#define vii vector<vector<int>>

void testcase(){
    int n,k;
    cin>>n>>k;
    k--;
    string s;
    cin>>s;
    s[k] += 32;    
    cout << s << "\n";
}

int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    testcase();
    return 0;
}

Measured memory_bytes: 3572
class Budget
  def initialize
    @n = $stdin.gets.chomp.to_i
    @count = 0
    @sum = 0
    @result = []
    calc
  end

  def calc
    (@n.to_i*2).times do
      val = $stdin.gets
      @count += 1
      @sum += val.chomp.to_i

      if @count == 2
        @result.push(@sum)
        @sum = 0
        @count = 0
      end 
    end

    @result.each do |n| 
      if n.to_s.size > 80
        puts "overflow"
      else
        puts n
      end
    end
  end
end

b = Budget.new

Measured memory_bytes: 2324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int length = Integer.toString(n).length();
			int result = 0;

			if (1 < length) {
				result += 9;
			}
			if (3 < length) {
				result += 900;
			}
			if (5 < length) {
				result += 90000;
			}

			if (1 == length) {
				System.out.println(n);
				return;
			}
			if (3 == length) {
				result += n - 100 + 1;
			}
			if (5 == length) {
				result += n - 10000 + 1;
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 23892
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

typedef struct {
  vector<pair<uint32_t, uint32_t>> Node;
} TreeType;

int main() {
  string S;
  cin >> S;
  uint32_t flag = 0;
  for (auto itr = S.begin(); itr < S.end(); ++itr) {
    if (distance(S.begin(), itr) & 0x01) {
      if (*itr == 'R') flag = 1;
    } else {
      if (*itr == 'L') flag = 1;
    }
  }
  if (flag)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 2e9
using namespace std;
const int N=1e6+1;
const int mod=1e9+7;
ll fastexp(ll base,ll exp){
	base%=mod;
	ll ans=1;
	while(exp>0){
		if(exp&1){
			ans*=base;
			ans%=mod;
		}
		base*=base;
		base%=mod;
		exp/=2;
	}
	return ans;
}
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}
struct mnmx{
	int mn,mx;
};
mnmx merge(mnmx a,mnmx b){
	mnmx ans;
	ans.mn=min(a.mn,b.mn);
	ans.mx=max(a.mx,b.mx);
	return ans;
}
int arr[N];
mnmx segtree[4*N];
void build(int node,int i,int j){
	if(i==j){
		segtree[node].mn=arr[i];segtree[node].mx=arr[i];return;
	}
	int mid=(i+j)/2;
	build(2*node,i,mid);build(2*node+1,mid+1,j);
	segtree[node]=merge(segtree[2*node],segtree[2*node+1]);
}
mnmx query(int node,int i,int j,int l,int r){
	if((i>r)||(l>j)||(i>j)||(l>r)){
		mnmx identity;identity.mn=INF;identity.mx=-1;
		return identity;
	}
	if((i>=l)&&(j<=r)) return segtree[node];
	int mid=(i+j)/2;
	return merge(query(2*node,i,mid,l,r),query(2*node+1,mid+1,j,l,r));
}
int main() {
	int n,a,r,temp=0,temp2=0;
	cin >> n;
	cin >> a;
	int st=0,rep=0;
	for (int i = 1; i <= n; i++){
		cin >> arr[i];
	}
	build(1,1,n);
	r=1;
	for(int i = 1; i <= n-a+1; i++){
		r=max(r,i);
		while((arr[r]<arr[r+1])&&(r<n)) r++;
		if(r-i>=a-1) st++;
		else{
			if(i==1) continue;
			mnmx temp=query(1,1,n,i-1,i+a-1);
			if((temp.mn==arr[i-1])&&(temp.mx==arr[i+a-1])) rep++;
		}
	}
	int ans = n+1-(a+st+rep);
	if(st) ans++;
	cout << ans;
	return 0;
}

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

using namespace std;
#define ull unsigned long long
#define ll long long
const double inf = 2e9;
const int MAXN = 2e5 + 10;
vector<vector<pair<int, int>>> data(15, vector<pair<int, int>>());
int dp[(int)3e5+2][60][2];
ull mod=1e9+7;
vector<ull> arr;
void solve() {
    int n;
    cin>>n;
    arr.resize(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<60;j++){
            for(int k=0;k<2;k++){
                dp[i][j][k]+=dp[i+1][j][k];
                if(((arr[i]>>j)&1)==k) dp[i][j][k]++;
            }
        }
    }
    ull ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=0;j<60;j++){
            ull sdv=((ull)1<<j);
            int kek=((arr[i]>>j)&1);
            sdv%=mod;
            ans+=sdv*dp[i+1][j][1-kek];
            ans%=mod;
        }
    }
    cout<<ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n = 1;
    for (int i = 0; i < n; i++) solve();
    return 0;
}

Measured memory_bytes: 143232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			List<Integer> list = new ArrayList<>();
			for (int i = 2; i <= 13; i++) {
				list.add(i);
			}
			list.add(1);

			int a = in.nextInt(), b = in.nextInt();

			int idxA = list.indexOf((Integer)a);
			int idxB = list.indexOf((Integer)b);

			if (idxA < idxB) {
				out.println("Bob");
			} else if (idxA == idxB) {
				out.println("Draw");
			} else if (idxA > idxB) {
				out.println("Alice");
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    string yes = "Yes", no = "No";
    rep(i, n) {
        if(i&1) {
            if(s[i] == 'R') {
                cout << no << endl;
                return 0;
            }
        }
        else {
            if(s[i] == 'L') {
                cout << no << endl;
                return 0;
            }
        }
    }
    cout << yes << endl;
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll k, x;cin >> k >> x;
	cout << (500 * k >= x ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());
        int X = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());

        int result = 100000 * 5000 * 2;
        for (int i = 0; i <= 100000; i++) {
            result = Math.min(result, i * 2 * C + Math.max(0, X - i) * A + Math.max(0, Y - i) * B);

        }
        System.out.println(result);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b==c+d)cout<<"Balanced"<<endl;
    else if(a+b>c+d)cout<<"Left"<<endl;
    else cout<<"Right"<<endl;

    return 0;
}


Measured memory_bytes: 3596