akhauriyash/Code-Regression huggingface dataset:
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

vector<int> v;
int data[150000];
void cal(){
  v.push_back(1);
  int w = 6;
  while(w < 150000){
    v.push_back(w);
    w = v.back() * 6;
  }
  w = 9;
  while(w < 150000){
    v.push_back(w);
    w = v.back() * 9;
  }
  sort(v.begin(), v.end());
}

void dp(){
  data[0] = 0;
  for(int i = 1; i < 150000; i++){
    data[i] = 999999;
  }
  int len = v.size();
  for(int i = 0; i < 100050; i++){
    for(int k = 0; k < len; k++){
      int w = v[k];
      // cout << w << endl;
      if(i + w > 100050) break;
      if(data[i + w] > data[i] + 1) data[i + w] = data[i] + 1;
    }
  }
}

int main(){
  int n;
  int cnt = 0;
  cin >> n;
  cal();
  dp();

  /*for(int i = 0; i <= 200; i++){
    cout << "i:" << i << " " << data[i] << endl;
  }*/

  cout << data[n] << endl;
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
string s,s1;
cin>>s>>s1;
int c1;
ll k=s.size();
ll kk=s1.size();
//int c1;
int mx=INT_MIN;
for(ll i=0;i<s.size()-s1.size()+1;i++)
{
    c1=0;
    for(ll j=i,c=0;c<kk;c++,j++){

     if(s[j]==s1[c])
     {
      //c++;
        c1++;
      //cout<<s[i]<<endl;
     }

}
mx=max(mx,c1);
}

cout<<kk-mx<<endl;
}


Measured memory_bytes: 3560
#include<stdio.h>

int main (){
	int A,B,ans;
    
        scanf("%d %d",&A,&B);
        
        if(A >= B){
            ans += A;
            A = A - 1;
        }else{
            ans += B;
            B = B - 1;
        }
    
        if(A >= B){
            ans += A;
            A = A - 1;
        }else{
            ans += B;
            B = B - 1;
        }
        
        printf("%d",ans);
        return 0;
  
}



Measured memory_bytes: 128
#include <iostream>

#define maxn 105

using namespace std;

int a[5][5],b[maxn],vis[5][5];

int main(){

	int i,j,n,k,flag=0;

	for(i=1;i<=3;i++)

		for(j=1;j<=3;j++)

			scanf("%d",&a[i][j]);

	scanf("%d",&n);

	for(i=1;i<=n;i++)scanf("%d",&b[i]);

	for(i=1;i<=n;i++)

		for(j=1;j<=3;j++)

			for(k=1;k<=3;k++)

				if(b[i]==a[j][k])vis[j][k]=1;

	for(i=1;i<=3;i++)

		if(vis[i][1]==1&&vis[i][2]==1&&vis[i][3]==1)flag=1;

	for(j=1;j<=3;j++)

		if(vis[1][j]==1&&vis[2][j]==1&&vis[3][j]==1)flag=1;

	if(vis[1][1]==1&&vis[2][2]==1&&vis[3][3]==1)flag=1;

	if(vis[1][3]==1&&vis[2][2]==1&&vis[3][1]==1)flag=1;

	if(flag)printf("Yes\n");

	else printf("No\n");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  bool sat = true;
  if(s.length()%2==1) sat = false;
  rep(i,s.length()){
    if(i%2==0 && s[i] != 'h')sat = false;
    if(i%2==1 && s[i] != 'i')sat = false;
  }
  YesNo(sat);
  return 0;
}


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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long
#define MAX_V
const double PI=3.14159265358979323846;

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain; 

map<int, int> mp;

int main() {
    int n, ans = 0;
    cin >> n;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        mp[tmp]++;
    }

    for(auto p: mp) {
        if(p.first <= p.second) ans += p.second - p.first;
        else ans += p.second;
    }

    cout << ans << endl;

    return 0;
}
 

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/03  Problem: ABC 047 C / Link: http://abc047.contest.atcoder.jp/tasks/abc047_c  ----- */


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


	string s; cin >> s;
	char f = s.front();
	LL ans = 0LL;
	for (auto c : s) {
		if (c == f)continue;
		else {
			f = c;
			ans++;
		}
	}
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool comp(ll a, ll b)
{
    return (a < b);
}
int main(){

ll n,w,i,j,k,a,b;
cin>>n>>w;
ll t[n+1][w+1];
for(i=0;i<n;i++){
    cin>>a>>b;
    t[i][0]=0;
    for(j=1;j<=w;j++){
        if(i!=0&&a<=j)
        t[i][j]= std::max(b+t[i-1][j-a],t[i-1][j]);
        if(i!=0&&a>j)
        t[i][j]=t[i-1][j];
        if(i==0){
        if(j>=a)
        t[i][j]=b;
        else
        t[i][j]=0;
        }
    }
}
// for(i=0;i<n;i++){
// for(j=0;j<=w;j++)
// cout<<t[i][j]<<" ";
// cout<<endl;
// }
cout<<t[n-1][w]<<endl;
return 0;
}



