akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,k,a[MAXN];
void die()
{
    puts("No");
    exit(0);
}
int main()
{
    scanf("%d",&n);
    int mini=INF,maxi=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        mini=min(mini,a[i]);maxi=max(maxi,a[i]);
    }
    if(maxi-mini>1) die();
    else if(maxi==mini)
    {
        if(maxi*2>n&&maxi!=n-1) die();
    }
    else
    {
        int cnt=0;
        for(int i=1;i<=n;i++) if(a[i]==mini) cnt++;
        if(cnt+(n-cnt)/2<maxi||cnt+1>maxi) die();
    }
    puts("Yes");
    return 0;
}



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

int main()
{
	int a, b;
	int k = 1;
	cin >> a >> b;
	while(true)
	{
		if (abs(a - k) == abs(b - k))
		{
			cout << k;
			break;
		}
		if (k > 1000000000)
		{
			cout << "IMPOSSIBLE \n";
			break;
		}
		
		k++;
	}
	return 0;
}

Measured memory_bytes: 256
// 2013/11/15 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

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

		if(n==0)
			break;

		char G[257][257];
		for(int y=1; y<=n; y++){
			for(int x=1; x<=n; x++){
				cin >> G[y][x];
			}
		}

		int DP1[257][257];	// 上下
		int DP2[257][257];	// 左右
		int DP3[257][257];	// 対角線（左上）
		int DP4[257][257];	// 対角線（右上）
		for(int y=0; y<=n+1; y++){
			for(int x=0; x<=n+1; x++){
				DP1[y][x] = 0;
				DP2[y][x] = 0;
				DP3[y][x] = 0;
				DP4[y][x] = 0;
			}
		}

		int DP_max = 0;

		for(int y=1; y<=n; y++){
			for(int x=1; x<=n; x++){
				if(G[y][x]=='0')
					continue;

				DP1[y][x] = DP1[y-1][x  ]+1;
				DP2[y][x] = DP2[y  ][x-1]+1;
				DP3[y][x] = DP3[y-1][x-1]+1;
				DP4[y][x] = DP4[y-1][x+1]+1;

				DP_max = max(DP_max, max(max(DP1[y][x], DP2[y][x]), max(DP3[y][x], DP4[y][x])));
			}
		}

		cout << DP_max << endl;
	}

	return 0;
}

Measured memory_bytes: 2256
N, K = map(int, input().split(" "))
Xs = [int(a) for a in input().split()]
 
 
min = 3*(10**8)
 
p=0
z=0
m=0
Y=[]
for x in Xs:
    if x > 0:
        p += 1
        Y.append(x)
    elif x < 0:
        m += 1
    else:
        z +=1
 
    
K -= z
Z=[]
for i in range(m-1,-1,-1):
    Z.append(-Xs[i])
    
 
if K == 0:
    min = 0
if K-1 < p and K-1 >= 0:
    if Y[K-1] < min:
        min = Y[K-1]
 
if K-1 < m and K-1 >= 0:
    if Z[K-1] < min:
        min = Z[K-1]
 
for i in range(p):
    if i < K-1:
        if K-i-2 < m:
            if Y[i] * 2 + Z[K-i-2] < min:
                min = Y[i] * 2 + Z[K-i-2]
    
for i in range(m):
    if i < K-1:
        if K-i-2 < p:
            if Z[i] * 2 + Y[K-i-2] < min:
                min = Z[i] * 2 + Y[K-i-2]
 
               
print (min)

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

int main() {
	int N;
	int K;
	int q;
	int q11;
	int q22;
	long long p;
	long long p1;
	long long p2;
	long long p3;
	long long p4;
   
	cin >> N >> K;
	int a[N];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
    sort(a, a + (N), greater<int>());  // a[0:N] を大きい順にソート
  	if (N==1){
		cin >> a[0];
 		p=1000000007;
      	p+=a[0];
		p=p%1000000007;
		cout << p << endl;
      return 0;
    }
  	if (K==1){
		cin >> a[0];
 		p=1000000007;
      	p+=a[0];
		p=p%1000000007;
		cout << p << endl;
      return 0;
    }
 	if ((K!=int(K/2)*2)&&(a[0]<0)){
		p=1;
		for(int i=0;i<K;i++){
			p*=a[i];
			p=p%1000000007;
		}
		p+=1000000007;
		p=p%1000000007;
		cout << p << endl;
		return 0;
	}
	if ((K!=int(K/2)*2)&&(a[0]==0)){
		cout << 0 << endl;
		return 0;
	}
	q=0;
	q11=0;
	q22=N-1;
	for(int i=0;i<K;i++){
		if(a[q11]>=-a[q22]) {
			q11++;
		} else {
			q22--;
			q++;
		}
	}
 	if ((q%2)==1){
    	if(q11==0){
        	q11++;
        	q22++;
        } else {
	 		p1=a[q11-1];
			p2=a[q11];
	      	p3=a[q22];
			p4=a[q22+1];
			if(p1*p2<p3*p4) {
				q11--;
				q22--;
			} else {
				q11++;
				q22++;
			}
        }
	}
 	p=1;
	while (q11 > 0) {
		q11--;
		p*=a[q11];
		p=p%1000000007;
	}
	while (q22 < N-1) {
		q22++;
		p*=a[q22];
		p=p%1000000007;
	}
	p+=1000000007;
	p=p%1000000007;
	cout << p << endl;
	return 0;
}


