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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long INF = 1LL << 60;
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}

signed main()
{   
    gearup;
    ll res = 0;
    ll n; cin >> n;
    string s; cin >> s;
    rep1(i,n){
        string s1 = s.substr(0,i);
        string s2 = s.substr(i,n-i);
        ll sum = 0;
        int a = 'a'-0;
        rep(j,26){
            char c = a+j;
            if(s1.find(c) != -1 && s2.find(c) != -1)sum++;
            //printf("%c\n",c);
        }
        res = max(sum,res);
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
typedef long long ll;
ll f[1000+10];
int main(){
	int n=read();
	f[0]=2;
	f[1]=1;
	REP(i,2,n) f[i]=f[i-1]+f[i-2];
	printf("%lld\n",f[n]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define sz(x) (x).size()
#define lowbit(x) (x)&(-x)
#define all(x) (x).begin(),(x).end()
#define mem(a,b) memset(a,b,sizeof(a))

namespace FastIO {
#define BUF_SIZE 100000
#define OUT_SIZE 100000
	bool IOerror=0;
	inline char nc() {
		static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
		if(p1==pend) {
			p1=buf;
			pend=buf+fread(buf,1,BUF_SIZE,stdin);
			if(pend==p1) {
				IOerror=1;
				return -1;
			}
		}
		return *p1++;
	}
	inline bool blank(char ch) {
		return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';
	}
	template<class T> inline bool read(T &x) {
		bool sign=0;
		char ch=nc();
		x=0;
		for(; blank(ch); ch=nc());
		if(IOerror)return false;
		if(ch=='-')sign=1,ch=nc();
		for(; ch>='0'&&ch<='9'; ch=nc())x=x*10+ch-'0';
		if(sign)x=-x;
		return true;
	}
	template<class T,class... U>bool read(T& h,U&... t) {
		return read(h)&&read(t...);
	}
#undef OUT_SIZE
#undef BUF_SIZE
};
using namespace std;
using namespace FastIO;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 0x3f3f3f3f;


int main() {

#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif

	ll x;
	cin>>x;
	for(ll i=-1000;i<=1000;i++){
		for(ll j=-1000;j<=1000;j++){
			if(i*i*i*i*i-j*j*j*j*j==x){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	} 




	return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
bool a[10];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < k; i++)
    {
        int num;
        cin >> num;
        a[num] = 1;
    }
    while(1)
    {
        int num = n;
        int flg = 1;
        while(num)
        {
            if(a[num%10])
            {
                flg = 0;
                break;
            }
            num /= 10;
        }
        if(flg)
        {
            break;
        }
        else n++;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# C

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

import itertools

N, M, X = map(int, input().split())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))

ans = float('inf')

for case in list(itertools.product('01', repeat=N)):
    val = [0] * M
    price = 0
    # print(case)
    for j in range(N):
        if case[j]=='1':
            price += data[j][0]
            for m in range(M):
                val[m] += data[j][m+1]

    flg = True
    for m in range(M):
        if val[m] < X:
            flg = False
    if flg:
        ans = min(ans, price)

if ans == float('inf'):
    print(-1)
else:
    print(ans)


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

int main(){
  int N,*bubble;
  int i,j,flag,tmp,k,count=0;
  scanf("%d",&N);
  if(N>=1&&N<=100){//Nの条件は問題文に応じて変更する
    bubble=(int *)malloc(N*sizeof(int));
    for(i=0;i<N;i++){
      scanf("%d",&bubble[i]);
      if(bubble[i]<0||bubble[i]>100){
	exit(1);
      }
    }
    flag=1;
    while(flag){
      flag=0;
      i=0;
      for(j=N-1;j>=i;j--){
	if(bubble[j-1]>bubble[j]){
	  tmp=bubble[j-1];
	  bubble[j-1]=bubble[j];
	  bubble[j]=tmp;
	  flag=1;
	  count++;
	}
      }
      i++;
    }
    for(k=0;k<N;k++){
      if(k!=N-1)printf("%d ",bubble[k]);
      else printf("%d",bubble[k]);
    }
    printf("\n");
    printf("%d\n",count);
  }

  return 0;
}




Measured memory_bytes: 2140
#include <stdio.h>

#define MAX 100

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



Measured memory_bytes: 2052
n,*a=map(int,open(0).read().split())
a.sort()
print(sum(abs(i)for i in a)-2*min(abs(a[-1]),abs(a[0]))*(a[0]*a[-1]>0))
if a[0]>0:
    print(a[0],a[-1])
    a[0]-=a[-1]
    for i in a[1:-2]:
        print(a[0],i)
        a[0]-=i
    print(a[-2],a[0])
elif a[-1]<0:
    for i in a[:-1]:
        print(a[-1],i)
        a[-1]-=i
else:
    for i in a[1:-1]:
        if i<0:
            print(a[-1],i)
            a[-1]-=i
        else:
            print(a[0],i)
            a[0]-=i
    print(a[-1],a[0])

Measured memory_bytes: 20516
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define arr array
#define yes cout << "YES" <<"\n"
#define no cout << "NO" <<"\n"
#define lb lower_bound
#define ub upper_bound
#define fast ios_base::sync_with_stdio(false)
#define out cin.tie(nullptr)
#define task "test"
#define open(task)  if(fopen(task".inp", "r")){freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout);}

using namespace std;

const int maxn = 2*1e5 + 69;
const ll mod = 2111992;

ll a[maxn], rg[maxn];
int n;
ll dp[81][10000][100];
ll maxx = 0;

int main()
{
    fast;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    ll ans = 1000;
    for(int i=1; i<n; i++){
        if(a[i] < a[i+1]){
            ans += (ans/a[i])*(a[i+1]-a[i]);
        }
    }
    cout << ans;
}


Measured memory_bytes: 3616
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    
    if(n>=30){

        cout<<"Yes\n";
        return;
    }  

    cout<<"No\n";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
    int N;
    cin>>N;
    vector<double>a(N);
    rep(i,N)cin>>a[i];
    map<double,int>cnt;
    rep(i,N)cnt[a[i]]++;

    map<double,int>ans;
    int sum=0;
    for(auto &w:cnt){
        ans[w.fi]=sum*3+w.se-1;
        sum+=w.se;
    }

    rep(i,N)cout<<ans[a[i]]<<endl;
    return 0;
}

Measured memory_bytes: 4112
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MOD = 1000000007;

long long mod(long long a) {
	a %= MOD;
	return a >= 0 ? a : a+MOD;
}

long long pow_mod(long long a, long long n) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = (res * a) % MOD;
		n >>= 1;
		a = (a * a) % MOD;
	}
	return res;
}

int main() {
	long long n;
	cin >> n;
	vector<long long> C(n);
	for (int i = 0; i < n; i++) cin >> C[i];
	sort(C.begin(), C.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans = mod(ans + C[n-1-i] * (2 + i) % MOD);
	}
	ans = mod(ans * pow_mod(2, (n-1)<<1));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4704
#include <iostream>
#include <map>
#define MOD 1000000007
using namespace std;
map<pair<string, string>, int> stringtocnt; 
int n;
string s;
int main() {
	cin >> n;
	cin >> s;
	for (int i = 0; i < (1 << n); i++) {
		string reds = "";
		string blues = "";
		for (int j = 0; j < n; j++) {
			if ((1 << j) & i) {
				reds += s[n + j];
			}
			else {
				blues = s[n + j] + blues;
			}
		}
		stringtocnt[make_pair(reds, blues)]++;
	}
	long long int ans = 0;
	for (int i = 0; i < (1 << n); i++) {
		string reds = "";
		string blues = "";
		for (int j = 0; j < n; j++) {
			if ((1 << j) & i) {
				reds += s[j];
			}
			else {
				blues = s[j] + blues;
			}
		}
		ans += stringtocnt[make_pair(blues, reds)];
	}	
	cout << ans << '\n';
}

Measured memory_bytes: 87040
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int K = scan.nextInt();
		int A = scan.nextInt();
		int B = scan.nextInt();

		int max = (B / K) * K;

		if (max >= A){
			System.out.println("OK");
		}else{
			System.out.println("NG");
		}

	}

}

Measured memory_bytes: 35544
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll A, B;
    input(A, B);

    cout << lcm(A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

ll dist[210][210];

int main(){
	int n, m, r; cin >> n >> m >> r;
	vector<int> region(r);
	for( int i = 0; i < r; ++i ){
		cin >> region[i];
		--region[i];
	}
	sort( region.begin(), region.end() );
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			dist[i][j] = INF;
		}
	}
	for( int i = 0; i < n; ++i ) dist[i][i] = 0;
	for( int i = 0; i < m; ++i ){
		int a, b; ll c; cin >> a >> b >> c; --a; --b;
		dist[a][b] = dist[b][a] = c;
	}
	for( int k = 0; k < n; ++k ){
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				dist[i][j] = min( dist[i][j], dist[i][k]+dist[k][j] );
			}
		}
	}
	
	ll ans = INF;
	do {
		ll tempans = 0;
		for( int i = 1; i < r; ++i ){
			// cout << region[i-1] << " " << region[i] << endl;
			tempans += dist[region[i-1]][region[i]];
		}
		ans = min(ans, tempans);
    } while( next_permutation( region.begin(), region.end()) );
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
	int a,b,e;
	scanf("%d%d%d",&a,&b,&e);
	int base = 3 * e;
	int c = base-a-b;
	int i = base-a-e;
	int f = base-c-i;
	int d = base-e-f;
	int h = base-b-e;
	int g = base-a-d;
	printf("%d %d %d\n",a,b,c);
	printf("%d %d %d\n",d,e,f);
	printf("%d %d %d\n",g,h,i);
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <cmath>
#include <tuple>
#include <vector>
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	ll n,k,ans=1;
	std::cin >> n >> k;
	ans = k * pow(k-1,n-1);
	std::cout << ans << std::endl;
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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