Measured memory_bytes: 78976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int d,g;
    cin >>d >>g;
    vector<int> p(d), c(d);
    rep(i,d) cin >>p[i] >>c[i];

    int ans = 1234;
    rep(mask,1<<d){
        int ct = 0;
        int s = 0;

        rep(i,d)if(mask>>i&1){
            ct += p[i];
            s += c[i] + p[i]*100*(i+1);
        }

        if(s>=g) ans = min(ans,ct);
        for(int i=d-1; i>=0; --i)if(!(mask>>i&1)){
            rep(j,p[i]){
                ++ct;
                s += 100*(i+1);
                if(s>=g) ans = min(ans,ct);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int64_t K, N;
    vector<int> house;
    cin >> K >> N;
    
    int64_t max_dist = 0;
    int pre = 0;
    int now;

    for (int i = 0; i < N; i++) {
        cin >> now;
        house.push_back(now - pre);
        pre = now;
    }

    house.at(0) += (K - now);
    int max = *(max_element(house.begin(), house.end()));
    cout << (K - max) << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
    int h,w;cin>>h>>w;
    vector<string> g(h);
    rep(i,0,h)cin>>g[i];
    vector<vector<ll>> dp(h,vector<ll>(w,0));
    dp[0][0]=1;
    ll MOD = 1e9+7;
    rep(i,0,h)rep(j,0,w){
        if(i+1<h && g[i+1][j]=='.')dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
        if(j+1<w && g[i][j+1]=='.')dp[i][j+1]=(dp[i][j+1]+dp[i][j])%MOD;
    }

    cout<<dp[h-1][w-1]<<endl;
}


Measured memory_bytes: 9216
#include<iostream>
using namespace std;
int main(){
  int a_start,a_end;
  int b_start,b_end;
  int ans=0;
  
  int time[103];
  cin >> a_start >> a_end;
  cin >> b_start >> b_end;
  
  for(int i=0;i<=100;i++){
    time[i]=0;
    if(i>=a_start&&i<=a_end)
      time[i]++;
    if(i>=b_start&&i<=b_end)
      time[i]++;
  }
  
  for(int i=0;i<=100;i++){
    if(time[i]==2)
      ans++;
  }
  if(ans>0)
    ans--;
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::vector<int> A;
	std::cin >> N;
	A.resize(N);
	for (auto& a : A)
		std::cin >> a;
	
	std::sort(A.begin(), A.end());
	auto it = std::unique(A.begin(), A.end());
	if (it == A.end())
		std::cout << "YES\n";
	else
		std::cout << "NO\n";
}


Measured memory_bytes: 1024
#include <algorithm>
#include <vector>
#include <iostream>
#include <tuple>
using namespace std;
struct tape{
    int x1,x2,y1,y2;
    tape(int x1, int y1, int x2, int y2){
        this->x1=x1;
        this->x2=x2;
        this->y1=y1;
        this->y2=y2;
    }
    bool isInclude(double x, double y){
        return x1<=x&&x<=x2&&y1<=y&&y<=y2;
    }
};
vector<tape> T;

int map[2002][2002];
vector<int> X,Y;

int color=0;
void rec(int x, int y){
    if(map[y][x]!=0) return;
    map[y][x]=color;
    int d[5]={-1,0,1,0,-1};
    for(int i=0;i<4;i++){
        int dx=d[i],dy=d[i+1];
        if(0<=x+dx&&x+dx<X.size()-1&&0<=y+dy&&y+dy<Y.size()-1)
            rec(x+dx,y+dy);
    }
}

int main(){
    int w,h;
    while(cin>>w>>h,w|h){
        int n;
        cin>>n;
        X.clear();
        Y.clear();
        T.clear();
        fill(map[0],map[2002],0);
        for(int i=0;i<n;i++){
            int x1,y1,x2,y2;
            cin>>x1>>y1>>x2>>y2;
            T.emplace_back(x1,y1,x2,y2);
            X.push_back(x1);
            X.push_back(x2);
            Y.push_back(y1);
            Y.push_back(y2);
        }
        X.push_back(0);
        X.push_back(w);
        Y.push_back(0);
        Y.push_back(h);
        sort(X.begin(),X.end());
        X.erase(unique(X.begin(),X.end()),X.end());
        sort(Y.begin(),Y.end());
        Y.erase(unique(Y.begin(),Y.end()),Y.end());
        /*
        cout<<"X={";
        for(auto e:X){
            cout<<e<<',';
        }
        cout<<"}"<<endl;
        cout<<"Y={";
        for(auto e:Y){
            cout<<e<<',';
        }
        cout<<"}"<<endl;*/

        for(int i=0;i<Y.size()-1;i++){
            for(int j=0;j<X.size()-1;j++){
                double x=(double)(X[j]+X[j+1])/2;
                double y=(double)(Y[i]+Y[i+1])/2;
                for(auto& t:T){
                    if(t.isInclude(x,y)){
                        map[i][j]=-1;
                        break;
                    }
                }
            }
        }
        color=0;
        for(int i=0;i<Y.size()-1;i++){
            for(int j=0;j<X.size()-1;j++){
                if(map[i][j]==0){
                    color++;
                    rec(j,i);
                }
            }
        }
        cout<<color<<endl;
    }
    return 0;
}

Measured memory_bytes: 27752
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;
ll a[100010],b[100010];
int main(){
    cin>>N>>K;
	ll maxA=0;
    for(ll i=0;i<N;i++){
		cin>>a[i]>>b[i];
		maxA=max(maxA,a[i]);
    }
	ll maxBit=0;
	for(ll i=0;(1ll<<i)<=maxA;i++){
		if((1ll<<i)&maxA)maxBit=i;
	}
	for(ll i=0;(1ll<<i)<=K;i++){
		if((1ll<<i)&K)maxBit=max(maxBit,i);
	}
	ll ans=0;
	for(ll i=0;i<N;i++){
		bool f=true;
		for(ll bit=0;bit<=maxBit;bit++){
			if( ((1ll<<bit)&K)==0 && ((1ll<<bit)&a[i])!=0 ){
				f=false;
				break;
			}
		}
		if(f)ans+=b[i];
	}
	for(ll bit=maxBit;bit>=0;bit--){
		if(((1ll<<bit)&K)==0)continue;
		ll sum=0;
		for(ll i=0;i<N;i++){
			if((1ll<<bit)&a[i])continue;
			bool f=true;
			for(ll j=maxBit;j>bit;j--){
				if( ((1ll<<j)&K)==0 && ((1ll<<j)&a[i])!=0 ){
					f=false;
					break;
				}
			}
			if(f)sum+=b[i];
		}
		ans=max(sum,ans);
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main(){
    int a,b; cin >> a >> b;
    if(b == 1) return puts("0") *0;
    if(a >= b){
        cout << 1 << endl;
    } else {
        cout << ((b - a) % (a -1) ? 1 :0 ) + (b-a)/(a-1) + 1 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
int main() {
    
	ll pos=0 , i;
	
	cin>>i;
	
	ll t=(-1+sqrt(1+(8*i)))/2;
	
	((t*(t+1))/2)==i ? cout << t : cout << t+1 ; 
}

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

int h, w;

int main(){
	scanf("%d %d", &h, &w);
	for(int i=0; i<h; i++){
		char t[101];
		scanf("%s", t);
		for(int j=0; j<2; j++){
			printf("%s\n", t);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
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() {
  int N; cin >> N;
  vector<int> X(N);
  rep(i, N) cin >> X[i];
  vector<int> Y(N);
  copy(X.begin(), X.end(), Y.begin());
  sort(Y.begin(), Y.end());
  rep(i,N) {
    if(X[i] <= Y[Y.size()/2-1]) {
      cout << Y[Y.size()/2] << endl;
    } else {
      cout << Y[Y.size()/2-1] << endl;
    }
  }
}

Measured memory_bytes: 3712
#include<stdio.h>
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    
    int b, f, r, p;
    int A[4][3][10] = {};
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d %d", &b, &f, &r, &p);
        A[b-1][f-1][r-1] += p;
    }
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                printf(" %d", A[i][j][k]);
            }
            printf("\n");
        }
        if (i < 3) printf("####################\n");
    }
}


Measured memory_bytes: 2728
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n,d,cnt=0;
    cin >>n>> d;
    float a[n][d];
    for (int i = 0; i <n ; i++) {
        for (int j = 0; j <d ; j++) {
            cin >>a[i][j];
        }
    }
    
    for (int i = 0; i <n ; i++) {
        for (int j = i+1; j <n ; j++) {
            int s=0;
            for (int k = 0; k <d ; k++) {
                s+=pow(a[i][k]-a[j][k],2.0);
            }
            double dis=sqrt(s);
            if (ceil(dis) == floor(dis)) {
                cnt++;
            }
        }
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 256
N = int(input())
l = input().split()
l = [int(s) for s in l]
count = 0
for j in range(N-1):
    min = l[j]
    for i in range(j,N):
        if( min > l[i]):
            min = l[i]
            a = i
    if(l[j]>min):
        l[j],l[a] = l[a],l[j]
        count += 1
for i in range(0,len(l)-1):
    print(l[i],end=' ')
print(l[N-1])
print(count)


Measured memory_bytes: 5616
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,d,e,f,g,h,w;
 
ll p[500005],c[500005];
bool used[50];

char s[500005];
int main(){
    cin>>d>>a;
	for(i=0;i<d;i++){
		cin>>p[i]>>c[i];
	}
	ans = INF;
	for(i=0;i<(1<<d);i++){

		b = i;
		num = 0;
		ll score = 0;
		for(j=0;j<d;j++){
			used[j]=false;
		}

		for(j=0;j<d;j++){
			if(b%2==1){
				used[j] = true;
				num += p[j];
				score += (p[j] * (j+1) * 100);
				score += c[j];
			}
			b /= 2;

		}
		if(score >= a){
			ans = min(ans,num);
		}else{
		for(j=d-1;j>=0;j--){
			if(used[j])continue;			
			if((a - score) >= p[j] * (j+1) * 100){
				break;
			}else{
				num += (a-score+j*100+99)/((j+1)*100);
				ans = min(ans,num);
				break;
			}
		}
		}
	}

	p(ans);
	return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n, m;
    cin >> n >> m;
    vector<int> f(n, 0);
    int a = 0, b = 0;
    for (int i = 0; i < m; i++) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if (f[p] != -1) {
            if (s == "AC") {
                a++;
                b += f[p];
                f[p] = -1;
            }
            else {
                f[p]++;
            }
        }
    }
    cout << a << ' ' << b << endl;
}

Measured memory_bytes: 640
($N) = split(/\s+/, <>);
@H = split(/\s+/, <>);

for $i (0..($N-2)) {
    next if $H[$i] <= $H[$i+1];
    ++$H[$i+1];
    next if $H[$i] <= $H[$i+1];
    print "No\n";
    exit 0;
}
print "Yes\n";


Measured memory_bytes: 11812
def resolve():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a

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

    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # Aは偶数。2*Bと書ける。少数をなくすため, B*(2p + 1)と式変形
    # 2を使用した為、2で割る
    B = [a//2 for a in A]

    # X = B[k] * (2p + 1)
    # これを見てみると、B[k]の奇数倍の数が作られることになる。
    # 公倍数は最小公倍数の倍数となるという性質がある。
    # 全部の数の最小公倍数を取って、M÷最小公倍数をすると答えが得られる。
    def solve():
        lc = 1
        for i in range(N):
            lc = lcm(lc, B[i])

        # 変形式より、XはB*奇数倍されないといけないX//B[k] == (2p+1)
        # なので、偶数になるとダメ
        for i in range(N):
            if (lc//B[i]) % 2 == 0:
                return 0
        ans = M//lc
        ans = (ans+1)//2
        return ans

    print(solve())

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 14292
/*
    Created by Rahul Goel.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/*******************************************************************************/
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*******************************************************************************/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
ll mod_sum() { return 0LL; }
template < typename T, typename... Args >
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%MOD + MOD)%MOD; }
/*******************************************************************************/
ll mod_prod() { return 1LL; }
template< typename T, typename... Args >
T mod_prod(T a, Args... args) { return (a * mod_prod(args...))%MOD; }
/*******************************************************************************/
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
/*******************************************************************************/
//.-.. . -. -.- .- .. ... .-.. --- ...- .
/*
    Code begins after this.
*/

ll solve() {
    ll n, ans = 0;
    cin >> n;
    vi vec(n);
    for (ll &x : vec) {
        cin >> x;
    }
    ll mn = vec.front();
    for (ll i = 1; i < n; i++) {
        ans += max(0LL, mn - vec[i]);
        mn = max(mn, vec[i]);
    }
    cout << ans << endl;
    return 0;
}

signed main() {
    fastio;

    ll t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 4776
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
	int N, A;
	cin >> N;
	vector<pair<int, int>> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> A;
		a[i].first = A;
		a[i].second = 1 + i;
	}
	sort(a.begin(), a.end());
	for (pair<int, int>& i : a) cout << i.second << ' ';
}

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

using namespace std;

#define ll long long

ll a[200001], b[200001];

 int main()
{
    ll i, j, n, m, hi, lo, mid, no, c;



    scanf("%lld", &n);

    for(i=0; i<n; i++) scanf("%lld", &a[i]);

    scanf("%lld", &m);

    for(i=0; i<m; i++) scanf("%lld", &b[i]);

    sort(a, a+n);

    sort(b, b+m);

    no=0;

    for(i=0; i<m; i++)
    {
        if(binary_search(a, a+n, b[i])==0)
        {
        no=1;
        break;
        }

    }
    if(no==1) printf("0\n");
    else printf("1\n");


    return 0;

}




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

using namespace std;

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

int main(){
	int n,m;
	while(cin>>n>>m,n){
		vector<int> s(n);
		vector<int> d(m);
		rep(i,n) cin>>s[i];
		rep(i,m) cin>>d[i];
		sort(d.begin(), d.end());
		vector<int> dp(1<<n, 1e9);
		dp[0] = 0;
		vector<int> cost(1<<n);
		rep(i,1<<n){
			int sum = 0;
			rep(j,n){
				if((1<<j)&i) sum += s[j];
			}
			cost[i] = sum;
		}
		rep(i,m){
			vector<int> next(1<<n, 1e9);
			rep(j,1<<n){
				rep(k,n){
					int t = (1<<k) | j;
					dp[t] = min(dp[t], dp[j]);
				}
			}
			rep(j,1<<n){
				// if(j==1) cout<<dp[j]<<" "<<cost[j]<<" "<<d[i]<<endl; 
				next[j] = min(next[j], dp[j] + abs(cost[j] - d[i]));
			}
			dp = next;
		}
		int ans = 1e9;
		rep(i,1<<n){
			ans = min(ans, dp[i]);
		}
		cout<<ans<<endl;
	}
}

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

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

	int N;
	int x,y;
	int i,k;
	int ans=0;
	int ctr=0;

	cin >> N;

	vector<int> gv(N);
	rep(i,N){
		cin >> x >> y;
		if(x==y) ctr++;
		else ctr=0;

		ans=max(ctr,ans);
	}

	if(ans>=3)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}



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

int main() {
  string S;
  cin >> S;

  int i = 0;
  while (i < S.size()) {
    if (S.size() >= 11) {
      string s(S.begin()+i, S.begin()+i+11);
      if (s == "dreameraser") { i+=11; cerr << s << endl; continue; }
    }
    if (S.size() >= 10) {
      string s(S.begin()+i, S.begin()+i+10);
      if (s == "dreamerase") { i+=10; cerr << s << endl; continue; }
    }
    if (S.size() >= 7) {
      string s(S.begin()+i, S.begin()+i+7);
      if (s == "dreamer") { i+=7; cerr << s << endl; continue;}
    }
    if (S.size() >= 6) {
      string s(S.begin()+i, S.begin()+i+6);
      if (s == "eraser") { i+=6; cerr << s << endl; continue; }
    }
    if (S.size() >= 5) {
      string s(S.begin()+i, S.begin()+i+5);
      if (s == "dream") { i+=5; cerr << s << endl; continue; }
      if (s == "erase") { i+=5; cerr << s << endl; continue; }
    }
    cout << "NO" << endl;
    return 0;
  }

  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

typedef long long ll;
// const ll MOD = 1000000007;
const ll inf = 999999999999;

int main() {
    int n; cin >> n;
    vector<ll> a(n+2);
    for (int i = 1; i <= n; i++) cin >> a[i];
    map<pair<int,int>,ll> dp;
    map<pair<int,int>,int> mp;
    dp[make_pair(1, 0)] = 0;
    mp[make_pair(1, 0)] = 0;
    dp[make_pair(1, 1)] = a[1];
    mp[make_pair(1, 1)] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = (i - 1) / 2; j <= (i + 1) / 2; j++) {
            if (dp.find(make_pair(i-1,j)) != dp.end()) {
                if(dp.find(make_pair(i,j)) == dp.end()) dp[make_pair(i,j)] = dp[make_pair(i-1,j)];
                else dp[make_pair(i,j)] = max(dp[make_pair(i,j)],dp[make_pair(i-1,j)]);
            }
            if (dp.find(make_pair(i-1,j-1)) != dp.end()) {
                if(dp.find(make_pair(i,j-1)) == dp.end()) dp[make_pair(i,j-1)] = dp[make_pair(i-1,j-1)];
                else dp[make_pair(i,j-1)] = max(dp[make_pair(i,j-1)],dp[make_pair(i-1,j-1)]); 
                if (mp[make_pair(i-1,j-1)] < i -1) {
                    if (dp.find(make_pair(i,j)) == dp.end()) dp[make_pair(i,j)] = dp[make_pair(i-1,j-1)] + a[i];
                    else dp[make_pair(i,j)] = max(dp[make_pair(i,j)], dp[make_pair(i-1,j-1)] + a[i]);
                    if(dp[make_pair(i,j)] == dp[make_pair(i-1,j-1)] + a[i]) mp[make_pair(i,j)] = i; 
                }
            }
            if (dp.find(make_pair(i-2,j-1)) != dp.end()) {
                if (dp.find(make_pair(i,j)) == dp.end()) dp[make_pair(i,j)] = dp[make_pair(i-2,j-1)] + a[i];
                else dp[make_pair(i,j)] = max(dp[make_pair(i,j)], dp[make_pair(i-2,j-1)] + a[i]);
                if(dp[make_pair(i,j)] == dp[make_pair(i-2,j-1)] + a[i]) mp[make_pair(i,j)] = i;
            }
        }
    }
    cout << dp[make_pair(n, n / 2)] << "\n";
}

Measured memory_bytes: 73488
#ifdef Rahul
# include "RAHUL.h"
#else
# include <bits/stdc++.h>
  using namespace std;
# define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

const int N = 5e5 + 42;
const int MAGIC = 600;
int l[N], r[N], c[N], a[N], b[N], ids[N];
int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int n, q; cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
  }
  for (int i = 1; i <= q; ++i) {
    cin >> l[i] >> r[i];
    ++r[i];
  }
  iota(ids, ids + q, 1);
  sort(ids, ids + q, [&] (int i, int j) {
    int bi = l[i] / MAGIC, bj = l[j] / MAGIC;
    if (bi != bj) return bi < bj;
    return bi & 1 ? r[i] > r[j] : r[i] < r[j]; 
  });
  int L = 1, R = 1, ans = 0;
  for (int ii = 0; ii < q; ++ii) {
    int i = ids[ii];
    while (R < r[i]) {
      ans += !a[c[R]];
      ++a[c[R]];
      ++R;
    }
    while (L > l[i]) {
      --L;
      ans += !a[c[L]];
      ++a[c[L]];
    }
    while (R > r[i]) {
      --R;
      --a[c[R]];
      ans -= !a[c[R]];
    }
    while (L < l[i]) {
      --a[c[L]];
      ans -= !a[c[L]];
      ++L;
    }
    b[i] = ans;
  }
  for (int i = 1; i <= q; ++i) cout << b[i] << '\n';
}


