akhauriyash/Code-Regression huggingface dataset:
// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
#define N 101010
void build(){

}
char c[ N ];
int n , a , b;
int pa , pb;
void init(){
  scanf( "%d%d%d" , &n , &a , &b );
  scanf( "%s" , c );
}
void solve(){
  for( int i = 0 ; c[ i ] ; i ++ ){
    bool pass = false;
    if( c[ i ] == 'a' && pa + pb < a + b ){
      pa ++; pass = true;
    }
    if( c[ i ] == 'b' && pa + pb < a + b && pb < b ){
      pb ++; pass = true;
    }
    puts( pass ? "Yes" : "No" );
  }
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 768
#include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

const double eps = 1e-11;
double x[4], y[4];
int N;

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

int main() {
  cin >> N;
  for (int t=0; t<N; t++) {
    for (int i=0; i<4; i++) {
      cin >> x[i] >> y[i];
    }

    xy_t a[2] = {
      xy_t(x[0],y[0]) - xy_t(x[1],y[1]), xy_t(x[2],y[2]) - xy_t(x[3],y[3])
    };
    bool p = abs(cross_product(a[0], a[1])) < eps;
    cout << (p ? "YES" : "NO") << endl;
  }
}


Measured memory_bytes: 3128
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    S = input()
    if S[0] == 'S':
        print('Cloudy')
    elif S[0] == 'C':
        print('Rainy')
    else:
        print('Sunny')

sol()

Measured memory_bytes: 3572
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
#define pb push_back
#define mp make_pair

typedef long long ll; 

#define fi first
#define se second
 
#define all(x) (x).begin(), (x).end()
 
using namespace std;             
//using namespace __gnu_pbds;

typedef vector<int> vi;
 
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int INF = (int)1e10;                   
const int MAXN = 300500; 

void solve() {                                    
    int k, x;
    cin >> k >> x;
    k *= 500;
    if (k >= x) {
        cout << "Yes";
    }
    else cout << "No";
}

int main() {      
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);   
    int tt = 1;
    
    while (tt--) {
        solve();
    }
 
    return 0;
}

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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18


int main(){
    int N,W;
    cin >> N >> W;
    vector<long long> w(N),v(N);
    rep(i,N) cin >> w[i] >> v[i];
    vector<vector<long long>> dp(N+10,vector<long long>(W+100));
    rep(i,N){
        rep(j,W+1){
            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]);
        }
    }
    long long ans = dp[N][W];
    cout << ans << endl;
}

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

typedef long long ll;
const int mxn = 111;

ll dp[mxn][3];
int  l , k;
ll solve(int pos , int ty)
{
//cout<<pos<<" "<<ty<<endl;
	if(pos < 0)
	{
		return 0;
	}
	else if(pos==0)
	{
		return ty==1 || ty==2;
	}
	if(dp[pos][ty]!=-1)
	{
		return dp[pos][ty];
	}
	ll ret = 0;
	if(ty==0)
	{
		ret += solve(pos-1 , 1);
		ret += solve(pos-k , 2);

	}
	else
	{
		ret += solve(pos-1 , 0);
		ret +=1;
	}


		return dp[pos][ty] = ret;
}

