akhauriyash/Code-Regression huggingface dataset:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    s=SI()
    turn=0
    q=I()
    ortop=[]
    orbot=[]
    for i in range(q):
        query=list(input().rstrip().split(" "))
        if query[0]=="1":
            turn=(turn+1)%2
        else:
            x=int(query[1])
            if (x+turn)%2==1:
                ortop.append(query[2])
            else:
                orbot.append(query[2])
    if turn%2==0:
        s1="".join(list(reversed(ortop)))
        s2="".join(orbot)
        print(s1+s+s2)
    else:
        s1="".join(list(reversed(orbot)))
        s2="".join(ortop)
        s="".join(list(reversed(s)))
        
        print(s1+s+s2)
        
        
            
            
            
    

        
    
            
        

        
if __name__=="__main__":
    main()


Measured memory_bytes: 92004
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


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

    map<char, int> mp;
    rep (i, n) {
        char s;
        cin >> s;
        mp[s]++;
    }

    if (mp.size() == 3) cout << "Three" << endl;
    else cout << "Four" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (ll i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int N,M;
int A[300][300];
bool enable[300];
int cnt[300];
int idx;
int max_v;
bool flag;

int get_popular ()
{
    flag = false;
    fill (cnt, cnt + 300, 0);
    int sum = 0;
    REP(i,N) {
        REP(j,M) {
            if (enable[A[i][j]]) {
                cnt[A[i][j]]++;
                sum++;
                goto nxt;
            }
        }
        nxt:;
    }
    idx = -1;
    max_v = -1;
    REP(i,M) {
        if (max_v < cnt[i]) {
            max_v = cnt[i];
            idx = i;
        }
    }
    if (sum == N) {
        flag = true;
    }
    return idx;
}

int main ()
{
    cin >> N >> M;
    REP(i,N)REP(j,M) cin >> A[i][j];
    REP(i,N)REP(j,M) A[i][j]--;
    fill (enable, enable + 300, true);

    int idx = get_popular();
    int ans = max_v;
    REP(i,M) {
        enable[idx] = false;
        idx = get_popular();
        if (!flag) {
            break;
        } else {
            ans = min(ans, max_v);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>

int main()
{
	int i,j,t,a[5];
	
	scanf("%d %d %d %d %d",a,a+1,a+2,a+3,a+4);
	for(i=0;i<5;i++){
		for(j=i+1;j<5;j++){
			if(a[i]<a[j]){
				t=a[i];a[i]=a[j];a[j]=t;
			}
		}
	}
	
	printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
	return 0;
}

Measured memory_bytes: 596
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    string s, t;
    cin >> s >> t;

    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == t[i])ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
# 2019-11-17 10:52:21(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, *v = [int(x) for x in sys.stdin.read().split()]
    v.sort()

    ans = (1/2)**(n-1) * (v[0] + sum(v[i] * 2**(i-1) for i in range(1, n)))
    print(ans)


if __name__ == "__main__":
    main()


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


int main(){
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	ll tmp1, tmp2;
	if (n%2 == 0){
		tmp1 = a[n/2-1] + a[n/2];
		tmp2 = b[n/2-1] + b[n/2];
	}else{
		tmp1 = a[n/2];
		tmp2 = b[n/2];
	}
	cout << tmp2 - tmp1 + 1 << endl;
	return 0;
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;
 
template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }


int main()
{
    fastio();

    int x,y; cin >> x >> y;

    int ans = 0;
    if (x == 1 && y == 1) {
        ans += 400000;
    }

    ans += max(0, 4 - x) * 100000 + max(0, 4 - y) * 100000;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
map<pair<long long, long long>, long long> memo;
long long power(long long a,long long now) {
	if (memo[make_pair(a, now)]) return memo[make_pair(a, now)];
	long long ans = 1;
	pair<int, int> base = make_pair(a, now);
	while (now != 0) {
		if (now % 2 == 1) {
			ans *= a;
			ans %= MOD;
		}
		now /= 2;
		a *= a;
		a %= MOD;
	}
	return memo[base] = ans;
}
long long inv(long long a) {
	return power(a, MOD - 2);
}
long long permutation(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MOD;
	}
	return ans;
}
long long combination(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MOD;
		ans *= inv(i + 1);
		ans %= MOD;
	}
	return ans;
}
int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int xe = x2 - x1, ye = y2 - y1;
	cout << x2 - ye << " " << y2 + (x2 - x1) << " ";
	cout << x1 - (y2 - y1) << " " << y1 + (x2 - x1) << endl;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*
 
 5/5/2020
 
 21:37-
 
 */

const int MAX_N=1e6+1;
int A[MAX_N];
int N;

void solve() {
  /*
  REP(i,N)FORE(j,i+1,N) {
    LL a=accumulate(A+i,A+j,0LL);
    LL b=0;
    FOR(k,i,j) b^=A[k];
    if(a==b) dump(i,j);
  }*/
  LL res=0;
  int cur=0,l=0,r=0;
  while(l<N) {
    while(r<N&&(cur&A[r])==0) {
      cur|=A[r];
      ++r;
    }
    res+=r-l;
    cur&=~A[l++];
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N) cin>>A[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;

// dp = value;
//  i < N, j <= w
int N, W;
ll w[101];
ll v[101];
ll dp[101][100001];


int main () {

  cin >> N >> W;
  rep(i,N) cin >> w[i] >> v[i];
  
  
  
  rep(i,N){
    for(int j = 0; j <= W; j++){
      if(j - w[i] >= 0 ){
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
      } 
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
    }
  }

  cout << dp[N][W] << endl;

  return 0;
}

Measured memory_bytes: 81700
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val s = cin.next()

    var ans: Long = 0
    var black_count = 0
    for (c in s) {
        if (c == 'W') {
            ans += black_count
        } else {
            black_count += 1
        }
    }
    println(ans)

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=min((a), (b))

const int MOD=1000000007;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	s[0]=='9' || s[1]=='9' ? cout<<"Yes"<<'\n' : cout<<"No"<<'\n';
	return 0;
}


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


int main() {
  int n;
  cin>>n;
  ll monstar[n+2];
  ll yusya[n+1];
  ll sum=0;
  monstar[0]=-1;
  yusya[0]=-1;
  rep(i, n+1) cin>>monstar[i+1];
  rep(i,n) cin>>yusya[i+1];
  
  
  
  for(int i=n; i>=1; i--){
    
    sum+=min(monstar[i+1], yusya[i]);
    yusya[i]-=min(monstar[i+1], yusya[i]);
    sum+=min(monstar[i], yusya[i]);
    monstar[i]-=min(monstar[i], yusya[i]);
    //cout<<yusya[i]<<" "<<monstar[i]<<endl;
  }
  cout<<sum<<endl;
    
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vint vector<int> 
#define rep(i,a,n) for(i=a;i<n;i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int i,int n,vint &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    //int i;
    int S;
    cin>>S;
    //int x1,y1;
    int max=1000000000;
    int b=S%max;
    int a=(S-b)/max;
    if(a>=max){
        a=a-(max-a+1);
        b=S-max*a;
    }
    cout<<setprecision(9)<<0<<" "<<0<<" "<<1<<" "<<max<<" "<<(a+1)<<" "<<(max-b)<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long int gcd(long long int a,long long int b)
{
  if(b == 0)
  {
    return a;
  }
  return gcd(b,a%b);
}
int main()
{
  int n;
  cin >> n;
  vector<long long int> v,l,r;
  for(int i = 0;i < n;i++)
  {
    long long int a;
    cin >> a;
    v.push_back(a);
  }
  l.push_back(v.at(0));
  r.push_back(v.at(n - 1));
  for(int i = 1;i < n;i++)
  {
    l.push_back(gcd(l.at(i - 1),v.at(i)));
    r.insert(r.begin(),gcd(r.at(0),v.at(n - 1 - i)));
  }
  long long int max = r.at(1);
  for(int i = 1;i < n - 1;i++)
  {
    if(gcd(l.at(i - 1),r.at(i + 1)) > max)
    {
      max = gcd(l.at(i - 1),r.at(i + 1));
    }
  }
  if(l.at(n - 2) > max)
  {
    max = l.at(n - 2);
  }
  cout << max << "\n";

}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d", &n);
	int height[n + 1];
	int dp[n + 1];
	for(int i = 1; i <= n; i++){
		scanf("%d", &height[i]);
	}
	dp[1] = 0;
	dp[2] = abs(height[1] - height[2]);
	for(int i = 3; i <= n; i++){
		dp[i] = min(dp[i - 1] + abs(height[i - 1] - height[i]), dp[i - 2] + abs(height[i - 2] - height[i]));
	}
	printf("%d", dp[n]);
	return 0;
} 

Measured memory_bytes: 1024
#include <stdio.h>

int main (int argc,char **argv)
{
	int a,b,c;

	scanf("%d%d%d",&a,&b,&c);

	if((a < b) && (a < c) && (b < c))
	{
		printf("%d\n",a+b);
	}

	else if((a < b) && (a < c) && (c < b))
	{
		printf("%d\n",a+c);
	}

	else if((b < a) && (b < c) && (a < c))
	{
		printf("%d\n",b + a);
	}

	else if ((b < a) && (b < c) && (c < a))
	{
		printf("%d\n",b + c);
	}

	else if ((c < a) && (c < b) && (a < b))
	{
		printf("%d\n",c + a);
	}

	else
	{
		printf("%d\n",c + b);
	}

	return 0;


}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);

class comb{
	vector<ll> f,fr;
	ll MOD_;
	public:
	//a^(p-1) = 1 (mod p)(p->Prime numbers)
	//a^(p-2) = a^(-1)
	ll calc(ll a,ll b,ll p){//a^(b) mod p   
		if(b==0)return 1;
		ll y = calc(a,b/2,p);y=(y*y)%p;
		if(b & 1) y = (y * a) % p;
		return y;
	}
	void init(ll n,ll mod){//input max_n
		MOD_ = mod;
		f.resize(n+1);
		fr.resize(n+1);
		f[0]=fr[0]=1;
		for(ll i=1;i<n+1;i++){
			f[i] = (f[i-1] * i) % mod;
		}
		fr[n] = calc(f[n],mod-2,mod);
		for(ll i=n-1;i>=0;i--){
			fr[i] = fr[i+1] * (i+1) % mod;
		}
	}
	ll nCr(ll n,ll r){
		if(n<0||r<0||n<r)return 0;
		return f[n] * fr[r] % MOD_ * fr[n-r] % MOD_;
	}
};


int main(){
	ll n,a,b;
	cin >> n >> a >> b;
	comb co;
	ll ans = (co.calc(2,n,MOD)+MOD-1)%MOD;
	ll x = 1 , y= 1;
	FOR(i,0,a){
		(x *= (n-i)) %= MOD;
		(x *= co.calc(i+1,MOD-2,MOD)) %= MOD;
	}
	FOR(i,0,b){
		(y *= (n-i)) %= MOD;
		(y *= co.calc(i+1,MOD-2,MOD)) %= MOD;
	}
	(x += y) %= MOD;
	cout << (ans-x+MOD)%MOD << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;cin>>k;
    k--;
    cout<<a[k]<<endl;
}




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

using namespace std;


int main(){
    int len_set1,len_set2;
    int temp;
    

    scanf("%d",&len_set1);
    vector<int> set_array1(len_set1);
    for(int i = 0; i < len_set1;i++){
        scanf("%d",&temp);
        set_array1[i] = temp;
    }

    scanf("%d",&len_set2);
    vector<int> set_array2(len_set2);
    for(int i = 0; i < len_set2;i++){
        scanf("%d",&temp);
        set_array2[i] = temp;
    }

    vector<int> intersection_set;
    set_difference(set_array1.begin(),set_array1.end(),
                set_array2.begin(),set_array2.end(),
                inserter(intersection_set,intersection_set.end()));

    for(auto itr = intersection_set.begin();itr!=intersection_set.end();itr++){
        printf("%d\n",*itr);
    }
    return 0;   
}



Measured memory_bytes: 5376
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

int main(){
    ll n,w;
    cin>>n>>w;
    vector<ll> a(n);
    for(auto &I:a){cin>>I;}
    sort(a.begin(),a.end());
    if(n==1){cout<<1<<endl; return 0;}
    vector<ll> A(n,0);
    A[0]=a[0];
    for(int i=1;i<n;i++){A[i]=A[i-1]; A[i]+=a[i];}
    vector<ll> dp(w+1,0);
    dp[0]=1;
    ll ans=0;
    if(A[n-2]<=w){ans++;}
    for(ll i=n-1;i>0;i--){
        for(ll t=w;t>=0;t--){
            if(t+a[i]<=w){dp[t+a[i]]+=dp[t]; dp[t+a[i]]%=MOD;}
        }
        for(ll t=0;t<=w;t++){
            if(t+(i==1?0LL:A[i-2])<=w && t+A[i-1]>w){ans+=dp[t]; ans%=MOD;}
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;
  int n = (int)s.size();

  ll ac = 0, ans = 0;
  rep(i, 0, n - 2) {
    if (s[i] == 'A')
      ac++;
    else
      ac = 0;

    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ans += ac;
      ac--;
      s[i + 2] = 'A';
      i++;
    }
  }

  cout << ans << endl;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ll a, b, k;
    cin >> a >> b >> k;
    cout << max(0LL, a - k) << " " << max(0LL, min(b - (k - a), b)) << endl;
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  int ans = 0;
  for (int i = 0; i < 1000; i++) {
    string t;
    int x = i;
    for (int j = 0; j < 3; j++) {
      t += '0' + x % 10;
      x /= 10;
    }
    int ti = 0;
    for (int j = 0; j < N; j++) {
      if (S[j] == t[ti]) {
        ti++;
        if (ti == 3) break;
      }
    }
    if (ti == 3) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        List<String> cities = new ArrayList<String>();
        List<Integer> scores = new ArrayList<Integer>();
        List<String> cityList = new ArrayList<String>();
        List<Integer> sortList;
        List<Integer> ansList = new ArrayList<Integer>();

        for (int i = 0; i < num; i++) {
            cities.add(sc.next());
            scores.add(sc.nextInt());
            if (!cityList.contains(cities.get(i))) {
                cityList.add(cities.get(i));
            }
        }

        Collections.sort(cityList);

        int maxIndex, tmp;
        for (String c : cityList) {
            sortList = new ArrayList<Integer>();
            for (int i = 0; i < cities.size(); i++) {
                if (cities.get(i).equals(c)) {
                    sortList.add(i);
                }
            }

            for (int i = 0; i < sortList.size() - 1; i++) {
                maxIndex = i;
                for (int j = i + 1; j < sortList.size(); j++) {
                    if (scores.get(sortList.get(maxIndex)) < scores.get(sortList.get(j))) {
                        maxIndex = j;
                    }
                }
                tmp = sortList.get(i);
                sortList.set(i, sortList.get(maxIndex));
                sortList.set(maxIndex, tmp);
            }
            ansList.addAll(sortList);

        }

        for (Integer ans : ansList) {
            System.out.println(ans + 1);
        }
    }
}

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

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

#define MOD 1000000007
int memo[3030];

int dp(int n){
	if(n == 1 || n == 2) return 0;
	if(n == 0) return 1;
	if(memo[n] != -1) return memo[n];
	int ans = 0;
	for(int i = 3;i <= n;i++){
		ans += dp(n-i);
		ans %= MOD;
	}
	return memo[n] = ans;
}

signed main(){
	int s;
	cin >> s;
	memset(memo, -1, sizeof(memo));
	cout << dp(s) << endl;
	return 0;
}


Measured memory_bytes: 3652
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }



int main() {
    int a, b;
    cin >> a >> b;
    if(a%2==1&&b%2==1) {
        print("Odd");
    } else {
        print("Even");
    }
    return 0;
}


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

int main() {
  int A, B, C, X, Y, ans;
  cin >> A >> B >> C >> X >> Y;
  if (A + B <= 2 * C) {
    ans = A * X + B * Y;
  }
  else if (X >= Y && A <= 2 * C) {
    ans = C * 2 * Y + A * (X - Y);
  }
  else if (X < Y && B <= 2 * C) {
    ans = C * 2 * X + B * (Y - X);
  }
  else if (X >= Y && A > 2 * C) {
    ans = C * 2 * X;
  }
  else if (X < Y && B > 2 * C) {
    ans = C * 2 * Y;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8

from collections import Counter

PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
II = lambda: int(input())
MI = lambda: map(int, input().split())

def factorization_pow(n):
    facts = Counter()
    for i in range(2, n + 1):
        for p in PRIMES:
            while i % p == 0:
                facts[p] += 1
                i = i // p
    return facts

C2 = lambda n: n * (n-1) // 2

def main():
    N = II()
    f = factorization_pow(N)
    LC = lambda v: len(list(filter(lambda x: x >= v, f.values())))
    return LC(74) + LC(24) * (LC(2) - 1) + LC(14) * (LC(4) - 1) + C2(LC(4)) * (LC(2) - 2)

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 3316
n = int(input())
Red = []
Blue = []
for i in range(n):
  Red.append(list(map(int, input().split())))
for i in range(n):
  Blue.append(list(map(int, input().split())))
Blue.sort(key=lambda x:x[0])
Red.sort(key=lambda x:x[1], reverse=True)

counter = 0
i = 0
while i < len(Blue):
  for j in range(len(Red)):
#    print(Blue[i], Red[j])
    if Blue[i][1] > Red[j][1] and Blue[i][0] > Red[j][0]:
#      print("removed", Blue[i], Red[j])
      Blue.remove(Blue[i])
      Red.remove(Red[j])
      counter += 1
      break
  else:
    i += 1
print(counter)

Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		string s;
		cin>>s;
		int n=s.size();
		int a[n];
		memset(a,0,sizeof(a));
		int l=0,r=0;
		for(int i=0;i<n;i++){
			if(i!=n-1&&s[i]=='R'&&s[i+1]=='L'){
				a[i]=r/2+1;
				a[i+1]=r/2+r%2;
			}
			if(s[i]=='R'){
				r++;
			}
			else 
			r=0;
		}
		for(int i=n-1;i>=0;i--){
			if(i!=0&&s[i]=='L'&&s[i-1]=='R'){
				a[i]+=l/2+1;
				a[i-1]+=l/2+l%2;
			}
			if(s[i]=='L')
			l++;
			else
			l=0;
		}
		for(int i=0;i<n;i++)
		cout<<a[i]<<" ";
	}
	return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);  

ll a, b, n; 
ll maxi=-1;

bool cal(ll x){
  ll tmp = a*x/b - a*(x/b);
  //cout << x << ' ' << tmp << endl;
  //if(n<tmp) return false;
  maxi = max(tmp, maxi);
  return maxi==tmp;
}


int main(){
  cin >> a >> b >> n;
  ll lb=-1, ub=n+1;
  while(ub-lb>1){
    ll mid=(ub+lb)/2;
    if(cal(mid)) lb=mid;
    else ub = mid;
  }
  cout << maxi << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int a[m];long int sum=0,x;
  for(int i=0;i<m;i++){cin>>a[i];sum+=a[i];}
  x=n-sum;
  if(x<0)cout<<"-1";
  else cout<<x;
  cout<<endl;
}
  

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

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

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


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

    cin >> N >> Q >> S;

    vector<int> s(N + 1, 0);

    for (int i=0;i<N;++i) {
        if (i+1<N && S[i] == 'A' && S[i+1] == 'C') s[i+1] = s[i] + 1;
        else s[i+1] = s[i];
    }

    for (int q=0;q<Q;++q) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        cout << (s[r] - s[l]) << endl;
    }

}

