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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,k,a[2000], memo[2000], mmemo[2000],ans;

signed main() {
    cin >> n >> k;
    rep(i,n) cin >> a[i];
    rep(i,n) repo(j,i,n) {
        if (a[i] > a[j]) memo[i]++;
        if (a[j] > a[i]) mmemo[j]++;
    }
    rep(i,n) {
        ans += (memo[i]*((k*(k+1)/2)%MOD))%MOD;
        ans += (mmemo[i]*((k*(k-1)/2)%MOD))%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\n";
string no = "No\n";

int  main()
{
	int a,b; char op; cin>> a >> op >> b;
	if (op == '+')
		cout << a + b;
	else
		cout << a - b ;
	return (0);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using vpii=vector<pii>;
using ll=long long;

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

signed main()
{
	int n; cin >> n;
	vi a(n), b(n);
	rep(i, n){
		cin >> a[i] >> b[i];
	}

	sort(all(a));
	sort(all(b));

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




Measured memory_bytes: 6428
/**
 *   author: bholuakku
**/

#include <bits/stdc++.h>
#define For(i,a,b) for(i=(a); i<(b); i++)
#define rep(i,n) for(i=0; i<(n); i++)
#define Nfor(i,a,b) for(i=(a)-1; i>=(b); i--)
#define dep(i,n) for(i=(n-1);i>=0; i--)
#define mp make_pair
#define pb push_back
#define Auto(a) for(auto &val : a)
#define X first
#define Y second
#define MOD 1000000007
#define MOD1 998244353
#define iterate(A, i) for(auto i = A.begin(); i!=A.end(); i++)
#define mset(A,val,n) memset(A, val, n*sizeof(int))
#define Endl cout<<"\n"
#define Test cout<<"Hello\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<bool> vb;
typedef vector<vector<bool> > vvb;
typedef pair<int, int> pii;
typedef vector<vector<pair<int, int> > > vvp;

int power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y>0){ if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x)%p;} return res;}
int modInverse(ll n) {ll p = MOD;return power(n, p-2, p);}
int min(int a, int b, int c) { return min(a, min(b, c)); }
int max(int a, int b, int c) { return max(a, max(b, c)); }
inline void swap(int &a, int &b) { int t = a; a = b; b = t;}
bool cmp(int a, int b){return a>b;}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        //freopen("C:\\Users\\ACER\\Desktop\\Codes\\input.txt", "r", stdin);
    #endif
    int n, k, i, j;
    cin>>n>>k;
    vi A(n);
    for(int& a : A) cin>>a;
    vi dp(100001, 0);
    for(i=1; i<=k; i++){
        for(j=0; j<n; j++){
            if((i-A[j]>=0)&&(!dp[i-A[j]])) dp[i] = 1;
        }
    }
    if(dp[k]) cout<<"First"; else cout<<"Second";
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);int ans=0;
	for(int i=1;i<=n;i+=2) {int cnt=0;for(int j=1;j<=i;++j) if(!(i%j)) ++cnt;if(cnt==8) ++ans;}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);	
		
		int n = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int sum = a + b;
		
		String s = scan.next();
		
		for(int i = 0 ;  i < n ; i++){
			
			if(s.charAt(i) == 'a'){
				if(sum > 0){
					System.out.println("Yes");
					sum--;
					if(a == 0){
						b--;
					} else {
						a--;
					}
					
				} else {
					System.out.println("No");
				}
			} else if(s.charAt(i) == 'b'){
				if(b > 0){
					System.out.println("Yes");
					b--;
					sum--;
				} else {
					System.out.println("No");
				}
			} else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 23616
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

pair<ll,ll> drink[100000]; // first = 値段
				 // second = 数

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

	ll N, M; cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> drink[i].first >> drink[i].second;
	}

	sort(drink, drink + N);

	ll ans = 0LL;

	for (int i = 0; i < N && M > 0; i++) {
		if (M >= drink[i].second) {
			M -= drink[i].second;
			ans += drink[i].first*drink[i].second;
		}
		else { // M < drink[i].second
			ans += drink[i].first * M;
			M = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
ll vis[501][501], done[501][501];
ll dx[] = {-1, 1, 0, 0};
ll dy[] = {0, 0, 1, -1};
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, i, j, ans = 0, k;
    cin>>n;
    ll init[n][n], cur;
    for(i = 0; i < n; i++) {
    	for(j = 0; j < n; j++) {
    		vis[i][j] = -1;
    		init[i][j] = min({i, n - i - 1, j, n - j - 1}) + 1;
    	}
    }
    // for(j = 0; j < n; j++) {
    // 		for(k = 0; k < n; k++) {
    // 			cout<<init[j][k]<<" ";
    // 		} cout<<"\n";
    // 	} 
    // 	cout<<"\n";
    queue<pair<ll, ll>> q;
    for(i = 0; i < n*n; i++) {
    	cin>>cur;
    	cur--;
    	ll row = cur / n;
    	ll col = cur % n;
    	done[row][col] = 1;
    	ans = ans + init[row][col] - 1;
    	init[row][col]--;
    	q.push(mp(row, col));
    	while(!q.empty()) {
    		pair<ll, ll> top = q.front();
    		q.pop();
    		for(j = 0; j < 4; j++) {
    			ll x = top.ff + dx[j];
    			ll y = top.ss + dy[j];
    			if(x >= 0 && x < n && y >= 0 && y < n && vis[x][y] != i) {
    				if(done[x][y]) {
    					if(init[x][y] > init[top.ff][top.ss]) {
    						vis[x][y] = i;
    						init[x][y] = init[top.ff][top.ss];
    						q.push(mp(x, y));
    					}
    				} else {
	    				if(init[x][y] > init[top.ff][top.ss] + 1) {
	    					vis[x][y] = i;
	    					init[x][y] = init[top.ff][top.ss] + 1;
	    					q.push(mp(x, y));
	    				}
	    			}

    			}
    		}
    	}
    	// for(j = 0; j < n; j++) {
    	// 	for(k = 0; k < n; k++) {
    	// 		cout<<init[j][k]<<" ";
    	// 	} cout<<"\n";
    	// }  cout<<"\n";
    	
    }
    cout<<ans<<"\n";
}	

Measured memory_bytes: 9488
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    vector<int>h(n);
    rep(i,n){
        cin >> h[i];
    }
    int ans = 0;
    while(1){
        int st = 0;
        while(st<n and h[st]==0)st++;
        if(st==n){
            cout << ans << endl;
            return 0;
        }
        int e = st;
        while(e < n and h[e]>0)e++;
        for(int i = st; i < e; i++)h[i]--;
        ans++;
    }
}

