akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1e9 + 7;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*ll fact_[200000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 200000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy*/
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
string s, t;
vector<int>b[26];
signed main() {
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++) {
		b[(int)(s[i] - 'a')].push_back(i);
	}
	int ans = 0, k = 0;
	for (int i = 0; i < t.size(); i++) {
		int r = (int)(t[i] - 'a');
		int g = lower_bound(all(b[r]), k) - b[r].begin();
		if (g == b[r].size()) {
			if (b[r].size() == 0) {
				cout << -1 << endl;
				return 0;
			}
			ans += (s.size() - k) + b[r][0] + 1;
			k = b[r][0] + 1;
		}
		else {
			ans += b[r][g] - k + 1;
			k = b[r][g] + 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1724
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a==b&&a!=c||a==c&&a!=b||b==c&&b!=a) System.out.println("Yes");
        else System.out.println("No");



    }
}


Measured memory_bytes: 23764
#include <stdio.h>


int main(){
	int a, b,ret;
	if((ret = scanf("%d %d",&a, &b))==EOF){return -1;}
	if(a <= b){
		for(int i =0; i< b; i++){printf("%d",a);}
		printf("\n");
	}else{
		for(int i =0; i< a; i++){printf("%d",b);}
		printf("\n");
	}
	
	return 0;
}

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

struct question {
    int wa;
    int ac;
};

int main(void) {
    int N,M;
    cin>>N>>M;
    map<int, question> qmap;
    for (int i = 0; i < M; i++) {
        int p;
        string S;
        cin>>p>>S;
        if (qmap.find(p) != qmap.end()) {
            question *q = &qmap[p];
            if (q->ac > 0) continue;
            else {
                if (S == "WA") q->wa += 1;
                else q->ac += 1;
            }
        } else {
            question q;
            if (S == "WA") {
                q.ac = 0;
                q.wa = 1;
            } else {
                q.ac = 1;
                q.wa = 0;
            }
            qmap[p] = q;
        }
    }
    int result_ac = 0;
    int result_wa = 0;
    for (map<int, question>::iterator it = qmap.begin(); it != qmap.end(); ++it) {
        question *q = &(it->second);
        if (q->ac > 0) {
            result_ac++;
            result_wa += q->wa;
        }
    }
    cout << result_ac << " " << result_wa << endl;
    return 0;
}

Measured memory_bytes: 4992
#![allow(non_snake_case,unused_imports,dead_code)]
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {
    input!{
        N:usize,
        A:[usize;N],
    }

    let mut n1 = 0;
    let mut n2 = 0;
    let mut n4 = 0;
    for &a in &A{
        match a%4{
            0 => {n4 += 1;}
            2 => {n2 = 1;}
            _ => {n1 += 1;}
        }
    }
    n1 += n2;
    println!("{}",if n4+1 >= n1 {"Yes"} else {"No"});

}

Measured memory_bytes: 3616
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int dfs(string s, int i, int n){
    if (i == n) {
        return 1;
    }

    vector<int> a(4, 0);

    if (s.substr(i, 7) == "dreamer"){
        a[0] = dfs(s, i+7, n);
    }
    if (s.substr(i, 6) == "eraser"){
        a[1] = dfs(s, i+6, n);
    }
    if (s.substr(i, 5) == "dream"){
        a[2] = dfs(s, i+5, n);
    }
    if (s.substr(i, 5) == "erase"){
        a[3] = dfs(s, i+5, n);
    }

    if (accumulate(a.begin(), a.end(), 0) > 0){
        return 1;
    }else{
        return 0;
    }
}



