akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

char field[50][50];
bool checked[2][50][50];
int w, h;

void fill( int x, int y, int t ) {
	checked[t][y][x] = true;
	if( 0<=y-1 && !checked[t][y-1][x] && field[y-1][x]=='.' ) {
		fill( x, y-1, t );
	}
	if( y+1<h && !checked[t][y+1][x] && field[y+1][x]=='.' ) {
		fill( x, y+1, t );
	}
	if( 0<=x-1 && !checked[t][y][x-1] && field[y][x-1]=='.' ) {
		fill( x-1, y, t );
	}
	if( x+1<w && !checked[t][y][x+1] && field[y][x+1]=='.' ) {
		fill( x+1, y, t );
	}
}

int main() {
    init();
	while( cin >> w >> h, w||h ) {
		memset( field, 0, sizeof(field) );
		memset( checked, 0, sizeof(checked) );
		rep(y, h) {
			rep(x, w) {
				cin >> field[y][x];
			}
		}
		rep(y, h) {
			rep(x, w) {
				if( field[y][x] == 'W' ) {
					fill( x, y, 0 );
				} else if( field[y][x] == 'B' ) {
					fill( x, y, 1 );
				}
			}
		}
		int cntW=0, cntB=0;
		rep(y, h) {
			rep(x, w) {
				if( field[y][x]=='.' && checked[0][y][x] && !checked[1][y][x] )
					cntW++;
				if( field[y][x]=='.' && checked[1][y][x] && !checked[0][y][x] )
					cntB++;
			}
		}
		cout << cntB << ' ' << cntW << endl;
	}
	return 0;
}

Measured memory_bytes: 1312
//
// Created by swift on 2020/8/2.
//

#include<bits/stdc++.h>
using namespace std;
int k,bas=7,ans=1;
int main(){
    cin>>k;
    bas%=k;
    while(bas!=0){
        bas*=10;
        bas+=7;
        bas%=k;
        ans++;
        if(ans>=10000000){
            puts("-1");
            return 0;
        }
    }
    cout<<ans<<endl;
    return 0;
}
//7777777777777777777
//7*111111

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

