akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* struct for mod Calculation*/
struct mint {
        ll x;
        mint(ll x = 0):x((x % mod + mod) % mod) {}
        mint operator-() const { return mint(-x); }
        mint& operator+=(const mint a) {
            if ((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator-=(const mint a) {
            if ((x += mod - a.x) >= mod) x -= mod;
            return *this;
        }
        mint& operator*=(const mint a) {
            (x *= a.x) %= mod;
            return *this;
        }
        mint operator+(const mint a) const {
            mint res(*this);
            return res += a;
        }
        mint operator-(const mint a) const {
            mint res(*this);
            return res -= a;
        }
        mint operator*(const mint a) const {
            mint res(*this);
            return res *= a;
        }
        mint pow(ll t) const {
            if (!t) return 1;
            mint a = pow(t >> 1);
            a *= a;
            if (t & 1) a *= *this;
            return a;
        }
        // for prime mod
        mint inv() const {
            return pow(mod - 2);
        }
        mint& operator/=(const mint a) {
            return (*this) *= a.inv();
        }
        mint operator/(const mint a) const {
            mint res(*this);
            return res /= a;
        }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
/* function */
/* main */
int main(){
    string L;
    cin >> L;
    int n = L.size();
    // dp[0][l]: Lの上からl-bitを見た時の a + b < Lとなる事が確定している組み合わせ
    // dp[1][l]: Lの上からl-bitを見た時の a + b = Lとなる組み合わせ
    vector<vector<mint>> dp(2, vector<mint>(n + 1, 0));
    // init
    dp[1][0] = 1;
    // a[l] + b[l] == a[l] xor b[l]
    // => l-bit : (0, 1), (1, 0), (0, 0)
    // transition
    for (int l = 0; l < n; l++) {
        if (L[l] == '0') {
            dp[0][l+1] += dp[0][l] * 3;
            dp[1][l+1] += dp[1][l];
        }
        else {
            dp[0][l+1] += dp[0][l] * 3 + dp[1][l];
            dp[1][l+1] += dp[1][l] * 2;
        }
    }
    cout << dp[0][n] + dp[1][n] << '\n';
}


Measured memory_bytes: 5872
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		//var n=sc.I;
		var s=sc.S;
		var t=sc.S;
		int ans=0;
		for(int i = 0;i<3;i++) {
			if(s[i]==t[i]){ans++;}
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
using namespace std::chrono;
const int N = 1e5+4 , M=N,inf=(int)1e9;
const ll mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
ll power( int x){
    ll p = 1;
    for( int i = 0 ; i < x ; i++){
        p*=2;
    }
    return p ;
}
void solve(){
  ll a , b ;
  cin >> a >> b;
  int last_bit =(int)(log2(b));
  /*for( ll i = 39 ; i >= 0 ; i--){
     if((b & (ll)(1<<i) )){
        last_bit = i ;
        break ;
     }
  }*/
  ll ans = 0 ;
  for( int i = 0 ; i <= last_bit ; i++){
        ll k = b-(power(i)-1);
        ll q = k / ((ll)power(i));
        ll r = k % ((ll)power(i));
        ll no = (q+1) / 2 ;
        no*=( (ll)(power(i)));
        if(q%2==0){
            no+=r;
        }
        //cout << no ;
        ///////////////////////////////////
        k = a-(power(i)-1)-1;
        q = k / ((ll)power(i));
        r = k % ((ll)power(i));
        ll no1 = (q+1) / 2 ;
        no1*=( (ll)(power(i)));
        if(q%2==0){
            no1+=r;
        }
        no1 = max((ll)0,no1);
        //cout << no1 << "\n";
        ll fno = no-no1;
        if(fno%2!=0){
            ans+=((ll)power(i));
        }
  }
    cout << ans ;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int H, W;
short dp[102][102][102][102];
short row[101][101], col[101][101];
int EY = -1, EX = -1;
string A[101];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> H >> W;
    rep(y, H) {
        cin >> A[y];
        rep(x, W) {
            if(A[y][x] == 'E') {
                EY = y;
                EX = x;
            } else if(A[y][x] == 'o') {
                row[y][x + 1] = 1;
                col[x][y + 1] = 1;
            }
        }
    }
    rep(y, H)rep(x, W) {
        row[y][x + 1] += row[y][x];
        col[x][y + 1] += col[x][y];
    }

    int up, le, bo, ri;
    short val, ans = 0;
    rep(u, H + 1)if(EY-u>=0)rep(l, W + 1)if(EX-l>=0)rep(d, H + 1)if(EY+d<H)rep(r, W + 1)if(EX+r<W) {
        up = max(EY - u, d);
        le = max(EX - l, r);
        bo = min(EY + d, H - 1 - u);
        ri = min(EX + r, W - 1 - l);
        val = dp[u][l][d][r];
        smax(ans, val);

        smax(dp[u + 1][l][d][r], val);
        if(up - 1 >= 0 && up > d && le <= ri) {
            smax(dp[u + 1][l][d][r], (short)(val + row[up - 1][ri + 1] - row[up - 1][le]));
        }
        smax(dp[u][l + 1][d][r], val);
        if(le - 1 >= 0 && le > r && up <= bo) {
            smax(dp[u][l + 1][d][r], (short)(val + col[le - 1][bo + 1] - col[le - 1][up]));
        }
        smax(dp[u][l][d + 1][r], val);
        if(bo + 1 < H && H - 1 - u > bo && le <= ri) {
            smax(dp[u][l][d + 1][r], (short)(val + row[bo + 1][ri + 1] - row[bo + 1][le]));
        }
        smax(dp[u][l][d][r + 1], val);
        if(ri + 1 < W && W - 1 - l > ri && up <= bo) {
            smax(dp[u][l][d][r + 1], (short)(val + col[ri + 1][bo + 1] - col[ri + 1][up]));
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 51200
import queue
import copy

vx = [0,1,0,-1];
vy = [1,0,-1,0];
q = queue.Queue()

hw = input().split(' ');
h = int(hw[0]);
w = int(hw[1]);
s = [ [0]*w for i in range(h)];
for i in range(h) :
	si = input();
	for j in range(w) :
		s[i][j] = si[j];

s_alt = copy.deepcopy(s);
ans = 0;
for sy in range(h) :
	for sx in range(w) :
		s = copy.deepcopy(s_alt);
		if s[sy][sx] == '.' :
			q_a = [0]*2;
			q_a[0] = sy;
			q_a[1] = sx;
			q.put(q_a);
			s[sy][sx] = 0;
			while not q.empty() :
				q_a = q.get();
				for i in range(4):
					ny = q_a[0] + vy[i];
					nx = q_a[1] + vx[i];
					if ny >= 0 and ny < h and nx >= 0 and nx < w and s[ny][nx] == '.':
						s[ny][nx] = s[q_a[0]][q_a[1]] + 1;
						q_b = [0]*2;
						q_b[0] = ny;
						q_b[1] = nx;
						q.put(q_b);
			max_path = 0;
			for i in range(h) :
				for j in range(w) :
					if s[i][j] == '#' :
						continue;
					elif s[i][j] > max_path :
						max_path = s[i][j];
			if max_path > ans :
				ans = max_path;

print(ans);

Measured memory_bytes: 4080
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

vector<int> ps;
vector<int> cs;
vector<int> state;
int D, G;

int dfs(int i, int acc, int sum){
    if(i>=D){
        if(sum<G) return INT_MAX;
        for(int j=0; j<D; ++j){
            if(state[j]==0 || state[j]==2) continue;
            int extra=(sum-G)/(j+1);
            if(extra<=ps[j]-1){
                acc-=extra;
                break;
            } else{
                acc-=(ps[j]-1);
                sum-=(ps[j]-1)*(j+1);
            }
        }
        return acc;
    } else{
        int ans=INT_MAX;
        for(int s=0; s<3; ++s){
            state[i]=s;
            int tmp;
            if(s==0){
                tmp=dfs(i+1, acc, sum);
            } else if(s==1){
                tmp=dfs(i+1, acc+ps[i]-1, sum+(i+1)*(ps[i]-1));
            } else{
                tmp=dfs(i+1, acc+ps[i], sum+(i+1)*ps[i]+cs[i]);
            }
            ans=min(ans, tmp);
        }
        return ans;
    }
}

int main(){
    cin >> D >> G;
    G/=100;
    ps.resize(D);
    cs.resize(D);
    state.resize(D);
    for(int i=0; i<D; ++i){
        cin >> ps[i] >> cs[i];
        cs[i]/=100;
    }
    cout << dfs(0, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <ctime>
#include <set>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second

using namespace std;

const int N = 210;

bool isnotprime[10000010];
int prime[10000010], cnt;
void get_prime()
{
	isnotprime[1] = true;
	for (int i = 2; i <= 10000000; i ++) {
		if (!isnotprime[i]) prime[++ cnt] = i;
		for (int j = 1; j <= cnt && i * prime[j] <= 10000000; j ++) {
			isnotprime[i * prime[j]] = true;
			if (!(i % prime[j])) break;
		}
	}
}

int vv[10000010], p[N], d0[N], d1[N], lnk[N], cd0, cd1;
bool vis[N];
bool dfs(int x)
{
	Rep(i, cd1) if (!isnotprime[abs(d0[x] - d1[i])] && !vis[i]) {
	//	printf("!%d\n", abs(d0[x] - d1[i]));
		vis[i] = true;
		if (lnk[i] == -1 || dfs(lnk[i])){ lnk[i] = x; return true;} 
	}
	return false;
}

int main()
{
	get_prime();
	
	int T = 1;
	//scanf("%d", &T);
	while (T --){
		int n;
		scanf("%d", &n);
		cd0 = cd1 = 0;
		Rep(i, n) {
			scanf("%d", &p[i]);
			if (vv[p[i]] != T + 1) vv[p[i]] = T + 1;
		}
		Rep(i, n) {
			if (vv[p[i]] != vv[p[i] - 1]) {
				if (p[i] & 1) d1[++ cd1] = p[i];
				else d0[++ cd0] = p[i];
			}
			if (vv[p[i]] != vv[p[i] + 1]) {
				if (p[i] & 1) d0[++ cd0] = p[i] + 1;
				else d1[++ cd1] = p[i] + 1;
			}
		}
	//	printf("%d %d\n", cd0, cd1);
	//	Rep(i, cd0) printf("_%d ", d0[i]); printf("\n");
	//	Rep(i, cd1) printf("_%d ", d1[i]); printf("\n");
		
		int ans = 0, t0 = cd0, t1 = cd1;
		memset(lnk, -1, sizeof(lnk));
		Rep(i, cd0) {
			memset(vis, false, sizeof(vis));
			if (dfs(i)) ans ++, t0 --, t1 --;
		}
		ans += (t0 / 2) * 2 + (t1 / 2) * 2;
		if (t0 & 1) ans += 3;
		printf("%d\n", ans);
	}
	
	return 0;
}
/*
3
2
2 3
3
1 2 4
5
101 102 103 104 105
*/

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

string N;

int main() {
    cin >> N;

    if (N[0] == N[N.length() - 1]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int X;

  scanf("%d", &X);

  int b=0;
  int p=0;

  int ans=0, pow=0, dif=1000, buf=1000;

  if(X <= 3){
    printf("1\n");
    return 0;
  }

  for(b=2; b <= 31; b++){
    pow = b*b;

    for(p=2; pow <= X; p++){
      buf = X - pow;

      if(buf == 0){
        printf("%d\n", X);
        return 0;
      }else if(buf < dif){
        ans = pow;
        dif = buf;
      }

      pow = pow * b;
    }
  }

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

  return 0;

}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){

   int n,i,hell=100000,work;

   scanf("%d",&n);
   for(i=0;i<n;i++){
      hell*=1.05;
      work=hell%1000;
      if(work!=0){
         hell-=work;
         hell+=1000;
      }
   }
   printf("%d\n",hell);

   return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long
using namespace std;

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin >> n >> m;
    pii a[n+5];
    for (int i=1;i<=n;i++) cin >> a[i].fi >> a[i].se;
    sort (a+1, a+n+1);
    int cur = 1, ans = 0;;
    priority_queue<int> p;
    for (int i=1;i<=m;i++) {
        while (a[cur].fi <= i && cur <= n) {
            p.push(a[cur].se);
            cur++;
        }
        if (!p.empty()) {
            ans += p.top();
            p.pop();
        }
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <functional>
#include <map>
#include <math.h>
#include <list>

using namespace std;
#define ll long long int


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int a[100005] = {};
	ll sum;
	int n, q, b, c,in;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> in;
		a[in] += 1;
		sum += in;
	}
	cin >> q;
	while (q--) {
		cin >> b >> c;
		a[c] += a[b];
		sum += (c - b) * a[b];
		a[b] = 0;
		cout << sum << endl;
	}

	

	return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 3e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

int n;
ll a[MAX_N];
ll suff[MAX_N][63];

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

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

    ll mul = 1LL;
    ll ans = 0LL;

    for (int i = n-1; i >= 0; i--) {
        for (ll j = 0LL; j < 60; j++) {
            suff[i][j] = suff[i+1][j];
            if (a[i] & (1LL << j)) suff[i][j]++;
        }
    }

    /*for (int i = n-1; i >= 0; i--) {
        for (int j = 0; j < 2; j++) {
            cout << suff[i][j] << "  ";
        }
        cout << "\n";
    }*/

    for (int i = 0; i < n-1; i++) {
        for (ll j = 0LL; j < 60; j++) {     // WARNING
            ll tmp = (1LL << j) % MOD;
            ll cnt;
            if (a[i] & (1LL << j)) {
                cnt = (ll)(n - i - 1 - suff[i+1][j]);
            } else {
                cnt = suff[i+1][j];
            }
            //cout << "D: " << tmp << "   " << cnt << "\n";
            tmp = (tmp * cnt) % MOD;
            ans = (ans + tmp) % MOD;
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 150272
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{

	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//long long n, A[1000000000];
	//ll n, m, q;
	cin >> a;
	string s[51];
	for (int i = 0; i < a; i++)
	{
		cin >> s[i];
	}
	char memo[51][30] = { {} };
	for (int i = 0; i < a; i++)
	{
		for (int k = 0; k < s[i].length(); k++)
		{
			//cout << s[i][k] - 'a'<<endl;
			memo[i][s[i][k] - 'a']++;
		}
	}
	char mini[30] = { {} };
	for (int i = 0; i < 26; i++)
	{
		mini[i] = memo[0][i];
	}
	for (int i = 1; i < a; i++)
	{
		for (int k = 0; k < 26; k++)
		{
			mini[k] = min(mini[k], memo[i][k]);
			
		}
	}
	char z;
	for (int i = 0; i < 26; i++)
	{
		while (mini[i]>0)
		{
			z = 'a' + char(i);
			//cout << z;
			cout << z;
			mini[i]--;
		}
	}
	cout<<endl;

	//-8965725 + (9912027 * (7812383 + 8965725)) / (4915988 + 9912027)
	//cout <<  << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//accumulate(x, x + a, 0);
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}



Measured memory_bytes: 256
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

struct Data{
    int A;
    string S;
    
    bool operator<( const Data& right ) const {
        return A == right.A ? S < right.S : A < right.A;
        //return A < right.A;
    }
};

int Func(){
    int x = 0;
    return x;
}

int main(){
    int N;
    
    cin >> N;
    
    for (int i=1;i<10;i++) {
        int same = i*111;
        if (N<=same) {
            cout << same << endl;
            return 0;
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e16;

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> d(N);
    for(auto& in:d) cin >> in;
    sort(d.begin(),d.end());
    int ans = 0;
    int D = -1;
    for(int i = 0; i < N;i++){
        if(d[i] > D){
            D = d[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
import Data.List
import Data.Function (on)
import Control.Applicative

main = do
  _ <- getLine
  xxs <- reverse . sortBy (compare `on` length) . group . sort . lines <$> getContents :: IO [[String]]
  let max1 = length . head $ xxs
  let result = sort [head xs | xs <- xxs, length xs == max1]
  show' result
  where
    show' = putStr . unlines


Measured memory_bytes: 145660
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for (int i = 0; i < s.length(); i += 2) {
            System.out.print(s.charAt(i));
        }
        System.out.println();
    }
}


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

int main() {
    int a,b;
    cin>>a>>b;
    if(a+b==15){
        cout<<'+'<<endl;
    }else if(a*b==15){
        cout<<'*'<<endl;
    }else{
        cout<<'x'<<endl;
    }
return 0;}
/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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 namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    vi time(5);
    ll minVal = 10, minIdx = 4;
    rep(i, 5){
        cin >> time[i];
        if(time[i]%10 != 0 && minVal > time[i]%10){
            minVal = time[i]%10;
            minIdx = i;
        }
    }

    ll ans = 0;
    rep(i, 5){
        if(i != minIdx) time[i] = (ll)(ceil(time[i]/10.0)*10);
        ans += time[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int N,M;
    cin>>N>>M;

    int ans = 0;
    for(int i = 0;i < M;i++) {
        int a;
        cin>>a;
        ans += a;
    }

    if(ans > N) {
        cout<<-1<<endl;
    } else {
        cout<<N-ans<<endl;
    }

    return 0;
}


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

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	
	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		ans += s[i] != t[i];
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 3856
N=int(input())

answer=0
def dfs(d):
  global answer
  if d>N:
    return
  
  d_str=str(d)
  if "3" in d_str and "5" in d_str and "7" in d_str:
    #print(d)
    answer+=1
  
  for dd in [3,5,7]:
    dfs(10*d+dd)
    
dfs(0)
print(answer)

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

int N,M,Ans;
int C[3005][3005],S[3005][3005];

int Pow(int base,int n,int mod){
	int ans=1;
	for(;n;n>>=1){
		if(n&1)
			ans=1ll*ans*base%mod;
		base=1ll*base*base%mod;
	}
	return ans;
}

int main(){
	int i,j,x;
	scanf("%d%d",&N,&M);
	for(i=0;i<=N;i++){
		C[i][0]=C[i][i]=1;
		for(j=1;j<i;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			if(C[i][j]>=M)
				C[i][j]-=M;
		}
	}
	S[0][0]=1;
	for(i=1;i<=N+1;i++)
		for(j=1;j<=i;j++){
			S[i][j]=S[i-1][j-1]+1ll*j*S[i-1][j]%M;
			if(S[i][j]>=M)
				S[i][j]-=M;
		}
	for(i=0;i<=N;i++){
		for(x=j=0;j<=i;j++){
			x+=1ll*S[i+1][j+1]*Pow(2,(N-i)*j,M)%M;
			if(x>=M)
				x-=M;
		}
		x=1ll*x*C[N][i]%M*Pow(2,Pow(2,N-i,M-1),M)%M;
		if(i&1)
			x=(M-x)%M;
		Ans+=x;
		if(Ans>=M)
			Ans-=M;
	}
	printf("%d\n",Ans);
	return 0;
}

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

  #define vi vector<int>
  #define all(v) v.begin(),v.end()
  #define ll long long int
  #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
  #define D2(x) {cerr<<" [" <<#x<<": ";for(auto it:x)cerr<<it<< " ";cerr<<"] ";cout << endl;}

  const ll MOD=1e9+7;

  void solve(){
     string s;
     cin >> s;
     int n = s.size();
     string t;
     cin >> t;
     int m = t.size();
     string ans = string(n,'z');
     for(int i=0;i+m-1<n;i++){
        bool ok = true;
        for(int j=0;j<m;j++){
           if((s[i+j]==t[j]) || (s[i+j]=='?'));
           else ok = false;
        }
        if(ok){
           string k = s.substr(0,i)+t+s.substr(i+m);
           for(int j=0;j<k.size();j++){
               if(k[j]=='?')k[j]='a';
           }
           ans = min(ans,k);
        }
     }
     if(ans == string(n,'z'))
     cout << "UNRESTORABLE";
     else cout << ans;
  }


  int main(){
    IOS
       solve();
       cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }
// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


Measured memory_bytes: 3828
program main
    implicit none
    integer n
    integer a,b
    integer alice, bob
    integer, allocatable :: card(:)

    read*, a, b
    if (mod(a+b, 2) == 0)then
        print'(i0)', (a+b) /2
    else
        print'(a)', 'IMPOSSIBLE'
    endif

  
end program main

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){

	int N;
	cin>>N;
	vector<pll> A;
	for(int i=0;i<N;i++){
		ll x, l;
		cin>>x>>l;
		A.eb(x, l);
	}
	sort(A.begin(), A.end());
	vll X, L;
	for(int i=0;i<N;i++){
		X.pb(A[i].first);
		L.pb(A[i].second);
	}

	vll DP;
	for(int i=0;i<SIZE;i++)
		DP.pb(INFLL);
	DP[0]=-INFLL;

	for(int i=0;i<N;i++){
		int idx=upper_bound(DP.begin(), DP.end(), X[i]-L[i])-DP.begin();
		//cout<<"!"<<i<<" "<<idx<<endl;
		DP[idx]=min(DP[idx], X[i]+L[i]);
	}

	int ans=0;
	for(int i=0;i<SIZE;i++)
		if(DP[i]<INFLL)
			ans=i;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5616
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


class UnionFind{
public:
    VI par;

    UnionFind(int num_of_v){
        REP(i, num_of_v) par.push_back(i);
    }

    int root(int x){
        if(par[x] == x) return x;
        else return par[x] = this->root(par[x]);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        par[x] = y;
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k, l;
    cin >> n >> k >> l;
    UnionFind road(n), railway(n);
    REP(i, k){
        int p, q;
        cin >> p >> q;
        p--; q--;
        road.unite(p, q);
    }
    REP(i, l){
        int r, s;
        cin >> r >> s;
        r--; s--;
        railway.unite(r, s);
    }

    map<pair<int, int>, int> counter_map;
    pair<int, int> index_map[n];
    REP(i, n){
        counter_map[make_pair(road.root(i), railway.root(i))]++;
        index_map[i] = make_pair(road.root(i), railway.root(i));
    }
    REP(i, n){
        cout << counter_map[index_map[i]] << " ";
    }
    cout << "\n";
    return 0;
}


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


int main()
{
	int n;
	cin>>n;
	n = n % 10;
	if( n == 2 || n == 4 || n == 5 || n == 7 || n == 9){
		cout<<"hon"<<endl;
	}else if( n == 3){
		cout<<"bon"<<endl;
	}else{
		cout<<"pon"<<endl;
	}
	return 0;
}



Measured memory_bytes: 3632
#include<stdio.h>
int main(void){
  int num,i,j;
  int a[100];
  int Asum,Bsum;
  int max = 0;
  int maxJ;

  if(scanf("%d",&num));
  for(i=0;i<num;i++){
     if(scanf("%d ",&a[i]));
  }
  
  for(i=0;i<num;i++){
    for(j=0;j<num;j++){
      if(max < a[j]){
        max = a[j];
        maxJ = j;
      }    
    }
    if(i%2 == 0){
      Asum += max;
    }
    else if(i%2 == 1){
      Bsum += max;
    }
    a[maxJ] = 0;
    max = 0;
  }
  
  printf("%d",Asum - Bsum);
  
  return 0;
}

Measured memory_bytes: 128
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2,gcd
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

ans=[]

while 1:
    n,m=MAP()
    if n==0 and m==0:
        break
    else:
        a=LIST()
        
        lis=[sum(x) for x in list(combinations(a,2)) if sum(x)<=m]
        if not lis:
            ans.append('NONE')
        else:
            ans.append(max(lis))

for x in ans:
    print(x)






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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

struct dsu {
	ll n;
	vl p;

	dsu(ll n): n(n), p(n) { iota(all(p),0); }
	
	ll find(ll x) {
		if (x == p[x]) return x;
		return p[x] = find(p[x]);
	}

	bool unite(ll x, ll y) {
		x = find(x), y = find(y);
		if (x == y) return false;
		
		if (rand() & 1) swap(x,y);
		p[y] = x;
		return true;
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, m;
	cin >> n >> m;
	
	dsu D(n);
	while (m--) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		D.unite(a,b);
	}
	
	ll res = 0;
	FOR(i,0,n) res += D.find(i) == i;
	cout << res << endl;

}



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

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

  if(N<=1000){
    cout << 1000-N << endl;
  }
  if(N<=2000 && 1000<N){
    cout << 2000-N << endl;
  }
  if(N<=3000 && 2000<N){
    cout << 3000-N << endl;
  }
  if(N<=4000 && 3000<N){
    cout << 4000-N << endl;
  }
  if(N<=5000 && 4000<N){
    cout << 5000-N << endl;
  }
  if(N<=6000 && 5000<N){
    cout << 6000-N << endl;
  }
  if(N<=7000 && 6000<N){
    cout << 7000-N << endl;
  }
  if(N<=8000 && 7000<N){
    cout << 8000-N << endl;
  }
  if(N<=9000 && 8000<N){
    cout << 9000-N << endl;
  }
  if(N<=10000 && 9000<N){
    cout << 10000-N << endl;
  }
return 0;
}


Measured memory_bytes: 3592
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# 0!~n!をmodしつつ求める
def fact_all(n,M=mod):
    f = [1]*(n+1)
    ans = 1
    for i in range(1,n+1):
        ans = (ans*i)%M
        f[i] = ans
    return f

# inv(0!)~inv(n!)をmodしつつ求める
def fact_inv_all(fact_all,M=mod):
    N = len(fact_all)
    finv = [0]*N
    finv[-1] = pow(fact_all[-1],M-2,M)
    for i in range(N-1)[::-1]:
        finv[i] = finv[i+1]*(i+1)%M
    return finv

# nCkをmodしつつ返す
def nCk(n,k,fact_list=[],inv_list=[],M=mod):
    # a!をmodしつつ求める
    def fact(a,M=mod):
        ans = 1
        for i in range(2,a+1):
            ans = (ans*i)%M
        return ans

    # 互いに素なa,bについて、a*x+b*y=1の一つの解[x,y]を出力
    def extgcd(a,b):
        r = [1,0,a]
        w = [0,1,b]
        while w[2] != 1:
            q = r[2]//w[2]
            r2 = w
            w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
            r = r2
            w = w2
        return [w[0],w[1]]

    # aの逆元(mod M)を求める（aとMは互いに素）
    def mod_inv(a,M=mod):
        x = extgcd(a,M)[0]
        return (M+x%M)%M
    
    if fact_list and inv_list:
        return (((fact_list[n]*inv_list[k])%M)*inv_list[n-k])%M
    else:
        x = fact(n,M)
        y1 = mod_inv(fact(k,M),M)
        y2 = mod_inv(fact(n-k,M),M)
        return ((x*y1)%M*y2)%M

n,k = LI()

fact_list = fact_all(n)
inv_list = fact_inv_all(fact_list)

ans = 1
for i in range(1,min(k+1,n)):
    ans += nCk(n,i,fact_list,inv_list) * nCk(n-1,i,fact_list,inv_list)
    ans %= mod
print(ans)

Measured memory_bytes: 42864
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int main() {

    string s;
    int L;
    while(cin >> s >> L, L) {
        int cnt = 0;
        vector< int > used(1000001, -1);
        used[atoi(s.c_str())] = 0;
        while(true) {
            cnt++;
            while(s.size() < L) s = "0" + s;
            string mini = s, maxi = s;
            sort(mini.begin(), mini.end());
            sort(maxi.rbegin(), maxi.rend());
            int next = atoi(maxi.c_str()) - atoi(mini.c_str());
            if(used[next] != -1) {
                cout << used[next] << " " << next << " " << cnt - used[next] << endl;
                break;
            }
            used[next] = cnt;
            s = to_string(next);
        }
    }
}

Measured memory_bytes: 7132
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,b,a) for (int i=(b);i>=(a);--i)
typedef long long LL;
inline int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const int MAXN=300005;
int n,m,q,a[MAXN],b[MAXN],c[MAXN],f[205][40005];
int main(){
	n=read(); m=read();
	if (n%m==0) printf("-1\n");
	else printf("%d\n",n);
	
	return 0;
}

/*
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h;
    cin >> h;
    ll cnt = 1, ans = 0;
    while (h) {
        ans += cnt;
        cnt *= 2LL;
        h /= 2LL;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int h, a;
  cin >> h >> a;
  cout << (h + a - 1) / a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        vector<int> W;
        for(int i=0;i<n;i++){
            string s;
            cin>>s;
            W.push_back(s.size());
        }
        // cout<<n<<endl;
        int C[5]={5,7,5,7,7};
        for(int i=0;i<n;i++){
            bool done = false;
            for(int j=i,c=0,cnt=0;j<n;j++){
                cnt+=W[j];
                // cout<<cnt<<endl;
                if(cnt<C[c]) continue;
                else if(cnt==C[c]){
                    c++;
                    cnt=0;
                    if(c==5){
                        cout<<i+1<<endl;
                        done = true;
                        break;
                    }
                }else{
                    break;
                }
            }
            if(done) break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 2992
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)

#define sz(x) int((x).size())
#define eb(x...) emplace_back(x)

using ll = int64_t;
using ld = long double;

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

constexpr ll inf = 2e18;
constexpr int M = 1e9 + 7;


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

	int n, K; cin >> n >> K;
	int a[n]; rep(i, 0, n) cin >> a[i];
	bool dp[K + 1];
	rep(k, 0, K + 1) {
		dp[k] = false;
		rep(i, 0, n) {
			if (a[i] > k) break;
			if (!dp[k - a[i]]) {
				dp[k] = true;
				break;
			}
		}
	}
	cout << (dp[K] ? "First" : "Second");
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>
#include <iomanip>
#include <unordered_map>
#include <queue>
using namespace std;

#define REP(i,n) for (int i=0;i<(n);i++)
#define PII pair<int,int>
#define LL long long
#define vi vector<int>
#define vii vector<PII>



int main(){
    LL n;
    map<string, map<int,int, greater<int>>> c;
    string s;
    LL t;

    cin >> n;
    REP(i,n){
        cin >> s >> t;
        c[s][t] = i + 1;
    }

    for (const auto& tm : c){
        auto m = tm.second;
        for (const auto& k : m){
            cout  <<k.second << endl;
        }
    }
    
    return 0;
     
}


Measured memory_bytes: 256
N, M = map(int, input().split())
*H, = map(int, input().split())
count = [0] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A - 1] > H[B - 1]:
        count[B - 1] = 1
    elif H[A - 1] < H[B - 1]:
        count[A - 1] = 1
    else:
        count[A - 1] = 1
        count[B - 1] = 1
print(count.count(0))

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

int main(void){
    int n;
    string s;

    cin >> n >> s;

    vector<int> w(n + 1);
    for(int i=0; i<n; i++){
        if(s[i] == '#'){
            w[i + 1] = w[i] + 1; 
        }else{
            w[i + 1] = w[i];
        }
    }


    int ans = 2e5;
    for(int i=0; i<=n; i++){
        ans = min(ans, w[i] + n - i - (w[n] - w[i]));
    }
    cout << ans;

    return 0;
}

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

int numW[1<<20], numE[1<<20];

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

  string s;
  cin >> s;

  for(int i=1;i<=N;i++){
    if(s[i-1]=='W') numW[i] = numW[i-1]+1;
    else numW[i] = numW[i-1];
  }

  for(int i=N;i>=1;i--){
    if(s[i-1]=='E') numE[i] = numE[i+1]+1;
    else numE[i] = numE[i+1];
  }

  int res = INT_MAX;
  for(int i=1;i<=N;i++){
    res = min(res, numW[i-1]+numE[i+1]);
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3844
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	char c;
	cin >> c;

	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
	{
		cout << "vowel";
		return 0;
	}

	cout << "consonant";

	return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
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; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
int n, m;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    map<char,int> ms;
    for (int i = 0; i < n; i++)
    {
        string temp;
        cin >> temp;
        for(int j=0;j<m;j++)ms[temp[j]]++;
    }
    map<int,int> mi;
    for(char i='a';i<='z';i++){
        mi[4]+=ms[i]/4;
        ms[i]%=4;
        mi[2]+=ms[i]/2;
        ms[i]%=2;
        mi[ms[i]]++;
    }
    //cout<<mi[4]<<" "<<mi[2]<<" "<<mi[1]<<"\n";
    if(n%2&&m%2){
        if(mi[1]!=1)return no,0;
        if(mi[2]>n/2+m/2) return no,0;
    }
    if(n%2&&!(m%2)){
        if(mi[1]!=0)return no,0;
        if(mi[2]>m/2)return no,0;
    }
    if(m%2&&!(n%2)){
        if(mi[1]!=0)return no,0;
        if(mi[2]>n/2)return no,0;
    }
    if(!(n%2)&&!(m%2)){
        if(mi[1]!=0)return no,0;
        if(mi[4]!=m*n/4)return no,0;
    }
    yes;
}



Measured memory_bytes: 256
def main():
    a,b,c = list(map(int,input().split()))
    k = int(input())
    print(solve(a,b,c,k))

def solve(a,b,c,k):
    lst = [a,b,c]
    for i in range(k):
        ind = lst.index(max(lst))
        lst[ind] = lst [ind] * 2
    return sum(lst)




if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;

ll dp[100100][10];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int k; cin >> k;
	for(int i=0;i<10;i++){
		dp[0][i]=1;
	}
	for(int i=1;i<k;i++){
		for(int j=0;j<10;j++){
			for(int l=0;l<10;l++){
				if(abs(j-l)<=1){
					dp[i][l]+=dp[i-1][j];
				}
			}
		}
	}
	int mx=0;
	int sum=0;
	for(int i=0;i<k;i++){
		for(int j=1;j<10;j++){
			if(sum+dp[i][j]<k){
				sum+=dp[i][j];
			}else{
				cout << j;
				int now=j;
				while(i){
					if(now>0){
						if(dp[i-1][now-1]+sum<k){
							sum+=dp[i-1][now-1];
						}else{
							cout << now-1;
							now--;
							i--;
							continue;
						}
					}
					if(dp[i-1][now]+sum<k){
						sum+=dp[i-1][now];
					}else{
						cout << now;
						i--;
						continue;
					}
					cout << now+1;
					now++;
					i--;
				}
				cout << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 8064
n = int(input())

graph = [[] for i in range(n)]

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        graph[a[0]].append(a[2+j*2:4+j*2])  #[頂点, cost]

memo = [10**10 for i in range(n)]
memo[0] = 0

import heapq
q = []
heapq.heappush(q, (0, 0))   #(それまでのcost, 頂点)
while len(q) != 0:
    top = heapq.heappop(q)
    for g in graph[top[1]]:
        cost = top[0] + g[1]
        if memo[g[0]] > cost:
            memo[g[0]] = cost
            heapq.heappush(q, (cost, g[0]))

for i in range(n):
    print(i, memo[i])


Measured memory_bytes: 6224
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    int k;
    scanf("%d", &k);
    vector <int> a(k);
    for (int i = 0; i < k; i++)
    {
        scanf("%d", &a[i]);
    }
    ll l = 2;
    ll r = 2;
    for (int i = k - 1; i >= 0; i--)
    {
        if (l % a[i]) l += a[i] - l % a[i];
        r -= r % a[i];
        r += a[i] - 1;
    }
    if (l > r)
    {
        puts("-1");
        return 0;
    }
    printf("%lld %lld\n", l, r);
}


Measured memory_bytes: 640