Measured memory_bytes: 15504
{- written by MarekCerny.com -}
{-# LANGUAGE ViewPatterns, PatternSynonyms  #-}
{-# LANGUAGE TupleSections                  #-}
{-# LANGUAGE UnicodeSyntax                  #-}
{-# LANGUAGE LambdaCase, MultiWayIf         #-}
import Data.Tuple
import Data.Bits
import Data.Maybe
import Data.Function
import Data.List
import Control.Exception
import qualified Data.HashMap.Strict as M
import Data.Sequence (Seq, (|>), (<|), (><))
import qualified Data.Sequence as S

main = interact $ unlines . sol . (map words) . lines

sol :: [[String]] -> [String]
sol [f,[c]] = let
    [a,b] = map (read) f :: [Int]
    st = take a c
    nd = drop (a+1) c
    in wrap $ if (isNumber st
                            && isNumber nd
                            && (c!!(a)) == '-'
                            && (length c) == a+b+1
                            )
                        then "Yes"
                        else "No"

isNumber ss = all (`elem` "0123456789") ss

--------------------------------------------------------------------------------
groupOn :: Int -> [a] -> [[a]]
groupOn _ [] = []
groupOn n xs = let (sts, nds) = splitAt n xs in sts : groupOn n nds

fromBool :: Num a => Bool -> a
fromBool b = if b then 1 else 0

allInt :: [String] -> [[Int]]
allInt = map ((map read) . words)

swrt :: Ord a => (a, a) -> (a, a)
swrt (a, b) | compare b a == LT = (b, a) | otherwise = (a, b)

wrap :: a -> [a]
wrap x = [x]

toSnd :: a->b-> (a,b)
toSnd x y = (x,y)

toFst :: b->a-> (a,b)
toFst y x = (x,y)

addCnt :: [String] -> [String]
addCnt ls = (show $ length ls) : ls

toBitMap :: Int -> [(Int, Bool)]
toBitMap = toBitMap' 31
  where
    toBitMap' (-1) _ = []
    toBitMap' n v = (n, v .&. (1`shiftL`n) > 0) : toBitMap' (n-1) v
--------------------------------------------------------------------------------
pattern Empty   <- (S.viewl -> S.EmptyL)
pattern x :< xs <- (S.viewl -> x S.:< xs)
pattern xs :> x <- (S.viewr -> xs S.:> x)
--------------------------------------------------------------------------------


Measured memory_bytes: 508
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m = 0;
  int j = 0;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    while (j < n && (m & a[j]) == 0) {
      m ^= a[j++];
    }
    ans += j - i;
    m ^= a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
n, m = list(map(int, input().split()))

penal = [0] * n
check = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p)
    p -= 1
    if check[p] == 1:
        continue
    if s == 'AC':
        check[p] = 1
    else:
        penal[p] += 1

Check = 0
Penal = 0
for i in range(n):
    Check += check[i]
    if check[i] == 1:
        Penal += penal[i]
print(Check, Penal)


Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(c>=a&&c<=b)
	{
		cout<<"Yes"<<endl;
	}
	else if(c<=a&&c>=b)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[52],b[52];
int main()
{
  cin>>a;
  cin>>b;
  int i,x=strlen(a),y=strlen(b),l=min(x,y),k=max(x,y);
  for(i=0;i<=l-1;i++)
     cout<<a[i]<<b[i];
  if(x>y)
    for(i=l;i<=k-1;i++)
      cout<<a[i];
  else 
	for(i=l;i<=k-1;i++)
      cout<<b[i];
  return 0;
}//大厦撒大声地//、、、dasdasdasd

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int H,W,n;
  cin >> H >> W >> n;
  queue<int> que;
  REP(i,n){
    int x;cin >> x;
    REP(j,x)que.push(i+1);
  }
  vector<vector<int>> res(H,vector<int>(W));
  bool is = true;
  REP(i,H){
    if(is){
      REP(j,W)res[i][j] = que.front(),que.pop();
      is = false;
    }else{
      REPD(j,W)res[i][j] = que.front(),que.pop();
      is = true;
    }
  }
  REP(i,H)REP(j,W)j == W-1 ? cout << res[i][j] << endl : cout << res[i][j] << " ";
  





  

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define dbg() cerr <<
#define name(x) (#x) << ": " << (x) << ' ' <<

using namespace std;

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

  int n, m; cin >> n >> m; cin.get();
  vector<string> a(n);
  for (int i = 0; i < n; ++i) {
    getline(cin, a[i]);
  }

  vector<vector<int>> dp(n, vector<int>(m, (int)1e9));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (i == 0 && j == 0) {
        dp[0][0] = a[0][0] == '#';
      } else {
        if (i - 1 >= 0)
          dp[i][j] = min(dp[i][j],
            dp[i - 1][j] + (a[i - 1][j] == '.' && a[i][j] == '#'));
        if (j - 1 >= 0)
          dp[i][j] = min(dp[i][j],
            dp[i][j - 1] + (a[i][j - 1] == '.' && a[i][j] == '#')); 
      }
    }
  }

  cout << dp[n - 1][m - 1] << endl;
}