int main() {
  string s;
  cin >>s;
  
  string s1=s.substr(0,1), s2=s.substr(1,1), s3=s.substr(2,1);
  
  //cout <<s1<<s2<<s3;
  
  string ans;
  if (s1 ==s2 && s2==s3){
    ans ="No";
  }else{
    ans="Yes";
  }
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include <iostream>


int main(){
	
	int a;
	int b;
	int c;
	int tmp;
	std::cin>>a>>b>>c;
	tmp = a;
	a = b;
	b = tmp;
	
	tmp = a;
	a = c;
	c = tmp;
	
	std::cout<<a<<' '<<b<<' '<<c;
	
	
	return 0;
	}


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

int N;
set<int> ret[100000], zero;

int calc_k(int N){
    for(int i = 1; i <= 2 * N; i++){
        if(i * (i - 1) == 2 * N){
            return i;
        }
    }
    return -1;
}

int main(){

    cin >> N;
    int k = calc_k(N);

    if(k == -1){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    cout << k << endl;
    for(int i = 1; i <= N; i++){
        zero.insert(i);
    }

    for(int i = 0; i < k; i++){
        cout << k - 1;
        for(int j = 0; j < i; j++){
            cout << ' ';
            auto it = ret[j].begin();
            cout << *it;
            ret[j].erase(*it);
        }
        for(int j = 0; j < k - 1 - i; j++){
            cout << ' ';
            auto it = zero.begin();
            cout << *it;
            ret[i].insert(*it);
            zero.erase(*it);
        }
        cout << endl;
    }
}

Measured memory_bytes: 10752
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,ans=0;
    string des,no;
    cin>>n>>des;
    while(n--){
        cin>>no;
        for(int i=0;i<no.length();i++){
            if(no[i]!=des[0]) continue;
            for(int j=1;j<100;j++){
                int te=1;
                for(int k=0;k<des.length();k++)
                    if(k<des.length() && (i+j*k)<no.length()){
                        if(des[k]!=no[i+j*k]){
                            te=0;
                            break;
                        }
                    }else te=0;
                if(te==1){
                    ans++;
                    goto next;
                }
            }
        }
    next:;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#include<iomanip>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define KETA 40

using namespace std;

typedef long long  ll;
typedef pair<ll,ll> P1;
typedef pair<string,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<Pi,int> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n;
	ll h[100001];
	cin>>n;

	rep(i,n){
		cin>>h[i];
	}

	for(int i=n-1; i>0; i--){
		if(h[i]-h[i-1]<0)h[i-1]--;
		if(h[i]-h[i-1]<0){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

	return 0;

}


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

int main(){

	int n, m;
	char c1, c2;

	while(cin >> n){
		if(n == 0) break;

		map<char, char> mp;
		for(int i=0; i<n; i++){
			cin >> c1 >> c2;
			mp.insert(make_pair(c1, c2));
		}
		for(int i=0; i<10; i++){
			mp.insert(make_pair('0'+i, '0'+i));
		}
		for(int i=0; i<26; i++){
			mp.insert(make_pair('A'+i, 'A'+i));
			mp.insert(make_pair('a'+i, 'a'+i));
		}
		
		cin >> m;
		for(int i=0; i<m; i++){
			cin >> c1;
			cout << mp[c1];
		}
		cout << endl;
		
	}

	return 0;

}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // input part

    int a,b;
    cin >> a >> b;

    int ans = (b-1)/(a-1);
    if ((b-1)%(a-1)!=0) ans++;
    cout << ans << endl;
}


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

int main()
{
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    if (w / 2 == x && h / 2 == y)
        cout << w * h / 2 << " " << 1 << endl;
    else
        cout << w * h / 2 << " " << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
const int N=1111;
char S[N];
int c[N],pw[22];
int a[22][N],sum[22][N];
int n,m,tot,k;
int calc(int x){
	int sum=0;
	for (int i=x; i; i/=2)	sum=sum+(i%2==1);
	return sum;
}
int get(int xx,int xy,int yx,int yy){
	return sum[yx][yy]-sum[yx][xy-1]-sum[xx-1][yy]+sum[xx-1][xy-1];
}
int check(int pre,int point){
	for (int i=1; i<=tot; i++)
		if (get(c[i-1]+1,pre,c[i],point)>k)	return 0;
	return 1;
}
int solve(int st){
	tot=0;
	for (int i=1; i<n; i++)	
		if (st&pw[i])	c[++tot]=i;
	c[++tot]=n;
	int pre=1,point=1,cnt=0;
	while (1){
		while (point<=m&&check(pre,point))	point++;
		if (point==m+1)	return cnt;
		if (point==pre)	return -1;
		pre=point;
		cnt++;
	}
	return -1;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1; i<=n; i++){
		scanf("%s",S+1);
		for (int j=1; j<=m; j++)
			a[i][j]=S[j]-'0';
	}
	for (int i=1; i<=n; i++)
		for (int j=1; j<=m; j++)
		sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
	for (int i=1; i<=n+1; i++)
		pw[i]=1<<(i-1);
	int ans=1e9;
	for (int i=0; i<pw[n]; i++){
		int g=solve(i);
		if (g!=-1)	ans=min(ans,g+calc(i));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws IOException {
       Scanner in = new Scanner(System.in);
       int a = in.nextInt();
       int b = in.nextInt();
       int c = in.nextInt();
       if(a < b && b < c) System.out.println("Yes");
       else System.out.println("No");
    }
}

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

typedef long long LL;
typedef long long ll;
typedef unsigned long long ULL;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)

#define PB push_back
#define INT(n) int n;scanf("%d",&n)
#define VI(v,n) vector<int> v(n);REP(i,n){scanf("%d",&v[i]);}
#define MSET(arr,val)  memset(arr,val,sizeof(arr))

int main(){
  INT(N); INT(C); INT(K); VI(Ts, N);
  int ans = 0, cnt = 0;
  sort(Ts.begin(), Ts.end());
  LL t = Ts[0] + K;
  FOR(it, Ts){
    if (cnt == 0){
      t = *it + K;
    }
    if (*it <= t){
      cnt++;
      if (cnt == C){
        ans++;
        cnt = 0;
      }
    }
    else {
      ans++;
      t = *it + K;
      cnt = 1;
    }
  }
  if (0 < cnt){ans++;}
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String c = sc.next();

        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        char result = alphabet.charAt(alphabet.indexOf(c) + 1);

        System.out.println(result);

        sc.close();
    }
}


Measured memory_bytes: 21972
#include <stdio.h>

int main(void) {
	int W, H, x, y, r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H)
	printf("Yes\n");
	else
	printf("No\n");
	
	return 0;
}

Measured memory_bytes: 1012
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
a << 10 ** 6
b = [0, 0, 0]
before = nil
max = 0
a.sort.each_with_index { |v, i|
  if v != before
    sum = b.inject(:+) || 0
    max = sum if sum > max
    if before != nil
      (v - before - 1).times {
        b.shift
        b << 0
      }
    end
    b.shift
    b << 1
    before = v
  else
    b[-1] += 1
  end
}

puts max


Measured memory_bytes: 12016
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
bool isPrime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}
 
