akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif

const ll Mod = 1e9 + 7;
// const ll Mod = 998244353;
const ll MAXN = 1e6;

void solve(){
    ll n,k;cin>>n>>k;
    vll a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    set<ll> se;
    vll v;
    ll i=1,val;
    while(1){
        se.I(i);
        v.pb(i);
        i=a[i-1];
        if(se.find(i)!=se.end()){
            val=i;
            break;
        }
    }
    ll l=0;
    for(ll pp:v){
        if(pp==val) break;
        l++;
    }
    // trace(k,l,v,val);
    if(k<=l){
        // trace("HI");
        cout<<v[k]<<"\n";
    }else{
        // 1 2 3 4
        k-=l;
        ll nn=v.size()-l;
        cout<<v[l+k%nn]<<"\n";
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if(a==5&&b==7&&c==5||a==5&&b==5&&c==7||a==7&&b==5&&c==5){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define si(a) scanf("%d",&a)
#define sll(a) scanf("%lld",&a)
#define sl(a) scanf("%ld",&a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%ld\n",a)
#define pll(a) printf("%lld\n",a) 
#define sc(a) scanf("%c",&a)a
#define pc(a) printf("%c",a)
#define ll long long
#define mod 1000000007
#define w while
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF INT_MAX
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define VI vector<int>
#define VL vector<ll>
#define PI pair<int,int>
#define PL pair<ll,ll>
long double PIE=acos(-1);
//////////////////////////////////////////////////////////////
const ll N=1e5+5;
ll Ans=1;
bool done[1000009];
vector < ll > primes;

void FindPrime(ll N)
{
    done[1] = 1;
    for(int i=2;i<=N;i++)
	{
        if(done[i]) continue;
        for(int j=i*2;j<=N;j+=i)
		{
            done[j] = 1;
        }
        primes.push_back(i);
    }
}

ll solve(ll Num)
{
    for(int i=0;i<primes.size();i++)
	{
    	int p=primes[i];
        if(p*p*p > Num) break;
        ll Count = 1;
        while(Num%p == 0)
		{
            Num /= p,Count++;
        }
        Ans *= Count;
    }
    ll sq = (ll)sqrt(Num);
    if(!done[Num]) 
	Ans *= 2;
    else if(sq*sq == Num && !done[sq]) 
	Ans *= 3;
    else if(Num != 1) 
	Ans *= 4;
    return Ans;
}


ll fact[N], invfact[N];



ll pow(ll a, ll b, ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

ll modinv(ll k)
{
	return pow(k, mod-2, mod);
}


ll nCr(ll x, ll y)
{
	if(y>x)
		return 0;
	ll num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}

void initinv()
{
	fact[0]=1;
	fr(i,1,N)
	{
		fact[i]=(i*fact[i-1])%mod;
	}
	invfact[N]=modinv(fact[N]);
	for(int i=N-1;i>=1;i--)
	{
		invfact[i]=((i+1)*invfact[i+1])%mod;
	}
}
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
ll dp[100005],dpp[100005];
int main()
{
	int n,k;
	cin>>n>>k;
	dp[0]=1;
	int a[n+1];
	fr(i,1,n)
	{
		cin>>a[i];
		fr(j,0,k+2)
		dpp[j]=0;
		for(int j=k;j>=0;j--)
		{
			int l=j+1;
			int r=j+min(a[i],k-j);
			if(l<=r)
			{
				dpp[l]=dpp[l]+dp[j];
				dpp[l]%=mod;
				if(r+1<=k)
				{
				
					dpp[r+1]=dpp[r+1]-dp[j];
					if(dpp[r+1]<mod)
					dpp[r+1]+=mod;
				}
				
			}
		}
			ll sum=0;
			for(int o=0;o<=k;o++)
			{
				sum+=dpp[o];
				sum%=mod;
				dp[o]=(dp[o]+sum)%mod;
			}
		}
	
	cout<<dp[k];
    return 0;
}

Measured memory_bytes: 5144
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
// #include <prettyprint.hpp>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;++i)
#define repi(i,n) for(ll i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define slf(n) scanf("%lf", &n);
typedef long long ll;
typedef double lf;
static const ll max_n = 130;
static const ll mod = 1000000007;
static const ll max_value = 100000000000100;

ll N, M;


void Main(){
    // bool is_ok = true;
    // printf("------------- V=%lld---------\n", V);
    ll N, K, a;
    sll(N);
    sll(K);
    map<ll, ll> status;

    rep(i, N){
        sll(a);
        -- a;
        status[i] = a;
    }

    // for(auto key:status){
        // cout << key.first << ";" << key.second <<endl;
    // }

    ll st = 0;
    vector<ll> junkan(1, st);
    map<ll, ll> searched;
    searched[st] = 0;
    ll next = status[st];
    while(searched.find(next) == searched.end()){
        junkan.emplace_back(next);
        searched[next] = junkan.size() -1;
        next = status[next];
    }

    ll till_junkan_st = searched[next];
    // cout << "till junkan st:" <<till_junkan_st <<endl;
    // cout << "junkan size:" << junkan.size() << endl;
    if(K <= till_junkan_st){
        cout << junkan[K] + 1 << endl;;
    }else{
        ll j_step = K - till_junkan_st;
        ll index = (j_step % (junkan.size()-till_junkan_st));
        cout << junkan[till_junkan_st+index] + 1 << endl;
    }

    // cout << junkan<<endl;

    // ll index = (K % junkan.size());
    // printf("%lld\n", junkan[index]+1);
    

    // printf("%lld\n", ans);


    // cout<<fixed<<setprecision(10)<<num<<endl;
    // cout << num << endl;

}

int main(){
    Main();

    return 0;

}

Measured memory_bytes: 29520
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

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

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

using namespace std;

void solve()
{
	int n;
	while (cin >> n, n)
	{
		vector< vector<int> > student(n, vector<int>(n));
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				cin >> student[i][j];
			}
		}
		vector<int> minInRow(n);
		for (int i = 0; i < n; ++i)
		{
			int minv = 1e9;
			for (int j = 0; j < n; ++j)
			{
				minv = min(minv, student[i][j]);
			}
			minInRow[i] = minv;
		}
		vector<int> maxInColumn(n);
		for (int j = 0; j < n; ++j)
		{
			int maxv = -1e9;
			for (int i = 0; i < n; ++i)
			{
				maxv = max(maxv, student[i][j]);
			}
			maxInColumn[j] = maxv;
		}
		bool isNotFound = true;
		sort(maxInColumn.begin(), maxInColumn.end());
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				if (maxInColumn[i] == minInRow[j])
				{
					cout << maxInColumn[i] << endl;
					goto END;
				}
			}
		}
		if (isNotFound)
		{
			cout << 0 << endl;
		}
END:
		;
	}
}

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

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=a;i<min(a+c,b+1);i++){
    cout<<i<<endl;
  }
  for(int i=max(b-c+1,a+c-1);i<=b;i++){
    if(a+c-1==i)continue;
    cout<<i<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod = 1000000007;
const long long INF = 1LL << 55;
const double EPS = 1e-10;

int main()
{
    int A, B, C;
    cin >> A >> B;

    cout << 6 - (A + B) << endl;
}

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(i, 1, (n))
#define pb push_back
#define f first
#define s second
#define INF 100000000000000000
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<piii> viii;

const int MAXN = 110;
ll w[MAXN];

int main()
{
    FAST_IO;

    int n;
    cin >> n;
    ll sum2 = 0;
    FOR(i, 0, n-1) {
        cin >> w[i];
        sum2 += w[i];
    }

    ll sum1 = 0, ans = sum2;

    FOR(i, 0, n-2) {
        sum1 += w[i], sum2 -= w[i];
        ans = min(ans, abs(sum1-sum2));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

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

	sort(a,a+3);
	cout<<a[0]+a[1]<<endl;


	

	return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int t;
int main()
{
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
      {
          if(a[i]=='C')
            t=1;
        if(a[i]=='F'&&t==1)
          {
            cout<<"Yes";
            return 0;
          }
      }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main { //LeGOD! - Max sequences is 
	//92378 so probably no TLE
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int Q = input.nextInt();
		int[][] query = new int[Q][4];
		for (int i = 0; i < Q; i++) {
			query[i][0] = input.nextInt();
			query[i][1] = input.nextInt();
			query[i][2] = input.nextInt();
			query[i][3] = input.nextInt();
		}
		long ans = 0;
		ArrayList<String> x = Recur(N,M);
		for (int i = 0; i < x.size(); i++) {
			String[] arr = x.get(i).split(" ");
			long curans = 0;
			for (int j = 0; j < Q; j++) {
				int A = query[j][0];
				int B = query[j][1];
				int C = query[j][2];
				int D = query[j][3];
				int cmpA = Integer.parseInt(arr[A-1]);
				int cmpB = Integer.parseInt(arr[B-1]);
				if (cmpB-cmpA==C) curans+=D; 
			}
			ans=Math.max(ans, curans);
		}
		System.out.println(ans);
	}
	public static ArrayList<String> Recur(int N, int M) {
		ArrayList<String> seq = new ArrayList<String>();
		if (N==1) {
			for (int i = 1; i <= M; i++) {
				seq.add(Integer.toString(i)+" "); //Space to prevent confusion of 1 and 10
			}
		}else {
			ArrayList<String> prev = Recur(N-1,M);
			for (int i = 0; i < prev.size(); i++) {
				String[] nums = prev.get(i).split(" ");
				int lowerbound = Integer.parseInt(nums[nums.length-1]);
				for (int j = lowerbound; j <= M; j++) {
					seq.add(prev.get(i)+Integer.toString(j)+" ");
				}
			}
		}
		return seq;
	}
}

Measured memory_bytes: 66184
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}

priority_queue<int, vector<int>, greater<int>> pq;
vector<int> v;

int main() {
    int n;
    scanf("%d", &n);

    ll sum = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            for (int k = 1; k <= n; k++) {
                sum += gcd(gcd(i, j), k);
            }

    printf("%lld", sum);
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
	IOS;
	int n;
	cin>>n;
	string S;
	cin>>S;
	si s[26];
	for(int i=0;i<(int)S.length();i++){
		int x=S[i]-'a';
		s[x].insert(i);
	}
	int q;
	cin>>q;
	while(q--){
		int t; cin>>t;
		if(t==1){
			int x;
			char c;
			cin>>x>>c;
			x--;
			char C=S[x];
			S[x]=c;
			s[C-'a'].erase(s[C-'a'].find(x));
			s[c-'a'].insert(x);
		}
		else{
			int l,r;
			cin>>l>>r;
			l--,r--;
			int ans=0;
			for(int i=0;i<26;i++){
				auto it=s[i].lower_bound(l);
				if(it!=s[i].end()){
					if(*it<=r) ans++;
				}
			}
			cout<<ans<<endl;
		}
	}
}

Measured memory_bytes: 24220
#include<bits/stdc++.h>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll x,y,z,a=0,b=0,c=0,d=0,sum,ans,total,cnt,n,m,k,p,kase,i;
string s1,s2;
#define N 100001
#define MX 1000000001
vector <ll> v;
map<ll,ll> mp;
set<ll> s;
map<ll,ll> :: iterator itr1, ptr1;
set<ll> :: iterator itr, ptr;


int main()
{

     cin>>n;
     int ar[n];
     c=0;
     for(int i=1;i<=n;i++)cin>>ar[i];
     for(int i=1;i<=n;i++){
        if(i%2==1){

            if(ar[i]%2==1)c++;
        }
     }
     cout<<c;



    return 0;
}
// Happy Coding  (:


Measured memory_bytes: 3612
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

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

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

//--------------------------------------------------------------------

signed main() {
    i64 h;
    cin>>h;

    i64 n = 0;
    while(1){
        h = h/2;
        n++;
        if(h == 0) break;
    }
    
    i64 sum = 0;
    REP(i,n){
        sum += pow(2,i);
    }
    cout<<sum<<endl;

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int g(int a,int b){return b?g(b,a%b):a;}
int N,A[1<<17];
int L[1<<17],R[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)L[i+1]=g(L[i],A[i]);
	for(int i=N;i--;)R[i]=g(R[i+1],A[i]);
	int ans=0;
	for(int i=0;i<N;i++)ans=max(ans,g(L[i],R[i+1]));
	cout<<ans<<endl;
}

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

typedef long long ll;
typedef long double ld;

ll pre[100005];
ll pos[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, k;
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        int x;
        cin >> x;
        pre[i] = pre[i-1] + x;
        pos[i] = pos[i-1];
        if(x >= 0) pos[i] += x;
    }
    ll res = 0;
    for(int l=1; l+k-1<=n; l++){
        int r = l+k-1;
        ll sum = pre[r] - pre[l-1];
        ll gre = pos[r] - pos[l-1];
        res = max(res, max(0LL, sum) + pos[n]-gre);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main()
{
    vector<vector<char>> c(3,vector<char>(3));
    for(int i=0; i<3; i++)
    {
        for(int j=0; j<3; j++)
        {
            cin>>c[i][j];
        }
    }
    cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int N, no , b, c, a, i, j;

  scanf("%d", &N);
  for(i = 0; i < N; i++){
    no = b = c = 0;
    for(j = 0; j < 10; j++){
      scanf("%d", &a);
      if(b < a) b = a;
      else if(c < a) c = a;
      else no++;
    }
      if(no == 0) printf("YES\n");
      else
	printf("NO\n");
  }
    return 0;
}

Measured memory_bytes: 580
n = int(input())
a = list(map(int, input().split()))
q = int(input())

l = [0] * 100001
for i in a:
    l[i] += 1

s = sum(a)

for _ in range(q):
    b, c = map(int, input().split())
    s += (c - b) * l[b]
    l[c] += l[b]
    l[b] = 0
    print(s)


Measured memory_bytes: 20840
# AGC031A - Colorful Subsequence
def main():
    _ = int(input())
    S = input().rstrip()
    MOD = 10 ** 9 + 7
    ans = 1
    for i in set(S):
        ans *= S.count(i) + 1
    print(ans % MOD - 1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
# 2019/09/01

n=int(input())
h=list(map(int,input().split()))[::-1]

cnt=0
ans=[]
for i in range(n-1):
    if h[i]<=h[i+1]:
        cnt+=1
        ans.append(cnt)    
    else:
        cnt=0
if ans:
    print(max(ans))
else:
    print(0)

Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,k;
    ll p,q,r;
    cin>>a>>b>>c>>k;
    r=0;
    if(a<=k){k-=a; r+=a;}
    else {r+=k;k=0;}
    if(b<=k){k-=b; r+=0;}
    else {r+=0;}
    if(c<=k){k-=c; r-=c;}
    else {r-=k; k=0;}
    cout<<r<<endl;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = (1<<30);

int main() {
  int a,b;
  cin >> a >> b;
  
  for(int i = b * 10; i < (b+1)*10; i++) {
    if((int)(i * 0.08) == a) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl; 
}

Measured memory_bytes: 3568
// #include <ext/pb_ds/assoc_container.hpp> 
        // #include <ext/pb_ds/tree_policy.hpp> 
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        #define trace(x) cerr << #x << ": " << x << " " << endl;
         
        typedef int64_t ll;
         
        #define endl '\n'
        #define int ll
        ll mod=1e18;
        ll mod1=1e9+5;
         
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
         
        // using namespace __gnu_pbds;
        // #define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
        //find_by_order(k)  returns iterator to kth element starting from 0;
        //order_of_key(k) returns count of elements strictly smaller than k;
        //erase,insert same as normal set
       
        int32_t main()
        {
            IOS
        

            int n,m;
            cin>>n>>m;
            int x[n+1];
            memset(x,-1,sizeof(x));
            for(int i=0;i<m;++i)
            {
                int a,b;
                cin>>a>>b;
                if(x[a-1]!=-1)
                {
                    if(x[a-1]==b)
                        continue;
                    cout<<-1;
                    return 0;
                }
                x[a-1]=b;
            }
            for(int i=0;i<=999;i++)
            {
                vector<int> v;
                if(i==0)
                {
                    v.push_back(0);
                }
                else
                {
                    int te=i;
                    while(te)
                    {
                        v.push_back(te%10);
                        te/=10;
                    }
                    reverse(v.begin(),v.end());
                }
                if(v.size()!=n)
                {
                    continue;
                }
                int ch=0;
                for(int i=0;i<v.size();i++)
                {
                    if(x[i]==-1)
                        continue;
                    if(x[i]!=v[i])
                    {
                        ch=1;
                        break;
                    }
                }
                if(ch==0)
                {
                    cout<<i;
                    return 0;
                }
            }
        cout<<-1;
        }       

Measured memory_bytes: 256
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

def wa(b,n):
    if n<b:
        return n
    else:
        return wa(b,int(n/b))+(n%b)

n=i()
s=i()


if n==s:
    print n+1
elif n<s:
    print -1
else:
    for j in range(2,int(math.sqrt(n))+1):
        if (n-s)%(j-1)==0:
            if wa(j,n)==s:
                print j
                break
    else:
        for j in reversed(range(1,int(math.sqrt(n))+1)):
            if (n-s)%j==0:
                if wa((n-s)/j+1,n)==s:
                    print (n-s)/j+1
                    break
        else:
            print -1


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

const int N = 100005;

int n, h[N], A, B;
long long H[N];

bool check(int val) {
	for (int i = 1; i <= n; ++i) H[i] = h[i] - 1LL * val * B; // H[i]: long long
	long long cnt = 0;
	for (int i = 1; i <= n; ++i) if (H[i] > 0) {
		cnt += (H[i] + A - 1) / A;
	}
	return cnt <= val;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> A >> B;
	A -= B;
	for (int i = 1; i <= n; ++i) cin >> h[i];

	// use binary search optimal sum
	int l = 0, r = 1e9;
	while(l < r) {
		int mid = ((l + r) >> 1);
		if (check(mid)) r = mid; else l = mid + 1;
	}
	cout << l << endl;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
long long A[1024];
int main(){
    A[0]=2;
    A[1]=1;
    int n;
    cin>>n;
    for(int i=2;i<=n;i++)
    {
        A[i]=A[i-1]+A[i-2];
    }
    cout<<A[n]<<endl;
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int x,y;
  scanf("%d %d",&x,&y);
  int a=0;
  
  for(int i=0;i<=x;i++){
    if(i*2+(x-i)*4==y||i*2+(x-i)*4==y)
      a=1;
  }
  if(a==1)
    printf("Yes");
  if(a==0)
    printf("No");
  return 0;
}

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

vector<int> v[11];
bool visit[11];
int n, ans;

void back_tracking(int node, int all)
{
	int i;

	if (all == n)
	{
		++ans;
		return;
	}

	visit[node] = true;
	for (i = 0; i < v[node].size(); i++)
	{
		int next = v[node][i];

		if (!visit[next])
			back_tracking(next, all + 1);
	}
	visit[node] = false;
}

int main(void)
{
	int m, i, a, b;

	scanf("%d %d" ,&n, &m);
	while (m--)
	{
		scanf("%d %d" ,&a, &b);
		v[a].push_back(b);
		v[b].push_back(a);
	}

	back_tracking(1, 1);

	printf("%d" ,ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
#include<cassert>
#include<cstring>

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

using namespace std;

typedef long long ll;

#define MAX 20010

ll dp[MAX];
int N,M;
ll K,A[MAX];

void computer() {
  rep(i,N+1) dp[i] = LLONG_MAX;
  rep(i,N) {
    dp[i] = ((i-1>=0)?dp[i-1]:0) + K;
    ll maxi = A[i];
    ll mini = A[i];
    for(int j=i-1;j>=0;--j) {
      if( i - j + 1 > M ) break;
      maxi = max(maxi,A[j]);
      mini = min(mini,A[j]);
      dp[i] = min(dp[i],((j-1>=0)?dp[j-1]:0)+K+(ll)(i-j+1) * ( maxi - mini ));
    }
  }
  cout << dp[N-1] << endl;
}

int main() {
  cin >> N >> M >> K;
  rep(i,N) cin >> A[i];
  computer();
  return 0;
}

Measured memory_bytes: 3420
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8


const int type[][2][4] = {
	{
		{0,1,0,1}, //a
		{0,0,1,1}
	},
	{
		{0,0,0,0}, //b
		{0,1,2,3}
	},
	{
		{0,1,2,3}, //c
		{0,0,0,0}
	},
	{
		{0,0,-1,-1}, //d
		{0,1,1,2}
	},
	{
		{0,1,1,2}, //e
		{0,0,1,1}
	},
	{
		{0,0,1,1}, //f
		{0,1,1,2}
	},
	{
		{0,1,-1,0}, //g
		{0,0,1,1}
	}
};
char field[8][9];

bool ok(int k, int x, int y){
	rep(i,4){
		int tx = x + type[k][0][i];
		int ty = y + type[k][1][i];
		if( tx<0 || ty<0 || tx>=8 || ty>=8 || field[ty][tx]=='0' ) return false;
	}
	return true;
}

int main(){
	
	while(~scanf("%s",field[0])){
		REP(i,1,8)scanf("%s",field[i]);
		bool f = false;
		int ans = -1;
		rep(i,8){
			rep(j,8){
				if( field[i][j]=='1' ){
					int k;
					for(k=0; k<7; k++)if( ok(k,j,i) ){
						f = true; ans = k;
					}
					if( f ) break;
				}
			}
			if( f ) break;
		}
		printf("%c\n",'A'+ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int n,k,aa[20][20],cnt=0,cnta=INF;
signed main(){
    cin>>n;
    rep(i,n){
        string s=to_string(i+1);
        if(s[s.size()-1]!=0){
            cnt+=aa[s[s.size()-1]-48][s[0]-48]*2;
            if(s[0]==s[s.size()-1]){
                cnt++;
            }
            aa[s[0]-48][s[s.size()-1]-48]++;
        }
    }
    cout<<cnt;
}


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

int main() {

int N,ans=0;
  cin>>N;
  vector<int> A(N),B(N),C(N-1);
  for(int i=0; i<N; i++){
    cin>>A.at(i);}
 for(int i=0; i<N; i++){
    cin>>B.at(i);}
 for(int i=0; i<N-1; i++){
    cin>>C.at(i);}
  
   for(int i=0; i<N-1; i++){
    ans+= B.at(A.at(i)-1);
     if(A.at(i)+1==A.at(i+1)){ans+=C.at(A.at(i)-1);}
   }
      
       
        ans+= B.at(A.at(N-1)-1);
	cout<<ans<<endl;
}


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

int mark[MAX];

int main(){
	int n;
	scanf("%d",&n);
	int x,mn = INT_MAX,mx = 0;
	for (int i=0;i<n;i++){
		scanf("%d",&x);
		mark[x]++;
		mn = min(mn,x);
		mx = max(mx,x);
	}
	if (n==2){
		if (mark[1]==2) cout << "Possible";
		else cout << "Impossible";
		return 0;
	}
	int temp = mx%2==0?mx/2:mx/2+1;
	if (temp!=mn){
		cout << "Impossible";
		return 0;
	}
	if (mx%2==0 && mark[mn]!=1){
		cout << "Impossible";
		return 0;
	}
	if (mx%2==1 && mark[mn]!=2){
		cout << "Impossible";
		return 0;
	}
	for (int i=mx;i>mn;i--){
		if (mark[i]<2){
			cout << "Impossible";
			return 0;
		}
	}
	cout << "Possible";
	return 0;
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 310, M = 100010;

int n;
int g[N][N], f[N][N];
bool st[N][N];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
		{
			cin >> g[i][j];
			f[i][j] = g[i][j];
		}
	
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )
			for (int j = 1; j <= n; j ++ )
				f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
				
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			if (g[i][j] != f[i][j])
			{
				puts("-1");
				return 0;
			}
	
	LL res = 0;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			for (int k = 1; k <= n; k ++ )
				if (k != i && k != j && g[i][j] == g[i][k] + g[k][j])
					st[i][j] = true;

	for (int i = 1; i <= n; i ++ )
		for (int j = i; j <= n; j ++ )
			if (!st[i][j])
				res += g[i][j];
	
	cout << res << endl;
	return 0;
}

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

int main() {
    int64_t x;
    cin >> x;
    int64_t money = 100;
    int ans = 0;
    while(money < x) {
        money = (double)money * 1.01;
        ans++;    
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main()

{

  int n,m,count,i,j,k;

  while (1)

    {
      scanf("%d %d",&n,&m);

      if (n==0) break;

      count=0;

      for (i=1;i<n-1;i++)
	{
	  for (j=i+1;j<n;j++)
	    {
	      for (k=j+1;k<n+1;k++)
		{
		  if (i+j+k==m) count+=1;
		}
	    }
	}

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

    }

  return 0;	

}



Measured memory_bytes: 2088
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numX = scanner.nextInt();

			if (numX - numA <= numB && numA <= numX) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numM = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numM = scanner.nextInt();
			numX = scanner.nextInt();

			Set<Integer> wk = new HashSet<Integer>();

			for (int i = 0; i < numM; i++) {
				wk.add(scanner.nextInt());
			}
			int res1 = 0;
			for (int i = numX; i <= numN; i++) {
				if (wk.contains(i)) {
					res1++;
				}

			}
			int res2 = 0;
			for (int i = 0; i <= numX; i++) {
				if (wk.contains(i)) {
					res2++;
				}

			}

			System.out.println(Math.min(res1, res2));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			long[] wk = new long[numN];
			long[] wk2 = new long[numN];

			for (int i = 0; i < wk.length; i++) {
				wk[i] = scanner.nextInt();
				wk2[i] = wk[i];
			}

			Arrays.sort(wk2);

			//中央値の準備（１：中央値より大きい値が除外された時の中央値　２：中央値より小さい値が除外された時の中央値）
			long m1 = wk2[(numN / 2) - 1];
			long m2 = wk2[(numN / 2)];

			for (int i = 0; i < wk.length; i++) {
				if (wk[i] > m1) {
					System.out.println(m1);
				} else {
					System.out.println(m2);
				}
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

int N, A, B;
int ans;

int main() {
	cin >> N >> A >> B;
	
	for(int i = 1; i <= N; ++i) {
		int tmp = 0;
		int ii = i;
		while(ii > 0) {
			tmp += ii % 10;
			ii /= 10;
		}
		if(tmp >= A && tmp <= B) {
			ans += i;
		}
	}
	
	cout << ans << endl;
}

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

int main(){
    int N;
    cin>>N;
    vector<vector<int>> a(2,vector<int>(N,0)),ruiseki(2,vector<int>(N+1,0));
    for(int i=0;i<2;i++){
        for(int j=0;j<N;j++){
            cin>>a[i][j];
            ruiseki[i][j+1]=ruiseki[i][j]+a[i][j];
        }
    }
    int ans=-1;
    for(int i=0;i<N;i++){
        ans=max(ans,ruiseki[0][i+1]+ruiseki[1][N]-ruiseki[1][i]);
    }
    cout<<ans<<endl;
}



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;

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  double ans = a[0];
  for (int i = 1; i < (n); ++i) {
    ans = (ans+a[i])/2;
  }
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(i, j)     memset(i, j, sizeof(i))
using namespace std;
 
#define ll long long
 int dp[3000][3000];
 ll t,n;
 vector<pair<int,int>>p;
 
 int solve(int i,int rem){
     if(rem<=0){return 0;}
     if(i==n){return 0;}
     int &ret=dp[i][rem];
    if(ret!=-1){return ret;}
     ret=solve(i+1,rem);
     ret=max(ret,solve(i+1,rem-p[i].first)+p[i].second);
     return ret;
     
 }
int main()
{
    cin>>n>>t;
    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        p.push_back({a,b});
    }clr(dp,-1);
    sort(p.begin(),p.end());
    cout<<solve(0,t);
  
   
}

Measured memory_bytes: 39028
#include <stdio.h>
#include <string.h>

int main() {
  int i;
  int n, point[2] = {};
  char Taro[200], Hanako[200];

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %s", Taro, Hanako);

    if (strcmp(Taro, Hanako) > 0) {
      point[0] += 3;
    } else if(strcmp(Taro, Hanako) < 0) {
      point[1] += 3;
    } else {
      point[0]++;
      point[1]++;
    }
  }

  printf("%d %d\n", point[0], point[1]);

  return 0;
}


Measured memory_bytes: 2096
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int x = o[0];
            int a = o[1];
            int b = o[2];
            string ans = null;
            if(b<=a)
            {
                ans = "delicious";
            }
            else if( b <= a+x)
            {
                ans = "safe";
            }
            else
            {
                ans = "dangerous";
            }
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<algorithm>
#include <cstring>
#include<set>
#include<cmath>
# define ll long long 
using namespace std;

int main()
{
	ll x,a;
	a=100;
	cin>>x;
	ll cnt=0;
	while(a<x)
	{
		a=(a*1.01);
		cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  string S; cin >> S;
  int price = 700;
  for (int i = 0; i < 3; ++i) {
    if (S[i] == 'o') price += 100;
  }
  cout << price << endl;
}


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

int main(){
  int A, B;
  cin >> A >> B;

  if(A <= 8 && B <= 8){
    cout << "Yay!" << endl;
  }
  else{
    cout<< ":(" << endl;
  }
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int x;
    cin >> x;
    
   int more = (x/500);
    
   int res = 0;
    
   res+=(more*1000);
    
   int left = x-(more*500);
    
   res+=(left/5)*5;
    cout << res;
        
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 256
def insertsort(array):
    for i in range(1,len(array)):
        print(" ".join(list(map(str,array))))
        temp = array[i]
        j = i-1
        while j >= 0 and temp < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = temp
    return array

input()
a = insertsort(list(map(int,input().split())))
print(" ".join(list(map(str,a))))



Measured memory_bytes: 5604
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
string s;
int k;
long long ans;
long long dfs(int now,int not0,bool free)
{
	long long ret=0;
	if(not0==k)
	{
		ret=1;
		return ret;
	}
	if(now==s.size()&&not0<k)
		return ret;
	if(!free)
	{
		if(s[now]=='0')
			ret=dfs(now+1,not0,false);
		else
		{
			for(int i=0;i<=int(s[now]-'0');i++)
			{
				if(i==0)
					ret+=dfs(now+1,not0,true);
				else if(i==int(s[now]-'0'))
					ret+=dfs(now+1,not0+1,false);
				else
					ret+=dfs(now+1,not0+1,true);
			}
		}
		return ret;
	}
	else
	{
		ret+=dfs(now+1,not0,true);
		ret+=dfs(now+1,not0+1,true)*9;
		return ret;
	}
}
int main(){
	cin>>s>>k;
	if(s.size()<k)
	{
		cout<<0;
		return 0;
	}
	ans=dfs(0,0,false);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool bad[10];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        int x;
        cin >> x;
        bad[x] = true;
    }
    for (int i = n; ; i++) {
        bool ok = true;
        int p = i;
        while (p) {
            if (bad[p % 10]) {
                ok = false;
                break;
            }
            p /= 10;
        }
        if (ok) {
            cout << i;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
t_t = 0
h_t = 0
for i in range(n):
    k = input()
    t, h = k.split()
    if t > h:
        t_t += 3
    elif t < h:
        h_t += 3
    elif t == h:
        t_t += 1
        h_t += 1
print(t_t, h_t)
        


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

char s[ 1024 ];
string str;
VS check_string;
VS _array;

int main() {
	while ( ~scanf( "%s", s ) ) {
		str = ( string ) s;
		check_string.clear();
		int now = 0;
		for ( int i = 0; i < str.size(); i++ ) {
			if ( str[ i ] == ',' || str[ i ] == '.' ) {
				check_string.push_back( str.substr( now, i - now ) );
				now = i + 1;
			}
		}
		if ( now != str.size() ) {
			check_string.push_back( str.substr( now, str.size() - now ) );
			if ( check_string[ check_string.size() - 1 ][ check_string[ check_string.size() - 1 ].size() - 1 ] == '.' || check_string[ check_string.size() - 1 ][ check_string[ check_string.size() - 1 ].size() - 1 ] == ',' ) {
				check_string[ check_string.size() - 1 ] = check_string[ check_string.size() - 1 ].substr( 0, check_string[ check_string.size() - 1 ].size() - 1 );
			}
		}
		for ( int i = 0; i < check_string.size(); i++ ) {
			if ( check_string[ i ].size() >= 3 && check_string[ i ].size() < 7 ) {
				_array.push_back( check_string[ i ] );
			}
		}
	}
	for ( int i = 0; i < ( ( int ) _array.size() ) - 1; i++ ) {
		printf( "%s ", _array[ i ].c_str() );
	}
	
	if ( _array.size() ) {
		printf( "%s", _array[ _array.size() - 1 ].c_str() );
	}
	printf( "\n" );
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Count(ll input){
    
    ll sum = 0;
    while(input){
        input/= 2;
        sum++;
    }
    return sum;
}
int main(){

    ll H; cin >> H;
    printf("%.0f\n",pow(2,Count(H))-1);
}

Measured memory_bytes: 4160
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
now = 99999
ans = 0
for i in range(N):
  tem = T - H[i] * 0.006
  if abs(tem - A ) < now:
    now = abs(tem - A)
    ans = i+1
print(ans)

Measured memory_bytes: 9256