Measured memory_bytes: 256
import java.util.*
fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    val N = scan.nextInt()
    val list = listOf(2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778,9349,15127,24476,39603,64079,103682,167761,271443,439204,710647,1149851,1860498,3010349,4870847,7881196,12752043,20633239,33385282,54018521,87403803,141422324,228826127,370248451,599074578,969323029,1568397607,2537720636,4106118243,6643838879,10749957122,17393796001,28143753123,45537549124,73681302247,119218851371,192900153618,312119004989,505019158607,817138163596,1322157322203,2139295485799,3461452808002,5600748293801,9062201101803,14662949395604,23725150497407,38388099893011,62113250390418,100501350283429,162614600673847,263115950957276,425730551631123,688846502588399,1114577054219522,1803423556807921,2918000611027443,4721424167835364,7639424778862807,12360848946698171,20000273725560978,32361122672259149,52361396397820127,84722519070079276,137083915467899403,221806434537978679,358890350005878082,580696784543856761,939587134549734843)
    print(list[N])
}

Measured memory_bytes: 34120
#include<iostream>
#include<cmath>

using namespace std;

void sort(int a[],int n)
{
	int i=0,j=n-1;
	int pivot = a[(i+j)/2];

	while(true)
	{
		while(a[i] < pivot)i++;
		while(a[j] > pivot)j--;

		if( i >= j )break;

		int hold = a[i];
		a[i] = a[j];
		a[j] = hold;

		i++;
		j--;
	}

	if( i > 1 )sort(a,i);
	if( n-j-1 > 1 )sort(a+j+1,n-j-1);
}

