akhauriyash/Code-Regression huggingface dataset:
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

 */

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long
#define int long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector< vector<int> > vvi;
typedef vector< pair<int, int> > vpi;
#define MAXN 300005
#define MOD 1000000007
#define INF 1000000000000000007


signed main(){
	fast
	int n, m;
	cin>>n>>m;
	map<int, priority_queue<int>> mp;
	int a, b;
	For(i, 0, n){
		cin>>a>>b;
		if(a<=m) mp[b].push(a);
	}

	int arr[m+1] = {0};
	set<int> st;
	For(i, 1, m+1){
		st.insert(i);
	}
	for(auto it=mp.rbegin(); it!=mp.rend(); it++){
		priority_queue<int> pq = it->second;
		int val = it->first;
		while(!pq.empty()){
	        int temp=pq.top();
	        pq.pop();
	        if(st.find(temp)==st.end()){
		        auto iit = st.upper_bound(temp);
		        if(iit!=st.end()){
			        arr[*iit] = val;
			        st.erase(iit);
			    }
	        }else{
	        	st.erase(temp);
	        	arr[temp] = val;
	        }
	    }
	}
	int ans=0;
	For(i, 1, m+1){
		ans+=arr[i];
	}
	cout<<ans<<endl;
    return 0;
}
    



Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

ll pw(ll x, ll p) {
    ll ans = 1;
    for(ll i = 0; i < p; i ++) {
        ans *= x;
    }
    return ans;
}


signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin >> n;
    ll len = 1;
    ll cpy = n;
    while(true) {
        ll curr = pw(26, len);
        if(curr >= n) {
            break;
        }
        n -= curr;
        len ++;
    }
    for(ll i = 0; i < len; i ++) {
        ll buk = 0;
        while(buk * pw(26, len - i - 1) < n) {
            buk ++;
        }
        buk --;
        n -= buk * pw(26, len - i - 1);
        cout << (char)('a' + buk);
    }
    return 0;
}



Measured memory_bytes: 3632
def rank(i):
    if i <= 48.00:
        return "light fly"
    elif 48.00 < i <= 51.00:
        return "fly"
    elif 51.00 < i <= 54.00:
        return "bantam"
    elif 54.00 < i <= 57.00:
        return "feather"
    elif 57.00 < i <= 60.00:
        return "light"
    elif 60.00 < i <= 64.00:
        return "light welter"
    elif 64.00 < i <= 69.00:
        return "welter"
    elif 69.00 < i <= 75.00:
        return "light middle"
    elif 75.00 < i <= 81.00:
        return "middle"
    elif 81.00 < i <= 91.00:
        return "light heavy"
    elif i > 91.00:
        return "heavy"

while(1):
    try:
        i = float(input())
        print(rank(i))
    except EOFError:
        break