int main()
{
	cin>>l>>k;
	memset(dp , -1 ,sizeof dp);
	ll ret = solve(l-1 , 1);
	//memset(dp , -1 , sizeof dp);
	ret += solve(l-k , 2);
	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 3096
A, B = map(int, input().split())
ans = 0

for i in range(A, B + 1):
    i = str(i)

    flag = True
    for j in range(len(i) // 2):
        if i[j] != i[len(i) - 1 - j]:
            flag = False
    if flag == True:
        ans += 1
print(ans)


Measured memory_bytes: 73752
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define es cout<<" "
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;
template<class T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<class T, class... Ts> 
auto make_vec(size_t a, Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}

int main(void) {
    int n, m;
    cin >> n >> m;
    
    auto v = make_vec<lint>(m, 0);
    repeat (i, m) {
        int k;
        cin >> k;
        rep (k) {
            int s;
            cin >> s;
            v[i].push_back(s);
        }
    }
    vector<int> p(m);
    repeat (i, m) cin >> p[i];
    
    auto check = [&](bitset<12> bs) {
        repeat (i, m) {
            int ons = 0;
            for (auto s: v[i]) {
                if (bs[s-1]) ++ons;
            }
            if (ons % 2 != p[i]) return false;
        }
        return true;
    };
    
    int ans = 0;
    repeat (i, (1<<n)) {
        bitset<12> bs(i);
        if (check(bs)) ++ans;
    }
    cout << ans << endl;
}

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

using namespace std;

const int INF = 1e9;

int a[200005];

int main() {
	int k, n;
	scanf("%d%d", &k, &n);
	
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	
	int res = INF;
	
	for (int i = 0; i < n; i++) {
		if (i + 1 < n) {
			res = min(res, a[i] + k - a[i + 1]);
		}
		else {
			res = min(res, a[i] - a[0]);
		}
		
		if (i - 1 >= 0) {
			res = min(res, k - a[i] + a[i - 1]);
		}
		else {
			res = min(res, a[n - 1] - a[i]);
		}
	}
	
	printf("%d\n", res);
}


Measured memory_bytes: 4588
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	while(1){
		int n, d;//n country  d limit
		cin >> n >> d;
		if(n == 0 && d == 0) return 0;

		vector<pair<int, int> > inf(n);//fi ???????????????????????????????¨????se????¬?????????????????????¨?????§???????????????????????????
		rep(i, n) inf[i].fi = 0;//?????????
		rep(i, n) inf[i].se = 0;//?????????
		vector<vector<int> > misairu(n);//misairu[i][]??????i???????????????????????\???

		rep(i, n){
			int m; scanf("%d", &m);
			misairu[i].resize(m);
			for (int j = m - 1; j >= 0 ; --j){//?????????????????????????????????????????????????????§??????????????\??????
				int c; scanf("%d", &c);
				misairu[i][j] = c;
				inf[i].fi += c;//??????????????????????????\????????????
			}
		}

		//??§?¬????
		while(1){
			bool endflag = false;
			int cntflag = 0;
			rep(j, n){
				int size = misairu[j].size() - inf[j].se;//j???????????¨?????????????????????????????£????????????

				if(size <= 0) continue;
				int now = inf[j].se;//???????¶?????????¨?????§???????????????????????????
				int tikara = misairu[j][now];//????????¨??????????????¨????????????????????????????¨????
				int tmp = inf[j].fi;//????¨?????????????????????????
				inf[j].fi -= tikara;//??????????????????????????????????¨???????????¨????
				//?????§?????¨????°?????????¢???
				int dai = -1, syou = 10000000;
				rep(k, n){
					dai = max(dai, inf[k].fi);
					syou = min(syou, inf[k].fi);
				}

				if(dai - syou > d){//??????????¨?????????§???????????¨?°????????????????????????????d????¶???????????????????????????§??????
					inf[j].fi = tmp;//?????????????????????
					cntflag++;
					if(j == n - 1 && cntflag == n){
						printf("No\n");
						endflag = true;
						break;
					}  
				}else{
					inf[j].se++;
				}
				//?????????????????????????????????????????????????¨????????¨????
				int sum = 0;
				rep(j, n) sum += inf[j].fi;
				if(sum == 0){
					printf("Yes\n");
					endflag = true;
					break;
				}
			}
			if(endflag == true) break;
		}
	}
	return 0;
}

Measured memory_bytes: 3156
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    string s;
    int flag=0;
    cin >> s;
    if(s[0]!=s[1] && s[1]!=s[2] && s[2]!=s[0]){
        if(s[0]=='a'||s[0]=='b'||s[0]=='c'){
            if(s[1]=='a'||s[1]=='b'||s[1]=='c'){
                if(s[2]=='a'||s[2]=='b'||s[2]=='c'){
                    flag=1;
                }
            }

        }
    }
    cout << (flag?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int n = sc.nextInt();
        int[] t_max = new int[n];
        ArrayList<PriorityQueue<Integer>> p_que = new ArrayList<>();
        for(int i = 0;i < n;i++){
            p_que.add(new PriorityQueue<>(Collections.reverseOrder()));
        }

        int q = sc.nextInt();
        for(int i = 0;i < q;i++){
            int num = sc.nextInt();
            int t = sc.nextInt();
            switch(num){
                case 0:
                    int x = sc.nextInt();
                    p_que.get(t).add(x);
                    break;
                case 1:
                    if(p_que.get(t).size() > 0)
                        System.out.println(p_que.get(t).peek());
                    break;
                case 2:
                    if(p_que.get(t).size() > 0)
                        p_que.get(t).poll();
                    break;
            }
        }
    }
}

class MyComparator implements Comparator{

    public int compare(Object obj1,Object obj2){
        int num1 = (int)obj1;
        int num2 = (int)obj2;

        if(num1 < num2) return 1;
        else if(num1 > num2)    return -1;
        else return 0;
    }
}


Measured memory_bytes: 177008
//wait for sh
    #pragma GCC optimize("Ofast")
    #include <bits/stdc++.h>
    using namespace std;

    #define int long long int
    #define pb push_back
    #define mp make_pair
    #define loop(i,st,end) for(int i=st;i<end;i++)
    #define itr(it,v)  for(auto it=v.begin();it!=v.end();++it)
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define debug(x) cout << "[ " << #x  << " : " << x << " ]" << endl ;
    #define mod (int)(1e9+7)
    const int maxn=5001;


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

        int mx=(1<<n)-1;
        //cout<<mx<<endl;
        int dp[mx+1];
        
        loop(j,0,mx+1)
            dp[j]=0;
        

        int a[n+1][n+1];
        loop(i,1,n+1)
        {
          loop(j,1,n+1)
           cin>>a[i][j];
        }

        dp[0]=1;
        //cout<<dp[1];
 

     
          loop(mask,0,mx+1)
          {
            int i=__builtin_popcount(mask);
            loop(k,1,n+1)
            {
              if(a[i+1][k] and !(mask & (1<<(k-1))))
               { dp[mask|(1<<(k-1))]+=dp[mask];

                dp[mask|(1<<(k-1))]%=mod;
              }
            }
          }
        

        cout<<dp[mx];
      }

    int32_t main()
    { IOS
      // #ifndef ONLINE_JUDGE
      // freopen("input.txt","r",stdin);
      // freopen("output.txt","w",stdout);
      // #endif

      int t;
      t=1;
      //cin>>t;

      loop(i,0,t)
      {  //cout<<"Case #"<<(i+1)<<": ";
          solve();
      }

      return 0;
    }