signed main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
    	vector<int>v;
    	for(int i=2;i<100005;i++)
    	{
    		if(isPrime(i))
    			v.pb(i);
    	}
    	int x;
    	cin>>x;
    	int j=lower_bound(v.begin(),v.end(),x)-v.begin();
    	cout<<v[j];
    }
	return 0;
}
  

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    int dy = 399;
    int t = 0;
    int size = 9;
    vector<int> t1 = {1,400,800,1200,1600,2000,2400,2800,3200};
    vector<int> t2 = {399,799,1199,1599,1999,2399,2799,3199,5000};
    int cnt[9] = {};

    for (int i = 0; i < N; i++){
        for (int k = 0; k < size; k++){
            if (t1[k] <= a[i] && a[i] <= t2[k]){
                cnt[k]++;
            }
        }
    }

    int minN = 0;
    for (int i = 0; i < 8; i++){
        if (cnt[i] != 0){
            minN++;
        }
    }

    int maxN = minN + cnt[8];
    if (cnt[8] == N){
        minN = 1;
        maxN = cnt[8];
    }

    cout << minN << ' ' << maxN << endl;





    


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

#define rep_1(i,n) for(int i=n;i>0;i--)
#define rep_2(i,n) for(int i=n;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

long long dp[10][1001];

int main()
{
	int n,s;
	while(cin >> n >> s)
	{
		if(n == 0 && s == 0) break;

		memset(dp,0,sizeof(dp));
		dp[0][0] = 1;
		rep(k,101)
		{
			rep_2(j,s)
			{
				rep_1(i,n)
				{
					if(j >= k)
					{
						dp[i][j] += dp[i-1][j-k];
					}
				}
			}
		}

		cout << dp[n][s] << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

int main() {
    int n;
    cin >> n;
    V<pair<int, pair<string, int>>> sp(n);
    for (int i = 0; i < n; ++i) {
        sp[i].first = i + 1;
        cin >> sp[i].second.first >> sp[i].second.second;
    }

    sort(sp.begin(), sp.end(), [](pair<int, pair<string, int>> a, pair<int, pair<string, int>> b) {
        if (a.second.first == b.second.first) return a.second.second > b.second.second;
        else return a.second.first < b.second.first;
    });

    for (int i = 0; i < n; ++i) {
        cout << sp[i].first << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long int ll;

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

  int n, k, c;
  string s;
  cin >> n >> k >> c >> s;
  vector < int > l, r;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'o' && l.size() < k) {
      l.push_back(i);
      i += c;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o' && r.size() < k) {
      r.push_back(i);
      i -= c;
    }
  }
  reverse(r.begin(), r.end());
  for (int i = 0; i < l.size() && i < r.size(); i++) {
    if (l[i] == r[i]) cout << l[i] + 1 << endl;
  }
}


Measured memory_bytes: 5740
parseInt(s)=parse(Int,s)
MOD=10^9+7
N,a,b=parseInt.(split(readline()))

f=let
    A=1
    for i in 1:a
        A*=((N-i+1)*invmod(i,MOD))%MOD
        A%=MOD
    end
    B=A
    for i in a+1:b
        B*=((N-i+1)*invmod(i,MOD))%MOD
        B%=MOD
    end
    (powermod(2,N,MOD)-1-A-B+3MOD)%MOD
end

print(f)

Measured memory_bytes: 180444
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, ans = 0, frb = 0, baa = 0, ba = 0;
	cin >> nn;
	string ss;
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> ss;
		for(int64 jj = 0;jj < ss.length() - 1;jj++)
		{
			if(ss.substr(jj, 2) == "AB")
			{
				ans++;
			}
		}
		if(ss[0] == 'B' && ss[ss.length() - 1] == 'A')
		{
			ba++;
		}
		else if(ss[0] == 'B')
		{
			frb++;
		}
		else if(ss[ss.length() - 1] == 'A')
		{
			baa++;
		}
	}
	int64 tmp = frb + baa;
	if(tmp == 0)
	{
		cout << (ans + (int64)max((int64)0, ba - 1)) << endl;
	}
	else
	{
		if(ba == 0)
		{
			cout << (ans + (int64)min(frb, baa)) << endl;
		}
		else
		{
			cout << (ans + ba + (int64)min(frb, baa)) << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

    int a[n], b[n], c[m], d[m];
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }

    for (int i = 0; i < m; ++i) {
        cin >> c[i] >> d[i];
    }

    for (int i = 0; i < n; ++i) {
        int minDist = abs(a[i] - c[0]) + abs(b[i] - d[0]);
        int ans = 0;
        for (int j = 1; j < m; ++j) {
            int tmpDist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (tmpDist < minDist) {
                minDist = tmpDist;
                ans = j;
            }
        }
        cout << ans + 1 << endl;
    }
    return 0;
}


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