Measured memory_bytes: 384
// Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

void play(string str){
    string mas[]={"x",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    int lng = 0;
    
    for(int i = 0; i < str.size() ; i++){
        if(str[i] == '0'){
            if(lng!=0){
                //cout << (lng-1) << " " << mas[str[i-1]-'0'].size() << endl;
                cout << mas[str[i-1]-'0'][(lng-1)%mas[str[i-1]-'0'].size()];
                lng = 0;
            }
        }
        else lng++;
    }
    cout << endl;
}

main(){
    //freopen("2006-input.txt","r",stdin);
    //freopen("test.txt","w",stdout);
    
    int t;
    string str;
    
    cin >> t;
    
    while(t--){
        cin >> str;
        
        play(str);
    }
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
	int n, x, t;
	cin >> n >> x >> t;
	int c = 0;
	while (n > 0)
	{
		n -= x;
		c += t;
	}
	cout << c << endl;
}


Measured memory_bytes: 3592
# import numpy as np
# import scipy as sp
# import sys
# input = sys.stdin.readline
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# a=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# a=[int(input()) for _ in range (n)]  #リスト入力  改行でa1 ... anのとき
# s=[list(map(str,list(input()))) for i in range(h)]  # 文字列の二次元配列入力
# s = [list(map(int, input().split())) for i in range(n)] # 数値の二次元配列入力
# a = b[:], a = [x[:] for x in b] # deepcopy
# chr(ord('a') + 1) # chrのインクリメント
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#　

n = int(input())


def ceil(a, b):
    return -(-a // b)


print(ceil(n, 2))


Measured memory_bytes: 38384
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int k = sc.nextInt();
    
    char a = s.charAt(k - 1);
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != a) {
        builder.append('*');
      } else {
        builder.append(a);
      }
    }
    
    System.out.println(builder.toString());
  }
}

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