int main()
{
	int N,x;
	int a[101];
	int cnt = 0;

	cin >> N >> x;

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

	sort(a,N);

	for(int i=0;i<N;i++)
	{
		if(a[i] <= x)
		{
			cnt++;
		}

		x = max(x - a[i],0);
	}

	if(x > 0)cnt = max(--cnt,0);

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////

void yes(){
    cout<<"Yes"<<endl;
}
void no(){
    cout<<"No"<<endl;
}

int main(){fastio
    ll h,w;cin>>h>>w;
    if(h>w)swap(h,w);
    if(h==1){
        cout<<1<<endl;return 0;
    }
    cout<<(h*w+1)/2<<endl;
    
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func getInt() (n int) {
	sc.Scan()
	n, _ = strconv.Atoi(sc.Text())
	return n
}

func main() {
	N := getInt()
	M := getInt()
	sArray := make([]int, M)
	tArray := make([]int, M)
	for i := 0; i < M; i++ {
		sArray[i] = getInt()
		tArray[i] = getInt()
	}

	var stMap = map[int][]int{}
	for i := 0; i < M; i++ {
		if stMap[sArray[i]] == nil {
			stMap[sArray[i]] = append([]int{}, tArray[i])
		} else {
			stMap[sArray[i]] = append(stMap[sArray[i]], tArray[i])
		}
	}

	EList := make([]float64, N+1)
	for k := 0; k < N+1; k++ {
		EMap := make([]float64, N+1)
		EMap[N] = 0.0
		for i := N - 1; i > 0; i-- {
			var Ej float64
			nList := make([]float64, len(stMap[i]))

			for i, v := range stMap[i] {
				nList[i] = EMap[v] + 1.0
			}

			if k == i {
				if len(nList) == 1 {
					goto OUT
				} else {
					sort.Float64s(nList)
					for j := 0; j < len(nList)-1; j++ {
						Ej += nList[j]
					}
					Ej = Ej / float64(len(nList)-1)
				}
			} else {
				for j := 0; j < len(nList); j++ {
					Ej += nList[j]
				}
				Ej = Ej / float64(len(nList))
			}
			EMap[i] = Ej
		}
		EList[k] = EMap[1]
	OUT:
	}

	sort.Float64s(EList)
	for _, v := range EList {
		if v > 0.0 {
			fmt.Println(v)
			break
		}
	}
}


Measured memory_bytes: 9728
#include <iostream>
#include <unordered_set>
using namespace std;
int slide_win(string const& s, unordered_set<char>& m) {
  int n = s.size();
  int rst = 0;
  for(auto len=1; len <= n; len++) {
    for(int l=0, r=len; r <= n; r++, l++) {
      	bool isHalt = false;
    	for(auto ch : s.substr(l,len)) {
          if(m.find(ch) == m.end()) {
            isHalt = true;
            break;
          }
        }
      	if(!isHalt) rst = max(rst,len);
    }
  }
  return rst;
}
int main() {
  unordered_set<char> set = {'A','C','G','T'};
  string in;
  while(getline(cin, in)) {
    if( in == "\n") break;
  	cout << slide_win(in, set) << endl;
    // SHINJUKU == 0
    // HATAGAYA == 5
    // ATCODER == 3
  }
  return 0;
  
}

Measured memory_bytes: 256
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(itr,data) for(__typeof((data).begin()) itr=(data).begin();itr!=(data).end();++itr)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;

int n;
int a[101];

//何項目,今の値,かな...
//

long long dp[103][23];



int main()
{
    cin>>n;
    rep(i,n) cin>>a[i];
    rep(i,103) rep(j,23) dp[i][j]=0;

    dp[1][a[0]] = 1;

    rep(i,n-1) {
        rep(j,23) {
            if(j+a[i]<=20) {
                dp[i+1][j+a[i]] += dp[i][j];
            }
            if(j-a[i]>=0) {
                dp[i+1][j-a[i]] += dp[i][j];
            }
        }
    }

    cout<<dp[n-1][a[n-1]]<<endl;


    return 0;
}

Measured memory_bytes: 1176
import java.io.*;
import java.util.*;
class Main {
	
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	long dp[];
	
	public static void main(String args[]) throws IOException {
		new Main().run();
	}
	void run() throws IOException {
		in = new BufferedReader( new InputStreamReader( System.in ) );
		ob = new PrintWriter( System.out );
		solve();
		ob.flush();
	}
	
	void solve() throws IOException {
		int n = ni();
		int a[] = new int[n];
		dp = new long[n];
		for(int i=0 ; i<n ; i++) { 
			a[i] = ni();
			dp[i] = -1;
		}
			
		long res = rec( a , 0 , n-1 );
		ob.println(res);
	}
	
	long rec( int a[] , int i , int size ) {
		if( i > size )
			return Long.MAX_VALUE;
		if( size == i )
			return 0;
		
		if( dp[i] != -1 )
			return dp[i];
		
		long ret = 0;
		if( i+1<=size )
			ret = Math.abs( a[i] - a[i+1] ) + rec( a , i+1 , size );
		
		if( i+2 <= size )
			ret = Math.min( ret , Math.abs( a[i] - a[i+2] ) + rec( a , i+2 , size ) );
		
		dp[i] = ret;
		return ret;
	}
	
	int ni() throws IOException {
		return Integer.parseInt( nextToken() );
	}
	
	String nextToken() throws IOException {
		if( st == null || !st.hasMoreTokens() )
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}

Measured memory_bytes: 51992
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
typedef long long ll;
ll N,M,ans=-1;
string s, t;
const int MOD = 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}

ll lcm(ll x, ll y)
{
	return (x * y / gcd(x, y));
}

ll x[100000];
ll y[100000];
bool fla = true;
int main(void)
{
	cin >> N>>M;
	ll min_lcm = lcm(N, M);
	cin >> s;
	cin >> t;
	ll s_wari = min_lcm / N;
	ll t_wari = min_lcm / M;
	ll big_lcm = lcm(s_wari, t_wari);
	for (int i = 0; big_lcm*i<=min_lcm; i++) {
		if (s[big_lcm*i/s_wari] != t[big_lcm*i/t_wari])fla = false;
	}
	if (fla) {
		cout << min_lcm << endl;
	}
	else {
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
long long n,h;
pair<int,int> d[100005];
int main()
{
	cin >> n >> h;
	int maxd=0;
	for(int i=0; i<n; i++)cin >> d[i].second >> d[i].first,maxd=max(maxd,d[i].second);
	
	sort(d,d+n);
	long long sum=0,l=0;
	for(int i=n-1; ~i; i--)
	{
		if(d[i].first<=maxd) break;
		sum+=d[i].first; l++;
		if(sum>=h)
		{
			cout << n-i;
			return 0;
		}
	}
	h-=sum;
	cout << h/maxd+(h%maxd!=0)+l;
	return 0;
}


Measured memory_bytes: 4356
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef set <int> :: iterator sitr;
typedef set <ll> :: iterator sltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef mset <int> :: iterator msitr;
typedef mset <ll> :: iterator msltr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
ll n,m;
bool isprime[20000000];
vll prime,v,num;
map <ll,ll> factor;
map <ll,ll> :: iterator itr;
ll md = 1000000007;
void sieve (ll x){
    for(int i=2;i<=x;i++)isprime[i]=true;
    for(int i=2;i<=x;i++){
        if(isprime[i]){
            prime.pb(i);
            for(int j=i*2;j<=x;j+=i){
                isprime[j]=false;
            }
        }
    }
}
void factorize(ll x){
    while(x>1){
        bool cant=true;
        for(int i=0;i<prime.size();i++){
            if(x%prime[i]==0){
                x/=prime[i];
                factor[prime[i]]++;
                cant=false;
                break;
            }
        }
        if(cant){factor[2]=1;break;}
    }
}
bool calc[200000][40];
ll memo[200000][40];
ll dp(ll s, ll d){
    if(d==1)return s;
    else if (s==1) return 1;
    else if (calc[s][d]) return memo[s][d];
    else if(calc[s+1][d]){
        ll temp = memo[s+1][d];
        temp -= dp(s+1,d-1);
        if(temp<0){temp+=md;}
        calc[s][d] = true;
        memo[s][d]= temp;
        return temp;
    }
    else{
        ll sum = 0;
        for(int i=s;i>=1;i--){
            sum = ((sum%md) + (dp(i,d-1) % md))%md;
        }
        calc[s][d]=true;
        memo[s][d]=sum;
        return sum;
    }
}
int main(){
    sieve(10000000);
    cin>>n>>m;
    if(n==1 || m==1)cout<<1<<endl;
    else{
        factorize(m);
        for(itr=factor.begin();itr!=factor.end();itr++){
            v.pb(dp(n,itr->se));
            //cout<<itr->fi<<" "<<itr->se<<endl;
        }
        ll ans = 1;
        for(int i=0;i<v.size();i++){
            ans = ((ans%md) * (v[i]%md))%md;
        }
        cout<<ans<<endl;

    }

}


Measured memory_bytes: 58728
#include <iostream>
#include<bits/stdc++.h>
#include<unordered_map>
#include<vector>
#define ll long long
using namespace std;
int main(){
   ll n;
   cin>>n;
   ll q=n/1000;
   ll r=n%1000;
 // cout<<r<<endl;
   if(r==0)
    cout<<0<<endl;
  else
   cout<<1000-r<<endl;
   
   return 0;
    
}


Measured memory_bytes: 3560
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
int GCD(int a, int b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
 
    int main(){
      ll n,h;
      cin >> n >> h;
      ll a[n],b[n];
      rep(i,n){
       cin >> a[i] >> b[i]; 
      }
      sort(a,a+n);
      sort(b,b+n);
      ll ans=0;
       rep(i,n){
        if(b[n-1-i]>=a[n-1] && h>0){
         h-=b[n-1-i];
          ans++;
        }
       }
      while(h>0){
       h-=a[n-1];
        ans++;
      }
      cout << ans << endl;
      return 0;}

Measured memory_bytes: 1792
/*
    Author : Wasi Ur Rahman
*/
#include <bits/stdc++.h>
using namespace std;
// defines
#define ll long long int
#define ull unsigned long long int
#define MOD 100000
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sc scanf
#define pf printf
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(d, min(a, min(b, c)))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(d, max(a, max(b, c)))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 3.141592653589793238462643
#define no cout << "No" << endl;
#define yes cout << "Yes" << endl;
#define elif else if
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
/* important funct */
int Int()
{
    int c;
    cin >> c;
    return c;
}
ll Long()
{
    ll c;
    cin >> c;
    return c;
}
double Double()
{
    double c;
    cin >> c;
    return c;
}

#define Int Int()
#define Long Long()
#define Double Double()
void sortString(string &str)
{
    sort(str.begin(), str.end());
}
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i < n; i++)
        if (n % i == 0)
            return false;
    return true;
}
ll ManualGcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll ManualLcm(ll a,ll b)
{
    return((a)*(b)/gcd(a,b));
}
ll fact(ll n)
{
    ll res = 1;
    for(ll i = n; i>=1; i--)
        res *= i;
    return res;
}
ll nCr(ll n,ll r)
{
    return (fact(n)/(fact(r)*fact(n-r)));
}
ll nPr(ll n,ll r)
{
    return fact(n)/fact(n-r);
}
const string s = "hello";
// Main
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    IOS
    ll n=Long;
    ll k=Long;
    ll arr[n];
    ll i,j;
    ll cnt =0;
    ll tc = 0;
    for(i = 0;i<n;i++)
        cin >> arr[i];
    sort(arr,arr+n);
        for(i = 0;i<n-k;i++)
        {
            cnt += arr[i];
        }
        cout << cnt << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int a;string s;cin>>a>>s;
    cout << (a >=3200 ? s : "red") << endl;
    return 0;
}


Measured memory_bytes: 256
A = 0
B = 0
AB = 0
O = 0
while True:
    try:
        n, blood = input().split(',')
    except:
        break
    if blood=='A':
        A += 1
    if blood=='B':
        B += 1
    if blood=='AB':
        AB += 1
    if blood=='O':
        O += 1
print(A)
print(B)
print(AB)
print(O)


Measured memory_bytes: 5560
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string a, b;
    cin >> a >> b;
    string A, B;
    for (int i = 0; i < stoi(b); ++i) {
        A += a;
    }
    for (int i = 0; i < stoi(a); ++i) {
        B += b;
    }
    puts(A < B ? A.c_str() : B.c_str());
    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++)
 
int main() {
  string s;
  cin >>s;
  int kazu=s.size();
  string a;
  rep(i,kazu){
    string moji=to_string(i%2);
    a+=moji;
  }
  int kotae1=0;
  rep(i,kazu)if(s[i]==a[i])kotae1++;
  string b;
  rep(i,kazu){
    string moji;
    int amari=i%2+1;
    if(amari==2)amari=0;
    moji=to_string(amari);
    b+=moji;
  }
  int kotae2=0;
  rep(i,kazu)if(s[i]==b[i])kotae2++;
  int kotae=min(kotae1,kotae2);
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <sstream>

#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>

#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

int main(){
    string s;
    cin >> s;
    int k = 0;
    for(auto&& c:s)if(c=='o')k++;
    if(15 - s.length() + k > 7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	long long n,a[10001],b,s,h;
	cin>>n>>a[0];
	b=a[0],s=a[0],h=a[0];
	for(int i=1;i<n;i++){
		cin>>a[i];
		if(a[i]>b)
			b=a[i];
		if(a[i]<s)
			s=a[i];
		h+=a[i];
	}
	cout<<s<<" "<<b<<" "<<h<<endl;
	return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
int main(void){
  int a,b,c,d,ans=0,l[100]={0},i;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  for(i=a;i<b;i++)l[i]++;
  for(i=c;i<d;i++)l[i]++;
  for(i=0;i<100;i++)if(l[i]==2)ans++;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
// Problem : D - Alice&Brown
// Contest : AtCoder - AtCoder Beginner Contest 059
// URL : https://atcoder.jp/contests/abc059/tasks/arc072_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int x,y;cin>>x>>y;
  cout << (abs(x-y)>1?"Alice":"Brown") ;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

int main(int argc, char const *argv[])
{
	int n, k=0, ans;
	char s[11], s1[4];
	scanf("%s", s);
	s1[0]=s[0];
	s1[1]=s[1];
	s1[2]=s[2];
	s1[3]='\0';
	n=atoi(s1);
	ans=abs(n-753);
	while (s[k] != '\0') k++;
	for (int i = 1; i < k-2; ++i)
	{
		s1[0]=s[i];
		s1[1]=s[i+1];
		s1[2]=s[i+2];
		s1[3]='\0';
		n=atoi(s1);
		if (ans>abs(n-753)) ans=abs(n-753);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections;
class Program
{
    public static void Main()
    {
        string[] imp = Console.ReadLine().Split(' ');
        int n, m;
        n = int.Parse(imp[0]);
        m = int.Parse(imp[1]);
        if (n == 1 && m == 1)
            Console.WriteLine(1);
        else if (n == 1)
            Console.WriteLine(m - 2);
        else if (m == 1)
            Console.WriteLine(n - 2);
        else
            Console.WriteLine((long)(n - 2) * (m - 2));
    }
}

Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());

			int[,] dp = new int[n + 1, 3];
			for (int i = 0; i < n; i++) {
				int[] plan = Console.ReadLine().Split().Select(int.Parse).ToArray();
				dp[i + 1, 0] = plan[0] + Math.Max(dp[i, 1], dp[i, 2]);
				dp[i + 1, 1] = plan[1] + Math.Max(dp[i, 0], dp[i, 2]);
				dp[i + 1, 2] = plan[2] + Math.Max(dp[i, 0], dp[i, 1]);
			}

			Console.WriteLine(Math.Max(dp[n, 0], Math.Max(dp[n, 1], dp[n, 2])));

		}
	}
}


Measured memory_bytes: 16312
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	int A,B;
	cin>>A>>B;
  ll m;
  cin>>m; m;
  vector<ll> a(A);
  rep(i,A){
    cin>>a[i]; a[i];
  }
  vector<ll> b(B);
  rep(i,B){
    cin>>b[i]; b[i];
  }
  vector<ll> x(m);
  vector<ll> y(m);
  vector<ll> c(m);
  rep(i,m){
    cin>>x[i]; x[i]--;
    cin>>y[i]; y[i]--;
    cin>>c[i]; c[i];
  }
	ll re=*min_element(all(a))+*min_element(all(b));
	rep(i,m){
		MN(re,a[x[i]]+b[y[i]]-c[i]);
	}
	cout<<re NL;
	return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>

int main(){
  
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==b && c!=a)
    printf("Yes");
  else if(b==c && a!=b)
    printf("Yes");
  else if(c==a && b!=c)
    printf("Yes");
  else
    printf("No");
  return 0;
}
  
  

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(void){
	int a;
	int b;
	int c;
	int k;
	int m;

	int total=0;
 
	cin >> a  >> b >> c;
	cin >> k;

	if (a <= b){
		total += a;

		if(b <= c){
			total += b;
			m = c;
		}
		else{
			total += c;
			m = b;
		}
	}
	else {
		total += b;

		if(a <= c){
			total += a;
			m = c;
		}
		else{
			total += c;
			m = a;
		}
	}

 
	for(int i=0; i < k; i++)
		m *= 2;


	total += m;
	
	cout << total;



 
	return 0;
}

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


int prime(int num)
{
	int flag = 1, i;

	for (i = 2; i < num; i++)
	{
		if (num%i == 0)
		{
			flag = 0;
			break;
		}
	}

	return flag;

}


int main()
{
	int x;

	scanf("%d", &x);

	int ans = x;

	while(1)
	{

		if (prime(x))
		{
			ans = x;
			break;
		}
		x++;
	}



	printf("%d\n", ans);

	return 0;

}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cmath>

using namespace std;

int main(void){

	double x,h;
	
	while(1){
		cin>>x;
		cin>>h;
		if(x==0&&h==0) break;
		printf("%.6f\n",2*x*(sqrt(pow(h,2)+pow(x,2)/4))+pow(x,2));
	}
	return 0;
}

Measured memory_bytes: 1236
#include "bits/stdc++.h"
constexpr auto MAX = 10E9+1;
using namespace std;
using ll = long long;
using VI = vector<int>;

int main()
{
    int n;
    cin >> n;
    if (n % 1000 == 0) {
        cout << 0 << endl;
    }
    else {
        cout << 1000 * (n / 1000 + 1) - n << endl;
    }

    return 0;
}


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

#define _GLIBCXX_DEBUG

//vector<int> A(M), B(M);
//vector<vector<char>> answer(N, vector<char>(N, '-'));

int main() {
  int x, y, z;
  int a, b, c;
  
  cin >> x >> y >> z;
  a = z;
  b = x;
  c = y;
  cout << a << " " << b << " " << c << endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    int L; cin>>L;
    cout<<fixed<<setprecision(10);
    double node=(double)L/3.0;
    cout<<node*node*node<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j,a,b;
	while(1){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0){
					break;
				}
		for(i = 0;i < a;i++){
			for(j = 0;j < b;j++){
					printf("#");
			}printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 572
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n, k, s int
	fmt.Scan(&n, &k, &s)

	const d9 = 1000000000
	var x, y int
	if s == d9 {
		x = d9
		y = 1
	} else {
		x = s
		y = d9
	}
	var wr = bufio.NewWriter(os.Stdout)
	for i := 0; i < k; i++ {
		wr.WriteString(strconv.Itoa(x))
		if i < k-1 {
			wr.WriteString(" ")
		}
	}
	for i := 0; i < n-k; i++ {
		wr.WriteString(" ")
		wr.WriteString(strconv.Itoa(y))
	}
	wr.WriteString("\n")
	wr.Flush()
}


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

int main() {
int w,a,b,y;
cin >> w >> a >> b;
if(b>=a && b <= a+w) y = 0;
else if(a<b){
  y =  abs(b - a - w);
}
else{
  y = abs(a-b-w);
}

cout << y << endl;
}


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

if N == 1:
    print(1)
    exit()
A.sort()
grid = {}
for i in range(N):
    for j in range(i+1,N):
        if (A[j][0] - A[i][0], A[j][1] - A[i][1]) not in grid:
            grid[A[j][0] - A[i][0], A[j][1] - A[i][1]] = 1
        else:
            grid[A[j][0] - A[i][0], A[j][1] - A[i][1]] += 1

print(N - max(grid.values()))

Measured memory_bytes: 3188
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int n;
    cin>>n;
    int x,y;
    cin>>x>>y;
    x--,y--;
    vector <ll> ans(n);
    for (ll i=0;i<n;i++)
    {
        for (ll j=i+1;j<n;j++)
        {
            ll dist=j-i;
            dist=min({dist,abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y)});
         //   cout<<dist<<" "<<i<<" "<<j<<'\n';
            ans[dist]++;
        }
    }
    rep(i,n-1)
    cout<<ans[i+1]<<"\n";





}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 998244353
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 1000000000000000000
#define vll vector<ll>
using namespace std;
const int N=1000005;

void solve()
{
	ll ans,x=0,y=0,z=0,i,j,n,m;
	ans=0;
	string s;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s;
		m=s.length();
		for(j=0;j<m-1;j++)
			if(s[j]=='A' && s[j+1]=='B')
				ans++;
		if(s[0]=='B' && s[m-1]=='A') z++;
		else if(s[0]=='B') y++;
		else if(s[m-1]=='A') x++;
	}
	if(x && z) ans+=z,x--;
	else ans+=max(0LL,z-1);

	if(y && z) ans++,y--;
	ans+=min(x,y);
	cout<<ans;  
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

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

	// C[i] := i番目の箱に入っている玉の数
	// B[i] := C[i] + C[i*2] + C[i*3] + ...
	vector<ll> A(n + 1), B(n + 1, 0), C(n + 1, 0);
	for (ll i = 1; i <= n; i++)
	{
		cin >> A[i];
	}

	// iが大きい方から見ていく
	for (ll i = n; i >= 1; i--)
	{
		if (B[i] % 2 == A[i]) { continue; }

		// 偶奇が異なる場合に玉を入れる
		C[i] ++;

		// i の約数にも玉を入れる
		for (ll j = 1; j * j <= i; j++)
		{
			if (i % j == 0)
			{
				B[j] ++;
				if ( j * j != i ) B[i/j] ++;
			}
		}
	}

	ll cnt = 0;
	for (ll i = 1; i <= n; i++)
	{
		if (B[i] % 2 != A[i]) { cnt = -1; break; }
		if (C[i] > 0) cnt++;
	}

	cout << cnt << endl;
	if (cnt > 0)
	{
		bool f = true;
		for (ll i = 1; i <= n; i++)
		{
			if ( C[i] == 0 ) continue;
			if ( f )
			{
				cout << i;
				f = false;
			}
			else
				cout << " " << i;
		}
		cout << endl;
	}


	return 0;
}


