akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

class DICE_MODEL
{

public:
    int l1, l2, l3, l4, l5, l6;

    DICE_MODEL()
    {
        std::cin >> l1 >> l2 >> l3 >> l4 >> l5 >> l6;
    }

    DICE_MODEL(DICE_MODEL& dice)
    {
        l1 = dice.l1;
        l2 = dice.l2;
        l3 = dice.l3;
        l4 = dice.l4;
        l5 = dice.l5;
        l6 = dice.l6;
    }

    void turnNorth()
    {
        int temp = l2;
        l2 = l6;
        l6 = l5;
        l5 = l1;
        l1 = temp;
    }

    void turnEast()
    {
        int temp = l4;
        l4 = l6;
        l6 = l3;
        l3 = l1;
        l1 = temp;
    }

    void turnSouth()
    {
        int temp = l5;
        l5 = l6;
        l6 = l2;
        l2 = l1;
        l1 = temp;
    }

    void turnWest()
    {
        int temp = l3;
        l3 = l6;
        l6 = l4;
        l4 = l1;
        l1 = temp;
    }

    void turnClock()
    {
        int temp = l2;
        l2 = l3;
        l3 = l5;
        l5 = l4;
        l4 = temp;
    }

    void turnCounterClock()
    {
        int temp = l2;
        l2 = l4;
        l4 = l5;
        l5 = l3;
        l3 = temp;
    }

    bool operator == (DICE_MODEL target)
    {
        return (l1 == target.l1 && l2 == target.l2 && l3 == target.l3 && l4 == target.l4 && l5 == target.l5 && l6 == target.l6) ? true : false;
    }

    void printTop()
    {
        std::cout << l1 << std::endl;
    }

    void printRight()
    {
        std::cout << l3 << std::endl;
    }

    void printAll()
    {
        std::cout << l1 << " "  << l2 << " " << l3 << " " << l4 << " " << l5 << " " << l6 << std::endl;
    }
};