Measured memory_bytes: 16768
import random
from operator import itemgetter
import sys
sys.setrecursionlimit(1000000)
ans=0

def gcd(x,y):
    x,y=max(abs(x),abs(y)),min(abs(x),abs(y))
    if x%y==0:
        return y
    while x%y!=0:
        x,y=y,x%y
    return y

def gcd_all(l):
    rt=l.pop()
    for i in l:
        rt=gcd(i,rt)
    return rt
    
n=int(input())

g=[]

a=[int(i) for i in input().split()]

ans=0
d=a[-1]
m=a[-1]
mi=-1
k1=[]
flg=0
for i in range(n):
    gg=gcd(a[i],d)
    if gg<m:
        m=gg
        mi=i
ans=max(ans,gcd_all(a[:mi]+(a[mi+1:] if mi+1<n else [])))

d=a[0]
m=a[0]
mi=0
k1=[]
flg=0
for i in range(n):
    gg=gcd(a[i],d)
    if gg<m:
        m=gg
        mi=i
ans=max(ans,gcd_all(a[:mi]+(a[mi+1:] if mi+1<n else [])))

print(ans)


Measured memory_bytes: 65644
#include <bits/stdc++.h>
using namespace std;
#define INFTY 1000000001

struct card{
    char suit;
    int value;    
};

void merge(vector<card> &A,int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    vector<card> L(n1+1);
    vector<card> R(n2+1);
    for(int i=0;i<n1;i++){
        L[i]=A[left+i];
    }
    for(int i=0;i<n2;i++){
        R[i]=A[mid+i];
    }
    L[n1].value=R[n2].value=INFTY;
    
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(L[i].value<=R[j].value){
            A[k]=L[i];
            i++;
        }
        else{
            A[k]=R[j];
            j++;
        }
    }
}

void mergeSort(vector<card> &A,int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,mid,right);
    }
}


int partition(vector<card> &A,int p,int r){
    int x=A[r].value;
    int i=p-1;
    for(int j=p;j<r;j++){
        if(A[j].value<=x){
            i=i+1;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

void quickSort(vector<card> &A,int p,int r){
    if(p<r){
        int q=partition(A,p,r);
        quickSort(A,p,q-1);
        quickSort(A,q+1,r);
    }
}



int main(){
    int n;
    cin>>n;
    vector<card> A(n),B(n);
    for(int i=0;i<n;i++){
        cin>>A[i].suit>>A[i].value;
    }

    B=A;
    quickSort(A,0,n-1);
    mergeSort(B,0,n);

    bool judge=true;
    for(int i=0;i<n;i++){
        if(A[i].suit!=B[i].suit||A[i].value!=B[i].value) judge=false;
    }

    if(judge) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;

    for(int i=0;i<n;i++){
        cout<<A[i].suit<<' '<<A[i].value<<endl;
    }      
}


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

#define inf 0x3f3f3f3f
#define pi acos(-1)
#define fi first
#define se second
#define pb push_back
#define int long long
#define all(a) a.begin(),a.end()
template<class T> bool mmin(T &a,T b){return (a>b ?(a=b,true):false);};
template<class T> bool mmax(T &a,T b){return (a<b ?(a=b,true):false);};



int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(a+b,min(b+c,c+a));
#ifdef LOCAL_DEFINE
	cerr << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




















Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	o := 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		r := a / 400
		if a >= 3200 {
			o++
		} else {
			m[r]++
		}
	}

	c := len(m)
	min := math.Max(1.0, float64(c))
	fmt.Println(int(min), c+o)
}


Measured memory_bytes: 512
#include<iostream>
#define N 51
using namespace std;
char map[N][N],clr[N][N];
int w,h;
void renew(int x,int y){
  int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1},newx,newy;
  for(int u=0;u<4;u++){
    newx=x+dx[u],newy=y+dy[u];
    if(newx>=0 && newx<w && newy>=0 && newy<h){
         if(clr[newy][newx]=='.' && map[newy][newx]=='.') map[newy][newx]=map[y][x],renew(newx,newy);
      else if(clr[newy][newx]=='.' && map[y][x]!=map[newy][newx])map[newy][newx]='F',renew(newx,newy);
    }
  }
}
 
