akhauriyash/Code-Regression huggingface dataset:
/*
memo
????????°??????

*/

#include<iostream>
#include<cstring>
#include<vector>
using namespace std;

int m, n;
int ma[300];
//int ka[300][300];
vector<int> g[300];
bool go[300], ba[300];
void iki(int x)
{
	//????????§????????¨????????????????????????

	//????????????????????´??????????????????????????°?????¨??????
	//????????´??????????????°???????????????
	//???????????????????????§??????????????¶???????????????????????????????????£???
	//??????????????°????????????????????°????????????????????°?????¨???????????????????????????
	//?????????????????????????????°?????¨??°?????°????????´???????¨???????????????????
	//????????????????????´???????????£???????????´???????????????????????????????????????
	//??´?????????????????????????????´??????????§???????????????????????????????????????´????????????????????¨??????????????°????????????????????????????????????

	int i;

	if (go[x]) return;
	go[x] = true;				//????????°??????
	if (x == n + 1) return;
	for (i = 1; i <= m; i++)
	{
		int y = x + i;
		if (y <= n+1)
		{
			y = y + ma[y];
			if (y>0)
			{
				if (y > n + 1) y = n + 1;
				//if (ka[y][x] == 1)continue;
				//ka[y][x] = 1;

				g[y].push_back(x);
				iki(y);
			}
		}

	}
	return;
}

void kae(int x)
{
	//????????§?????°?????¨????????´???????????????????????????????????¨???????????????????????????

	//????????????????????´?????????????§??????¨??????????????????????????°????????????????????§???????????´?????????????????????
	//??????????????§?????£?????´??????????????¨?????????????????°???????????????


	int i;
	if (ba[x]) return;
	ba[x] = true;
	if (x == 0) return;
	for (i = 0; i<g[x].size(); i++)
	{
		kae(g[x][i]);
	}
	return;
}

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

		//---------------?????????--------------------//
		for (i = 0; i<300; i++)
		{
			g[i].clear();
			ma[i] = 0;
			//for (int j = 0; j<300; j++)
			//{
			//	ka[i][j] = 0;
			//}
		}
		memset(go, 0, sizeof(go));
		memset(ba, 0, sizeof(ba));


		for (i = 1; i <= n; i++)
		{
			cin >> ma[i];
		}
		ma[0] = ma[n + 1] = 0;

		iki(0);
		kae(n + 1);


		/*
		for (i = 0; i <= n + 1; i++)
		{
			cout << "  " << go[i] << "  " ;
		}
		cout << endl;
		for (i = 0; i <= n + 1; i++)
		{
			cout << "  " << ba[i] << "  ";
		}
		*/



		for (i = 0; i <= n + 1; i++)
		{
			if (go[i])
			{
				if (ba[i] == 0)
				{
					cout << "NG\n";
					break;
				}
			}
			if (i == n + 1) cout << "OK\n";
		}
	}
	return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pub push_back