int main(){
    ll n;
    cin >> n;
    ll ans;
    for(ll i=sqrt(n); i>0; i--){
        ll tmp=n/i;
        if(tmp*i==n){
            ans=tmp+i-2;
            break;
        }
    }
    cout << ans << endl;
}

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

#define __sel(_1, _2, x, ...) x

#define repn(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) __sel(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (ll i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (ll i = (b - 1); i >= (a); i--)
#define rrep(i, ...) __sel(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x))
#define umin(m, x) (m = min(m, x))
#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()
#define bit(x, n) ((x) >> (n) & 1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define pt(x) cout << (x) << endl;
#define ptv(v) for (auto __t1 : v) cout << __t1 << " "; cout << endl;
#define ptl(v) for (auto __t1 : v) cout << __t1 << endl;
#define shv(v) for (auto __t1 : v) cerr << __t1 << " "; cerr << endl;
#define db(x) cerr << #x << ": " << (x) << endl;
#define dbv(v) cerr << #v << ": "; shv(v);
#define dbm(m) cerr << #m << ":" << endl; for (auto __t2 : m) { shv(__t2); }

using namespace std;

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

using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vld = vector<ld>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
using vvld = vector<vector<ld>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

inline int gi() { int x; cin >> x; return x; }
inline ll gl() { int x; cin >> x; return x; }
inline char gc() { char x; cin >> x; return x; }
inline string gs() { string x; cin >> x; return x; }
inline int ni() { return gi() - 1; }
inline ll nl() { return gl() - 1; }

inline vi gvi(int n) { vi v; rep(i, n) v.pb(gi()); return v; }
inline vl gvl(int n) { vl v; rep(i, n) v.pb(gl()); return v; }
inline vc gvc(int n) { vc v; rep(i, n) v.pb(gc()); return v; }
inline vs gvs(int n) { vs v; rep(i, n) v.pb(gs()); return v; }
inline vi nvi(int n) { vi v; rep(i, n) v.pb(ni()); return v; }
inline vl nvl(int n) { vl v; rep(i, n) v.pb(nl()); return v; }

inline vvi gvvi(int m, int n) { vvi v; rep(i, n) v.pb(gvi(m)); return v; }
inline vvl gvvl(int m, int n) { vvl v; rep(i, n) v.pb(gvl(m)); return v; }
inline vvc gvvc(int m, int n) { vvc v; rep(i, n) v.pb(gvc(m)); return v; }
inline vvs gvvs(int m, int n) { vvs v; rep(i, n) v.pb(gvs(m)); return v; }
inline vvi nvvi(int m, int n) { vvi v; rep(i, n) v.pb(nvi(m)); return v; }
inline vvl nvvl(int m, int n) { vvl v; rep(i, n) v.pb(nvl(m)); return v; }

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


