akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  ll X, Y; cin >> X >> Y;
  Y /= X;
  ll ans{1};
  while (Y >= 2) {
    Y /= 2;
    ++ans;
  }
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
mod = 998244353
n = int(input())
d = list(map(int, input().split()))

if d[0] != 0:
    print(0)
    exit(0)

max_d = max(d)
cnt = [0] * (max_d + 1)

for num in d:
    cnt[num] += 1

if cnt[0] > 1:
    print(0)
    exit(0)

ans = 1

for i in range(1, len(cnt)):
    ans *= pow(cnt[i - 1], cnt[i], mod)
    ans %= mod

print(ans)


Measured memory_bytes: 84604
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

A.sort()

def f(X):
    cnt = 0
    for a in A:
        if a <= X:
            continue
        t = a//X
        if t*X == a:
            t -= 1
        cnt += t
    return cnt

l = 1
r = max(A)
while r-l > 0.01:
    m = (r+l)/2
    if f(m) <= K:
        r = m
    else:
        l = m

if int(l) < l:
    print(int(l)+1)
else:
    print(int(l))

Measured memory_bytes: 93936
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<utility>

typedef long long ll;
#define INF 1000000000
#define MOD 1000000007

using namespace std;

ll dp[100001];

int main() {
	ll n, k;
	cin >> n >> k;
	ll h[100001];
	for (ll i = 0; i < n; i++) cin >> h[i];
	for (ll i = 1; i < 100001; i++) dp[i] = INF;

	ll ans = 0;
	for (ll i = 0; i <= n-2; i++) {
		for (int j = 1; j <= k; j++) {
			if (i + j > n - 1) break;
			int a = abs(h[i] - h[i + j]);
			dp[i + j] = min(dp[i + j], dp[i] + a);
		}
	}
	cout << dp[n-1] << endl;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
mod = 10 ** 9 + 7
H, W = map(int, input().split())
field = []
dp = [[0] * W for _ in range(H)]

for _ in range(H):
	field.append(input())

dp[0][0] = 1

for i in range(H):
	for j in range(W):
		if field[i][j] == '.':
			if i > 0:
				dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod
			if j > 0:
				dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod
				
print(dp[-1][-1])


Measured memory_bytes: 53488
import java.util.*;

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


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N, M; cin >> N >> M;
    vector<ll> fact(N + M + 1);
    ll ans = 0;
    for(int i = 0; i <= N + M; i++) {
        if(i == 0) fact[0] = 1;
        else {
            fact[i] = i * fact[i - 1];
            fact[i] %= mod;
        }
    }
    if(max(N, M) - min(N, M) == 0) ans = 2 * fact[N] * fact[M] % mod;
    else if(max(N, M) - min(N, M) == 1)ans = fact[N] * fact[M] % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4708
from itertools import product
H,W,K=map(int,input().split())
c = [list(input()) for _ in range(H)]

ans=0
fh = list(product([True,False],repeat=H))
fw = list(product([True,False],repeat=W))
#print(len(fh),len(fw))

for s in fh:
    for t in fw:
        #print(s,t)
        tmp=0
        for i in range(H):
            for j in range(W):
                if c[i][j]=="#" and (s[i] and t[j]):
                    tmp +=1
                    #print(i,j,s[i],t[j])
        if tmp==K:
            ans +=1
            #print(tmp)
                    
print(ans) 


Measured memory_bytes: 9208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, D;
    cin >> N >> D;
    
    cout << (N - 1) / (2 * D + 1) + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		long ans = 0;
		int ans2 = 0;

		Scanner sc = new Scanner(System.in);
		int  n = sc.nextInt();
//		long  k = sc.nextLong();
//		longd = sc.nextInt();
//
//		boolean f = false;
//		int[] ai = new int[n];
//		int[] tmp = new int[n];
//		for (int i = 0; i < n; i++) {
//			ai[i] = sc.nextInt();
//			tmp[i] = 0;
//		}

//		int[] bi = new int[n];
//		for (int i = 0; i < k; i++) {
//			bi[i] = sc.nextInt();
//		}

		ans2 = n *n*n;


		System.out.println(ans2);

		sc.close();
	}
}

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