#define pob pop_back
#define M 1000000007
#define pii pair<ll,ll>
#define mp make_pair
using namespace std;
vector<pii >p;
int main()
{
    ios_base::sync_with_stdio(false);
    ll a,b,p,x;
    cin>>a>>b;
    p=b%4;
    if(p==3)x=0;
    else if(p==2)x=b+1;
    else if(p==1)x=1;
    else {x=b;}
    if(a!=0)
    {
    	p=(a-1)%4;
    	if(p==3)x^=0;
    	else if(p==2)x^=a;
    	else if(p==1)x^=1;
    	else {x^=(a-1);}
	}	
    cout<<x;

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:

};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; 
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    pair<int,int> maxs{-1, -1};
    for (int i = 0; i < n; ++i) {
        if (maxs.first <= A[i]) {
            maxs.second = maxs.first;
            maxs.first = A[i];
        } else if (maxs.second < A[i]) {
            maxs.second = A[i];
        }
    }

    for (int i = 0; i < n; ++i) {
        if (A[i] == maxs.first) {
            cout << maxs.second << "\n";
        } else {
            cout << maxs.first << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {

	string str;
	cin >> str;
	int ue = stoi(str) / 100;
	int sita = stoi(str) - ue * 100;
	string ans = "NA";

	if ((ue >= 1 && ue <= 12) && (sita < 1 || sita > 12)){
		ans = "MMYY";
	}
	else if ((ue < 1 || ue > 12) && (sita >= 1 && sita <= 12)) {
		ans = "YYMM";
	}
	else if ((ue >= 1 && ue <= 12) && (sita >= 1 && sita <= 12)) {
		ans = "AMBIGUOUS";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <limits.h>

#define YesNo(b) ((b) ? "Yes" : "No")
#define YESNO(b) ((b) ? "YES" : "NO")

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;


int main()
{
	int N;
	string S;
	cin >> N >> S;
	S.push_back('x');
	S.push_back('x');

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C')
		{
			++ans;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n;
  int a[100];
  int i;
  int c=1;
  long long k,m,ans;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  m=1000%a[0];
  k=1000/a[0];
  ans=1000;
  for(i=1;i<n;i++){
    if(a[i]>a[i-1]){
      ans=m+a[i]*k;
    }
    else if(a[i]<a[i-1]){
      k=ans/a[i];
      m=ans%a[i];
      c=0;
    }
  }
  printf("%lld",ans);
  return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	int N; cin >> N;
	vector<int> tmp(55556, 0), prime;
	for(int i = 0; i < tmp.size(); ++i) tmp[i] = i;
	tmp[0] = -1; tmp[1] = -1;

	int e = 2;
	while(e <= (int)sqrt(55555)){
		for(int i = e+1; i < tmp.size(); ++i){
			if(tmp[i] % e == 0) tmp[i] = -1;
		}
		for(int i = e+1; i < tmp.size(); ++i)
			if(tmp[i] != e && tmp[i] != -1){ e = i; break; }
	}

	for(int i = 0; i < tmp.size(); ++i){
		if(tmp[i] != -1 && tmp[i] % 5 == 1) prime.push_back(i);
	}

	cout << prime[0];
	for(int i = 1; i < N; ++i) cout << " " << prime[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void){
  long long int i,j,k,n,ans=0;
	scanf("%lld",&n);

  for(i=1;i*(i+1)<n;i++){
    if(n%i==0){
      j = n/i-1;
      ans+=j;
    }
  }

  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int W = scan.nextInt();
		int H = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int r = scan.nextInt();

		W = Math.abs(W);
		H = Math.abs(H);
		int a = Math.abs(x + r);
		int b = Math.abs(y + r);

		if (x <= 0 | y <= 0) {
			System.out.println("No");
		} else if(W >= a & H >= b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26140
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))

int main()
{
    int N,K;
    cin>>N>>K;
    int ans=1;
    for(int i=0;i<N;i++){
        ans=min(ans*2,ans+K);
    }
    cout<<ans;
    return 0;
}


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

int main() {
    int n;
    int h[101000];
    bool result = true;
    int pre = -999;

    cin >> n;

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

    for (int i = 0; i < n; i++) {
        if (pre <= (h[i] - 1)) {
            pre = h[i] - 1;
        }
        else if (pre <= h[i]) {
            pre = h[i];
        }
        else {
            result = false;
            break;
        }
    }

    cout << (result ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
import std.stdio;
import std.string;

bool isK(C)(C[] a) {
	if (a.length <= 1) return true;
	
	size_t l = 0, r = a.length - 1;

	while (l < r) {
		if (a[l] != a[r]) {
			return false;
		}
		++l;
		--r;
	}

	return true;
}

void main() {
	auto s = readln.chomp;

	if (s.isK && s[0.. $ / 2].isK && s[$ / 2 + 1..$].isK) {
		writeln("Yes");
	} else {
		writeln("No");
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, n, a[10000], min, max;
	long sum;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	
	min = a[0];
	max = a[0];
	sum = a[0];
	for (i = 1; i < n; i++) {
		min = (a[i] < min) ? a[i] : min;
		max = (max < a[i]) ? a[i] : max;
		sum += a[i];
	}
	
	printf("%d %d %ld\n", min, max, sum);
	
	return 0;
}

Measured memory_bytes: 640
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim sx As Integer = NextInt()
        Dim sy As Integer = NextInt()
        Dim tx As Integer = NextInt()
        Dim ty As Integer = NextInt()
        Dim start As Integer() = New Integer() {1, 1}
        Dim target As Integer() = New Integer() {tx - sx + start(0), ty - sy + start(1)}

        Dim visited(tx - sx + 2, ty - sy + 2) As Boolean
        Dim now As Integer() = start
        Dim dic As New Dictionary(Of Char, Integer())
        Dim ans As String = ""

        dic("U"c) = New Integer() {0, 1}
        dic("D"c) = New Integer() {0, -1}
        dic("L"c) = New Integer() {-1, 0}
        dic("R"c) = New Integer() {1, 0}

        For turn As Integer = 1 To 4
            Dim goal As Integer()
            If turn Mod 2 = 1 Then
                goal = target
            Else
                goal = start
            End If

            Do While now(0) <> goal(0) Or now(1) <> goal(1)
                Dim cnddt As New List(Of Integer)
                For Each k As Char In "UDLR"
                    Dim nxt As Integer() = New Integer() {now(0) + dic(k)(0), now(1) + dic(k)(1)}
                    If nxt(0) < 0 Or target(0) + 1 < nxt(0) Then
                    ElseIf nxt(1) < 0 Or target(1) + 1 < nxt(1) Then
                    ElseIf (nxt(0) = goal(0) And nxt(1) = goal(1)) Or Not visited(nxt(0), nxt(1)) Then
                        cnddt.Add((Diff(nxt, goal) - Diff(now, goal) + 1) * 1000 + Asc(k))
                    End If
                Next
                cnddt.Sort()
                Dim kk As Char = Chr(cnddt(0) Mod 1000)
                ans &= kk
                Dim nxxt As Integer() = New Integer() {now(0) + dic(kk)(0), now(1) + dic(kk)(1)}
                visited(nxxt(0), nxxt(1)) = True
                now = nxxt
            Loop
        Next
        WriteLine(ans)
    End Sub

    Function Diff(a As Integer(), b As Integer()) As Integer
        Return Math.Abs(a(0) - b(0)) + Math.Abs(a(1) - b(1))
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module


Measured memory_bytes: 43460
import std.algorithm,
       std.string,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  string[] n = readln.chomp.split("");

  if (n[0] == n[2]) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}


Measured memory_bytes: 256
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void YESNO(const bool cond)
{
	OUT(cond ? "YES" : "NO");
}
void YesNo(const bool cond)
{
	OUT(cond ? "Yes" : "No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
ll factorial(ll n)
{
	for (ll i = n - 1; i > 1; --i)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll ncr(const ll n, ll r)
{
	if (r * 2 > n) r = n - r;

	ll dividend = 1, divisor  = 1;

	for (ll i = 1; i <= r; ++i) {
		dividend *= n - i + 1;
		divisor *= i;
	}

	return dividend / divisor;
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool isprime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0) return false;
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll digsum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

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

void Main()
{
	inll n;
	vll a;
	REP(i, n)
	{
		inll a_;
		a.push_back(a_);
	}

	ll cnt = 0;
	FOR(i, 1, n)
	{
		if (a[i] == a[i - 1])
		{
			cnt++;
			a[i] = a[i - 1] + 1;

			if (a.size() - 1 >= i + 1 && a[i] == a[i + 1])
				a[i] = a[i + 1] + 1;
		}
	}
	
	return OUT(cnt);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fill(arr,c) memset(arr,c,sizeof(arr))
#define perm(r) next_permutation(all(r))
//it gives bool value ans permute the string lexoggraphically
#define sortdesc greater<int>()
#define ll long long int 
#define f(i,a) for(int i=0;i<a;i++)
#define fo(i,a) for(int i=1;i<=a;i++)
#define foo(i,x,n,c) for(ll i=x;i<n;i+=c)
#define foi(i,x,n,c) for(ll i=x;i>=n;i+=c)
#define fauto(i,m) for(auto i:m)
#define forall(a) for( auto itr=a.begin();itr!=a.end();itr++)
#define ld long double
#define in push_back
#define mll map<ll,ll>
#define mcl map<char,ll>
#define msl map<string,ll>
#define vi vector<int >
#define vl vector<ll >
#define vp vector< pair<int,int> >
#define vs vector <string> 
#define vc vector <char> 
#define o(a) cout<<a
#define os(a) cout<<a<<" "
#define en cout<<"\n";
#define testcase ll t ;cin>>t; while(t--)
#define ff first
#define ss second
#define pl pair<ll,ll>
#define pi pair<int,int>
#define all(a) (a).begin(), (a).end()

#define sz(a)  (a).size()
#define prec(n) fixed<<setprecision(n)
#define mp make_pair
#define bitcount  __builtin_popcountll
#define imin o("imin");en;
using namespace std;
bool comp(const pair<int,int> &a , const pair<int,int> &b){
    if(a.first == b.first)  return a.second < b.second;
     return a.first < b.first;
}
bool comps(const pair<int,int> &a , const pair<int,int> &b){
    if(a.second == b.second)  return a.first< b.first;
     return a.second < b.second;
}
//ll pi=acos(0.0)*2;
void fastio()
{
    	ios::sync_with_stdio(0);
cin.tie(0);

}
void inout()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);

     freopen("output.txt", "w", stdout);
     #endif
}
	
ll lcm(ll a,ll b)
{
	return (a*b)/__gcd(a,b);
}
int main()
{
	ld n;
cin>>n;
if(n==1)
o(0);
if(n==0)
o(1);

return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define lli long long int
#define MAX 1000000000
using namespace std;

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

    lli x;
    int ctr = 0;
    lli m = 100;
    cin>>x;
    while(m<x){
        m = m+(m*0.01);
        ctr++;
    }
    cout<<ctr;
    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double INF = 1e+9;
const double EPS = 1e-9;

//string型からint型に変換する
int s_to_i(string s){
    bool flag = false;
    int n = 0;
    for(unsigned int i=0 ; i < s.size() ; ++i ){
        if( i == 0 && s[i] == '-' ){
            flag = true;
        }else if( s[i] >= '0' && s[i] <= '9' ){
            n *= 10;
            n += s[i] - '0';
        }else{
            break;
        }
    }
    return (flag)? -n : n ;
}

// 文字列を半角スペース区切りで単語に分割する
// s = "This is a pen."
// vector<string> v = split_words(s); // v = {"This", "is", "a", "pen."}
vector<string> split_words(string s){
    bool flag = false;
    vector<string> vs;
    string str;
    s.push_back(' ');
    for(int i=0 ; i < s.size() ; i++ ){
        char c = s[i];
        if( flag == false ){
            if( c != ' ' ){
                flag = true;
                str.clear();
                str.push_back( c );
            }
        }else{
            if( c != ' ' ){
                str.push_back( c );
            }
            if( c == ' ' ){
                flag = false;
                vs.push_back( str );
                str.clear();
            }
        }
    }
    return vs;
}

vector<int> to_vint(vector<string> vs){
	vector<int> vi;
	for(int i=0 ; i < vs.size() ; i++ ){
		vi.push_back( s_to_i( vs[i] ) );
	}
	return vi;
}

int main(){
	string s;
	while( getline(cin,s) ){
		vector<string> vs = split_words(s);
		vector<int> v = to_vint( vs );
		int width = v[0];
		int N = v.size() - 1;
		vector<int> v_;
		for(int i=1 ; i < v.size() ; i++ ){
			v_.push_back( v[i] );
		}
		v = v_;
		
		// dp[S][i] := 右端のロールケーキは i， 集合Sのロールケーキを並べた.
		double dp[1<<12][12];
		// 初期化
		for(int i=0 ; i < (1<<N) ; i++ ){
			fill( dp[i] , dp[i]+N , INF );
		}
		for(int i=0 ; i < N ; i++ ){
			dp[1<<i][i] = 2.0 * v[i];
		}
		for(int s=1 ; s < (1<<N) ; s++ ){
			for(int j=0 ; j < N ; j++ ){
				if( (s >> j & 1) == 0 ) continue;
				
				for(int i=0 ; i < N ; i++ ){
					if( (s >> i & 1) == 0 ){
						double d = 2.0 * sqrt(v[j] * v[i]) - v[j] + v[i];
						dp[s|1<<i][i] = min( dp[s|1<<i][i], dp[s][j] + d );
					}
				}
			}
		}
		double ans = INF;
		for(int i=0 ; i < N ; i++ ){
			ans = min( ans , dp[(1<<N)-1][i] );
		}
		cout << ((ans < width + EPS)? "OK" : "NA" ) << endl;
	}
}

Measured memory_bytes: 1288
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    d = sum(B) - sum(A)

    if d < 0:
        print('No')
        return

    C = [a - b for a, b in zip(A, B)]
    m = sum(((abs(x) + 1) // 2 for x in C if x < 0))

    # print(d, m)

    if abs(m) > d:
        print('No')
        return

    # assert d * 2 + sum((x for x in C if x > 0)) + m == d
    print('Yes')


main()


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

long long mod = 1e9 + 7;

long long modpow(long long x, long long n) {
    x = x%mod;
    if(n == 0){
        return 1;
    }
    else if(n%2 == 1){
        return(x*modpow(x, n-1))%mod;
    }
    else{
        return modpow((x*x)%mod, n/2)%mod;
    }
}

long long comb(long long n, long long k){
    long long x = 1;

    for(long long i = n-k+1; i <= n; i++){
        x = x*i;
        x = x%mod;
    }
    long long y = 1;
    for(long long i = 1; i <= k; i++){
        y = y*i;
        y = y%mod;
    }

    y = modpow(y, mod-2);

    return x*y%mod;
}

int main(){
    long long n, k;
    cin >> n >> k;

    for(long long i = 1; i <= k; i++){
        long long blue = comb(k - 1, i - 1);
        long long red = comb(n - k + 1, i);
        printf("%lld\n", blue*red%mod);
    }
    return 0;
}

Measured memory_bytes: 3688
# ABC089 C - March
N = int(input())
S = [input() for i in range(N)]

x = [0,0,0,0,0,0,1,1,1,2]
y = [1,1,1,2,2,3,2,2,3,3]
z = [2,3,4,3,4,4,3,4,4,4]

m = 0
a = 0
r = 0
c = 0
h = 0

for s in S:
    if s[0:1] == 'M':
        m += 1
    if s[0:1] == 'A':
        a += 1
    if s[0:1] == 'R':
        r += 1
    if s[0:1] == 'C':
        c += 1
    if s[0:1] == 'H':
        h += 1

ans = 0
D = []
D.append(m)
D.append(a)
D.append(r)
D.append(c)
D.append(h)

for d in range(10):
    ans += D[x[d]]*D[y[d]]*D[z[d]]
print(ans)



Measured memory_bytes: 10032
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int cnt[111],n,mx;
void nosol(){puts("Impossible");exit(0);}
int main()
{
	get1(n);
	for(int i=1,x;i<=n;i++)
	{
		get1(x);
		cnt[x]++;
		mx=max(mx,x);
	}
	for(int i=mx;i>mx/2;i--)
	{
		if(cnt[i]<2)nosol();
		cnt[i]-=2;
	}
	if(mx%2==0)
	{
		if(cnt[mx/2]<1)nosol();
		cnt[mx/2]-=1;
	}
	
	int mx2=(mx+1)/2+1;
	for(int i=0;i<mx2;i++)if(cnt[i])nosol();
	
	puts("Possible");
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define mem(a, b) memset(a, (b), sizeof(a))
#define fore(i,a) for(int i=0;i<a;i++)
#define fore1(i,j,a) for(int i=j;i<a;i++)
#define print(ar) for(int i=0;i<ar.size();i++)cout<<ar[i]<<" ";
#define END cout<<'\n'
const double pi=acos(-1.0);
 
typedef pair<int, int> PII;
 
typedef vector<long long> VI;
 
typedef vector<string> VS;
 
typedef vector<PII> VII;
 
typedef vector<VI> VVI;
 
typedef map<int,int> MPII;
 
typedef set<int> SETI;
 
typedef multiset<int> MSETI;
 
typedef long int li;
 
typedef unsigned long int uli;
 
typedef long long int ll;
 
typedef unsigned long long int  ull;
ll fastexp (ll a, ll b, ll n) {
  ll res = 1;
  while (b) {
      if (b & 1) res = res*a%n;
      a = a*a%n;
      b >>= 1;
  }
  return res;
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
 {  fast();
 int n;
     cin>>n;
     set<string> s;
     while(n--){
         string k;
         cin>>k;
         s.insert(k);
     }
     cout<<s.size()<<endl;
     
 }

Measured memory_bytes: 19204
var input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\s/)[0];
var max = 0;
var startIndex = 0;
var tailIndex = 0;
while(startIndex < input.length && input.length - startIndex > max) {
  	tailIndex = startIndex
	while(tailIndex < input.length) {
      if(!/A|C|G|T/.test(input[tailIndex])) {
        break;
      }
      tailIndex+=1
    }
  	var n = tailIndex - startIndex;
  	if(n > max) max = n;
	  startIndex+=1;
}

console.log(max)

Measured memory_bytes: 7372
#include <stdio.h>

int main(void) {
  int i, j, k, m, n;
  scanf("%d", &n);
  m = (n * (n - 1)) / 2;
  int s[n + 1], num[n + 1], l[n + 1], now = 1;
  for(i = 0; i <= n; ++i) s[i] = 0, num[i] = i;
  for(i = 0; i < m; ++i) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if(c > d) s[a] += 3;
    else if(d > c) s[b] += 3;
    else s[a]++, s[b]++;
  }
  for(i = 1; i <= n; ++i) {
    for(j = i + 1; j <= n; ++j) {
      if(s[i] < s[j]) {
        int t;
        t = s[i], s[i] = s[j], s[j] = t;
        t = num[i], num[i] = num[j], num[j] = t;
      }
    }
  }
  l[1] = 1;
  for(i = 2; i <= n; ++i) {
    if(s[i] == s[i - 1]) l[i] = now;
    else now = i, l[i] = i;
  }
  for(i = 1; i <= n; ++i) {
    for(j = i + 1; j <= n; ++j) {
      if(num[i] > num[j]) {
        int t;
        t = l[i], l[i] = l[j], l[j] = t;
        t = num[i], num[i] = num[j], num[j] = t;
      }
    }
  }
  for(i = 1; i <= n; ++i) printf("%d\n", l[i]);
  return 0;
}


Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
int main(){
    ll a, b, sum, bef=-1;
    cin>>a>>b;
    ll arr[a];
    for (int i=0; i<a; i++) cin>>arr[i];
    for (int i=0; i<a-b; i++){
        if (arr[i]<arr[i+b]) cout<<"Yes\n";
        else cout<<"No\n";
    }
}

Measured memory_bytes: 5192
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

int main() {
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    for(int i = 0; i < s.size(); i++) {
        int c = s[i] - 'A';
        c = (c + n) % 26;
        s[i] = 'A' + c;
    }
    cout << s << endl;
    return 0;
}



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

int main(void){
	int num[6][6] = {
		{ 0, 3, 5, 2, 4, 0 },
		{ 4, 0, 1, 6, 0, 3 },
		{ 2, 6, 0, 0, 1, 5 },
		{ 5, 1, 0, 0, 6, 2 },
		{ 3, 0, 6, 1, 0, 4 },
		{ 0, 4, 2, 5, 3, 0 },
	};
	int n[6], q, u,f;

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

	cin >> q;

	for (int i = 0; i < q; i++){
		cin >> u >> f;

		for (int i = 0; i < 6; i++){
			if (n[i] == u) u = i;
			else if (n[i] == f) f = i;
		}

		cout << n[num[u][f]-1] << "\n";
	}

	return 0;
}

Measured memory_bytes: 1160
var
i,j,k,N:Longint;
S:String;
R,G,B,ans:int64;
begin
readln(N);
readln(S);
for i:=1 to N do if S[i]='R'then inc(R)else if S[i]='B'then inc(B)else inc(G);
ans:=R*G*B;
for i:=1 to N do for j:=i+2 to N do if(j-i)mod 2=0 then begin
if(S[i]<>S[j])and(S[i]<>S[(i+j)div 2])and(S[j]<>S[(i+j)div 2])then dec(ans);
end;
writeln(ans);
end.

Measured memory_bytes: 1380
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    s = [input() for _ in range(N)]
    M = ii()
    t = [input() for _ in range(M)]
    dic = {}
    for v in s:
        if not v in dic:
            dic[v] = 0
        dic[v] += 1
    for v in t:
        if not v in dic:
            dic[v] = 0
        dic[v] -= 1

    print(max(0, max(dic.values())))

if __name__ == '__main__':
    main()

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

int main() {
  int N;
  cin >> N;
  for(int i = 0; i < 10; i++)
    if (N == 0){
      cout << 0 << endl;
      break;
    }
    else if((i + 1) * 1000 >= N){
      cout << (i + 1) * 1000 - N << endl;
      break;
    }
}

Measured memory_bytes: 3540
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.AbstractCollection;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.AbstractQueue;
import java.util.ArrayList;

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

    static class SummerVacation {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            PriorityQueue<Pair> pq = new PriorityQueue<>(n, (o1, o2) -> {
                return Integer.compare(o2.money, o1.money);
            });

            List<List<Pair>> list = new ArrayList<>();
            for (int i = 0; i <= m; i++) {
                list.add(new ArrayList<>());
            }

            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                int b = in.nextInt();
                if (a <= m) {
                    (list.get(a)).add(new Pair(a, b));
                }
            }

            long result = 0;
            for (int i = 1; i <= m; i++) {
                pq.addAll(list.get(i));
                if (!pq.isEmpty()) {
                    Pair max = pq.poll();
                    result += max.money;
                }
            }

            out.println(result);

        }

        class Pair {
            public final Integer days;
            public final Integer money;

            public Pair(Integer days, Integer money) {
                this.days = days;
                this.money = money;
            }

        }

    }
}



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

using namespace std;

typedef long long ll;

const int N = 222;
const int MASK = 61;

int n;
string str;
ll a[N];
ll tmask[MASK];

int main() {
    int tc; cin >> tc;
    while (tc--) {
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        cin >> str; str = " " + str;
        memset(tmask, 0, sizeof(tmask));
        int res = 0;
        for (int i = n; i >= 1; i--) {
            if (str[i] == '0') {
                for (int j = 60; j >= 0; j--) if (a[i] >> j & 1ll) {
                    if (!tmask[j]) {
                        tmask[j] = a[i];
                        break;
                    }
                    a[i] ^= tmask[j];
                }
            } else {
                for (int j = 60; j >= 0; j--) if (a[i] >> j & 1ll)
                    a[i] ^= tmask[j];
                if (a[i]) {
                    res = 1;
                    break;
                }
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define haha(i,n) for(ll i=0;i<n;i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve()
{
   ll a,b,c;
  cin >> a>>b>>c;
  cout <<c<<" "<<a<<" "<<b;
}
 
int main()
{
      ll t;
      t=1;
      //cin >>t;
      while(t--){
            solve();
      }
}

Measured memory_bytes: 256
tmp = list(map(int, input().split()))
a, b ,c,x,y = tmp[0],tmp[1],tmp[2],tmp[3],tmp[4]
if x >= y:
    s1 = a * x + b * y
    s2 = x * c * 2
    s3 = y * c * 2 + (x-y) * a
    print(min(s1,s2,s3))
else:
    s1 = a * x + b * y
    s2 = y * c * 2
    s3 = x * c * 2 + (y-x) * b
    print(min(s1,s2,s3))


Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
  char s[4];
  int i, j;
  int count = 0;
  for (i = 0; i < 4; i++)
  {
    scanf("%c", &s[i]);
  }
  for (i = 0; i < 3; i++)
  {
    for (j = i + 1; j < 4; j++)
    {
      if (s[i] == s[j])
      {
        count++;
      }
    }
  }
  if (count == 2)
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
 
using namespace std;
 


int main()
{
    

    int n;

    cin >> n;

    if (n % 1000 == 0) {

        cout << "0";
    }
    else {
        cout << 1000 - n % 1000;
    }

      
   
 
}

Measured memory_bytes: 3632
if __name__ == "__main__":
    nset = int(input())

    for i in range(0, nset):
        sa = input()
        sb = input()
        a = int(sa)
        b = int(sb)
        c = a + b

        if len(sa) > 80 or len(sb) > 80 or len(str(c)) > 80:
            print("overflow")
        else:
            print(c)

Measured memory_bytes: 6720
// ConsoleApplication2.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    
    double d; //距離
    double t; //待ち合わせ時間
    double s; //分速

    cin >> d >> t >> s;

    double ds = d / s; //距離割る分速

    if ( ds > t) {

        cout << "No";

    } else {

        cout << "Yes";
    }
    

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3152
#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() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  string t;
  rep(qi, q) {
    int ty;
    cin >> ty;
    if (ty == 1) {
      swap(s, t);
    } else {
      int f;
      char c;
      cin >> f >> c;
      if ( f == 1 ) {
        t += c;
      } else {
        s += c;
      }
    }
  }
  
  reverse(t.begin(), t.end());
  t += s;
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 1128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int mod = 998244353 ;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 1e5 + 5 ;
int n ;
int a[maxn][5] ;
int dp[maxn][5] ;
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n ;
    rep(i,0,n-1)
     rep(j,0,2)
       cin >> a[i][j] ;
    rep(i,0,n-1) rep(j,0,2) dp[i][j] = -inf ;
    rep(j,0,2) dp[0][j] = a[0][j] ;
    rep(i,1,n-1)
    {
       rep(j,0,2)
       {
           rep(k,0,2)
           {
               if(k == j) continue ;
               dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i][j]) ;
           }
       }
    }
    int res = -63 ;
    rep(j,0,2)
     res = max(res, dp[n-1][j]);
    cout << res << "\n" ;
    return 0 ;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i )
typedef std::pair<int,int> pint;

using namespace std;
typedef long long ll;

int main(){
    int N; cin >> N;
    vector<int> list(N);
    ll money = 1000;
    ll stock = 0;
    rep (i,N){
        cin >> list[i];
    }
    rep (i,N-1){
        if(list[i] < list[i+1]){
            stock = money / list[i];
            money = money - list[i] * stock + list[i+1] * stock;
            stock = 0;
        }
    }
    cout << money << endl;
    return 0;
}

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

int main() {
    int n, m, c; cin >> n >> m >> c;
    vector<int> B(m);
    for (int i = 0; i < m; i++) {
        cin >> B[i];
    }
    vector<vector<int>> A(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int x = 0;
        for (int j = 0; j < m; j++) {
            if ((A[i][j] >= 0 && B[j] >= 0) || (A[i][j] < 0 && B[j] < 0)) {
                x += abs(A[i][j] * B[j]);
            } else {
                x -= abs(A[i][j] * B[j]);
            }
        }
        if (x + c > 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    struct P
    {
        public int num;
        public int h;
        public int w;
        public P(int num,int h,int w)
        {
            this.num = num;
            this.h = h;
            this.w = w;
        }
    }
    static void Main(string[] args)
    {
        var hwd = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ps = new P[hwd[0] * hwd[1]+1];
        for (var i = 0; i < hwd[0]; i++)
        {
            var input = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
            for (var j = 0; j < hwd[1]; j++)
                ps[input[j]] = new P(input[j], i, j);
        }
        var im = new long[hwd[0] * hwd[1] + 1];
        for (var i = hwd[2] + 1; i <= hwd[0] * hwd[1]; i++)
            im[i] = im[i - hwd[2]] + GetDif(ps[i], ps[i - hwd[2]]);
        var que = ToInt32(ReadLine());
        var res = new long[que];
        for(var i = 0; i < que; i++)
        {
            var lr = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
            res[i] = im[lr[1]] - im[lr[0]];
        }
        WriteLine(string.Join("\n", res));
    }
    private static int GetDif(P fr,P to)
    {
        return Abs(fr.h - to.h) + Abs(fr.w - to.w);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 21944
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;

ll nod[10000000+100]={0};

void NOD(ll n)
{
    for(ll i=1; i<=n; i++)
    {
        for(ll j=i; j<=n; j+=i)
            nod[j]++;
    }
}

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

    NOD(N);

    ll sum = 0;
    for (ll i = 1; i <= N; i++)
    {
        sum += i * nod[i];
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 81756
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c ,n, sum, A[500010], B[500000],rui[500000],  dp[5000];
str S[100],T;bool check = true;	vector<ll> v;



int main() {
	//Code Line

cin >> n;
for(int i = 0;i < n;i++){
cin >> S[i] >> A[i];
}
cin >> T;

for(int i = 0;i < n;i++){
if(S[i] == T){
	a = i;
	break;
}
}

for(int i = a+1;i < n;i++){
sum += A[i];
}

cout << sum << endl;
	return 0;
}


Measured memory_bytes: 2304
#include <iostream>

using namespace std;

int main(){

  int N, ans = 0;
  int A[20], B[20], C[20];

  cin >> N;

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

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

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

  for(int i = 0; i < N; i++){
	ans += B[A[i] - 1];
	if(i != 0){
	  if(A[i-1] + 1 == A[i]){
		ans += C[A[i-1] - 1];
	  }
	}
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,temp,a[105],ans;
void selection()
{
    for(int i=0;i<n-1;i++)
    {
        int minn=i;
        for(int j=i+1;j<n;j++)
        {
            if(a[j]<a[minn]) minn=j;
        }
        if(a[minn]<a[i])
        {
            temp=a[minn];
            a[minn]=a[i];
            a[i]=temp;
            ans++;
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    selection();
    for(int i=0;i<n-1;i++)
        cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
    cout<<ans<<endl;
    return 0;
}


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

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

using namespace std;

int main() {
  int n, m, x;
  std::cin >> n >> m >> x;
  std::vector<int> a(m);
  rep(i, m) std::cin >> a[i];

  int64_t x_to_n = 0, x_to_0 = 0;
  for (int i = x; i < n; ++i) {
    rep(j, m) {
      if (i == a[j]) {
        x_to_n++;
      }
    }
  }

  for (int i = x; i > 0; --i) {
    rep(j, m) {
      if (i == a[j]) {
        x_to_0++;
      }
    }
  }

  std::cout << min(x_to_n, x_to_0) << std::endl;
  return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define testing 1
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9
#define oo (ll)1e18
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
template <typename T> void maxself(T& a, T b) {
	a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
	a = min(a, b);
}
#define MAXN (int)1e5 + 5 
#if !testing
	#define cerr if(0)cout
#endif

ll A[MAXN],dp[MAXN][3];
char op[MAXN];

int32_t main() {
	IAMSPEED
	// set testing to 0 when submitting to judge
	FOR(i,0,MAXN-1) FOR(j,0,2) dp[i][j] = -oo;
	int n; cin >> n;
	cin >> A[1];
	FOR(i,2,n) {
		cin >> op[i] >> A[i];
	}
	dp[1][0] = A[1];
	//dp[1][1] = A[1];
	FOR(i,2,n) {
		if (op[i]=='-') A[i]*=-1;
		maxself(dp[i][0],dp[i-1][0]+A[i]);
		maxself(dp[i][1],dp[i-1][1]-A[i]);
		maxself(dp[i][2],dp[i-1][2]+A[i]);
		if (op[i]=='-') {
			maxself(dp[i][1],dp[i-1][0]+A[i]);
			maxself(dp[i][2],dp[i-1][1]-A[i]);
		}
		maxself(dp[i][1],dp[i-1][2]+A[i]);
	}
	cout << max({dp[n][0],dp[n][1],dp[n][2]});

}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	long long a,b,c,d,x,y;
  	cin >> a >> b >> c >> d;
  	
  	cout << max({a*c,b*c,a*d,b*d}) << endl;
  
  
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
	int K, S;
	cin >> K >> S;
	int ans = 0;
	for (int i = 0; i <= K; ++i) {
		for (int j = 0; j <= K; ++j) {
			int k = S - i - j;
			if (0 <= k && k <= K) {
				++ans;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int L = sc.nextInt();

		sc.close();

		out.println(new BigDecimal(Math.pow(L / 3.0, 3)).toPlainString());

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 21588
#include<iostream>
#include<functional>
#include<vector>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
using ll =long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(i) i.begin(),i.end()
template<typename T=ll>
using v =vector<T>;
template<typename T=ll>
using vv = vector<v<T>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
const ll INF = (ll)1e9;
const ll MOD = INF+7;
template<typename T> T chmin(T &a,T b){a=min(a,b);}
template<typename T> T chmax(T &a,T b){a=max(a,b);}

void a(){
    string s,t; 
    cin >> s >> t;
    if(s==t.substr(t.size()-1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

void b(){
    ll a,b,c,k; 
    cin >> a >> b >> c >> k;
    ll count=0;

  	rep(i,a){
      	if(k<=0) break;
        k--;
        count++;
    }
  
    rep(i,b){
      	if(k<=0) break;
        k--;
    }
  
    rep(i,c){
      	if(k<=0) break;
        k--;
        count--;
    }

  	cout << count << endl;

}
void c(){}
void d(){}

int main(){
    b();
    return 0;
}


Measured memory_bytes: 3600
n, m, x = map(int, input().split())
r = list(map(int, input().split()))

c1 = 0
for i in range(x, n+1):
    if i in r:
        c1 += 1

c2 = 0
for i in range(x, 0, -1):
    if i in r:
        c2 += 1

print(min(c1, c2))


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
	int p[100],Score[30]={};
	int n,s;
	int call,rank;
	while(scanf("%d,%d",&n,&s),n|s){
		p[n-1]=s;
		Score[s-1]++;
	}
	
	while(cin>>call){
		rank=0;
		for(int i=29;i>=p[call-1]-1;--i){
			if(Score[i]){
				++rank;
			}
		}
		cout<<rank<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1244
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
    a[i] += a[i - 1]
for i in range(1, m + 1):
    b[i] += b[i - 1]
i, j, z = 0, m, 0
while i <= n and a[i] <= k:
    while b[j] > k - a[i]:
        j -= 1
    z = max(z, i + j)
    i += 1
print(str(z))

Measured memory_bytes: 119172
#include<bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define mod 1000000007
#define bitcount __builtin_popcountll
#define ll long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define mp make_pair
ll h[100005];
ll a,b,n;
ll check(ll val1, ll val2)
{
	ll l=0,r=val2,ans=1e14;
	while(l<=r)
	{
		ll mid=(l+r)/2;
		ll temp=a*mid+b*(val2-mid);
		if(temp>=val1)
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	return ans;
}
int main()
{
	ll i,j,k;
	slld(n);
	slld(a);
	slld(b);
	for(i=1;i<=n;i++)
		slld(h[i]);
	ll l=1,r=1e9,ans=1e18;
	while(l<=r)
	{
		ll mid=(l+r)/2;
		ll temp=0;
		for(i=1;i<=n;i++){
			temp+=check(h[i],mid);
		}
		if(temp>mid)
		{
			l=mid+1;
		}
		else
		{
			ans=mid;
			r=mid-1;
		}
	}
	printf("%lld\n",ans );
	return 0;
}

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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;

int main() {
	Boost();

	string s; cin >> s;
	int n = (int)s.size();

	if (s[0] == '0' || s[n - 1] == '1') {
		cout << -1;
		return 0;
	}
	for (int i = 0; i < n - 1; ++i) {
		int j = n - i - 2;
		if (s[i] != s[j]) {
			cout << -1;
			return 0;
		}
	}

	int lastNode = 1;
	for (int i = 1; i < n; ++i) {
		int now = i + 1;
		cout << now << " " << lastNode << "\n";
		if (s[i - 1] == '1') {
			lastNode = now;
		}
	}
	return 0;
}

Measured memory_bytes: 1616
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i,a,b) for(register int i=a;i<=b;++i)
#define repd(i,a,b) for(register int i=a;i>=b;--i)
#define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define ce(i,r) i==r?'\n':' '
#define pb push_back 
#define all(x) x.begin(),x.end()
#define fi first
#define se second
//#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef long long ll;

int main(){
	int n,x,t;
	si(n),si(x),si(t);
	int add = 0;
	if(n % x)
		add = 1;
	cout<<((n / x) + add) * t<<endl;
	return 0;
}

Measured memory_bytes: 3760