int main(){
  while(1){
    int wcnt=0,bcnt=0;
    cin>>w>>h;
    if(w+h==0) break;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
    cin>>map[i][j];
    clr[i][j]=map[i][j];
      }
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
    if(clr[i][j]=='W') wcnt--;
    if(clr[i][j]=='B')bcnt--;
    if(clr[i][j]!='.') renew(j,i);
      }
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
    if(map[i][j]=='B')bcnt++;
    else if(map[i][j]=='W')wcnt++;
       }
     
    cout<<bcnt<<" "<<wcnt<<endl;
  }
   
  return 0;
}

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

using namespace std;

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

#define PB push_back
#define MP make_pair
#define L first
#define R second
#define sz(x) ((int)(x).size())
#define smax(x, y) ((x) = max((x), (y)))
#define smin(x, y) ((x) = min((x), (y)))
#define all(x) x.begin(),x.end()

const int maxn = 1e5 + 85 - 69;
LL n, L, a[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> L;
	int pos = -1;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(i and a[i] + a[i - 1] >= L) pos = i - 1;
	}
	if(pos == -1){
		cout << "Impossible\n";
		return 0;
	}
	cout << "Possible\n";
	for(int i = 0; i < pos; i++)
		cout << i + 1 << '\n';
	for(int i = n - 2; i > pos; i--)
		cout << i + 1 << '\n';
	cout << pos + 1 << '\n';
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#define INF 1000000
using namespace std;
int loop[15] ={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
	
int main(){
  int a,b;
  int mn = INF;
  vector<int>ans;
  int n;
  cin >> n;
  while(n-- ){
    cin >> a >>b;
    ans.clear();
    ans.push_back(a);
    for(int i = a+1 ;; i++){

      if(loop[i%15] == a)ans.clear();

      ans.push_back(loop[i%15]);

      if(loop[i%15] == b)break;
    }

    for(int i = 0 ; i < ans.size() ; i++ ){
      if(i == 0)cout << ans[i];
      else cout << ' ' << ans[i];  
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli n, k;
    cin>>n>>k;
    out((k==1?0:n-k));
}

Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const ll maxn=100000;

int main(){
    
    int a[maxn]={0};
    int l;
    int n;
    int subs=INF;
    cin >> n>>l;
    
    rep(i,n){
        a[i]=i+l;
        if(abs(subs)>abs(i+l))subs=i+l;
    }
    
    sort(a,a+n);
    int ans = 0;
    rep(i,n){
        ans+=a[i];
    }
    ans-=subs;
    cout << ans <<endl;
    
    
    return 0;
}


Measured memory_bytes: 640
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)

using namespace std;
int solve()
{	
	int n,l;
	cin>>n>>l;
	int f[n+1];
	int sum=0;
	for(int i=1;i<=n;i++)
		f[i]=l+i-1,sum+=f[i];
	int mn=INT_MAX;
	int ans;
	for(int i=1;i<=n;i++){
		int add=0;
		for(int j=1;j<=n;j++){
			if(j==i)	
				continue;
			add+=f[j];
		}
		if(abs(sum-add)<mn){
			ans=add;
			mn=abs(sum-add);
		}
	}
	cout<<ans<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 3588
from itertools import product, permutations

N, A, B, C = map(int, input().split(' '))
L = [int(input()) for _ in range(N)]

ans = 10 ** 9
for groups in product(range(4), repeat=N):
    items = []
    group_a = []
    group_b = []
    group_c = []

    for group, length in zip(groups, L):
        if group == 0:
            items.append((length, 0))
        elif group == 1:
            group_a.append(length)
        elif group == 2:
            group_b.append(length)
        elif group == 3:
            group_c.append(length)

    if group_a:
        items.append((sum(group_a), (len(group_a) - 1) * 10))
    if group_b:
        items.append((sum(group_b), (len(group_b) - 1) * 10))
    if group_c:
        items.append((sum(group_c), (len(group_c) - 1) * 10))

    if len(items) < 3:
        continue

    for one, two, three in permutations((A, B, C), r=3):
        cost = 0
        _items = list(items)

        _items = sorted(_items, key=lambda x: (abs(x[0] - one), x[1]))
        cost += abs(_items[0][0] - one) + _items[0][1]
        _items.pop(0)

        _items = sorted(_items, key=lambda x: (abs(x[0] - two), x[1]))
        cost += abs(_items[0][0] - two) + _items[0][1]
        _items.pop(0)

        _items = sorted(_items, key=lambda x: (abs(x[0] - three), x[1]))
        cost += abs(_items[0][0] - three) + _items[0][1]

        ans = min(ans, cost)

print(ans)


Measured memory_bytes: 9280
n = int(input())
a = [int(input()) for i in range(n)]

trace = {1}
p = a[0]
ans = 1
while p != 2:
    if p in trace:
        ans = -1
        break
    trace.add(p)
    p = a[p - 1]
    ans += 1

print(ans)

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

using namespace std;

typedef long long ll;
#define mems(p) memset(p,0,sizeof(p))
#define mp make_pair

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);}

ll a[100010];
pair<ll,ll> b[200020];

bool sorter(pair<ll,ll> a, pair<ll,ll> b){
	return a.first>b.first;
}

int main() {
	fast();
	ll n,m,curr;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i].first;
		b[i].second=1;
	}
	for (int i = n; i < m+n; ++i)
	{
		cin>>b[i].second>>b[i].first;
	}
	sort(b,b+m+n,sorter);
	curr=0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = curr; j < min(n,curr+b[i].second); ++j)
		{
			a[j]=b[i].first;
		}
		curr+=b[i].second;
		if (curr>=n)
		{
			break;
		}
	}
	ll sum=0;
	for (int i = 0; i < n; ++i)
	{
		sum+=a[i];
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 4224
import numpy as np

N = int(input())
D = np.array([int(a) for a in input().split()])

num_at_dist = np.array([1] + [0] * (N-1) + [0]) # extra 0 at the end for index -1

if D[0] != 0:
    ans = 0
else:
    ans = 1
    D = np.sort(D)
    for i in range(1, N):
        dist = D[i]
        num_at_dist[dist] += 1
        ans = ( ans * num_at_dist[dist - 1] ) % 998244353

print(ans % 998244353)

Measured memory_bytes: 31760
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int num;
string s;
int main()
{
	cin>>s;
	for (int i=0;i<=s.size()-1;i++)
	   if (s[i]=='o')
		    num++;
  if (15-s.size()+num>=8)
	   cout<<"YES\n";
	else
	   cout<<"NO\n";
 return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N = int(readline())
P = list(map(float,readline().split()))

# dp[i][j] = i枚投げて、表がj枚出ている確率
dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1
for i in range(N):
  for j in range(N):
    dp[i + 1][j] += dp[i][j] * (1 - P[i])
    dp[i + 1][j + 1] += dp[i][j] * P[i]
    
ans = 0
for i in range(N + 1):
  if i > N // 2:
    ans += dp[-1][i]

print(ans)

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int ans;
  if (a == b) {
    ans = c;
  } else if (b == c) {
    ans = a;
  } else {
    ans = b;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n,m;
  cin >> n >> m;
  ll i_max = 1;
  for(ll i = 1; i*i<=m; i++){
    if(m%i==0){
      if(i<=m/n){
        i_max = max(i,i_max);
      }
      if(m/i<=m/n){
        i_max = max(m/i,i_max);
      }
    }
  }
  cout << i_max << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int cnt,i;
	int num,sum;
	char c;

	cnt = 0;
	num = 0;
	sum = 0;

	while(1){
		c = getchar();
		if(c == EOF){
			break;
		}else if(c == ' '){
			sum += num;
			num = 0;
		}else if(c == '\n'){
			sum += num;
			i = 1;
			while(sum >= 10){
				sum /= 10;
				i++;
			}
			printf("%d\n",i);
			sum = 0;
			num = 0;
		}else{
			num *= 10;
			num += c - '0';
		}
	}

	return 0;
}

Measured memory_bytes: 524
import sys
a,b,c = map(int,input().split())
k = int(input())
for i in range(k+1):
    if b * 2**i > a:
        n = i
        break
for j in range(k-n+1):
    if c * 2**j > b * 2**n:
        print("Yes")
        sys.exit()
print("No")

Measured memory_bytes: 9076
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#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;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll N;
    vector<ll> A, Bho, B;
    ll a, b;
    cin>>N;
    rep(i, N){
        cin>>a;
        A.push_back(a);
    }
    rep(i, N){
        cin>>b;
        Bho.push_back(b);
    }
    rep(i, N){
        B.push_back(Bho[N-1-i]);
    }
    ll eq=0;
    ll count1=0;
    bool ok=false;
    ll senpo;
    rep(i, N){
        if(A[i]==B[i]){
            
            eq=A[i], count1++;
            if(!ok){
                senpo=i;
                ok=true;
            }
        }
    }
    ll count2=0;
    ok=false;
    ll sento;
    rep(i, N){
        if(A[i]==eq || B[i]==eq){
            count2++;
            if(!ok){
                ok=true;
                sento=i;
            }
        }
    }
    
    if(count1>N-count2){
        cout<<"No"<<endl;
        return 0;
    }
   
    cout<<"Yes"<<endl;
    ll dum=0;
    while(dum<sento && dum<count1){
        swap(B[dum], B[senpo+dum]);
        dum++;
        
    }
    ll intr=0;
    sento+=count2;
    while(dum<count1){
        swap(B[sento+intr], B[senpo+dum]);
        intr++;
        dum++;
    }
    rep(i, N){
        cout<<B[i];
        if(i==N-1) cout<<endl;
        else cout<<sp;
    }
    return 0;
}


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

namespace AGC001A{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            Console.WriteLine(sr.Next<int>(sr.Next<int>() * 2).OrderBy(x => x).Where((_, i) => i % 2 == 0).Sum());
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

Measured memory_bytes: 3160
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k,p[200010];
int main(){
    double mx,now;
    while (scanf("%d %d",&n,&k)!=EOF) {
        now = mx = 0;
        for (int i=0;i<n;i++) {
            scanf("%d",&p[i]);
            if (i<k) {
                now += (p[i]+1)*0.5;
                if (mx < now)
                    mx = now;
            }
            else {
                now = now + (p[i]+1)*0.5 - (p[i-k]+1)*0.5;
                if (mx<now)
                    mx = now;
            }
        }
        printf("%.12lf\n",mx);
    }
    return 0;
}


Measured memory_bytes: 1024
a=gets.scan(/F*/).map &:size
x, y=gets.split.map &:to_i

x-=a.shift if a[0]>0

c=true
tx, ty=a.partition{|e| c=!c if e==0; c}

f=->t, g do
    s={0=>true}
    t.select{|e|e>0}.each do |d|
        n={}
        s.each{|k, _| n[k-d]=n[k+d]=true}
        s=n
    end
    s[g]
end

puts (f[tx, x] && f[ty, y] ? "Yes" : "No")


Measured memory_bytes: 76156
import java.util.Scanner;
public class Main{
 public static void main(String[]args){
   Scanner sc = new Scanner(System.in);
while(true){
int n= sc.nextInt();
if(n==0)
break;
int[] scores = new int [n];
double[] x = new double[n];
for(int i=0;i<scores.length;i++){
  scores[i]=sc.nextInt();
}
  double average = 0,variance=0;
  for(int i=0;i<scores.length;i++){
    average+=scores[i];
  }
  average=average/scores.length;
  for(int i=0;i<scores.length;i++){
    x[i]=(scores[i]-average)*(scores[i]-average);
    variance += x[i];
  }
variance = variance/scores.length;
System.out.println(Math.sqrt(variance));
}
}
}



Measured memory_bytes: 31412
#include <iostream>

using namespace std;

int main()
{
	int N, Y;
	cin >> N >> Y;
	int res10000 = -1, res5000 = -1, res1000 = -1;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; i + j <= N; j++) {
			int k = N - i - j;
			int total = 10000 * i + 5000 * j + 1000 * k;
			if (total == Y) {
				res10000 =i;
				res5000 = j;
				res1000 = k;
			}
		}
	}
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int count;
int f(int n,int s)
{
    count++;
    if(n)
        f(n/s,s);
}
int main()
{
    int n,s;
    scanf("%d %d",&n,&s);
    f(n,s);
    printf("%d",count-1);
    return 0;
}


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

int qsort_int(const void *a, const void *b);


int main(){

	int yama[10];

	for(int i=0; i<10; i++){
		cin >> yama[i]; 
	}
	
	qsort(yama, 10, sizeof(int), qsort_int);

	for(int i = 0; i<3; i++){
		cout << yama[i] << endl;
	}

	return 0;

}

int qsort_int(const void *a, const void *b){
	 return *(int*)b - *(int*)a; 
}



Measured memory_bytes: 3068
n, m = gets.strip.split.map(&:to_i)
abc = readlines.map {|line| line.strip.split.map(&:to_i) }

graph = Array.new(n+1) { [10**12]*(n+1) }
abc.each do |a, b, c|
  graph[a][b] = c
  graph[b][a] = c
end

(1..n).each do |i|
  graph[i][i]=0
end

vias = Array.new(n+1) { [false]*(n+1) }
abc.each do |a, b, c|
  vias[a][b] = vias[b][a] = true
end


minimum_edges = Array.new(n+1) { []*(n+1) }
(1..n).each do |via|
  (1..n).each do |from|
    (1..n).each do |to|
      if graph[from][to] > graph[from][via] + graph[via][to]
        graph[from][to] = graph[from][via] + graph[via][to]
        vias[from][to] = false
      end
    end
  end
end

p abc.count {|a, b, _| !vias[a][b] }

Measured memory_bytes: 2300
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define N 100010
int n;
int a[N];

void end(int x)
{
	if (x == 1) puts ("First");
	else puts ("Second");
	exit(0);
}

int gcd(int x, int y)
{
	while(x)
	{
		int z = x;
		x = y % x;
		y = z;
	}
	return y;
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i ++)
        cin >> a[i];
	int x = 1;
	while (1)
	{
		ll S = 0;
		int odd = 0, F1 = 0;
		for (int i = 0; i < n; i ++)
		{
			if (a[i] & 1) odd ++;
			S += a[i];
			if (a[i] == 1) F1 ++;
		}
		if ((S - n) % 2 == 1) end(x);
		if (odd >= 2 || F1 > 0) end(3 - x);
		int g = 0;
		for (int i = 0; i < n; i ++)
			if (a[i] & 1) g = gcd(g, a[i]-1);
			else g = gcd(g, a[i]);
		for (int i = 0; i < n; i ++) a[i] /= g;
		x = 3 - x;
	}
	return 0;
}


