akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;long int a=1;string s;cin>>n>>s;
  vector<int> c(26);
  for(int i=0;i<n;i++)c.at(s.at(i)-'a')++;
  for(int i=0;i<26;i++){
    a*=(c.at(i)+1);
    a=a%(1000000007);
  }
  cout<<a-1<<endl;
}


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

ll n;
std::vector<ll> vec;
map<ll, ll> m;
int main() {
    cin >> n;
    vec.assign(n, 0);
    for (ll i = 0; i < n; i++) {
        std::cin >> vec[i];
    }
    vec.insert(vec.begin(), 0); // 0が最初からある(0が数列の中にある場合のことを考えて0を入れる)
    for (ll i = 1; i <= n; i++) {
        vec[i] = vec[i] + vec[i-1];
    }
    for (ll i = 0; i <= n; i++) {
        m[vec[i]]++;
    }
    ll ans = 0;
    for (auto e: m) {
        ans += e.second * (e.second-1) / 2; //(e.second)C2 (e.second)個から2個を取り出す組み合わせ
    }
    cout << ans << std::endl;
}


Measured memory_bytes: 15716
#include <iostream>
#include <math.h>
using namespace std;

int main(){
  int x;
  cin >> x;
  int num = 1;
  int p = 2;
  for(int i = 2; i < 33; i++){
    while(x >= pow(i, p)){
      p++;
      if(num < pow(i, (p - 1))){
	num = pow(i, (p - 1));
      }
    }
    p = 2;
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i <(int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i,k,n) for (int i = (int)(n)-1; i >= k; i--)
#define mod 1000000007
#define inf 999999999

bool p[1000000]={};
int nextp(int i){
  i+=5;
  while(i<1000000 && p[i] == false) i+=5;
  return i;
}
void sieve(){
  rep(i,1000000) p[i] = true;
  p[0] = false;
  p[1] = false;
  REP(i,2,1000){
    if(p[i])
      REP(k,2,1000){
        if(i*k<1000000) p[i*k] = false;
      }
  }
}
int main(){
  int N;
  cin >> N;
  sieve();
  int a = 11;
  int b[100]= {};
  int sum = 0;
  rep(i,N){
    b[i] = nextp(a);
    a = b[i];
  }
  rep(i,N-1){
    cout << b[i] << " ";
  }
  cout << b[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  
  int H[N];
  for (int i = 0; i < N; i++){
    cin >> H[i];
  }
  
  int h = 0;
  int num = 0;
  for(int i = 0; i < N; i++){
    if(h <= H[i])
    {
      h = H[i];
      num++;
    }
  }
  cout << num << endl;
  return 0;
      
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<ll, ll> pll;

pll parseS(string S) {
	int n = (int) S.size();
	int i = 0;
	ll a = 0, v = 1;
	bool found_dot = false;
	while (i < n) {
		if (S[i] == '.') {
			found_dot = true;
		} else {
			int d = S[i] - '0';
			if (found_dot) {
				a *= 10; a += d;
				v *= 10;
			} else {
				a *= 10; a += d;
			}
		}
		i += 1;
	}
	return {a, v};
}

pii get25(ll x) {
	ll c2 = 0;
	ll c5 = 0;
	while (x % 2 == 0) {
		x /= 2; c2++;
	}
	
	while (x % 5 == 0) {
		x /= 5; c5++;
	}
	return {c2, c5};
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	map<pair<pii, pii>, ll> V;
	for (int i = 0; i < n; i++) {
		string S;
		cin >> S;
		pll r = parseS(S);
		ll gcd = __gcd(r.first, r.second);
		r.first /= gcd;
		r.second /= gcd;
		V[{get25(r.first), get25(r.second)}]++;
	}
	ll r = 0;
	int v_i = 0;
	for (const auto & v: V) {
		int a_i = 0;
		for (const auto &a: V) {
			if (v_i < a_i) break;
			if (v_i == a_i && v.first.second.first == 0 && v.first.second.second == 0) {
				r += a.second * (a.second - 1) / 2;
			} else if (v.first.first.first >= a.first.second.first 
				&& v.first.first.second >= a.first.second.second
				&& v.first.second.first <= a.first.first.first
				&& v.first.second.second <= a.first.first.second) {
				r += v.second * a.second;
			}
			a_i++;
		}
		v_i++;
	}

	cout << r << endl;
}


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

using ll = long long;
using ld = long double;

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

  int n;
  vector<int> ve;
  cin >> n;
  for(int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ve.emplace_back(x);
  }
  sort(ve.begin(), ve.end());
  int sum = 0, idx = -1;
  bool ada = 0;
  for(int i = 0; i < n; i++) {
    sum += ve[i];
    if(!ada && ve[i] % 10 != 0) {
      ada = true;
      idx = i;
    }
  }
  if(sum % 10 != 0) {
    cout << sum;
  } else {
    cout << (ada ? sum - ve[idx] : 0);
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double EPS= (1e-9);
using namespace std;
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=100000+9,mod=1000000000+7;
ll cnt[N],fres[N];
void go(int n){

   for(int i=1;i*i<=n;i++){

       if(n%i==0){
         cnt[i]++;
         if(n/i!=i) cnt[n/i]++;
       }

   }
}
ll power(ll b,ll p){

   if(p==0) return 1;
   if((p&(1ll))){
     return b%mod*power((b*b)%mod,p/2)%mod;
   }
   else{
    return  power((b*b)%mod,p/2);
   }
}
int main(){
    GO();
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        go(i);
    }
    ll ans=0;
    for(int i=k;i>=1;i--){
        fres[i]=power(cnt[i],n);
         for(int j=i*2;j<=k;j+=i){
            fres[i]=((fres[i]-fres[j])+mod)%mod;
         }
         ans+= (1ll*fres[i]*i)%mod;
         if(ans>=mod) ans-=mod;

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




































Measured memory_bytes: 5172
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> mount(n, 0);
    ll mp = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(i%2 == 0){
            mp += a[i];
        }else{
            mp -= a[i];
        }
    }

    mount[0] = mp;
    for(int p=1;p<n;p++){
        mount[p] = 2*(a[p-1] - (mount[(p-1)]/2));
    }
    for(int i=0;i<n;i++){
        cout << mount[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2944
#include <iostream>
#include <stdio.h>
#include <utility>
using namespace std;

class Dice{
public:
  int value[6];
  void roll(char _order) {
    switch(_order) {
    case 'N':
      swap(value[4], value[0]);
      swap(value[0], value[1]);
      swap(value[1], value[5]);
      break;
    case 'E':
      swap(value[2], value[0]);
      swap(value[0], value[3]);
      swap(value[3], value[5]);
      break;
    case 'S':
      swap(value[1], value[0]);
      swap(value[0], value[4]);
      swap(value[4], value[5]);
      break;
    case 'W':
      swap(value[0], value[2]);
      swap(value[2], value[5]);
      swap(value[5], value[3]);
      break;
    }
  }
};

int main() {
  Dice dice;
  for (int i=0;i<6;i++)
    cin >> dice.value[i];
  char c;
  getchar();
  while ((c = getchar()) != '\n')
    dice.roll(c);
  cout << dice.value[0] << endl;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll func(ll n,ll x)
{
    while(n%x==0)
        n/=x;
    if(n%x==1)
        return 1;
    else return 0;
}
int main()
{
	ll t;
	t=1;
	while(t--)
    {
        ll n;
        cin>>n;
        if(n==2)
        {
            cout<<1<<"\n";
            continue;
        }
        ll s=0;
        for(ll i=2;i*i<=(n-1);i++)
        {
            if((n-1)%i==0)
            {
                s++;
                if((n-1)/i != i)
                    s++;
            }
        }
        ll c=0;
        for(ll i=2;i*i<=n;i++)
        {
            if(n%i==0){
                c+=func(n,i);
            if(n/i != i)
                c+=func(n,n/i);
            }
        }
        cout<<c+s+2;
    }
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
  if i==0:
    s+=b[a[0]-1]
  elif a[i]==a[i-1]+1:
    s=s+b[a[i]-1]+c[a[i]-2]
  else:
    s=s+b[a[i]-1]
print(s)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
    int N,D,a,b,x,c;
    cin >> N >> D;
    a=D*2+1;
    b=N/a;
    c=N%a;
    x=0;
    if(c==0)
        x=b;
    else
        x=b+1;
    cout << x;
    return 0;
}

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

 
int main(){
        int n,m,q;
        cin >> n >> m >> q;
        vector<vector<int>> train(n+1,vector<int>(n+1,0));
        rep(i,m){
                int l,r;
                cin >> l >> r;
                train[l][r] ++;
        }

        rep(i,n+1)for(int j=1;j<=n;j++) train[i][j] += train[i][j-1];
        rep(i,n+1)for(int j=1;j<=n;j++) train[j][i] += train[j-1][i];

        /*rep(i,n+1){
                rep(j,n+1) cout << train[i][j] << " ";
                cout << endl;
        }*/

        rep(i,q){
                int l,r;
                cin >> l  >> r;
                cout << train[r][r] - train[l-1][r] - train[r][l-1] + train[l-1][l-1] <<endl;
        }

        return 0;
}






Measured memory_bytes: 1920
def get_x(k, i, x)
  if i >= k then
    x
  else
    get_x(k, i * 2, x + 1)
  end
end

n, k = gets.strip.split(' ').map(&:to_i)
ans = 0

(1..n).each do |i|
#  if i >= k then
#    x = 0
#  else
#    x = Math.log(k / i, 2).ceil
#  end
  x = get_x(k, i, 0)
  ans += (0.5 ** x) / n
end

puts ans


Measured memory_bytes: 1788
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()
bl = all(x % 3 == 0 or x % 5 == 0 for x in A if x % 2 == 0)
print('APPROVED' if bl else 'DENIED')


Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

#define INF 255*255*20000
int n,m;
int c[17],x[30000];
int dp[20001][256];
int main(void){
	while(1){
		scanf("%d %d",&n,&m);
		if(n+m==0)break;
		for(int i=0;i<m;i++){
			scanf("%d",&c[i]);
		}
		for(int i=0;i<n;i++){
			scanf("%d",&x[i]);
		}
		memset(dp,-1,sizeof(dp));
		dp[0][128]=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<256;j++){
				if(dp[i][j]>=0){
					for(int k=0;k<m;k++){
						int nx=j+c[k];
						if(nx<0)nx=0;
						if(nx>255)nx=255;
						int np=pow(nx-x[i],2);
						if(dp[i+1][nx]>np+dp[i][j] || dp[i+1][nx]==-1){
							dp[i+1][nx]=np+dp[i][j];
						}
					}
				}
			}
		}
		int res=INF;
		for(int i=0;i<256;i++){
			if(dp[n][i]>=0)res=std::min(res,dp[n][i]);
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 21116
#C
S = list(str(input()))
N = len(S)
K = int(input())

cand = []
for i in range(N):
    s = S[i]
    cand.append(s)
    for j in range(K):
        if i+j+1 < N:
            s+=S[i+j+1]
            cand.append(s)
            
cand.sort()
old = ""
shin = []
for c in cand:
    if c != old:
        shin.append(c)
        old = c
        
shin.sort()
print(shin[K-1])


Measured memory_bytes: 4956
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    string S,ans;
  	cin >> S;
  	REP(i,S.size()){
      ans +="x";
    }
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>vc;
vector<int>add;
vector<bool>visited;

void dfs(int v) {
    visited[v] = true;
    for (int u : vc[v]) {
        if (!visited[u]) {
            add[u] += add[v];
            dfs(u);
        }
    }
}

int main()
{
    int n, q;
    scanf("%d %d", &n, &q);
    vc.assign(n + 1, vector<int>());
    add.assign(n + 1, 0);
    visited.assign(n + 1, 0);
    for(int i = 0; i < n - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        vc[a].emplace_back(b);
    }
    while(q--) {
        int a, b;
        scanf("%d %d", &a, &b);
        add[a] += b;
    }
    dfs(1);
    for(int i = 1; i <= n; i++) {
        printf("%d%c", add[i], " \n"[i == n]);
    }
}


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


void solve(long long N, std::vector<long long> H){
  ll x = H[0];
  ll ans = 0;
  ll cnt = 0;
  for(int i=1; i<N; i++) {
    if(x < H[i]) {
      ans = max(ans, cnt);
      cnt = 0;
    } else {
      cnt++;
    }
    x = H[i];
  }
  ans = max(ans, cnt);
  std::cout << ans << std::endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, std::move(H));
    return 0;
}


Measured memory_bytes: 4016
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int n, mem[500010];
string s;
int dp(int x){
  if(x>=n)
    return 0;
  if(mem[x]!=-1)
    return mem[x];
  int res=0, tmp=0, tmp1;
  for(int i=x; i<n; ++i){
    if(s[i]=='0'){
      tmp1=0;
      for(int j=i+1; j<n; ++j){
        if(s[j]=='1')
          ++tmp1;
        else
          break;
      }
      if(tmp>0&&tmp1>0){
        res=max(max(tmp+dp(i+2), tmp1+dp(i+tmp1+1)), tmp1-1+dp(i+tmp1));
      }
      else{
        res=dp(i+1);
      }
      break;
    }
    else{
      ++tmp;
    }
  }
  mem[x]=res;
  return res;
}

int main(){
  while(cin>>n){
    cin>>s;
    memset(mem, -1, sizeof mem);
    int ans=dp(0);
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 41860
import java.util.Scanner;


public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int aa=String.valueOf(a).length();
        int bb=String.valueOf(b).length();
        if((aa==1&&bb==1)||(aa==2&&bb==1)||(aa==3&&bb==1)){
          int c=10*a+b;
         for(int i=0;i<c;i++){
            if(i*i==c){
                System.out.println("Yes");
                break;
            }else if(i==c-1){
                System.out.println("No");
            }
        
        }
}
        if((aa==1&&bb==2)||(aa==2&&bb==2)||(aa==3&&bb==2)){
            int c=100*a+b;
            for(int i=0;i<c;i++){
                if(i*i==c){
                    System.out.println("Yes");
                    break;
                }else if(i==c-1){
                    System.out.println("No");
                }
            
            }
    }
        
        if((aa==1&&bb==3)||(aa==2&&bb==3)||(aa==3&&bb==3)){
            int c=1000*a+b;
            for(int i=0;i<c;i++){
                if(i*i==c){
                    System.out.println("Yes");
                    break;
                }else if(i==c-1){
                    System.out.println("No");
                }
            
            }
    }
        

        


    }
}

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

long long x,x1,ans;

int main(){
  cin >> x;

  x1=x/500;
  x=x%500;

  ans+=(x1*500*2);
  
  x1=x/5;

  ans+=(x1*5);

  cout << ans << endl;
}


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

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

  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      ans++;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	
	cin>>N;
	
	N %= 10;
	
	if(N == 3) cout<<"bon"<<endl;
	else if(N <= 1 || N == 6 || N == 8) cout<<"pon"<<endl;
	else cout<<"hon"<<endl;
 	
	
	
	return 0;
}

Measured memory_bytes: 3132
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int count = 1;
	while(scan.hasNext()) {
	    String input = scan.next();
	    if (input.equals("0")) {
		break;
	    }
	    System.out.println("Case " + count++ + ": " + input);
	}
    }
}

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

int main(){
  int n; cin >>n;
  vector<int> p(n);
  rep(i,n) cin >>p[i];
  int cnt = 0;
  rep(i,n){
    if(p[i]==i+1) {
      cnt++;
      i++;
    }
  }
  cout << cnt << endl;
  return 0;
}

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

using namespace std;
typedef long long int ll;

int main()
{


    string s,s1,s2;
    ll n,a,ds=0,sz,c=5,m,ans=0;
    cin>>n;
    m=n;
    stringstream ss;
    ss<<n;

    s=ss.str();
    sz=s.size();

   for(int i=0;i<sz;i++)
      {
          ds=ds+(s[i]-48);
      }

    if(m%ds==0) cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 256
def sub():
    S = input()
    maxCount = 0
    count = 0
    acgt = ["A", "C", "G", "T"]
    for c in S:
        if c in acgt:
            count = count + 1
            if count > maxCount:
                maxCount = count
        else:
            count = 0
    print(maxCount)



sub()



Measured memory_bytes: 2940
import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val menus = List.fill(5)(sc.nextInt())

    val a = menus.zip(menus.map(_ % 10).map{b =>
      if (b == 0) 0 else 10 - b
    }).sortWith((A, B) => A._2 > B._2)
    val times = a.head._1 + a.tail.map{ case (c, d) => c + d }.sum
    println(times)
  }

}


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


int factor(int n){
    int N;
    N = 0;
    for (int i = 1; i <= n; i++) (n % i == 0) && (N++); 
    return N;
}


int main(){
    int N,ans;
    ans = 0;
    cin >> N;
    for(int i = 1; i <= N; i++){
        if (i % 2 == 1 && factor(i) == 8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main 
{           
    public static void main(String[] args) 
    {
        Scanner scan = new Scanner (System.in);

        int W = scan.nextInt();
        
        int H = scan.nextInt();
        
        int x = scan.nextInt();
        
        int y = scan.nextInt();
        
        int r = scan.nextInt();
       
        if( x + r <= W && y + r <= H &&  x - r >= 0 && y - r  >= 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }        
}      


Measured memory_bytes: 26296
#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 n,m;
  cin>>n>>m;
  int a[11000];
  int sum=0;
  rep(i,m){
    cin>>a[i];
    sum+=a[i];
  }
  if(n-sum<0){
    cout<<"-1"<<endl;
  }else{
    cout<<n-sum<<endl;
  }
  return 0;

}

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

long long n, m;

int main()
{	
	cin >> n;

	m = n - 1;

	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0)
			m = i + n / i - 2;
	}

	cout << m << endl;

	return 0;
}

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

#define ff              first
#define ss              second
#define ll            long long

#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void sb()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int main()
{
	//sb();
ll n;
cin>>n;
ll p =100;

ll count = 0;

while(p<n){
    count++;
   p = floor(p*(1.01));
}
cout<<count;

return 0;
}



Measured memory_bytes: 3724
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();

    sc.close();

    int current = 1;

    for (int i = 0; i < N; i++) {
      if (current < K) {
        current = current * 2;
      } else {
        current += K;
      }
    }

    System.out.println(current);

  }

}

Measured memory_bytes: 23124
#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
using namespace std;

typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
using modint = ModInt<1000000007>;
#endif
#line 3 "math/factorial.cpp"
using namespace std;

template <int mod>
struct Factorial {
  using mint = ModInt<mod>;
  vector<modint> Fact, Finv;
public:
  Factorial(int _n): Fact(_n+1), Finv(_n+1) {
      Fact[0]=mint(1); for (int i = 0; i < _n; ++i) Fact[i+1]=Fact[i]*(i+1);
      Finv[_n]=mint(1)/Fact[_n]; for (int i = _n; i > 0; --i) Finv[i-1]=Finv[i]*i;
  }
  mint fact(int n,bool inv=0) { if (inv) return Finv[n]; else return Fact[n]; }
  mint nPr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[n-r]; }
  mint nCr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[r]*Finv[n-r]; }
};

using factorial = Factorial<1000000007>;


modint s(int r, int c) { 
  factorial fact(2000020);
  modint ret = 0;
  for (int i = 0; i <= r; ++i) {
    ret += fact.nCr(i+1+c, i+1);
  }
  return ret;
}

int main() {
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  modint ans = s(r2,c2)-s(r1-1,c2)-s(r2,c1-1)+s(r1-1,c1-1);
  cout << ans.val << endl;
}



Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int a,b;
  cin>>a>>b;
  set<int> st={1,2,3};
  st.erase(a);
  st.erase(b);
  for(auto&& e: st) 
  {
    cout<<e<<endl;
  }
}

