akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 998244353;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,s;
Vi a;
ll dp[3001][3001];

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n>>s;
	a.resize(n);
	rep(i,n){
		cin>>a[i];
	}
	rep(i,3001){
		rep(j,3001){
			dp[i][j]=0;
		}
	}
	rep(i,n){
		dp[i+1][a[i]] += i+1;
		dp[i+1][a[i]] %= Mod;
		rep(j,s+1){
			dp[i+1][j] += dp[i][j];
			dp[i+1][j] %= Mod;
			if(j+a[i]<=s){
				if(j==0)continue;
				dp[i+1][j+a[i]] += dp[i][j];
				dp[i+1][j+a[i]] %= Mod;
			}
		}
	}
	ll ans = 0;
	//ans = dp[n][s];
	rep(i,n){
		ans += dp[i+1][s];
		ans %= Mod;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    string s;
    cin >> s;
    string t = "";
    vi x;
    int a = 0;
    rep(i, s.size()) {
        if (s[i] != 'x') {
            x.emplace_back(a);
            a = 0;
            t += s[i];
        }
        else {
            a++;
        }
    }
    x.emplace_back(a);
    a = 0;

    int lt = t.size();
    rep(i, lt / 2) {
        if (t[i] != t[lt - i - 1]) {
            cout << -1 << endl;
            return 0;
        }
    }

    int ans = 0;
    int lx = x.size();
    rep(i, lx / 2) {
        ans += abs(x[i] - x[lx - i - 1]);
    }

    cout << ans << endl;

}


Measured memory_bytes: 1608
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "YES";
    private static final String NO = "NO";

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

        int N = sc.nextInt();
        int[] A = new int[N+1];
        int[] B = new int[N];
        for (int i=0; i<N+1; i++) {
            A[i] = sc.nextInt();
        }
        for (int i=0; i<N; i++) {
            B[i] = sc.nextInt();
        }

        System.out.println(solve(N, A, B));
    }

    private static long solve(int N, int[] A, int[] B) {
        long count = 0;

        int remain = 0;
        for (int i=0; i<N; i++) {
            int a = A[i];
            int b = remain + B[i];

            count += Math.min(a, b);
            remain = a <= remain ? B[i] : Math.max(b-a, 0);
        }
        count += Math.min(A[N], remain);

        return count;
    }
}

Measured memory_bytes: 64056
#include <iostream>
#include <vector>
#include <string>
using namespace std;

void pop2( vector<int> &stk, int &i, int &j )
{
	i = stk.back();
	stk.pop_back();
	j = stk.back();
	stk.pop_back();

	return;
}

void add( vector<int> &stk )
{
	int i, j;
	pop2( stk, i, j );
	stk.push_back( i + j );
}

void sub( vector<int> &stk )
{
	int i, j;
	pop2( stk, i, j );
	stk.push_back( j - i );
}

void multi( vector<int> &stk )
{
	int i, j;
	pop2( stk, i, j );
	stk.push_back( i * j );
}

void div( vector<int> &stk )
{
	int i, j;
	pop2( stk, i, j );
	stk.push_back( i / j );
}

int main()
{
	vector<int> stk;
	string tkn;

	while( cin >> tkn ) {
		if( tkn == "+" ) {
			add( stk );
			continue;
		}
		if( tkn == "-" ) {
			sub( stk );
			continue;
		}
		if( tkn == "*" ) {
			multi( stk );
			continue;
		}
		if( tkn == "/" ) {
			div( stk );
			continue;
		}

		stk.push_back( stoi( tkn ) );
	}
	
	cout << stk.back() << endl;
	return 0;
}