int main() {
    string s = gs(), t = gs();
    rep(c, 'a', 'z' + 1) {
        if (s + (char)c == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int d = 0; d < W; d++) {
					if (i == 0 || d == 0 || d == W - 1 || i == H - 1) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}

				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}


Measured memory_bytes: 34320
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vd vector<ld>
#define vvd vector<vector<ld>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [](auto& i)
#define compare(i, j) [](auto& i, auto& j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define SZ(a) ll((a).size())
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  ll x, a, b;
  ll ans = 0;

  cin >> x >> a >> b;
  // vi v(n);
  // REP(i, n) {
  //   cin >> v[i];
  // }

  cout << (x + a < b ? "dangerous" : a < b ? "safe" : "delicious") << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

int main() {
	string s;
	char aa,bb,cc;
	int a,b,c,d,ans=0;
	cin >>s;
	a=s[0]-'0';
	b = s[1] - '0';
	c = s[2] - '0';
	d = s[3] - '0';
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 2; k++) {
				ans=a;
				if (i == 0) {
					ans+=b;
					aa='+';
				}
				else {
					ans-=b;
					aa='-';
				}
				if (j == 0) {
					ans += c;
					bb = '+';
				}
				else {
					ans -= c;
					bb = '-';
				}
				if (k == 0) {
					ans += d;
					cc = '+';
				}
				else {
					ans -= d;
					cc = '-';
				}
				if (ans == 7) {
					cout<<s[0]<<aa<<s[1]<<bb<<s[2]<<cc<<s[3]<<"=7"<<endl;
					return 0;
				}
			}
		}
	}
    return 0;
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

double dp[310][310][310];
bool memo[310][310][310];
int N;
double f(int i, int j, int k) {
  if (memo[i][j][k]) return dp[i][j][k];
  memo[i][j][k] = true;
  if (i != 0 && j != 0 && k != 0) {
    dp[i][j][k] = (double)(f(i-1,j,k)*i+f(i+1,j-1,k)*j+f(i,j+1,k-1)*k+N) / (i+j+k);
  }
  else if (i == 0 && j == 0) dp[i][j][k] = (double)(f(i,j+1,k-1)*k+N) / (i+j+k);
  else if (i == 0 && k == 0) dp[i][j][k] = (double)(f(i+1,j-1,k)*j+N) / (i+j+k);
  else if (j == 0 && k == 0) dp[i][j][k] = (double)(f(i-1,j,k)*i+N) / (i+j+k);
  else if (i == 0) dp[i][j][k] = (double)(f(i+1,j-1,k)*j+f(i,j+1,k-1)*k+N) / (i+j+k);
  else if (j == 0) dp[i][j][k] = (double)(f(i-1,j,k)*i+f(i,j+1,k-1)*k+N) / (i+j+k);
  else if (k == 0) dp[i][j][k] = (double)(f(i-1,j,k)*i+f(i+1,j-1,k)*j+N) / (i+j+k);
  return dp[i][j][k];
}

int main() {
  int M;
  cin >> M;
  vector<int> v(4);
  for(int i = 0; i < M; i++) {
    int x;
    cin >> x;
    v.at(x)++;
  }
  N = v.at(1) + v.at(2) + v.at(3);
  memo[0][0][0] = true;
  dp[0][0][0] = 0;
  double i = v.at(1), j = v.at(2), k = v.at(3);
  cout << fixed << setprecision(12);
  cout << f(i,j,k) << endl;
}
  

Measured memory_bytes: 256256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
bool f=0;
int c[N],cnt[3];
vector<int>G[N];
void dfs(int x,int ff=1)
{
    if(c[x])
    {
        f|=ff!=c[x];
        return;
    }
    c[x]=ff;
    cnt[ff]++;
    for(int u:G[x])
    dfs(u,3-ff);
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0; i<m; ++i)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1);
    printf("%lld\n",f?1LL*n*(n-1)/2-m:1LL*cnt[1]*cnt[2]-m);
    return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

class UnionFind{
private:
	std::vector<int_fast32_t> par;
	size_t n;

public:
	UnionFind(){}
	UnionFind(size_t n):n(n){
		par.resize(n, -1);
	}

	uint_fast32_t find(uint_fast32_t x){
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}

	size_t size(uint_fast32_t x){
		return -par[find(x)];
	}

	void unite(uint_fast32_t x, uint_fast32_t y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(size(x) < size(y)) std::swap(x, y);
		par[x] += par[y];
		par[y] = x;
	}

	bool same(uint_fast32_t x, uint_fast32_t y){
		return find(x) == find(y);
	}
};

const int64 mod = 1e9+7;