int main()
{
    DICE_MODEL *dice;

    int diceNum;
    std::cin >> diceNum;

    dice = new DICE_MODEL[diceNum];

    bool equalFlag = false;
    for (int i = 0; i < diceNum; i++)
    {
        DICE_MODEL diceA = dice[i];
        for (int j = i + 1; j < diceNum; j++)
        {
            DICE_MODEL diceB = dice[j];

            int  men = 1;
            int  clockCnt  = 0;

            while (1)
            {
                if (diceA == diceB)
                {
                    equalFlag = true;
                    break;
                }

                diceA.turnClock();
                clockCnt++;
                if (clockCnt > 3)
                {
                    men++;

                    if      (men <= 4) diceA.turnNorth();
                    else if (men == 5)
                    {
                        diceA.turnNorth();
                        diceA.turnEast();
                    }
                    else if (men == 6)
                    {
                        diceA.turnEast();
                        diceA.turnEast();
                    }
                    else break;
                    
                    clockCnt = 0;
                }
            }

            if (equalFlag) break;
        }

        if (equalFlag) break;
    }

    if (equalFlag) std::cout << "No" << std::endl;
    else           std::cout << "Yes"  << std::endl;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(){
    long long N,K;

    cin >> N >> K;

    N = N%K;

    if(K - N > N){
        cout << N << endl;
    }else{
        cout << K - N << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
//?????¢merge
#include<iostream>
#include<cstdio>
#include<algorithm>
#define MAX 200000
#define INF 2000000000

using namespace std;

int LEFT[MAX/2+2],RIGHT[MAX/2+2];

long long s=0;

void Merge(int A[], int left,int mid,int right){
    int n1 = mid - left;
    int n2 = right - mid;
    
    for (int i = 0; i < n1; i++) LEFT[i] = A[i+left];
    for (int i = 0; i < n2; i++) RIGHT[i] = A[i+mid];
    
    LEFT[n1] = INF;
    RIGHT[n2] = INF;
    
    int countL=0,countR=0;
    int N = n1 + n2;
    for (int i = 0; i < N; i++) {
        
        int plus = countL + countR;
        if (LEFT[countL] <= RIGHT[countR]) {
            A[left+plus] = LEFT[countL];
            countL++;
        }else{
            A[left+plus] = RIGHT[countR];//????????§?????¢?????????????????????????????°???n1 - countL
            s += n1-countL;
            countR++;
        }
    }
}

void MergeSort(int A[],int left ,int right){
    int mid = (left + right)/2;
    if (right - left > 1) {
        MergeSort(A,left,mid);
        MergeSort(A,mid,right);
    }
    Merge(A,left,mid,right);
}

int main(){
    int A[MAX];
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    
    MergeSort(A,0,n);
    
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, k, s; cin >> n >> k >> s;
  int extra = s > n ? 1 : 1000'000'000;
  for (int i = 0; i < k; i++) {
    cout << s << ' ';
  }
  for (int i = k; i < n; i++) {
    cout << extra << ' ';
  }
  cout << '\n';

  return 0;
}


Measured memory_bytes: 1280
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
def do():
    n = INT()
    k = INT()
    x = INT()
    y = INT()
    if n<=k:
        print(n*x)
    else:
        print(k*x+(n-k)*y)
if __name__ == '__main__':
    do()

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

int getdigit(int num) {
	int digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		cout << getdigit(a + b) << endl;
	}
	return 0;
}


Measured memory_bytes: 2972
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int x;
	cin >> x;
	if(x >= 30) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
using namespace std;

#define REP(i, n) for(int i = 0; i < (n); ++i)

int main(void) {
    string o, e, ans = "";

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> o;
    cin >> e;
    REP(i, o.length() + e.length()) {
        ans += (i % 2 == 0)? o[(i / 2) + (i % 2)] : e[(i / 2) + (i % 2) - 1];
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include"iostream"
#include"cstdio"
#include"cmath"
#include"cstring"
#include"algorithm"
#include"stack"
#include"queue"
using namespace std;

#define read(x) scanf("%d",&x)
#define readl(x) scanf("%lld",&x)
#define ll long long 
#define inf 2147483647
#define ull unsigned long long
#define MAXN 10000005 

int pri[MAXN],vis[MAXN];
int t[MAXN],e[MAXN];
int n,cnt=0;
ll sum=0;

void get(int n)
{
	t[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(!vis[i]) pri[++cnt]=i,t[i]=2,e[i]=1;
		for(int j=1;j<=cnt;j++)
		{
			if(1ll*pri[j]*i>(ll)n) break;
			vis[pri[j]*i]=1;
			if(i%pri[j]==0){e[i*pri[j]]=e[i]+1,t[i*pri[j]]=t[i]/(e[i]+1)*(e[i*pri[j]]+1);break;}
			else t[i*pri[j]]=t[i]*t[pri[j]],e[i*pri[j]]=1;
		}
	}
	return;
}

int main()
{
	read(n);
	get(n+1);
	for(int i=1;i<=n;i++)
	{
		sum=sum+1ll*i*t[i];
	}
	cout<<sum<<endl;
	return 0;
} 

Measured memory_bytes: 123408
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
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;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
// clang-format on
int k[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
           1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K;
  cin >> K;

  cout << k[K - 1] << endl;

  return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long a = long.Parse(input[0]);
        long b = long.Parse(input[1]);
        long times = 0;
        long sockets = 1;
        while (sockets < b)
        {
            sockets = (sockets - 1) + a;
            times++;
        }
        Console.WriteLine(times);
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>

using namespace std;

using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const ll INF = (1e+18)+100;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repl(i, l, n) for(int i=l;i<n;++i)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;

typedef long double ld;
const ld eps = 1e-8;

bool exi[100001];
void solve() {
	int x; cin >> x;
	exi[0] = true;
	rep(i, 6) {
		int val = 100 + i;
		
		rep(j, 100001) {
			if (exi[j] && j + val < 100001) {
				exi[j + val] = true;
			}
		}
	}
	cout << exi[x] << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int
//------------ATCODER TEMPLATE-------------

signed main() {
  int N; cin >> N;
  string S;
  while (N > 0) {
    int d = (N-1) % 26;
    char c = 'a' + d;
    S = c + S;
    N = (N-1) / 26;
  }
  cout << S << endl;

  return 0;
}


Measured memory_bytes: 3592
n, k, q = list(map(int, input().split()))
nums = [int(input()) for _ in range(q)]
ans = [k - q for _ in range(n)]

for num in nums:
	ans[num - 1] += 1

print('\n'.join(map(str, ["Yes" if x > 0 else "No" for x in ans])))



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

int main()
{
    int N, X, m[1010];
    cin >> N >> X;
    REP(i, N) cin >> m[i], X -= m[i];
    sort(&m[0], &m[N]);
    cout << N + X / m[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
//入力a,bの平均値の小数点以下を切上げた値を出力
int main(void) {
  int a, b, c;
  // scanfで入力を読み込み
  scanf("%d%d", &a, &b);
  // 平均値の計算 ceil:小数点を切上げる関数
  c = ceil((a + b) / 2.0);
  // 答えの出力
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 128
def sum_distance(a, b):
    x = 0
    for i in range(a):
        x += ((i + 1) * (a - i))
        x %= mod
    x *= pow(b, 2)
    return x % mod

def comb(n, r):
    x, y = 1, 1
    for i in range(n, n - r, -1):
        x *= i
        y *= i + r - n
        x %= mod
        y %= mod
    return pow(y, mod - 2, mod) * x % mod

n, m, k = map(int, input().split())
mod = pow(10, 9) + 7
ans = 0
ans += sum_distance(n - 1, m)
ans += sum_distance(m - 1, n)
ans %= mod
ans *= comb(n * m - 2, k - 2)
ans %= mod
print(ans)

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

int main(){
    int n,q;
    string s;
    cin >> n >> q >> s;

    vector<pair<int,int>> pls;
    rep(i,q){
        pair<int,int> p;
        cin >> p.first >> p.second;
        p.first--;
        p.second--;
        pls.push_back(p);
    }

    vector<int> cnts(n);
    int cur = 0;
    rep(i,n-1){
        char c = s.at(i);
        if(s.at(i) == 'A' && s.at(i+1) == 'C'){
            cur++;
        }
        cnts.at(i) = cur;
    }

    rep(i,q){
        int res = cnts.at(pls.at(i).second-1);
        if(pls.at(i).first > 0){
            res -= cnts.at(pls.at(i).first-1);
        }
        // cout << pls.at(i).first << " " << pls.at(i).second << " " << res << endl;
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 2292
#include <bits/stdc++.h>
using namespace std;
const int N=25;
int n,a[N],b[N],c[N];
int ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=1;i<=n;++i) cin>>a[i];
	for (int i=1;i<=n;++i) cin>>b[i];
	for (int i=1;i<n;++i) cin>>c[i];
	for (int i=1;i<=n;++i)
	{
		ans+=b[a[i]];
		if (a[i-1]+1==a[i]) ans+=c[a[i-1]];
	}
	cout<<ans;
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    multiset<int> ms;
    reverse(A.begin(), A.end());
    for(auto &e : A) {
        auto it = ms.upper_bound(e);
        if(it != ms.end()) ms.erase(it);
        ms.insert(e);
    }
    cout << ms.size() << '\n';
    return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cstring>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;


int n, m;

bool check(const string &s){
	for(int i = 0; i < n*2+1; i+=2) if(s[i] != 'I') return false;
	for(int i = 1; i < n*2+1; i+=2) if(s[i] != 'O') return false;
	return true;
}

int main(){
	while(cin >> n, n){
		cin >> m;
		string s;
		cin >> s;
		int ans = 0;
		rep(i, m-n*2+1){
			ans += check(s.substr(i, n*2+1));
		}
		cout << ans << endl;
	}

    return 0;
}

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

const int N = 1e5 + 5 , INF = 2e9;

int n , k;
int  h[N];
int dp[N];

main(){
    scanf("%d %d" , &n , &k);

    for(int i = 1 ; i <= n ; i ++){
        scanf("%d" , &h[i]);
    }

    for(int i = 1 ; i <= n ; i ++)dp[i] = INF;
    dp[1] = 0;

    for(int i = 1 ; i <= n ; i ++){
        for(int j = 1 ; j <= k ; j ++){
            if(i - j >= 1){
                dp[i] = min(dp[i] , abs(h[i] - h[i - j]) + dp[i - j]);
            }
        }
    }

    printf("%d\n" , dp[n]);
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,count=0;
    cin>>N;
    int arr[N];
    for(int i=0;i<N;i++)
    {
        cin>>arr[i];

    }
    for(int i=0;i<N-1;i++)
    {
        if(arr[i]!=i+1)
            count++;

    }
    if(count<=2)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}

Measured memory_bytes: 256
from itertools import product as p
n=input()
N=int(n)
ans=0

for j in range(1,len(n)+1):
  for i in p(["3","5","7"],repeat=j):
    s="".join(i)
    v=int(s)
    if "3" in s and "5" in s and "7" in s and v<=N:
      ans+=1

print(ans)

Measured memory_bytes: 3060
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


if __name__ == "__main__":
    mod = 10**9 + 7
    x, y = map(int, input().split())

    if (x + y) % 3 != 0:
        print(0)
        exit()

    n = (x + y) // 3
    k = (2 * x - y) // 3
    g1 = [1, 1]  # 元テーブル
    g2 = [1, 1]  # 逆元テーブル
    inv = [0, 1]  # 逆元テーブル計算用テーブル

    for i in range(2, n + 1):
        g1.append((g1[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inv[-1]) % mod)

    print(cmb(n, k, mod))


Measured memory_bytes: 82448
N = int(input())
S = input()

def z_algo(S):
    N = len(S)
    Z = [0]*N
    i = 1
    j = 0
    Z[0] = N
    while i < N:
        while i+j < N and S[j] == S[i+j]:
            j += 1
        if j == 0:
            i += 1
            continue
        Z[i] = j
        k = 1
        while i+k < N and k < j-Z[k]:
            Z[i+k] = Z[k]
            k += 1
        i += k
        j -= k
    return Z

ans = 0
l = 0
while l < N:
    temp = S[l:]
    z = z_algo(temp)
    for i in range(1, len(temp)):
        ans = max(ans, min(i, z[i]))
    l += 1
    
print(ans)

Measured memory_bytes: 49500
#!/usr/bin/env pypy3

import sys
sys.dont_write_bytecode = True
stdin = sys.stdin
input = stdin.readline
#sys.setrecursionlimit(100000)

#import numpy as np
#import scipy as sp

# Python 3 modules: https://docs.python.org/3/library/

import math, itertools, operator
from math import *
from math import factorial as fact
from operator import itemgetter, attrgetter
from itertools import permutations, combinations
from functools import reduce
# Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
# Before Python 3.5.  Import from math after it.
from fractions import gcd
from fractions import Fraction as Frac

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return list(map(conv, inp().split(sep = sep)))

################################################################################

A, B = input_ints()
print(B if A >= 13 else B//2 if A >= 6 else 0)


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

using namespace std;

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

	cin >> a >> b >> c;
	if (a < b && b < c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3092
import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer n = Integer.parseInt(scanner.next());
        Integer[] num_seq = new Integer[n];

        for(int i = 0; i < n; i++) {
            num_seq[i] = Integer.parseInt(scanner.next());
        }

        int count = 0;
        boolean[] total = new boolean[n-1];
        for(int i = 0; i < num_seq.length -1; i++) {
            if(num_seq[i] < num_seq[i+1]) {
                total[i] = true;
            } else {
                total[i] = false;
                count++;
            }
        }

        if(count > 2) {
            System.out.println("NO");
            System.exit(0);
        }

        int tmp = -1;
        int hoge = 0;
        boolean is_first = true;
        for(int i = 0; i < total.length; i++) {
            if (total[i] == false) {
                if(is_first) {
                    tmp = i;
                    is_first = false;
                } else {
                    hoge = num_seq[tmp];
                    num_seq[tmp] = num_seq[i+1];
                    num_seq[i+1] = hoge;
                }
            }
        }

        for(int i = 0; i < num_seq.length -1; i++) {
            if( !(num_seq[i] < num_seq[i+1])) {
                System.out.println("NO");
                System.exit(0);
            }
        }
        System.out.println("YES");
    }
}


Measured memory_bytes: 22740
from bisect import bisect_right
s=input()
t=input()
dic={}
n=len(s)
for i in range(n):
	if s[i] in dic:
		dic[s[i]].append(i)
	else:
		dic[s[i]]=[i]
k=-1
r=0
for i in t:
	if i in dic:
		a=bisect_right(dic[i],k)
		if a==len(dic[i]):
			r+=1
			k=dic[i][0]
		else:
			k=dic[i][a]
	else:
		print(-1)
		exit()
print(r*n+k+1)


Measured memory_bytes: 7668
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    lint a=input,b=input,c=input,k=input;

    std::cout<<
        std::min(a, k) - std::max(k-a-b, 0ll) << '\n';
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

vi init(string& P)
{
    vi b(P.size() + 1);
    int i = 0, j = -1; b[0] = -1;
    while (i < P.size())
    {
        while (j >= 0 && P[i] != P[j]) j = b[j];
        b[++i] = ++j;
    }
    return b;
}

vi kmp(string& T, string& P, vi& b)
{
    vi ret;
    int i = 0, j = 0;
    while (i < T.size())
    {
        while (j >= 0 && T[i] != P[j]) j = b[j];
        ++i; ++j;
        if (j == P.size())
        {
            ret.push_back(i - j);
            j = b[j];
        }
    }
    return ret;
}

vector<int> ord;
string s, t;
vi a;

int dfs(int x)
{
    if (!a[x])
        return 0;

    return a[x] = 1 + dfs((x + t.size()) % s.size());
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> s >> t;
    s.reserve(max(s.size(), t.size()));
    while (s.size() < t.size())
        s += s;
    vi b = init(t);
    string z = s + s;
    vi m = kmp(z, t, b), n;
    a.resize(s.size());
    for (int x : m)
        if (x < s.size())
            a[x] = 1, n.push_back(x);

    if (n.empty())
        return cout << 0, 0;
    vi ind(s.size());
    for (int x : n)
        if (a[(x + t.size()) % s.size()])
            ind[(x + t.size()) % s.size()]++;

    int bst = -1;
    for (int x : n)
        if (ind[x] == 0)
            bst = max(bst, dfs(x));

    cout << bst;
}


Measured memory_bytes: 24356
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;
using ul = uint64_t;

int main() {
  string s;
  cin >> s;
  int streak = 0;
  int maxStreak = 0;
  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] == 'R') {
      ++streak;
      maxStreak = max(maxStreak, streak);
    } else {
      streak = 0;
    }
  }
  cout << maxStreak << endl;
  return 0;
}

Measured memory_bytes: 3592
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;

typedef int LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 81, INF = MaxN * MaxN * 2 + 1;

LL n, a[MaxN][MaxN], m, b[MaxN][MaxN], kq = 1e9;
bool d[MaxN][MaxN][MaxN * MaxN * 4 + 3];

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j) cin >> a[i][j];
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j) cin >> b[i][j];
    d[1][1][a[1][1] - b[1][1] + INF] = 1;
    d[1][1][b[1][1] - a[1][1] + INF] = 1;
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j)
    for(int k = 0 ; k <= INF * 2 ; ++k){
        if(d[i - 1][j][k]){
            d[i][j][k + a[i][j] - b[i][j]] = 1;
            d[i][j][k - a[i][j] + b[i][j]] = 1;
        }
        if(d[i][j - 1][k]){
            d[i][j][k + a[i][j] - b[i][j]] = 1;
            d[i][j][k - a[i][j] + b[i][j]] = 1;
        }
    }
    for(int i = 0 ; i <= INF * 2 ; ++i)
    if(d[n][m][i]) kq = min(kq, abs(i - INF));
    cout << kq << endl;

    return 0;
}

Measured memory_bytes: 166400
#include<bits/stdc++.h>
using namespace std;
const int maxx=1e5+10;
typedef long long ll;
map<string,int> mp;
int main(){
    int n; cin>>n;
    for(int i=1;i<=n;i++){
        string s; cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI tv(n);
    int t_sum = 0;
    REP(i, n){
        cin >> tv[i];
        t_sum += tv[i];
    }
    int m;
    cin >> m;
    REP(i, m){
        int p, x;
        cin >> p >> x;
        p--;
        cout << t_sum + x - tv[p] << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
"""
根付き木を構成する
"""
import copy

class Node:
    def __init__(self):
        self.parent = -1
        self.depth = 0
        self.children = []

#空の木の構成
#node_idをインデックスに持たせる
n = int(input())
nodes = []
for _ in range(n):
    node = Node()
    nodes.append(node)

def getDepth(node_id):
    d = 0
    target = nodes[node_id]
    while target.parent != -1:
        d += 1
        tmp_num = target.parent
        target = nodes[tmp_num]
    return d

def getParent(node_id):
    target = nodes[node_id]
    return target.parent

def getDegree(node_id):
    target = nodes[node_id]
    count = 0
    if target.children[0] != -1:
        count += 1
    if target.children[1] != -1:
        count += 1
    return count

def getType(node_id):
    target = nodes[node_id]
    if target.parent == -1:
        return 'root'
    elif target.children[0] == -1 and target.children[1] == -1:
        return 'leaf'
    else:
        return 'internal node'

def getSibling(node_id):
    target = nodes[node_id]
    if not target.parent == -1:
        brother_list = copy.copy(nodes[target.parent].children)
        brother_list.remove(node_id)
        return brother_list[0]
    else:
        return -1

def getChildren(node_id):
    target= nodes[node_id]
    return target.children

def getHeight(node_id, h): #このhに結果を保持してく
    target = nodes[node_id]
    h1 = 0
    h2 = 0
    if target.children[0] != -1:
        h1 = getHeight(target.children[0], h)+1
    if target.children[1] != -1:
        h2 = getHeight(target.children[1], h)+1
    h = max(h1, h2)
    return h



#木の構成
for i in range(n):
    l = list(map(int, input().split()))
    node_id = l[0]

    for j in range(2):
        try:
            child = l[1+j] #l[1+j]というのは子供の番号
            nodes[node_id].children.append(child) 
            if not child == -1:
                nodes[child].parent = node_id #子一人当たり親は必ず一人
        except:
            pass #エラー回避
    else:
        pass #子がいないとき


for i in range(n):
    ans = 'node '+str(i)+': ' +\
          'parent = '+str(getParent(i))+', ' +\
          'sibling = '+str(getSibling(i))+', ' +\
          'degree = '+str(getDegree(i))+', ' +\
          'depth = '+str(getDepth(i))+', '+\
          'height = '+str(getHeight(i, h=0))+', ' +\
           getType(i)
    print(ans)


    



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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++)
    {
        cin >> A.at(i);
    }
    int sum=0;
    for(int i=0; i<N; i++)
    {
        sum+=A.at(i);
    }
    cout << sum-N << endl;
}

Measured memory_bytes: 3648
/*
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt
    */

//  io
#include <iostream>
//#include <fineam> //http://www.cplusplus.com/reference/fineam/fineam/
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
#include <limits>
//  util
#include <string>
#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
#include <queue>
#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//file input routed to stdinout
/*
    std::ifineam inFile("input.txt");
    std::ofineam outFile("output.txt");
    std::cin.rdbuf(inFile.rdbuf());
    std::cout.rdbuf(outFile.rdbuf());
    */

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll a, b;
    cin >> a >> b;

    ll aux = __gcd(a, b);

    ll coprimes = 1;

    for (ll i = 2; i * i <= aux; i++)
    {
        bool prime = 0;
        while (!(aux % i))
        {
            aux /= i;
            prime = 1;
        }
        if (prime)
        {
            coprimes++;
        }
    }
    if (aux != 1)
    {
        coprimes++;
    }

    cout << coprimes;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;

const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get() {
	if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
	if(H==T) return -1;
	return *H++;
}
inline int read() {
	int x=0;
	char c=Get();
	while(!isdigit(c)) c=Get();
	while(isdigit(c)) x=x*10+c-'0',c=Get();
	return x;
}

typedef pair<int,int> pii;
const double pi=acos(-1);
const int N=200010;
const int MX=1e8+5;
int x1,yy1,x2,yy2,n,tot=0,lis;
int g[N],idx[N],a[N],f[N],gx[N],ax[N];
pii pnt[N];
bool deled[N];

int LIS() {
	int res=0;
	memset(g,0x7f,sizeof(g));
	for(int i=1; i<=tot; i++) {
		auto it=lower_bound(g+1,g+1+n,a[i]);
		if(*it==0x7f7f7f7f) res++;
		*it=a[i];
	}
	return res;
}

int main() {
	x1=read();
	yy1=read();
	x2=read();
	yy2=read();
	n=read();
	for(int i=1; i<=n; i++) pnt[i].X=read(),pnt[i].Y=read();
	if(x2<x1||yy2<yy1) {
		if(x1<=x2) goto swap2;
		x1=MX-x1;
		x2=MX-x2;
		for(int i=1; i<=n; i++) pnt[i].X=MX-pnt[i].X;
		if(yy1<=yy2) goto work;
swap2:
		yy1=MX-yy1;
		yy2=MX-yy2;
		for(int i=1; i<=n; i++) pnt[i].Y=MX-pnt[i].Y;
	}
work:
	sort(pnt+1,pnt+1+n);
	for(int i=1; i<=n; i++)
		if(pnt[i].X>=x1&&pnt[i].X<=x2&&pnt[i].Y>=yy1&&pnt[i].Y<=yy2) a[++tot]=pnt[i].Y;
	double ans=100.0*(x2-x1+yy2-yy1)+(pi*5-20)*(lis=LIS());
	if(lis==min(x2-x1,yy2-yy1)+1) ans+=pi*5;
output:
	printf("%.12lf\n",ans);
	return 0;
}

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

int main() {
    int n, a, b;
    std::cin >> n >> a >> b;
    int temp = n * a;
    
    if (temp >= b){
        std::cout << b << std::endl;
    }
    else{
        std::cout << temp << std::endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

vector<int> sieve(int n) {
	vector<int> res(1, 2);
	vector<bool> prime(n, true);
	for(int i = 3; i < n; i += 2) {
		if(prime[i]) {
			res.push_back(i);
			for(int j = i * 3; j < n; j += i * 2)
				prime[j] = false;
		}
	}

	return res;
}

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

	const int MAX = 123456 * 2 + 1;
	vector<int> primes = sieve(MAX);
	for(int n; cin >> n, n;) {
		if(n == 1)
			cout << 1 << endl;
		else
			cout << lower_bound(primes.begin(), primes.end(), 2 * n) - upper_bound(primes.begin(), primes.end(), n) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1356
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main()
{
  int n, m, total=0, count=0;
  cin>>n>>m;
  vector<int> v(n);
  for(int i=0; i<n; i++)
  {
    cin>>v[i];
    total+=v[i];
  }
  
  double j=1.0*total/(4*m);
  for(int i=0; i<n; i++)
    if(v[i]>=j) count++;
  
  if(count>=m) cout<<"Yes";
  else cout<<"No";

  return 0;
}

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

namespace ConsoleApplication1
{
    class User
    {
        internal int group;
        internal List<int> friends;

        public User()
        {
            group = -1;
            friends = new List<int>();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int n = input[0], m = input[1];

            User[] users = new User[n];
            for (int i = 0; i < n; i++) users[i] = new User();

            for (int i = 0; i < m; i++)
            {
                input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                users[input[0]].friends.Add(input[1]);
                users[input[1]].friends.Add(input[0]);
            }
            
            for(int i = 0; i < n; i++)
            {
                if (users[i].group == -1) DFS(users, i, i);
            }

            StringBuilder sb = new StringBuilder();
            int q = int.Parse(Console.ReadLine());

            for (int i = 0; i < q; i++)
            {
                input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                sb.AppendLine(users[input[0]].group == users[input[1]].group ? "yes" : "no");
            }
            Console.Write(sb);
        }

        static void DFS(User[] U, int u, int g)
        {
            Stack<User> stk = new Stack<User>();
            U[u].group = g;
            stk.Push(U[u]);

            while (stk.Count > 0)
            {
                User temp = stk.Pop();

                foreach (var friend in temp.friends)
                {
                    if (U[friend].group == -1)
                    {
                        U[friend].group = g;
                        stk.Push(U[friend]);
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 27772
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    int N;
    cin>>N;
    int p[N];
    int cnt=0;
    rep(i,N){
        cin>>p[i];
        if(i+1!=p[i]){
            cnt++;
        }
    }
    if(cnt==0||cnt==2){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
    
}


Measured memory_bytes: 3608
a, b, c, k = map(int, input().split())
cnt = 0

if a > k:
    cnt += k
else:
    cnt += a
    k -= a
if k != 0:
    if b > k:
        k -= k
    else:
        k -= b
    if k != 0:
        if c > k:
            cnt -= k
        else:
            cnt -= c

print(cnt)


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

int main() {
    int n, m;
    cin >> n >> m;
    if (n == m) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VINT;
typedef unsigned long long ULL;
typedef pair<ULL, int> PAIR;
const ULL INF=1e16;
struct Graph{
  int N, M; VINT B; vector<ULL> w, d; vector<VINT> from;
  Graph(int n) : N(n), M(0), d(n), from(n) {}
  void setEdge(int s, int t, ULL u){ 
    B.push_back(t); w.push_back(u); from[s].push_back(M); M++;
  }
  void Dijkstra(int s){
    priority_queue< PAIR, vector<PAIR>, greater<PAIR> > Q;
    for(int i=0; i<N; i++){ d[i]=(i==s)?0:INF; Q.push(make_pair(d[i], i)); }
    while(!Q.empty()){
      PAIR p=Q.top(); int v=p.second; Q.pop();
      if(p.first==INF){ break; }
      if(d[v]<p.first){ continue; }
      for(int i=0; i<from[v].size(); i++){
        int e=from[v][i], u=B[e]; ULL nw=d[v]+w[e];
        if(nw<d[u]){ d[u]=nw; Q.push(make_pair(d[u], u)); }
      }
    }
  }
};
int main(){
  int MAX=0, N, M, S, i, j, k; cin >> N >> M >> S; 
  int U[M], V[M], A[M], C[N]; ULL B[M], D[N]; vector<VINT> edge(N);
  for(i=0; i<M; i++){ 
    cin >> U[i] >> V[i] >> A[i] >> B[i]; U[i]--; V[i]--;
    edge[U[i]].push_back(i); edge[V[i]].push_back(i); MAX=max(MAX, A[i]);
  }
  MAX=MAX*(N-1); S=min(S, MAX);
  for(i=0; i<N; i++){ cin >> C[i] >> D[i]; }
  int h=0; map<pair<int, int>, int> F;
  for(i=0; i<N; i++){ for(j=0; j<=MAX; j++){ F[make_pair(i, j)]=h; h++; } }
  Graph G(h);
  for(i=0; i<N; i++){ for(j=0; j<=MAX; j++){
    int p=F[make_pair(i, j)], m=min(j+C[i], MAX);
    if(j<MAX){ G.setEdge(p, F[make_pair(i, m)], D[i]); }
    for(k=0; k<edge[i].size(); k++){
      int e=edge[i][k], v=(i!=U[e])?U[e]:V[e];
      if(A[e]<=j){ G.setEdge(p, F[make_pair(v, j-A[e])], B[e]); }
    }
  } }
  G.Dijkstra(F[make_pair(0, S)]);
  ULL ans=0;
  for(i=1; i<N; i++){ 
  for(ans=INF, j=0; j<=MAX; j++){ ans=min(ans, G.d[F[make_pair(i, j)]]); }
  cout << ans << "\n";
  }
}

Measured memory_bytes: 33876
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll K;
  cin >> K;
  ll a = K / 50;
  ll b = K % 50;
  cout << 50 << endl;

  cout << (49 - b + ((b / 3) * 51) + a);
  cout << " " << (49 - b + ((b / 3) * 51) + a);
  cout << " " << (49 - b + (((b / 3) + (b % 3)) * 51) + a);

  REP(i, 47) { cout << " " << 49 + a - b; }
  cout << endl;

  return 0;
}


Measured memory_bytes: 504
N,A,B = map(int,input().split())
S = input()

goal =0
Bgoal =0

for i in range(N):
    if S[i]=="a":
        if goal < A+B:
            print("Yes")
            goal +=1
        else:
            print("No")
    elif S[i] =="b":
        if goal < A+B and  Bgoal < B:
            print("Yes")
            goal += 1
            Bgoal +=1
        else:
            print("No")
    elif S[i] == "c":
        print("No")

Measured memory_bytes: 4016
#include<stdio.h>
int main(void){
	int t;

	int h,m,s;
	
	scanf("%d",&t);
	
	h=t/(60*60);
	m=(t%3600)/60;
	s=t-(h*3600)-(m*60);

	printf("%d:%d:%d\n",h,m,s);

	return 0;
}
	

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

void solve(long long X)
{
    ll a = X / 500;
    X -= a * 500;
    ll b = X / 5;
    cout << a * 1000 + b * 5 << endl;
}

int main()
{
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int num=1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<int>());
    int cnt=1;
    bool flag=false;
    for(int i=0; i<n-1; i++){
        if(a[i]==a[i+1])cnt++;
        else cnt=1;
        if(cnt%2==0)b.push_back(a[i]);
        if(b.size()>=2){
            flag=true;
            break;
        }
    }
    if(flag){
        ll ans=(ll)b[1]*b[0];
        cout << ans << endl;
    }
    else cout << 0 << endl;
}

Measured memory_bytes: 640
X = int(input())
temp = X % 7

if temp == 0:
    print("thu")
elif temp == 1:
    print("fri")
elif temp == 2:
    print("sat")
elif temp == 3:
    print("sun")
elif temp == 4:
    print("mon")
elif temp == 5:
    print("tue")
elif temp == 6:
    print("wed")


Measured memory_bytes: 5592
/*
_____________________$$o____________________o$$$$$o__
___________________o$o_$$o____oo$$$$$$$oo______o$$$$o
______________$o________o$$$$$o___oo$$$$$$$o______$$$
______________$$$ooo________o$$$$o______o$$$$$o_____o
____________oo_____oo_____oo___o$$$$$______$$$$$$____
_________ooooo___$$o_$___oooooo___o$$$$o__o__o$$$$___
_______ooo__ooo$$$$o_$$ooooooooooo__o$$$o__oo_oo$$$o_
______oo_o$$o_$$_o$o_o$o__oooooooooo__o$$$o_oo__o$$$o
____oooooo$$$$o___oo__$$o_ooo_oooooooo__o$$o_ooo_o$$$
___ooooooo__o___oooo__$$ooooo$_oooooooo__o$$__ooo_$$$
_$$o_ooooo___o$$$$$o__o$o__o_$o__oooooooo_o$$o_oo__$$
_$$$o_ooo_________o$$_$$o____$$o_ooooooooo_$$$o_oo_$$
__oo________o$$o____o_$$o____o$ooooooooooo_o$$o_oo_o$
___o$$$$$$$$$$$$$o___$$$o____$$o_oooooooooo_$$$o_o_o$
________o__oo$$$$$o__$$$o____$$o____oooooo__$$$o_o_o$
_________$$$$$$$$$o__$$_____$$$o___________$$$oooooo_
__________o$$$$$$$o_________$$___________o$o___oooooo
___________o$$$$o_______________ooooo__oo$__ooo__oooo
________________________________ooo_$$oo___oooo$o____
________________________________oooo_$$$$$o___oo$$$o_
________________________________ooooo_o$$$$$o_____$$$
________________________________oooooo_o$$$$$$ooo___o
________________________________ooooooo__o$$$$$o_____
*/
#include<bits/stdc++.h>
#define ll long long
#define ft first
#define sd second
#define HageBaIO_KPOCCbI int LOL;scanf("%d", &LOL);for(int i = 0; i < LOL; i++)
#define Terrorist ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//BY |3 |<
const int dx[] = {1, 0, -1,  0};
const int dy[] = {0, 1,  0, -1};
//Where I am?
const ll N = 2e3 + 3;
const ll NN = 1e3 + 3;
const ll MOD = (1e9 + 7);
const ll MOD1 = 998244353;
const double PI = 3.14159265;
const int INF32 = 2e9;
const ll INF64 = 2e18;
//Don`t believe!!!//
int n, x, y, d[N];
queue<int>q;
vector<int>g[N];
map<int, int>mp;
void KEK(){
	cin>>n>>x>>y;
	for(int i = 1; i < n; i++){
		g[i].push_back(i + 1);
		g[i + 1].push_back(i);
	}
	g[x].push_back(y);
	g[y].push_back(x);
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(j != i)d[j] = INF32;
			else d[j] = 0;
		}
		q.push(i);
		while(!q.empty()){
			int x = q.front();
			q.pop();
			for(int i = 0; i < g[x].size(); i++){
				if(d[g[x][i]] > d[x] + 1){
					d[g[x][i]] = d[x] + 1;
					q.push(g[x][i]);
					mp[d[g[x][i]]]++;
				}
			}
		}
	}
	for(int i = 1; i < n; i++)cout<<mp[i] / 2<<endl;
}
int main(){
	Terrorist
	//HageBaIO_KPOCCbI
	KEK();
	return 0;
}
//TAUMAC, 9| BbIWEJI 3A TObOU!!!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
p = list(map(int, input().split()))

ans = 1
mi = p[0]
for i in range(1, n):
    if p[i] <= mi:
        ans += 1
        mi = min([p[i], mi])

print(ans)


Measured memory_bytes: 31008