Measured memory_bytes: 1408
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val S = readLine()!!

    val ans = (1..N-1).map {
        val c1 = S.substring(0,it).toCharArray()
        val c2 = S.substring(it).toCharArray().asList()
        c1.intersect(c2).size
    }.max()
    println(ans)
}

Measured memory_bytes: 38040
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        System.out.println(sc.nextInt() + sc.nextInt() / 2);
    }
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n,m; cin >> n >> m;
    VI ans(n,0);
    REP(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        ans[a]++; ans[b]++;
    }
    REP(i,n) out(ans[i]);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  int N,M,Q;
  cin>>N>>M>>Q;
  int A[510][510]={0};
  int L,R;
  rep(i,M){
    cin>>L>>R;
    A[L][R]++;
  }
  rep(i,N+1) rep(j,N+1) A[i][j+1]+=A[i][j];
  rep(i,N+1) rep(j,N+1) A[i+1][j]+=A[i][j];
  rep(i,Q){
    int p,q;
    cin>>p>>q;
    cout<<A[q][q]-A[p-1][q]-A[q][p-1]+A[p-1][p-1]<<endl;
  }
}

Measured memory_bytes: 1920
#include <iostream>

int main()
{
	int n;
	std::cin >> n;
	
	int x = n / 1.08;
	while (x * 1.08 < n) x++;
	if (static_cast<int>(x * 1.08) != n)
		std::cout << ":(" << std::endl;
	else
		std::cout << x << std::endl;
	
	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr uint64_t INF = 1e18;

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

  int N;
  cin >> N;
  vector<int> A(N,0);
  for (auto& a : A) {
    cin >> a;
  }
  int32_t cnt = 0;
  for (int i = 0; i < N; i++) {
    if ((i + 1) % 2 == 1 && A[i] % 2 == 1) {
      cnt++;
    }
  }
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 3648
import java.util.*;
// import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // StringBuilder sb = new StringBuilder();

        int num_a = sc.nextInt();

        ArrayList<Integer> array_a = new ArrayList<>();
        for (int i = 0; i < num_a; i++) {
            int tmp = sc.nextInt();
            array_a.add(tmp);
        }

        int num_b = sc.nextInt();

        ArrayList<Integer> array_b = new ArrayList<>();
        for (int i = 0; i < num_b; i++) {
            int tmp = sc.nextInt();
            array_b.add(tmp);
        }

        for (int i = 0; i < array_a.size() && i < array_b.size(); i++) {
            if (array_a.get(i) > array_b.get(i)) {
                System.out.println(0);
                sc.close();
                return;
            } else if (array_a.get(i) < array_b.get(i)) {
                System.out.println(1);
                sc.close();
                return;
            }
        }

        if (array_a.size() >= array_b.size()) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }

        // System.out.print(sb);
        
        sc.close();
    }
}



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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