// i番目までみて, 時間をjまで使うときの、満足のMAX
ll dp[3010][6010];

int main(int argc, char const *argv[])
{
	int n; ll t; cin >> n >> t;
	vector<pair<ll, ll>> v;
	rep(i, n) {
		int t1, t2; cin >> t1 >> t2;
		v.push_back(make_pair(t1, t2));
	}
	sort(v.begin(), v.end());

	vector<ll> a(n), b(n);
	rep(i, n) {
		a[i] = v[i].first;
		b[i] = v[i].second;
	}

	rep(i, 3010)rep(j, 6010) dp[i][j] = -1;
	dp[0][0] = 0;

	rep(i, n) {
		rep(j, t) {
			if (dp[i][j] == -1)
				continue;
			// select
			dp[i + 1][j + a[i]] = max(dp[i + 1][j + a[i]], dp[i][j] + b[i]);

			// not selcet
			dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
		}
	}

	ll ans = 0;
	// for (int i = 0; i < 6010; ++i) {
	// 	ans = max(ans, dp[n][i]);
	// }
	rep(i, 3010)rep(j, 6010)
		ans = max(ans, dp[i][j]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 141824
#include <bits/stdc++.h>
int n,a,b,p[300005];
int main(){
	scanf("%d%d%d",&n,&a,&b);
	if (n<a+b-1 || n>1ll*a*b){
		puts("-1");
		return 0;
	}
	int cnt=0,now=1;
	for (int i=n-a+1;i<=n;i++){
		p[++cnt]=i;
		int x=std::min(now+b-2,n-a);
		for (int j=1;now<=n-a && j<b;j++,now++)
			p[++cnt]=x--;
	}
	for (int i=1;i<=n;i++) printf("%d ",p[i]);
}

Measured memory_bytes: 4944
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        vector<int> v(n);
        int sm= 0;
        map<int, int> mp;
        lp(i, n) { cin >> v[i]; sm+= v[i]; mp[v[i]]++; }
        int q; cin >> q;
        while (q--) {
                int l, r; cin >> l>> r;
                int val= mp[l];
                sm-= (l* mp[l]);
                mp[l]= 0;
                mp[r]+= val;
                sm+= r*val;
                cout << sm<<"\n";
        }
return 0;
}


Measured memory_bytes: 10088
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, m;
ll a[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n>>m;
    cin>>a[0];
    a[0] /= 2;
    ll ans = a[0];
    for(int i = 1; i < n; i++){
        cin>>a[i];
        a[i] /= 2;

        if(ans % a[i] == 0){
            continue;
        }else{
            ll nx = ans*a[i] / __gcd(ans, a[i]);
            if(nx > m){
                cout<<0<<endl;
                return 0;
            }else{
                ans = nx;
            }
        }
    }
    ll nw = 0;
    for(int i = 0; i < n; i++){
        a[i] = ans / a[i];
        if(a[i] % 2 == 0){
            cout<<0<<endl;
            return 0;
        }else{
            nw = max(nw, a[i]);
        }
    }
    ll cnt = m / ans;
    if(cnt % 2){
        cout<<cnt / 2 + 1;
    }else{
        cout<<cnt / 2<<endl;
    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int b[2005];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,x,y;
	cin>>n>>x>>y;
	int k;
	
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
		{
			k=min(min(abs(j-i),abs(i-x)+1+abs(j-y)),abs(i-y)+1+abs(j-x));
			b[k]++;
		}
	
	for(int i=1; i<=n-1; i++)
		cout<<b[i]<< endl;
		
	return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main() {
  cin.sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  repl(i, 1, n - 1) {
    set<int> s1, s2;
    rep(j, i) {
      s1.insert(s[j]);
    }
    repl(j, i, n) {
      s2.insert(s[j]);
    }
    int cnt = 0;
    each(itr, s1) if (s2.count(itr)) cnt++;
    maxch(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef map<int,int> mapi;
typedef pair<int,int> pr;
vector<pr> data;
vector<int> leader;
int n,q;
int study(int lo,int hi,int needs){
	if(lo>hi)
	return 0;
	int f=lo,s=hi;
	while(f<=s){
	int mid=(f+s)/2;
	if(data[mid].first>=needs)
		s=mid-1;
	else
		f=mid+1;
	}
	return s-lo+1;
}
bool can(int space,int score){
	int sum=0;
	if(leader[0]!=0)
	sum+=study(0,leader[0]-1,data[leader[0]].first-score);
	for(int i=1;i<leader.size();i++){
	int f=leader[i-1]+1,s=leader[i]-1;
	while(data[f].first==data[f-1].first) f++; 
	sum+=study(f,s,data[leader[i]].first-score);
	}
	int c=0;
	for(int i=leader[leader.size()-1]+1;i<n;i++)
		if(data[i].first==data[i-1].first)
			c++;
		else
			break;
	sum+=n-c-(leader[leader.size()-1]+1);
	return space>=sum;

}
int search(int space){
	int f=0,s=pow(10,9);
	while(f<=s){
	int mid=(f+s)/2;
	if(can(space,mid))
		s=mid-1;
	else
		f=mid+1;
	}
	return f;
}
int main() {
	// your code goes here
	int tmp;
	string tmps;
	while(cin >>n >> q && n!=0){
	mapi point;
		for(int i=0;i<n;i++){
			cin >> tmp;
			//point.insert(mapi::value_type(i+1,tmp));
			data.push_back(pr(tmp,i+1));
		}
		sort(data.begin(),data.end());
		for(int i=0;i<n;i++)
			point.insert(mapi::value_type(data[i].second,i));

		for(int j=0;j<q;j++){
			cin >> tmps >> tmp;
			if(tmps=="ADD")
				leader.push_back(point[tmp]);
			if(tmps=="REMOVE"){
				for(vector<int>::iterator it=leader.begin()++;it!=leader.end();++it)
					if(*it==point[tmp]){
						it=leader.erase(it);
						break;
					}
			}
			if(tmps=="CHECK"){
				int ans;
				if(leader.size()==0){
					if(tmp<n)
						ans=1000000001;
					else
						ans=0;
				}
				else
				ans=search(tmp);
				if(ans==1000000001)
				cout << "NA" << endl;
				else
				cout << ans << endl;
			}
			else
			sort(leader.begin(),leader.end());
		}
		
		data.clear();
		leader.clear();
	}
	return 0;
}

Measured memory_bytes: 55972
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    string s;
    cin >> s;
    int G=0,P=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='g')G++;
        else P++;
    }
    cout << (G-P)/2 << endl;
}

Measured memory_bytes: 512
// binary search tree 1
// input command "insert" or "print", print is output in-order tree walk and pre-order tree walk
#include<iostream>
#include<stdlib.h>
#include<string>
typedef struct node{
  struct node *left, *right, *parent;
  int key;
}node;
node *T;
void Insert(int);
void Inorder(node*);
void Preorder(node*);
void Free(node*);
int main(){
  int n, i, key;
  std::string func, ins="insert", pri="print";
  T = new node;;
  T->parent = T->left = T->right = NULL, T->key = -1;
  std::cin >> n;
  for(i=0; i<n; i++){
    std::cin >> func;
    if(func == ins){
      std::cin >> key;
      Insert(key);
    }
    else if(func == pri){
      Inorder(T); std::cout << "\n";
      Preorder(T); std::cout << "\n";
    }
  }
  Free(T);
  return 0;
}
void Inorder(node* X){
  if(X != NULL){
    Inorder(X->left);
    std::cout << " " << X->key;
    Inorder(X->right);
  }
}
void Preorder(node* X){
  if(X != NULL){
    std::cout << " " << X->key;
    Preorder(X->left);
    Preorder(X->right);
  }
}
void Free(node* X){
  if(X != NULL){
    Free(X->left);
    Free(X->right);
    delete X;
  }
}
void Insert(int key){
  node *x, *y, *S;
  if(T->key == -1){
    T->key = key;
    return;
  }
  S = new node;
  S->key = key;
  S->parent = S->left = S->right = NULL;
  x = T;
  while(x != NULL){
    y = x;
    if(key < x->key) x = x->left;
    else x = x->right;
  }
  S->parent = y;
  if(S->key < y->key) y->left = S;
  else y->right = S;
}

Measured memory_bytes: 26500
import java.util.*;
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;//ni();
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = 998244353;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long maxn = 200005;

    static void solve() {
        long r = nlo();
        long d = nlo();
        long x = nlo();
        for (int i = 1; i <= 10; i++) {
            x = r * x - d;
            out.println(x);
        }
    }
}

Measured memory_bytes: 21204
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n, l;
    cin >> n >> l;
    string s[n];
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

    sort(s, s+n);

    for (int i = 0; i < n; i++) {
        cout << s[i];
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a)
    {
        cout<<k;
        return 0;
    }
    if(k>a && k<=a+b)
    {
        cout<<a;
        return 0;
    }
    else if(k>a+b)
    {
        cout<<a-(k-a-b);
        return 0;
    }
    

    return 0;
}


Measured memory_bytes: 3640
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n):
    a[i]+=a[i-1]