int main(){
    int n,x;
    cin >> n >> x;
    vector<int> m(n);
    for(int i=0;i<n;i++){
        cin >> m[i];
    }
    sort(m.begin(),m.end());
    for(int i=0;i<n;i++){
        x-=m[i];
    }
    cout << n+x/m[0];
}


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


int main(){

	int n;  cin>>n;
	string s; int mx=0; int count=0; 
	cin>>s; 
	for(int i=0;i<n;i++){
		
		if(s[i]=='I') count++; 
		else count--; 
		mx=max(count,mx);
	}

	cout<<mx;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define p(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1<<25

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

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M;cin>>N>>M;
	int j=2;
	int ki=1;
	rep(i,M){
		ki*=2;
	}
	int ans=0;
	ans+=(1900*ki)*M;
	ans+=ki*100*(N-M);
	P(ans)
	return 0;
}



Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
//#include <boost/graph/graph_utility.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/trie_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;
 
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define bsort boost::sort::spreadsort::spreadsort
#define int int_fast64_t
using pii = pair<int,int>;
 
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
template <class Func>
 
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}
 
    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};
 
template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
 
template <typename T> using Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V> using Umap = gp_hash_table<K, V>;
using Trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
 
struct negrightshift {
    inline int operator() (const int &x, const unsigned offset) {
        return -(x >> offset);
    }
};
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	umap<string,int> mp;
	int sum = 0;
	rep(i,n){
		string s;
		cin >> s;
		sort(all(s));
		++mp[s];
		sum += mp[s]-1;
	}
	cout << sum << '\n';
	return 0;
}