Measured memory_bytes: 256
from collections import defaultdict
N,M = map(int,input().split())

D = defaultdict(lambda: N+1)
for i in range(M):
    a,b = map(int,input().split())
    if b<D[a]:D[a]=b
        
side_b_min = N+1
ans = 0
for i in range(1,N+1):
    if i == side_b_min:
        side_b_min = N+1
        ans += 1
    if D[i] < side_b_min: side_b_min = D[i]
    #print(i,side_b_min)
    
print(ans)

Measured memory_bytes: 18240
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>

#define LL long long

using namespace std;

int H,W,K,S[11][1111],ans=1e9;

int main() {
	cin>>H>>W>>K;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++){
		char c;
		cin>>c;
		S[i][j]=c-'0';
	}
	for(int i=0;i<(1<<(H-1));i++){
		int area[11],arcnt[11]={},tmp=0;//区域/各区域のcnt/カット回数
		bool psbl=true;//不可能でない
		area[0]=0;
		for(int j=0;j<H-1;j++){//区分け
			if(i&(1<<j)){area[j+1]=area[j]+1;tmp++;}
			else area[j+1]=area[j];
		}

		for(int x=0;x<W;x++){
			int narcnt[11]={};//この行でのcnt
			bool flg=true;//切らぬべきか
			for(int y=0;y<H;y++){//ncolのみに加算
				narcnt[area[y]]+=S[y][x];
				if(narcnt[area[y]]>K){
					psbl=false;break;
				}
				else if(arcnt[area[y]]+narcnt[area[y]]>K)
					flg=false;
			}

			if(!psbl)break;
			if(flg)for(int ar=0;ar<=area[H-1];ar++)arcnt[ar]+=narcnt[ar];
			else {//切ってwhにncolをコピー
				tmp++;
				for(int ar=0;ar<=area[H-1];ar++)arcnt[ar]=narcnt[ar];
			}
		}

		if(!psbl)continue;
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
//#include<array>
#include<algorithm>
#include<queue>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
//#include<bitset>
//#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//配列,座標
/*array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
array<int, 4>dir_x2 = { 0,0,1,-1 };
array<int, 4>dir_y2 = { 1,-1,0,0 };
char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };*/

//Union Find
/*class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};*/

//最大公約数,最小公倍数
/*LLI gcd(LLI x, LLI y) {
	LLI  r;
	if (x < y) {
		swap(x, y);
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}
LLI lcm(LLI x, LLI y) {
	return x / gcd(x, y) * y;
}*/

//組み合わせ
/*long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; i--) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; i++) {
		ans = ans / i;
	}
	return ans;
}
long nHr(int n, int r) {
	n = n + r - 1;
	return nCr(n, r);
}*/

//素数判定
bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

//桁数
/*LLI GetDigit(LLI num) {
	LLI digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}*/

//サンプル
/*const int n_max = 8;
array<array<bool, n_max>, n_max>graph;
int dfs(int v,int N,array<bool,n_max>visited) {
	int ret = 0;
	bool all_visited = true;
	for (int i = 0; i < N;i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}
	if (all_visited) {
		return 1;
	}
	for (int i = 0; i < N;i++) {
		if (graph[v][i] == false) {
			continue;
		}
		if (visited[i] == true) {
			continue;
		}
		visited[i] = true;
		ret += dfs(i,N,visited);
		visited[i] = false;
	}
	return ret;
}*/

//サンプル
/*vector<vector<int>>sub;
int dfs(int id) {
	if (sub[id].size() == 0) {
		return 1;
	}
	int minP = (int)1e9;
	int maxP = 0;
	for (int i : sub[id]) {
		int P = dfs(i);
		minP = min(minP, P);
		maxP = max(maxP, P);
	}
	return minP + maxP + 1;
}*/

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI X;
	cin >> X;
	while (!IsPrime(X)) {
		X++;
	}
	cout << X << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll d; cin >> d;
    vector<ll> c(26);
    for(int i = 0; i < 26; i++) cin >> c[i];
    vector s(d, vector<ll>(26));
    rep(i,0,d)rep(j,0,26){
        cin >> s[i][j];
    }
    vector<ll> t(d);
    for(int i = 0; i < d; i++){
        cin >> t[i];
        t[i]--;
    }
    vector<ll> last(26, -1);
    ll ans = 0;
    rep(i,0,d){
        ans += s[i][t[i]];
        last[t[i]] = i;
        ll sum = 0;
        rep(j,0,26)
            sum += c[j] * (i - last[j]);
        ans -= sum;
        cout << ans << "\n";
    }
}