Measured memory_bytes: 4364
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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;}

set<int>ng={'q','w','e','r','t','a','s','d','f','g','z','x','c','v','b'};

signed main()
{
	IOS();
	vector<int>ans;
	while(1){
		int N,A,B,C,X;
		cin>>N>>A>>B>>C>>X;
		if(N==0&&A==0&&B==0&&C==0&&X==0)break;
		vector<int>a(N);
		rep(i,0,N)cin>>a[i];
		int now = 0;
		int t = X;
		rep(i,0,10001){
			if(t==a[now]){
				if(now==N-1){
					ans.push_back(i);
					break;
				}else now++;
			}
			if(10000==i)ans.push_back(-1);
			t = (A*t+B)%C;
		}
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}



Measured memory_bytes: 3168
N = gets.to_i
S = gets.chomp

p = S.rindex('.') || 0
bc = 0
wc = 0
ans = 0

(p).downto(0) do |i|
  if S[i] == '#'
    bc += 1
  else
    wc += 1
  end

  if bc > wc
    ans += wc
    bc = 0
    wc = 0
  end
end

puts ans + [bc, wc].min

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

stones = input()

N = len(stones)

l = 0
r = N - 1

cnt = 0

while r - l > 0:
    while stones[l] != 'W' and r - l > 0:
        l += 1

    while stones[r] != 'R' and r - l > 0:
        r -= 1

    if r - l > 0:
        cnt += 1
        l += 1
        r -= 1
    else:
        break

print(cnt)

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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 2e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e17;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;


signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   int n, x, kol = 0;
   cin >> n >> x;
   vi a(n);
   bool ok = false;
   for (int i = 0; i < n; i++) cin >> a[i];
   sort(a.begin(), a.end());
   for (auto to : a) {
      if (x >= to) x-=to, kol++;
      else {
         if (x < to || x >= 0) {
            ok = true;
            break;
         }
      }
   }
   if (x != 0 && !ok) {
      kol--;
   }
   cout << kol;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }


int main() {
	int N;
	scanf("%d", &N);
	int *C = (int*)malloc(sizeof(int)*N);
	int *S = (int*)malloc(sizeof(int)*N);
	int *F = (int*)malloc(sizeof(int)*N);
	int ans = 0;
	for (int i = 0; i < N - 1; i++) {
		scanf("%d%d%d", &C[i], &S[i], &F[i]);
	}

	for (int j = 0; j < N; j++) {
		int tmp = 0;//経過時間
		ans = 0;
		for (int i = 0 + j; i < N - 1; i++) {
			if (tmp <= S[i]) {
				tmp = S[i];
			}
			else {
				if ((tmp - S[i]) % F[i] != 0) {
					tmp = S[i] + F[i] * ((tmp - S[i]) / F[i] + 1);
				}
				else if ((tmp - S[i]) % F[i] == 0) {
					tmp = S[i] + F[i] * (tmp - S[i]) / F[i];
				}
			}
			tmp = tmp + C[i];
		}
		ans = tmp;
		printf("%d\n",ans);
	}
#ifdef DEBUGF
	getch();
#endif
	return 0;
}

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

using i64 = int64_t;