Measured memory_bytes: 10228
## coding: UTF-8

N = int(input())
A = list(map(int,input().split()))
C = [format(i,'b') for i in A]
#print(C)


length = 0
for i in range(N):
    length = max(length, len(C[i]))
#print(length)


#30桁あればよし
even = [True] * 31 #後ろから考えます
for i in range(N):
    pivot = C[i]
    char = []
    for j in range(len(pivot)):
        char.append(pivot[j])
    char = char[::-1]
    for j in range(len(char)):
        if(char[j] == '1'):
            even[j] = not(even[j])
    #print(char)
    #print(even)


#print()
#print()

#print(C)
for i in range(N):
    pivot = C[i]
    ret = []
    #print(pivot, length-len(pivot))
    for j in range(length - len(pivot)):
        ret.append('0')
    for j in range(len(pivot)):
        ret.append(pivot[j])
    C[i] = (''.join(ret))
    #print(C)
#print(C)    





#print()
#print()

ans = []
for i in range(N):
    ret = []
    pivot = C[i]
    pivot = pivot[::-1]
    for j in range(length):
        if(even[j]):
            ret.append(pivot[j])
        else:
            if(pivot[j] == '0'):
                ret.append('1')
            else:
                ret.append('0')
    ret = ret[::-1]
    #print(pivot, ret)
    ans.append(int(''.join(ret), 2))
    #print(ans)