int main() {
	int a, b;
	char op;
	while (true) {
		cin >> a >> op >> b;
		if (op == '?') break;
		int sum = 0;
		switch (op) {
		case '+': sum = a + b;
			break;
		case '-': sum = a - b;
			break;
		case '*': sum = a * b;
			break;
		case '/': sum = a / b;
			break;
		case '?': break;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;
using System.Linq;

namespace ABC139D
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = CIN.Long();
            
            Console.WriteLine((N - 1) * N / 2);
            
        }
    }

    internal static class CIN
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 11092
# numba ATOコンパイルver
# 参考：https://qiita.com/yniji/items/d012bb9f938e0445a3ff#numba-aot

def solve(N):

    ans = 0
    for x in range(1, N + 1):
        y = int(N / x)
        ans += y * (y + 1) * x // 2

    return ans


def main():

    N = int(input())
    print(solve(N))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i4,)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


Measured memory_bytes: 27368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int n,m,k,a[20][20],sum[15],c[15],ans=0x3f3f3f3f,g;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++){
	scanf("%d",&c[i]);	
	for(int j=0;j<m;j++) scanf("%d",&a[i][j]); 
	}
	for(int i=1;i<(1<<n);i++){
	  memset(sum,0,sizeof(sum)); g=0;
	 for(int j=0;j<n;j++){
	  if(!(i&(1<<j))) continue;
	  for(int l=0;l<m;l++) sum[l]+=a[j][l];
	  g+=c[j];
	 }
	bool flag=0;
	for(int j=0;j<m;j++) {
	 if(sum[j]<k) {
	 	flag=1;
	 	break;
	 }
	}
	if(!flag) ans=min(ans,g);
	}
	printf("%d\n",ans==0x3f3f3f3f? -1:ans);
 } 

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using pll=pair<ll,ll>;
using graph=vector<vector<int>>;
using wgraph=vector<vector<pll>>;

const ll MOD=1000000007;
const ld E=1e-10;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ex[8]={1,1,0,-1,-1,-1,0,1};
const int ey[8]={0,1,1,1,0,-1,-1,-1};

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1){
      ret*=a;
    }
    a*=a;
    if(a>=p)a%=p;
    b=b>>1;
  }
  return ret;
}

int digit(ll a,ll b=10){
  int i=0;
  while(a!=0){
    a/=b;
    i++;
  }
  return i;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p=MOD){
  a%=p;
  ll n=solveLinear(a,p,1);
  n%=p;
  if(n<0)return n+p;
  return n;
}

ll fact(ll n,ll p=MOD){
  if(n<0)return 0;
  int i;
  ll ret=1;
  for(i=0;i<n;i++){
    ret=ret*(i+1);
    if(ret>=p)ret%=p;
  }
  return ret;
}

ll perm(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i);
    if(ret>=p)ret%=p;
  }
  return ret;
}

ll binom(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1,fact=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i);
    fact*=i+1;
    if(ret>=p)ret%=p;
    if(fact>=p)fact%=p;
  }
  return (ret*modRev(fact))%p;
}

void pushHeap(vector<ll>& h,int n){
  int i=h.size();
  h.push_back(n);
  while(i!=0 && h[(i-1)/2]<h[i]){
    swap(h[i],h[(i-1)/2]);
    i=(i-1)/2;
  }
  h[i]=n;
}

ll popHeap(vector<ll>& h){
  int n=h.size()-1;
  if(n==-1)return 0;
  ll i,ret=h[0];
  swap(h[0],h[n]);
  h.pop_back();
  for(i=0;i<n;){
    int j=2*i+1;
    if(j>=n)break;
    if(j!=n-1 && h[j]<h[j+1])j++;
    if(h[i]<h[j]){
      swap(h[i],h[j]);
    }
    i=j;
  }
  return ret;
}

int bis(vector<int> v,int key){
  int left=-1,right=v.size();
  while(abs1(right-left)>1){
    int mid=left+(right-left)/2;
    if(v[mid]<=key)left=mid;
    else right=mid;
  }
  return left;
}

bool area(pll x,pll y,pll z){
  ll ax=x.first-z.first;
  ll ay=x.second-z.second;
  ll bx=y.first-z.first;
  ll by=y.second-z.second;
  ll s=abs1(ax*by-bx*ay);
  if(s==0)return 0;
  if(s%2==0)return 1;
  return 0;
}