int main(void){
	int32 x;
	cin >> x;
	if(x == 3 || x == 5 || x == 7){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
  int A,B,C;
  int f = 1;
  
 while(f == 1){
    scanf("%d %d %d", &A, &B, &C);
    if((1 >= A <= 9 )&&(1 >= B <=9)&&(1 >= C <=9))
      f = 0;
  }
  int i = 0;
  if (A == B && B != C) 
    i = 1;
  if (B == C && A != C)
    i = 1;
  if (A == C && A != B)
    i = 1;
  
  if (i) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

ll n, k;

ll f(ll b) {
	ll ret = 0;
	if (k >= b) {
		return ret;
	}
	ret = (n / b) * (b - k);
	if (k == 0) {
		ret--;
	}
	ll mod = n % b;
	if (mod >= k) {
		ret += mod - k + 1;
	}
	return ret;
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n >> k;
	ll ret = 0;
	for (int b = 1; b <= n; b++) {
		ret += f(b);
	}
	cout << ret << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 3584
#include<stdio.h>
#define MAX 10000
#define NO -1

struct tree { int p, l, r;};
struct tree T[MAX];
int n;

void Preorder ( int u ) {
    if ( u == NO ) return;
    printf(" %d", u);
    Preorder(T[u].l);
    Preorder(T[u].r);
}

void Inorder ( int u ) {
    if ( u == NO ) return;
    Inorder(T[u].l);
    printf(" %d", u);
    Inorder(T[u].r);
}

void Postorder ( int u ) {
    if ( u == NO ) return;
    Postorder(T[u].l);
    Postorder(T[u].r);
    printf(" %d", u);
}

int main(void) {
    int i, v, l, r, f, root;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) {
        T[i].p = NO;
    }

    for ( i = 0; i < n; i++ ) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if ( l != NO ) T[l].p = v;
        if ( r != NO ) T[r].p = v;
    }

    for ( i = 0; i < n; i++ ) {
        if ( T[i].p == NO ) root = i;
    }

    printf("Preorder\n");
    Preorder(root);
    printf("\nInorder\n");
    Inorder(root);
    printf("\nPostorder\n");
    Postorder(root);
    printf("\n");

    return 0;

}

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

#define ll long long
#define MOD 1000000007


int main(){
    //全通りー数値の個数

    ll n;
    cin>>n;

    vector<ll> a(n);
    vector<ll> table(n+1,0);


    for(int i=0;i<n;i++){
        cin>>a.at(i);
        table.at(a.at(i))++;
    }

    ll sum=0;
    for(int i=0;i<=n;i++){
        sum += table.at(i)*(table.at(i)-1)/2;
    }

    for(int i=0;i<n;i++){
        cout<<sum-(table.at(a.at(i))-1)<<endl;
    }



}



Measured memory_bytes: 5760
n=int(input())
l=[]
while n>0:
  x=(n-1)%26
  l.append(x)
  n-=(x+1)
  n//=26
a=''
s=[chr(i) for i in range(97, 97+26)]
for x in l:
  a=s[x]+a
print(a)

Measured memory_bytes: 9180
def factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
x=int(input())
for i in range(x,x+1000000):
    if len(factorize(i))==1:
        print(i)
        exit()

Measured memory_bytes: 9080
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 1e9;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

// Lv n バーガの下から x 個に含まれる P の数
ll calc(const vector<ll>& n_all, const vector<ll>& n_p, ll n, ll x) {
  if (n == 0 && x > 0) return 1;
  else if (n == 0) return 0;
  x--;
  ll ret = 0;
  if (x  >= n_all[n-1]) {
    ret += n_p[n-1];
    x -= n_all[n-1];
    if (x > 0) {  // ちょうど中間の P
      ret++;
      x--;
    }
  }

  if (x <= 0) return ret;
  ret += calc(n_all, n_p, n-1, x);
  return ret;
}

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

  ll n, x;
  cin >> n >> x;

  vector<ll> n_p(51);
  vector<ll> n_all(51);
  n_p[0] = 1;
  n_all[0] = 1;
  for (int i = 1; i <= 50; i++) {
    n_p[i] = n_p[i-1] * 2 + 1;
    n_all[i] = n_all[i-1] * 2 + 3;
  }
  ll ans = calc(n_all, n_p, n, x);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			n = scanner.nextInt();
			u = scanner.nextInt();
			if ((n | u) == 0)
				break;
			need = new int[n];
			int all = 0;
			unit = new int[n];
			num = new int[n];
			for (int i = 0; i < n; i++) {
				unit[i] = num[i] = scanner.nextInt();
				all += unit[i];
				int k = scanner.nextInt();
				for (int j = 0; j < k; j++) {
					int x = scanner.nextInt();
					need[i] |= (1 << x);
				}
			}
			if (all == u) {
				System.out.println(n);
				continue;
			}
			Arrays.sort(num);
			int sum = 0;
			for (int i = n - 1; i >= 0; i--) {
				sum += num[i];
				if (sum >= u) {
					m = n - i;
					break;
				}
			}

			for (int i = m; i < n; i++) {
				v = new boolean[1 << n];
				if (slove(0, 0, 0, i)) {
					System.out.println(i);
					break;
				}
			}
		}

	}

	private boolean slove(int bit, int one, int have, int depth) {
		if (u <= have)
			return true;
		if (one == depth)
			return false;
		for (int i = 0; i < n; i++) {
			int a = bit | (1 << i);
			if (v[a] || (bit | need[i]) != bit)
				continue;
			v[a] = true;
			if (slove(a, one + 1, have + unit[i], depth))
				return true;
		}
		return false;
	}

	int m;
	int n, u;
	int[] need, unit, num;
	int ans;
	boolean[] v;
}