int main(){
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int cnt = 0;
    for(int i=0;i<=n;++i){
        if(s[i] == '1')cnt++;
        if(cnt >= m){
            cout << -1 << endl;
            return 0;
        }
        if(s[i] == '0')cnt = 0;
    }

    vector<int> ans;
    int num = n;
    while(num > 0){
        int next = max(0, num - m);
        while(s[next] == '1' && next < num)next++;
        ans.push_back(num - next);
        num = next;
    }
    reverse(ans.begin(), ans.end());
    for(int i=0;i<ans.size();++i){
        if(i)cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1144
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {

		char alphabet = 'a';
		// アルファベットを格納する配列
		char[] alphabets = new char[26];
		// アルファベットの数をカウントする配列
		int[] count = new int[26];

		// 配列の中にアルファベットを格納
		for (int i = 0; i < 26; i++) {
			alphabets[i] = alphabet++;
		}

		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String sentence = scan.nextLine().toLowerCase();
			if (sentence.length() == 0) { // 文字列が空(長さゼロ)の場合
				break;
			}
			for (int i = 0; i < sentence.length(); i++) {
				for (int j = 0; j < 26; j++) {
					// 配列の要素と文字が同じとき
					if (alphabets[j] == sentence.charAt(i)) {
						// アルファベットをカウント
						count[j]++;
					}
				}
			}
		}
		// アルファベットのカウントを出力
		for (int i = 0; i < 26; i++) {
			System.out.println(alphabets[i] + " " + ":" + " " + count[i]);
		}
		scan.close();
	}
}



Measured memory_bytes: 26236
import math
N, D = map(int, input().split())
data = [list(map(int, input().split())) for i in range(N)]
distance = []
count = 0
for i in range(N):
    distance.append(abs(math.sqrt(data[i][0]**2 + data[i][1]**2)))
    if distance[i] <= D:
        count += 1
print(count)

