akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>

using namespace std;

struct str
{
    int t,x,y;
};

str v[100010];

int cmp(str a,str b)
{
    return a.t<b.t;
}

int main()
{
    //freopen("file.in","r",stdin);
    //freopen("file.out","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d%d",&v[i].t,&v[i].x,&v[i].y);
    int x=0,y=0,t=0;
    sort(v+1,v+n+1,cmp);
    for(int i=1;i<=n;i++)
    {
        int dist=abs(v[i].x-x)+abs(v[i].y-y);
        if(dist>v[i].t-t or (x==v[i].x && y==v[i].y)) {printf("No");return 0;}
        if((v[i].t-t-dist)%2==1) {printf("No");return 0;}
        x=v[i].x;y=v[i].y;t=v[i].t;
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cout << #x " = " << (x) << '\n';
#define P(x) cout << #x << '\n';    
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;


int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(9);
	#ifdef LOCAL_DEFINE
		freopen("in.txt", "rt", stdin);
	#endif
	
	
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++ i)
		cin >> a[i];
	int p1 = 0, p2 = n - 1, s1 = a[0], s2 = a[n - 1];
	while(p2 - p1 > 1)
	{
		if(s1 < s2)
		{
			++ p1;
			s1 += a[p1];
		}
		else
		{
			-- p2;
			s2 += a[p2];
		}
	}
	cout << abs(s1 - s2) << '\n';
	
	return 0;
}






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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    int now=1;
    rep(i,n){
        now=a[now-1];
        if(now==2){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 640
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]
n = int(input())
b = []
c = [0]*9
for i in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                c[i*3+j] = 1
ans = 'No'
if c[0]==c[3]==c[6]==1 or c[1]==c[4]==c[7]==1 or c[2]==c[5]==c[8]==1:
    ans = 'Yes'
elif c[0]==c[1]==c[2]==1 or c[3]==c[4]==c[5]==1 or c[6]==c[7]==c[8]==1:
    ans = 'Yes'
elif c[0]==c[4]==c[8]==1 or c[2]==c[4]==c[6]==1:
    ans = 'Yes'

print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
	int w;
	int a, b;
	cin >> w >> a >> b;
	
	int A = min(a, b);
	int B = max(a, b);
	
	cout << max(0, B-(A+w)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
  string s;
  cin>>s;
  int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
  if(a+b+c+d==7)
  cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;
  else if(a+b-c+d==7)
  cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;
  else if(a+b-c-d==7)
  cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;
  else if(a+b+c-d==7)
  cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;
  else if(a-b+c+d==7)
  cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;
  else if(a-b+c-d==7)
  cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;
  else if(a-b-c+d==7)
  cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;
  else if(a-b-c-d==7)
  cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;
    }
  
  
  
  

  
  

 


Measured memory_bytes: 256
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//s配列に格納した単語を、辞書順にソートする
//getline(cin, s);
//  sort(s.begin(), s.end());
//  string t = "keyence";//で文字列入力ができる
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int kan_hyaku(int n){
  int kurai = 0;
  for(int i=0;i<3;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ju(int n){
  int kurai = 0;
  for(int i=0;i<2;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ichi(int n){
  int kurai = 0;
  for(int i=0;i<1;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll range = b-a+1;
  ll c_baisuu = b/c - a/c;
  if(a%c == 0){
    c_baisuu ++;
  } 
  ll d_baisuu = b/d - a/d;
  if(a%d == 0){
    d_baisuu ++;
  }

  ll candd_baisuu = b/lcm(c,d) - a/lcm(c,d);
  if(a%lcm(c,d) == 0){
    candd_baisuu ++;
  }

  ll hikumono = c_baisuu + d_baisuu - candd_baisuu;
  cout <<  range - hikumono << endl;
/*
  cout << range << endl;
  cout << c_baisuu <<endl;
  cout << d_baisuu <<endl;
  cout << candd_baisuu <<endl;
  
  cout << hikumono << endl;
  */
}


Measured memory_bytes: 3584
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
const int maxn = 2e5 + 100;
ll a[maxn];
ll n;
ll dp[maxn][2];
ll solve(ll i, ll change)
{
	ll mul = 1;
	if (change) mul = -1;
	if (dp[i][change] != -1)
		return dp[i][change];
	if (i == n - 1)
		return dp[i][change] = a[i] * mul;
	ll val = a[i] * mul;
	ll nVal = -val;
	ll ans = INT_MIN;
	ans = max(ans, solve(i + 1, 1) + nVal);
	ans = max(ans, solve(i + 1, 0) + val);
	return dp[i][change] = ans;
}
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	cin >> n;
	// ll a[n];
	rep(i, 0, n)
	cin >> a[i];
	mems(dp, -1);
	cout << solve(0, 0);
	return 0;
}

Measured memory_bytes: 12200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> s(n);
	rep(i, n) cin >> s[i];

	int mi = 101;
	int cnt = 0;
	rep(i, n) {
		if (s[i] % 10 != 0) mi = min(mi, s[i]);
		else cnt++;
	}
	if (cnt == n) {
		cout << 0 << endl;
		return 0;
	}
	int sum = 0;
	rep(i, n) sum += s[i];
	if (sum % 10 == 0) sum -= mi;
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3") 
// #pragma GCC optimization ("unroll-loops")
 
#define ll  long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define S second
#define F first
#define die() return 0;
 
#define md         1000000007
#define M           1000011
#define N 			12

ll f(vector<ll> v,ll val){

	ll cnt=0,i;
	vector<ll> v2=v;
	reverse(all(v2));
	for(i=0;i<v.size();++i){
		// ll k=val/v[i];
		ll x=-1;
		if(v[i]==0){
			if(val>=0)cnt+=v.size()-1;
			continue;

		}
		else if(v[i]>0){
			ll p=v.size();
			for(;p>=1;p/=2){
				while(x+p<v.size()&&v[i]*v[x+p]<=val)x+=p;
			}
		if(x!=-1&&(v[i]<=v[x]))--x;
		++x;

	}
	else{
			ll p=v.size();
			for(;p>=1;p/=2){
				while(x+p<v.size()&&abs(v[i])*v2[x+p]>=-1*val)x+=p;
			}

		if(x!=-1&&(v[i]>=v2[x]))--x;
		++x;



	}
	cnt+=x;

	}
	return cnt/2;

}
int solve(){
	ll n,i,j,k,m,x;
	cin>>n>>k;
	vector<ll> v(n);
	for(i=0;i<n;++i)cin>>v[i];
	sort(all(v));
	ll ans=1e18;
	ll p=1e18;
	x=-1e18;
	// cout<<f(v,6)<<"aa\n";
	// die();
	for(;p>=1;p/=2){
		while(x+p<=1e18&&f(v,x+p)<k)x+=p;

	}
	cout<<++x<<"\n";

	die();



}
 
 
int main(){
 
 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    t=1;
    // prec();
    // cin>>t;
 
    while(t--){
    	solve();
    }
 
 
 
 
 
    die();
}

Measured memory_bytes: 5016
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define SQ(x) (x)*(x)
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define debug(x) cerr<<#x<<" is "<<x<<endl
using namespace std;

// #define int ll

const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"No\n"; exit(0);}

ll mpow(ll a, ll n){ // a^n % mod
    ll re=1;
    while (n>0){
        if (n&1) re = re*a %mod;
        a = a*a %mod;
        n>>=1;
    }
    return re;
}

ll inv (ll b){
    if (b==1) return b;
    return (mod-mod/b) * inv(mod%b) % mod;
}

const int maxn = 1e5+5;

main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, m; cin>>n>>m;
    vector<vector<int>> v(m+1);
    REP(i,n){
        int a, b; cin>>a>>b;
        if (a<=m) v[a].pb(b);
    }
    map<int,int> st;
    ll re = 0;
    FOR(i,1,m+1){
        for (int x : v[i] ) st[x]++;
        if (st.size()){
            int tmp = (*st.rbegin()).f;
            re += tmp;
            st[tmp]--;
            if (st[tmp]==0) st.erase(tmp);
        }
    }
    cout<<re<<endl;
    
} 

Measured memory_bytes: 5632
#include<cstdio>
#define mod 1000000007
using namespace std;
long long jie[1000005];
long long qpow(long long a, long long b)
{
    long long ans=1;
    while(b)
    {
        if(b%2)
            ans=(ans*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return ans%mod;
}
void f()
{
    jie[0]=1;
    for(int i=1;i<1000001;i++)
        jie[i]=(jie[i-1]*i)%mod;
}
long long zuhe(long long n, long long m)
{
    long long a=jie[n];
    long long b=(jie[m]*jie[n-m])%mod;
    return (a*qpow(b, mod-2))%mod;
}
int main()
{
    f();
    long long h, w, a, b, ans=0;
    scanf("%lld%lld%lld%lld", &h, &w, &a, &b);
    for(int i=b+1;i<=w;i++)
    {
        long long temp=(zuhe(h-a+i-2, h-a-1)%mod*zuhe(w-i+a-1, w-i)%mod)%mod;
        ans=(ans+temp)%mod;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
#define For(i,n) for(int i=0; i<=n; i++)
using namespace std;
int main()
{
    string s;
    cin>>s;
    int si = s.size()-1, i, a=0, b=0;
    For(i,si)
    {
        s[i] =='0' ? a++ : b++;

    }
    cout<<2*(min(a,b))<<endl;
    
    return 0;
}


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

int main(){
  int n, x;
  cin >> n >> x;
  int L, num = 0;
  int ans = 1;
  
  for (int i = 0; i < n; i++) {
    cin >> L;
    num += L;
    if (num <= x) ++ans;
  }
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
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() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long
#define Graph vector<vector<int> >
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数定義や変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

string s;
int c=0;
cin>>s;
REP(i,3)
{
	if(s[i]=='1') c++;
}

cout<<c<<endl;


return 0;

}

Measured memory_bytes: 3652
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<=n;i++)
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;


/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
 string S;
 string A;
 cin >> S;
int ans = 0;
if(S[0] == '0'){
REP(i,S.size()){
    if(i%2 == 0){
       A += '0';
    }
    else{
        A +='1';
    }
}
}
else{
    REP(i,S.size()){
    if(i%2 == 0){
        A += '1';
    }
    else{
        A += '0';
    }
}
}
REP(i,S.size()){
    if(A[i] != S[i]){
        ans++;
    }
}
cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n, r;
    cin>>n>>r;
    int ans=r;
    if(n>=10){

    }
    else{
    	// int d
    	ans=r+100*(10-n);
    }
    cout<<ans<<"\n";

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  string s;
  set<string> st;

  for (int i = 0; i < n; i++) {
    cin >> s;
    st.insert(s);
  }

  for (auto itr = st.begin(); itr != st.end(); itr++) {
    cnt++;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 19224
# https://atcoder.jp/contests/arc100/tasks/arc100_a

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

for i in range(n):
    nums[i] -= i + 1
nums.sort()
ans = 0
mid = nums[n // 2]
for i in range(n):
    ans += abs(nums[i] - mid)
print(ans)

Measured memory_bytes: 86740
X,Y,Z,K=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)
B=[int(x) for x in input().split()]
B.sort(reverse=True)
C=[int(x) for x in input().split()]
C.sort(reverse=True)
D=[a+b for a in A for b in B]
D.sort(reverse=True)
D=D[:3000]
E=[ab+c for ab in D for c in C]
E.sort(reverse=True)
for i in range(K):
  print(E[i])


Measured memory_bytes: 136392
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("YES") if fl else print("NO")
import collections
import math
import itertools
import heapq as hq
gcd = math.gcd
n = ni()
A = lma()
gcd_l = [1]*n
gcd_l[0]=A[0]
gcd_r =[1]*n
gcd_r[-1] = A[-1]
for i in range(1,n):
    gcd_l[i] = gcd(A[i],gcd_l[i-1])
    gcd_r[-i-1] = gcd(A[-i-1],gcd_r[-i])
ans = max(gcd_l[-2],gcd_r[1])
for i in range(1,n-1):
    ggg = gcd(gcd_l[i-1],gcd_r[i+1])
    ans = max(ans,ggg)
print(ans)


Measured memory_bytes: 21316
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> B,A,vec,AB;
	rep(i,n){
		string s;
		cin >> s;
		if(s[0] == 'B' && s[s.end()-s.begin()-1] == 'A') AB.emplace_back(s);
		else if(s[0] == 'B') B.emplace_back(s);
		else if(s[s.end()-s.begin()-1] == 'A') A.emplace_back(s);
		else vec.emplace_back(s);
	}
	string s;
	if(A.size() != 0) s += A[0];
	int ABs = AB.size();
	rep(i,ABs){
		s += AB[i];
	}
	int As = A.size(),Bs = B.size();
	rep(i,(As == 0 ? 0 : As-1) + Bs){
		if(i < Bs) s += B[i];
		if(i+1 < As) s += A[i+1];
	}
	int vs = vec.size();
	rep(i,vs){
		s += vec[i];
	}
	int cnt = 0;
	int ss = s.size();
	rep(i,ss-1){
		if(s[i] == 'A' && s[i+1] == 'B'){
			++cnt;
			++i;
		}
	}
	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a < b) swap(a, b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
struct sieve_of_eratosthenes {
  vector<bool> is_prime;
  vector<int> prime_numbers;
  sieve_of_eratosthenes(int n)
    : is_prime(vector<bool>(n, true))
    , prime_numbers(vector<int>(0))
  {
    is_prime[1] = false;
    for (int i = 2; i < n; i++) if (is_prime[i]) {
      prime_numbers.push_back(i);
      for (int j = 2 * i; j < n; j += i) {
        if (is_prime[i]) is_prime[j] = false;
      }
    }
  }
};
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = n; i >= 0; i--) cin >> a[i];
  sieve_of_eratosthenes sieve(n + 1);
  set<int> ret;
  for (auto const&p : sieve.prime_numbers) {
    if (a[0] % p) continue;
    bool flg = false;
    for (int i = 0; i < p - 1; i++) {
      int tmp = 0;
      for (int j = i; j <= n; j += p - 1) {
        tmp += a[j];
      }
      if (tmp % p) {
        flg = true;
        break;
      }
    }
    if (!flg) ret.insert(p);
  }
  int g = a[0];
  for (int i = 1; i <= n; i++) g = gcd(g, a[i]);
  for (int p = 2; p * p <= g; p++) {
    while (!(g % p)) {
      g /= p;
      ret.insert(p);
    }
  }
  if (g != 1) ret.insert(g);
  for (auto it = ret.begin(); it != ret.end(); it++) {
    cout << *it << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc.A
{
    public class Question
    {
        public static void Main(string[] args)
        {
            new Question().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string s1 = cin.Read;
            string s2 = cin.Read;
            bool flag = true;
            for (int i = 0; i < 3; i++)
            {
                if(s1[i] != s2[2 - i])
                {
                    flag = false;
                    break;
                }
            }
            Console.WriteLine(flag ? "YES" : "NO");
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 26180
#include<iostream>
using namespace std;
int main(){
	int a[4]={0},b[4]={0},hi,br;
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		hi=0;
		br=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}
		}
		for(int i=0;i<4;i++){
			for(int n=0;n<4;n++){
				if(i!=n&&a[i]==b[n]){
					br++;
				}
			}
		}
		cout<<hi<<" "<<br<<endl;
	}
}

Measured memory_bytes: 3076
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools

def main():
    node_num, q_num = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(node_num - 1)]
    q_data = [list(map(int, input().split())) for i in range(q_num)]

    graph_data = defaultdict(set)
    for i in range(node_num - 1):
        a, b = data[i]
        graph_data[a].add(b)
        graph_data[b].add(a)

    ans_list = [0 for i in range(node_num + 1)]
    for i in range(q_num):
        a, b = q_data[i]
        ans_list[a] += b

    parent_node = [0 for i in range(node_num + 1)]
    parent_node[1] = 1
    now_set = set()
    now_set.add(1)
    next_set = set()
    while len(now_set) > 0:
        for now_ele in now_set:
            for next_ele in graph_data[now_ele]:
                if parent_node[next_ele]:
                    continue
                parent_node[next_ele] = now_ele
                next_set.add(next_ele)
        now_set = next_set
        next_set = set()

    visit_flg = [0 for i in range(node_num + 1)]
    visit_flg[1] = 1
    now_set = set()
    now_set.add(1)
    next_set = set()
    while len(now_set) > 0:
        for now_ele in now_set:
            for next_ele in graph_data[now_ele]:
                if visit_flg[next_ele]:
                    continue
                visit_flg[next_ele] = 1
                ans_list[next_ele] += ans_list[now_ele]
                next_set.add(next_ele)
        now_set = next_set
        next_set = set()

    for i in range(1, node_num + 1):
        print(ans_list[i], end='')
        if i == node_num:
            print()
        else:
            print(' ',end='')





if __name__ == '__main__':
    main()



Measured memory_bytes: 173408
import math
X = int(input())

if X == 2 or X == 3:
    print(X)
    exit()

x = X
while 1:
    flag = 1
    for i in range(2,int(math.sqrt(X))+1):
        if x%i == 0:
            flag = 0
    if flag:
        print(x)
        break
    x += 1



Measured memory_bytes: 38760
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

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

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

int N, M;
vector<int> A(1000);
void solve() {
  cin >> N >> M;
  long double sum = 0;
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    sum += A.at(i);
  }
  int counter = 0;
  for(int i = 0; i < N; i++){
    if(A.at(i) >= sum / (4 * M)){
      counter++;
    }
  }
  if(counter >= M){
    cout << "Yes" <<endl;
  } else{ 
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    //Seiranchan!
    long long  N,K,ans;
    cin >> N>> K;

    vector<long long> vec(N);
    long long  size = vec.size();
    REP(i,N) cin >> vec[i];

    SORT(vec);

    for(long long  i=0;i<=size-K;i++){
        if(i==0){
            ans = vec[i+K-1]-vec[i];
        }else{
        ans = min(ans,(vec[i+K-1]-vec[i]));
    }
    }

    cout << ans <<endl;

}


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

int main()
{
    long long Q, H, S, D;
    cin >> Q >> H >> S >> D;
    long long n;
    cin >> n;

    int d = min(D, min(2 * S, min(4 * H, 8 * Q)));
    int s = min(S, min(2 * H, 4 * Q));
    int h = min(H, 2 * Q);
    int q = Q;

    n = n * 4;
    long long answer = 0;
    answer += n / 8 * d;
    n = n % 8;
    answer += n / 4 * s;
    n = n % 4;
    answer += n / 2 * h;
    n = n % 2;
    answer += n * q;

    cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> vec(H,vector<char>(W));
  for (int i=0; i<H; ++i) {
    for (int j=0; j<W; ++j) {
      cin >> vec.at(i).at(j);
    }
  }
  while (1) {
    int b=0;
    int c=0;
    for (int i=0; i<H; ++i) {
      int a=1;
      for (int j=0; j<W; ++j) {
        if (vec.at(i).at(j) != '.') {
          a=0;
        }
      }
      if (a==1) {
        b=1;
        c=i;
        break;
      }
    }
    if (b==1) {
      for (int i=c; i<H-1; ++i) {
        for (int j=0; j<W; ++j) {
          vec.at(i).at(j) = vec.at(i+1).at(j);
        }
      }
      H -= 1;
    }
    int d=0;
    int e=0;
    for (int i=0; i<W; ++i) {
      int a=1;
      for (int j=0; j<H; ++j) {
        if (vec.at(j).at(i) != '.') {
          a=0;
        }
      }
      if (a==1) {
        d=1;
        e=i;
        break;
      }
    }
    if (d==1) {
      for (int i=e; i<W-1; ++i) {
        for (int j=0; j<H; ++j) {
          vec.at(j).at(i) = vec.at(j).at(i+1);
        }
      }
      W -= 1;
    }
    if (b == 0 && d == 0) {
      break;
    }
  }
  for (int i=0; i<H; ++i) {
    for (int j=0; j<W; ++j) {
      cout << vec.at(i).at(j);
    }
    cout << endl;
  }
}
        
        
        
        
        
        
        


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1e9+7;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
typedef pair<ll, ll> pll;

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

int main() {
    long long a[4];
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    long long ans = a[0] * a[2];
    ans = max(ans, a[1] * a[2]);
    ans = max(ans, a[0] * a[3]);
    ans = max(ans, a[1] * a[3]);
    cout << ans << endl;
    
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int N=100000+10,M=1500,INF=0x3f3f3f3f;
int main()
{
    char s[N];
    int sz[N];
    while(~scanf("%s",s)){
        memset(sz,0,sizeof(sz));
        bool flag=0;
        char t[N];
        int n=1;
        for(int i=0;i<strlen(s);i++){
            if(s[i]!='x')  {sz[n]=i;t[n++]=s[i];}
        }
        sz[0]=0;
        sz[n]=strlen(s)-1;
        n--;
        for(int i=1;i<=n/2;i++){
            if(t[i]!=t[n+1-i]){
                flag=1;break;
            }

        }
        if(flag) printf("-1\n");
        else {
            int ans=0;
            for(int i=1;i<=(n+1)/2;i++){
                ans+=abs((sz[i]-sz[i-1])-(sz[n+1-i+1]-sz[n+1-i]));
            }
            printf("%d\n",ans);
        }
    }
    return 0;
 }


Measured memory_bytes: 768
#include<cstdio>
#include<cstring>
using namespace std;
int m[26];char s[200005];
int main()
{
	scanf("%s",s);
	int n=strlen(s);
	long long ans=1ll*n*(n+1)/2;
	for(int i=0;i<n;++i)
		++m[s[i]-'a'];
	for(int i=0;i<n;++i)
		ans-=(m[s[i]-'a']--);
	printf("%lld\n",ans+1);
	return 0;
}

Measured memory_bytes: 384
# AOJ 0016 Treasure Hunt
# Python3 2018.6.15 bal4u

import math

PI = 3.1415926535897932384626433832795
M = 0.01745329251994329576923690768489
EPS = 1e-8

r, q, f = 0, 90*M, 0
while True:
	d, a = list(map(int, input().split(',')))
	if d == 0 and a == 0: break
	r2 = math.sqrt(r*r + d*d - 2*r*d*math.cos(PI - math.fabs(f)))
	if math.fabs(r) < EPS or math.fabs(r2) < EPS:
		q2 = q - f
		f = a * M
	else:
		t = math.acos((r*r + r2*r2 - d*d) / (2 * r*r2));
		if f >= 0:
			q2 = q - t
			f += a*M - t
		else:
			q2 = q + t
			f += a*M + t
	r = r2
	q = q2
print(int(r * math.cos(q)), int(r * math.sin(q)), sep='\n')


Measured memory_bytes: 5744
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
l=n*m//g
for i in range(n):
  if i%(n//g)==0 and not s[i]==t[i*m//n]:
    print(-1)
    exit()
print(l)

Measured memory_bytes: 5432
<?php
//error_reporting(0);
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
list($A,$B) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$s = trim(fgets(STDIN));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$x = intdiv($A,$N);
if (($x * $N)==$A) {
  printf("OK\n");
  exit;
}
$x = ($x+1) * $N;
if ($x <= $B) {
  printf("OK\n");
}
else {
  printf("NG\n");
}


Measured memory_bytes: 16072
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
struct edge{ll to;};
struct graph{
    ll N; //ノードの個数
    vector<vector<edge> > G;
    vector<ll> depth;

    graph(ll n): N(n), G(N), depth(N,-1) {}
    
    void ade(ll s, ll t){
        G[s].emplace_back((edge){t});
        G[t].emplace_back((edge){s}); //無向ならON
    }

    void bfs(ll s) {
        deque<ll> dq; //探索予定地 必要ならpairでparentを記録
        dq.emplace_back(s);
        depth[s]=0;
        while(!dq.empty()) {
            ll v = dq.front();
            dq.pop_front();
            for(edge E : G[v]){
                if(depth[E.to]==-1) {
                    depth[E.to]=depth[v]+1;
                    dq.emplace_back(E.to);
                }
            }
        }
    }
};
//--MAIN-----------------------------------
void Main() {
    ll N,X,Y;
    cin>>N>>X>>Y;
    vector<ll> ans(N-1,0);
    graph g(N);
    rep(i,N-1){
        g.ade(i,i+1);
    }
    if(abs(X-Y)!=1) g.ade(X-1,Y-1);
    rep(i,N){
        g.bfs(i);
        rep(j,N){
            if(i==j) continue;
            ans[g.depth[j]-1]++;
        }
        rep(j,N){
            g.depth[j]=-1;
        }
    }
    for(auto x: ans){
        cout<< x/2 <<"\n";
    }



}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

// ABC123B - Five Dishes
// https://atcoder.jp/contests/abc123/tasks/abc123_b
void ABC123B() {
	int a[5];
	for (int i = 0; i < 5; i++)
	{
		cin >> a[i];
	}

	string s = "hoge";
	char hoge = s[0];


	//切り上げ対象である「1の位が一番小さいもの」をチェック(0を除く)
	int min = INT_MAX;
	int index = 0;
	for (int i = 0; i < 5; i++)
	{
		// 1桁目を取り出す
		int digit = a[i] - ((a[i] / 10) * 10);
		//cout <<"digit : " << digit << endl;
		if (digit < min && digit != 0) { //0は切り上げる必要がないので無視
			min = digit;
			index = i;
		}

	}
	//cout << "index : " << index << endl;

	int ans = 0;
	for (int i = 0; i < 5; i++)
	{
		if (i == index) {
			ans += a[i];
		}
		else {
			ans += ((a[i] + 9) / 10) * 10; //10分単位に切り上げる
		}
	}

	cout << ans << endl;
}


int main() {
	ABC123B();

	return 0;
}

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

int main(){
 int a,b,c;
cin>>a>>b>>c;
    if(a>b){
      swap(a,b);
    }
      if(b>c){
      swap(c,b);
    }
      if(a==5&&b==5&&c==7){
      cout<<"YES"<<endl;
    }
  else{
  cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
def nsum(n):
	return (n * (n + 1)) // 2

def contains(s):
	ans = nsum(s) - nsum(s // 3) * 3 - nsum(s // 5) * 5 + nsum(n // 15) * 15
	return ans


n = int(input())
print(contains(n))

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define f first 
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
 
int main(){
  ll n,t,q;
  FIO;  
  cin >> n;
  int a[n+1];
  map<int,int>m;
  for (int i = 0; i < n; ++i)
  {
  	cin >> a[i];
  	m[a[i]]++;
  }
  vector<pair<int,int>>v;
  int flag = 0;
	for (auto i : m)
	{
		v.push_back(make_pair(i.f,i.s));
	}
	sort(v.begin(), v.end());
	if(v.size()<=3)
	{
		if(m[0] == n)
			flag = 1;
		else if(m[0] == n/3 && v.size() == 2 && v[1].s == (2*n)/3)
			flag = 1;
		else
		{
			int t = ((v[0].f^v[1].f)^v[2].f);
			if(v[0].s == n/3 && v[1].s == n/3 && v[2].s == n/3 && t == 0)
				flag = 1;
		}

	}
  
  if(flag == 1)
	cout << "Yes\n";
  else
  	cout << "No\n";
  return 0;
}

Measured memory_bytes: 5372
A, B, C, D, E, F = [int(_) for _ in input().split()]

X = []
Y = []
for i in range(F):
    for j in range(F):
        x = A * i + B * j
        if x * 100 <= F:
            X.append(x)
        y = C * i + D * j
        if y <= F:
            Y.append(y)
m = -1
ans = []
for x in X:
    if x == 0: continue
    for y in Y:
        if x * 100 + y <= F and x * E >= y:
            if m < y / (x + y):
                m = y / (x + y)
                ans = (x * 100 + y, y)

print(*ans)


Measured memory_bytes: 48764
import java.util.Scanner;

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

        int n = sc.nextInt();
        int x = sc.nextInt();
        int donut = n;
        int min = 1000;
        int add = 0;

        int[] m = new int[n];
        for (int i = 0; i < n; i++) {
            m[i] = sc.nextInt();
            add += m[i];
            if (min > m[i]) {
                min = m[i];
            }
        }
        donut += (x - add) / min;

        System.out.println(donut);
    }
}

Measured memory_bytes: 23252
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  vector<ll> A(N), B(N);
  vector<ll> li(N);
  FOR(i, N) {
    cin >> A[i] >> B[i];
    li[i] = A[i] + B[i];
  }
  vector<int> ind(N);
  FOR(i, N) ind[i] = i;
  sort(ALL(ind), [&](const int& l, const int& r) { return li[l] > li[r]; });
  ll ans = 0;
  FOR(i, N) {
    if (i % 2 == 0) {
      ans += A[ind[i]];
    } else {
      ans -= B[ind[i]];
    }
  }
  print(ans);
  return 0;
}

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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  deque<int> w, r;
  for(int i = 0; i < n; ++i) {
    char c; cin >> c;
    if(c == 'W') w.push_back(i);
    else r.push_back(i);
  }
  int ans = 0;
  while(r.size() && w.size() && r.back() > w.front()) {
    int a = w.front(); w.pop_front();
    int b = r.back(); r.pop_back();
    w.push_back(b);
    r.push_front(a);
    ans += 1;
  }
  cout << ans << '\n';
}

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

template <typename T>
struct UnionFind{
    std::vector<T> par, rank, sz;
    UnionFind(T n) : par(n), rank(n, 0), sz(n, 1){
        for(T i=0; i<n; i++) par[i] = i;
    }
    void init(T n){
        par.resize(n);
        rank.resize(n);
        sz.resize(n);
        for(T i=0; i<n; i++){
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }
    
    int root(T x){
        if(par[x] == x) return x;
        else  return par[x] = root(par[x]);
    }
    
    bool is_same(T x, T y){
        return root(x)==root(y);
    }
    
    int size(T x) {
        return sz[root(x)];
    }
    
    bool unite(T x, T y){
        x = root(x);
        y = root(y);
        if(x==y) return false;
        
        if(rank[x] < rank[y]) std::swap(x, y);
        if(rank[x]==rank[y]) rank[x]++;
        par[y] = x;
        sz[x] += sz[y];
        return true;
    }
};

int main(){
    using namespace std;
    int N, K, L; cin >> N >> K >> L;
    UnionFind<int> load(N), train(N);
    for (int i = 0; i < K; i++)
    {
        int p, q; cin >> p >> q;
        p--; q--;
        load.unite(p, q);
    }
    for (int i = 0; i < L; i++)
    {
        int r, s; cin >> r >> s;
        r--; s--;
        train.unite(r, s);
    }

    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; i++)
    {
        mp[make_pair(load.root(i), train.root(i))]++;
    }
    
    for (int i = 0; i < N; i++)
    {
        cout << mp[make_pair(load.root(i), train.root(i))];
        if(i!=N-1) cout << " ";
        else cout << endl;
    }
}


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

vector<int> createInput(int length) {
    vector<int> v;
    int tmp;
    for(int i = 0;i < length;i++) {
        cin >> tmp;
        v.push_back(tmp);
    }
    return v;
}


int main()
{
    long unsigned k; cin >> k;
    string s; cin >> s;
    
    string result;
    if(k >= s.size()) {
        result = s;
    } 
    else {
        result = s.substr(0,k) + "...";
    }
    
    cout << result << endl;
    
    return 0;
}



Measured memory_bytes: 3644
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    S = input()
    T = input()
    len_s = len(S)
    len_t = len(T)
    ans = 1000
    for i in range(len_s-len_t+1):
        cunt = 0
        for j in range(len_t):
            if S[i+j] != T[j]:
                cunt += 1
        ans = min(ans, cunt)
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 9068
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const int inf=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
vll v(1000000,0);
void factorize(ll n) {
  
    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        v[i]++;
        while (n % i == 0) {
            n /= i;
            
        } 
    }
    if (n != 1) v[n]++;
    return ;
}

int main(){
  ll n;cin>>n;
  vll a(n);
  rep(i,0,n){
    cin>>a[i];
    factorize(a[i]);
  }
  int ans=1;
  rep(i,0,1000000){
    if(v[i]>1){ans=2;}
  }
  if(ans==1){cout<<"pairwise coprime"<<endl;return 0;}
  rep(i,0,1000000){
    if(v[i]==n){ans=3;}
  }
  if(ans==2){cout<<"setwise coprime"<<endl;}
  else{cout<<"not coprime"<<endl;}
}



Measured memory_bytes: 18792