akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main(){
  ll n,pp=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='1')pp++;
  }
  ll a[n],b[n];
  a[0]=1%(pp+1);
  for(int i=1;i<n;i++){
    a[i]=(a[i-1]*2)%(pp+1);
  }
  if(pp-1>0){
    b[0]=1%(pp-1);
    for(int i=1;i<n;i++){
      b[i]=(b[i-1]*2)%(pp-1);
    }
  }
  ll xa=0,xb=0;
  for(int i=0;i<n;i++){
    if(s[n-1-i]=='1'){xa+=a[i];xa%=(pp+1);}
  }
  if(pp-1>0){
    for(int i=0;i<n;i++){
      if(s[n-1-i]=='1'){xb+=b[i];xb%=(pp-1);}
    }
  }
  for(int i=0;i<n;i++){
    ll nowx,npp,ans=1;
    if(s[i]=='0'){
      npp=pp+1;
      nowx=xa+a[n-1-i];nowx%=npp;
      if(nowx==0){cout<<1<<endl;continue;}
      npp=__builtin_popcount(nowx);
      while(nowx>0){
//        cout<<i<<" "<<nowx<<" "<<npp<<endl;
        nowx%=npp;
        npp=__builtin_popcount(nowx);
        ans++;
//        cout<<i<<" "<<nowx<<" "<<npp<<endl;
      }
    }
    else{
      npp=pp-1;
      if(npp==0){cout<<0<<endl;continue;}
      else{
        nowx=xb-b[n-1-i]+npp;nowx%=npp;
        if(nowx==0){cout<<1<<endl;continue;}
        ans--;
        while(nowx>0){
//          cout<<i<<" "<<nowx<<" "<<npp<<endl;
          nowx%=npp;
          npp=__builtin_popcount(nowx);
          ans++;
//          cout<<i<<" "<<nowx<<" "<<npp<<endl;
        }
      }
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 6828
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

int main()
{
	ll n,m;
	cin >> n >> m;
	
	vector<int> h(n);
	for(auto &x : h)
		cin >> x;
	
	vector<int> graph[n];
		
	for(ll i=0;i<m;i++){
		int a,b;
		cin >> a >> b;
		
		graph[a-1].push_back(b-1);
		graph[b-1].push_back(a-1);
	}
	
	ll ans = 0;
	for(ll i=0;i<n;i++){
		int f = 0;
		for(ll j=0;j<graph[i].size();j++){
			if( h[i] <= h[graph[i][j]]){
				f = 1;
				break;
			}
			//cout << graph[i][j] << " ";
		}
		
		if(!f){
			ans++;
			//cout << i+1;
		}
		//cout << endl;
	}
	
	cout << ans;
}




Measured memory_bytes: 8804
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    gcd(b,a%b);
}


void solve(){
    int n;
    cin >> n;

    int x = n/500;
    int y = (n - 500*x);

    int z = y/5;

    int ans = x*1000 + z*5;
    cout << ans << endl; 
 
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n, q;
    int i, j;
    int com[100000], x[100000], y[100000];
    int group[100000];
    int tmp;

    scanf("%d %d", &n, &q);
    for (i = 0; i < q; i++)
    {
        scanf("%d %d %d", &com[i], &x[i], &y[i]);
    }
    for (i = 0; i < n; i++)
    {
        group[i] = i;
    }

    for (i = 0; i < q; i++)
    {
        if (com[i] == 0) //unite
        {
            tmp = group[y[i]];
            for (j = 0; j < n; j++)
            {
                if (group[j] == tmp)
                {
                    group[j] = group[x[i]];
                }
            }
        }
        if (group[x[i]] == group[y[i]] && com[i] == 1)
        {
            printf("1\n");
        }
        else if (com[i] == 1)
        {
            printf("0\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

string A="Sunny";
string B="Cloudy";
string C="Rainy";

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

  if(S==A) cout<<B<<endl;
  else if(S==B) cout<<C<<endl;
  else cout<<A<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 2010
#define MOD 924844033
using namespace std;
typedef long long ll;
ll dp[MAXN][MAXN][2];
void prepare(){
	dp[0][0][0]=1;
	dp[0][0][1]=1;
	for(int i=1;i<=2000;i++)
		for(int j=0;j<=i;j++){
			dp[i][j][0]=dp[i-1][j][1];
			if(i>=1&&j>=1)
				dp[i][j][0]+=dp[i-1][j-1][0];
			dp[i][j][0]%=MOD;
			
			dp[i][j][1]=dp[i][j][0];
			if(i>=1&&j>=1)
				dp[i][j][1]+=dp[i-1][j-1][1];
			dp[i][j][1]%=MOD;
		}
}
int n,k;
ll sum[MAXN],fac[MAXN];
int main(){
	prepare();
	SF("%d%d",&n,&k);
	sum[0]=1;
	for(int i=1;i<=k*2&&i<=n;i++){
		int lenx=(n-i)/(k*2)+1;
		int fir=i-k;
		int las=(lenx-1)*k*2+i+k;
		int kd;
		if(fir>=1&&las<=n)
			kd=1;
		else if(fir>=1||las<=n)
			kd=0;
		else{
			kd=1;
			lenx--;
		}
		/*PF("%d:{%d %d (%d %d)}\n",i,lenx,kd,fir,las);
		for(int j=0;j<=lenx;j++){
			PF("[%d %lld]\n",j,dp[lenx][j][kd]);
		}*/
		for(int i=n;i>=0;i--)
			for(int j=1;j<=lenx&&i-j>=0;j++){
				sum[i]+=sum[i-j]*dp[lenx][j][kd];
				sum[i]%=MOD;
			}
		/*PF("now,sum:\n");
		for(int i=1;i<=n;i++)
			PF("{%d %lld}\n",i,sum[i]);
		PF("-----------\n");*/
	}
	fac[0]=1;
	for(int i=1;i<=n;i++)
		fac[i]=fac[i-1]*i%MOD;
	ll ans=0;
	for(int i=0;i<=n;i++){
		if(i%2==0)
			ans=(ans+sum[i]*fac[n-i])%MOD;
		else
			ans=(ans-sum[i]*fac[n-i])%MOD;
	}
	PF("%lld",(ans+MOD)%MOD);
}

Measured memory_bytes: 61312
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <cmath>
#include <numeric>
using ll = long long;
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a;
    int x;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    if (n % 2 == 0)
    {
        for (int i = 0; i < n / 2; i++)
        {
            ans -= 2 * a[i];
        }
        for (int i = n / 2; i < n; i++)
        {
            ans += 2 * a[i];
        }
        ans = ans - a[n / 2] + a[n / 2 - 1];
    }
    else if (n % 2 == 1)
    {
        //大きいのが多い方
        for (int i = 0; i < n / 2; i++)
        {
            ans -= 2 * a[i];
        }
        for (int i = n / 2; i < n; i++)
        {
            ans += 2 * a[i];
        }
        ans = ans - a[n / 2] - a[n / 2 + 1];
        //小さいのが多い方
        ll tmp_ans = 0;
        for (int i = 0; i < n / 2 + 1; i++)
        {
            tmp_ans -= 2 * a[i];
        }
        for (int i = n / 2 + 1; i < n; i++)
        {
            tmp_ans += 2 * a[i];
        }

        tmp_ans = tmp_ans + a[n / 2] + a[n / 2 - 1];

        ans = max(tmp_ans, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
int a,b;
long long d,n,x,y;
int main()
{
    cin>>a>>b;
    if (a>=9||b>=9)
        cout<<":(";
    else
        cout<<"Yay!";
        /*
    cin>>d>>n;
    if (d==0)
    {
        cout<<n;
    }
    else if (d==1)
    {
        cout<<100*n;
    }
    else
    {
        cout<<10000*n;
    }
    */
    return 0;
}


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

int main(void)
{
    long long int a,b,c,d,i,j,k,n,x[10];
    string s;
    char C[5];

    cin >> a >> b >> c;

    if(abs(a-b)<abs(a-c)) cout << "A";
    if(abs(a-b)>abs(a-c)) cout << "B";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define all(a)                      a.begin(), a.end()
#define pb                          push_back
#define ll							long long
#define index(a)            		order_of_key(a)
#define value(a)					find_by_order(a)
#define count_1 					__builtin_popcount
#define mod(x, m)					((((x) % (m)) + (m)) % (m))
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	
	for(int i=0;i<s.size();i++){
		for(int j=0;j<s.size();j++){
			if(s.substr(0,i)+s.substr(j)=="keyence")return cout<<"YES",0;
		}
	}
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
//void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }

const int DP_MAX = 60000;
const int OFFSET = DP_MAX / 2;
bool dp[80][80][DP_MAX];

int H, W;
int A[80][80];
int B[80][80];

signed main()
{
	cin >> H >> W;
	REP(y, H) REP(x, W) cin >> A[x][y];
	REP(y, H) REP(x, W) cin >> B[x][y];

	dp[0][0][abs(A[0][0] - B[0][0]) + OFFSET] = true;

	for (int x = 1; x < W; x++)
	{
		int sub = abs(A[x][0] - B[x][0]);
		for (int i = 0; i < DP_MAX; i++)
		{
			if (dp[x - 1][0][i])
			{
				dp[x][0][i - sub] = true;
				dp[x][0][i + sub] = true;
			}
		}
	}

	for (int y = 1; y < H; y++)
	{
		int sub = abs(A[0][y] - B[0][y]);
		for (int i = 0; i < DP_MAX; i++)
		{
			if (dp[0][y - 1][i])
			{
				dp[0][y][i - sub] = true;
				dp[0][y][i + sub] = true;
			}
		}
	}

	for (int x = 1; x < W; x++)
	{
		for (int y = 1; y < H; y++)
		{
			int sub = abs(A[x][y] - B[x][y]);

			for (int i = 0; i < DP_MAX; i++)
			{
				if (dp[x][y - 1][i])
				{
					dp[x][y][i - sub] = true;
					dp[x][y][i + sub] = true;
				}
				if (dp[x - 1][y][i])
				{
					dp[x][y][i - sub] = true;
					dp[x][y][i + sub] = true;
				}
			}
		}
	}

	int ans = INT_MAX;
	for (int i = 0; i < DP_MAX; i++)
	{
		if (dp[W - 1][H - 1][i])
		{
			int n = abs(i - OFFSET);
			ans = min(n, ans);
		}
	}
	cout << ans << endl;
}




Measured memory_bytes: 108128
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second

const int INF = 2e9 + 7;
const int MAXN = 2e5 + 7;

int f(pii p, int tp){
    if(tp==0)return p.x + p.y;
    else if(tp==1)return p.x - p.y;
    else if(tp==2)return -p.x + p.y;
    else return -p.x - p.y;
}

int main(){
    fastio; int n; cin>>n;
    int mx[4]; pii pmx[4];
    int mn[4]; pii pmn[4];
    for(int i=0; i<4; i++){
        mx[i] = -INF;
        mn[i] = INF;
    }
    for(int i=0; i<n; i++){
        int xi,yi; cin>>xi>>yi;
        pii p = {xi, yi};
        for(int j = 0; j<4; j++){
            if(f(p, j) > mx[j]){mx[j]=f(p,j); pmx[j]=p;}
            if(f(p, j) < mn[j]){mn[j]=f(p,j); pmn[j]=p;}
        }
    }
    int ans = -INF;
    for(int i=0; i<4; i++)ans = max(ans, mx[i] - mn[i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	for(int i=0;i<10050;i++){
		if((int)(i*0.08)==a&&(int)(i/10)==b){
			cout<<i;
			return 0;
		}
	}
	cout<<"-1";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
#include<utility>

using namespace std;

const int INFTY=(1<<30);
int n,s,t,w;
vector<pair<int,int>> A[100100];
queue<int> Q;
int d[100100];

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

void bfs(int s){
    Fill(d,INFTY);
    d[s]=0;
    Q.push(s);
    while(!Q.empty()){
        int cur=Q.front();
        Q.pop();
        for(int i=0;i<A[cur].size();++i){
            int next=A[cur][i].first;
            if(d[next]==INFTY){
                d[next]=d[cur]+A[cur][i].second;
                Q.push(next);
            }
        }
    }
}

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>s>>t>>w;
        A[s].push_back(make_pair(t,w));
        A[t].push_back(make_pair(s,w));
    }

    bfs(0);
    int lngst=0,remotest=0;

    for(int i=0;i<n;++i){
        if(d[i]==INFTY) continue; //グラフの連結性が保証されているなら不要な気がする
        if(d[i]>lngst){
            lngst=d[i];
            remotest=i;
        }
    }

    bfs(remotest);
    lngst=0;
    for(int i=0;i<n;++i){
        if(d[i]==INFTY) continue;
        if(d[i]>lngst) lngst=d[i];
    }

    cout<<lngst<<endl;
}


Measured memory_bytes: 9932
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
    return f?res:-res;
}
inline char readchar(){
	char ch=gc();
	while(isspace(ch))ch=gc();
	return ch;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int mod=998244353;
inline int add(int a,int b){return (a+b)>=mod?(a+b-mod):(a+b);}
inline int dec(int a,int b){return (a<b)?(a-b+mod):(a-b);}
inline int mul(int a,int b){static ll r;r=(ll)a*b;return (r>=mod)?(r%mod):r;}
inline void Add(int &a,int b){a=(a+b)>=mod?(a+b-mod):(a+b);}
inline void Dec(int &a,int b){a=(a<b)?(a-b+mod):(a-b);}
inline void Mul(int &a,int b){static ll r;r=(ll)a*b;a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
inline int fix(ll x){x%=mod;return (x<0)?x+mod:x;}
map<string,int> f,g;
char str[105];
inline int F(string s);
inline int G(string s){
	if(g.count(s))return g[s];
	if(s.size()==1)return s[0]-'0'+1;
	int res=0;
	for(int i=1;i<s.size();i++)if(s.size()%i==0){
		string t;
		for(int j=0;j<i;j++){
			int fg=1;
			for(int k=0;i*k<s.size();k++)
			fg&=s[i*k+j];
			t+=(char)(fg+'0');
		}
		Add(res,F(t));
	}return g[s]=res;
}
inline int F(string s){
	if(f.count(s))return f[s];
	int res=0;
	for(int i=0;i<s.size();i++)
	Add(res,mul(F(s.substr(0,i)),G(s.substr(i,s.size()-i))));
	return f[s]=res;
}
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	readstring(str);
	f[""]=1;
	string s=str+1;
	cout<<F(s)<<'\n';
	return 0;
}

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

int main()
{
	std::ios::sync_with_stdio(false);

    int n;
    cin>>n;
    int a[n+1];
    for(int i = 1;i <= n;i++)
    {
        int x;
        cin>>x;
        a[x] = i;
    }
    for(int i = 1;i <= n;i++)
    {
        cout<<a[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	const int mod = 998244353;
	int n; cin >> n;
	string s; cin >> s;
	
	vi type(3 * n), cnt(3);
	vector<vi> pos(n);
	rep(i, 3 * n){
		int x = s[i] == 'R' ? 0 : s[i] == 'G' ? 1 : 2;
		pos[cnt[x]++].pb(i);
		if(pos[cnt[x] - 1].size() == 3) rep(j, 3) type[pos[cnt[x] - 1][j]] = j;
	}
	//dbg(type);
	ll ans = 1;
	int c = 0;
	rep(i, 3 * n) if(type[i] < 2){
		if(type[i] == 1) ans = ans * c-- % mod;
		else c++;
	}
	for(int i = 3 * n - 1; i >= 0; i--) if(type[i] > 0){
		if(type[i] == 1) ans = ans * c-- % mod;
		else c++;
	}
	rep(i, n) ans = ans * (i + 1) % mod;
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7188
from math import ceil
n, h = map(int, input().split())
a_nums = []
b_nums = []
for _ in range(n):
    a, b = map(int, input().split())
    a_nums.append(a)
    b_nums.append(b)
a_nums = sorted(a_nums)
b_nums = sorted(b_nums)
cnt = 0
while h > 0:
    a = a_nums.pop()
    if b_nums:
        b = b_nums.pop()
        if b >= a:
            h -= b
        else:
            h -= a
        a_nums.append(a)
        cnt += 1
    else:
        cnt += ceil(h / a)
        break
print(cnt)

Measured memory_bytes: 12160
a=[0]*5
for i in range(5):
  a[i]=int(input())
k=int(input())
suc=True

for i in range(4):
  for j in range(i+1,5):
    if a[j]-a[i]>k:
      suc=False
      
if suc:
  print("Yay!")
else:
  print(":(")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}
int out(int a){cout << a << el; return 0;}
int out(string s = "NO"){cout << s << el; return 0;}
template <class T>
inline int out(vector<T>&v,string c = " "){
    for(int i = 0; i < v.size(); ++i){
        if(i) cout << c; cout << v[i];
    } cout << el;return 0;
}
constexpr int mod = 1e9 + 7;
template <class T> T modpow(T a, T b) {
    if (b == 0) return T(1);
    if (b % 2 == 0) {
        long long d = modpow(a, b / T(2));
        return (d * d) % mod;
    } else {
        return (a * modpow(a, b - 1) % mod );
    }
}class Prime{
public:
    vector<bool>Isprime;
    vector<int>prime;
    int size;
    Prime(int n) : Isprime(n+1,true),size(n+1){
        Isprime[0] = Isprime[1] = false;
        for(int i = 2; i<=size; i++){
            if(!Isprime[i])continue;
            prime.push_back(i);
            for(int j = 2;i*j <=size;j++) Isprime[i*j] = false;
        }
    }
    bool IsPrime(int n){return (n<=size? Isprime[n]:false);}
    int indexOf(int i){return (i<prime.size()?prime[i]:INF);}
};


signed main(){
    fast_io();
    int N;
    cin >> N;
    int ans = 1;
    constexpr int mod = 1e9 + 7;
    map<int,int>memo;
    auto P = Prime(1e3 + 1);
    for(int i = 2; i <= N; ++i){
        for(const auto p : P.prime){
            if(p > i) break;
            int cnt = 0;
            int ti = i;
            while(ti % p == 0){
                cnt++; ti /= p;
            }
            memo[p] += cnt;
        }
    }
    for(auto itr : memo)
        ans *= (itr.second + 1), ans %= mod;
    
    out(ans);
}




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

int main(){
    int n;
    int m = 0;
    int b = 0;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n-1){
        if(a[i+1] <= a[i]){
            b++;
        }else{
            if(m < b) m = b;
            b = 0;
        }
    }
    if(m < b) m = b;
    cout << m << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int bubbleSort(int A[], int N) {
    int c = 0;
    bool flag = true;

    for (int i = 0; flag; i++) {
        flag = false;
        for (int j = N-1; j >= i+1; j--) {
            if (A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                flag = true;
                c++;
            }
        }
    }
    return c;
}

int main()
{
    int A[101];
    int N;

    while (cin >> N) {

        if (N == 0)
            break;

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

        cout << bubbleSort(A, N) << endl;
    }

    return 0;
}

Measured memory_bytes: 3000
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

int dp[100001];
int dp2[100001];

bool check(int a){
    for(int i = 2; i < a; i++){
        if(i > a){
            break;
        }
        if(a % i == 0){
            dp[a] = 0;
            return dp[a];
        }
    }
    dp[a] = 1;
    return dp[a];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    memset(dp, 0, sizeof(dp));
    
    dp[1] = 0;
    dp[2] = 1;
    for(int i = 3; i <= 100000; i+=2){
        check(i);
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i] = dp[i] && dp[(i+1)/2];
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i+1] += dp2[i];
    }
    
    //return 0;
    int Q;
    cin >> Q;
    REP(i, Q){
        int l, r;
        cin >> l >> r;
        cout <<  dp2[r] - dp2[l-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
N = gets.to_i
T, A = [], []
N.times{t, a = gets.split.map(&:to_i); T << t; A << a}

votes = (0 ... N).inject([0, 0]) do |(t, a), i|
  if T[i] >= t && A[i] >= a
    [T[i], A[i]]
  else
    m = [(t + T[i] - 1)/T[i], (a + A[i] - 1)/A[i]].max
    [m*T[i], m*A[i]]
  end
end
puts votes.inject(:+)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<int> cnt(1000001, 0);
  for (int i = 0; i < N; i++){
    cnt[A[i]]++;
  }
  bool ok_pair = true;
  for (int i = 2; i <= 1000000; i++){
    int sum = 0;
    for (int j = i; j <= 1000000; j += i){
      sum += cnt[j];
    }
    if (sum >= 2){
      ok_pair = false;
    }
  }
  int g = A[0];
  for (int i = 1; i < N; i++){
    g = gcd(g, A[i]);
  }
  if (ok_pair){
    cout << "pairwise coprime" << endl;
  } else if (g == 1){
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }
}

Measured memory_bytes: 11164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int m;
  for (int i = 0; i < (s.size() - 2); i++) {
    string a = s.substr(i, 3);
    int j = stoi(a);
    if (i == 0 || abs(753 - j) < m) {m = abs(753 - j);}
  }
  cout << m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	vector<string>vec(N);
	rep(i, N) {
		cin >> vec[i];
	}
	
	int A = 0;
	int B = 0;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (vec[i] == vec[j]) {
				B = B + 1;
			}
		}
	}

	if (B == N) {
		for (int i = 0; i < N - 1; i++) {
			if (vec[i].back() == vec[i + 1].at(0)) {
				A = A + 1;
			}
			else {
				A = 101;
			}
		}
	}
	else {
		A = 101;
	}


	if (A == N - 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;

int main(){
    string s,t;
    cin>>s>>t;
    vector<vector<int>> ms(26);
    for (int i = 0; i < s.size(); ++i) {
        ms[s[i]-'a'].emplace_back(i);
    }
    int ind=0;
    long long ans=0;
    long long sind=-1;
    while(ind<t.size()){
        sind=-1;
        while(ind<t.size()){
            if(ms[t[ind]-'a'].size()==0){
                cout<<-1<<endl;
                return 0;
            }
            auto itu=upper_bound(ms[t[ind]-'a'].begin(),ms[t[ind]-'a'].end(),sind);
            if(itu==ms[t[ind]-'a'].end())break;
            else {
                ++ind;
                sind=*itu;
            }
        }
        if(ind<t.size())++ans;
    }
    cout<<s.size()*ans+sind+1<<endl;
    return 0;
}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  string d[4] = {"maerd", "remaerd", "esare", "resare"};

  string s;
  cin >> s;

  reverse(all(s));

  for(int i = 0; i < s.size();) {
    bool ok = false;
    rep(j, 0, 4) {
      if(d[j] == s.substr(i, d[j].size())) {
        ok = true;
        i += d[j].size();
        break;
      }
    }
    if(!ok) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}


Measured memory_bytes: 512
# coding: utf-8
# Your code here!
import copy
S=list(input())
N=len(S)
point=0
hand=copy.deepcopy(S)
panum=sum([j=="p" for j in hand])
pamax=N//2#ポイントの上限
pa=0
for i in range(N):
    if S[i]=="g" and pa<(i+1)//2 and point<pamax-panum:
        hand[i]="p"
        point+=1
    if point>=pamax-panum:
        break
    if hand[i]=="p":
        pa+=1
print(point)

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

bitset<8> adj[8];
int n, m;

int dfs(int node, bitset<8> visited){
    bool complete = true;
    if(visited.count() == n)
        return 1;
    int total = 0;
    for(int i = 0; i < n; ++i){
        if(adj[node][i] == 0) continue;
        if(visited[i]) continue;
        visited[i] = 1;
        total += dfs(i, visited);
        visited[i] = 0;
    }
    return total;
}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> n >> m;

    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        adj[a - 1][b - 1] = adj[b - 1][a - 1] = 1;
    }

    bitset<8> visited;
    visited[0] = 1;

    cout << dfs(0, visited);

    return 0;
}


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

ans = 0
for i in range(n):
    if a[i] <=  b[i]:
        ans += a[i]
        b[i] -= a[i]
    else:
        ans += b[i]
        b[i] = 0
    if b[i] > 0:
        if a[i+1] > b[i]:
            ans += b[i]
            a[i+1] -= b[i]
        else:
            ans += a[i+1]
            a[i+1] = 0
print(ans)

Measured memory_bytes: 18624
#include<stdio.h>
int main()
{
    char s[100];
    scanf("%s",s);
    int i,d,j,k=3;
    d=strlen(s);
        for(i=1;i<d;i++){
            for(j=0;j<d;j++){
                if(s[i]==s[j]&&i!=j){
                    printf("no\n");
                    return 0;
                }
            }
        }
        printf("yes\n");
        return 0;
}


Measured memory_bytes: 1624
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define rep1(i,s,e) for(int i=s;i<e;i++)
#define rep2(i,s,e,c) for(int i=s;i>=e;i--)
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define pfn() printf("\n")
#define pfs() printf(" ")
#define sfi(x) scanf("%d",&x)
#define sfi1(x,y) scanf("%d%d",&x,&y)
#define sff(x) scanf("%lf",&x)
#define sfl(x) scanf("%lld",&x)
#define memset1(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
const int MAX = 1e4 + 50;
const int mod = 996873654;
int main(){
	int a,b,i;
	cin>>a>>b;
	for(i=0;i<=20;i++){
		int cnt=i*a-i+1;
		if(cnt>=b){
			break;
		}
	}
	cout<<i;
	return 0;
}

Measured memory_bytes: 256
//Shubham Vijayvargiya

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#define sz(a) (int)(a.size())
#define set(a,b) memset(a,b,sizeof(a))
#define let(x,a) __typeof(a) x(a)
#define rep(i, begin, end) for (ll i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) (v).begin(),(v).end()
#define sll(x) { scanf("%lld",&x); }
#define si(x) { scanf("%d",&x); }
#define slf(x) { scanf("%lf",&x); }
#define pll(x) { printf("%lld\n",x); }
#define pi(x) { printf("%d\n",x); }
#define tcases() long long testcases; cin>>testcases ; while(testcases--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << std::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

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<long long,long long> pll;
typedef vector<long long> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

const ll mod=1000000007;
//-----------------------------------------------------------------------------------------------------------------------------------------------//

ll a[100009];

int main()
{
//	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll n,c,k;
	cin>>n>>c>>k;
	rep(i,0,n){
		sll(a[i]);
	}

	sort(a,a+n);
	ll i=0;
	ll buses=0;
	while(i<n){
		buses++;
		ll t=a[i];
		ll cnt=1;
		i++;
		while(i<n && a[i]<=t+k && cnt<c){
			i++;
			cnt++;
		}
	}
	cout<<buses<<endl;
	return 0;
}



Measured memory_bytes: 1024
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    let a = new Set()
    while(hasNext()){
        a.add(nextInt())
    }
    let dp = {}
    dp[0] = 1n
    if(a.has(1)) dp[1] = 0n
    else dp[1] = 1n
    for(let i = 2;i<=N; i++){
        if(a.has(i)) dp[i] = 0n
        else {
            dp[i] = dp[i-1] + dp[i-2]
        }        
    }
    console.log(Number(dp[N] % 1000000007n))
}
Main()


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

int main(){
  int A, B;
  cin >> A >> B;
  int n1, n2, n3, n4, n5;
  int Ans=0;
  for(int i=A; i<=B; i++){
    n1=i/10000;
    n2=i/1000-10*n1;
    n3=i/100-n2*10-n1*100;
    n4=i/10-n3*10-n2*100-n1*1000;
    n5=i-n4*10-n3*100-n2*1000-n1*10000;
    if(n1==n5 && n2==n4){
      Ans++;
    }
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#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)

int k,a,b; 

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

    cin>>k>>a>>b;
    int i=1;
    while(1){
        if(k*i>b){
            cout<<"NG"<<endl;
            break;
        }
        if(k*i<=b&&k*i>=a){
            cout<<"OK"<<endl;
            break;
        }else{
            i++;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MOD = 1e9 + 7;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}



void get_treeinfo(int now, int from, vector<vector<int>> &edges, vector<int> &parent, vector<vector<int>> &children){
    parent[now] = from;
    for(auto to: edges[now]){
        if(to == from)
            continue;
        children[now].push_back(to);
        get_treeinfo(to, now, edges, parent, children);
    }
}

int power(int n, int p)
{
    if (p == 0)
        return 1;
    long long res = 1;
    long long add = n;
    while (p > 0)
    {
        if (p & 1)
            res = (res * add) % MOD;
        p >>= 1;
        add = add*add%MOD;
    }
    return res;
}


ll permutation(int n, int r, vector<ll> &perm, vector<ll> &inv){
    if(n < r || n < 0)
        return 0;
    return perm[n] * inv[n-r] % MOD;
}

void recur(int now, vector<vector<int>> &children, ll &ans, int k, vector<ll> &perm, vector<ll> &inv){
    int cnt = children[now].size();
    int cand = (now == 0 ? (k-1):(k-2));
    ans = (ans * permutation(cand, cnt, perm, inv)) % MOD;
    for(auto child: children[now])
        recur(child, children, ans, k, perm, inv);
}

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

    vector<vector<int>> edges(n);
    vector<vector<int>> children(n);
    vector<int> parent(n);
    parent[0] = -1;
    REP(i, n-1){
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    get_treeinfo(0, -1, edges, parent, children);
    
    vector<ll> perm(k+1);
    vector<ll> inv(k+1);
    perm[0] = 1;
    inv[0] = 1;
    IFOR(i, 1, k){
        perm[i] = (perm[i-1] * i) % MOD;
        inv[i] = power(perm[i], MOD-2);
    }


    ll ans = 1;

    recur(0, children, ans, k, perm, inv);

    ans = (ans * k) % MOD;
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 18560
#include <iostream>
using namespace std;
int a, b;
int	main(){
	cin >> a;
	cin >> b;
	if (a < b)
	cout << "a " << '<' <<" b" <<endl;
	else if (a > b)
cout << "a " << '>' <<" b"<<endl;
else
	cout << "a " << "==" <<" b" <<endl;
	return 0;
}


Measured memory_bytes: 3068
N=int(input())
e=[0]*(N+1)
for i in range(2,N+1):
    cur=i
    for j in range(2,i+1):
        while cur%j==0:
            e[j]+=1
            cur//=j

def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

Measured memory_bytes: 3064
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Measured memory_bytes: 6724
#!python3.4.3

n, m = map(int, input().split(' '))

penalty = [0 for _ in range(n)]
result = [0 for _ in range(n)]

for i in range(m):
    p, s = input().split(' ')
    p = int(p)
    if s == 'AC':
        result[p-1] = 1
    elif s == 'WA' and result[p-1] != 1:
        penalty[p-1] += 1
    
penalty = [x * y for (x, y) in zip(penalty, result)]

print(sum(result), sum(penalty))


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

int main(){
    string S;
    cin >> S;
    
    int ans = 0;
    rep(i, 3){
        if (S[i] == 'R'){
            ans++;
        }
    }

    if (S == "RSR"){
        ans = 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
use proconio::input;

fn main() {
    input! {
        k: usize,
        a: usize,
        b: usize,
    }

    solve(k, a, b);
}

fn solve(k: usize, a: usize, b: usize) {
    for i in a..(b + 1) {
        if i % k == 0 {
            println!("OK");
            return;
        }
    }
    println!("NG");
}


Measured memory_bytes: 2148
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s;

    cin >> s;

    ll ans = 0;
    ll res = 0;

    for (int i = 0; i < s.size(); i++)
    {
        if (s[i]=='A'||s[i]=='G'||s[i]=='T'||s[i]=='C')
        {
            res++;
        }
        else
        {
            res = 0;
        }

        ans = max(ans, res);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
# D = list(map(int,input().split()))
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]

print((n - 1) * (m - 1))


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

int main() {
  int h,n;
  cin >> h >> n;
  vector<int> vec(n);
  for( int i = 0; i < n; i++ ){
    cin >> vec.at(i);
  }
  int sum = 0;
  for( int k = 0; k < n; k++ ){
    sum += vec.at(k);
  }
  if( h <= sum ){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  unordered_map<int, int> mp;
  REP(i, n) {
    int x;
    cin >> x;
    mp[x] += 1;
  }
  int two_cards = 0;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    if (itr->second % 2 == 0) two_cards++;
  }
  cout << mp.size() - (two_cards % 2) << endl;
}

Measured memory_bytes: 7144
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
 	if(D ==25){
	System.out.println("Christmas");
    }else if(D ==24){
	System.out.println("Christmas Eve");      
    }else if(D ==23){
	System.out.println("Christmas Eve Eve");
    }else if(D ==22){
	System.out.println("Christmas Eve Eve Eve");
    }
}
    }

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

string s;
vector<long long> v;

long long solve();
bool ch(long long k);

int main() {
  cin >> s;

  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 10000000000;
  for(int i = 0; i < s.size(); ++i) {
    long long cnt = 1;
    while(i + 1 < s.size() && s[i] == s[i + 1]) ++cnt, ++i;
    v.push_back(cnt);
  }
  for(int i = 1; i < v.size(); ++i) v[i] += v[i - 1];
  for(int i = 0; i < v.size(); ++i)
    ans = min(ans, max(v[i], (long long)s.size() - v[i]));
  return ans;
}

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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] SP; } cout BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout BR;

const ll MAX = 1e5+5;
ll N, M;
vector<ll> G[MAX];
vector<ll> visit(MAX, 0);
vector<ll> cnt(MAX, 0);
vector<pair<ll, ll>> edges;
set<pair<ll, ll>> rev;

int dfs(ll now, ll prev) {
  visit[now] = 1;
  for (ll i : G[now]) {
    if (visit[i]) continue;
    dfs(i, now);
  }

  if ( cnt[now] % 2 != 0 ) {
    cnt[now]++;
    cnt[prev]++;
    rev.insert({now, prev});
    rev.insert({prev, now});
    // cout << SP << now << SP << prev << BR;
  }
  return 0;
}

int ans() {
  for (auto e: edges) {
    if ( rev.find(e) != rev.end() ) {
      cout << e.second << SP << e.first << BR;
    } else {
      cout << e.first << SP << e.second << BR;
    }
  }
  return 0;
}

int main() {
  ll a, b;
  cin >> N >> M;

  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
    cnt[a]++;
    edges.push_back({a, b});
  }
  if ( M % 2 == 1 ) {
      cout << "-1\n";
      return 0;
  }

  dfs(a, 0);
  ans();

  return 0;
}

Measured memory_bytes: 22512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main() {
  string s;
  cin>>s;
  ll ans=0;
  for(int i=0;i<4;i++)ans+=(s[i]=='+'?1:-1);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n;
	int a[4],i,j,cnt,b,c,d;
	scanf("%d",&n);
	for(i=0;i<4;i++){
		a[i]=0;
	}
	b=n%1000;
	c=b%100;
	d=c%10;
	for(i=0;i<4;i++){
		a[0]=n/1000;
		a[1]=b/100;
		a[2]=c/10;
		a[3]=d;
	}
	if(a[0]==a[1]&&a[0]==a[2]||a[1]==a[2]&&a[1]==a[3]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



using namespace std;





int main() {
  string s; cin>>s;
  string d = "coffee";
  if(s[2] == s[3] and s[4] == s[5] ) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (i=a;i<n;i++)
#define per(i,a,n) for (i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE 1000001
#define ONLINE_JUDGE
#define rd
#define PI acos(-1)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
auto clk=clock(); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;

bitset<SIZE> vis;

vector<int> adj[SIZE];
vector<int> col;

int main(){
	double r;
	cin>>r;
	cout << fixed << setprecision(2) << PI*2*r;
	return 0;
}

Measured memory_bytes: 27268
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define pii pair <int,int>
#define vpii vector< pair<int,int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	string s, t;
	cin >> s >> t;
	string ans = t + s;
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <iomanip>
#define int long long
#define endl "\n";
#define debug(x) cout << #x << " is " << x << endl;
using namespace std;
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
void solve() {
	int n, m, u, v;
	cin >> n >> m;
	vector <vector <int>> a(n + 1);
	for (int i = 0; i < m; ++i) {
		cin >> u >> v;
		a[u].push_back(v);
		a[v].push_back(u);
	}
	vector <int> ans(n + 1); vector <bool> used(n + 1, false); used[1] = true;
	queue <int> q;
	q.push(1);
	while (q.size()) {
		v = q.front(); q.pop();
		//debug(v);
		for (auto u : a[v]) {
			if (used[u]) continue;
			used[u] = true;
			ans[u] = v;
			q.push(u);
		}
	}
	for (int i = 2; i <= n; ++i) {
		if (!ans[i]) { cout << "No"; return; }
	}
	cout << "Yes\n";
	for (int i = 2; i <= n; ++i){
		cout << ans[i] << endl;
	}
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(15);
	int t;
	t = 1;
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 12948