Measured memory_bytes: 5504
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	while (1) {
		int n;
		cin >> n;
		if (n == 0)break;
		int M = 0, m = 2525;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			M = max(a, M), m = min(a, m);
			cnt += a;
		}

		cout << (cnt - M - m) / (n - 2) << endl;
	}
	return 0;
}


Measured memory_bytes: 2984
#include "bits/stdc++.h"
using namespace std;
#define debug(var) cout << #var << ": " << var << endl;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
using ll = long long;
using ull = unsigned long long;
using vvint = vector<vector<int>>;
constexpr ll mod = 1e9 + 7;

int main() {

  int ans = 0;
  int N; cin >> N;
  rep(i, N) {
	int a; cin >> a;
	ans += (a - 1);
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 256
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long n = long.Parse(Console.ReadLine());
			//int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int n = int.Parse(Console.ReadLine());
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

			// 18bit
			int xor = 0;
			for (int i = 0; i < n; i++) {
				xor ^= a[i];
			}
			//System.Diagnostics.Debug.WriteLine($"{Convert.ToString(xor, 2)}");

			// 1が偶数の時 同じ、1が奇数の時 反転
			for (int i = 0; i < n; i++) {
				int ans = ((a[i] & ~xor) | (~a[i] & xor)) & 0x3fffffff;
				Console.WriteLine(ans);
			}

		}
	}
}