#print(ans)

for i in range(N):
    print(ans[i], end=' ')
print()







Measured memory_bytes: 131736
def main():
    import math
    x = int(input())
    n = 0
    while n == 0:
        tmp = 0
        #print(int(math.floor(math.sqrt(x)))+1)
        for i in range(2, int(math.floor(math.sqrt(x)))+1):
            if x % i == 0:
                tmp += 1
                break
        if tmp == 0:
            print(x)
            exit()
        x += 1
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 63036
import java.util.Scanner;
public class Main {
	public static void main(String []args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) {
			System.out.println("a == b");
		}else if(a>b){
			System.out.println("a > b");
		}else {
			System.out.println("a < b");
		}
	}
}



Measured memory_bytes: 26100
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int Q;
	scanf("%d",&Q);

	int a,b,c,d;
	int minus;

	for(int loop = 0; loop < Q; loop++){

		scanf("%d %d %d %d",&a,&b,&c,&d);

		minus = 0;

		for(int row = a; row <= c; row++){
			for(int col = b; col <= d; col++){
				if(row%2 == 1 && col%2 == 0)minus++;
			}
		}

		printf("%d\n",(c-a+1)*(d-b+1)-minus);
	}

	return 0;
}



Measured memory_bytes: 3216
#include <stdio.h>

int main()
{
    int a, b, t=0, c=0;
    scanf("%d %d", &a, &b);
    if(b == 1)
    {
        printf("0\n");
        return 0;
    }

    while(c<=b)
    {
        c += (a-1);
        t++;
        if(c+1>=b)
            break;
    }

    printf("%d\n", t);

    return 0;
}


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

int i;
int N, K, sum = 0;
int p[1010];

int main(){
    cin >> N >> K;
    for(i=1;i<=N;i++){
        cin >> p[i];
    }
    sort(p+1 , p+N +1);
    for(i=1;i<=K;i++){
        sum += p[i];
    }
    cout << sum <<endl;
    return 0;
}

Measured memory_bytes: 3624
/**
 *    author:  tourist
 *    created: 18.01.2020 23:18:35       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a > 0) {
    cout << "Positive" << '\n';
  } else {
    if (b < 0) {
      cout << ((b - a + 1) % 2 == 0 ? "Positive" : "Negative") << '\n';
    } else {
      cout << "Zero" << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 256