int main(int argc, char**argv){
    string s;
    cin >> s;

    int i = 0;
    if (dfs(s, i, s.size())) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}













Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#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, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    ll H, W;
    cin >> H >> W;
    if (H == 1 | W == 1)
    {
        cout << 1 << endl;
    }
    else if (H * W % 2 == 0)
    {
        cout << H * W / 2 << endl;
    }
    else
    {
        cout << H * W / 2 + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



n=int(input())
a=list(map(int,input().split()))
a.sort()
s=10**6
s+=100
sosu_flag=[True for i in range(s)]
#素数であるかどうかの前計算
#素数をn倍していき倍数をどんどん塗りつぶしていくイメージ
ans=0
cal=[]
for i in a:
    if not sosu_flag[i]:
        continue
    ans+=1
    cal.append(i)
    for j in range(i,s,i):
        sosu_flag[j]=False

c=Counter(a)
for key in cal:
    if c[key]>1:
        ans-=1
print(ans)

Measured memory_bytes: 168520
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{
    int vacationDays, assignments, daysRequired = 0;
    scanf("%d %d", &vacationDays, &assignments);
    
    for(int i = 0; i < assignments; i++)
    {
        int oneAssignment;
        scanf("%d", &oneAssignment);
        daysRequired += oneAssignment;
    }
    
    vacationDays = vacationDays - daysRequired;
    
    if(vacationDays < 0)
    {
       printf("-1 \n");
    }
    else
    {
        printf("%d \n",vacationDays);
    }
    
    return 0;
}


Measured memory_bytes: 1676
// AOJ Volume 0 Problem 0034

#include <stdio.h>

int main(void)
{
	int l[10];
	int sum_l;
	int l1;
	int v1, v2;
	int i;

	while (scanf("%d,", &l[0]) != EOF){
		for (i = 1; i < 10; i++){
			scanf("%d,", &l[i]);
		}
		scanf("%d,%d", &v1, &v2);

		sum_l = 0;
		for (i = 0; i < 10; i++){
			sum_l += l[i];
		}
		
		l1 = ((float)v1 * sum_l / (v1 + v2) + 0.9999);
		
		i = 0;
		while (l1 > 0){
			l1 -= l[i];
			i++;
		}
		printf("%d\n", i);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define x first
#define y second

vector<vector<int>> dp, arr;
int main() {
    fast;
    int n;
    cin>>n;
    arr.resize(n);
    dp.resize(n);
    for (int i = 0; i <n; ++i) {
        arr[i].resize(3);
        dp[i].resize(3);
        for (int j = 0; j < 3; ++j) {
            cin>>arr[i][j];
            dp[i][j] = -1;
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 3; ++j) {
            if(i == n-1)
            {
                dp[i][j] = arr[i][j];
            } else{
                int temp, max = 0;
                for (int k = 0; k < 3; ++k) {
                    if(k == j)
                        continue;
                    temp = dp[i + 1][k];
                    if(temp > max)
                        max = temp;
                }
                dp[i][j] = max + arr[i][j];
            }
        }
    }
    sort(dp[0].begin(), dp[0].end());
    cout<<dp[0][2];
}

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

using namespace std;

long long n, s;

long long chec(long long b, long long n) {
	if (b <= n) return chec(b, n/b) + n % b;
	return n;
}

vector<long long> res;

signed main() {
	cin >> n >> s;
	if (n == s) {
		cout << n + 1;
		return 0;
	}
	for (int i = 1; i <= sqrt(n - s); i++) {
		if ((n - s) % i == 0) {
			if (chec(i + 1, n) == s) res.push_back(i + 1);
			if (chec((n - s) / i + 1, n) == s) res.push_back((n - s) / i + 1);
		}
	}
	sort(res.begin(), res.end());
	res.push_back(-1);
	cout << *res.begin();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,q;
string s;
bool palin(int l, int r)
{
    int t=l+r;
    if(r-l+1 == 2)
        if(s[l] != s[r]) return false;
    for(int i=l; i< t/2;++i)
        if(s[i] != s[t-i])
            return false;
    return true;
}
int main()
{
    cin>>s;
    n=s.size();
    if(palin(0,n-1))
    {
        if(palin(0,(n-1)/2 -1))
           if (palin((n+3)/2 -1, n-1))
           {cout<<"Yes"; return 0;}
        cout<<"No";
    }
    else cout<<"No";
    return 0;
}


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

int main() {
	int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int x, y;
	cin >> x >> y;
	if (month[x - 1] == month[y - 1]) cout << "Yes";
	else cout << "No";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

このグループって暦の各月の日数で分けてるじゃねーか！
あ、判定に関してはあれだ、それぞれにグループ番号を割り振って、
そのグループ番号が一致すれば～で解ける
*/

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void) {
	int A, B;
	char op;
	/* 出力が合わなかった理由→空白も入力に含まれる */
	scanf("%d %c %d", &A, &op, &B);
	if (op == '+') {
		printf("%d", A + B);
	}
	else {
		printf("%d", A - B);
	}


	return 0;

}

Measured memory_bytes: 128
a,b,k = map(int,input().split())
if a < b:
  tmp = a
  a = b
  b = tmp
cnt = 0
c = b
while cnt < k:
  if a % c == 0 and b % c == 0:
    cnt += 1
  if cnt < k:
    c -= 1
print(c)

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

int main() {
  int a,b;
  cin>>a>>b;
  int ans=-1;
  for(int i=1;i<1500;i++){
    if(i*8/100==a && i/10==b){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 5e3+5 , mod=1e9+7;
const int b = 37;
const int b2 = 31;
int pw[N] , inv[N] , pw2[N] , inv2[N];
pair<int,int> prefix[N] , prefix2[N];
int n;
string s;

int mul(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (1ll * a * b) % mod;
}

int add(int a, int b)
{
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int fastpow(int base, int power)
{
    if(!power)
        return 1;
    int ret = fastpow(base, power / 2);
    ret = mul(ret, ret);
    if(power & 1)
        ret = mul(ret, base);
    return ret;
}

void pre()
{
    pw[0] = inv[0] = pw2[0] = inv2[0] =1;
    int mul_inv = fastpow(b, mod - 2);
    int mul_inv2 = fastpow(b2, mod - 2);
    for(int i = 1; i < N; i++)
    {
        pw[i] = mul(pw[i - 1], b), inv[i] = mul(inv[i - 1], mul_inv);
        pw2[i] = mul(pw2[i - 1], b2), inv2[i] = mul(inv2[i - 1], mul_inv2);
    }
}

pair<int,int> getHash(int l , int r)
{
    int res = prefix[r].f , res2 = prefix[r].s;
    if (l) res = add(res , -prefix[l-1].f) , res2 = add(res2 , -prefix[l-1].s);
    res = mul(res , inv[l]) , res2 = mul(res2 , inv2[l]);
    return {res,res2};
}

void calc()
{
    for(int i=0; i<s.size(); i++)
    {
        if (i) prefix[i] = prefix[i-1];
        prefix[i].f = add(prefix[i].f , mul(s[i]-'a'+1 , pw[i]));
        prefix[i].s = add(prefix[i].s , mul(s[i]-'a'+1 , pw2[i]));
    }
}

bool check(int len)
{
    map< pair<int,int> , int> mp;
    for(int i=0; i+len-1<n; i++)
    {
        int l=i , r = i+len-1;
        pair<int,int> pr = getHash(l,r);
        if (!mp.count(pr)) mp[pr] = r;
        else
        {
            if (mp[pr] < i) return 1;
        }
    }

    return 0;
}

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

    pre();

    cin >> n >> s;
    calc();

    int l=1 , h=n , mid , idx=0;
    while(l<=h)
    {
        mid = (l+h)/2;
        if (check(mid))
        {
            idx = max(idx , mid);
            l = mid+1;
        }
        else h=mid-1;
    }

    cout << idx << '\n';

    return 0;
}

Measured memory_bytes: 768
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1195&lang=jp
//
#include <bits/stdc++.h>
using namespace std;
vector<string> lists;
string input;
void listsup(char key, string str) {
    if (key == 'a') {
        lists.push_back(str);
        return;
    }
    string::size_type index = str.find(key);
    // cout << key << endl;
    if (index == string::npos) {
        // ?????£???????????´???
        listsup(key-1, str);
        // ?????£?????´???
        for (int i=0; i<str.length(); i++) {
            if (str[i] == key-1) {
                string temp = str;
                temp[i] = key;
                listsup(key-1, temp);
            }
        }
    } else {
        // ????????\?????§??????????????£?????????
        for (int i=0; i<index; i++) {
            if (str[i] == key-1) {
                string temp = str;
                temp[i] = key;
                listsup(key-1, temp);
            }
        }
    }
}
int main() {
    while (cin >> input) {
        if (input == "#") break;
            lists.erase(lists.begin(), lists.end());
            listsup('z', input);
            sort(lists.begin(), lists.end());
            cout << lists.size() << endl;
            if (lists.size() > 10) {
                for (int i=0; i<5; i++) cout << lists[i] << endl;
                for (int i=5; i>0; i--) cout << lists[lists.size()-i] << endl;
            } else {
                for (int i=0; i<lists.size(); i++) cout << lists[i] << endl;
            }
    }
}

Measured memory_bytes: 2352
#include <stdio.h>
int main(void){
    
    int i,j=0,a,b,c,d,e[101]={0},f[101]={0};
    
    scanf("%d%d",&a,&b);
    for(i=a;i<b;i++) e[i]=1;
    scanf("%d%d",&c,&d);
    for(i=c;i<d;i++) f[i]=1;
    
    for(i=0;i<101;i++)
        if((e[i]==f[i])&&(e[i]==1))
            j++;
    
    printf("%d\n",j);
    
    return 0;
}


Measured memory_bytes: 1728
//abc178_e.cpp
//Sun Sep 13 20:42:27 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

using namespace std;
using ll=long long;
typedef pair<ll,ll> P;

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

	vector<ll> zx,zy;
	rep(i,n) {
		ll x,y;
		cin >> x >> y;
		zx.push_back(x+y);
		zy.push_back(x-y);
	}

	sort(zx.begin(),zx.end());
	sort(zy.begin(),zy.end());

	ll ans = max(zx[zx.size()-1]-zx[0],zy[zy.size()-1]-zy[0]);
	cout << ans << endl;

}


Measured memory_bytes: 6628
inp = []
while(1):
    ans = 0
    n, x = map(int, input().split())
    if n == 0:
        break
    for y1 in range(1, n-1):
        for y2 in range(y1+1, n):
            for y3 in range(y2+1, n+1):
                if y1 + y2 + y3 == x:
                    ans +=1
    print(ans)



Measured memory_bytes: 5600
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
a,b,c,d=io()
while 1:
    c=c-b
    if c<=0:
        print('Yes')
        break
    a-=d
    if  a<=0:
        print('No')
        break

Measured memory_bytes: 9180
#include <stdio.h>

void insertionSort(int *A, int N)
{
    int v;
    int i;
    int j;
    int k;
    
    for ( k = 0; k < N; k++ ) {
        printf("%d", A[k]);
        if ( k == N - 1 ) {
            printf("\n");
        } else {
            printf(" ");
        }
    }
    
    for ( i = 1; i < N; i++ ) {
        v = A[i];
        j = i - 1;
        while ( ( j >= 0 ) && ( A[j] > v)) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        for ( k = 0; k < N; k++ ) {
            printf("%d", A[k]);
            if ( k == N - 1 ) {
                printf("\n");
            } else {
                printf(" ");
            }
        }
    }
    
    return;
}

int main(void)
{
    int N;
    int A[100] = { 0 };
    int i;
    
    scanf("%d", &N);
    
    for ( i = 0; i < N; i++ ) {
        scanf("%d", &A[i]);
    }
    
    insertionSort( A, N );
    
    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;


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

    if (k % 2 == 0) {
        cout<<a - b<<endl;
    } else {
        cout<<b - a<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s;
    cin >> s;
    int n = stoi(s);
    int sum = 0;
    rep(i, s.size()) {
        sum += s[i]-'0';
    }

    if(n%sum) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}

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

using namespace std;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int Q;
    cin >> S >> Q;
    bool flip = false;
    string prefix = "";
    string suffix = "";
    for (int i = 0; i < Q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            flip = !flip;
        } else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (flip) {
                    suffix += c;
                } else {
                    prefix = c + prefix;
                }
            } else {
                if (flip) {
                    prefix = c + prefix;
                } else {
                    suffix += c;
                }
            }
        }
    }
    S = prefix + S + suffix;
    if (flip) {
        reverse(S.begin(), S.end());
    }
    cout << S << endl;
    return 0;
}


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

main() {
  ll Q, H, S, D; cin >> Q >> H >> S >> D;
  int N; cin >> N;
  H = min(H, 2 * Q);
  S = min(S, 2 * H);
  ll ans = 0;
  if (2 * S < D) {
    ans = N * S;
  } else {
    ans = (N / 2) * D + (N % 2) * S;
  }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

int n;
int flag[110];

void dfs(int n){
    if(n>100) return;
    flag[n]=true;
    dfs(n+4);
    dfs(n+7);
}
int main() {
    cin>>n;

    dfs(4);
    dfs(7);

    if(flag[n]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int H,W,i,l;
	
	while(1){
		
		scanf("%d %d",&H,&W);
		
		if((H==0)&&(W==0))break;
		
		for(l=0;l<H;l++){
			for(i=0;i<W;i++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2104
use proconio::{fastout, input};
use std::cmp::{min,max};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        v: [i64 ; n],
    }

    let r = min(n,k);
    let mut ans : i64 = 0;
    for i in 0..=r{
        for j in 0..=(r-i){
            let mut hand : Vec<i64>= vec![];
            let mut tmp_k : i32= (k - (i+j)) as i32;
            for k in 0..i{
                hand.push(v[k]);
            }
            for k in 0..j{
                hand.push(v[n-k-1]);
            }

            hand.sort();
            hand.reverse();

            if hand.len() == 0{
                continue;
            }

            while hand.len() > 0 && tmp_k > 0{
                if hand[hand.len() - 1] >= 0{
                    break;
                }
                hand.pop();
                tmp_k -= 1;
            }

            let res : i64= hand.iter().sum();
            ans = max(ans,res);
        }
    }

    println!("{}",ans);
}


Measured memory_bytes: 2156
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

struct segtree
{
	static const int SIZE = 1 << 16;
	int data[2 * SIZE];

	segtree() {
		for (int i = 0; i < 2 * SIZE; ++i) data[i] = 0;
	}

	void incl(int p) {
		p += SIZE;
		while (p) {
			data[p] += 1;
			p >>= 1;
		}
	}

	int query(int L, int R) {
		L += SIZE;
		R += SIZE;
		int ret = 0;
		while (L < R) {
			if (L & 1) ret += data[L++];
			if (R & 1) ret += data[--R];
			L >>= 1; R >>= 1;
		}
		return ret;
	}
};

int N, A[101010], B[101010], C[101010];

int inv(vector<int> a, vector<int> b)
{
	int ori[40404];
	for (int i = 0; i < a.size(); ++i) {
		ori[a[i]] = i;
	}
	vector<int> b2;
	for (int i = 0; i < b.size(); ++i) {
		b2.push_back(ori[b[i]]);
	}
	//for (int i = 0; i < a.size(); ++i) {
	//	printf("%d %d %d\n", a[i], b[i], b2[i]);
	//}
	segtree seg;
	int ret = 0;
	for (int i = 0; i < b2.size(); ++i) {
		ret += seg.query(b2[i], b2.size());
		seg.incl(b2[i]);
	}
	//printf("%d\n", ret);
	return ret;
}
vector<int> trans(vector<pair<double, int> > v)
{
	vector<int> ret;
	for (auto a : v) ret.push_back(a.second);
	return ret;
}
i64 solve2(double t)
{
	vector<pair<double, int> > fst;
	for (int i = 0; i < N; ++i) {
		fst.push_back({ (double)A[i] / B[i], i });
	}
	sort(fst.begin(), fst.end());

	vector<pair<double, int> > aft;
	for (int i = 0; i < N; ++i) {
		aft.push_back({ (C[i] - A[i] * t) / B[i], i });
	}
	sort(aft.begin(), aft.end());

	return inv(trans(fst), trans(aft));
}

double solve()
{
	double left = -1e9, right = 1e9;
	int tot = (1+  N * (N - 1) / 2) / 2;
	for (int i = 0; i < 70; ++i) {
		double mid = (left + right) / 2;

		if (solve2(mid) < tot) {
			left = mid;
		} else {
			right = mid;
		}
	}
	return left;
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d%d%d", A + i, B + i, C + i);
	}

	double ansx = solve();
	for (int i = 0; i < N; ++i) swap(A[i], B[i]);
	double ansy = solve();

	printf("%.10f %.10f\n", ansx, ansy);

	return 0;
}


Measured memory_bytes: 5656
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
inline int mex(unordered_set<int> st)
{
    int m = 0;
    while (st.find(m) != st.end())
    {
        m += 1;
    }
    return m;
}
inline int calculateGrundy(int n)
{
    if (n == 1)
        return 0;
    unordered_set<int> mexi;
    for (int i = 1; i <= sqrt(n); i += 1)
    {
        if (n % i == 0)
        {
            if (n / i != n)
                mexi.insert(calculateGrundy(n / i));
            mexi.insert(calculateGrundy(i));
        }
    }
    return mex(mexi);
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll n, k;
    cin >> k >> n;
    vector<ll> arr(n, 0);
    f(i, 0, n)
    {
        cin >> arr[i];
    }
    sort(all(arr));
    ll ans = INF;
    f(i, 0, n)
    {
        ll gh=i;
        if (gh == 0)
            gh = n - 1;
        else
            gh -= 1;
        if (gh == n - 1)
        {
            if(ans> arr[gh] - arr[0])
                ans = arr[gh] - arr[0];
        }
        else
        {
            if(ans > k + arr[gh] - arr[i])
            ans = k + arr[gh] - arr[i];
        }
    }
    f(i, n-1, -1)
    {
        ll gh = i;
        if (gh == 0)
            gh = n - 1;
        else
            gh -= 1;
        if (gh == n - 1)
        {
            if (ans > arr[gh] - arr[0])
                ans = arr[gh] - arr[0];
        }
        else
        {
            if (ans > k + arr[gh] - arr[i])
                ans = k + arr[gh] - arr[i];
        }
    }
    f(i, 0, n)
    {
        ll gh = i;
        if (gh == n-1)
            gh = 0;
        else
            gh += 1;
        if (gh == 0)
        {
            if (ans > k-arr[gh] + arr[i])
                ans = k-arr[gh] + arr[i];
        }
        else
        {
            if (ans > k - arr[gh] + arr[i])
                ans = k - arr[gh] + arr[i];
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
using ll = long long;

int main(){
    int h; int n;
    cin >> h >> n;
    vector<int> a(n);
    for (int i=0;i<n;i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end(),greater<int>());
    bool can=false;
    int sum=0;
    for (int i=0;i<n;i++){
        sum+= a.at(i);
    }
    if(sum>=h) can =true;
    if(can) cout << "Yes" << endl;
    else cout <<"No" << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

def check(c):
    return (ord(c) >= ord('0') and ord(c) <= ord('9'))

def check2(c):
    return (ord(c) >= ord('A') and ord(c) <= ord('Z'))

while True:
    S1, S2 = raw_input().split()
    if S1 == '0':
        break
    N = int(S2)
    SS = ''
    flag = False
    for i in range(len(S1) - 1):
        SS += S1[i]
        if check(S1[i]) and not check(S1[i + 1]) and S1[i + 1] != '(':
            SS += '('
            flag = True
        elif flag:
            SS += ')'
            flag = False
    SS += S1[len(S1) - 1]
    if flag:
        SS += ')'
    S1 = '(' + SS + ')'
    for i in range(26):
        c = chr(ord('A') + i)
        S1 = S1.replace('(' + c, '("' + c)
        S1 = S1.replace(c + ')', c + '")')
        S1 = S1.replace(')' + c, ')"' + c)
        S1 = S1.replace(c + '(', c + '"(')
        for j in range(10):
            c2 = str(j)
            S1 = S1.replace(c + c2, c + '"' + c2)
    S1 = S1[1 : -1]
    S1 = S1.replace('(', ',')
    SS = ''
    for i in range(len(S1) - 1):
        SS += S1[i]
        if not check(S1[i]) and check(S1[i + 1]):
            SS += '('
    SS += S1[len(S1) - 1]
    if check(S1[0]):
        SS = '(' + SS
    S1 = '(1, ' + SS + ')'
    S1 = S1.replace(')(', '),(')
    S1 = S1.replace(')"', '),"')
    S1 = S1.replace('"(', '",(')
    hoge = eval(S1)
    ans = 0
    m = {}
    def func(obj):
        if type(obj) == type("hoge"):
            m[obj] = len(obj)
            return len(obj)
        num = obj[0]
        ret = 0
        for i in range(1, len(obj)):
            ret += num * func(obj[i])
        m[obj] = ret
        return ret

    def func2(obj, index):
        if type(obj) == type("hoge"):
            return obj[index]
        num = obj[0]
        S = m[obj]
        index %= S / num
        ret = 0
        for i in range(1, len(obj)):
            ret += m[obj[i]]
            if ret > index:
                ret -= m[obj[i]]
                return func2(obj[i], index - ret)
        return '0'
    
    func(hoge)
    if N >= m[hoge]:
        print '0'
    else:
        print func2(hoge, N)



Measured memory_bytes: 5164
#include<stdio.h>
int main(){
	long long a,b,c,d,x,y;
	scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
	x=a*b;
	y=c*d;
	if(x>=y){
		printf("%ld\n",x);
		}
		else{printf("%ld\n",y);}
	return 0;
	}

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

namespace AtCode
{
    class Class1
    {
        static void Main(string[] args)
        {
            string Input = Console.ReadLine();
            char Command;
            string Output = null;
            int cnt = 0;
            for (int i = 0; i < Input.Length; i++)
            {
                Command = Input[i];

                if(Command == '0')
                {
                    Output += "0";
                    cnt++;
                }
                else if(Command == '1')
                {
                    Output += "1";
                    cnt++;
                }
                else if(Command == 'B')
                {
                    if(cnt != 0)
                    {
                        Output = Output.Remove(Output.Length -1);
                        cnt--;
                    }
                }

            }
            Console.WriteLine(Output);
        }
    }
    
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9+7 ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////
void solve(){
    int n ;
    cin >> n ;
    string s ;
    cin >> s ;
    vector < set < int > > v(26);
    for( int i = 0 ; i < n ; i++){
        v[s[i]-'a'].insert(i);
    }
    int m ;
    cin >> m ;
    while(m--){
        int t ;
        cin >> t ;
        if(t==2){
            int l , r ;
            cin >> l >> r ;
            l--,r--;
            int ans = 0 ;
            for( int i = 0 ; i < 26 ; i++){
                auto it = v[i].lower_bound(l);
                if(it != v[i].end() && *it>=l && *it<=r)
                    ans++;
            }
            cout << ans << "\n";
        }
        else{
            int l ;
            char c ;
            cin >> l >> c ;
            l--;
            char p = s[l];
            v[p-'a'].erase(l);
            v[c-'a'].insert(l);
            s[l] = c ;
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t ;
    t = 1 ;
   // cin >> t ;
    while(t--){
        solve( );
    }
}


Measured memory_bytes: 24220
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
vi S,T;
bool bSearch(ll l, ll r, ll x){
    if(l>r)return false;
    ll mid=(l+r)/2;
    if(S[mid]<x){
        l=mid+1;
    }else if(x<S[mid]){
        r=mid-1;
    }else{
        return true;
    }
    bSearch(l,r,x);
}
int main(void){
    ll N;cin>>N;
    S.resize(N);
    REP(i,N)cin>>S[i];
    
    ll Q;cin>>Q;
    T.resize(Q);
    REP(i,Q)cin>>T[i];
    
    ll cnt=0;
    REP(i,Q){
        cnt+=bSearch(0,S.size()-1,T[i]);
    }
    cout<<cnt<<"\n";
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll t1,t2,p;
	cin>>t1>>t2>>p;
	if(t2>=p)
	{
		cout<<p+t2;
	}
	else{
		p-=t2;
		if(p>t1)
		{
			cout<<2*t2+min(t1,p)+1;
		}
		else{
			cout<<2*t2+min(t1,p);
		}
	}
 	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] array = sc.intarr;
            int a = array[0];
            int b = array[1];

            if(a <= b)
            {
                wr.wri(a);
            }
            else
            {
                wr.wri(a-1);
            }

        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    int X,Y;
    cin >> X >> Y;
    
    int tmp = X,cnt = 0;
    while(tmp<=Y){
        tmp = tmp*2;
        cnt++;
    }
    
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//入力
		Scanner sc = new Scanner(System.in);

		//図形作成繰り返し
		for (int h = 0;; h++) {

			//縦の長さ
			int H = sc.nextInt();

			//横の長さ
			int W = sc.nextInt();

		//	if (H > 0 && W > 0) {

				//どちらも0の時は終了
				if (H == 0 && W == 0) {
					break;

				}
				//繰り返しH
				for (int i = 0; i < H; i++) {

					//	System.out.println("#");

					//繰り返しW
					for (int j = 0; j < W; j++) {

						System.out.print("#");

					}
					System.out.println();
				}
			//}
			System.out.println();
		}

	}
}



Measured memory_bytes: 34904
n, a, b = gets.strip.split.map(&:to_i)

# 各桁の和を求める
def digit_sum n
    sum = 0
    while n > 0 do
        sum += n % 10
        n /= 10
    end
    sum
end

ans = (1..n)
        .map { |i| [i, digit_sum(i)] }
        .select { |d| a <= d[1] && d[1] <= b }
        .inject(0) { |sum, d| sum + d[0] }

puts ans

Measured memory_bytes: 2300
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}
 
 
 
 
 
 
 





int main()
{
     int n,m;
     cin>>n>>m;
     int ct[n+1]={0};
     for(int i=0;i<m;i++){
          int x,y;
          cin>>x>>y;
          ct[x]++;ct[y]++;
     }
     for(int i=1;i<=n;i++){
          if(ct[i]%2){cout<<"NO";return 0;}

     }
     cout<<"YES";

     
}




































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

using namespace std;

int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	int ans = 1;
	for (int i = 1; i <= n; i++){
		if (ans <= k)
			ans <<= 1;
		else 
			ans += k;
	}
	printf("%d\n", ans);
	return 0;
}

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

int N;
int main (){
    cin >> N;
    long long int l[N+1];
    l[0] = 2;
    l[1] = 1;
    for(int i=2; i<N+1; i++){
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[N] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
ll arr[100];

void lucas(ll n)
{
	arr[0]=2;
	arr[1]=1;
	for(ll i=2;i<=n;i++)arr[i]=arr[i-1]+arr[i-2];
}

int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n;
	lucas(n);
	cout<<arr[n];

}

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

int main (){
  unsigned long long X, a;
  cin >> X;
  a = 100;
  unsigned long long i = 0;
  while (1){
    i++;
    a = a * 1.01;
    if ( X <= a )break;
  }
  cout << i;
}

Measured memory_bytes: 3592
n = int(input())
l=[[] for _ in range(n)]
for i in range(n):
    a,b = input().split()
    b=int(b)
    l[i].append(a)
    l[i].append(b)

c=input()
memo=0
ans=0
for i in range(n):
    if memo==1:
        ans+=l[i][1]
    if l[i][0]==c:
        memo=1

print(ans)

Measured memory_bytes: 9096
// Problem : C - Together
// Contest : AtCoder Regular Contest 082
// URL : https://atcoder.jp/contests/arc082/tasks/arc082_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n, ans = 0, a[N], pre[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; i++) {
		int r = upper_bound(a + 1, a + n + 1, a[i] + 2) - a;
		ans = max(ans, r - i);
	}
	cout << ans;
}


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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  int s,t;
  s = 0;
  t = 1;
  for(int j = 0; j < N; j++){
    s += vec.at(j);
    if(s <= X){
      t += 1;
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long d[105][100005];

int main()
{
    int n,w;
    cin>>n>>w;
    long long wt[n+1],val[n+1];
    for(int i=1; i<=n; i++)
        cin>>wt[i]>>val[i];
    for(int i=1; i<=n; i++) {
        for(int j=1; j<=w; j++) {
            if(wt[i]>j)
                d[i][j]=d[i-1][j];
            else {
                d[i][j]=max(d[i-1][j],val[i]+d[i-1][j-wt[i]]);
            }
        }
    }
    cout<<d[n][w]<<endl;
    return 0;
}

Measured memory_bytes: 81664
#include<stdio.h>
#include<math.h>

int main(){

  long long n;
  scanf("%lld",&n);

  long long a[n];

  for(long long i=0;i<n;i++){
    scanf("%lld",&a[i]);
  }

  long long b0=0;
  long long b1=0;
  long long b2=0;

  for(long long i=0;i<n;i++){
    if(a[i]%4==0){
      b2++;
    }
    else if(a[i]%2==0){
      b1++;
    }
    else{
      b0++;
    }
  }

  if(b1==0){
    if(b2+1>=b0){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
  else{
    if(b2>=b0){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }

  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
using namespace std;
const int INF = 1 << 30;
const int NIL = -1;
const int MAXN = 10005;
int vis[MAXN];
int d[MAXN];
int head[500005];
int n;
int cnt;
struct Edge {
	int to, next, w;
	Edge() {}
} edge[500005];

void add(int u, int v, int w)
{
	edge[cnt].to = v;
	edge[cnt].w = w;
	edge[cnt].next = head[u];
	head[u] = cnt++;
}

struct Node {
	int u, w;
	Node (int _u, int _w) :u(_u), w(_w) {}
	friend bool operator<(const Node& a, const Node& b)
	{
		return a.w > b.w;
	}
};

void dijkstra(int s)
{
	priority_queue<Node> q;
	for (int i = 0; i < n; ++i)
		d[i] = INF, vis[i] = false;
	d[s] = 0;
	
	Node t(s, 0);
	q.push(t);
	int u, v, w;
	int count = 0;
	while (!q.empty() && count < n - 1)
	{
		t = q.top();
		q.pop();
		u = t.u;
		if (d[u] < t.w)
			continue;
		vis[u] = true;
		++count;
		for (int i = head[u]; i != NIL; i = edge[i].next)
		{
			v = edge[i].to;
			w = edge[i].w;
			if (!vis[v] && d[v] > d[u] + w)
			{
				d[v] = d[u] + w;
				q.push(Node(v, d[v]));
			}
		}
	}
	if (count == n - 1)
		for (int i = 0; i < n; ++i)
			cout << i << " " << d[i] << endl;

}

int main(void)
{cin.tie(0);
	ios::sync_with_stdio(false);
	int k, s, e, w;
	cin >> n;
	memset(head, NIL, sizeof(-1));
	cnt = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> s >> k;
		while (k--)
		{
			cin >> e >> w;
			add(s, e, w);
		}
	}
	dijkstra(0);

	return 0;
}

Measured memory_bytes: 9068
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <string.h>

using namespace std;
typedef pair<int, int> P;
static const int INF = 2e9;

struct Edge
{
	int to;
	int cost;
};
vector<Edge> G1[5001];
vector<Edge> G2[5001];
int d[5001];
bool isUsed[5001];

void solve()
{
	int N, K;
	cin >> N >> K;
	vector<int> C(N);
	vector<int> R(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> C[i] >> R[i];
	}
	for (int i = 0; i < K; ++i)
	{
		int from, to;
		Edge e1, e2;
		cin >> from >> to;
		--from; --to;
		e1.to = to;
		e1.cost = 1;
		e2.to = from;
		e2.cost = 1;
		G1[from].push_back(e1);
		G1[to].push_back(e2);
	}
	for (int i = 0; i < N; ++i)
	{
		memset(isUsed, 0, sizeof(isUsed));
		queue<P> que;
		que.push(P(i, R[i]));
		isUsed[i] = true;
		while (!que.empty())
		{
			P p = que.front();
			que.pop();
			int v = p.first;
			for (int j = 0; j < G1[v].size(); ++j)
			{
				int to = G1[v][j].to;
				if (!isUsed[to] && p.second >= 1)
				{
					isUsed[to] = true;
					que.push(P(to, p.second - 1));
					Edge e;
					e.to = to;
					e.cost = C[i];
					G2[i].push_back(e);
				}
			}
		}
	}

	for (int i = 0; i < N; ++i)
	{
		d[i] = INF;
	}
	priority_queue<P, vector<P>, greater<P> > pque;
	pque.push(P(0, 0));
	d[0] = 0;
	while (!pque.empty())
	{
		P p = pque.top();
		pque.pop();
		int v = p.first;
		for (int i = 0; i < G2[v].size(); ++i)
		{
			Edge e = G2[v][i];
			if (d[e.to] > p.second + e.cost)
			{
				d[e.to] = p.second + e.cost;
				pque.push(P(e.to, d[e.to]));
			}
		}
	}
	cout << d[N - 1] << endl;
}

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

Measured memory_bytes: 125880