Measured memory_bytes: 53900
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int w = sc.nextInt();
		int h = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		
		if (0 <= x - r && x + r <= w && 0 <= y - r && y + r <= h)
			System.out.println("Yes");
		else
			System.out.println("No");
		
		sc.close();
	}

}

Measured memory_bytes: 26360
x,n=input().split()
x=int(x)
n=int(n)
p=list(map(int,input().split()))
if(n==0):
    print(x)
    exit()
i=0
while(True):
    x_r=x+i
    x_l=x-i

    if(x_l not in p):
        a=x_l
        break
    if(x_r not in p):
        a=x_r
        break

    i+=1


print(a)
    


Measured memory_bytes: 9224
import math
import sys

#n, a, b= map(int, input().split())
#n, x  = map(int, input().split())
s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))

#a = [""]*n
#for i in range(n):
#  a[i] = int(input())

#for i in range(n):
alpha = [chr(i) for i in range(97, 97+26)]
s.sort()
count = 0
ii = 0
n = len(s)
n_alp = len(alpha) - 1
for i in range(n):
  if(s[i] == alpha[ii]):
    ans = alpha[ii]
    ii = ii + 1
    if(ii > n_alp):
      print('None')
      sys.exit()

print(alpha[ii])

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

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

    REP(o, k) {
        vector<int> b(n + 1, 0);
        REP(i, n) {
            int l = max(0, i - a[i]);
            int r = min(n, i + a[i] + 1);
            b[l]++;
            b[r]--;
        }
        REP(i, n) b[i + 1] += b[i];
        b.pop_back();
        if (a == b) break ;
        a = b;
    }

    REP(i, n) {
        cout << a[i];
        if (i != n - 1) cout << ' ';
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 4920
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#define ll long long int
using namespace std;
int main() {
  ll MOD=1000000007;
    ll n,m;
    cin>>n>>m;
    ll x[114514]={};
    ll y[114514]={};
    for(int i=1;i<=n;i++){
        cin>>x[i];
    }
    for(int i=1;i<=m;i++){
        cin>>y[i];
    }
    ll xs=0;
    for(ll i=1;i<=n;i++){
        xs+=(ll)((ll)(i-1)*x[i])%MOD-(ll)((ll)(n-i)*x[i])%MOD;
        xs=xs%MOD;
    }
    ll ys=0;
    for(ll i=1;i<=m;i++){
        ys+=(ll)((ll)(i-1)*y[i])%MOD-(ll)((ll)(m-i)*y[i])%MOD;
        ys=ys%MOD;
    }
    ll ans=xs*ys;
    ans=(ans%MOD+MOD)%MOD;
    cout<<ans<<endl;

}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  vector<int> mi, pl;
  bool f = false;
  rep(i, n-1){
    if(f == false){
      if(a.at(i) < a.at(i+1)){
        mi.push_back(a.at(i));
        f = true;
      }
    }else{
      if(a.at(i) > a.at(i+1)){
        pl.push_back(a.at(i));
        f = false;
      }
    }
  }
  if(f == true) pl.push_back(a.back());
  ll ans = 1000;
  rep(i, pl.size()){
    ll ka = ans/mi.at(i);
    ans %= mi.at(i);
    ans += ka*pl.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int n,h[100005],dp[100005];
int f(int i)
{
	if(i==(n-1) )
	return 0;
	if(dp[i]!=-1)
	return dp[i];
	int ans= abs(h[i]-h[i+1])+f(i+1);
	if( (i+2)<n)
		ans=min(ans,abs(h[i]-h[i+2])+f(i+2));
	return dp[i]=ans;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>h[i];
	memset(dp,-1,sizeof(dp));
	cout<<f(0)<<endl;
	return 0;
}

Measured memory_bytes: 4096