Measured memory_bytes: 640
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
BC.sort(key=lambda x:-x[1])
for B,C in BC:
    A.extend([C]*B)
    if len(A)>N*2:
        break
A.sort(reverse=True)
print(sum(A[:N]))

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

int main(){
  double N;
  int K;
  cin >> N >> K;
  double L=0;
  for(int i=1; i<=N; i++){
    double j=0;
    int k=i;
    while(k<K){
      k*=2;
      j++;
    }
    L+=1/pow(2,j);
  }
  L=L/N;
  std::cout << std::setprecision(18) << L << endl;
}

Measured memory_bytes: 256
#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 INF = 1001001001;
int main(){
  int c[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>c[i][j];
    }
  }
  int a[3];
  int b[3];
  b[0]=0;
  for(int i=0;i<3;i++){a[i]=c[0][i]-b[0];}
  for(int i=0;i<3;i++){b[i]=c[i][0]-a[0];}
  
   for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      if(c[i][j]!=a[j]+b[i]){cout<<"No"<<endl;return 0;}
    }
  }
  cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)

fun factorization(n :Long) :List<Long>{
    var number = n
    val list = mutableListOf<Long>()
    while (number % 2L == 0L) {
        list.add(2L)
        number /= 2
    }
    for(divider in 3L..(Math.floor(Math.sqrt(number.toDouble())) + 1f).toLong()  step 2){
        while (number % divider == 0L) {
            list.add(divider)
            number /= divider
        }
        if (number == 1L){
            break
        }
    }
    if (number != 1L){
        list.add(number)
    }
    return list
}