Measured memory_bytes: 3192
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	string s,ans="";
	cin>>s;
	rep(i,s.size()){
		if(s[i]=='B'){
			if(ans!="")ans = ans.substr( 0, ans.size()-1 );
		}else{
			ans+=s[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <iomanip>
int MOD=1e9+7;
using namespace std;
int main(){
    string n;
    cin >> n;
    int count=0;
    for(int i=0;i<4;i++){
        if(n[i]=='2'){
            count++;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (h, w) = listOfInt()
    var lines = mutableListOf<String>()

    repeat(h) {
        lines.add(next())
    }

    for (i in 0 until h) {
        for (j in 0 until w) {
            if (lines[i][j] == '#') continue

            var cnt = 0

            if (i > 0 && j > 0 && lines[i-1][j-1] == '#') cnt++ // top-left
            if (i > 0 && lines[i-1][j] == '#') cnt++ // top
            if (i > 0 && j < w-1 && lines[i-1][j+1] == '#') cnt++ // top-right
            if (j > 0 && lines[i][j-1] == '#') cnt++ // left
            if (j < w-1 && lines[i][j+1] == '#') cnt++ // right
            if (i < h-1 && j > 0 && lines[i+1][j-1] == '#') cnt++ // bottom-left
            if (i < h-1 && lines[i+1][j] == '#') cnt++ // bottom
            if (i < h-1 && j < w-1 && lines[i+1][j+1] == '#') cnt++ // bottom-right

            lines[i] = lines[i].take(j) + cnt + lines[i].takeLast(w-j-1)
        }
        println(lines[i])
    }
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 38584
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>


using namespace std;

int main()
{
  int x, n, ans;
  while(true)
  {
    ans = 0;
    cin >> n >> x;
    if(!n && !x)
      break;
    for(int i = 1; i <= n; i++)
    {
      for(int j = i; j <= n; j++)
      {
        for(int k = j; k <= n; k++)
        {
          if(i == j || j == k || k == i)
            continue;
          if(i + j + k == x)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> s(N);
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }

    // int ans = 0;
    // int p;
    // for(int bit = 0; bit < (1<<N); bit++){
    //     p = 0;
    //     for(int i = 0; i < N; i++){
    //         if(bit & (1<<i)){
    //             p += s[i];
    //         }
    //     }
    //     if(p % 10 != 0){
    //         ans = max(ans, p);
    //     }
    // }


    sort(s.begin(), s.end());

    int ans = 0;
    for(int i = 0; i < N; i++){
        ans += s[i];
    }

    if(ans % 10 == 0){
        for(int i = 0; i < N; i++){
            if(s[i] % 10 != 0){
                ans -= s[i];
                break;
            }
        }
    }
    
    if(ans % 10 != 0){
        cout << ans << endl;
    }else{
        cout << 0 << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b;
    cin >> a >> b;
    intl ans = 0;
    ans += (a > b ? a-- : b--);
    ans += (a > b ? a-- : b--);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();

        int count = 0;
        int z = 0;
        for(int x = 0; x <= K; x++){
            for(int y = 0; y <= K; y++){
                z = S - x - y;
                if(0 <= z && z <= K) count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23124
n, m = map(int, input().split())
mod = 1e9 + 7
ok = [True] * (n+1)
for i in range(m):
    a = int(input())
    ok[a] = False
dp = [0] * (n+1)
dp[0] = 1
for i in range(n):
    for j in range(i+1, 1 + min(n, i + 2)):
        if ok[j]:
            dp[j] += dp[i]
            dp[j] %= mod
print(int(dp[-1]))

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

int main()
{
  int n;
  cin >> n;
  vector<int64_t> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i + 1;
  }
  sort(begin(a), end(a));

  int64_t ans = 0;
  int64_t m = a[n / 2];
  for (int i = 0; i < n; i++) {
    ans += a[i] > m ? a[i] - m : m - a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1920
from sys import stdin
import math


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C,X,Y= list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = float('inf')
    for c in range(2*X+2*Y+1):
        if X-c/2>=0 or Y-c/2>=0:
            a = max(math.ceil(X-c/2),0)
            b = max(math.ceil(Y-c/2),0)
            cnt = min(cnt,A*a+B*b+C*c)
        else:
            break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


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


int main(){
	int a , b, c ,d , Left , Right;
  	cin >> a >> b >> c >> d ;
  	Left = a + b;
    Right = c + d;
  	if (Left > Right)
      cout << "Left" << endl;
  	else if ( Right > Left)
      cout << "Right" << endl;
  	else
      cout << "Balanced" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

#define pll pair<ll,ll>
#define ff first
#define snd second
#define pb push_back
#define vll vector<ll>
#define vpll vector<pll>
#define endl "\n"
#define MOD 1000000007
using namespace std;

ll const N = 1e5+1;


void solve()
{
   ll n;
   cin>>n;
   vll a(n);
   for(int i=0;i<n;i++)
   cin>>a[i];
   
   sort(a.rbegin(),a.rend());
   
   if(n==1)
   {
           cout<<0<<endl;
           return;
   }
   
   if(n==2)
   {
           cout<<a[0]<<endl;
           return;
   }
   
   ll mx = a[1];
   ll mx_c = 0;
   vll v;
   v.pb(a[1]);
   int idx = 0;
   ll ans = a[0];
   for(int i=2;i<n;i++)
   {
           ans+=mx;
           mx_c++;
           if(mx_c==2)
           {
                mx_c = 0;
                idx++;
                mx = v[idx];          
           }
           v.pb(a[i]);
   }
   cout<<ans<<endl;
}
 
int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
	    int t=1;
	    //cin>>t;
	    while(t--)
	    {
	            solve();
	    }
	    return 0;
}

Measured memory_bytes: 6884
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin>>s;
    if(s=="ani"){
        cout<< "square1001"<<endl;
    }
    else cout<<"e869120"<<endl;
    
}
//大丈夫だ問題ない
//略して　　大　問　題　だ



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

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

    int ans = T.size();
    for (int i = 0; i < S.size() - T.size() + 1; i++)
    {
        int cnt = 0;
        for (int j = 0; j < T.size(); j++)
        {
            if (S[i + j] != T[j]) cnt++;
        }
        ans =min(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <queue>
#include <thread>
#include<bits/extc++.h>
 
using namespace __gnu_pbds;
#pragma GCC optimize("Ofast")
 
#define ll long long
 
#define gc (c = getchar())
#define gi(x) scanf("%d", &x)
#define gid(x, y) scanf("%d%d", &x, &y)
#define gll(x) scanf("%lld", &x)
#define glld(x, y) scanf("%lld%lld", &x, &y)
#define gllt(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define git(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pr(x) return !(printf("%lld\n", (long long)(x)))
#define pcs(ch, cs, x) printf("Case %c%d: %d\n", ch, cs, x)
#define pllcs(ch, cs, x) printf("Case %c%d: %lld\n", ch, cs, x)
#define pcsyn(ch, cs, st) printf("Case %c%d: %s\n", ch, cs, (st) ? "Yes" : "No")
#define pyn(st) printf("%s\n", (st) ? "yes" : "no")
#define pryn(st) return !(printf("%s\n", (st) ? "YES" : "NO"))
#define pll(x) printf("%lld\n", x)
#define plld(x, y) printf("%lld %lld\n", x, y)
 
#define mp(x, y) std::make_pair(x, y)
#define fcs(x) while (x--)
#define dbg(x) std::cerr << #x << " " << x << std::endl
#define fi freopen("in.txt", "r", stdin)
#define fo freopen("out.txt", "w", stdout)
#define siz(x) (int)x.size()
#define pb(x) push_back(x)
 
inline long long max(long long x, long long y) { return x > y ? x : y; }
 
inline long long min(long long x, long long y) { return x > y ? y : x; }
 
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }


const int maxn = 2e5 + 5;
long long seq[maxn];
int main(){
    int n;
    gi(n);
    for (int i = 1; i <= n; ++ i) gll(seq[i]);
    long long ret = 0;
    long long cur = 0;
    for (int i = 1; i <= n; ++ i){
        if (seq[i] < cur) {
            ret += (cur - seq[i]);
            seq[i] = cur;
        }
        cur = seq[i];
    }
    pll(ret);
}

Measured memory_bytes: 5284
n = int(input())
cnt_dict = []
for _ in range(n):
    input_str = input()
    chr_dict = {chr(i):0 for i in range(97,97+26)}
    for s in input_str:
        chr_dict[s] += 1
    cnt_dict.append(chr_dict)

common = {chr(i):100 for i in range(97,97+26)}
for c in cnt_dict:
    for k,v in c.items():
        common[k] = min(common[k],v)

result = ''
for k,v in sorted(common.items()):
    result += k*v
print(result)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(string s,string t)
{
    KAKA
    vector<ll> vec;
    ll len1 = s.length();
    ll len2 = t.length();
    pragi(0,len1 - len2 + 1)
    {
        ll changes = 0;
        pragj(0,len2)
        {
            if(s[i + j] != t[j]) changes++;
        }
        vec.eb(changes);
    }
    ll mn = *min_element(vec.begin(),vec.end());
    cout<<mn<<"\n";
}
int main()
{
    KAKA
    string s,t;
    cin>>s>>t;
    Compute(s,t);
}

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

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    char g[h][w];
    rep(i, h) rep(j, w) cin >> g[i][j];

    int ans = 0;
    rep(bitR, 1 << h) {
        rep(bitC, 1 << w) {
            int a = 0;
            rep(i, h) rep(j, w) {
                if (bitR & (1 << i) && bitC & (1 << j) && g[i][j] == '#') a++;
            }
            if (a == k) ans++;
        }
    }

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


Measured memory_bytes: 3608
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <memory.h>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main(){
	string s;
	cin>>s;
	if(s.length()>=4&&s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') cout<<"Yes\n";
	else cout<<"No\n";
return 0;
}

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

int main(){
  ll X;
  cin >> X;
  ll N = 100;
  int C=0;
  if(N==X){
    cout << 0 << endl;
    return 0;
  }
  while(N<X){
    N += N/100;
    C++;
  }
  cout << C << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

struct edge{ int to,cost; };
typedef pair<int,int> P;

int main(){
	int n,m,d[400] = {};
	vector<edge> G[400];
	cin >> n >> m;
	for(int i = 0;i < m;i++){
		int a,b,c;
		cin >> a >> b >> c;
		G[a].push_back({b,c});
	}
	priority_queue<P> que;
	que.push(P(0,0));
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second;
		if(d[v] > p.first) continue;
		for(int i = 0;i < G[v].size();i++){
			edge e = G[v][i];
			if(d[e.to] < d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
	cout << d[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 3164
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

num = list(map(int, input().split()))
x = num[0]
y = num[1]

if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print("Yes")
else:
    print("No")

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

int main() {
    long double A, B, H, M, tansin, tyousin,angle,ans; //Aは短針Bは長針,H時M分
    //tansin,tyousihはそれぞれの角度
    long double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063;
    cin >> A >> B >> H >> M;
    tansin = 6*M;
    tyousin = 30*H+0.5*M;
    angle = max(tansin,tyousin)-min(tansin,tyousin);
    ans = A*A + B*B - 2 * B * A * cos(PI / 180 * angle);//余弦定理
    ans = sqrt(ans);
    cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 4064
#include <bits/stdc++.h>
#define mod 1000000007
#define fi first
#define se second
#define all(v) ((v).begin()), ((v).end())

using namespace std;
typedef long long ll;

int main () {
#ifndef ONLINE_JUDGE
  //freopen ("in.txt", "r", stdin);
#endif
  vector<int> v(3);
  set<vector<int>>st;
  cin >> v[0] >> v[1] >> v[2];
  int ans = 0;
  while(true) {
    sort(all(v));
    if(st.insert(v).se == false) {
      //cout << v[0] << " " << v[1] << " " << v[2] << endl;
      cout << -1 << endl;
      return 0;
    }
    vector<int> t(3);
    for(int i = 0; i < 3; i++) {
      if(v[i] & 1) {
        cout << ans << endl;
        return 0;
      }
      for(int j = 0; j < 3; j++) {
        if(i == j) {
          continue;
        }
        t[j] += v[i] / 2;
      }
    }
    v = t;
    ans++;
  }
}

Measured memory_bytes: 256
import java.io.*; import java.util.*;
public class Main {
    static ArrayList<Integer> arl[];
    static long[] fac;
    static int[] siz;
    static long[] ans;
    static long[] dp;
    static long MOD=1000000007;
    public static void main(String[] args) throws IOException {
        fac=new long[200001];
        fac[0]=1;
        for (int i = 1; i < 200001; i++) {
            fac[i]=(fac[i-1]*i)%MOD;
        }
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N=Integer.parseInt(br.readLine());
        arl=new ArrayList[N];
        for (int i = 0; i < N; i++) {
            arl[i]=new ArrayList<>();
        }
        int a,b=0;
        for (int i = 0; i < N-1; i++) {
            StringTokenizer st=new StringTokenizer(br.readLine());
            a=Integer.parseInt(st.nextToken())-1;
            b=Integer.parseInt(st.nextToken())-1;
            arl[a].add(b); arl[b].add(a);
        }
        siz=new int[N];
        ans=new long[N];
        dp=new long[N];
        init(-1,0);
        ans[0]=dp[0];
        dfs(-1,0);
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < N; i++) {
            sb.append(ans[i]).append("\n");
        }
        System.out.println(sb.toString());
    }
    public static long inv(long a, long b){//Computes modular inverse of a mod b
        //Assume b>a and gcd(a,b)=1, 
        if(a==1)return 1;
        long q=b/a;
        long r=b-q*a;
        long y=-inv(r,a);
        return ((b*y+1)/a)+b;
        
    }
    public static void init(int p, int v){
        siz[v]=1;
        dp[v]=1;
        for (int u : arl[v]) {
            if(u==p)continue;
            init(v,u);
            siz[v]+=siz[u];
            dp[v]*=dp[u]; dp[v]%=MOD;
            dp[v]*=inv(fac[siz[u]],MOD); dp[v]%=MOD;
        }
        dp[v]*=fac[siz[v]-1]; dp[v]%=MOD;
        
    }
    public static void dfs(int p, int v){
        for (int u: arl[v]) {
            if(u==p)continue;
            dp[v]*=inv(dp[u],MOD); dp[v]%=MOD;
            dp[v]*=inv(fac[siz[v]-1],MOD); dp[v]%=MOD;
            dp[v]*=fac[siz[v]-siz[u]-1]; dp[v]%=MOD;
            dp[v]*=fac[siz[u]]; dp[v]%=MOD;
            siz[v]-=siz[u];
            siz[u]+=siz[v];
            dp[u]*=fac[siz[u]-1]; dp[u]%=MOD;
            dp[u]*=inv(fac[siz[u]-siz[v]-1],MOD); dp[u]%=MOD;
            dp[u]*=dp[v]; dp[u]%=MOD;
            dp[u]*=inv(fac[siz[v]],MOD); dp[u]%=MOD;
            ans[u]=dp[u];
            dfs(v,u);
            //Revert
            
            dp[u]*=inv(fac[siz[u]-1],MOD); dp[u]%=MOD;
            dp[u]*=fac[siz[u]-siz[v]-1]; dp[u]%=MOD;
            dp[u]*=inv(dp[v],MOD); dp[u]%=MOD;
            dp[u]*=fac[siz[v]]; dp[u]%=MOD;
            siz[u]-=siz[v];
            siz[v]+=siz[u];
            dp[v]*=dp[u]; dp[v]%=MOD;
            dp[v]*=fac[siz[v]-1]; dp[v]%=MOD;
            dp[v]*=inv(fac[siz[v]-siz[u]-1],MOD); dp[v]%=MOD;
            dp[v]*=inv(fac[siz[u]],MOD); dp[v]%=MOD;
            
        }
    }
}


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

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

  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  long long n;
  cin >> n;
  vector<int> p;
  for (int i = 0; (1LL << (i + 1)) <= n + 1; i++)
    p.push_back(i);
  long long plen = p.size();
  long long m = n - ((1LL << plen) - 1);
  set<int> used;
  for (int k = plen - 1; k >= 0; k--) {
    if ((m >> k) & 1) {
      p.insert(p.begin() + k, 99 - k);
      used.insert(99 - k);
    }
  }
  vector<int> q;
  cout << p.size() * 2 << endl;
  for (int i = 0; i < p.size(); i++) {
    q.push_back(p[i] + 1);
  }
  for (int i = 0; i < plen; i++)
    q.push_back(i + 1);
  for (auto &i : used)
    q.push_back(i + 1);
  cout << q[0];
  for (int i = 1; i < q.size(); i++)
    cout << " " << q[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
s = gets.chomp.split('').map(&:to_i)
aa = s[0..1].join.to_i
bb = s[2..-1].join.to_i

if aa == 0 && bb > 13
  puts 'NA'
elsif aa > 13 && bb == 0
  puts 'NA'
elsif aa >= 1 && aa <= 12 && bb >= 1 && bb <= 12
  puts 'AMBIGUOUS'
elsif aa >= 0 && aa <= 99 && bb >= 1 && bb <= 31
  puts 'YYMM'
elsif aa >= 1 && aa <= 31 && bb >= 0 && bb <= 99
  puts 'MMYY'
else
  puts 'NA'
end

Measured memory_bytes: 1788
using System.Collections.Generic;
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, a);
    }
    static void getAns(int n, int[] a)
    {
        var s = new Stack<int>();
        var cat = new bool[101];
        for (int i = 0; i < n; i++)
        {
            if (a[i] > 0)
            {
                if (!cat[a[i]]) { s.Push(a[i]); cat[a[i]] = true; }
                else { Console.WriteLine(i + 1); return; }
            }
            else
            {
                if (!cat[-a[i]]) { Console.WriteLine(i + 1); return; }
                else
                {
                    var w = s.Peek();
                    if (w == -a[i]) { s.Pop(); cat[w] = false; }
                    else { Console.WriteLine(i + 1); return; }
                }
            }
        }
        Console.WriteLine("OK");
    }
}



Measured memory_bytes: 18276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;

int main(){
  int x;
  cin >> x;
  bool f = false;
  if(x == 1){
    cout << 1 << endl;
  }
  else{
    int ans = 1;
    for(int i = 2; i <= pow(x, 0.5); i++){
      for(int j = 2; j < 10; j++){
        if(pow(i, j) <= x){
          if(pow(i, j) > ans){ans = pow(i, j);} 
        }
        else{break;}
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
<?php

class Scanner
{
  private $arr = [];
  private $count = 0;
  private $pointer = 0;

  public function next()
  {
    if ($this->pointer >= $this->count) {
      $str = trim(fgets(STDIN));
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    ++$this->pointer;

    return $result;
  }

  public function hasNext()
  {
    return $this->pointer < $this->count;
  }

  public function nextInt()
  {
    return (int) $this->next();
  }

  public function nextDouble()
  {
    return (float) $this->next();
  }
}

$sc = new Scanner();
$s = $sc->next();
$array = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$answer = 'None';

foreach($array as $key=>$value){
  if(!strpos("1" . $s, $value) > 0){
    $answer = $value;
    break;
  }
}

echo $answer . PHP_EOL;


Measured memory_bytes: 16396
#include<bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int,int>P;

#define INF INT_MAX;
#define F first
#define S second

int main(){
  int n;
  int a[100005];
  int ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=1;i<n;i++){
    if(a[i]>a[i-1]) ans++;
  }

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



Measured memory_bytes: 3604
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;
struct Node{
	int parent;
	int left;
	int right;
};
Node tree[25];
int maxDepth;

int findSibling(int i){
	Node parent;
	if(tree[i].parent == -1){
		return -1;
	}else{
		parent = tree[tree[i].parent];
	}
	if(parent.left==i){
		return parent.right; 
	}else{
		return parent.left;
	}
}

int calcurateDepth(int i){
	int count = 0;
	Node node = tree[i];
	while(1){
		if(node.parent== -1){
			break;
		}
		node = tree[node.parent];
		count++;
	}
	return count;
}
void calcurateMaxDepth(int n){
	int depth = 0;
	for(int i = 0; i < n ; i++){
		depth=max(calcurateDepth(i),depth);	
	}
	maxDepth = depth;
}

int calcurateDegree(int i){
	int count =0;
	if(tree[i].left != -1){
		count++;
	}
	if(tree[i].right != -1){
		count++;
	}
	return count;
}


int calcurateHeight(int i){
	int h1=0,h2=0;
	if(tree[i].left!=-1){
		h1 = calcurateHeight(tree[i].left)+1;
	}
	if(tree[i].right!=-1){
		h2 = calcurateHeight(tree[i].right)+1;
	}

	return max(h1,h2);
}

string confirmType(int i){
	if(tree[i].parent == -1){
		return "root";
	}else if(tree[i].left == -1 && tree[i].right == -1){
		return "leaf";
	}else{
		return "internal node";
	}
}
void printTree(int n){
	for(int i = 0; i < n ; i++){
		printf("node %d: ",i);
		printf("parent = %d, ",tree[i].parent);	
		printf("sibling = %d, ",findSibling(i));
		printf("degree = %d, ",calcurateDegree(i));
		printf("depth = %d, ",calcurateDepth(i));
		printf("height = %d, ",calcurateHeight(i));
		printf("%s\n",confirmType(i).c_str());
	}
}
int main(){
	int n,it,left,right;
	scanf("%d",&n);;
	for(int i = 0; i < n ; i++){
		Node node;
		node.left = node.right = node.parent = -1;
		tree[i] = node;
	}
	for(int i = 0; i < n ; i++){
		scanf("%d %d %d",&it,&left,&right);	
		tree[it].left = left;
		tree[it].right = right;
		if(left != -1){
			tree[left].parent = it;
		}
		if(right != -1){
			tree[right].parent = it;
		}
	}
	calcurateMaxDepth(n);

	printTree(n);
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
  ll n,k;
  cin >>n>>k;
  ll x[n],ans=1e10;
  for(ll i=0;i<n;i++) cin>> x[i];
  for(ll i=0;i<n-k+1;i++) {
    ans=min(ans,abs(x[i+k-1]-x[i])+min(abs(x[i]),abs(x[i+k-1])));
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 1024
//HOJ-918
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int h,w,n,ans;
  cin>>h>>w>>n;
  ans=n/max(h,w);
  if(n%max(h,w) != 0)
    ans++;
  
  cout<<ans<<endl;
   return(0);
}
        

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if((x+r>W)||(y+r>H)||(x-r<0)||(y-r<0)){
printf("No\n");}else{
printf("Yes\n");}
return 0;
}


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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,k,x;
	ll ans=0;
	cin >> n >> k;
	for0(i,n){
		cin >> x ;
		if(x >= k) { 
			ans++;
		}
	}
	cout << ans << endl;

	
	return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    char a;
    cin >> a;
    if(a>='A' && a<='Z'){
        cout << "A" << endl;
    }else{
        cout << "a" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int n,x,y,z;
	scanf("%d",&n);
	z=n;
	x=0;
	while(1){
		if(n<=0){
			break;
		}
		x+=n%10;
		n=n/10;
	}
	if(z%x==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


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

int ask(int c){
  cout << c << endl; fflush(stdout);
  string d; cin >> d;
  if( d[0] == 'V'){ exit(0);}
  
  return d[0] == 'M';
} //男が帰ってきたら１を、女が帰ってきたら0を返す
 
  
int main(){ 
  int N; cin >> N;
  int lb = 0; int lbt = ask(0);
  int ub = N-1; int ubt = ask(N-1);
  
  while(true){
    int mid = (lb+ub)/2;
    int midt = ask(mid);
    
    if( abs(mid-lb)%2 != abs(lbt-midt)%2){
      ub = mid;
      ubt = midt;
    }
    else{
      lb = mid;
      lbt = midt;
    }
  }
  
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define NL endl
#define pi 2.0*acos(0.0)
#define INTM 1e18
#define mod 1e9+7
#define FOR(i,j,n)    for(ull i=j;i<n;i++)
#define RFOR(i,j,n)    for(ull i=j;i>=n;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

int main(){
    fastIO;
    ll n;
    cin>>n;
    ll arr[n];
    map<ll,ll>imap;
    FOR(i,0,n) cin>>arr[i], imap[arr[i]]++;
    ll flag = 0;
    for(auto itr = imap.begin(); itr != imap.end(); itr++){
        if(itr->second >= 2){
            flag = 1;
            break;
        }
    }
    if(flag) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


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

const int maxN = 2005;

int n;
int a[maxN + 1], deg[maxN + 1];
bool flag[maxN + 1];

vector<int> to[maxN + 1], nxt[maxN + 1];

priority_queue<int> q;

inline void dfs(int u)
{
	flag[u] = true;
	for(int i = 0; i < to[u].size(); i++)
	{
		int v = to[u][i];
		if(flag[v]) continue;
		nxt[u].push_back(v); deg[v] ++;
		dfs(v);
	}
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			if(i != j && __gcd(a[i], a[j]) != 1) to[i].push_back(j);

	for(int i = 1; i <= n; i++)
		if(!flag[i]) dfs(i);
	
	for(int i = 1; i <= n; i++)
		if(!deg[i]) q.push(i);
	while(!q.empty())
	{
		int x = q.top(); q.pop();
		printf("%d ", a[x]);
		for(int i = 0; i < nxt[x].size(); i++)
			if(-- deg[ nxt[x][i] ] == 0) q.push(nxt[x][i]);
	}
	puts("");
	return 0;
}


Measured memory_bytes: 19468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e9;
typedef pair<int, int> pi;
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int>v(n);
    for (int& i : v)cin >> i;
    ll ans = 0;
    sort(v.begin(), v.end());
    for (int i = 0; i < k; i++)ans += v[i];
    cout << ans;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
typedef pair<int, int> P;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    int n, a, b; cin >> n >> a >> b;
    int ans1 = min(a, b);
    int ans2 = 0;
    if(a + b >= n){
        ans2 = a + b -n;
    }

    cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;
int main(){
    int a,  b;
    cin >> a >> b;
    if(a == 2 || b == 2){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }

}

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


int main() {

    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    int c = 0;
    int ans = 0;
    for (int j = 0; j < 30; ++j) {
        ++c;
        bool odd = false;
        rep(i,n) {
            if (a[i] % 2 == 1) odd = true;
        }
        if (odd) break;
        ++ans;
        rep(i,n) a[i] /= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,h=map(int,input().split())
ab=[]
ans=0
for i in range(n):
  aa,bb=map(int,input().split())
  ab.append([aa,bb])

ab.sort(key=lambda x: x[0],reverse=True)
katana=ab[0][0]
ab.sort(key=lambda x: x[1],reverse=True)
cnt=0

for a,b in ab:
  if b>katana:
    cnt+=1

for i in range(cnt):
  if h<=0:break
  h-=ab[i][1]
  ans+=1
if h>0:
  ans+=(h+katana-1)//katana
print(ans)


Measured memory_bytes: 21192
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

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

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    char ans1 = s1[0] - 0x20;
    char ans2 = s2[0] - 0x20;
    char ans3 = s3[0] - 0x20;
    cout << ans1 << ans2 << ans3 << endl;
}

Measured memory_bytes: 256
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    cnt = 0
    for a, b in zip(A, B):
        if a < b:
            cnt += (b - a) // 2
        else:
            cnt -= a - b

    if cnt < 0:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 41196
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
struct edge {
  int to;
  ll cost;
  edge(int to, ll cost) : to(to), cost(cost) {}
};
#define MAX_N 200005
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll modinv(ll a, ll m=mod) {
  ll b = m, u = 1, v = 0;
  while(b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if(u < 0) u += m;
  return u;
}
vector<vector<edge> > G;
vector<ll> D;
vector<int> size;
int dfsSize(int tmp, int par) {
  size[tmp] = 1;
  for(auto ne: G[tmp])
    if(ne.to != par)
      size[tmp] += dfsSize(ne.to, tmp);
  return size[tmp];
}
ll dfs(int tmp, int par) {
  ll dp = 1;
  for(auto ne: G[tmp])
    if(ne.to != par)
      (((dp *= dfs(ne.to, tmp)) %= mod) *= finv[size[ne.to]]) %= mod;
  D[tmp] = dp * fac[size[tmp]-1] % mod;
  return D[tmp];
}
vector<ll> ans;
int N;
void dfs2(int tmp, int par, ll d_par) {
  ll dp = 1;
  for(auto ne: G[tmp]) {
    if(ne.to != par)
      (((dp *= D[ne.to]) %= mod) *= finv[size[ne.to]]) %= mod;
    else {
      (((dp *= d_par) %= mod) *= finv[N-size[tmp]]) %= mod;
    }
  }
  ans[tmp] = dp * fac[N-1] % mod;
  for(auto ne: G[tmp])
    if(ne.to != par) {
      ll next_d_par = ((dp * fac[size[ne.to]] % mod) * modinv(D[ne.to]) % mod) * fac[N-size[ne.to]-1] % mod;
      dfs2(ne.to, tmp, next_d_par);
    }
}
int main() {
  make();
  cin >> N;
  G = vector<vector<edge> >(N);
  D = vector<ll>(N);
  size = vector<int>(N);
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(edge(b, 1));
    G[b].push_back(edge(a, 1));
  }
  dfsSize(0, -1);
  dfs(0, -1);
  ans = vector<ll>(N);
  dfs2(0, -1, 0);
  rep(i, N) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 26240
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define For(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

int read(){
    char c=getchar(); int flag=1, x=0;
    while(!isdigit(c)){ if(c=='-') flag=-1; c=getchar(); }
    while( isdigit(c)){ x=x*10+(c-'0'); c=getchar(); }
    return flag*x;
}

signed main(){

    int n=read();
    
    cout<<pow(n,3)<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
char c[5][9];
string d[10] = {
  "* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
  " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** ",
};
int main()
{
  int n,i,j;
  bool f = false;
  while(cin >> n){
    if(f) cout << endl;
    for(i=0; i<5; i++){
      memcpy(c[i], d[n%10].c_str(), 8);
      n /= 10;
    }
    for(i=0; i<8; i++){
      for(j=4; j>=0; j--){
	cout << c[j][i];
      }
      cout << endl;
    }
    f = true;
  }
  return 0;
}

Measured memory_bytes: 904
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (a > x) {
    cout << "NO" << endl;
  } else if (a + b >= x) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] B = new int[N];
		for(int i = 0; i < N-1; i++) {
			B[i] = sc.nextInt();
		}
		List<Integer> A = new ArrayList<Integer>(Arrays.asList(100000));
		for(int j = 0; j < N-1; j++) {
			if(A.get(j) > B[j]) {
				A.set(j, B[j]);
			}
			A.add(j+1, B[j]);
		}
		int answer = 0;
		for(Integer k : A) {
			answer += k;
		}
		
		System.out.println(answer);
	}
}

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

int main(){
    int n;
    cin >> n;
    int h[n+1];
    h[0] = 0;
    for(int i=1; i<n+1; i++){
        cin >> h[i];
    }
    for(int i=1; i<n; i++){
        if(h[i]-1 > h[i+1]){
            cout << "No" << endl;
            return 0;
        }
        int t = h[i] - h[i-1];
        if(t==0 && h[i] > h[i+1]){
            cout << "No" << endl;
            return 0;
        }
        if(t != 0) h[i]--;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner scn = new Scanner(System.in);
      double x=scn.nextDouble();
      double a=-150,b=0;
      
      OUT:while(true){
        for(b=150;b>=-150;b--){
            if(Math.pow(a,5)-Math.pow(b,5)==x) {
                break OUT;
            }
        }
        a++;
      }
      OUT:
      System.out.println((int)a+" "+(int)b);
    }
}


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

typedef long long ll;

int main(){
  ll N, C;
  cin >> N >> C;
  vector<pair<ll, ll>> xv(N);
  for (ll i=0; i<N; i++){
    cin >> xv[i].first >> xv[i].second;
  }
  vector<ll> right(N,0), left(N,0), rev_right(N,0), rev_left(N);
  for (int i=0; i<N; i++){
    if (i>0) {
      right[i] += right[i-1];
      rev_right[i] += rev_right[i-1];
      right[i] += xv[i].second - (xv[i].first - xv[i-1].first);
      rev_right[i] += xv[i].second - (xv[i].first - xv[i-1].first)*2;
    } else {
      right[i] += xv[i].second - xv[i].first;
      rev_right[i] += xv[i].second - xv[i].first*2;
    }
  }
  for (int i=N-1; i>-1; i--){
    if (i<N-1){
      left[i] += left[i+1];
      left[i] += xv[i].second - (xv[i+1].first - xv[i].first);
      rev_left[i] += rev_left[i+1];
      rev_left[i] += xv[i].second - (xv[i+1].first - xv[i].first)*2;
    } else {
      left[i] += xv[i].second - (C-xv[i].first);
      rev_left[i] += xv[i].second - (C-xv[i].first)*2;
    }
  }
  vector<ll> best_right(N), best_left(N), rev_best_right(N), rev_best_left(N);
  best_right[0] = right[0];
  best_left[N-1] = left[N-1];
  rev_best_right[0] = rev_right[0];
  rev_best_left[N-1] = rev_left[N-1];
  for (int i=1; i<N; i++){
    best_right[i] = max(right[i], best_right[i-1]);
    rev_best_right[i] = max(rev_right[i], rev_best_right[i-1]);
  }
  for (int i=N-2; i>-1; i--){
    best_left[i] = max(left[i], best_left[i+1]);
    rev_best_left[i] = max(rev_left[i], rev_best_left[i+1]);
  }
  ll ans = 0;
  ans = max(ans, best_right[N-1]);
  ans = max(ans, best_left[0]);
  for (int i=0; i<N-1; i++){
    // cout << rev_best_right[i]+best_left[i+1] << endl;
    ans = max(ans, rev_best_right[i]+best_left[i+1]);
  }
  for (int i=N-1; i>0; i--){
    // cout << rev_best_left[i]+best_right[i-1] << endl;
    ans = max(ans, rev_best_left[i]+best_right[i-1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 8064