Measured memory_bytes: 91580
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 1000005;

int n, ans, ql, qr, a[MAXN], q[MAXN];
char s[MAXN], t[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), scanf("%s%s", s + 1, t + 1);
	bool flg = true;
	for (int i = 1; i <= n && flg; i ++)
		flg &= s[i] == t[i];
	if (flg)
		return puts("0"), 0;
	for (int i = n, j = n, lst = n + 1; i; i --)
		if (t[i] ^ t[i - 1])
		{
			for (j = min(i, j); j && (s[j] ^ t[i]); j --);
			if (!j)
				return puts("-1"), 0;
			a[j] = lst - 1, lst = i;
		}
	for (int i = n, j = 0; i; i --)
		if (a[i])
		{
			while (ql < qr && q[ql] - j > a[i])
				ql ++;
			if (a[i] ^ i)
				q[qr ++] = i + (++ j);
			ans = max(ans, qr - ql);
		}
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 9984
import itertools

n = int(input())
S = []
for _ in range(n):
    S.append(str(input()))

First = ['M', 'A', 'R', 'C', 'H']

M, A, R, C, H = [], [], [], [], []
for s in S:
    if s[0] == 'M':
        M.append(s)
    elif s[0] == 'A':
        A.append(s)
    elif s[0] == 'R':
        R.append(s)
    elif s[0] == 'C':
        C.append(s)
    elif s[0] == 'H':
        H.append(s)

ans = 0

for first_cmb in itertools.combinations(First, 3):
    temp = 1
    for i in first_cmb:
        if i == 'M':
            temp = temp*len(M)
        elif i == 'A':
            temp = temp*len(A)
        elif i == 'R':
            temp = temp*len(R)
        elif i == 'C':
            temp = temp*len(C)
        elif i == 'H':
            temp = temp*len(H)
        
    ans += temp


print(ans)



Measured memory_bytes: 10804
int main(void)
{
    char frame,body;
    frame = '#';
    body = '.';
    int height,width;
    
    while(1){
        scanf("%d%d",&height,&width);
        
        for(int i=0;i<height;i++){
            if(i == 0 || i == height-1) {
                for(int k =0;k < width;k++){
                  putchar(frame);
                }
                printf("\n");
            }
            
            else{
                for(int j=0;j<width;j++){
                if(j==0 || j == width-1) putchar(frame);
                else putchar(body);
            }
                printf("\n");
        }
        }
        if(height+width ==0) return 0;
        printf("\n");
    }
    
    return 0;
}


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

