akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll h, w;
    cin >> h >> w;
    ll ans = (h * w + 1) / 2;
    if (w == 1 || h == 1)
    {
        cout << 1 << endl;
        return 0;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e6+69, INF=2e9+6969;

int qq;

int main()
{
	string s;
	cin >> s;
	for(auto e: s) printf("x");
	puts("");
	return 0;
}


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

int main() {
	char c;
  	cin >> c;
  
  	if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    	cout << "vowel" << endl; 
    }else {
    	cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

int main(void) {
  int n, k;
  cin >> n >> k;
  string s;
  k--;
  cin >> s;
  if (s[k] == 'A')
    s[k] = 'a';
  else if(s[k] == 'B')
    s[k] = 'b';
  else
    s[k] = 'c';

  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline int max(const int x,const int y){return x>y?x:y;}
int main(void)
{
  int ten[21][21]={{0}},N;long count=0;long double A;
  if(!scanf("%d",&N))return -1;
  rep(i,N)
  {
    if(!scanf("%Lf",&A))return -1;
    long x=1l*1e9*A+0.1;int even=0,five=0;
    while(!(x&1)&&even<=18){x/=2,even++;}
    while(x%5==0&&five<=18){x/=5,five++;}
    for(int j=max(0,18-even);j<=20;j++)for(int k=max(0,18-five);k<=20;k++)count+=ten[j][k];
    ten[even][five]++;
  }
  return printf("%ld\n",count),0;
}

Measured memory_bytes: 1716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

ll i,j;

int main(){
    int n;cin>>n;
    
    map<string,int> S;
    vector<string> s(n);

    for(i=0;i<n;i++){
        cin>>s[i];
        S[s[i]]++;
    }
    sort(s.begin(),s.end());

    int maxi=0;
    for(i=0;i<n;i++){
        maxi=max(maxi,S[s[i]]);
    }

    vector<string> ans;
    string distin="A";
    for(i=0;i<n;i++){
        if(S[s[i]]==maxi){
            if(distin!=s[i]){
                ans.push_back(s[i]);
                distin=s[i];
            }
        }
    }

    for(i=0;i<ans.size();i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

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

using namespace std;

vector<int>v(200005);

int main()
{
    int n;
    cin>>n;
    int f=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        if(v[i]==1)f=1;
    }
   if(!f){cout<<"-1"<<endl;return 0;}
   int ans=0,c=1;
   for(int i=0;i<n;i++){
    if(v[i]==c){
        ++ans;
        c+=1;
    }
   }
   cout<<n-ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int arr[100010],n,k;
int dp[100010];
int f(int pos){
	if(pos>=n-1)return 0;
	int &ret=dp[pos];
	if(ret^-1)return ret;
	ret=1000000010;
	for(int i=1;i<=k && pos+i<n;i++)ret=min(ret,f(pos+i)+abs(arr[pos]-arr[pos+i]));
		return ret;
}

int main(int argc, char const *argv[])
{
	memset(dp,-1,sizeof dp);
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>arr[i];
		cout<<f(0)<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>

using namespace std;


int main(){
    long long A, B; cin >> A >> B;
    int K; cin >> K;

    for (int i = 0; i < K; i++){
        if (i % 2 == 0){
            A = A / 2;
            B = A + B;
        }else{
            B = B / 2;
            A = A + B;
        }
    }
    
    cout << A << " " << B << endl;

    return 0;
}

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



int main(){
    int n;
    cin >> n;
    ll arr[n];
    for(int i=0; i<n; i++) cin >> arr[i];

    ll cntr = 0;
    int orta_index;
    for(int i=0; i<n; i++) cntr+=arr[i];
    ll top1 = 0,top2 = 0 ;
    for(int i=0; i<n; i++){
			if(2*top1< cntr)
			top1+=arr[i];
    }
    for(int i=0; i<n; i++){
			if(2*top2< cntr)
			top2+=arr[n-i-1];
    }
    cout<<min(abs(cntr-2*top1),abs(cntr-2*top2));


    return 0;
}

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

using namespace std;

typedef long long ll;

#define INF 2000000000
#define SIZE 1000000
#define pb push_back
#define showint(x) cerr<<#x<<" is "<<x<<endl;
#define showarr(x,n) for(int I=0;I<n;I++) {cerr<<#x<<"["<<I<<"]"<<" is "<<x[I]<<endl;}
//#define fin cin

int main()
{
  ifstream fin("input.txt",ios::in);
	ios_base::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
  cout<<setprecision(10);
  cout<<fixed;
  int n;
  cin>>n;
  ll suma=0;
  ll sumb=0;
  ll a[n];
  ll b[n];
  ll c[n];
  ll k=0;
  ll sumk=0;
  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;i++)
  {
    suma+=a[i];
    sumb+=b[i];
    c[i]=a[i]-b[i];
    if(a[i]<b[i])
    {
      k++;
      sumk+=c[i];
    }
  }
  sumk*=-1;
  if(suma<sumb) return cout<<-1,0;
  sort(c,c+n);
  //cout<<c[2];
  for(int i=n-1;i>-1;i--)
  {
    if(sumk>0)
    {
      sumk-=c[i];
      k++;
    }else
    {
      break;
    }
  }
  cout<<k;


}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using ll = long long;

using namespace std;

ll mod=1e9+7;


int main() {
	int h,w;
	cin>>h>>w;
	vector<vector<char>>map(h,vector<char>(w));
	int ans=h*w-2;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>map[i][j];
			if(map[i][j]=='#'){
				ans--;
			}
		}
	}
	int dx[]={1,0,-1,0};
	int dy[]={0,1,0,-1};
	queue<pair<pair<int,int>,int>>todo;
	todo.push(pair<pair<int,int>,int>(pair<int,int>(0,0),0));
	bool ok=false;
	while(todo.empty()!=1){
		auto tmp=todo.front();
		todo.pop();
		int x=tmp.first.first;
		int y=tmp.first.second;
		int depth=tmp.second;
		bool flag=false;
		for(int j=0;j<4;j++){
			int nx=x+dx[j];
			int ny=y+dy[j];
			if(nx<0||nx>=h||ny<0||ny>=w)continue;
			if(nx==h-1&&ny==w-1){
				ok=true;
				ans-=depth;
				flag=true;
				break;
			}
			if(map[nx][ny]!='#'){
				todo.push(pair<pair<int,int>,int>(pair<int,int>(nx,ny),depth+1));
				map[nx][ny]='#';
			}
		}
		if(flag)break;
	}
	if(!ok)ans=-1;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  
  ll diff = min(b, d) -max(a, c);
  
  cout << max(ll(0), diff) << "\n";

}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

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

  vector<long long> H(n);
  for (int i = 0; i < n; i++) {
    int h;
    scanf("%d", &h);
    H[i] = h;
  }
  
  if (n <= k) {
    cout << 0 << endl;
    return 0;
  }

  sort(H.begin(), H.end(), greater<long long>());
  auto head = H.begin() + k;
  long long sum = accumulate(head, H.end(), (long long) 0);

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


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;



int main(){
	int N;
	cin>>N;
	vector<int> a(N);
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	int ans=0;
	for(int i=0;i<N;i++){
		if(i==N-1)ans+=a[i]/2;
		else ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,k,v[100],ans;


signed main() {
    cin >> n >> k;
    rep(i,n) cin >> v[i];
    rep(i,k+1) {
        rep(j,k-i+1) {
            rep(x,k-i-j+1) {
                int z=0,sum=0;
                vector<int> vv;
                rep(l,min(i,n)) sum += v[z],vv.pb(v[z++]);
                z = n-1;
                rep(l,min(j,n-i)) sum += v[z], vv.pb(v[z--]);
                sort(all(vv));
                rep(l,min(i+j,min(n,max(x,k-n)))) if (vv[l] < 0) sum -= vv[l];
                ans = max(ans,sum);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

namespace util {
    template<typename T >
    void print_vector(vector<T> &v) {
        for (auto it = v.begin(); it != v.end(); it++) {
            cout << *it;
            if (it + 1 != v.end())
                cout << " ";
        }
        cout << endl;
    }
}

namespace {
    void insertion_sort(vector<int> &a, int g, int &count) {
        for (int i = g; i < a.size(); i++) {
            int v = a[i];
            int j = i - g;
            while (j >= 0 && a[j] > v) {
                a[j+g] = a[j];
                j = j - g;
                count++;
            }
            a[j+g] = v;
        }
    }

    vector<int> shell_sort(vector<int> &a, int &count) {
        vector<int> gs;
        int g = 1;
        while (a.size() >= g) {
            gs.push_back(g);
            g = 3 * g + 1;
        }

        reverse(gs.begin(), gs.end());

        for (int _g : gs) {
            insertion_sort(a, _g, count);
        }

        return gs;
    }
}

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

    vector<int> v;
    for (int i = 0; i < n; i++) {
        int in;
        cin >> in;
        v.push_back(in);
    }

    int count = 0;

    vector<int> gs = shell_sort(v, count);

    cout << gs.size() << endl;
    util::print_vector(gs);
    cout << count << endl;
    for(int i : v) {
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 7256
#include <iostream>
#include<vector>
using namespace std;
#define rep(i,x) for(int i=1; i<=(x); i++)

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

  int room[5][4][11];
  rep(i,4) rep(j,3) rep(k,10) room[i][j][k] = 0;
  rep(i,n){
    int b,f,r,v;
    cin >> b >> f >> r >> v;
    room[b][f][r] += v;
  }

  rep(i,4){
    rep(j,3){
      rep(k,10){
        cout << " " << room[i][j][k];
      }
      cout << endl;
    }
    if(i<4){
      rep(m,20) cout << "#";
      cout << endl;
    }
  }

  return 0;
}
  

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

vector<ll> ans(100000, -1);
vector<ll> to[100000];
vector<bool> reach(100000, false);
queue<ll> q;

int main(void){
  ll n, m;
  cin >> n >> m;
  REP(i, m){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    to[a].emplace_back(b);
    to[b].emplace_back(a);
  }

  q.push(0);
  ans[0] = 0;
  while(!q.empty()){
    ll v = q.front();
    q.pop();
    if(reach[v]) continue;
    reach[v] = true;
    for(ll u : to[v]){
    if(ans[u] != -1) continue; 
      ans[u] = v+1;
      q.push(u);
    }
  }
  REP(i, n){
    if(ans[i] == -1){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  REP(i, n-1) cout << ans[i+1] << endl;
  return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n,l; cin >> n >> l;
  vector<int> taste(n);
  for(int i = 1;i<=n;i++) taste[i-1] = l+i-1;
  int max = 0;
  for(int i = 1;i<=n;i++) max+=taste[i-1];

  int ans = INF;
  for(int i = 1;i<=n;i++){
    int t = max-taste[i-1];
    if(abs(max-t) < abs(ans-max)) ans = t;
  }

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


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<cassert>
 
struct Meirei{
    std::string mei;
    std::string str;
};

struct Node{
	Node(){
		umu=false;
		a=NULL;
		c=NULL;
		g=NULL;
		t=NULL;
	}
	~Node(){
		if(a)delete a;
		if(c)delete c;
		if(g)delete g;
		if(t)delete t;
//		std::cout << "a::" << a << ",g::" << g << ",c::" << c << ",t::" << t << std::endl;
	}
	bool umu;
	Node* a,*c,*g,*t;//?????°???????????°????????????????????????????????§?????????????????°????????????
};

class Tree
{
public:
	Tree(){
		m_root=new Node();
	}
	~Tree(){
		delete m_root;
	}
	void insert(std::string moji);
	bool find(std::string moji);
	
private:
	Node* m_root;
};

void Tree::insert(std::string moji)
{
//	m_root=new Node();
	Node* node = m_root;
	for(int i =0; i < moji.size(); i++){
		if(moji[i]=='A'){
			if(node->a == NULL)	node->a = new Node();
			node = node->a;
		}else if(moji[i]=='C'){
			if(node->c == NULL)	node->c = new Node();
			node = node->c;
		}else if(moji[i]=='G'){
			if(node->g == NULL) node->g = new Node();
			node = node->g;
		}else if(moji[i]=='T'){
			if(node->t == NULL)	node->t = new Node();
			node = node->t;
		}else {
			assert(true);
		}
	}
	node->umu=true;
}
//---------------------------------
bool Tree::find(std::string moji)
{
	Node* node = m_root;
	for(int i =0; i < moji.size(); i++){
		if(moji[i]=='A'){
			if(node->a == NULL)	return false;
			node = node->a;
		}else if(moji[i]=='C'){
			if(node->c == NULL)	return false;
			node = node->c;
		}else if(moji[i]=='G'){
			if(node->g == NULL)	return false;
			node = node->g;
		}else if(moji[i]=='T'){
			if(node->t == NULL)	return false;
			node = node->t;
		}else {
			assert(true);
		}
	}
	if(node->umu)return true;
	return false;
}

//typedef std::vector<MEIREI> VecMeirei;
//typedef std::vector<std::string> WORDS;
//typedef std::vector<bool> ARINASHI;
//void input();
//bool find(WORDS jisho, std::string str);
void output(bool result);
//-------------------------------------------------------------------
int main()
{
    long n;
    std::cin >> n;
//    Tree* tree = new Tree();???//??????????????§????????????????????????
    Tree tree;
	for(int i=0; i<n; i++){
		std::string meirei;
	    std::cin >> meirei;
		std::string moji;
		std::cin >> moji;
		if(meirei=="insert"){
		    tree.insert(moji);
	    }else if(meirei=="find"){
	     	output(tree.find(moji));
	    }
	}
//	delete tree;
    return 0;
}
//-------------------------------------------------------------------
void output(bool result)
{
    if(result){
        std::cout << "yes" << std::endl;
    }else{
        std::cout << "no" << std::endl;
    }
    return;
}
//-------------------------------------------------------------------

Measured memory_bytes: 19468
from collections import deque

r, c = map(int, input().split())
s_y, s_x = 1, 1
g_y, g_x = r, c
s_y -= 1
s_x -= 1
g_y -= 1
g_x -= 1

maze = [list(input()) for i in range(r)]
dot_num = 0
for i in maze:
    dot_num += i.count('.')
reached = [[0] * c for i in range(r)]

directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]

queue = deque([[s_y, s_x, 0]])
reached[s_y][s_x] = 1

while queue:
    now = queue.popleft()
    depth = now[2] + 1
    for d in directions:
        next_y = now[0] + d[0]
        next_x = now[1] + d[1]
        if 0 <= next_y < r and 0 <= next_x < c:
            if maze[next_y][next_x] == '.':
                if reached[next_y][next_x] == 0:
                    queue.append([next_y, next_x, depth])
                    reached[next_y][next_x] = 1

                    if next_y == g_y and next_x == g_x:
                        print(dot_num - depth - 1)
                        exit()
print(-1)


Measured memory_bytes: 40432
#include <iostream>                                                                                  
#include <algorithm>                                                                                 
#include <vector>                                                                                    
#include <cmath>                                                                                     
#include <string>                                                                                    
#include <stdio.h>                                                                                   
using namespace std;                                                                                 
                                                                                                     
int main()                                                                                           
{                                                                                                    
    int a;                                                                                           
    cin >> a;                                                                                        
    int n, m;                                                                                        
    for(n = -119; n < 120; n++){                                                                     
        for(m = -119; m < 120; m++){                                                                 
            if(pow(n, 5) - pow(m, 5) == a){                                                          
                cout << n << " " << m << endl;                                                       
                return 0;                                                                            
            }                                                                                        
        }                                                                                            
    }                                                                                                
    return 0;                                                                                        
}

Measured memory_bytes: 3988
# 2020/08/08
# AtCoder Beginner Contest 174 - A

# Input
n, a, b = map(int,input().split())

# Calc
sa = abs(b - a)

if sa % 2 == 0:
    ans = sa // 2
else:
    # B go Right and 1 lose
    bgr = n - b + 1
    bgra = a + bgr
    rans = (n - bgra) // 2 + bgr
    
    # A go Left and 1 lose
    agl = a - 1 + 1
    aglb = b - agl
    lans = (aglb - 1) // 2 + agl
    ans = min(rans, lans)

# Output
print(ans)


Measured memory_bytes: 9124
using System;

namespace ABC114_A
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int x = int.Parse(Console.ReadLine());

			if (x == 7 || x == 5 || x == 3)
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
		}
	}
}

Measured memory_bytes: 13140
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

template <class T, class T2>
void group(T &xs, vector<pair<T2, int> > &result) {
  int i=0, j;
  while (i<xs.size()) {
    j=i;
    while (j < xs.size() and xs[j] == xs[i]) j++;
    result.push_back({ xs[i], j-i });
    if (j==i) i++;
    i=j;
  }
}

void solve() {
  string s;
  cin >> s;
  vector<pair<char, int> > G;
  group(s, G);
  for (auto&& g: G) {
    if (g.second >= 2) {
      cout << "Bad" << endl;
      return;
    }
  }
  
  cout << "Good" << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

			long n = sc.nextLong();

			//root nまでの素数を列挙
			List<Integer> factorPrimes = findPrimes((int)Math.sqrt(n)+1);
			
//			for(int p : factorPrimes) {
//				System.out.println(p);
//			}
			
			int count = 0;
			while( factorPrimes.size() > 0 ) {
				//find smallest prime number
				long p = factorPrimes.remove(0);
				
				if ( n % p == 0 ) {
					//bingo
					int pCount = 1;
					n = n / p;
					while (n % p == 0 ) {
						pCount++;
						n = n /p;
					}
					
					for(int i = 1 ; i <= pCount; i++ ) {
						if ( i <= pCount ) {
							count++;
							pCount -= i;
						}
					}
					
//					System.out.println(p);
//					System.out.println(count);
//					count += pCount;
				}
			}
			
			if ( n > 1 ) {
				//it is prime number;
				count++;
			}
			System.out.println(count);
		}
	}

	public static List<Integer> findPrimes(int n) {

		long[] primeCandidate = new long[n+1];

		List<Integer> primes = new ArrayList<>();

		for(int i = 2 ; i < n+1 ; i++ ) {
			if ( primeCandidate[i] == 0 ) {
				primes.add(i);
				int po = i*2;
				while (po <= n ) {
					primeCandidate[po] = 1;
					po += i;
				}
			}
		}
		
		return primes;

	}
}

Measured memory_bytes: 46568
#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>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;
 
int main() {
    int n;
    cin >> n;
    int d[n][2];
    rep(i,n) cin >> d[i][0] >> d[i][1];
    rep(i, n-2) {
        if (d[i][0] == d[i][1] && d[i+1][0] == d[i+1][1] && d[i+2][0] == d[i+2][1]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <string>

using namespace std;

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

	int m = N % 10;
	string str = "";

	switch (m) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			str = "hon";
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			str = "pon";
			break;
		
		case 3:
			str = "bon";
			break;
	}

	cout << str << endl;

	return 0;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"


// vector
#define MAX_ELE(vec) *max_element(vec.begin(), vec.end())
#define SORT(vec) sort(vec.begin(), vec.end());


// ---------------------------------------

// string
#define TO_UP(str) transform(str.cbegin(), str.cend(), str.begin(), ::toupper)

// ---------------------------------------



using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    

    int N;
    int h[100000];
    long long dp[100000];

    cin >> N;
    
    for (int i = 0; i < N; i++)
    {
        dp[i] = INFINITY;
        cin >> h[i];
    }
    
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < N; i++)
    {
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    
    cout << dp[N-1] << "\n";

}

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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	string s,t;
	cin >> s >> t;
	int cnt = t.length();
	int loopcnt = 0;
	for(int i = 0;i < s.length() - t.length() + 1;i++){
		loopcnt = 0;
		for(int j = 0;j < t.length();j++){
			if(s[i+j] == t[j]){
				loopcnt++;
			}
		}
		int newcnt = t.length() - loopcnt;
		cnt = min(newcnt, cnt);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
 
int main(){
	
	int n; cin>>n;
	vector<int> a(n),b(n);
	for(int i=0; i<n; i++){
		cin>>a.at(i)>>b.at(i);
	}
	sort(a.begin(),a.end());
	sort(b.rbegin(),b.rend());
	
	if(n%2){
		int low, high;
		low = a.at((n)/2);
		high = b.at((n)/2);
		cout << high-low+1 << endl;
	}
	else{
		int low0,low1,high0,high1;
		low0 = a.at(n/2-1);
		high0 = a.at(n/2);
		low1 = b.at(n/2);
		high1 = b.at(n/2-1);
		cout << (high1+low1)-(high0+low0)+1<<endl;
	}
}


Measured memory_bytes: 4764
n = int(input())
a = list(map(int,input().split()))

a = sorted(a)
max_a = max(a)
dp = [1 for i in range(max_a+1)]
a_num = [0 for i in range(max_a+1)]
ans = 0

for i in a:
    a_num[i] += 1
    if a_num[i] == 2:
        tmp = i
        while tmp+i <= max_a:
            tmp += i
            dp[tmp] = 0
        dp[i] = 0

for i in a:
    if dp[i] == 0:
        continue
    else:
        ans += 1
        tmp = i
        while tmp+i <= max_a:
            tmp += i
            dp[tmp] = 0

print(ans)


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

int main(){
  int D; cin >> D;
  vector<int> c(26);
  for(int i=0; i<26; i++) cin >> c[i];
  vector<vector<int>> s(D,vector<int>(26));
  for(int i=0; i<D; i++){
    for(int j=0; j<26; j++){
      cin >> s[i][j];
    }
  }
  vector<vector<int>> lastc(D+1,vector<int>(26,0));
  vector<int> t(D);
  
    srand(std::time(nullptr));
  
  for(int i=1; i<=D; i++){
    
    int cont; /*cin >> cont;
    cont--;*/ cont=rand()%26;
    t[i-1]=cont;
    
    //lastcの更新
    for(int j=0; j<26; j++){
      if(j==cont) lastc[i][j]=i;
      else lastc[i][j]=lastc[i-1][j];
    }
  }
  
  int M=100000;//調整
  for(int i=0; i<M; i++){
    int d,q; /*cin >> d >> q; q--;
    */
    d=rand()%D+1; 
    q=rand()%26;
    int qold=t[d-1];
    
    int sat=0;
    
    sat = sat - s[d-1][qold];
    sat = sat + s[d-1][q];
    
    int lastcold = lastc[d-1][qold];
    for(int j=d; j<=D; j++){
      if(j==d){
        sat-=c[qold]*(j-lastcold);
      }
      else if(lastc[j][qold]==j){
        break;
      }
      else{
        sat-=c[qold]*(lastc[j][qold]-lastcold);
      }
    }
    
    for(int j=d; j<=D; j++){
      if(lastc[j][q]==j){
        break;
      }
      else{
        sat+=c[q]*(d-lastc[j][q]);
      }
    }
    
    if(sat>0){
      for(int j=d; j<=D; j++){
        if(j==d){
          lastc[j][qold]=lastc[j-1][qold];
        }
        else if(lastc[j][qold]==j){
          break;
        }
        else{
          lastc[j][qold]=lastc[j-1][qold];
        }
      }
      
      for(int j=d; j<=D; j++){
        if(j==d){
          lastc[j][q]=d;
        }
        else if(lastc[j][q]==j){
          break;
        }
        else{
          lastc[j][q]=lastc[j-1][q];
        }
      }
      
      t[d-1]=q;
    }
  }
  
  for(int i=0; i<D; i++){
    cout << t[i]+1 << endl;
  }
}

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



using namespace std;

#define F first
#define S second


int main(){
	int n; cin >> n;
	vector<int> a(n),b(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i] >> b[i];
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n&1){
		cout << b[n/2]  - a[n / 2] + 1;
	}else{
		int bb = b[n / 2] + b[n/2 - 1];
		int aa = a[n / 2] + a[n/2 - 1];
		cout << bb - aa + 1 << "\n";
	}
		
	return 0;
}


Measured memory_bytes: 4808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

struct WUnion {
  vector< int > data;
  vector< int > diff_weight;
 
  WUnion(int sz) {
    data.assign(sz, -1);
    diff_weight.assign(sz,0);
  }
 
  bool unite(int x, int y, int w) {
    w+=weight(x);w-=weight(y);
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y),w=-w;
    data[x] += data[y];
    data[y] = x;
    diff_weight[y]=w;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    else{
        int r=find(data[k]);
        diff_weight[k]+=diff_weight[data[k]];
        return (data[k] = find(data[k]));
    }
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
  int weight(int k){
      find(k);
      return diff_weight[k];
  }
  int diff(int x, int y){
      return weight(y)-weight(x);
  }
};

int main(){
    int n,m;cin>>n>>m;
    WUnion wu(n);
    rep(i,m){
        int l,r,d;cin>>l>>r>>d;
        --l;--r;
        if(wu.find(l)==wu.find(r)&&wu.diff(l,r)!=d){
            cout<<"No"<<endl;
            exit(0);
        }
        else{
            wu.unite(l,r,d);
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010,mod=1000000007;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,k,a[1111],f[22][1111],fac[maxn],inv[maxn],invfac[maxn];
inline int C(int n,int m){
	if(n<0 || m<0 || n<m) return 0;
	return 1ll*fac[n]*invfac[m]%mod*invfac[n-m]%mod;
}
int main(){
	n=read();k=read();
	FOR(i,1,k) a[i]=read();
	fac[0]=fac[1]=inv[1]=invfac[0]=invfac[1]=1;
	FOR(i,2,n){
		fac[i]=1ll*fac[i-1]*i%mod;
		inv[i]=mod-1ll*(mod/i)*inv[mod%i]%mod;
		invfac[i]=1ll*invfac[i-1]*inv[i]%mod;
	}
	f[0][0]=1;
	FOR(i,1,k) FOR(j,0,n) FOR(k,0,j) f[i][j]=(f[i][j]+1ll*f[i-1][j-k]*C(n-k,a[i]-k)%mod*invfac[k])%mod;
	printf("%d\n",int(1ll*f[k][n]*fac[n]%mod));
}

Measured memory_bytes: 384
#include <iostream>


using namespace std;

int main(){
	string u;
  int l;
    cin >> l;
	cin >> u;
  	if(l%2 != 0){
      cout << "No";
      return 0;
    }
  	string k = u;

  if(u.compare(0, l/2, k, l/2,l/2)==0){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
	return 0;
}
  

Measured memory_bytes: 256
// ※AtCoderでの提出の為、ES6で記述出来ません。

// 完成
(function(stdin){
  var input = stdin.split("\n");
  // 10進数に変換
  var n = parseInt(input[0], 10);
  var a = input[1].split(" ");

  for (var i = 0; i < n; i++) {
    a[i] = parseInt(a[i], 10);
  }

  var ans = 0;
  var up = false;
  var down = false;
  for (var i = 0; i < n - 1; i++) {
    if (a[i] < a[i + 1]) {
      up = true;
    }
 
    if (a[i] > a[i + 1]) {
      down = true;
    }
 
    if (up && down) {
      up = down = false;
      ans++;
    }
  }

  console.log(ans + 1);
})(require("fs").readFileSync("/dev/stdin", "utf8"));

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

/*
位置jにたどり着くコストの最小値は、
min(dp[j-1]+|h[j]-h[j-1]|, dp[j-2]+|h[j]-h[j-2]|)
*/

void solve(){
    int n;
    cin >> n;
    int h[n+10];
    rep(i,n){
        cin >> h[i];
    }
    int dp[n+10];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2; i<n; i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << endl;
}

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


Measured memory_bytes: 1024
#include<stdio.h>

int main() {
	int n, i, j, temp;
	int d[101];
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &d[i]);
	for (i = 0; i < n - 1; i++) {
		for (j = 0; j < n - 1 - i; j++) {
			if (d[j] > d[j + 1]) {
				temp = d[j];
				d[j] = d[j + 1];
				d[j + 1] = temp;
			}
		}
	}
	temp = -1;
	j = 0;
	for (i = 0; i < n; i++) {
		if (d[i] != temp) {
			j++;
			temp = d[i];
		}
	}
	printf("%d", j);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
    char s[100005];
    scanf("%s", s);
    int i, n = strlen(s);
    int a, b, c;
    a = b = c = 0;
    for (i = 0; i < n; i++)
    {
        if (s[i] == 'a')a++;
        else if (s[i] == 'b')b++;
        else if (s[i] == 'c')c++;
    }
    int max = a;
    if (max < b)max = b;
    if (max < c)max = c;
    int min = a;
    if (min > b)min = b;
    if (min > c)min = c;
    if (max - min > 1)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}

Measured memory_bytes: 256
N,M,K=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))

A_cumsum=[0]*(N+1)
B_cumsum=[0]*(M+1)

#累積和を取得
a_cumsum=0
for n in range(N):
    a_cumsum=a_cumsum+A[n]
    A_cumsum[n+1] = a_cumsum
        
b_cumsum=0
for m in range(M):
    b_cumsum=b_cumsum+B[m]
    B_cumsum[m+1] = b_cumsum
    

ans = []
for n in range(N+1):
    a=A_cumsum[n]
    K_=K-a
    
    if K_< 0:
        break

    i=0
    left=0
    right=len(B_cumsum)-1

    while i < 100:
        i+=1
        if left >= right:
            break
        half = int((left+right)/2)
        if B_cumsum[half] < K_:
            left = half
        else:
            right=half

    for l in range(left,right+1):
        if B_cumsum[l] > K_:
            l=l-1
            break
    
    ans.append(n+l)
print(max(ans))

Measured memory_bytes: 111136
n,k = map(int,input().split())
x_y = [list(map(int,input().split())) for _ in range(n)]
x_y = sorted(x_y,key=lambda x:(x[0],x[1]))
ans = float('inf')
for i in range(n-1):
    for j in range(i+1,n):
        if j-i+1<k:
            continue
        dis_x = x_y[j][0]-x_y[i][0]
        y_x = x_y[i:j+1]
        y_x = sorted(y_x,key=lambda x:x[1])
        for l in range(len(y_x)-1):
            for m in range(l+1,len(y_x)):
                if m-l+1<k:
                    continue
                dis_y = y_x[m][1]-y_x[l][1]
                ans = min(ans,dis_x*dis_y)
print(ans)

Measured memory_bytes: 3064
//nani?
#include<bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const ll inf=1e9;
const ll MOD=1e9+7;
// ac cmtr;
const ll MAX_N = 1e5;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------

vector <ll> v[100005];
ll vis[100005];
ll dis[100005];
ll in_degree[100005];
    
void dfs(ll ini){
  	vis[ini]=1;
    f(i,0,v[ini].size()){
        ll vecino=v[ini][i];
        dis[vecino]=max(dis[vecino],dis[ini]+1);
        in_degree[vecino]--;
        if(in_degree[vecino]==0){
            dfs(vecino);
        }
    }
}


int main(){
    fastio;
    ll n,m;
    cin>>n>>m;
    f(i,0,m){
        ll a,b;
        cin>>a>>b;
        v[a].pb(b);
        ++in_degree[b];
    }
    f(i,1,n+1){
        if(!vis[i] && in_degree[i]==0) dfs(i);
    }
    ll ans=-1;
    f(i,1,n+1){
        ans=max(ans,dis[i]);
    }   
    cout<<ans<<endl;



    return 0;
}   



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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 10;

int main(void){
    for(int n; cin >> n, n;){
        vi cnt(N);

        while(n --){
            int ind; cin >> ind;
            cnt[ind] ++;
        }

        rep(i, N){
            if(cnt[i]) while(cnt[i] --) cout << '*';
            else cout << '-';
            cout << endl;
        }
    }
 
    return 0;
}

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

int n;
int _fib[100];

int fib(int n){
	if(_fib[n]) return _fib[n];
	int i=0;
	if(n == 0) i = 1;
	else if(n == 1) i = 1;
	else i = fib(n-1) + fib(n-2);
	_fib[n] = i;
	return i;
}

int main(void){
	int n;
	cin >> n;
	
	cout << fib(n) << endl;
	
	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main(){
  int n ;cin>> n;
    vector<P>  A(n) ;
  rep(i,n){
   ll a,b;
   cin>>a>>b;
   A[i].first=a+b ;
   A[i].second=a-b ;
   }
   sort(A.begin(),A.end()) ;
   ll end=-INF ;
   int ans=0 ;
   rep(i,n){
     if(A[i].second>=end){
       ans++ ;
       end=A[i].first ;
     
     }
   }
    cout << ans << endl;
    return 0;
  }

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication26
{
    class Program
    {
        static void Main(string[] args)
        {
            double b, c;
            b=0;c=1<<29;
            string line;
            while((line=Console.ReadLine())!=null)
            {
                double a = double.Parse(line);
                if (b < a)
                    b = a;
                if (c > a)
                    c = a;
            }
            Console.WriteLine(b - c);
        }
    }
}
 
 

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

int main()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("ourpur.txt", "w", stdout);
	#endif
	ll n,z,m;
	cin>>n>>m;
	z=m*n;
	long long q=z;
	cout<<q;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<ut,VI> PQ;
const int SIZE=2*1e5;
const LL INF=1<<30;
const LL p=7+1e9;
string s;
int main(){
	cin >> s;
	s+="QQQQQQQQQ";
	if(s.substr(0,4)=="YAKI")
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
	return 0;
}

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

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int) (x).size())
#define ALL(x) x.begin(), x.end()
#define debug(x) cerr << #x" = " << x << endl

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef unsigned long long u64;
typedef vector<int> VI;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
template <typename T> void read(T & x) {
	int f = 1; char ch; x = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); x *= f;
}

const int N = 305;
int n, K, M, f[N][N], g[N], c[N][N];
int main() {
	read(n); read(K); read(M);
	for (int i = 0; i < N; i++) {
		for (int j = c[i][0] = 1; j <= i; j++)
			c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % M;
	}
	for (int i = K; i >= 0; i--) {
		for (int j = 1; j <= n + 1; j++)
			g[j] = 0;
		for (int j = i + 1; j <= K; j++)
			for (int k = 1; k <= n + 1; k++)
				g[k] = (g[k] + f[j][k]) % M;
		f[i][1] = 1;
		for (int j = 1; j <= n + 1; j++)	
			for (int k = 1; j + k <= n + 1; k++)
				f[i][j + k] = (f[i][j + k] + (LL) f[i][j] * c[j + k - 2][k - 1] % M * g[k]) % M;
	}
	cout << f[0][n + 1];
	return 0; 
}





Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
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=1e9+7;

int main(){
    ll n,W;
    cin >> n >> W;
    vector<ll> w(n);
    vector<ll> v(n);
    rep(i,n){
        cin >> w[i] >> v[i];
    }
    vector<vector<ll>> dp(n+1,vector<ll>(100100,INF));
    dp[0][0]=0;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<=100000;j++){
            if(j+v[i]<=100000){
                dp[i+1][j+v[i]]=min(dp[i+1][j+v[i]],dp[i][j]+w[i]);
            }
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }
    ll ans=0;
    rep(i,100001){
        if(dp[n][i]<=W){
            ans=max(ans,i);
        }
    }
    cout << ans << endl;
    return 0;
} 

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vec s(m), c(m);
    init(s, c);

    vec num(n + 1, -1);

    rep (i, m) {
        if (num[s[i]] != -1 and num[s[i]] != c[i]) {
            print(-1);
            return 0;
        }
        num[s[i]] = c[i];
    }
    if (n > 1 and num[1] == 0) {
        print(-1);
        return 0;
    }

    For(i, 1, n) {
        if (n == 1 and num[i] == -1) {
            cout << 0;
        } else if (num[i] != -1) {
            cout << num[i];
        } else {
            if (i == 1)
                cout << 1;
            else
                cout << 0;
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=3000;
const double MPI=acos(-1.0);
struct P { double x,y; P() {} P(double x,double y):x(x),y(y) {} };

int n,den;
int num[MAXN];


double ang[MAXN-1];


double my_tan(double x) {
  if (x > MPI / 2 - 0.0001) {
    double y = MPI / 2 - x;
    return 1.0 / y - y / 3 - y * y * y / 45;
  }
  return tan(x);
}


P solve() {
	P ret(0,0);
	REP(i,n) {
		P cur(cos(2*MPI*num[i]/den),sin(2*MPI*num[i]/den));
		//printf("%lf %lf\n",cur.x,cur.y);
		REP(j,n-1) ang[j]=2*MPI*((num[(i+1+j)%n]+den-num[i])%den)/den;
		//REP(j,n-1) printf(" %lf",ang[j]); puts("");
		double mlt=0,sum=0;
		REP(j,n-1) {
			mlt+=0.5*(j-my_tan((2*MPI-ang[j])/4)*sum);
			sum+=my_tan(ang[j]/4);
		}
		//printf(" mlt=%lf\n",mlt);
		ret.x+=mlt*cur.x,ret.y+=mlt*cur.y;
	}
	ll cnt=(ll)n*(n-1)*(n-2)/6; ret.x/=cnt,ret.y/=cnt;
	return ret;
}

void run() {
	scanf("%d%d",&n,&den);
	REP(i,n) scanf("%d",&num[i]);
	P ans=solve();
	printf("%.15lf %.15lf\n",ans.x,ans.y);
}

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


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

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  for(int i=0; i<n; i++){
    cin >> l.at(i);
  }
  sort(l.begin(), l.end(), greater<int>());
  int sum=0;
  for(int i=1; i<n; i++){
    sum += l.at(i);
  }
  if(l.at(0) < sum){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256