Measured memory_bytes: 5568
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 2");
            WillReturn.Add("1 2");
            WillReturn.Add("5 5");
            WillReturn.Add("-2 8");
            //1
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 4");
            WillReturn.Add("-3 7 8 2");
            WillReturn.Add("-12 1 10 2");
            WillReturn.Add("-2 8 9 3");
            //2
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("5 1");
            WillReturn.Add("1");
            WillReturn.Add("2");
            WillReturn.Add("3");
            WillReturn.Add("4");
            WillReturn.Add("5");
            //10
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        var XArrList = new List<int[]>();

        foreach (string EachStr in InputList.Skip(1)) {
            XArrList.Add(EachStr.Split(' ').Select(X => int.Parse(X)).ToArray());
        }

        int Answer = 0;
        for (int I = 0; I <= XArrList.Count - 1; I++) {
            for (int J = I + 1; J <= XArrList.Count - 1; J++) {
                if (IsOkPair(XArrList[I], XArrList[J])) {
                    Answer++;
                }
            }
        }
        Console.WriteLine(Answer);
    }

    //配列のペアを引数として、
    static bool IsOkPair(int[] PArr1, int[] PArr2)
    {
        long SumVal = 0;
        for (int I = 0; I <= PArr1.GetUpperBound(0); I++) {
            SumVal += (PArr1[I] - PArr2[I]) * (PArr1[I] - PArr2[I]);
        }
        return IsHeihouSuu(SumVal);
    }

    //2分法で平方数かの判定
    static bool IsHeihouSuu(long pVal)
    {
        long LeftP = 0;
        long RightP = pVal;
        long MidP;

        while (LeftP <= RightP) {
            MidP = (LeftP + RightP) / 2;
            //Console.WriteLine("探索対象={0},LeftP={1},MidP={2},RightP={3}", pVal, LeftP, MidP, RightP);
            long NijyouVal = MidP * MidP;
            if (NijyouVal == pVal) return true;
            if (NijyouVal > pVal) {
                RightP = MidP - 1;
            }
            else {
                LeftP = MidP + 1;
            }
        }
        return false;
    }
}


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

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

    int n;
    ll k;
    cin >> n >> k;

    pair<int, int> P[n];
    for (int i = 0; i < n; ++i) {
        ll a, b; cin >> a >> b;
        P[i].first = a;
        P[i].second = b;
    }

    sort(P, P+n);

    ll pos = 0;
    for (auto& p : P) {
        pos += p.second;
        if (pos >= k) {
            cout << p.first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
string str;

cin >> str;

int n=str.size();
int max=-1;
int ans=0;
char op;
for(int i=0;i<n;i++){
  op=str.at(i);
  if(op=='A'||op=='C'||op=='G'||op=='T'){
    //ans++;
  for(int j=i;j<n;j++){
    op=str.at(j);
  if(op=='A'||op=='C'||op=='G'||op=='T'){
    ans++;
  }
     else{break;}
  }
}
  if(ans>max){max=ans;}
  ans=0;
}
cout <<max<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long  //comment it out when MLE
//# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000009
# define pi acos(-1)
# define f first
# define s second
using namespace std;

signed main()
{
    gok
    int n,m;
    cin>>n>>m;
    int a[n];
    int ss=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
     ss+=a[i];
    }

   int c=0;
   for(int i=0;i<n;i++)
   {
       int tt = ss/(4*m);
       if(ss%(4*m))
        tt++;
       if(a[i]>=tt)
       {
           c++;
       }
   }
if(c>=m)
    cout<<"Yes";
else
    cout<<"No";



      return 0;
    }


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

int main(){
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    int x, y, b, p;
    cin >> x >> y >> b >> p;
    int ret = x * b + y * p;
    for(int i = b; i < 10; i++){
      for(int j = p; j < 10; j++){
        int res = i * x + j * y;
        if(i >= 5 && j >= 2) res = res * 0.8;
        ret = min( ret, res);
      }
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;


int main(){
	ll N;
	cin >> N;
	vll A;
	ll i, j, k;
	for (i = 0; i < N; i++){
		ll a;
		cin >> a;
		A.push_back(a);
	}
	ll s1, s2, s3, s4;
	ll zero = 0;
	ll A_sum = accumulate(A.begin(), A.end(), zero);
	i = 2;
	j = 1;
	k = 3;
	s1 = A[0];
	s2 = A[1];
	s3 = A[2];
	s4 = A_sum - s1 - s2 - s3;
	while (1){
		if (k == N - 1) break;
		if (abs(s3 - s4) >= abs((s3 + A[k]) - (s4 - A[k]))){
			s3 += A[k];
			s4 -= A[k];
			k++;
		}
		else break;
	}
	ll ans = max(max(s1, s2), max(s3, s4)) - min(min(s1, s2), min(s3, s4));
	while (1){
		if (i == N - 2) break;
		i++;
		s2 += A[i - 1];
		s3 -= A[i - 1];
		if (i == k){
			s3 += A[k];
			s4 -= A[k];
			k++;
		}
		while (1){
			if (j == i - 1) break;
			if (abs(s1 - s2) >= abs((s1 + A[j]) - (s2 - A[j]))){
				s1 += A[j];
				s2 -= A[j];
				j++;
			}
			else break;
		}
		while (1){
			if (k == N - 1) break;
			if (abs(s3 - s4) > abs((s3 + A[k]) - (s4 - A[k]))){
				s3 += A[k];
				s4 -= A[k];
				k++;
			}
			else break;
		}
		ll tmpans = max(max(s1, s2), max(s3, s4)) - min(min(s1, s2), min(s3, s4));
		ans = min(ans, tmpans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2420
N=int(input())
c = 0
if (N == 0):
    print("Yes")
else:
    num_list = list(str(N))
    s = len(num_list)
    for i in range(s):
        a = num_list[i]
        c += int(a) 
    if(c % 9 == 0):
        print("Yes")
    else:
        print("No")



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

int main() {
  int a, b, c;
  bool d = 0;
  cin >> a >> b >> c;
  rep(i, b+1){
    if(a*i % b == c){
      d = 1;
      break;
    }
  }
  if(d) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long LL;
constexpr int kMod = 1000000007;
constexpr int kMaxChild = 101;
constexpr int kMaxCandy = 100001;

int main() {
  LL dp[kMaxChild][kMaxCandy];
  int N, K; std::cin >> N >> K;
  std::vector<int> a(N+1);
  for (int i = 1; i <= N; ++i) std::cin >> a[i];

  dp[0][0] = 1;
  for (int k = 1; k <= K; ++k) dp[0][k] = 0;

  for (int n = 1; n <= N; ++n) {
    dp[n][0] = dp[n-1][0];

    int k = 1;
    for (; k <= a[n] && k <= K; ++k) {
      dp[n][k] = dp[n-1][k] + dp[n][k-1];
      dp[n][k] %= kMod;
    }
    for (; k <= K; ++k) {
      LL add = (dp[n][k-1] - dp[n-1][k-a[n]-1] + kMod) % kMod;
      dp[n][k] = (dp[n-1][k] + add) % kMod;
    }
  }

  std::cout << dp[N][K] << std::endl;
}


Measured memory_bytes: 79104
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}



vector<ll>adj[Max+10];

ll dis[Max+10];

ll vis[Max+10];

ll ans=-1;

ll cycle=-1;

 bool flag=false;

 ll k;

void dfs(ll s,ll p)
{
    if(flag)return ;

    if(vis[s])
    {
        cycle=s;

        flag=true;
        return ;
    }


    dis[s]=dis[p]+1;

    if(k==dis[s] && flag==false)
    {
        ans=s;

        flag=true;

        return ;
    }

    vis[s]=true;


    for(auto x : adj[s])
    {
        dfs(x,s);
    }


}
int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,b,c,d,cnt=0,q,l,r;



         cin>>n>>k;

         ll ara[n+1];

         for(i=1; i<=n; i++)
         {
             cin>>a;

             ara[i]=a;


             adj[i].eb(a);
         }



         dis[0]=-1;
          dfs(1,0);

        //  cout<<cycle<<endl;

          if(~ans)cout<<ans<<endl;

          else
          {
              vector<ll>v;
              v.eb(cycle);

              ans=cycle;

              while(ara[cycle]!=ans)
              {
                  cycle=ara[cycle];



                  v.eb(cycle);
              }

            k-=dis[ans];

            k%=v.size();

            cout<<v[k]<<endl;


          }





}



Measured memory_bytes: 68088
S=input()
T=input()
N=len(S)
def char2num(a):
  temp='abcdefghijklmnopqrstuvwxyz'
  i=0
  while temp[i]!=a:
    i+=1
  return i

s2t=[-1]*26
t2s=[-1]*26
for i in range(N):
  snum=char2num(S[i])
  tnum=char2num(T[i])
  if s2t[snum]>=0 or t2s[tnum]>=0:
    if s2t[snum]!=tnum or t2s[tnum]!=snum:
      print('No')
      exit()
  else:
    s2t[snum]=tnum
    t2s[tnum]=snum
    
print('Yes')

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll h,n;

    cin >> h >> n;
    int ary[n];
    rep(i,n) cin >> ary[i];
    int sum = 0;
    rep(i,n) sum += ary[i];
    if (h <= sum)
    {
        cout << "Yes" << endl;

    }
    else
    {
        cout << "No" << endl;
    }
    
    
}




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

int main() {
    int64_t K;
    string S;
    cin >> K >> S;
    int64_t s_size = S.size();
    if (s_size <= K) {
        cout << S << endl;
    }else{
        cout << S.erase(K) << "..." << endl;
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	string t;
	cin>>t;
	bool w = false, e = false, s = false, n = false;
	rep(i,t.size()){
		if(t[i] == 'W')w = true;
		if(t[i] == 'E')e = true;
		if(t[i] == 'S')s = true;
		if(t[i] == 'N')n = true;
	}
	bool ok = false;
	if(w == e && s == n)ok = true;
	cout<<((ok)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
n = int(input())
p = list(map(int, input().split()))
num = p[0]
cnt = 1
for i in range(n - 1):
    if p[i + 1] <= num:
        cnt += 1
        num = p[i + 1]
    else:
        continue
print(cnt)

Measured memory_bytes: 24744
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
	int N;
	while(cin>>N,N){
		string L;
		int P,A,B,C,D,E,F,S,M;
		vector<pair<double, string> > v;
		REP(i,N){
			cin>>L>>P>>A>>B>>C>>D>>E>>F>>S>>M;
			double ef = (double)(-P+F*S*M)/(A+B+C+M*(D+E));
			v.push_back(make_pair(-ef,L));
		}
		sort(v.begin(),v.end());
		REP(i,v.size()){
			cout<<v[i].second<<endl;
		}
		cout<<"#"<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define per(i,n) for (int i=n-1; i>=0; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using vi = vector<int>;
using vv = vector<vi>;
const int mod = 1000000007;
//const int mod = 998244353;

ll dp[2001][2001];

int main(){
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i,n){
        cin>>a[i].first;
        a[i].second = i;
    }
    sort(rall(a));
    //rep(i,n)cout<<a[i].first<<endl;
    
    for(int i=1; i<=n; i++){
        for(int x=0; x<=i; x++){
            
            int y = i-x;
            ll  c = a[i-1].first;
            ll  p = a[i-1].second;
            if(x)dp[x][y] = max(dp[x][y], dp[x-1][y] + c*abs(p-(x-1)));
            if(y)dp[x][y] = max(dp[x][y], dp[x][y-1] + c*abs((n-y)-p));
        }
    }
    ll ans = 0;
    rep(i,n+1){
        ans = max(ans, dp[i][n-i]);
    }
    
    cout << ans << endl;
    
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<long long> alphabet(26);
  for (int i = 0; i < S.size(); i++) alphabet[S[i] - 'a']++;
  const int MOD = 1e9 + 7;
  long long ans = 1;
  for (int i = 0; i < 26; i++) ans = (ans * (alphabet[i] + 1)) % MOD;
  ans--;
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
	int n ;
	int a ;
	int b ;
	cin >> n >> a >> b;
	int cost1 ;
	int cost2 ;
	cost1 = a * n;
	cost2 = b;
	if (cost2 > cost1){
		cout << cost1 << endl;
	}
	else if (cost1 > cost2){
		cout << cost2 << endl;
	}
	else {
		cout << cost2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug puts("orzyrt")
	#define debug(a...) fprintf(stderr,a);
#else
	#define Debug ('orzyrt')
	#define debug(a...) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(a>b)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

LL d,n,ret=0,i;
int main(){
	read(d);read(n);
	if(!d){
		ret=n;
		if(n%100)printf("%lld\n",ret);
		else printf("%lld\n",ret+1);
	}
	if(d==1){
		ret=100ll*n;
		if(ret%10000)printf("%lld\n",ret);
		else printf("%lld\n",ret+100);
	}
	if(d==2){
		ret=10000ll*n;
		if(ret%1000000)printf("%lld\n",ret);
		else printf("%lld\n",ret+10000);
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n= sc.nextInt();
    int [] a = new int[n];
    for(int i =0;i<n;i++){
      a[i] = sc.nextInt();
    }
    int count = 0;
    Arrays.sort(a);
    for(int i =0;i<n-2;i++){
      for(int j =i+1;j<n-1;j++){
        for(int k =j+1;k<n;k++){
          // System.out.println(a[i] + " "+ a[j] +  " " +a[k]);
          if(a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i]){
            if(a[i]+a[j]>a[k]){
              // System.out.println("!"+a[i] + " "+ a[j] +  " " +a[k]);
              count++;
          }
        }
      }  
    }
  }
  System.out.println(count);
  }
}



Measured memory_bytes: 36620
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



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

  string s; cin >> s; 

  ll ans = 0;
  ll sum = s.size() * 9;
  ll now = 0;
  rep(i,s.size()){
    now += (s[i] - '0');
    ans = max(ans, (now + (((ll)s.size()-i-(ll)1) * (ll)9) - (ll)1));
  }
  ans = max(ans, now);
  cout << ans  << endl;
  

  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[1000010];
ll dp2[1000010];
ll n3[1000010],s3;
ll n4[1000010],s4;
ll n5[1000010],s5;
int rec(int x){
  if(dp[x]!=-1)return dp[x];
  int ans=1e9;
  for(int i=1;i<s4;i++){
    if(n4[i]>x)break;
    ans=min(ans,rec(x-n4[i])+1);
  }
  return dp[x]=ans;
}

int rec2(int x){
  if(dp2[x]!=-1)return dp2[x];
  int ans=1e9;
  for(int i=0;i<s5;i++){
    if(n5[i]>x)break;
    ans=min(ans,rec2(x-n5[i])+1);
  }
  return dp2[x]=ans;
}



int main(){
  memset(dp,-1,sizeof(dp));
  memset(dp2,-1,sizeof(dp2));
  dp[0]=dp2[0]=0;
  for(int i=1;;i++){
    n3[i]=n3[i-1]+i;
    s3=i+1;
    if(n3[i]>1e6)break;
  }
  for(int i=1;;i++){
    n4[i]=n4[i-1]+n3[i];
    s4=i+1;
    if(n4[i]%2){
      n5[s5++]=n4[i];
    }
    if(n4[i]>1e6)break;
    dp[n4[i]]=1;
    dp2[n5[s5-1]]=1;
  }
  int n;
  while(cin>>n,n){
    cout<<rec(n)<<" "<<rec2(n)<<endl;
  }
  return 0;
}



Measured memory_bytes: 47856
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] -= i + 1

sortA = sorted(A)

if(N>1):
    b1 = sortA[(N-1)//2]
    b2 = sortA[(N-1)//2+1]

    ans1 = 0
    ans2 = 0
    for i in range(N):
        ans1 += abs(b1-A[i])
        ans2 += abs(b2-A[i])

    print(min(ans1, ans2))
else:
    print(0)


Measured memory_bytes: 26832
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

//ライブラリ始まり

//定数

//円周率
const double PI = 3.1415926535897932384;

//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15

//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";

//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造

//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  UnionFind(int N) : UF(N) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    UF.at(rx) = ry; // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

//関数

//ctoi
int ctoi(char c){
  if (c == '0') {
    return 0;
  }
  if (c == '1') {
    return 1;
  } 
  if (c == '2') {
    return 2;
  } 
  if (c == '3') {
    return 3;
  }
  if (c == '4') {
    return 4;
  } 
  if (c == '5') {
    return 5;
  } 
  if (c == '6') {
    return 6;
  }
  if (c == '7') {
    return 7;
  } 
  if (c == '8') {
    return 8;
  } 
  if (c == '9') {
    return 9;
  }
  return -1;  
}

//素数判定
bool PN(int x) {
  if (x <= 1) {
    return false; // 1や0,-1は素数ではない
  }
  if (x == 2) {
    return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  }
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) {
      return false; // 割れたら素数じゃない
    }
  }
  return true;
}

//ライブラリ終わり

int main() {
  string SA, SB, SC;
  cin >> SA >> SB >> SC;
  int LA = SA.size();
  int LB = SB.size();
  int LC = SC.size();
  int NA = 0, NB = -1, NC = -1;
  char N = SA.at(0);
  while (true) {
    if (N == 'a') {
      NA++;
      if (NA == LA) {
        cout << 'A' << endl;
        break;
      }
      N = SA.at(NA);
    }
    else if (N == 'b') {
      NB++;
      if (NB == LB) {
        cout << 'B' << endl;
        break;
      }
      N = SB.at(NB);
    }
    else {
      NC++;
      if (NC == LC) {
        cout << 'C' << endl;
        break;
      }
      N = SC.at(NC);
    }
  }
}

Measured memory_bytes: 3676
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1e18;

struct UnionFind {
    vector<int> data; int sz;
    UnionFind(int sz) : data(sz, -1), sz(sz) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) { return false; }
        if (data[x] > data[y]) { swap(x, y); }
        data[x] += data[y]; data[y] = x; sz--; return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return sz; }
};

int main() {
    int N;
    bool is_ok = true;
    cin >> N;
    long long A[N][N];
    vector<vector<long long>> G(N, vector<long long>(N, INF));
    vector<pair<long long, pair<int, int>>> edges;
    for (int i = 0; i < N; i++) G[i][i] = 0;
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
        cin >> A[i][j];
        if (i < j) edges.emplace_back(A[i][j], make_pair(i, j));
    }
    // WF で最短路か判定(以降Aが最短路とする)
    // kruskal法の要領で辺の採用不採用を判定
    // 繋がっていないなら採用
    // 繋がっているとき、その辺を使って最短路が生まれるなら採用
    sort(edges.begin(), edges.end());
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
            if (chmin(A[i][j], A[i][k] + A[k][j])) is_ok = false;
        }
    }
    
    if (!is_ok) { cout << -1 << endl; return 0; }

    auto wf = [&](int u, int v)->void {
        for (int k = 0; k < N; k++) {
            chmin(G[u][v], G[u][k] + G[k][v]);
            chmin(G[v][u], G[v][k] + G[k][u]);
        }
    };

    UnionFind uf(N);
    long long ans = 0;
    for (auto e : edges) {
        int u, v; tie(u, v) = e.second;
        long long cost = e.first;
        if (uf.unionSet(u, v)) { G[u][v] = cost; G[v][u] = cost; ans += cost; }
        else {
            wf(u, v);
            if (chmin(G[u][v], cost)) { G[v][u] = cost; ans += cost; }
        }            
    }
    
    cout << ans << endl;
    return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N;
    cin >> N;
    vector<P> X(N);
    rep(i, N) {
        cin >> X[i].first;
        X[i].second = i;
    }
    sort(X.begin(), X.end());
    int l = (N-1)/2;
    vector<int> ans(N);
    rep(i, N) {
        int tmp = X[i].second;
        if (i <= l) {
            ans[tmp] = X[l+1].first;
        }
        else {
            ans[tmp] = X[l].first;
        }
    }
    for (int tmp : ans) {
        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 4480
s=input()
n=4
for i in range(2 ** (n-1)):
  x=str(format(i,'b').zfill(3))
  a=[]
  res=int(s[0])
  for j in range(n-1):
    if x[j]=='1':
      res+=int(s[j+1])
      a.append('+')
    else:
      res-=int(s[j+1])
      a.append('-')
  if res==7:
    ans=s[0]+a[0]+s[1]+a[1]+s[2]+a[2]+s[3]+'=7'
    break
print(ans)

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;
    
    ll odd_cnt = 0;
    for (ll i = 0; i < n; i++) {
    	ll a;
    	cin >> a;
    	
    	if (a % 2 != 0) odd_cnt++;
    }
    
    YN(odd_cnt % 2 == 0);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int h,w;
	while(1){
		cin>>h>>w;
		if(h==0&&w==0)break;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(0==(i+j)%2)cout<<"#";
				else cout<<".";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    
    
    int a[1000],b,c,d,p,e,n,f,x,y=0,z=0,m,i,k;
    
    cin>>n>>m;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    
    for(k=1;k<=m;k++){
        for(i=0;i<n-1;i++){
            if(a[i]%k > a[i+1]%k){
                swap(a[i],a[i+1]);
            }
        }
    }
        
    for(i=0;i<n;i++){
        cout<<a[i]<<endl;
    }
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
string s;
long long l,r;
int p;
int n;
int f[100005];
long long num[200010][26];
long long doit(long long x,int y)
{
	if(x<=n)return num[x][y];
	if(x<=2*n)return num[n][y]+num[x-n][y];
	long long x1=num[n][y]+num[p][y],x2=num[n][y];
	long long l1=n+p,l2=n;
	while(x>l1+l2)
	{
//		cout<<x1<<" "<<x2<<" "<<l1<<" "<<l2<<endl;
		long long t=x1;
		x1+=x2;
		x2=t;
		t=l1;
		l1+=l2;
		l2=t;
	}
	x1+=doit(x-l1,y);
//	cout<<x<<" "<<x1<<endl;
	return x1;
}
long long sol(long long x,int y)
{
	if(x<=n)return num[x][y];
//	if(x<=2*n)return num[n][y]+num[x-n][y];
	if(n%p==0)
	{
		long long xx=(x-n)/(long long)p*num[p][y]+num[n][y];
		x%=(long long)p;
		xx+=num[x][y];
		return xx;
	}
	return doit(x,y);
}
int main()
{
	cin>>s>>l>>r;
	n=s.size()/2;
	s=s.substr(0,n);
	s=" "+s;
	f[1]=0;
	for(int i=2,j=0;i<=n;i++)
	{
		while(s[i]!=s[j+1]&&j>0)j=f[j];
		j+=(s[i]==s[j+1]);
		f[i]=j;
	}
//	cout<<f[0]<<f[1]<<f[2]<<f[3]<<endl;
	p=n-f[n];
//	cout<<p<<endl;
//	p=n-p;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<26;j++)num[i][j]+=num[i-1][j];
		num[i][s[i]-'a']++;
	}
	for(int i=0;i<26;i++)cout<<sol(r,i)-sol(l-1,i)<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 22976
from _collections import deque


h,w=map(int,input().split())
cx,cy=map(int,input().split())
dx,dy=map(int,input().split())
s=[[] for _ in range(h+2)]
for i in range(h):
    x=list(input())
    x.insert(0,"#")
    x.append("#")
    s[i+1]=x
s[0]=s[-1]=["#"]*(w+2)




dep=[[10**10]*(w+2) for _ in range(h+2)]
dep[cx][cy]=0
data=deque([[cx,cy]])
while len(data)>0:
    xy=data.popleft()
    x,y=xy[0],xy[1]

    if s[x-1][y]=="." and dep[x-1][y]>dep[x][y]:
        dep[x-1][y]=dep[x][y]
        data.appendleft([x-1,y])
    if s[x+1][y] == "." and dep[x+1][y] > dep[x][y]:
        dep[x+1][y] = dep[x][y]
        data.appendleft([x + 1,y])
    if s[x][y-1] == "." and dep[x][y-1] > dep[x][y]:
        dep[x][y-1] = dep[x][y]
        data.appendleft([x,y-1])
    if s[x][y+1] == "." and dep[x][y+1] > dep[x][y]:
        dep[x][y+1] = dep[x][y]
        data.appendleft([x,y+1])

    for i in range(5):
        for j in range(5):
            if 0<=x-2+i<=h+1 and 0<=y-2+j<=w+1 and s[x-2+i][y-2+j]=="." and dep[x-2+i][y-2+j]>dep[x][y]+1:
                dep[x-2+i][y-2+j]=dep[x][y]+1
                data.append([x-2+i,y-2+j])

print(dep[dx][dy] if dep[dx][dy]<10**10 else -1)





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

pair<int, int> is_bipartite (const vector<vector<int>>& g) {
    assert(g.size());
    int n = g.size(), s = 0, t = 0, f = 1;
    vector<int> c(n, 0); c[0] = 1;
    queue<int> que; que.emplace(0);
    while (not que.empty()) {
        int v = que.front(); que.pop();
        for (const auto& u : g[v]) {
            if (c[u] != 0) { if (c[u] == c[v]) f = 0; }
            else { c[u] = c[v] * -1; que.emplace(u); }
        }
    }
    if (not f) return make_pair(s, t);
    for (int &e : c) { s += (e == 1); t += (e == -1); }
    return make_pair(s, t);
}

int main() {
    int n, m;
    long long ans;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
    
    int s, t; tie(s, t) = is_bipartite(g);
    if (s and t) ans = (long long) s * t - m;
    else ans = (long long) n * (n - 1) / 2 - m;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n;
	std::vector<int> alpha_vec;
	std::string buf;

	alpha_vec.push_back(1);
	alpha_vec.push_back(3);
	alpha_vec.push_back(5);
	alpha_vec.push_back(7);
	alpha_vec.push_back(9);
	alpha_vec.push_back(11);
	alpha_vec.push_back(15);
	alpha_vec.push_back(17);
	alpha_vec.push_back(19);
	alpha_vec.push_back(21);
	alpha_vec.push_back(23);
	alpha_vec.push_back(25);

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	std::cin.rdbuf(ifs.rdbuf());
#endif

	std::cin >> n;
	std::getline(std::cin, buf);
	
	for(int i = 0; i < n; i++){
		std::getline(std::cin, buf);
		for(int j = 0; j < alpha_vec.size(); j++){
			int alpha = alpha_vec[j];
			for(int beta = 0; beta < 26; beta++){
				std::map<unsigned char, unsigned char> map;
				std::string decoded_buf = buf;

				for(unsigned char k = 0; k <= 25; k++){
					unsigned char f = (alpha * k + beta) % 26;
					map[f + 'a'] = k + 'a';
				}
				
				for(int k = 0; k < decoded_buf.size(); k++){
					if(decoded_buf[k] >= 'a' && decoded_buf[k] <= 'z'){
						decoded_buf[k] = map[decoded_buf[k]];
					}
				}
				if(decoded_buf.find("that") != std::string::npos ||
					decoded_buf.find("this") != std::string::npos){
					std::cout << decoded_buf << std::endl;
				}
			}
		}

	}


#if INPUT_FROM_FILE
		//fclose(fp);
#endif
	return 0;
}



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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;
int main(int argc, char const *argv[])
{
	int n;
	char str[NMAX];
	scanf("%d",&n);
	scanf("%s",str);
	int len = strlen(str);
	if(n >= len)
		puts(str);
	else
	{
		for(register int i = 0;i < n;i++)
			putchar(str[i]);
		puts("...");
	}
	return 0;
}

Measured memory_bytes: 3772
val mod = (1e9 + 7).toInt()

fun main() {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }

    val fact = Array(m + 1) { 1L }
    for (i in 1..m) fact[i] = fact[i - 1] mul i.toLong()

    val invFact = Array(m + 1) { i -> inv(fact[i]) }

    val C = Array(n + 1) { k -> fact[n] mul invFact[k] mul invFact[n - k] }
    val Pm = Array(n + 1) { k -> fact[m] mul invFact[m - k] }
    val P2 = Array(n + 1) { k -> fact[m - k] mul invFact[m - k - (n - k)] }

    var res = 0L
    for (k in 0..n) {
        val x = C[k] mul Pm[k] mul P2[k] mul P2[k]
        if (k % 2 == 0) res = (res + x) % mod
        else res = (res + mod - x) % mod
    }
    println(res)
}

private fun inv(x: Long): Long {
    return pow(x, mod - 2)
}

private fun pow(a: Long, x: Int): Long {
    var a = a
    var x = x
    var res = 1L
    while (x > 0) {
        if (x % 2 == 1) res = res mul a
        a = a mul a
        x /= 2
    }
    return res
}

private infix fun Long.mul(other: Long): Long = (this * other) % mod


Measured memory_bytes: 104672
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,m,a[101][101],f,x,y;
int main(){
  cin>>n>>m;
  r(i,n)r(j,n)a[i][j]=1e8;
  r(j,m){
    cin>>x>>y;
    a[x][y]=-1;
  }
  r(k,n)r(i,n)r(j,n)a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
  r(i,n)if(a[i][i]<0)f++;
  cout<<(f?1:0)<<endl;
}

Measured memory_bytes: 3084
n,m,x=map(int,input().split())
c=[]
a=[]
for _ in range(n):
  ca=list(map(int,input().split()))
  c.append(ca[0])
  a.append(ca[1:])
ans=13*pow(10,5)
for i in range(2**n):
  rikai=[0]*m
  kin=0
  for j in range(n):
    if ((i>>j) & 1):#立っているビットのところで処理が走る
      for k in range(m):
        rikai[k]+=a[j][k]
      kin+=c[j]
  if min(rikai)>=x:
    ans=min(ans,kin)
print(ans if ans<13*pow(10,5) else -1)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int n,x,y;
  cin >> n >> x >> y;
  
  vi a(2009,0);
  rep2(i,1,n)rep2(j,i+1,n+1){
    int p = min(j-i,abs(x-i)+1+abs(y-j));
    a[p]++;
  }
  rep2(i,1,n)cout << a[i] << endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll d[n];
    for(int i=0;i<n;i++)cin>>d[i];
    sort(d,d+n);
    //if(d[n/2-1]==d[n/2])
    cout << d[n/2]-d[n/2-1]<<endl;
    return 0;
}


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

int main() {
  long H,W,M;
  cin>>H>>W>>M;
  vector<long>K(M);//これは問題文の配列「h」
  vector<long>O(M);//これは問題文の配列「w」
  long h=H+1;//添え字は0を含むので+1
  long w=W+1;
  int m=max(h,w);//面倒なので大きい方を取る
  vector<long>A(m,0);//配列「h」のK行に存在する爆弾の数を記録する表
  vector<long>B(m,0);//配列「w」のO列に存在する爆弾の数を記録する表
  vector<long>a(m,0);//表Aのコピー
  vector<long>b(m,0);//表Bのコピー
  vector<long>D(m,0);//表Aのコピー
  vector<long>d(m,0);//表Bのコピー
  for(long i=0;i<M;i++){
    cin>>K[i]>>O[i];
    A[K[i]]++;//点数表のK[i]番目にK[i]行に１つ爆弾があることを記録する。
    B[O[i]]++;//点数表のO[i]番目にO[i]列に１つ爆弾があることを記録する。
    a[K[i]]++;//コピー
    b[O[i]]++;//コピー
    D[K[i]]++;//コピー
    d[O[i]]++;//コピー
  }
  long C=0;
  long c=0;
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());//ここで一番点数の高い添え字をa[0]に持ってくる。
  for(long i=0;i<m;i++){
    if(a[0]==D[i]){
      c=i;//ここでa[0]が何番目の添え字だったのかを記録する。
      break;
    }
  }//ここまでの作業で配列「h」の中で爆弾一番多いK行の内の１つの添え字を特定し、cに保存できた。
  for(long i=0;C<a[0];i++){
    if(K[i]==c){
      b[O[i]]--;//ここで配列「h」のK行のc番目と添え字が同じ配列「w」のO列全てを抹消する。
      C++;
    }
  }
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());//ここで一番点数の高い添え字をb[0]に持ってくる。
  int ANS=a[0]+b[0];//これで配列「h」に存在する爆弾の最大行と、
  //それと重複しない配列「w」に存在する爆弾の最大列をANSに記録できた。
  //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
  //以下はこれで配列「w」に存在する爆弾の最大行と、
  //それと重複しない配列「h」に存在する爆弾の最大列をansに記録するもの。
  long E=0;
  sort(B.begin(),B.end());
  reverse(B.begin(),B.end());
  for(long i=0;i<m;i++){
    if(B[0]==d[i]){
      c=i;
      break;
    }
  }
  for(int i=0;E<B[0];i++){
    if(O[i]==c){
      A[K[i]]--;
      E++;
    }
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  int ans=A[0]+B[0];
  
  cout<<max(ANS,ans)<<endl;
}

Measured memory_bytes: 21968
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int s;
    cin >> s;
    int a = s/100;
    int b = s%100;
    if(0 < a && a <= 12){
        if(0 < b && b <= 12) cout << "AMBIGUOUS" << endl;
        else if(b > 12) cout << "MMYY" << endl;
        else if(b == 0) cout << "MMYY" << endl;
    }
    else if(a > 12){
        if(0 < b && b <= 12) cout << "YYMM" << endl;
        else if(b > 12) cout << "NA" << endl;
        else if(b == 0) cout << "NA" << endl;
    }
    else if(a == 0){
        if(b == 0) cout << "NA" << endl;
        else if(0 < b && b <= 12) cout << "YYMM" << endl;
        else if(b > 12) cout << "NA" << endl;
    }
}
        

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, c[400], s[400][30];

signed main() {
	std::random_device rnd;
	cin >> n;
	for (int i = 1; i <= n; i++)cout << rnd() % 26 + 1 << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

ll N, M, L, Q;
ll fuel[305][305];
ll dist[305][305];
ll s[105000], t[105000];
ll A[100000], B[100000], C[100000];

bool chmin(ll &a, ll b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
	cin >> N >> M >> L;
    rep (i, M) {
        cin >> A[i] >> B[i] >> C[i];
        A[i] -= 1;
        B[i] -= 1;
    }
    cin >> Q;
    rep (i, Q) {
        cin >> s[i] >> t[i];
        s[i] -= 1;
        t[i] -= 1;
    }

    rep (i, N) {
        rep (j, N) {
            fuel[i][j] = LINF;
            dist[i][j] = LINF;
        }
        fuel[i][i] = 0;
        dist[i][i] = 0;
    }
    rep (i, M) {
        chmin(fuel[A[i]][B[i]], C[i]);
        chmin(fuel[B[i]][A[i]], C[i]);
    }
    rep (i, N) rep (j, N) rep (k, N) {
        chmin(fuel[j][k], fuel[j][i] + fuel[i][k]);
    }
    rep (i, N) rep(j, N) {
        if (i==j) continue;
        if (fuel[i][j] <= L) chmin(dist[i][j], 1LL);
    }
    rep (i, N) rep(j, N) rep(k, N) {
        chmin(dist[j][k], dist[j][i] + dist[i][k]);
    }

    rep(i, Q) {
        if(dist[t[i]][s[i]] < LINF) cout << dist[t[i]][s[i]] - 1 << endl;
        else cout << -1 << endl;
    }
	return 0;
}


Measured memory_bytes: 4864
N = int(input())
Alist = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list(map(int, input().split()))

Alist.insert(0,0)
Blist.insert(0,0)
Clist.insert(0,0)

ans = 0

for i in range(1,N+1):
    ans = ans + Blist[Alist[i]]
    if i+1 < N+1:
        if Alist[i] +1  == Alist[i+1]:
            ans = ans + Clist[Alist[i]]

print(ans)


Measured memory_bytes: 3064
program prob6
    implicit none
    integer::i, j, l
    integer(8)::ans, sum, tmp, wa
    character(len=10)::S
    read(*,*) S
    l = len_trim(S)
    ans = 0
    wa = 0

    do i = 0, 2**(l-1)-1
        tmp = i
        sum = ichar(S(1:1)) - ichar('0')
        do j = 2, l
            if(mod(tmp,2) == 0) then
                sum = sum*10 + ichar(S(j:j)) - ichar('0')
            else
                wa = wa + sum
                sum = ichar(S(j:j)) - ichar('0')
            end if
            tmp = tmp/2
        end do
        wa = wa + sum
    end do
    write(*,*) wa
    stop
end program

Measured memory_bytes: 2748
#include<bits/stdc++.h>
using namespace std;
const int N = 405;
long long dp[N][N];
long long a[N];
long long qs[N];
long long play(int l,int r){
    if(dp[l][r])    return dp[l][r];
    if(l == r)      return 0;
    if(l+1 == r)    return a[l]+a[r];
    long long mi = 1e18;
    for(int i=l;i<r;i++)
        mi = min(mi,play(l,i)+play(i+1,r)+qs[r]-qs[l-1]);
    return dp[l][r] = mi;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)   scanf("%d",&a[i]),qs[i] = qs[i-1] + a[i];
    printf("%lld\n",play(1,n));
    return 0;
}


Measured memory_bytes: 1536
from sys import stdin

def main():
    n,m = [int(x) for x in stdin.readline().rstrip().split()]

    _l = 0
    _r = n

    for i in range(m):
        l,r = [int(x) for x in stdin.readline().rstrip().split()]
        _l = max(l, _l)
        _r = min(r, _r)

    if _r - _l < 0:
        print(0)
    else:
        print(_r - _l + 1)
    
if __name__=='__main__':
    main()

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

int cnt[101010];
bool f[101010];

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


  fill(cnt, cnt + n, 1);
  f[0] = true;

  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--; y--;

    f[y] = f[x] | f[y];
    cnt[y]++; cnt[x]--;
    if (!cnt[x]) f[x] = false;
  }

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += f[i];
  }

  cout << ans << endl;
}


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

const int N = 100010;

int main(){
    int n;
    scanf("%d", &n);
    int x = n & (-n);
    if (x == n){
        puts("No");
        return 0;
    }
    puts("Yes");
    for (int i = 2; i + 1 <= n; i += 2){
        printf("%d %d\n", i + 1, i);
        printf("%d %d\n", i, 1);
        printf("%d %d\n", 1, i + 1 + n);
        printf("%d %d\n", i + 1 + n, i + n);
    }
    printf("%d %d\n", 2 + n, 1 + n);
    if (n % 2 == 0){
        printf("%d %d\n", n, x);
        printf("%d %d\n", n + n, (n ^ x ^ 1) + n);
    }
    return 0;
}


Measured memory_bytes: 2304