int main() {
  // ここにプログラムを追記
  int a,b,x;
  cin >> a >> b;
  ((a+b) % 2 == 0) ? (x = (a+b)/2) : (x = (a+b)/2 + 1);
  cout << x << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

static void do_calc(int a_i[], int b[], int n, int m);

int
main(int argc, char *argv[])
{
  // n, m
  int n, m;
  scanf("%d%d", &n, &m);

  int i;

  // a
  int a[n][m];
  for (i = 0; i < n; i++) {
    int j;
    for (j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
    }
  }

  // b
  int b[m];
  for (i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  // calc
  for (i = 0; i < n; i++) {
    do_calc(a[i], b, n, m);
  }
  return 0;
}

static void
do_calc(int a_i[], int b[], int n, int m)
{
  int j;
  int sum = 0;
  for (j = 0; j < m; j++) {
    sum += a_i[j] * b[j];
  }
  printf("%d\n", sum);
  return;
}

Measured memory_bytes: 1844
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

ll powMod(ll k, ll n, ll mod) {
    ll x = 1;
    while (n > 0) {
        if (n & 1) {
            x = x * k % mod;
        }
        k = k * k % mod;
        n >>= 1;
    }
    return x;
}
 
// comb O(r)一つだけ
ll comb(ll n, ll r, ll mod) {
    ll ret = 1;
    while (true) {
        if (r == 0) break;
        ll N = n % mod;
        ll R = r % mod;
        if (N < R) return 0;
        for (int i = 0; i < R; i++)
        {
            ret = ret * (N - i) % mod;
        }
        ll imul = 1;
        for (int i = 0; i < R; i++)
        {
            imul = imul * (i + 1) % mod;
        }
        ret = ret * powMod(imul, mod - 2, mod) % mod;
        n /= mod; r /= mod;
    }
    return ret;
}


int main() {
  ll x=0,y=0,k,n,m,h,w,sum=0,ans=0,Max=1,Min=1e9+1;
  string s,t,u;
  bool ok = true;
  cin >> n >> x >> y;
  ll z = powMod(2,n,mod)-1;
  m = comb(n,x,mod)%mod;
  h = comb(n,y,mod)%mod;
  ans = (z-(m+h));
  ans %= mod;
  ans += mod; 
  cout << ans%mod << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1e3 + 2;
ll i,n,j,p,ans;
ll a[N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    rep(i,0,n) cin>>a[i];
    rep(i,0,n){
        p = 1;
        rep(j,0,i) if(a[j] > a[i]){
            p = 0;
            break;
        }
        ans += p;
    }
    cout<<ans;
    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 x;
  cin >> x;
  int64 n = 100;
  int32 cnt = 0;
  while(n < x){
    n = (double)n * 1.01;
    cnt++;
  }
  ANS(cnt);
  return 0;
}

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

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

using namespace std;
int main(void){
    set<int>S;
    int n=0;
    rep(i, 3) {
        cin >>n;
        S.insert(n);
    }
    cout << S.size();
}

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

					using namespace std;
					typedef long long ll;
					int n, a[222222];
					ll s;
					map<int, ll> m, p; 
					set<int> q;
					int main()
					{
						cin >> n;
						for(int i = 1; i <= n; i++)
						{
							cin >> a[i];
							m[a[i]]++;
							q.insert(a[i]);
						}
						for(auto it : q)
						{
							ll k = m[it]-1;
							p[it] = ((1+k)*k/2);	
						}
						for(auto id : q)
							s += p[id];
						for(int i = 1; i <= n; i++)
						{
							cout << s - (m[a[i]]-1) << '\n';
						}		
					}

Measured memory_bytes: 24064
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		int a = -1;
		int b = -1;
		for(int i = 0; i<S.length;i++){
			if(S[i] == 'C'){
				a = i;
			}
			if(S[i] == 'F'){
				b = i;
			}
		}
		if(a<b && a != -1 && b != -1){
			System.out.println("Yes");
		}else if(a==-1 || b==-1 || b<a){
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 10060
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
int n,_a[SZ],*a=_a+1;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;++i)
		scanf("%d",a+i);
	sort(a,a+n); reverse(a,a+n); a[-1]=a[0];
	int g=0; while(g<n&&g<a[g]) ++g;
	--g; int h=a[g]-g,y=0;
	while(y+g<n&&a[y+g]>g) ++y;
	if((h&1)&&(y&1)) puts("Second");
	else puts("First");
}

Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;

int n, m, a[105];
int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		a[x]++;
		a[y]++;
	}
	for(int i = 1; i <= n; i++)
		printf("%d\n", a[i]);
	return 0;
}

Measured memory_bytes: 128
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
A = 0
B = 7
while True:
    A += B
    A %= K
    
    B *= 10
    B %= K
    i += 1
    if A == 0:
        break
print(i)


Measured memory_bytes: 63380
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 a;
    seika b;
    cin >> a >> b;
    int x = 0;
    for (char c : b)
    {
        if (c == '.')
        {
            continue;
        }
        x *= 10;
        x += c - '0';
    }
    a *= x;
    a /= 100;
    cout << a << endl;
}

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


Measured memory_bytes: 3584