fun calc(a:Long, b:Long):Int = factorization(gcd(a, b)).toSet().size + 1

fun main(args:Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toLong() }
    val ans = calc(a, b)
    println(ans)
}




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

using namespace std;

typedef long long ll;

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 (a>b) { a=b; return 1; } return 0; }

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

	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;

	if(w > v){
		cout << "NO" << endl;
		exit(0);
	}

	if(abs(b - a) <= (v - w) * t){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}

}


Measured memory_bytes: 3648
#include<stdio.h>

typedef long long int int64;

int64 calc(int64 n){
  if(n<=0) return 0;
  int64 ans=(n%4==0 || n%4==3)?0:1;
  for(int i=1;(1LL<<i)<=n;i++){
    int64 t=n%(2LL<<i)-(1LL<<i)+1;
    if(t>0) ans|=(t&1)<<i;
  }
  return ans;
}

void run(void){
  int64 a,b;
  scanf("%lld%lld",&a,&b);
  int64 ans=calc(a-1)^calc(b);
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

vector<vector<ll>> pascal(53, vector<ll>(53));
ll ncr(int n, int r){
  return pascal[n+1][r+1];
}

int main(){
  for(int u=1;u<=52;u++){
    for(int v=1;v<=52;v++){
      if(v==1) pascal[u][v] = 1;
      else if(v==u){ pascal[u][v] = 1; break;}
      else pascal[u][v] = pascal[u-1][v-1]+pascal[u-1][v];
    }
  }

  int N, A, B;
  cin >> N >> A >> B;
  vector<ll> v(N);
  rep(i,N) cin >> v[i];
  sort(v.begin(), v.end(), greater<ll>());
  ll sum = 0;
  rep(i,A){
    sum += v[i];
  }
  cout << setprecision(23) << (double)sum / A << endl;
  vector<ll> cnt;
  rep(i,N){
    if(i==0 || v[i]!=v[i-1]){
      cnt.pb(1);
    }
    else cnt[(int)cnt.size()-1]++;
  }
  ll ans=0;
  //rep(i,(int)cnt.size()) cout << cnt[i] << endl;
  vector<ll> va;
  rep(i,A) va.pb(v[i]);
  vector<ll> vb;
  for(int i=0;i<B;i++){
    if(v[i]<va[(int)va.size()-1]) break;
    vb.pb(v[i]);
  }

  ll Ast, AstSize=0, Bst;
  Ast = v[A-1]; Bst = v[B-1];
  rep(i,N){
    if(v[i]==Ast)AstSize++;
  }

  if(Ast==Bst){
    if(Ast == v[0]){
      for(int i=A;i<=B;i++){
        ans += ncr(AstSize,i);
      }
    }
    else{
      int itr=0;
      while(1){
        if(v[itr]!=Ast)A--;
        else break;
        itr++;
      }
      ans = ncr(AstSize,A);
    }
  }
  else{
    if(Ast == v[0]){
      for(int i=A;i<=AstSize;i++){
        ans += ncr(AstSize,i);
      }
    }
    else{
      int itr=0;
      while(1){
        if(v[itr]!=Ast) A--;
        else break;
        itr++;
      }
      ans = ncr(AstSize,A);
    }
  }


  /*
  for(auto x:va) cout << x << " ";
  cout << endl;
  for(auto x:vb) cout << x << " ";
  cout << endl;
  */

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


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, ans, sum, last, cnt = 25000, a[100000],dp[60][10000];
Pll b[100000];
struct Edge { LL to,cost; };
vector<Edge>vec[100000];
string str[3];
bool f;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Seg {
	LL n;
	vector<LL>node, lazy;
	Seg(vector<LL>v) {
		n = 1; while (n < v.size())n *= 2;
		node.resize(n * 2 - 1);
		lazy.resize(n * 2 - 1);
		rep(i, n)node[n + i - 1] = v[i];
		Mfor(i, n - 2)node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}
	Seg(LL n_) {
		n = 1; while (n < n_)n *= 2;
		node.resize(n * 2 - 1);
		lazy.resize(n * 2 - 1);
		rep(i, n)node[n + i - 1] = ((LL)1 << 31) - 1;
		Mfor(i, n - 2)node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
		rep(i, n * 2 - 1)lazy[i] = -1;
	}
	void eval(LL k, LL l, LL r) {
		if (lazy[k] != -1) {
			node[k] = lazy[k];
			if (r - l >= 1) {
				lazy[k * 2 + 1] = lazy[k];
				lazy[k * 2 + 2] = lazy[k];
			}
			lazy[k] = -1;
		}
	}
	void update(LL i, LL x, LL a, LL b, LL l, LL r) {
		eval(i, a, b);
		if (b < l || r < a)return;
		if (l <= a&&b <= r) {
			lazy[i] = x;
			eval(i, a, b);
		}
		else {
			update(i * 2 + 1, x, a, (a + b) / 2, l, r);
			update(i * 2 + 2, x, (a + b + 1) / 2, b, l, r);
			node[i] = min(node[i * 2 + 1] , node[i * 2 + 2]);
		}
	}
	LL find(LL i, LL a, LL b, LL l, LL r) {
		eval(i,a,b);
		if (b< l || r < a)return INF;
		if (l <= a&&b <= r)return node[i];
		return min(find(i * 2 + 1, a, (a + b) / 2, l, r), find(i * 2 + 2, (a + b + 1) / 2, b, l, r));
	}
};
int main() {
	cin >> n >> q;
	Seg seg(n);
	rep(i, q) {
		LL x, y, z, w;
		cin >> x;
		if (x == 0) {
			cin >> y >> z >> w;
			seg.update(0, w, 0, seg.n - 1, y, z);
		}
		else {
			cin >> y >> z;
			cout << seg.find(0, 0, seg.n - 1, y, z) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 9208
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    reverse(all(s));
    bool ok = true;
    ll pos = 0;
    ll n = s.size();
    while(pos < n){
        string t = s.substr(pos,3);
        // debug(pos);debug(t);
        if(t == "mae"){
            if(s.substr(pos,5) != "maerd"){ok = false;break;}
            else pos += 5;
        }
        else if(t == "rem"){
            if(s.substr(pos, 7) != "remaerd"){ok = false;break;}
            else pos += 7;
        }
        else if(t == "esa"){
            if(s.substr(pos,5) != "esare"){ok = false;break;}
            else pos += 5;
        }
        else if(t == "res"){
            if(s.substr(pos, 6) != "resare"){ok = false;break;}
            else pos += 6;
        }
        else {
            ok = false;
            break;
        }

    }

    cout << ( ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
n,a,b = list(map(int, input().split()))
if abs(b-a)%2==0:
    print(abs(b-a)//2)
else:
    #卓1に行くコスト
    c1=max(a,b)-1
    #卓Nに行くコスト
    c2=n-min(a,b)
    
    ans=0
    cost=min(c1,c2)
    if c1<c2:
        ans+=min(a,b)-1
    else:
        ans+=n-max(a,b)
    cost-=ans
    ans+=(cost+1)//2
    print(ans)

Measured memory_bytes: 3064
cards={}
gets.to_i.times.map{
  name = gets.chomp
  cards.key?(name) ? cards[name] += 1 : cards.store(name,1)
}
gets.to_i.times.map{
  name = gets.chomp
  cards[name] -= 1 if cards.key?(name)
}
values = [0]
cards.map{|key,value| values << value}
puts values.max

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll a,b,k; cin >> a >> b >> k;
	if(a>=k){
		a-=k;
		cout << a << ' ' << b << endl;
	}else{
		k-=a;
		a=0;
		b-=k;
		if(b<0)b=0;
		cout << a << ' ' << b << endl;
	}
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {

  int n1, n2 = 0;
  char *m;
  char num1[5];
  m = (fgets(num1, sizeof(num1), stdin));
  sscanf(num1, "%d\n", &n1);

  if(n1 >= 82){
    printf("No\n");
    return 0;
  }else{
    for (int i = 1; i < 10; i++) {
      for (int j = 1; j < 10; j++) {
        if ( (i * j) == n1) {
          printf("Yes\n");
          return 0;
        }
      }
    }
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int A,B,count=0;
    cin>>A>>B;
    for(int i=A; i<=B; i++){
        string s = to_string(i);
                if(s[0]==s[s.size()-1]&&s[1]==s[s.size()-2]){
                    count++;
        }
    }
    cout<< count <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#define ll long long
#define ld long double
#define ctoi(x) x-'0'
#define pshb(a) cin >> x;a.push_back(x)
#define fr(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);
#define Test ll q ; cin>>q ; while (q--)
#define ph push_back
using namespace std;
int main()
{
    ll x , y ;
    ll a,b ,cnt=0 ;
    cin>>x>>y ;
    if (min(x,y)==1)
        return cout<<1 , 0 ;
    cout<<(x*y+1)/2 ;
}



Measured memory_bytes: 256