ll five(ll n) { return n * n * n * n * n; }

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

  double x;
  cin >> x;
  vector<double> plus(200);
  REP(i, 200) { plus[i] = five(i); }

  vector<double> minus(200);
  REP(i, 200) { minus[i] = five(i) * -1; }

  bool can = false;
  REP(i, 200) {
    REP(j, 200) {
      if (plus[i] - plus[j] == x) {
        cout << i << " " << j << "\n";
        can = true;
      }
      if (can) {
        break;
      }
    }
    if (can) {
      break;
    }
  }

  if (!can) {
    REP(i, 200) {
      REP(j, 200) {
        if (plus[i] - minus[j] == x) {
          cout << i << " " << -1 * j << "\n";
          can = true;
        }
        if (can) {
          break;
        }
      }
      if (can) {
        break;
      }
    }
  }
}


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

using namespace std;

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

    vector<int> hs = vector<int>(n);
    cin >> hs[0];
    int maxH = 0;
    int c = 1;
    for (int i = 1; i < n; i++) {
        cin >> hs[i];
        if (hs[maxH] <= hs[i]) {
            c++;
        }
        if (hs[maxH] < hs[i]){
            maxH = i;
        }
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
using namespace std;
int main() {
	int n;
	int a[100010];
	int dp[100010] = { 0 };
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[1] = abs(a[1] - a[0]);
	for (int j = 2; j < n; j++) {
		if (abs(a[j] - a[j - 1]) + dp[j - 1] <= abs(a[j] - a[j - 2]) + dp[j - 2]) {
			dp[j] = abs(a[j] - a[j - 1]) + dp[j - 1];
		}
		else {
			dp[j] = abs(a[j] - a[j - 2]) + dp[j - 2];
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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


signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string s; cin >> s;
    string ans;
    REP(i, (int)s.length())
    {
        if(s[i] == 'B' && !ans.empty()) ans.pop_back();
        else if(s[i] != 'B') ans.push_back(s[i]);
    }
    cout << ans << endl;

/* C
    int N; cin >> N;
    vi a(N); REP(i, N) cin >> a[i];
    int ans = INF;
    for(int i = -100; i <= 100; i++)
    {
        int cost = 0;
        REP(j, N)
        {
            cost += (a[j] - i) * (a[j] - i);
        }
        chmin(ans, cost);
    }
    cout << ans << endl;
*/



}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    ll ans = 0;
    sort(all(l));
    
    rep(i, n - 2) {
        reps(ii, i + 1, n - 1) {
            int p = lower_bound(all(l), l[i] + l[ii]) - l.begin();
            ans += max(p - (ii + 1), 0);
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
    int n;
    cin >> n;
    map <long long, int> mp;
    long long sum = 0;
    mp[sum]++;
    rep (i, n) {
        int a;
        cin >> a;
        sum += a;
        mp[sum]++;
    }

    long long ans = 0;
    for (auto i : mp) {
        int tmp = i.second - 1;
        ans += 1LL * tmp * (tmp + 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

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


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

int main(){

  int n, x, xi, ans;
  cin >> n >> x >> xi;

  ans = abs(x-xi);

  for(;--n;){
    cin >> xi;
    ans = gcd(ans, abs(x-xi));
    //cout << ans << endl;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>

using namespace std;
typedef long long ll;

int main()
{
	int X, Y, A, B, C;
	ll p[100000];
	ll q[100000];
	ll r[100000];
	
	scanf("%d %d %d %d %d", &X, &Y, &A, &B, &C);
	for(int i = 0; i < A; i++){
		scanf("%lld", &p[i]);
	}
	for(int i = 0; i < B; i++){
		scanf("%lld", &q[i]);
	}
	for(int i = 0; i < C; i++){
		scanf("%lld", &r[i]);
	}
	
	sort(p, p+A, std::greater<int>());
	sort(q, q+B, std::greater<int>());
	sort(r, r+C, std::greater<int>());
	
	ll pq[200000];
	for(int i = 0; i < X; i++){
		pq[i] = p[i];
	}
	for(int i = 0; i < Y; i++){
		pq[i+X] = q[i];
	}
	
	sort(pq, pq+X+Y);
	
	ll ans = 0;
	int c = 0;
	for(int i = 0; i < X + Y; i++){
		if(c < C && pq[i] < r[c]){
			ans += r[c];
			c++;
		}
		else{
			ans += pq[i];
		}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e9+7;

int N, M;
vector<pair<int, int> > key;
ll DP[(1<<15)];

ll solve(int S){
    if(DP[S] > -1) return DP[S];
    DP[S] = big;
    int tmpS;
    for(int i=0;i<N;++i){
        if((S&(1<<i))!=0){
            for(int j=0;j<M;++j){
                if((key[j].fi&(1<<i))!=0){
                    tmpS = S;
                    for(int k=0;k<N;++k){
                        if(key[j].fi&(1<<k)){
                            if(tmpS&(1<<k)){
                                tmpS -= (1<<k);
                            }
                        }
                    }
                    DP[S] = min(DP[S], solve(tmpS) + key[j].se);
                }
            }
        }
    }
    return DP[S];
}

int main() {
    for(int i=0;i<(1<<15);++i){
        DP[i] = -1;
    }
    DP[0] = 0;
    cin>>N>>M;
    int a, b, c;
    int tmpkey;
    for(int i=0;i<M;++i){
        cin>>a>>b;
        tmpkey = 0;
        for(int j=0;j<b;++j){
            cin>>c;
            c--;
            tmpkey += (1<<c);
        }
        key.push_back(mp(tmpkey, a));
    }
    ll ans = solve((1<<N)-1);
    if(ans==big) cout<<-1<<endl;
    else cout<<ans<<endl;
}


Measured memory_bytes: 640
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  int M = sc.nextInt();
  int[] a = new int[2*M];
  for(int i = 0;i < 2*M;i++){
    a[i] = sc.nextInt();
  }
  for(int i = 0;i < N;i++){
    int ans = 0;
    for(int j = 0;j < 2*M;j++){
      if(a[j] == i+1)ans++;
    }
    System.out.println(ans);
  }
}}


Measured memory_bytes: 24148
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  rep(i,n) cin>>h[i];
  int mx=h[0];
  for(int i=1;i<n;i++){
    mx=max(mx,h[i]);
    if(h[i]<=mx-2){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3776