i=0
while a[i]<=a[n-1]//2:
    i+=1
left=a[i]
right=a[n-1]-a[i]
ans=abs(left-right)
left=a[i-1]
right=a[n-1]-a[i-1]
ans=min(ans,abs(left-right))
print(ans)

Measured memory_bytes: 89168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            char[] ch = input.ToCharArray();

            for (int i = 0; i < ch.Length; i++)
            {
                if (ch[i] >= 'a' && ch[i] <= 'z')
                {
                    ch[i] = (char)(ch[i] - 32);
                }
            }
            Console.WriteLine(new string(ch));
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    Vec a(n);
    rep(i,n){
        cin>>a[i];
    }
    vector<P> ptn;

    rep(i,m){
        ll b,c;
        cin>>b>>c;
        ptn.pb(mp(b,c));
    }
    sort(ALL(ptn),[](P a, P b)->int {
        return a.second>b.second;
    });

    Vec add(n*2);
    ll cards = 0;
    rep(i,m){
        P &card = ptn[i];
        fill(add.begin()+cards,add.begin()+cards+card.fi,card.se);
        cards += card.fi;
        if(cards>=n){
            break;
        }
    }

    a.reserve(3*n+5);
    copy(ALL(add),back_inserter(a));
    sort(ALL(a),greater<ll>());
    ll ans=0;
    rep(i,n){
        ans += a[i];
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 6640
#include<stdio.h>
#include<stdlib.h>
#define N 1000

int main(){
  int n,m,i,j;
  int M[N][N];
  int nm,cn;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&nm,&m);
    for(j=0;j<m;j++){
      scanf("%d",&cn);
      M[nm-1][cn-1]=1;
    } 
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2192
mod utils {
    use std::error::Error;
    use std::io::stdin;
    use std::str::FromStr;

    #[allow(dead_code)]
    pub fn read_line<T>() -> Result<Vec<T>, Box<Error>>
    where
        T: FromStr,
        T::Err: 'static + Error,
    {
        let mut line = String::new();
        let _ = stdin().read_line(&mut line)?;
        let parsed_line = line.split_whitespace()
            .map(|x| x.parse::<T>())
            .collect::<Result<Vec<T>, T::Err>>()?;

        Ok(parsed_line)
    }

    #[allow(dead_code)]
    pub fn read_lines<T>(n: usize) -> Result<Vec<Vec<T>>, Box<Error>>
    where
        T: FromStr,
        T::Err: 'static + Error,
    {
        (0..n).map(|_| read_line()).collect()
    }
}

fn solve() -> Result<(), Box<std::error::Error>> {
    let n = utils::read_line::<usize>()?[0];
    let s = &utils::read_line::<String>()?[0];
    let mut s = s.split("").collect::<Vec<_>>();

    s.remove(n + 1);
    s.remove(0);

    let mut prev_is_x = false;

    for i in 0..n {
        let current_is_x = s[i] == "x";
        if prev_is_x && current_is_x {
            println!("{}", i);
            break;
        } else if i == n - 1 {
            println!("{}", i + 1);
        }
        prev_is_x = current_is_x;
    }

    Ok(())
}

fn main() {
    match solve() {
        Err(err) => panic!("{}", err),
        _ => (),
    };
}



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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

int main() {
    ll n;
    int ans = INF;
    cin >> n;
    for (ll i = 1; i <= sqrt(n); ++i) {
        if (n % i == 0) {
            ans = min(ans, max((int)log10(i) + 1, (int)log10(n / i) + 1));
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 10, mod = 1e9 + 7;

int n, m;
LL res;
bool g[N][N];
bool st[N];

void dfs(int u, int c)
{
    if(c == n && !st[u])
    {
        res++;
        return;
    }

    st[u] = true;
    for(int i = 1; i <= n; i++)
        if(g[u][i] && !st[i])
            dfs(i, c + 1);
    st[u] = false;
}

int main()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a][b] = g[b][a] = true;
    }

    dfs(1, 1);

    cout << res << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



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

    vector<tuple<string,int,int>> t(n);

    for(int i=0;i<n;i++){
        string a;int b;
        cin >> a >> b;
        t[i] = make_tuple(a,-b,i);
    }

    sort(t);

    for(int i=0;i<n;i++){
        cout << get<2>(t[i])+1 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  long int n,x,a,b,ans=0,t;
  scanf("%ld%ld",&n,&x);
  a=(x*2<n)? x:n-x;
  b=n-a;
  while (a){
    t=b%a;
    ans+=b-t;
    b=a;
    a=t;
  }
  printf("%ld",ans*3);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

ll power(ll x,ll n){
    if(n==0) return 1;
    ll res=power(x*x%mod,n/2);
    if(n&1) res=res*x%mod;
    return res;
}

int main(){
  int n,k;
  cin>>n>>k;
  bool p[10];
  rep(i,0,10){
    p[i]=true;
  }
  rep(i,0,k){
    int d;
    cin>>d;
    p[d]=false;
  }
  
  while(true){
    string s=to_string(n);
    bool q=true;
    rep(i,0,s.size()){
      if(!p[s[i]-'0']) q=false;
    }
    if(q){
      cout<<n<<endl;
      break;
    }
    n++;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  //連結条件から
  if(K>(N-1)*(N-2)/2){
    cout << -1 << endl;
    return 0;
  }
  cout << N*(N-1)/2 - K << endl;
  //全部つなぐ
  int count = N-1;
  rep(i,N-1){
    cout << 1 SP i+2 << endl;
  }
  repp(i,1,N){
    repp(j,i+1,N){
      if(count == (N)*(N-1)/2-K) return 0;
      cout << i+1 SP j+1 << endl;
      count++;
    }
  }
  return 0;
}


Measured memory_bytes: 256
s=[t=l=0]*17
c=(0..99).map{|i|[i*5,i%5==1?5:2,17*(i%2)+3*(i%3)+19]}
(a,n,b=c[l];(a<=t&&(z=[*s.each_cons(n)].index{|j|j.all?{|i|i<=t}}))?(s[z,n]=[t+b]*n;c[l]=t-a;l+=1):t+=1)while c[l]
$<.map{|i|p c[i.to_i]}

Measured memory_bytes: 6100
// atcoder/abc131/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  int n, l;
  while (cin >> n >> l) {
    vector<lli> a;
    for (int i = 0; i < n; ++i) {
      a.push_back(l + i);
    }
    sort(a.begin(), a.end(), [] (auto i, auto j) { return abs(i) < abs(j); });
    lli x = accumulate(a.begin(), a.end(), 0LL);
    cout << x - a.front() << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
 
n,m,k = map(int,input().split())
ab = [set() for _ in range(n)]
cd = [[] * n for _ in range(n)]

 
#Union Find
 
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
 
#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]
 
#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

for _ in range(m):
    a, b = [int(x) for x in input().split()]
    unite(a - 1, b - 1)
    ab[a - 1].add(b - 1)
    ab[b - 1].add(a - 1)

for i in range(k):
    c, d = [int(x) for x in input().split()]
    if same(c - 1, d - 1):
        cd[c - 1].append(d - 1)
        cd[d - 1].append(c - 1)

ans = [0] * n

for i in range(n):
    ans[i] = size(i) - 1 - len(cd[i]) - len(ab[i])

print(*ans)




Measured memory_bytes: 64496
fn main() {
    let mut buf = String::new();
    let stdin = std::io::stdin();
    stdin.read_line(&mut buf).unwrap();
    let mut ap = buf.split_whitespace().map(|x|x.parse::<u32>().unwrap());
    let a = ap.next().unwrap();
    let p = ap.next().unwrap();
    println!("{}", (a * 3 + p) / 2);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    ll x,d;
    cin>>x>>d;
    ll l,r,cnt=0;
    for (int i=0;i<x;i++){
        cin>>l>>r;
        long double dis=sqrt(l*l+r*r);
        if (dis<=d)
            cnt++;
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3696
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int M = in.Int();
            int[] H = in.Int(N);
            int[] A = new int[M];
            int[] B = new int[M];
            for (int i = 0; i < M; i++) {
                A[i] = in.Int() - 1;
                B[i] = in.Int() - 1;
            }

            Map<Integer, List<Integer>> map = new HashMap<>();
            for (int i = 0; i < N; i++) {
                map.put(i, new ArrayList<>());
            }
            for (int i = 0; i < M; i++) {
                map.get(A[i]).add(B[i]);
                map.get(B[i]).add(A[i]);
            }
            int cnt = 0;
            for (int i = 0; i < N; i++) {
                int ha = H[i];
                if (map.get(i).size() > 0) {
                    boolean f = true;
                    for (int bi : map.get(i)) {
                        int hb = H[bi];
                        if (ha <= hb) {
                            f = false;
                            break;
                        }
                    }
                    if (f) {
                        cnt++;
                    }
                } else {
                    cnt++;
                }
            }
            out.println(cnt);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 71592
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

int main()
{
    int num;
    string str;
    cin >> num >> str;
    string red = "R";
    string green = "G";
    string blue = "B";
    int rn[4100] = {}, gn[4100] = {}, bn[4100] = {};
    for(int i=num-1;i>=0;i--){
        if(str.compare(i,1,red)==0){
            rn[i]=rn[i+1]+1;
            gn[i]=gn[i+1];
            bn[i]=bn[i+1];
        }else if(str.compare(i,1,green)==0){
            rn[i]=rn[i+1];
            gn[i]=gn[i+1]+1;
            bn[i]=bn[i+1];
        }else{
            rn[i]=rn[i+1];
            gn[i]=gn[i+1];
            bn[i]=bn[i+1]+1;
        }
    }
    int judge1,judge2;
    //0 = R,1 = G, 2 = B
    long long ans  = 0;
    for(int i=0;i<num;i++){
        if(str.compare(i,1,red)==0){
            judge1 = 0;
        }else if(str.compare(i,1,green)==0){
            judge1 = 1;
        }else{
            judge1 =2;
        }
        for(int j=i+1;j<num;j++){
            if(str.compare(j,1,red)==0){
                judge2 = 0;
            }else if(str.compare(j,1,green)==0){
                judge2 = 1;
            }else{
                judge2 = 2;
            }
            if(judge1==judge2){
                continue;
            }else{
                if(judge1 + judge2 == 1){
                    ans += bn[j+1];
                    if((j+j-i<num)&&(str.compare(j+j-i,1,blue)==0)){
                        ans --;
                    }
                }else if(judge1 + judge2 == 3){
                    ans += rn[j+1];
                    if((j+j-i<num)&&(str.compare(j+j-i,1,red)==0)){
                        ans --;
                    }
                }else{
                    ans += gn[j+1];
                    if((j+j-i<num)&&(str.compare(j+j-i,1,green)==0)){
                        ans --;
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 3284
#include<stdio.h>
#include<math.h>

int main(void){
  double a,b,c,d,e,f;
  double x,y;
  int i=0,j;

  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){

    x=(e*c-b*f)/(a*e-b*d);
    y=(a*f-d*c)/(a*e-b*d);

    if(fabs(x)==x)
      x=fabs(x);
    if(fabs(y)==y)
      y=fabs(y);
      
    printf("%.3f %.3f\n",x,y);

  }
  return 0;
}

Measured memory_bytes: 652
#include <stdio.h>
int B[101];
void insertionSort(int n);
void Print(int n);
int main(void){
	int i,n;

	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&B[i]);
	insertionSort(n);
	return 0;
}

void insertionSort(int n){
	int i,j,v;
	for(i=0;i<n;i++){
		v = B[i];
		j = i - 1;
		while(j>=0 && B[j]>v){
			B[j+1] = B[j];
			j--;
			B[j+1] = v;
		}
		Print(n);
	}
}
void Print(int n){
	int k;
	for(k=0;k<n;k++){
		if(k) printf(" ");
		printf("%d",B[k]);
	}
	printf("\n");
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a < b) a = b; }
template<class T> void chmin(T& a, T b) { if(a > b) a = b; }
typedef long long ll;

const ll INF = 1LL << 60;
const ll MAX_N = 110;
const ll MAX_V = 100100;

int main() {
    ll N, W; cin >> N >> W;
    vector<ll> weight(N);
    vector<ll> value(N);
    for(int i = 0; i < N; i++){
        cin >> weight[i] >> value[i];
    }

    vector<vector<ll> > dp(MAX_N, vector<ll>(MAX_V, INF));
    dp[0][0] = 0;
    for(ll i = 0; i < N; i++){
        for(ll v = 0; v <= MAX_V; v++){
            if(v - value[i] >= 0){
                chmin(dp[i + 1][v], dp[i][v - value[i]] + weight[i]);
            }
            chmin(dp[i + 1][v], dp[i][v]);
        }
    }
    ll ans = 0;
    for(int v = 0; v < MAX_V; v++){
        if(dp[N][v] <= W) ans = v;
    }
    cout << ans << endl;
}


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

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

int n;
ll x[51],y[51];
set<pii> st;

int main(){
	cin>>n;
	for (int i=1;i<=n;i++) cin>>x[i]>>y[i];
	if (n==1){
		cout<<1<<endl;
		return 0;
	}
	ll ans=n+1;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if (i==j) continue;
			if (x[i]==x[j] && y[i]==y[j]) continue;
			if (x[i]>x[j]) continue;
			ll p=x[j]-x[i],q=y[j]-y[i];
			
			st.clear();
			for (int i=1;i<=n;i++)
				st.insert(make_pair(x[i],y[i]));
			ll tmp=0;
			pii pre;
			bool first=true;
			while (st.size()){
				pii nx=make_pair(pre.first+p,pre.second+q);
				if (!first && st.count(nx)){
					pre=nx;
					st.erase(nx);
				}
				else{
					pre=*st.begin();
					st.erase(st.begin());
					tmp++;
				}
				first=false;
			}
			//cout<<p<<" "<<q<<endl;
			ans=min(ans,tmp);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256