Measured memory_bytes: 53440
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 998244353;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
struct mint {
    ll x; // typedef long long ll;
    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, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

//n -> big, a -> small
mint choose(int n,int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

int main(){
    ll n, k;
    cin >> n >> k;
    vector<int> l(k), r(k);
    rep(i, k) cin >> l[i] >> r[i];
    vector<mint> dp(n+1),dpsum(n+1);
    dp[1] = 1;
    dpsum[1] = 1;
    FOR(i,2,n+1){
        rep(j,k){
            int li = i - r[j];
            int ri = i - l[j];
            if(ri < 0)
                continue;
            li = max(li, 1);
            dp[i] += dpsum[ri] - dpsum[li - 1];
        }
        dpsum[i] += dpsum[i - 1] + dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6408
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int r,a,r1,r2,r3,r4,a1,a2,a3,a4,hit=0,blow=0;
    while (cin>>r>>a) {
        if (r==0&&a==0) {
            break;
        } else {
            r1=r/1000;
            r2=(r-r1*1000)/100;
            r3=(r-r1*1000-r2*100)/10;
            r4=r-r1*1000-r2*100-r3*10;
            a1=a/1000;
            a2=(a-a1*1000)/100;
            a3=(a-a1*1000-a2*100)/10;
            a4=a-a1*1000-a2*100-a3*10;
            if (r1==a1) {
                hit++;
            } else if (r1==a2||r1==a3||r1==a4) {
                blow++;
            }
            if (r2==a2) {
                hit++;
            } else if (r2==a1||r2==a3||r2==a4) {
                blow++;
            }
            if (r3==a3) {
                hit++;
            } else if (r3==a1||r3==a2||r3==a4) {
                blow++;
            }
            if (r4==a4) {
                hit++;
            } else if (r4==a1||r4==a2||r4==a3) {
                blow++;
            }
        }
        cout<<hit<<" "<<blow<<endl;
        hit=0;
        blow=0;
    }
}


Measured memory_bytes: 3032
/*Step by step, my body’s bouncing
Close your eyes and dance like the flow of the waves
Feels like I could fly to space
I keep humming lululu
A fair skinned child
Like going to an amusement park
Holding up her arms
Like riding the Viking
She has fallen in love, feel
Heartbeat beating so loud
As if she’ll kiss you
On your fluffy cheeks

Ok turn up the rhythm
That flirty girl
Who smiled at you last time
She’s kinda pretty today
Maybe I’m crazy
The ambulance goes beep bo beep bo
But then again
I’m dancing along

Jumping with my round butt
High till I can touch the clouds
Bungee jumping from above
Where am I right now?

Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly
Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly

Step by step, my body’s bouncing
Close your eyes and dance like the flow of the waves
Feels like I could fly to space
I keep humming lululu

Drunk with the scent of sweet fruit
My clear eyes get hazy
I feel good even if someone calls me ugly
I’ll stick my tongue out to the antis
My smile will reach my ears
Like a big eyed frog
The taste of the voice in my ears
Like sugar coated lemon

Jumping with my round butt
High till I can touch the clouds
Bungee jumping from above
Where am I right now?
Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly
Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly

Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly
Up on the jelly
Up on the jelly
Up on the up on the
Up on the jelly*/

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;
using cd = complex<double>;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<cd> vcd;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 10, K = 26, inf = 1e9, infll = 1e18;
const double pi = acos(-1);
int pref[1010];

void solve(){
    int n, j, i, k, l, r, bt;
    cin >> n >> k;
    int a[n + 2]; pref[0] = 0;
    for1(i, 1, n){
        cin >> a[i]; pref[i] = pref[i - 1] + a[i];
    }
    int ans = 0;
    vi luu; 
    for1(i, 0, n - 1){
        for1(j, i + 1, n){
            int tmp = pref[j] - pref[i]; luu.pb(tmp);
        }
    }
    forw1(bt, 50, 0){
        int cnt = 0;
        fora(v, luu){
            if((ans & v) == ans){
                if((v & (1ll << bt)) == (1ll << bt)){
                    cnt++;
                }
            }
        }
        if(cnt >= k){
            ans ^= (1ll << bt);
        }
    }
    cout << ans;
}

signed main() {
    //freopen(".INP", "r", stdin); 
    //freopen(".OUT", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}


Measured memory_bytes: 6384
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
static string[] input = Console.ReadLine().Split(' ');
static long n = long.Parse(input[0]);
static long a = long.Parse(input[1]);
static long b = long.Parse(input[2]);
static long k = long.Parse(input[3]);
static long p = 998244353;
static long answer = 0;
static long memoB = 0;
static long[] factorials = new long[n+1];
static long[] factorialRs = new long[n+1];//i!^-1(mod p), pは素数

	static void Main()
	{
  factorials[0] = 1;
  factorialRs[n] = DivideModFactorial(n,p);
   for(long i = 1; i <= n; i++)
   {
     factorials[i] = (factorials[i-1]*i)%p;
     factorialRs[n-i] = (factorialRs[n+1-i]*(n+1-i))%p;//逆元を先にメモ
   }
   
   for(long i = 0; i <= n; i++)
   {
      if((k-a*i)%b != 0 || (k-a*i)/b > n || (k-a*i)/b < 0) continue;//aに対するbが存在しないとき
      else
      {
        memoB = (k-a*i)/b;
        long memo = Comb(n, i, p);
        memo %= p;
        memo *= Comb(n, memoB, p);
        memo %= p;
        answer += memo;
        answer %= p;
      }
   }

	 Console.WriteLine(answer);
	}

  static long DivideMod(long x, long a, long p)//戻り値はx^a(mod p)
  {
    long num = 2;
    long answer = 1;
    long check = a;
    long memo = x%p;
    
    while(check > 0)
    {
      if(check % num == num / 2)
      {
        check -= num / 2;
        answer *= memo;
        answer %= p;
      }
    memo *= memo;
    memo %= p;
    num *= 2;
    }
    return answer;
  }

  static long DivideModReverse(long x, long p)//戻り値はx^-1(mod p), pは素数
  {
    long answer = DivideMod(x, p-2, p);
    return answer;
  }

  static long DivideModFactorial(long x, long p)//戻り値はx!^-1(mod p), pは素数
  {
    long answer = 1;
    for(long i = x; i >= 2; i--)
    {
      answer *= DivideModReverse(i, p);
      answer %= p;
    }
    return answer;
  }

  static long Comb(long a, long b, long p)//戻り値は組み合わせC(a,b)のmod p
  {
    long answer = 1;
    answer *= factorials[a];
    answer %= p;
    answer *= factorialRs[a-b];
    answer %= p;
    answer *= factorialRs[b];
    answer %= p;
    return answer;
  }
  
}


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

using namespace std;

#define FOR(i,a,b)  for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n)    FOR(i,0,n)
#define ALL(a)      a.begin(),a.end()
#define vi          vector<int>
#define vvi         vector<vi>
#define P           pair<int,int>
#define vP          vector<P>
#define vvP         vector<vP>

int main(){
    int n,h;cin>>n>>h;
    int aMax=0;
    vi b(n);
    REP(i,n){
        int t;cin>>t>>b[i];
        aMax=max(aMax,t);
    }
    sort(ALL(b),greater<int>());
    int res=0;
    REP(i,n){
        if(b[i]<aMax)break;
        h-=b[i];
        res++;
        if(h<=0)break;
    }
    function<int (int,int)> RoundUp=[&](int a,int b){
        return (a+b-1)/b;
    };
    if(h>0)res+=RoundUp(h,aMax);
    cout<<res<<"\n";
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	string s;
	cin >> s;
	int ans = 1;
	for (int i = 0; i < N - 1; i++) {
		if (s[i + 1] != s[i])ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define reps(i,b,n) for(int i = b ; i < (int)n ; ++i )
#define rep(i,n) reps(i,0,n)
bool flg[26];
int buff[26];
vector<int> vc[26];
void dfs(int c){
  flg[c] = false;
  rep(i,vc[c].size()) if(flg[vc[c][i]]) dfs(vc[c][i]);
}
int main(){
  int n;
  string str;
  while(cin >> n , n){
    bool ok = true;
    rep(i,26)vc[i].clear();
    fill_n(flg,26,false);
    fill_n(buff,26,0);
    int l,r;
    rep(i,n){
      cin >> str;
      l = str[0] - 'a' , r = str[str.size()-1] - 'a';
      vc[l].push_back(r);
      buff[l]++ , buff[r]--;
      flg[l] = flg[r] = true;
    }
    dfs(l);
    rep(i,26){
      if(flg[i]||buff[i]){
        ok = false;
        break;
      }
    }
    cout << (ok ? "OK" : "NG") << endl;
  }
}

Measured memory_bytes: 1276
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, A, B = map(int, readline().split())
S = readline().decode().rstrip()

cnt_A = 0
cnt_B = 0

for c in S:
    if c == 'c':
        print("No")

    elif c == 'a':
        if cnt_A + cnt_B < A + B:
            print("Yes")
            cnt_A += 1
        else:
            print("No")
    else:
        if (cnt_A + cnt_B < A + B) and (cnt_B + 1 <= B):
            print("Yes")
            cnt_B += 1

        else:
            print("No")


Measured memory_bytes: 13312
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a*c, max(b*d, max(a*d, b*c))) << endl;
	return 0;
}

Measured memory_bytes: 3192
/*input
2
ip cc
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}


int main(){
	IOS;
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	REP(i,SZ(s)*2){
		if(i&1) cout<<t[i/2];
		else cout<<s[i/2];
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a[10000],b,c=0,d=0;
  for(int i=0;i<3;i++){
    cin>>a[i];
    }
  cin>>b;
  sort(a,a+3);
  for(int i=0;i<b;i++){
    a[2]*=2;
  }
  c=a[0]+a[1]+a[2];
  cout<<c<<"\n";
}


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

int main()
{
        int N, H, W;
        int n = 0;

        std::cin >> N >> H >> W;

        for (int i = 0; i < N; ++i) {
                int h, w;
                std::cin >> h >> w;
                if (h >= H && w >= W)
                        ++n;
        }
        std::cout << n << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll dp[100005][4];
int main() {
    init();
    string S;
    cin>>S;

    ll N = S.size();
    dp[0][0] = 1;
    rep(i,N){
        rep(j, 4)(dp[i + 1][j] += dp[i][j]*(S[i]=='?'?3:1)) %= MOD;
        if(S[i]=='A'){
            (dp[i + 1][1] += dp[i][0]) %= MOD;
        }
        else if(S[i]=='B'){
            (dp[i + 1][2] += dp[i][1]) %= MOD;
        }
        else if(S[i]=='C'){
            (dp[i + 1][3] += dp[i][2]) %= MOD;
        }
        else{
            (dp[i + 1][1] += dp[i][0]) %= MOD;
            (dp[i + 1][2] += dp[i][1]) %= MOD;
            (dp[i + 1][3] += dp[i][2]) %= MOD;
        }
    }
    cout << dp[N][3] << endl;
}

Measured memory_bytes: 3664
"use strict"

const arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
const args_lines = arg_str.split('\n')
const a = args_lines[0]
const s = args_lines[1]

if(parseInt(a) < 3200){
    console.log('red')
}else{
    console.log(s)
}


Measured memory_bytes: 21064
n = int(input())
d = {}
for x in input().split():
    a = int(x)
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
ans = "No"
if len(d) == 3 and len(set([d[key] for key in d]))== 1:
    a, b, c = d.keys()
    if a == b ^ c and b == a ^ c and c == b ^ a:
        ans = "Yes"
if len(d) == 2:
    a, b = sorted(list(d.keys()))
    if a == 0 and d[b] == 2 * d[a]:
        ans = "Yes"

if len(d) == 1:
    if list(d.keys())[0] == 0:
        ans = "Yes"
print(ans)


Measured memory_bytes: 15476
/*1.4*/
#include "bits/stdc++.h"
using namespace std;

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


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

    long long dp[n+1][W+1];
    for(int i = 0; i <= n; ++i) {
        for(int j = 0; j <= W; ++j) {
            if(i == 0 || j == 0) dp[i][j] = 0;
            else if(j >= wt[i-1]) dp[i][j] = max(dp[i-1][j], (dp[i-1][j-wt[i-1]] + val[i-1]));
            else dp[i][j] = dp[i-1][j];
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    cout << dp[n][W] << endl;
}

Measured memory_bytes: 79104
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, a;

int main(){
	cin >> n;
	priority_queue<ll, vector<ll>, greater<ll>> que;
	for(ll i = 1; i <= n; i++){cin >> a; que.push(a);}
	
	ll ans = que.top(); que.pop();
	while(!que.empty()){
		ll foe = que.top(); que.pop();
		foe %= ans;
		if(foe != 0){
			que.push(ans);
			ans = foe;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;

long long gcd(long long m, long long n){
    if(n==0)return m;
    return gcd(n,m%n);
}

int main(int argc, char const *argv[]) {
    long long n,m;cin>>n>>m;
    string s,t;cin>>s>>t;
    long long g = gcd(m,n);
    long long res=m*n/g;
    for(int i=0;i<g;++i){
        if(s[i*(n/g)]!=t[i*(m/g)]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<res<<endl;
    return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    ll ans = 0;

    Vl s(N);

    if (N & 1) {
        ll idx1 = 0, idx2 = N;
        for (ll i = 1; i < N - 1; i++) {
            if (i & 1) {
                s[i] = A[--idx2];
            }
            else {
                s[i] = A[idx1++];
            }
        }
        s[0] = A[idx1++];
        s[N - 1] = A[--idx2];
        ll t = 0;
        for (ll i = 1; i < N; i++) {
            t += abs(s[i] - s[i - 1]);
        }
        ans = max(ans, t);

        idx1 = 0, idx2 = N;
        for (ll i = 1; i < N - 1; i++) {
            if (!(i & 1)) {
                s[i] = A[--idx2];
            }
            else {
                s[i] = A[idx1++];
            }
        }
        s[0] = A[idx1++];
        s[N - 1] = A[--idx2];
        t = 0;
        for (ll i = 1; i < N; i++) {
            t += abs(s[i] - s[i - 1]);
        }
        ans = max(ans, t);
    }
    else {
        ll idx1 = 0, idx2 = N;
        for (ll i = 1; i < N - 1; i++) {
            if (i & 1) {
                s[i] = A[--idx2];
            }
            else {
                s[i] = A[idx1++];
            }
        }
        s[0] = A[idx1++];
        s[N - 1] = A[--idx2];
        ll t = 0;
        for (ll i = 1; i < N; i++) {
            t += abs(s[i] - s[i - 1]);
        }
        ans = max(ans, t);
    }

    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 4768
#include <stdio.h>
#include <iostream>

using namespace std;

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

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

    int a[N];
    REP(0, i, N) {
        cin >> a[i];
        a[i]--; // zero origin
    }

    int b[N];
    REP(0, i, N) {
        b[i] = 0;
    }

    int i = 0;
    while (true) {
        if (b[i] == 1) {
            cout << -1 << endl;
            return 0;
        }

        b[i] = 1;

        if (a[i] == 1) {
            break;
        }

        i = a[i];
    }

    int cnt = 0;
    REP(0, i, N) {
        // cout << i << ' ' << b[i] << endl;
        cnt += b[i];
    }

    cout << cnt << endl;

    return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

bool compare(pii &a, pii &b){
	return a.S - a.F>b.S - b.F;
}

bool solve(){
	int n;
	cin>>n;
	vii pos, neg;
	int total_val = 0;
	forn(i, n){
		string s;
		cin>>s;
		int curr = 0, minim = 0;
		for(auto c: s){
			if(c=='(') curr++; else curr--;
			minim = min(curr, minim);
		}
		if(curr>=0)
			pos.pb(mp(minim, curr));
		else
			neg.pb(mp(minim, curr));
	}
	sort(all(pos), greater<pii>());
	sort(all(neg), compare);
	// trace(pos);
	// trace(neg);
	// trace(total_val);
	int i = 0;
	while(i<pos.size()&&total_val+pos[i].F>=0){
		total_val += pos[i].S; i++;
	}
	if(i!=pos.size())
		return false;
	i = 0;
	while(i<neg.size()&&total_val+neg[i].F>=0){
		total_val += neg[i].S; i++;
	}
	if(i!=neg.size()||total_val!=0)
		return false;
	return true;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	while(t--)
		if(solve()) cout<<"Yes"<<endl; else cout<<"No"<<endl;
}

Measured memory_bytes: 11192
N = int(input())
plan = [tuple(map(int, input().split())) for i in range(N)]
plan.insert(0, (0, 0, 0))

for i in range(1, N+1):
     t = plan[i][0] - plan[i-1][0]
     x = abs(plan[i][1] - plan[i-1][1])
     y = abs(plan[i][2] - plan[i-1][2])
     
     if t < x+y or (t - (x+y)) % 2 != 0:
         print('No')
         break
else:
    print('Yes')



Measured memory_bytes: 17312
from sys import stdin
import numpy as np
N = int(stdin.readline().rstrip())
data = []
for _ in range(N):
    data.append(int(input()))
max_val = max(data)
max2_val = sorted(data)[-2]
for i in data:
    if i == max_val:
        print(max2_val)
    else:
        print(max_val)

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


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  char c;
  cin>>c;
  if(c>='a'){cout<<'a';}
  else{cout<<'A';}
  return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String f = sc.nextLine();
		if(f.equals("RRR")){
			System.out.println(3);
		}else if(f.equals("SSS")){
			System.out.println(0);
		}else if(f.equals("SRR")){
			System.out.println(2);
		}else if(f.equals("RRS")){
			System.out.println(2);
		}else{
			System.out.println(1);
		} 
		
		
	}
}

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

int A[1<<20];
int main(void) {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }

  int r = 1;
  long long sum = 0;
  long long res = 0;
  for (int l = 1; l <= N; l++) {
    while ((r <= N) && (sum + A[r] == (sum ^ A[r]))) {
      sum += A[r];
      r++;
    }

    res += r - l;
    sum -= A[l];
  }

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


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	int n;
	scanf("%d",&n);
	int a[4][13] = {0};
	while(n--)
	{
		getchar();
		char c;
		int b;
		scanf("%c %d",&c,&b);
		
		if(c == 'S')
		{
			a[0][b-1]=1;
		}
		if(c == 'H')
		{
			a[1][b-1]=1;
		}
		if(c == 'C')
		{
			a[2][b-1]=1;
		}
		if(c == 'D')
		{
			a[3][b-1]=1;
		}
	}
	int i,j;
	for(i=0;i<4;i++)
	{
		for(j=0;j<13;j++)
		{
			if(a[i][j]==0)
			{
				if(i==0)printf("S %d\n",j+1);
				if(i==1)printf("H %d\n",j+1);
				if(i==2)printf("C %d\n",j+1);
				if(i==3)printf("D %d\n",j+1);
				
			}
		}
	}
	
	return 0;
 } 


Measured memory_bytes: 2092
#include <stdio.h>
int main(void)
{
	int H[1000],W[1000],i,j,k,l,H1=1,W1=1;
	for(i=0;(H1 != 0) || (W1 != 0);i++)
	{
		scanf("%d" "%d" ,&H1,&W1);
		H[i] = H1;
		W[i] = W1;
	}
	for(j=0;j<i-1;j++)
	{
		H1 = H[j];
		W1 = W[j];
		for(l=0;l < W1;l++)
		{
			printf("#");
		}
		for(k=0;k < H1-2;k++)
		{
			printf("\n#");
			for(l=0;l < W1-2;l++)
			{
				printf(".");
			}
			printf("#");
		}
		printf("\n");
		for(l=0;l < W1;l++)
		{
			printf("#");
		}
		printf("\n\n");
	}
	
	return 0;
}

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

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  ll x, c = 100, n = 0;
  cin >> x;

  while (c < x) {
    c *= 1.01;
    n++;
  }

  cout << n << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  std::string s;
  std::cin >> s;

  if (s[0] == s[1] and s[1] == s[2])
    std::cout << "No" << std::endl;
  else
    std::cout << "Yes" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;

int main(){

    //種類を考えずにk個分基礎ポイントが高いものをvectorに入れる
    //その時の各種類の個数をカウントする残りのn-k個分についてそれが
    //新しい種類のものなら上位k個のうちの基礎ポイントが低いほうから
    //その種類のものが1個しか入っていないものと取り換えて総合ポイントを比較していく
    
    int n,k;
    cin >> n >> k;

    vector<pair<ll,int>> v;

    rep(i,n){
        int t;
        ll d;
        cin >> t >> d;

        v.pback(mpair(d,t));
    }

    sort(ALL(v));
    reverse(ALL(v));

    //種類とその個数をいれるmap
    map<int,int> m;
    ll kind = 0;
    ll basicp = 0;

    rep(i,k){

        ll tmpd = v[i].first;
        int tmpt = v[i].second;

        if(m.find(tmpt) == m.end()){
            kind++;
        }

        m[tmpt]++;
        basicp = basicp + tmpd;
    }

    vector<ll> point;
    point.pback(basicp + kind * kind);

    //cerr << basicp << " " << kind << endl;

    int checkindex = k - 1;

    for(int i = k; i < n; i++){
        ll tmpd  = v[i].first;
        int tmpt = v[i].second;

        if(m[tmpt] == 0){

            while(checkindex >= 0 && m[v[checkindex].second] == 1){
                checkindex--;
            }

            if(checkindex >= 0){

                //cerr << checkindex << " " << v[checkindex].second <<  " " << m[v[checkindex].second] << endl;
                assert(m[v[checkindex].second] >= 2);

                basicp = basicp - v[checkindex].first + tmpd;
                kind++;
                m[v[checkindex].second]--;
                m[tmpt]++;

                point.pback(basicp + kind * kind);
                //cerr << basicp << " " << kind << endl;

                checkindex--;

            }else{
                break;
            }
        }
    }

    sort(ALL(point));

    cout << point[point.size() - 1] << endl;

    return 0;
}

Measured memory_bytes: 4848
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int len = s.length();
		String shortWord = s.substring(0, 1) + (len - 2) + s.substring(len - 1, len);

		System.out.println(shortWord);

		sc.close();
	}
}

Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.function.LongSupplier;

public class Main{ // 

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

	static LongSupplier now = new LongSupplier() {
		private long t = System.currentTimeMillis();

		@Override
		public long getAsLong() {
			long a = t;
			t = System.currentTimeMillis();
			long ans = t - a;
			return ans;
		}
	};

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	static int tr(Object... objects) {
		System.out.println("tr:" + Arrays.deepToString(objects));
		return 0;
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		// assert solve(1) == 1;

		int n = cin.nextInt();

		int[][] lrs = new int[n][];
		for (int i = 0; i < lrs.length; i++)
			lrs[i] = new int[] { cin.nextInt(), cin.nextInt() };

		now.getAsLong();

		long ans = solve(n, lrs);
		cout.println(ans);

		assert 0 == tr("elapsed", now.getAsLong());
	}

	private static long solve(int n, int[][] lrs) {
		long ans = 0;
		for (int[] lr : lrs)
			ans += lr[1] - lr[0] + 1;
		return ans;
	}

}


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

int main() {
  int N, T, A; cin >> N >> T >> A;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  int m_i = 0;
  double m = abs(T - H.at(0) * 0.006 - A);
  for (int i = 1; i < N; i++) {
    if (abs(T - H.at(i) * 0.006 - A) < m) {
      m_i = i;
      m = abs(T - H.at(i) * 0.006 - A);
    }
  }
  cout << m_i + 1 << endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ui unsigned int
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define db long double
#define mp make_pair
#define X first
#define Y second
#define vi vector<int>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define fore(i,a) for(int i=0;i<(a).size();++i)
#define ls x<<1,l,m
#define rs x<<1|1,m+1,r
#define gc getchar
inline ll rd()
{
	ll x=0,w=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();
	if(c=='-')c=gc(),w=-1;while(isdigit(c))x=x*10+c-48,c=gc();return x*w;
}
const int N=2e7+10,P=998244353;
int n,a,b,ans,fac[N],ifac[N],iv[N];
inline int C(int a,int b){return a<b||b<0?0:1ll*fac[a]*ifac[b]%P*ifac[a-b]%P;}
inline int D(int a,int b){return 1ll*C(a+b,a)*(a-b+1)%P*iv[a+1]%P;}
int main()
{
	fac[0]=1;rep0(i,1,N)fac[i]=1ll*fac[i-1]*i%P;
	iv[1]=1;rep0(i,2,N)iv[i]=1ll*(P-P/i)*iv[P%i]%P;
	ifac[0]=1;rep0(i,1,N)ifac[i]=1ll*ifac[i-1]*iv[i]%P;
	n=rd();a=rd();b=rd();if(!b){puts("1");return 0;}
	if(a!=b&&a+b==n)ans=D(b-1,a);
	rep(k,b,n-1)ans=(ans+1ll*D(b-1,k-b)*C(n-k-1+b+a-k,b+a-k))%P;
	printf("%d\n",ans);return 0;
}


Measured memory_bytes: 238108
A = int(input())
B = int(input())
C = int(input())
X = int(input())

X //= 50

res = 0

for i in range(A+1):
  rem = X-10*i
  if rem < 0:
    break
  for j in range(B+1):
    if 0 <= rem-2*j <= C:
      res += 1
      
print(res)

Measured memory_bytes: 63856
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n>>m;
  if(n==m)
  {
    c("Yes");
  }
  else c("No");
 
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 256