akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

// http://arc075.contest.atcoder.jp/tasks/arc075_c

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using __gnu_pbds::tree;
using __gnu_pbds::null_type;
using __gnu_pbds::rb_tree_tag;
using __gnu_pbds::tree_order_statistics_node_update;

template<typename Key, typename T=null_type, typename Comp=less<Key>>
using order_stat_tree = tree<Key, T, Comp, /* key, value & compare function */
      rb_tree_tag, tree_order_statistics_node_update>;

int64_t arc075_c()
{
  size_t n;
  int64_t k;
  cin >> n >> k;
  vector<int64_t> a(n);
  cin >> a;

  for(auto & i: a) i -= k;
  DEBUG(a);

  order_stat_tree<pair<int64_t, size_t>> tr;
  // tr.insert(pair((int64_t)0, 0));

  int64_t out = 0, acc = 0;
  for(size_t i = 0; i < n; ++i)
  {
    acc += a[i];
    out += tr.order_of_key(make_pair(acc, n + 10));
    out += -1 < acc;
    tr.insert(make_pair(acc, i + 1));
  }

  return out;
}

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << arc075_c();

  return EXIT_SUCCESS;
}


Measured memory_bytes: 14336
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N;
	int cnt[210]={};
	
	cin >> N;
	for(int i=1;i<=N;i+=2)
	{
		for(int j=1;j<=i;j++)
		{
			if(i%j==0)
				cnt[i]++;
		}
	}
	
	int ans=0;
	for(int i=1;i<=N;i++)
	{
		if(cnt[i]==8)
			ans++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int K = sc.nextInt();
		int X = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for (int i = X - K + 1; i <= X + K - 1; i++) {
			sb.append(" ");
			sb.append(String.valueOf(i));
		}
		System.out.print(sb.toString().substring(1));
	}

	public static int[] judgeEven(int Num) {
		int ret[] = new int[2];
		ret[0] = Num / 2;
		ret[1] = ret[0];
		int amari = Num % 2;
		if (amari != 0) {
			ret[1]++;
		}
		return ret;

	}

	public static List<String[]> getRunLength(String str) {
		List<String[]> list = new ArrayList<String[]>();
		char back = 'm';
		for (int i = 0; i < str.length(); i++) {
			if (back != str.charAt(i)) {
				String[] hairetu = new String[2];
				hairetu[0] = String.valueOf(str.charAt(i));
				hairetu[1] = "1";
				list.add(hairetu);
				back = str.charAt(i);
			} else {
				String[] hairetu = list.get(list.size() - 1);
				hairetu[1] = String.valueOf(Integer.parseInt(hairetu[1]) + 1);
				list.set(list.size() - 1, hairetu);
			}
		}
		return list;
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

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

int main() {
  int n;
  cin >> n;
  bool f = false;
  for (int i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    f |= a % 2 == 1;
  }
  cout << (f ? "first" : "second") << endl;
  return 0;
}


Measured memory_bytes: 256
from copy import deepcopy
s = input()
n = len(s)
partitions = []

for i in range(1<<(n-1)):
    p = []
    k = 0
    for j in range(n):
        if i & 2**j:
            #print (bin(i), j, s[k:j+1])
            p.append(int(s[k:j+1]))
            k = j+1
    p.append(int(s[k:n]))
    partitions.append(p)
#print (partitions)
print (sum([sum(p) for p in partitions]))

Measured memory_bytes: 9268
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
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/gcd(a,b)*b;
}
 