int main(){
  int i,j,k,l,cnt=0;
  int n,x;
  cin>>n>>x;
  if(x==1 || x==2*n-1){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  j=0;i=1;
  for(j=0;j<n-2;){
    if(i==x-1 || i==x || i==x+1){
      i++;
      continue;
    }
    cout<<i++<<endl;
    j++;
  }
  cout<<x-1<<endl;
  cout<<x<<endl;
  cout<<x+1<<endl;
  j=0;
  for(j=0;j<n-2;){
    if(i==x-1 || i==x || i==x+1){
      i++;
      continue;
    }
    cout<<i++<<endl;
    j++;
  }
}


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

int main()
{
    ll N;
    cin >> N;
    ll prev = 0, now;
    vector<ll> H(N);
    rep(i, N)
    {
        cin >> now;
        if (now <= prev)
            H[i] = H[i - 1] + 1;
        else
            H[i] = 0;
        prev = now;
    }
    cout << *max_element(H.begin(), H.end()) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
// a^{-1} mod を計算する
ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
 
const int MAX = 510000;
const ll MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int main() {
    ll n, k;
    cin >> n >> k;
    COMinit();
    if (k >= n - 1) {
        cout << COM(2 * n - 1, n) << "\n";
    } else {
        ll ans = 0;
        for (int i = 1; i <= k; i++) {
            // H(n - i, i) = C(n - 1, i)
            ans += COM(n, i) * COM(n - 1, i);
            ans %= MOD;
        }
        ans++;
        cout << ans % MOD << "\n";
    }
    
    return 0;
 
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
int dp[100005][102];
signed main()
{
    IOS
    int n,W; cin>>n>>W;
    int wt[n+1],val[n+1];
    for(int i = 1;i<=n;i++)
    {
      cin>>wt[i]>>val[i];
    }
    for(int i = 0;i<=n;i++) dp[0][i] = 0;
    for(int i=0;i<=W;i++) dp[i][0] = 0;
    for(int j=1;j<=n;j++)
    {
      for(int i = 1;i<=W;i++)
      {
        if(i >= wt[j]) dp[i][j] = max(dp[i][j-1] , dp[i - wt[j]][j-1] + val[j]);
        else dp[i][j] = dp[i][j-1];
      }
    }
    int ans = 0;
    for(int i=1;i<=W;i++)
    {
      ans = max(ans , dp[i][n]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 80000
#include <stdio.h>

using namespace std;

int main(){
	int r,c,sum,total_sum = 0;
	scanf("%d %d",&r,&c);
	int table[r+1][c+1];

	for(int i = 0; i < r+1; i++){
		for(int j = 0; j < c+1; j++){
			table[i][j] = 0;
		}
	}

	for(int i = 0; i < r; i++){
		sum = 0;
		for(int j = 0; j < c; j++){
			scanf("%d",&table[i][j]);
			sum += table[i][j];
			table[r][j] += table[i][j];
		}
		table[i][c] = sum;
		total_sum += sum;
	}
	table[r][c] = total_sum;

	for(int i = 0; i < r+1; i++){
		for(int j = 0; j < c; j++){
			printf("%d ",table[i][j]);
		}
		printf("%d\n",table[i][c]);
	}
}



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

vector<int> primes;

/*void sieve(){
  int n = 1e6;
  bool isPrime[n + 1] = {false};
  isPrime[] = true;
  isPrime[1] = true;
  for(int i = 2; i <= 1e6; i++){
    if(!isPrime[i]){
      primes.push_back(i);
     for(int j = i; j <= n; j += i){
        isPrime[j] = true;
      }
    }
  }
}
*/

bool isPrime(long long a){
  if(a == 2)return true;
  if(a < 2 || a % 2 == 0)return false;
  int i = 3;
  while(i <= sqrt((double)a)){
    if(a % i == 0)return false;
    i += 2;
  }
  return true;
}

int main(){
  int a, d, n;
  while(cin >> a >> d >> n, a || d || n){
    int num;
    int cnt = 0;
    for(int i = 0; ; i++){
      num = a + i * d;
      if(isPrime(num))cnt++;

      if(cnt == n){
        cout << num << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 2964
n,m,x= map(int, input().split())
a= []*n
for i in range(0,n):
    a.append(list(map(int,input().split())))

sum=[0]*(m+1)
minval=1200001
for i in range(0,2**n):
    sum=[0]*(m+1)
    for j in range(n-1,-1,-1):
        if i//(2**j)==1:
            for k in range(0,m+1):
                sum[k]+=a[j][k]
        i = i % (2**j)
    flag=0
    for l in range(1,m+1):
        if sum[l] < x:
            flag=1
            break;
    if flag==0:
        minval= min(minval,sum[0])

if minval==1200001:
    print("-1")
else:
    print(minval)


Measured memory_bytes: 9236
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        s: Chars
    }

    let mut ans = 0;
    let mut res = 0;
    let mut prev = false;
    for i in 0..3 {
        if s[i] == 'R' {
            if prev {
                res += 1;
                ans = max(ans, res);
            } else {
                prev = true;
                ans = max(ans, 1);
                res = 1;
            }
        } else {
            ans = max(ans, res);
            res = 0;
            prev = false;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
vector<int> Zalgo(string s) {
    vector<int> v(1,s.size());
    for(int i=1,l=-1,r=-1;i<s.size();i++) {
        if(i<=r && v[i-l]<r-i+1) v.push_back(v[i-l]);
        else {
            l=i; r=(i>r)?i:(r+1);
            while(r<s.size() && s[r-i]==s[r]) r++;
            v.push_back((r--)-l);
        }
    }
    return v;
}

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

    int n; cin >> n;
    string in; cin >> in;

    int res = 0;
    rep(i, n){
        string S = in.substr(i);
        auto tbl = Zalgo(S);
        rep(j, tbl.size()){
            chmax(res, min(j, tbl[j]));
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll man(ll x,ll y, ll s, ll t){
    return abs(x-s)+abs(y-t);
}

void solve() {
    ll N;
    cin >> N;
    vll A(N);
    map<ll,ll> counter;
    rep(i,N){
        cin >> A[i];
        counter[A[i]]++;
    }
    ll ans = 0;
    for(auto c:counter){
        ans += c.sc*(c.sc-1)/2;
    }
    rep(i,N){
        ll x = counter[A[i]];
        print(ans - x*(x-1)/2 + (x-1)*(x-2)/2);
    }

}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

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

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

    
    int res = 0;
    while(true){
        bool exist_even = false;
        for(int i=0; i<N; i++){
            if(A[i] % 2 == 0 && A[i] != 0) exist_even = true;
        }

        if(exist_even){
            for(int i=0; i<N; i++) A[i] /= 2;
            res++;
        }
        else {
            break;
        }

        
    }

    int ans = 1;
    for(int i=0; i<res; i++) ans *= 2;
    cout << ans  << endl;
    
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using P = pair<int, int>;
const int mx = 100005;
int n, m, a, b, c;
long long ans;
P p[mx];
priority_queue<int> qu;
int main(){
	scanf("%d%d", &n, &m);
	rep(i,n){
		scanf("%d%d", &a, &b);
		p[i] = P(a, b);
	}
	sort(p,p+n);
	rep(i,m){
		while(p[c].first <= i+1) qu.push(p[c++].second);
		if(qu.size()){
			ans += qu.top(); qu.pop();
		}
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 1660
package main

import "fmt"

func main() {
	var n int
	var (
		bfN int
		stp int
	)
	fmt.Scan(&n)
	a := make([]int, n)
	stp = 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		if i == 0 {
			bfN = a[i]
			continue
		}
		if a[i] < bfN {
			stp = stp + (bfN - a[i])
		} else {
			bfN = a[i]
		}
	}
	fmt.Println(stp)
}

Measured memory_bytes: 6468
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

class DisjointSet{
public:
  vector<int> rank,p;

  DisjointSet() {}
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    for(int i=0;i<size;i++) makeSet(i);
  }

  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
  }

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

  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }

  void link(int x,int y){
    if(rank[x]<rank[y]){
      p[y]=x;
    }else{
      p[x]=y;
      if(rank[x]==rank[y]){
        rank[y]++;
      }
    }
  }

  int findSet(int x){
    if(x!=p[x]){
      p[x]=findSet(p[x]);
    }
    return p[x];
  }
};



int main(){
  int N,M,K;
  cin>>N>>M>>K;
  
  vector<int> c(N);
  vector<int> a(M),b(M);
  vector<ll> w(M);

  vector<pair<ll,pair<int,int>>> v;
  for(int i=0;i<N;i++) cin>>c[i];
  for(int i=0;i<M;i++){
      cin>>a[i]>>b[i]>>w[i];
      a[i]--;
      b[i]--;
      v.push_back(make_pair(w[i],make_pair(a[i],b[i])));
  }
  sort(v.begin(),v.end());

  DisjointSet us(N+K);
  ll cost=0;
  int num=1;
  for(int i=0;i<v.size();i++){
      if(num==K) break;
      ll w=v[i].first;
      int x=v[i].second.first;
      int y=v[i].second.second;
      if(c[x]>0) x=N-1+c[x];
      if(c[y]>0) y=N-1+c[y];

      if(!us.same(x,y)){
          cost+=w;
          us.unite(x,y);
          num++;
      }
  }

  if(num==K) cout<<cost<<endl;
  else cout<<-1<<endl;

  return 0;
}


Measured memory_bytes: 5360
#include<stdio.h>
 
int main(){
  int x,y,i;
  while(1){
    scanf("%d %d",&x,&y);
    if(x>y){
    i=x;
    x=y;
    y=i;
    }
    else if(x==0&&y==0)
      break;
    printf("%d %d\n",x,y);

  }
    return 0;
}

Measured memory_bytes: 1028
#include<stdio.h>
#define N 32769

int prime[N];

int ertstns(){
  int i;
  int cnt=0;
  for(i=0;i<N;i++){
    if(i<2){
      prime[i]=0;
    }
    else{
      prime[i]=1;
    }
  }
  for(i=2;i<N;i++){
    int j;
    for(j=2*i;j<N;j+=i)
      prime[j]=0;
  }
  for(i=0;i<N;i++){
    if(prime[i]==1){
      cnt++;
    }
  }
  return cnt;
}

void gldbch(int *p,int n){
  int i;
  int cnt=0;
  for(i=0;p[i]<=n/2;i++){
    int j=i;
    int f=0;
    while((p[j]<=n)&&(f==0)){
      if((p[i]+p[j])==n){
	cnt++;
	f=1;
      }
      j++;
    }
  }
  printf("%d\n",cnt);
}

void doit(){
  int m=ertstns();
  int i;
  int prm[m];
  int j=0;
  int n;
  i=0;
  for(i=0;i<N;i++){
    if(prime[i]==1){
      prm[j]=i;
      j++;
    }
  }
  scanf("%d",&n);
  while(n!=0){
    gldbch(prm,n);
    scanf("%d",&n);
  }
}

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

Measured memory_bytes: 740
n = gets.chomp.to_i
a = gets.chomp.split().map(&:to_i)
a.sort!
b = 1
i = 0
c = false
for i in 0..n-1
    b = b * a[i]
    if b > 1000000000000000000
        c = true
        print '-1'
        break
    end
end

if !c
    print b 
end


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

int main() {
    int inf = 1001001001;
    int n, k;
    cin >> n >> k;
    vector<int> h(n + 1000);
    for (int i = 0; i < n; ++i) {
        cin >> h.at(i);
    }
    vector<int> dp(n + 1000, inf);
    dp.at(0) = 0;
    for (int j = 0; j < n; ++j) {
        for (int i = 1; i <= k; ++i) {
            dp.at(j + i) = min(dp.at(j + i), dp.at(j) + abs(h.at(j + i) - h.at(j)));
        }
    }
    cout << dp.at(n - 1) << endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

typedef long long ll;
typedef pair<ll, int> P;


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

	int s = 0;
	int ans = 1;
	for(int i=0;i<n;i++){
		int l;
		cin >> l;
		if(s+l<=x) ans++;
		s += l;
	}
	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    nitro
    int n,c=0;cin>>n;
    int a[n];
    for(auto& x:a)
    {
    	cin>>x;
    	if(x%2==0 and x%3==0) continue;
    	else if(x%2==0 and x%5==0) continue;
    	else if(x%2!=0) continue;
    	else c=1;
    }
    if(c==0) cout<<"APPROVED";
    else cout<<"DENIED";
    return 0;
}

Measured memory_bytes: 256
// iとi+1で少ないほうとったあと大きいほうを...と思ったけど合計してドレインしてもいいか
// 3 6 2 0 5 2 とかだと最初の2つをドレインすると [0 1 2 0 5 2]になる
// 残してもしょうがないので吸い尽くせ
// クソコーナーケースでWA
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	N := nextInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
	if N == 1 {
		fmt.Fprintln(out, A[0]/2)
		return
	}
	ans := 0
	for i := 1; i < N; i++ {
		sum := A[i] + A[i-1]
		if sum%2 == 0 {
			// 吸い尽くせ
			ans += sum / 2
			A[i], A[i-1] = 0, 0
		} else {
			ans += (sum - 1) / 2
			if A[i] != 0 {
				A[i] = 1
			}
			A[i-1] = 0
		}
	}
	fmt.Fprintln(out, ans)
}
func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

// 10
// 1 8 3 4 2 1 4 6 0 4 3
// 1 0


Measured memory_bytes: 4096
S = int(input())

SS = int(S**0.5)

if SS*SS == S:
  X2 = 0
  Y1 = 0
  X1 = SS
  Y2 = SS
elif SS*(SS+1) == S:
  X2 = 0
  Y1 = 0
  X1 = SS
  Y2 = SS+1
elif SS*(SS+1) > S:
  X2 = SS*(SS+1)-S
  Y1 = 1
  X1 = SS
  Y2 = SS+1
elif (SS+1)*(SS+1) == S:
  X2 = 0
  Y1 = 0
  X1 = SS+1
  Y2 = SS+1
else:
  X2 = (SS+1)**2-S
  Y1 = 1
  X1 = SS+1
  Y2 = SS+1

X3 = 0
Y3 = 0

print("{} {} {} {} {} {}".format(X1,Y1,X2,Y2,X3,Y3))

Measured memory_bytes: 38384
N = int(input())
a = list(map(int, input().split()))

memo = [0] * N
for i in range(1, N+1)[::-1]:
    sm = sum([memo[j-1] for j in range(i, N+1, i)])
    memo[i-1] = (sm + a[i-1]) % 2

M = sum(memo)
print(M)

ans = []
for i in range(N):
    if memo[i] == 1:
        ans.append(i+1)
print(*ans)


Measured memory_bytes: 14136
// https://atcoder.jp/contests/agc047/tasks/agc047_a
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;
using cpp_dec = mp::cpp_dec_float_50;
using cpp_int = mp::cpp_int;
using namespace std;

#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define Aint(obj) (obj).begin(), (obj).end()
#define AintR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    map<pair<int, int>, int> cnt;
    REP(i, N) {
        cpp_dec x;
        cin >> x;
        int t = static_cast<int>(x * 1e9);
        // 2で割り切れる回数、5で割り切れる回数
        pair<int, int> p = {-9, -9};
        while (t % 2 == 0) {
            t /= 2;
            p.first++;
        }
        while (t % 5 == 0) {
            t /= 5;
            p.second++;
        }
        cnt[p]++;
    }
    // mapだと要素指定のアクセスができないのでvectorへ変換
    vector<pair<int, int>> ps;
    vector<int> cs;
    for (auto w : cnt) {
        ps.emplace_back(w.first);
        cs.emplace_back(w.second);
    }

    int ans = 0;
    REP(i, ps.size()) {
        pair<int, int> p = ps[i];
        if (p.first >= 0 && p.second >= 0) {
            ans += cs[i] * (cs[i] - 1) / 2;
        }
        REP(j, i) {
            if (p.first + ps[j].first >= 0 && p.second + ps[j].second >= 0) {
                ans += cs[i] * cs[j];
            }
        }
    }

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


Measured memory_bytes: 3716
h, w = map(int, input().split())
masu = ['.'*(w+2)]
masu += ['.' + input() + '.' for _ in range(h)]
masu.append('.'*(w+2))
ans = 'Yes'
for i in range(1,h+1):
    for j in range(1,w+1):
        if masu[i][j] == '#':
            if masu[i+1][j] == '#' or masu[i-1][j] == '#' or masu[i][j+1] == '#' or masu[i][j-1] == '#':
                continue
            else:
                ans = 'No'
                break
print(ans)

Measured memory_bytes: 3064
import sys
input=sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n=INT()
p=LIST()
cnt=1
pre=p[0]
for i in range(1,n):
    if pre>p[i]:
        cnt+=1
        pre=p[i]
print(cnt)

Measured memory_bytes: 71248
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
 
using namespace std; 

int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}

int main(){

    int n;
    cin>>n;

    int s[100];
    for(int i=0;i<n;i++) cin>>s[i];

    //int dp[101][10001]={};
    vector<vector<int> > dp(n+1,vector<int>(10001,-1)); 
    dp[0][0]=0;

    for(int i=0;i<n;i++){
        for(int j=0;j<=10000;j++){
            if(dp[i][j]!=-1){
                int sum=j+s[i],val=sum;
                if(sum%10==0) val=0;
                dp[i+1][sum]=max(dp[i+1][sum],val);
            }
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
        }
    }

    int res=0;
    for(int i=0;i<=10000;i++){
        res=max(res,dp[n][i]);
    }

    cout<<res<<endl;

	return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	int n;
	cin >> n;
	int racha = 0;
	bool ok = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (a == b) racha++;
		else racha = 0;
		if (racha >= 3) ok = true;
	}

	cout << (ok ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 3632
N,M = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
if N < M:
    A = sorted(X)
    tmp = len(A) - 1
    difA = [0] * tmp
    for i in range(tmp):
        difA[i] = A[i+1] - A[i]
    difA_sorted = sorted(difA)
    print(sum(difA_sorted[:M-N]))
else:
    print(0)

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

#define debug_input freopen("stdin.in", "r", stdin)
#define debug_output freopen("stdout.out", "w", stdout)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORALL(i, n) for(int i = 0; i < n; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define SORT(a) sort(a.begin(), a.end())
#define REV(a) reverse(a.begin(), a.end())
#define NP(a) next_permutation(a.begin(), a.end())
#define endl "\n"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	string s, t;
	cin >> s;
	cin >> t;

	int slen = s.length();
	int tlen = t.length();

	int mini = 10005;
	for(int i = 0; i < slen - tlen + 1; i++) {
		int cnt = 0;
		for(int j = 0; j < tlen; j++) {
			if(s[i + j] != t[j]) {
				cnt++;
			}		
		}
		mini = min(mini, cnt);
	}
	cout << mini << endl;

	return 0;
}

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int a, b, c, d, e, k;
	cin >> a >> b >> c >>  d >> e >> k;
	cout << (e - a <= k ? "Yay!" : ":(") << endl;



	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==b){
		printf("a == b\n");
	}else if(a<b){
		printf("a < b\n");
	}else{
		printf("a > b\n");
	}
	
	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (a < b)
	{
		printf("a < b\n");
	}
	else if (a > b)
	{
		printf("a > b\n");
	}
	else
	{
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
const int INF = (1e9+7);
using namespace std;

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

	vector<int> a(n);

	for (int& x : a){
		cin >> x;
	}

	vector<int> dp(n , INF);
	dp[0] = 0;
	for (int i = 0 ; i < n ; i++){
		for (int j : {i+1 , i+2}){
			dp[j] = min(dp[j] , dp[i]+abs(a[i] - a[j]));
		}
	}

	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
  cin>>s;
  for(int i=0;i<26;i++){
    char t=('a'+i);
    if(s.find(t)!=string::npos) continue;
    cout<<t<<endl;
    return 0;
  }
  cout<<"None"<<endl;
}

Measured memory_bytes: 512
import java.util.*;
class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
        int []x  = new int[n];
        for (int i = 0; i < n; i++) {
            x[i]  = sc.nextInt();
        }
        for (int i = n-1; i >= 0; i--) {
            if(i==0)
            System.out.println(x[i]);
            else
            System.out.print(x[i] + " ");
        }
        sc.close();
    }
}


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

int main()
{
  int n, s;

  scanf("%d", &n);
  for (int i = 0; i < n; i++){
    scanf("%d", &s);
    printf("Case %d:\n", i + 1);
    for (int j = 0; j < 10; j++){
      printf("%d\n", s = s * s / 100 % 10000);
    }
  }

  return (0);
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
#define check(n) reverse(all(n));rep(z,0,n.size())cout<<n[z];co("");reverse(all(n));
using namespace std;
namespace mp=boost::multiprecision;
typedef long long ll;
typedef unsigned long long ull;
using bint=mp::cpp_int;

int main(){
  ll n,m=100,c=0;
  cin>>n;
  while(c<4000){
    m*=1.01;
    c++;
    if(m>=n) break;
  }
  co(c);
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B = 1, C = 0,j;
    cin >> N;
    rep(i, N){
        cin >> A;
        if(A >= B){
            C = B;
            B = A;
            j = i;
        } else if(A >= C){
            C = A;
        }
    }
    rep(i, N){
        cout << (i == j?C:B) << endl;
    }
}

Measured memory_bytes: 1664
from random import randrange
from heapq import heapify, heappush, heappop
from time import time
K = 60
rand = lambda: randrange(1 << K)
sTime = time()
N = int(input())
S, IS, C = [], [], []
for _ in range(N):
    s, c = input().split()
    S.append(s)
    IS.append(s[::-1])
    C.append(int(c))

D = {}
done = [set(), set()]
r = rand()
D[r] = (0, "", 0)
H = [r]
ans = 1 << K
while H:
    r = heappop(H)
    if time() - sTime > 1.7:
        break
    d, s, c = D[r]
    if s in done[d]: continue
    done[d].add(s)
    if d == 0:
        for ss, cc in zip(S, C):
            m = min(len(s), len(ss))
            if s[:m] == ss[:m]:
                if abs(len(s) - len(ss)) <= 1 or len(ss) > len(s) and ss[m:] == ss[m:][::-1]:
                    ans = min(ans, c + cc)
                else:
                    if len(s) < len(ss):
                        r = rand() + (c + cc << K)
                        D[r] = (1, ss[m:], c + cc)
                        heappush(H, r)
                    else:
                        r = rand() + (c + cc << K)
                        D[r] = (0, s[m:], c + cc)
                        heappush(H, r)
    else:
        for ss, cc in zip(IS, C):
            m = min(len(s), len(ss))
            if s[:m] == ss[:m]:
                if abs(len(s) - len(ss)) <= 1 or len(ss) > len(s) and ss[m:] == ss[m:][::-1]:
                    ans = min(ans, c + cc)
                else:
                    if len(s) < len(ss):
                        r = rand() + (c + cc << K)
                        D[r] = (0, ss[m:], c + cc)
                        heappush(H, r)
                    else:
                        r = rand() + (c + cc << K)
                        D[r] = (1, s[m:], c + cc)
                        heappush(H, r)

print(ans if ans < 1 << K - 2 else -1)

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

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>


using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

string s;
int a[4];
char ans[9];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    rep(i, 4) {
        a[i] = s[i] - '0';
    }
    ans[7] = '=';
    ans[8] = '7';
    rep(i, 4) {
        ans[i*2] = char(a[i] + '0');
    }
    rep(i, 1<<3) {
        int tmp = a[0];
        rep(j, 3) {
            if(i>>j & 1) {
                tmp = tmp + a[j + 1];
            }
            else {
                tmp = tmp - a[j + 1];
            }
        }
        if (tmp == 7) {
            rep(j, 3) {
                if (i>>j&1) {
                    ans[j * 2 + 1] = '+';
                }
                else {
                    ans[j * 2 + 1] = '-';
                }
            }
            rep(i, 9) cout << ans[i];
            cout << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

N = int(input())
ali = list(map(int,input().split()))
inf = 10**15
dp = [[inf]*(N+1) for _ in range(N+1)]
#i-j番目までが残っているときの利益の最大値
for i in range(N+1):
  dp[i][i] = 0

for j in range(1,N+1):
  for i in range(N+1):
    if i+j > N:
      break
    dp[i][i+j] = max(-dp[i+1][i+j]+ali[i],-dp[i][i+j-1]+ali[i+j-1])
  
print(dp[0][N])

Measured memory_bytes: 112476
h = {
  'I' => 1,
  'V' => 5,
  'X' => 10,
  'L' => 50,
  'C' => 100,
  'D' => 500,
  'M' => 1000,
}
while roman = STDIN.gets
  roman.chomp!
  arabic=0
  prev=0
  roman.chars.reverse.each do |c|
    if h[c] < prev then
      arabic -= h[c]
    else
      arabic += h[c]
    end
    prev = h[c]
  end
  puts arabic
end

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



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


    if(n>=b-1){
        cout<<floorl((a-(a*1.0)/(b*1.0)))<<endl;
    }else{
        cout<<floorl((a*(n/(b*1.0))))-a*(n/b)<<endl;
    }

    return 0;
}

Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n;
	cin >> n;
	int co = 0;
	int k, l;
	for (int i = 1;; i++) {
		co += i;
		if (co >= n) {
			k = i;
			l = co;
			break;
		}
	}
	for (int j = 1; j <= k; j++) {
		if (l - n == j) {
			continue;
		}
		else {
			cout << j << endl;
		}
	}
	return 0;
}

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

std::vector<std::vector<int>> vec;
int h, w;
int counter = 0;
std::string s;
int main() {
    std::cin >> h >> w;
    vec.assign(h, std::vector<int>(w, 0));
    for (int i = 0; i < h; i++) {
        std::cin >> s;
        for (int p = 0; p < w; p++) {
            if (s[p] == '#') {
                vec[i][p] = 1;
            }
            else if (s[p] == '.') {
                vec[i][p] = 0;
            }
        }
    }
    for (int i = 0; i < h; ++i) {
        counter = 0;
        for (int p = 0; p < w; ++p) {
            if (vec[i][p] == 0 || vec[i][p] == -1)
                counter++;
        }
        if (counter == w) {
            for (int p = 0; p < w; ++p) {
                vec[i][p] = -1;
            }
        }
    }
    for (int i = 0; i < w; i++) {
        counter = 0;
        for (int p = 0; p < h; p++) {
            if (vec[p][i] == 0 || vec[p][i] == -1) {
                counter++;
            }
        }
        if (counter == h) {
            for (int k = 0; k < h; k++) {
                vec[k][i] = -1;
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int p = 0; p < w; p++) {
            if (vec[i][p] == 0) {
                std::cout << ".";
            }
            else if (vec[i][p] == 1) {
                std::cout << "#";
            }
        }
        std::cout << std::endl;
    }
}


Measured memory_bytes: 256