Measured memory_bytes: 3756
#include<iostream>
using namespace std;
int main(){
  double h;
  while(cin>>h){
    if(h<=48.000) cout << "light fly" << endl;
    else if(h<=51.000) cout << "fly" << endl;
    else if(h<=54.000) cout << "bantam" << endl;
    else if(h<=57.000) cout << "feather" << endl;
    else if(h<=60.000) cout << "light" << endl;
    else if(h<=64.000) cout << "light welter" << endl;
    else if(h<=69.000) cout << "welter" << endl;
    else if(h<=75.000) cout << "light middle" << endl;
    else if(h<=81.000) cout << "middle" << endl;
    else if(h<=91.000) cout << "light heavy" << endl;
    else if(h>91.000) cout << "heavy" << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll x, y , z;
    ll k;

    vector<ll> vx,vy,vz;

    cin >> x >> y >> z >> k;

    rep(i, x){
        ll inp; cin >> inp;
        vx.pb(inp);
    }
    rep(i, y){
        ll inp; cin >> inp;
        vy.pb(inp);
    }
    rep(i, z){
        ll inp; cin >> inp;
        vz.pb(inp);
    }

    vector<ll> ans1, ans2;

    rep(i, x)rep(j, y){
        ans1.pb(vx[i] + vy[j]);
    }
    sort(rall(ans1));

    ll siz = min(k, (ll)ans1.size()) ;
    rep(i, siz )rep(j, z){
        ans2.pb(ans1[i] + vz[j]);
    }

    sort(rall(ans2));

    rep(i, k){
        cout << ans2[i] << endl;
    }




    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int w;
    while (cin >> w) {
        vector<int> v;
        for (int i = 0; i <= 9; i++) {
            if (w >> i & 1) {
                v.push_back(1<<i);
            }
        }
        for (int i = 0; i < (int)v.size(); i++) {
            if (i > 0) cout << " ";
            cout << v[i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3076
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>

using namespace std;

typedef struct {
	int start;
	int end;
} Confrict;

// 構造体vectorのソート方法を指定する関数
bool cmp_end(const Confrict& left, const Confrict& right) {
	return left.end < right.end;
}

int main() {

	int N, K;
	cin >> N >> K;
	vector<int> dislike;
	for (int i = 0; i < K; i++) {
		int tmp;
		cin >> tmp;
		dislike.push_back(tmp);
	}

	int pay = N;
	while (true) {

		int order1 = pay % 10;
		int order2 = (pay % 100) / 10;
		int order3 = (pay % 1000) / 100;
		int order4 = (pay % 10000) / 1000;
		int order5 = (pay % 100000) / 10000;

		bool order5is0 = (order5 == 0);
		bool order4is0 = (order4 == 0);
		bool order3is0 = (order3 == 0);
		bool order2is0 = (order2 == 0);

		bool order5Notdislike = true;
		for (int i = 0; i < dislike.size(); i++) {
			if (order5 == dislike[i]) order5Notdislike = false;
		}
		bool order4Notdislike = true;
		for (int i = 0; i < dislike.size(); i++) {
			if (order4 == dislike[i]) order4Notdislike = false;
		}
		bool order3Notdislike = true;
		for (int i = 0; i < dislike.size(); i++) {
			if (order3 == dislike[i]) order3Notdislike = false;
		}
		bool order2Notdislike = true;
		for (int i = 0; i < dislike.size(); i++) {
			if (order2 == dislike[i]) order2Notdislike = false;
		}
		bool order1Notdislike = true;
		for (int i = 0; i < dislike.size(); i++) {
			if (order1 == dislike[i]) order1Notdislike = false;
		}

		bool order5OK = (order5Notdislike | order5is0);
		bool order4OK = (order4Notdislike | (order5is0&&order4is0));
		bool order3OK = (order3Notdislike | (order5is0&&order4is0&& order3is0));
		bool order2OK = (order2Notdislike | (order5is0&&order4is0 && order3is0 && order2is0));
		bool order1OK = (order1Notdislike);


		if(order1OK&& order2OK&& order3OK&& order4OK&& order5OK){
			break;
		}
		else {
			pay++;
		}
	}
	cout << pay << endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) { 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}

void solve() {
	int x;
	cin >> x;
	int mx = -1;
	for (int i = 0; ; i++) {
		if ((1ll << i) <= x) {
			mx = (1ll << i);
		} else {
			break;
		}
	}	
	cout << 2ll * mx - 1ll;
}   

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

int main(){
	int n,k;
	string s;
	cin >> n >> k >>s;
	int hps{};
	for(int i=0; i<n; i++){
		if(s.at(i)=='L'){
			if(i-1>=0&&s.at(i-1)=='L') hps++;
		}
		if(s.at(i)=='R'){
			if(i+1<n&&s.at(i+1)=='R') hps++;
		}
	}
	cout << min(n-1,hps+k*2) << endl;
	
}

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


int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    int x = *max_element(v.begin(), v.end());
    int y = *min_element(v.begin(), v.end());
    cout << x - y << endl;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

ll dp[51][2501];

void solve() {
  dp[0][0] = 1;
  int n, A; cin >> n >> A;
  for (int i = 1; i <= n; i++) {
    int v; cin >> v;
    for (int cnt = i - 1; cnt >= 0; cnt--) {
      for (int sum = 0; sum <= 2500; sum++) {
        dp[cnt + 1][sum + v] += dp[cnt][sum];
      }
    }
  }
  ll ans = 0;
  for (int cnt = 1; cnt <= n; cnt++) {
    int sum = cnt * A;
    ans += dp[cnt][sum];
  }
  cout << ans;
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
  solve();
}


Measured memory_bytes: 4560
#include<stdio.h>

int Btree(int[],int,int);

int main(){
  int n,data[100001],q,key,i,total=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&data[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(Btree(data,key,n))total++;
  }
  printf("%d\n",total);
  return 0;
}

int Btree(int data[],int key,int n){
  int left,right,mid;
  left=0;
  right=n;
  while(left<right){
    mid=(left+right)/2;
  if(data[mid]==key)return 1;
  else if(key<data[mid])right=mid;
  else left=mid+1;
  }
  return 0;
}



Measured memory_bytes: 2144
N, M = map(int,input().split())
PY = [list(map(int,input().split())) + [0] for _ in range(M)]
sort_PY = sorted(PY, key = lambda x: x[1])

city = {}
for i in range(M):
  p, y = sort_PY[i][0], sort_PY[i][1]
  if p in city:
    city[p] += 1
  else:
    city[p] = 1
  sort_PY[i][2] = city[p]
for p, y, z in PY:
  print(str(p).zfill(6)+str(z).zfill(6))

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

int main()
{
	int a, b;
	int count;

	cin >> a >> b;

	for (int i = 1; i <= a; ++i)
	{
		if (i == a)
		{
			for (int j = 1; j <= b; ++j)
			{
				if (i == j)
				{
					count++;
				}
			}			
		} else {
			for (int j = 1; j <= 31; ++j)
			{
				if (i == j)
				{
					count++;
				}
			}
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 200006
using namespace std;
struct arr{long long to,ne;}e[N<<1];bool flag;
long long n,cnt,x,y,rt,v[N],f[N],g[N],d[N],head[N];
inline long long read()
{
	long long x=0,c=getchar();while(c<48)c=getchar();
	while(c>47)x=x*10+c-48,c=getchar();return x;
}
inline void add(long long x,long long y)
{
	e[++cnt].to=y;e[cnt].ne=head[x];head[x]=cnt;
}
void dfs(long long x,long long fa)
{
	long long siz=1;
	for(long long i=head[x];i;i=e[i].ne)
		if(e[i].to!=fa)siz++,dfs(e[i].to,x);
	if(siz==1)g[x]=v[x];
	else{
		long long tot=0;
		for(long long i=head[x];i;i=e[i].ne)
			if(e[i].to!=fa)f[++tot]=g[e[i].to];
		sort(f+1,f+tot+1);
		long long sum=0;
		for(long long i=1;i<tot;i++)sum+=f[i];
		long long tmp=max(f[tot]-sum,(sum+f[tot])&1);
		sum+=f[tot];
		if(sum<v[x]||tmp+(sum-tmp)/2>v[x])flag=1;
		else{
			long long xx=sum-v[x],yy=v[x]-xx;
			g[x]=yy;
		}
	}
}
int main()
{
	n=read();
	for(long long i=1;i<=n;i++)v[i]=read();
	for(long long i=1;i<n;i++){
		x=read();y=read();
		add(x,y);add(y,x);
		d[x]++;d[y]++;
		if(d[x]>1)rt=x;
		if(d[y]>1)rt=y;
	}
	if(rt==0){
		if(v[1]!=v[2])puts("NO");else puts("YES");
		return 0;
	}
	dfs(rt,0);if(g[rt]||flag)puts("NO");else puts("YES");
}

Measured memory_bytes: 16384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;


public class Main {


    public static void main(String[] args) throws IOException {
        MyScanner scanner = new MyScanner();
        PrintStream out = System.out;

        Main main = new Main();

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int h = scanner.nextInt();

        out.println( ((a + b)*h)/2  );

        scanner.reader.close();
        out.close();
    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader reader;

        public MyScanner() {
            this.reader = new BufferedReader(new InputStreamReader(System.in));
        }

        public void close() throws IOException {
            this.reader.close();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(this.next());
        }

        String next() {
            String str = "";
            try {
                str = this.reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        String[] nextStringArray() {
            String[] str = null;
            try {
                str = this.reader.readLine().trim().split(" ");
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray() {
            String[] data  = nextStringArray();
            int[] a  = new int[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        Integer[] nextIntegerArray() {
            String[] data  = nextStringArray();
            Integer[] a  = new Integer[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        long[] nextLongArray() {
            String[] data  = nextStringArray();
            long[] a  = new long[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Long.parseLong(data[i]);
            }

            return a;
        }
    }
}



Measured memory_bytes: 8020
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001;
const int NMAX=8;
const int mod=1000000007;


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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}




int main()
{
  string l;
  cin>>l;
  int n=l.size();
  int d[n+5][2];
  rep(i,n+1)rep(j,2)d[i][j]=0;
  d[0][0]=1;
  d[0][1]=0;
  //d[n][0]が一致、d[n][1]が未満
  rep(i,n){
    if (l[i]=='1'){
    //  cout<<'1'<<endl;
      d[i+1][0]=(d[i][0]+d[i][0])%mod;

      d[i+1][1]=(d[i][0]+d[i][1])%mod;
      (d[i+1][1]+=d[i][1]*2%mod)%=mod;
    }
    else if (l[i]=='0'){
      d[i+1][0]=d[i][0];

      (d[i+1][1]=d[i][1])%=mod;
      (d[i+1][1]+=d[i][1]*2%mod)%=mod;

    }
  //  cout<<d[i+1][0]<<" 0"<<endl;
  //  cout<<d[i+1][1]<<" 1"<<endl;
  }
  int ans=d[n][0]%mod+d[n][1]%mod;
  ans=ans%mod;
  cout<<ans;



}


Measured memory_bytes: 1280
def main():
    S = input()
    N = len(S)
    K = int(input())
    dp = [[[0]*(K+2) for j in range(2)] for i in range(N+1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(2):
            for k in range(K+1):
                lim = (9 if j else int(S[i]))
                for d in range(lim + 1):
                    # print(i, j, lim, d, j or d < lim)
                    dp[i+1][j or d < lim][k + (d != 0)] += dp[i][j][k]
    print((dp[N][0][K]+dp[N][1][K]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 39920
#include<stdio.h>
int a[305][305];
bool v[305][305];
long long ans;
main(){
	int n;scanf("%d",&n);
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			scanf("%d",&a[i][j]);
	for(register int k=1;k<=n;k++){
		for(register int i=1;i<=n;i++){
			for(register int j=1;j<=n;j++){
				if(k!=i&&k!=j&&i!=j){
					if(a[i][j]==a[i][k]+a[k][j])
						v[i][j]=1;
					else if(a[i][j]>a[i][k]+a[k][j]){
						puts("-1");
						return 0;
					}
				}
			}
		}
	}
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			if(!v[i][j])
				ans+=a[i][j];
	printf("%lld\n",ans/2);
	return 0; 
} 

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    int n, h[100];

    cin >> n;

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

    int ans = 0;
    bool flag;
    for (int i=0; i<100; i++) {
        flag = true;
        for (int j=0; j<n; j++) {
            if (flag && h[j] > 0) {
                flag = false;
                ans++;
            }
            else if (!flag && h[j] <= 0) {
                flag = true;
            }

            h[j]--;
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
s = input()

def f(s):
    if len(s)%2 ==0:
        if s[0:len(s)//2] == s[len(s)//2:len(s)]:
            return True
        else:
            return False
    else:
        return False

for i in range(1,len(s)):
    if f(s[0:len(s)-i]):
        print(len(s[0:len(s)-i]))
        break

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int n;
    cin >> n;
    
    long long int current, next = 0;
    int count, max = 0;
    cin >> next;
    for (int i = 1; i < n; i++)
    {
        current = next;
        cin >> next;
        if (next <= current) count++;
        else
        {
            if (count > max) max = count;
            count = 0;
        }
    }
    if (count > max) max = count;

    cout << max << endl;
    
    return 0;    
}

Measured memory_bytes: 256