int main(){
  ll a,b;
  cin>>a>>b;
  if(a==1||b==1){
    cout<<1<<endl;
    return 0;
  }
  cout<<(a*b+1)/2<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

  long long N,A,B;
  cin>>N>>A>>B;
  if((B-A)%2==0){
  
    cout<<(B-A)/2;
    return 0;
  }
  long long ansA=A-1;
  long long ansB=N-B;
  long long ans=0;
  if(ansA<ansB){
  
    ans+=ansA+1;
    A-=ansA;
    B-=ansA+1;
    ans+=(B-A)/2;
  }
  else{
  
    ans+=ansB+1;
    B+=ansB;
    A+=ansB+1;
    ans+=(B-A)/2;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int d[100010];

int main() {
	int k;
	cin >> k;
	rep(i, k) d[i] = INF;
	d[k] = 0; //kから始める

	deque<int> dq;
	dq.push_front(k);
	while (!dq.empty()) {
		int u = dq.front(); //前から出す
		dq.pop_front();
		int n0 = (u == k) ? k : (u * 10) % k; //uがkでなければ×10してmodk
		int n1 = (u + 1) % k; //uに１を足してmodk
		if (d[n0] > d[u]) { //×10した最短路
			d[n0] = d[u];
			dq.push_front(n0); //前に入れる
		}
		if (d[n1] > d[u] + 1) { //+1した最短路
			d[n1] = d[u] + 1;
			dq.push_back(n1); //後ろに入れる
		}
	}
	cout << d[0] << endl;
	return 0;
}

Measured memory_bytes: 896
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	var n = parseInt(tmp[0], 10);
	var m = parseInt(tmp[1], 10);

    var id = {}
  	for(var i = 1; i <= m; i++) {
      py = input[i].split(" ");
      var p = py[0];
      var y = py[1];

      if (!(p in id)) {
        id[p] = {};
      }
      id[p][y] = 0;
	}
    Object.keys(id).forEach(function (key) {
        var i = 1;
        Object.keys(id[key])
         .sort(function(a,b){
    		return a-b;
    	 })
         .forEach(function (key2) {
            id[key][key2] = i;
            i++;
        });
    });
    for(var i = 1; i <= m; i++) {
      py = input[i].split(" ");
      var p = py[0];
      var y = py[1];
      console.log(('000000'+p).slice(-6)+('000000'+id[p][y]).slice(-6));
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 80932
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

long long int solve(long long int n){
	if(n==2){return 3;}
	else if(n==4||n==6||n==9||n==11){return 2;}
	else{return 1;}
}

int main() {
	long long int n=1,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a;
	cout<<a*(a+1)/2;


	cout<<endl;
} 


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

int main(){
  ll s,c;
  cin >> s >> c;
  ll cc = 0;
  if( c%2 == 0 ){
    cc = c/2;
  }else{
    cc = c/2;
    c = 1;
  }
  
  if( cc >= s ){
    cout << ( s + cc )/2;
  }else{
    cout << min(s,cc) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    R = input(int)
    print(R * 2 * 3.14)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 9496
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    ll x[2], y[2];
    cin >> x[0] >> x[1] >> y[0] >> y[1];

    ll ans = -LINF;
    
    irep(i, 2) {
        irep(j, 2) {
            chmax(ans, x[i]*y[j]);
        }
    }
    cout << ans << endl;
    return 0;
} /*atcoder*/


Measured memory_bytes: 3628
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

// Union-Find 木 (Verified: AtCoder Typical Contest 001 B)
struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};

signed main() {
    int N, M; cin >> N >> M;
    vector<int> lang[100010];
    rep(i,0,N) {
        int k; cin >> k;
        rep(j,0,k) {
            int L; cin >> L; L--;
            lang[L].push_back(i);
        }
    }

    UnionFind uf(N);
    rep(i,0,M) {
        rep(j,0,(int)lang[i].size() - 1) {
            int p = lang[i][j], q = lang[i][j+1];
            // printf("i = %lld, p = %lld, q = %lld\n", i, p, q);
            uf.unite(p, q);
        }
    }

    int sz = uf.size(0);
    if(sz == N) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>

typedef struct {
  char gara;
  int kazu;
}card;

card b[36];
card s[36];

void bubble(card *b,int a) {
  int i,j;
  card z;
  for(i=0;i<a;i++){
    for(j=a-1;j>i;j--){
      if(b[j-1].kazu>b[j].kazu){
	z=b[j];
	b[j]=b[j-1];
	b[j-1]=z;
      }
    }
  }
  for(j=0;j<a;j++) {
    if(j>0) printf(" ");
    printf("%c%d",b[j].gara,b[j].kazu);
  }
  printf("\nStable\n");
}

void select(card *s,int a) {
  int i,j,small;
  card z;

  for(i=0;i<a;i++) {
    small=i;
    for(j=i;j<a;j++) {
      if(s[small].kazu>s[j].kazu) {
	small=j;
      }
    }
      z=s[i];
      s[i]=s[small];
      s[small]=z;
  }
  for(j=0;j<a;j++) {
    if(j>0) printf(" ");
    printf("%c%d",s[j].gara,s[j].kazu);
  }
  printf("\n");
}

void stable(card *b,card *s, int a) {
  int i,count=0;
  for(i=0;i<a;i++) {
    if(b[i].gara!=s[i].gara || b[i].kazu!=b[i].kazu) count++;
  }
  if(count==0) printf("Stable\n");
  else printf("Not stable\n");
}

int main() {
  int a,i;
  scanf("%d",&a);
  if(1<=a&&a<=36) {
    for(i=0;i<a;i++) {
      scanf(" %c%d",&b[i].gara,&b[i].kazu);
      s[i]=b[i];
    }
    bubble(b,a);
    select(s,a);
    stable(b,s,a);
  }
  return 0;
}
	



Measured memory_bytes: 2112
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	for (int i = A; i <= B; i++) {
		if (i % K == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
const ll MOD=1e9+7;

int main(){
    ll N,K;cin>>N>>K;K++;
    vector<ll> A(N);
    for(int i=0;i<N;++i) cin>>A[i];
    ll ans=0;
    for(int d=50;d>=0;--d){
        if(!(K&(1LL<<d))) continue;
        ll tmp=0;
        for(int e=50;e>=0;--e){
            ll mask=1LL<<e;
            ll num=0;
            for(int i=0;i<N;++i){
                if(A[i]&mask) ++num;
            }
            if(e>d){
                if(K&mask) tmp+=mask*(N-num);
                else tmp+=mask*num;
            }else if(e==d){
                tmp+=mask*num;
            }else{
                tmp+=mask*max(num,N-num);
            }
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4060
#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>;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// Sieve of Eratosthenes
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int n, k; cin>>n>>k;
  Sieve sieve(k);
  mint ans;
  vector<mint> d(k+1);
  for (int i = 1; i <= k; ++i) d[i] = mint(k/i).pow(n);
  for (int p : sieve.primes) {
    for (int i = p; i <= k; i += p) {
      d[i/p] -= d[i];
    }
  }
  for (int i = 1; i <= k; ++i) ans += d[i]*i;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4584
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int N; cin >> N;
	vector<long long> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	long long maxv = -1000000000;
	long long minv = a[0];
	for (int i = 1; i < N; i++) {
		maxv = max(maxv, a[i] - minv);
		minv = min(minv, a[i]);
	}
	cout << maxv << endl;
}

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

int main() {
  int N; cin >> N;
  int x {};
  set<int> s;
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    x ^= a;
    int m {};
    while ((a >> m & 1) == 0) m++;
    s.insert(m);
  }
  int c {};
  while (x >> c) c++;
  int ans {};
  for (int i = c - 1; i >= 0; i--) {
    if (x >> i & 1) {
      if (!s.count(i)) {
        ans = -1;
        break;
      }
      x ^= ((1 << (i + 1)) - 1);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  long long x,y;
  cin >> x >> y;
  long long a,b;
  a = min(x,y),b = max(x,y);
  if(b-a <= 1)cout << "Brown" << endl;
  else cout << "Alice" << endl;
  return 0;
}

Measured memory_bytes: 256
# ABC168d


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))
    from collections import deque
    INF = 10**12

    import heapq
    import sys

    input = sys.stdin.readline

    def dijkstra_heap(s, edge, n):
        # 始点sから各頂点への最短距離
        d = [INF] * n
        used = [True] * n  # True:未確定
        d[s] = 0
        used[s] = False
        edgelist = []
        frm = [-1]*n
        for a, b in edge[s]:
            heapq.heappush(edgelist, (a*(10**6)+b, -1))
        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            froom = minedge[1]
            minedge = minedge[0]
            # まだ使われてない頂点の中から最小の距離のものを探す
            if not used[minedge % (10**6)]:
                continue
            v = minedge % (10**6)
            d[v] = minedge // (10 ** 6)
            frm[v] = froom
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist, ((e[0]+d[v])*(10**6)+e[1], v))
        return (d, frm)

    n, m = map(int, input().split())
    edges = [list() for _ in range(n)]
    for _ in range(m):
        a, b = map(int, input().split())
        edges[a - 1].append((1, b - 1))
        edges[b - 1].append((1, a - 1))

    dist = dijkstra_heap(0, edges, n)
    #print(dist[0], dist[1])
   # print(graph.dist)
    # print(graph.frm)
    if INF in dist[0]:
        print('No')
        exit(0)
    print('Yes')
    for i in dist[1][1:]:
        print(i+1 if i+1 != 0 else 1)


if __name__ == '__main__':
    main()


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

#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "No\n";
    else cout << "Yes\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 1000010;
// cnt[i][0]->a_iの0の数
// cnt[i][1]->a_iの1の数
int cnt[60][2];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	rep(i, n) {
		rep(j, 60) {
			// bit演算
			// ビットa[i]にj番目のフラグが立っているかどうか
			cnt[j][(a[i] >> j) & 1]++;
		}
	}
	int ans = 0;
	repr(i,59) {
		ans = (ans * 2) % MOD;
		ans += cnt[i][0] * cnt[i][1] % MOD;
	}
	cout << ans % MOD << endl;
	return 0;
}


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

int main(){
  ll n,m,q;
  cin >> n >> m >> q;
  vector<ll>a(q),b(q),c(q),d(q);
  for(int i=0; i<q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  vector<ll>A(10);
  ll ans=0;
  for(int i=1; i<=m; i++){
   A[0]=i;
   for(int j=i; j<=m; j++){
     A[1]=j;
    for(int k=j; k<=m; k++){
      A[2]=k;
      for(int l=k; l<=m; l++){
        A[3]=l;
        for(int u=l; u<=m; u++){
          A[4]=u;
          for(int v=u; v<=m; v++){
            A[5]=v;
            for(int w=v; w<=m; w++){
              A[6]=w;
              for(int x=w; x<=m; x++){
                A[7]=x;
                for(int y=x; y<=m; y++){
                  A[8]=y;
                  for(int z=y; z<=m; z++){
                    A[9]=z;
                    ll count = 0;
                    for(int o=0; o<q; o++){
                      if(A[b[o]-1]-A[a[o]-1]==c[o]) count+=d[o];
                    }
                    ans=max(ans,count);
                  }
                }
              }
            }
          }
        }
      }
    }
   }
  }
                  
  
  cout << ans << endl;
  
}
  
  


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  ll a,b,k;
  cin >> a>>b>>k;
  if(k>=a){
    k-=a;
    a=0;
  }else{
    a-=k;
      cout<<a<<" "<<b<<endl;
      return 0;
  }
  if(k<=b)b-=k;
  else b=0;
  cout<<a<<" "<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation)

N = int(input())
A = list(map(int, input().split()))
print(c(N, A))

Measured memory_bytes: 18132
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	int f = 0 ;
	for(int i = 0; i < s.length() ; i++){
		if(i&1){
			if(s[i] == 'R'){
				f = 1;
				break;
			}
		}
		else{
			if(s[i] == 'L'){
				f = 1;
				break;
			}
		}
	}
	if(f)
		cout<<"No\n";
	else
		cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 998244353;
const long long int INF = 1e18;

long long int N,res=INF;



int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    for(long long int i = 1; i*i <= N; i++){
        if(N%i==0){res=min(res,i+N/i-2);}
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

double dist(int i, int j, int x[], int y[])
{
	double dx = x[j]-x[i];
	double dy = y[j]-y[i];
	return sqrt(dx*dx+ dy*dy);
}

void calc(int n, int x[], int y[])
{
	vector<int> indices;
	double sum=0, p=1;

	indices.resize(n);
	for(int i=0; i<n; i++) indices[i] = i;

	do{
		for (int i=0; i<n-1; i++){
			sum += dist(indices[i], indices[i+1], x, y); 
		}
	}while(next_permutation(indices.begin(), indices.end()) );

	for(int i=2; i<=n; i++) p*=i;

	printf("%lf\n", sum/p);
}

int main()
{
	int  n;
	int x[8], y[8];

	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%d %d", &x[i], &y[i]);
	}

	calc(n, x, y);

	return 0;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int pow(int a, int n) {
    int ret = 1, mul = a;
    while (n > 0) {
        if (n & 1) { ret *= mul; }
        mul *= mul;
        n >>= 1;
    }
    return ret;
}

std::map<long long, int> get_prime_factors(long long n) {
    std::map<long long, int> ret;
    for (long long i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) { ret[n] = 1; }
    return ret;
}

int N, P;
signed main() {
    cin >> N >> P;
    auto mp = get_prime_factors(P);
    int ans = 1;
    for (auto p:mp) { ans *= pow(p.first, p.second / N); }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

std::string s;

int main()
{
    std::cin >> s;
    std::sort(s.begin(), s.end());
    do
    {
        if (s == "abc")
        {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    } while (std::next_permutation(s.begin(), s.end()));
    std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

const int INF = 1<<30;

int main(){
    string s;
    cin >> s;
    int ans = INF;
    rep(j, 2){
        int si = j;
        int sum = 0;
        rep(i,s.size()){
            if (s[i] == si+'0') sum++;
            si = !si;
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3728
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
#define inf 0x3f3f3f3f
#define N 200010
using namespace std;
int a[N],n,k;

bool check(int m)
{
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]%m==0)
            cnt+=a[i]/m-1;
        else
            cnt+=a[i]/m;
    }
    return cnt<=k;
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
    {
        scanf("%d",a+i);
    }
    int l=1,r=1e9+1;
    while(l<r)
    {
        int m=(l+r)>>1;
        if(check(m))
            r=m;
        else
            l=m+1;
    }
    printf("%d\n",r);
	return 0;
}


Measured memory_bytes: 4508
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n;
	long long i,l,j,k,s=0;
	cin>>n;
	l=n.length();
	for(i=0;i<l;i++){
		s+=(n[i]-48);
	}
//	cout<<s<<endl;
	if(s%9==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3668
n,m = gets.split.map(&:to_i)

ansl = 1
ansr = n
m.times do
    l,r = gets.split.map(&:to_i)
    ansl = l if ansl < l
    ansr = r if ansr > r
end

puts ansl <= ansr ? ansr - ansl + 1 : 0

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll a[200];
    ll N;
    cin>>N;
    rep(i, N) cin>>a[i];
    ll Minim=400000000;
    reps(i, -100, 101){
        ll count=0;
        rep(j,N){
            count+=(a[j]-i)*(a[j]-i);
        }
        Minim=min(Minim, count);
    }
    cout<<Minim<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int x[100005],y[100005],step[100005];
int main()
{
	int n,a[3];cin>>n>>a[0]>>a[1]>>a[2];
	for(int i=0;i<n;++i)
	{
		char s[3];
		cin>>s;
		x[i]=s[0]-'A';y[i]=s[1]-'A';
	} 
	for(int i=0;i<n;++i)
	{
		if(a[x[i]]>a[y[i]])
		swap(x[i],y[i]);
		else if(a[x[i]]==a[y[i]])
		{
		if(i+1<n&&(y[i]==x[i+1]||y[i]==y[i+1]))
		swap(x[i],y[i]);
		}
		if(a[y[i]]==0) 
		{
			cout<<"No";return 0;
		}
		a[x[i]]++;a[y[i]]--;step[i]=x[i];
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<n;++i)
	cout<<char(step[i]+'A')<<endl;
 } 

Measured memory_bytes: 4820
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int main(){
  int N;
  long long K;
  scanf("%d", &N);
  scanf("%lld", &K);
  std::vector<int > A(N), F(N);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  for (int i=0; i<N; i++){
    scanf("%d", &F[i]);
  }
  std::sort(A.begin(), A.end(), std::greater<int>());
  std::sort(F.begin(), F.end());
  long long min = -1;
  long long max = 1e18;
  while(max-min>1) {
    //printf("[%lld, %lld]\n", min, max);
    long long mid = (min+max)/2;
    long long sum = 0;
    for (int i=0; i<N; i++){
      if ((long long)A[i]*F[i]>mid){
	sum += A[i]-mid/(long long)F[i];
	//std::cout << "+=" << A[i]-mid/(long long)F[i] << std::endl;
      }
    }
    //printf("mid=%d, sum=%lld\n", mid, sum);
    if (sum>K){
      min=mid;
    } else {
      max=mid;
    }
  }
  std::cout << max << std::endl;
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/10000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> p;
    p.resize(n);

    int c1 = 0, c2 = 0, c3 = 0;
    rep(i, n) {
        cin >> p[i];
        if (p[i] <= a) c1++;
        else if (p[i] >= a + 1 && p[i] <= b) c2++;
        else if (p[i] >= b + 1) c3++;
    }
    cout << min({c1, c2, c3}) << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
ok = [1 for i in range(10)]
for i in range(len(d)):
    ok[d[i]] = -1
for i in range(n, 100000):
    complete = True
    for j in range(len(str(i))):
        if ok[int(str(i)[j])] == -1:
            complete = False
            break
    if complete:
        print(i)
        exit()

"""
import copy
def listToString(_list, split=""):
    maped_list = map(str, _list)  # mapで要素すべてを文字列に
    mojiretu = split.join(maped_list)
    return mojiretu

n, k = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
ok = [1 for i in range(10)]
for i in range(len(d)):
    ok[d[i]] = -1
# nをしたの位から順に置き換えていく
money = [0]
for i in range(len(str(n))):
    money.append(int(str(n)[i]))
# 最小でなくともn以上の整数を作る
for i in reversed(range(1, len(money))):
    for j in range(money[i], 10+money[i]):
        _j = j % 10
        if ok[_j] == 1:
            if _j >= money[i]:
                money[i] = _j
                break
            else:
                money[i] = _j
# print("okList:{}".format(ok))
# print(money)
while True:
    if money[0] != 0:
        break
    else:
        del(money[0])
# print(money)
# 次に可能な限り最小化していく
for i in range(len(money)):
    for j in range(10):
        if ok[j] == 1:
            tmpMoney = copy.deepcopy(money)
            tmpMoney[i] = j
            # print("n:{} tmpMoney:{}".format(n, int(listToString(tmpMoney))))
            if int(listToString(tmpMoney)) >= n:
                # print("money:{}".format(money))
                money[i] = j
                break
print(int(listToString(money)))
"""

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){
    int n,k;
    double ans = 0.0;
    cin >> n >> k;

    for(int i = 1;i <= n;i++){
        int t = 0,t2 = i;

        while(k-t2 > 0){
            t2 *= 2;
            t++;
        }

        ans += (1.0/n)*(1.0/pow(2,t));

    }

    cout << setprecision(16) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
using ll = long long;
const int INF = 0x3f3f3f3f;
const int MAX_N = 206;

int N;
int a[MAX_N];
int b[MAX_N];
int c[MAX_N];

void solve()
{
	int tot = 0;
	int last = -1;
	for(int i=1;i<=N;++i){
		int cur = a[i];
		tot += b[cur];
		if(last != -1 && cur == last + 1) tot += c[last];
		last = cur;
	}
	cout << tot << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=1;i<=N;++i)cin >> a[i];
	for(int i=1;i<=N;++i)cin >> b[i];
	for(int i=1;i<N;++i)cin >> c[i];
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
ll n,a,b;
int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a>=b-1)printf("%lld\n",n+1);
	else
	{
		if(n<a)printf("%lld\n",n+1);
		else
		{
			n-=a-1;
			ll ans=a+(b-a)*(n/2);
			if(n&1)ans++;
			printf("%lld\n",ans);
		}
	}
	return 0;
}

Measured memory_bytes: 128
class Type:
    win_Taro = 0
    win_Hanako = 1
    EVEN = 2
 
def comp_str(A,B):
    if A > B:
        return Type.win_Taro
    elif A < B:
        return Type.win_Hanako
    else:
        return Type.EVEN
 
N = int(input())
 
point_Taro = 0
point_Hanako = 0
 
for loop in range(N):
    line = str(input()).split()
    ret_type = comp_str(line[0],line[1])
    if ret_type == Type.win_Taro:
        point_Taro += 3
    elif ret_type == Type.win_Hanako:
        point_Hanako += 3
    else:
        point_Taro += 1
        point_Hanako += 1
 
print("%d %d"%(point_Taro,point_Hanako))


Measured memory_bytes: 5600
#include <bits/stdc++.h>
 
#define itn int
#define fro for
#define Fast freopen("in.txt", "r", stdin)
#define manx maxn
#define lowbit(x) ((x) & (-x))
#define ceil(n, p) (((n) +(p) - 1) / (p))
#define DBG(x) (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n')

using namespace std;
typedef long long ll;

/*------------------------------------------------------------------------------------*/
template <typename _t>
inline void read(_t &x){
    x = 0; _t fu = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-') fu = - 1; ch = getchar();}
    while(ch >= '0' && ch <= '9'){
        x = (x << 3) + (x << 1) + (ch & 15);
        ch = getchar();
    }
    x *= fu ;
}
/*------------------------------------------------------------------------------------*/
ll gcd(ll x, ll y){return !x? y: gcd(y % x, x);}
void exgcd(ll a, ll b, ll &x, ll &y){
    if(!b){x = 1; y = 0;return;}
    exgcd(b, a % b, y, x);
    y -= a / b * x;
}
//return x, a ^ x <= n < a ^ (x + 1)
//保证res不会大于n
ll log(ll n, ll a, ll x = 0, ll res = 1){
    while(res <= n / a){ x++; res *= a;} return x;
}
ll qp(ll a, ll p, ll M){
    ll ans = 1;
    while(p){
        if(p & 1) ans = ans * a % M;
        a = a * a % M; p >>= 1;
    }
    return ans;
}
/*------------------------------------------------------------------------------------*/
struct Mart{
    int a, b, c, d;
    Mart operator *(Mart &m){
        Mart temp;
        temp.a = a * m.a + b * m.c;
        temp.b = a * m.b + b * m.d;
        temp.c = c * m.a + d * m.c;
        temp.d = c * m.b + d * m.d;
        return temp;
    }
    Mart(){a = b = c = d = 0;}
    Mart(int x[4]){a = x[0]; b = x[1]; c = x[2]; d = x[3];}
    Mart(int u, int v, int w, int x){a = u; b = v; c = w; d = x;}
    int det(){return a * d - b * c;}
};
/*
打算加一些数据结构进来。。比如线段树的单点、区间修改，单点、区间查询
star存图的相关结构
把Mart改为n阶矩阵
（记得标注各种接口信息！)
*/
/*------------------------------------------------------------------------------------*/

const int maxn = 200 + 10;
ll a[maxn];

const int L = 63;
ll d[L];
bool add(ll x){
    for(int i = L - 1; i >= 0; i--) if(x & 1ll << i){
        if(d[i] == -1){d[i] = x; return true;}
        x ^= d[i];
    }
    return false;
}

bool check(ll x){
    for(int i = L - 1; i >= 0 && x; i--) if(x & 1ll << i){
        if(!d[i]) return 0;
        x ^= d[i];
    }
    return 1;
}

int main(){
//    Fast;
    int t; scanf("%d", &t); while(t--){
        memset(d, -1, sizeof d);
        
        int n; scanf("%d", &n);
        for(int i = 0; i < n; i++) scanf("%lld", a + i);
        char s[maxn]; scanf("%s", s);
        int flag = 0;
        for(int i = n - 1; i >= 0; i--){
            if(add(a[i]) && s[i] == '1'){
                flag = 1;
                break;
            }
        }
        printf("%d\n", flag);
        
        
    }
    return 0;
}



Measured memory_bytes: 3680