akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

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

int solve(string d1, string d2) {
  int m = d1.size(), n = d2.size();
  vvi c(m + 1, vi(n + 1));
  d1 = " " + d1;
  d2 = " " + d2;
  
  int l = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (d1[i] == d2[j]) c[i][j] = c[i - 1][j - 1] + 1;
      else c[i][j] = max(c[i - 1][j], c[i][j - 1]);

      l = max(l, c[i][j]);
    }
  }

  return l;
}

int main() {
  int q;
  cin >> q;
  
  rep(i, q) {
    string d1, d2;
    cin >> d1 >> d2;
    cout << solve(d1, d2) << endl;
  }
}



Measured memory_bytes: 6784
import java.util.Scanner

object Main{
  val sc = new Scanner(System.in)
  def main(args :Array[String]):Unit ={
    val s = sc.nextInt

    val result = s match{
      case 1 => 4
      case 2 => 4
      case 4 => 4
      case n => loop((s, 1))._2 + 1
    }

    println(result)
  }

  def loop(tuple : (Int, Int) ):(Int, Int) = {
    tuple._1 match {
      case  1 => tuple
      case _  => loop(op(tuple._1) , tuple._2 + 1)
    }
  }
  def op(n: Int): Int = if(n % 2 == 0 ) n / 2 else 3 * n + 1

}

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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }


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

    if(n<1200) cout << "ABC" << endl;
    else if(n<2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;

    return 0;
}


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

long long H, W;
long long UP[2005][2005];
long long LEFT[2005][2005];
long long RIGHT[2005][2005];
long long DOWN[2005][2005];
string S[2005];

int main(){
	cin >> H >> W;
	for(long long i = 0; i < H; i++){
		cin >> S[i];
	}

	for(long long i = 0; i < H; i++){
		long long cur = 0;
		for(long long j = 0; j < W; j++){
			if(S[i][j] == '.'){
				LEFT[i][j] = cur;
				cur++;
			}else{
				cur = 0;
			}
		}

		cur = 0;
		for(long long j = W-1; j >= 0; j--){
			if(S[i][j] == '.'){
				RIGHT[i][j] = cur;
				cur++;
			}else{
				cur = 0;
			}
		}
	}

	for(long long j = 0; j < W; j++){
		long long cur = 0;
		for(long long i = 0; i < H; i++){
			if(S[i][j] == '.'){
				UP[i][j] = cur;
				cur++;
			}else{
				cur = 0;
			}
		}

		cur = 0;
		for(long long i = H-1; i >= 0; i--){
			if(S[i][j] == '.'){
				DOWN[i][j] = cur;
				cur++;
			}else{
				cur = 0;
			}
		}
	}

	
	long long ans = 0;
	for(long long i = 0; i < H; i++){
		for(long long j = 0; j < W; j++){
			if(S[i][j] == '.'){
				ans = max(ans, LEFT[i][j] + RIGHT[i][j] + UP[i][j] + DOWN[i][j] + 1);
			}
		}
	}
	cout << ans << endl;
}

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

typedef pair<int, int> II;
typedef vector< II > VII;
typedef vector<int> VI;

#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ll long long
#define fr(i,n) for(i=0;i<n;i++)

ll c[1010],s[1010],f[1010];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t,n,i,j;
    cin>>n;
    for(i=1;i<n;i++)
        cin>>c[i]>>s[i]>>f[i];
    for(i=1;i<=n;i++)
    {
        t=0;
        for(j=i;j<n;j++)
        {
            if(t<s[j])
                t=s[j]+c[j];
            else
            {
                if(t%f[j]==0)
                    t+=c[j];
                else
                {
                    t/=f[j];
                    t*=f[j];
                    t+=c[j]+f[j];
                }
            }
        }
        cout<<t<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N,Q = (int(i) for i in input().split())
X = []
for i in range(N-1):
    Y = [int(n) for n in input().split()]
    X.append(Y)
X = sorted(X, key=lambda x:x[1])
Z = []
for i in range(N):
    Z.append(0)
    
for i in range(Q):
    Z_1,Z_2 = (int(i) for i in input().split())
    Z[Z_1-1] = Z[Z_1-1] + Z_2

#print(X)
#print(Z)


ans=[Z[0]]

for i in range(1,N):
    ans.append(Z[i])
    ans[i] += ans[X[i-1][0]-1]
    
#print(ans)
print(' '.join(map(str, ans)))

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

int s;

int main() {
    cin >> s;

    set<int> as;
    int ans = 1;

    int a = s;
    while(true){
        if(as.count(a) == 0){
            as.insert(a);
            if(a % 2 == 0){
                a = a / 2;
            }else{
                a = 3 * a + 1;
            }
        }else{
            break;
        }
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
# count=int(input())
# nums=[int(i) for i in input().split()]
str = input()
ans = ""
for i in range(0,3,1):
    if str[i]=="1":
        ans+="9"
    elif str[i]=="9":
        ans+="1"
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    map<ll, ll> A;
    ll tmp;
    rep(i, N){
        cin >> tmp;
        A[tmp]++;
    }
    ll ans = 0;
    for(auto p: A){
        ll a, b;
        tie(a, b) = p;
        if (a <= b)
            ans += b - a;
        else
            ans += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6272
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
  print(a*x+b*y)
else:
  total=2*c*min(x,y)
  if x<=y:
    if b<=2*c:
      print(total+b*(y-x))
    else:
      print(total+2*c*(y-x))
  else:
    if a<=2*c:
      print(total+a*(x-y))
    else:
      print(total+2*c*(x-y))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)



int main(){
    int n; cin >> n;
    string res = "No";
    rep(i,7){
        if((n - 4*i) >=0 && (n - 4*i) % 7 == 0){
            res = "Yes";
            break;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;

    vector<vector<int>> A(N, vector<int>(N)), day(N, vector<int>(N));
    vector<int> index(N);

    rep(i, N) {
        rep(j, N - 1) {
            cin >> A[i][j];
        }
    }

    int maxloop = (N * (N - 1)) / 2;
    int before = 0;
    for (int l = 0; l < maxloop; l++) {
        for (int i = 0; i < N; i++) {
            if (index[i] < N - 1) {
                int to = A[i][index[i]]; 
                if (i + 1 == A[to - 1][index[to - 1]]) {
                    int value = max(day[i][index[i]], day[to - 1][index[to - 1]]);
                    // cout << i + 1 << " " << to << " " << value + 1 << endl;
                    day[i][index[i] + 1] = value + 1;
                    day[to - 1][index[to - 1] + 1] = value + 1;
                    index[i]++; index[to - 1]++;
                }
            }   
        }
        int res = 0;
        for (int i = 0; i < N; i++) {
            res += index[i];
        }
        if (res == before || res == (N - 1) * N) break;
        before = res;
    }

    int sum = 0;
    rep(i, N) sum += index[i];

    int cnt = 0;
    rep(i, N) {
        chmax(cnt, day[i][N - 1]);
    }

    if (sum == (N - 1) * N) {
        cout << cnt << endl;
    }
    else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 11528
package main

import (
	"fmt"
	"sort"
)

func main(){
	var n,max,ans_num int
	fmt.Scan(&n)
	s := make([]string,n)
	for i := 0 ; i < n ; i++ {
		fmt.Scan(&s[i])
	}
	sort.Strings(s)
	//fmt.Println(s)
	ans := make([]string,n)
	c := 1
	for i := 0 ; i < n ; i++ {
		//fmt.Println(s[i],c,ans_num,ans)
		if i != n-1 && s[i] == s[i+1]{
			c++
		} else {
			c = 1
		}
		if c > max {
			ans_num = 0
			ans[ans_num] = s[i]
			max = c
		} else if c == max {
			ans_num++
			ans[ans_num] = s[i]
		}
	}
	//fmt.Println(max,ans_num)
	//fmt.Println("====================")
	for i := 0 ; i <= ans_num ; i++ {
		fmt.Println(ans[i])
	}
}


Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
int main(){
    ll n, l;
    cin >> n >> l;
    vector<ll> a(n), uni(n-1);
    ll las = -1;
    rep(i,n){
        cin >> a[i];
        if(i > 0){
            uni[i-1] = a[i] + a[i-1];
            if(uni[i-1] >= l)las = i-1;
        }
    }
    
    if(las == -1){
        cout << "Impossible" << endl;
        return 0;
    }

    cout << "Possible" << endl;
    rep(i,las)cout << i+1 << endl;
    for(int i = n-2; i >= las; i--)cout << i+1 << endl;
    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1e9+7LL;

int main() {
    ll H, W, M; cin >> H >> W >> M;
    vector<ll> hcnt(H);
    vector<ll> wcnt(W);
    vector<ll> hselect(0);
    vector<ll> wselect(0);
    set<P> s;
    
    rep(i, M){
        ll h, w; cin >> h >> w;
        hcnt.at(h-1)++;
        wcnt.at(w-1)++;
        P p = make_pair(h-1, w-1);
        s.insert(p);
    }
    ll maxh = 0;
    ll maxw = 0;
    rep(i, H){
        if(maxh<hcnt.at(i)) maxh = hcnt.at(i);
    }
    rep(i, W){
        if(maxw<wcnt.at(i)) maxw = wcnt.at(i);
    }
    rep(i, H){
        if(maxh==hcnt.at(i)) hselect.push_back(i);
    }
    rep(i, W){
        if(maxw==wcnt.at(i)) wselect.push_back(i);
    }
    if(maxh == W || maxw == H){
        cout << maxh + maxw - 1 << endl;
        return 0;
    }
    
    bool flag = false;
    rep(i, hselect.size()){
        rep(j, wselect.size()){
            P p = make_pair(hselect.at(i), wselect.at(j));
            if(!s.count(p)){
                flag = true;
                break;
            }
        }
        if(flag) break;
    }
    if(flag) cout << maxh + maxw << endl;
    else cout << maxh + maxw - 1 << endl;
}

Measured memory_bytes: 35064
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back


int main(){
    int N, K;
    cin >> N >> K;
    vector<i64> H(N);
    rep(i, N) cin >> H[i];
    sort(all(H));
    
    i64 ans = 0;
    rep(i, N-K) ans += H[i];

    cout << ans << endl;
    
}

Measured memory_bytes: 1792
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    string s;
    cin >> s, sort(ALL(s));
    cout << (s == "abc" ? "Yes" : "No") << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const double pi=3.1415926536;
#define fo(i,n) for( ll int i=0;i<n;++i)
#define fos(j,i,n) for(ll int j=i;j<n;++j)
#define nax 100004
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define abs(x) ((x)<0?(-(x)):(x))
#define dis(k) cout << k << endl
#define forr(i,n) for( ll int i= n-1;i>=0;--i)
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ve vector
#define fi first
#define se second
#define setzero(a) memset(a,0,sizeof(a))
#define setinf(a) memset(a,0x7F,sizeof(a))
typedef ve< ll > vi;
typedef ve< vi > vvi;
typedef pair< ll ,ll > ii;


//weird debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
		sim > struct rge { c b, e; };
		sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
		sim > auto dud(c* x) -> decltype(cerr << *x, 0);
		sim > char dud(...);
		struct debug {
#ifdef LOCAL
			~debug() { cerr << endl; }
			eni(!=) cerr << boolalpha << i; ris; }
		eni(==) ris << range(begin(i), end(i)); }
		sim, class b dor(pair < b, c > d) {
			ris << "(" << d.first << ", " << d.second << ")";
		}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


/*Don't just sit and hope that God will solve this
  fucking do something, try to observe or solve it a different way.
  Use that pen and paper.
  If nothing works take a deep breath and start again.*/

void solve(){
	ll n,m;
	cin >> n >> m;
	string s[n];
	fo(i,n) cin >> s[i];
	vvi dp(n,vi(m,0));
	if(s[0][0]=='.') dp[0][0]++;
	fo(i,n)
		fo(j,m){
			if(s[i][j]=='.'){
				if(!i && !j) continue;
				else if(!i){
					if(s[i][j-1]=='.') {
						dp[i][j]+=dp[i][j-1];
						dp[i][j]%=mod;
					}
				}
				else if(!j){
					if(s[i-1][j]=='.'){
						dp[i][j]+=dp[i-1][j];
						dp[i][j]%=mod;
					}
				}
				else{
					if(s[i][j-1]=='.') {
						dp[i][j]+=dp[i][j-1];
						dp[i][j]%=mod;
					}
					if(s[i-1][j]=='.'){
						dp[i][j]+=dp[i-1][j];
						dp[i][j]%=mod;
					}
				}
			}
		}
	dis(dp[n-1][m-1]);

}

int main(){
	fast;
	int t=1;
	int tt=1;
	//cin >> t;

	while(t--){
		//cout << "Case #" << tt << ": " ;
		tt++;
		solve();
	}
	return 0;
}



Measured memory_bytes: 12180
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    init_comb();

    int h, w, a, b;
    std::cin >> h >> w >> a >> b;

    long long ans = 0;

    for (int i = b; i < w; i++) {
        ans += comb(i + (h - a - 1), i) * comb((w - 1 - i) + (a - 1), (a - 1)) % mod;
        ans %= mod;
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 12160
N,M=map(int,input().split())
A=[int(i) for i in input().split()]
S=[0 for i in range(N)]
S[0]=A[0]%M
for i in range(1,N):
    S[i]=(S[i-1]+A[i])%M
D=dict()
D[0]=0
for i in range(N):
    if S[i] in D:
        D[S[i]]+=1
    else:
        D[S[i]]=1
ans=0
for num in D:
    tmp=D[num]
    ans+=(tmp*(tmp-1))//2
ans+=D[0]
print(ans)


Measured memory_bytes: 16212
#include<iostream>
#include<iomanip>


using namespace std;
int main(){
    
    long double N, K; cin >> N >> K;
    int score = 0;
    long double pb, res=0, coin=0.5;
    int count =0;
    for(int i=1; i<=N; i++){
        count=0;
        pb=1/N;
        score=i;
        while(score<K){
            score*=2;
            pb*=coin;
        }
        res += pb;
    }
    cout << setprecision(10) << res << endl;
    
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    A, B, C, D, E, F = map(int, input().split())

    water = set()
    for a in range(F // (A * 100) + 1):
        for b in range(F // (B * 100) + 1):
            if 0 < a * 100 * A + b * 100 * B <= F:
                water.add(a * 100 * A + b * 100 * B)

    kouho = []
    for w in water:
        ma = (E * w) // 100
        for c in range(ma // C + 1):
            for d in range(ma // D + 1):
                sugar = c * C + d * D
                if 0 < sugar <= ma and w + sugar <= F:
                    kouho.append([w, sugar])

    if len(kouho) == 0:
        print(list(water)[0], 0)
        exit()

    max_noudo = 0
    res = []
    for w, sugar in kouho:
        noudo = sugar / (w + sugar)
        if max_noudo < noudo:
            max_noudo = noudo
            res = [w + sugar, sugar]
    print(*res)


if __name__ == '__main__':
    resolve()


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

using namespace std;
typedef long long ll;
//ll t , n,c,x , y , a, b,c , d ,sum;
string s;
char ch;
int main()
{

    cin >> ch;
    if(ch<='Z'&&ch>='A')
    {
        cout << 'A';
    }
    else cout <<'a';
    return 0;
}


Measured memory_bytes: 3632
import numpy as np
N = int(input())
W_list = [int(i) for i in input().split(" ")]
ans = np.abs(W_list[0] - np.sum(W_list[1:N]))
for j in range(2, N):
    difference = np.abs(np.sum(W_list[:j]) - np.sum(W_list[j:N]))
    if difference < ans:
        ans = difference
    else:
        break

print(ans)


Measured memory_bytes: 12508
#include<iostream>
#include<vector>
#include <queue>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int, int> > ab;
  REP(i,n){
    int a,b;
    cin >> a >> b;
    ab.push_back(make_pair(a,b));
  }

  sort(ab.begin(), ab.end());
  priority_queue<int>  q;

  int j=0;
  ll ans=0;
  for(int i = 1; i <= m; i++){
    while(true){
      if(j < ab.size() && ab[j].first <= i){
        q.push(ab[j].second);
        j++;
      }else{
        break;
      }
    }
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1908
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int P,Q,R;
  cin >> P>>Q>>R;
  int a = min(P+R,min(P+Q,Q+R));
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using ll = long long;
using P  = pair<int, int>;
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    string s;
    cin >> s;
    if(s == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3632
import bisect

N = int(input())
D = sorted(list(map(int, input().split())))

if N % 2 == 1:
    print(0)
else:
    half = N // 2
    cnt = 0
    for k in range(0, 100005):
        if bisect.bisect_left(D, k) == half:
            cnt += 1
    print(cnt)


Measured memory_bytes: 53036
N, X = map(int, input().split())
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)


def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])


print(f(N, X))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#define ll long long 
using namespace std;

int main(void) {
    string s;
    cin >> s;
    ll size = s.length();

    ll n_0=0, n_1=0;

    for (ll i=0; i<size; i++) {
        if (s[i] == '0') n_0 ++;
        else n_1 ++;
    }

    printf("%d\n", min(n_0, n_1)*2);

        
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
 
int main(){
    int n, a, i;
    int min = 1000000;
    int max = -1000000;
    long long goukeiti = 0;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> a;
        if (a < min) min = a;
        if (a > max) max = a;
        goukeiti = goukeiti + a;
    }
    cout << min << " " << max << " " << goukeiti << endl;
 
    return 0;
}

Measured memory_bytes: 1168
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vvvi= vector<vvi>;
using vs= vector<string>;

#define endl "\n"

/* At most three _per row_
 */
void solve() {
    cini(r);
    cini(c);
    cini(k);

    vvi v(r+1, vi(c+1, 0));
    for(int i=0; i<k; i++) {
        cini(rr);
        cini(cc);
        cin>>v[rr][cc];
    }

    vvvi dp(4, vvi(r+1, vi(c+1)));

    for(int i=1; i<=r; i++) {
        for(int j=1; j<=c; j++) {
            for(int k=0; k<4; k++)
                dp[0][i][j]=max(dp[0][i][j], dp[k][i-1][j]);

            dp[1][i][j]=dp[0][i][j]+v[i][j];

            for(k=1; k<4; k++) {
                dp[k][i][j]=max(dp[k][i][j], dp[k][i][j-1]);
                dp[k][i][j]=max(dp[k][i][j], dp[k-1][i][j-1]+v[i][j]);
            }
        }
    }

    int ans=0;
    for(int k=0; k<4; k++) 
        ans=max(ans, dp[k][r][c]);
    cout<<ans<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

int m1, a, m2;
int main(){
    scanf("%d %d %d",&m1, &a, &m2);
    if(m2>m1)printf("1");
    else printf("0");
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <iomanip>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
long long dp[5500][6000] = {};
long long inv(long long vary){
	long long geko = MAX_MOD-2;
	long long ans = 1;
	while(geko != 0){
		if(geko % 2 == 1){
			ans *= vary;
			ans %= MAX_MOD;
		}
		geko /= 2;
		vary *= vary;
		vary %= MAX_MOD;
	}
	return ans;
}
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	dp[0][0] = 1;
	for(int i = 1;i <= n;++i){
		for(int q = 0;q <= n;++q){
			if(q != 0) dp[i][q] += 2*dp[i-1][q-1];
			else dp[i][q] += dp[i-1][q];
			dp[i][q] += dp[i-1][q+1];
			dp[i][q] %= MAX_MOD;
		}
	}
	long long hoge = 1;
	for(int i = 0;i < s.length();++i){
		hoge *= 2;
		hoge %= MAX_MOD;
	}
	cout << (dp[n][s.length()] * inv(hoge))%MAX_MOD << endl;
	return 0;
}


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

ll N;
string S = "";

/*S_0は2で割った余りで判定、S_1は2^2で割った余りで判定、S_2は2^3で割った...*/
/*余りがあるのならば、その余りがなくなるように判定後調整を加える*/
/*直前に判定したところまで正しいということは自明*/

void solve(){
  ll kake = 1; ll div = 2;
  if(N == 0) S = "0";
  while(N){
    if(N % div){ S = "1" + S; N-=kake; }
    else S = "0" + S;
    kake *= -2; div *= 2;
  }
  return ;
}


int main(){
  cin >> N;

  solve();

  cout << S << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	string top = "MARCH";
	ll a[5] = { 0 };
	REP(i, N) {
		string S;
		cin >> S;
		REP(j, 5) {
			if (S[0] == top[j]) {
				a[j]++;
				break;
			}
		}
	}
	ll res = 0;
	for (int i = 0;i < 3;i++) {
		for (int j = i + 1;j < 4;j++) {
			for (int k = j + 1;k < 5;k++) {
				res += a[i] * a[j] * a[k];
			}
		}
	}
	cout << res << "\n";

	return 0;
}

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

int main() {
	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;

	if(r <= x && x <= (W - r) && r <= y && y <= (H - r)) cout<<"Yes"<<endl;
	else												 cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 1160
//itp1_topic1_d
#include <bits/stdc++.h>
using namespace std;
 
  int main(){
  
  int x;
  cin>>x;
  int h = x /3600;
  int m = (x / 60) % 60;
  int s = x % 60;
  cout<<h<<":"<<m<<":"<<s<<endl;

  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  1e9+5
 #define f first
 #define se second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii >
 #define vll vector < ll >
 #define mi map<int,int>
 #define mll map<ll,ll>
 #define mci map<char,int>
 #define msi map<string,int>
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define int long long int
 #define Anurag_Gupta ios_base::sync_with_stdio(false);
#define IIIT_ALLD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
vi fact(1000007);
inline int mdpower(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res%mod*a%mod)%mod;
        b/=2;
        a = (a%mod*a%mod)%mod;
    }
    return res;
}
inline int power(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res*a);
        b/=2;
        a = a*a;
    }
    return res;
}

inline void factorial()
{
    fact[0]=1;
    for(int i=1;i<1000007;i++)
        fact[i] = (fact[i-1]%mod*i%mod)%mod;
}

inline int inverse(int a)
{
    return mdpower(a,mod-2);
}
 signed main()
 {
     Anurag_Gupta
     IIIT_ALLD
     
    /* #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
     #endif*/
        int n,m,c;
        cin>>n>>m>>c;
        vi brr;
        int arr[n][m];
        for(int i=0;i<m;i++)
        {
            int x;
            cin>>x;
            brr.pb(x);
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
                cin>>arr[i][j];
        }
        int count=0;
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<m;j++)
            {
                sum+=arr[i][j]*brr[j];
            }
            if(sum+c>0)
                count++;
        }
        cout<<count<<"\n";

 }


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  string S;
  cin >> S;
  ll cnt = 0;
  rep(i, 0, 3){
    if (S[i] == 'o')
    {
      cnt++;
    }
  }
  cout << 700 + cnt * 100 << endl;
  return 0;
}

Measured memory_bytes: 764
while True:
    n, s = map(int, input().split()) #与えられた値をn,sに代入
    answer = 0 #答えとなる関数
    if [n,s] == [0,0]:
        break
    else:
        for i in range(2**10): #部分集合をビット表示する
            a = [] #部分集合を表示するためのリストを作成
            for j in range(10):
                if (i >> j) & 1 == 1:
                    a += [j] #ビット表示をただのリストになおす
            if len(a) == n:
                if sum(a) == s:
                    answer += 1
        print(answer)


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

int main(void){
  
  int w,a[3]={125,140,160};
  
  while(cin >> w,~w){
    int res=1150;
    w-=10;      
    
    for(int i=0;i<3 && 0<w;i++){
      if(9<w  && i<2)w-=10,res+=10*a[i];
      else{
	res+=w*a[i];
	break;
      }
    }
 
    cout << 4280-res << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

int x,y;

int32_t main(){_
    //freopen("input","r",stdin);
	cin >> x >> y;
	int ans = 1;
	while(x * 2 <= y)
	{
		x *= 2;
		ans++;
	}
	rc(ans);
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
long long n,x,ans=0;
long long a[100010];
int main()
{
	scanf("%lld %lld",&n,&x);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		a[i]=abs(a[i]-x);
	}
	for(int i=2;i<=n;i++)
		a[i]=__gcd(a[i],a[i-1]);
	cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long n = scan.nextLong();
		int k = scan.nextInt();
		int last = 0;
		int count =0;
		last = (int)n;

		while(last>0) {

			last = last/k;
			count++;
		}

		System.out.println(count);

		scan.close();
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
#define erase(s) s.erase(s.end()-1) //文字列sの末尾削除

ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  string s;
  cin>>n>>s;
  map<char,ll> alpha;
  loop(i,n)alpha[s[i]]++;
  ll ans=1;
  loop(i,'z'-'a'+1){
    ans*=alpha[(char)('a'+i)]+1;
    ans%=1000000007;
  }
  putout(ans-1);
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    int h1,m1,h2,m2,k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    int minite1 = h1*60+m1;
    int minite2 = h2*60+m2;
    cout << minite2 - minite1 - k << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll cnt[6];
int main()
{
  	ll a,b,c,d;
    cin>>a>>b>>c>>d;
  	cnt[1]=a*c;
    cnt[2]=a*d;
    cnt[3]=b*c;
    cnt[4]=b*d;
    cnt[5]=0;
    ll maxx=-1000000000000000000;
    for(int i=1; i<=4; i++)
       if(cnt[i]>maxx) maxx=cnt[i];
    cout<<maxx;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  int v[a];
  double d =0.0;
  int x=0;
  for (int i=0; i<a; i++) {
    cin >> v[i];
    d += v[i];
  }
  for (int i=0; i<a; i++) {
    if (v[i] >= d/(4*b)) {
      x++;
    }
  }
  if (x >= b) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static long[] ans = new long[]{-1,-1,-1};
	public static void main(String[] args) throws Exception {


		int N=nextInt();
		long[] D = nextLongs();
		int M=nextInt();
		long[] T = nextLongs();

		Arrays.sort(D);
		Arrays.sort(T);

		int di = 0;
		int ti = 0;
		while(di<N&&ti<M){
			if(D[di]==T[ti]){
				di++;
				ti++;
			}else if(D[di] < T[ti]){
				di++;
			}else{
				break;
			}
		}
		if(ti==M){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 89180
using System;

namespace Registration
{
    class Program
    {
        static void Main(string[] args)
        {
            string S, T;

            S = Console.ReadLine();
            T = Console.ReadLine();

            if (S.Equals(T.Substring(0,S.Length)))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }


        }
    }
}


Measured memory_bytes: 25864
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	string s,t; cin>>s>>t;
	bool flag = true;
	rep(i,0,s.size())if(s[i] != t[i]) flag = false;
	cout<<(flag ? "Yes" : "No")<<endl;
}

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

int main(){
  int n;cin >> n;int x=n;
  cout << x << ":";
  for(int i=2;i*i<=x;i++){
    while(n%i==0) {
      cout << " " << i;
      n/=i;
    }
  }
  if(n!=1)
    cout << " " << n;
  cout << endl;
  return 0;
}


Measured memory_bytes: 3112
let n = Int(readLine()!)!
let p = readLine()!.characters.split(" ").map{Int(String($0))!}
print((1..<n-1).reduce(0){i,j in let k=(p[j-1]<p[j]&&p[j]<p[j+1])||(p[j-1]>p[j]&&p[j]>p[j+1]) ?1:0;return i+k})

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

int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  
}


Measured memory_bytes: 256
let main () =
  let n = Scanf.scanf "%s\n" (fun a -> a) in
  let n = ref @@ BatString.rev n in
  let xs = BatArray.map BatString.rev [|"dream"; "dreamer"; "erase"; "eraser"|] in
  let flag = ref true in
  while !flag do
    flag := BatArray.fold_left (fun acc elm ->
        if BatString.equal (BatString.left !n @@ BatString.length elm) elm
        then (n := BatString.tail !n @@ BatString.length elm; true)
        else acc || false
      ) false xs
  done;
  Printf.printf (if BatString.is_empty !n then "YES" else "NO")

let _ = main ()


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

#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; i++)
#define MOD (int)(1e9+7)
using namespace std;
typedef pair<int, int> P;
struct edge {
    int to, cost;
};

class dijkstra {
private:
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<>> que;

public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first)
                continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

    int find(int e) {
        return d[e];
    }
};

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

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

bool prime(int a) {
    if (a == 1)
        return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)
            return false;
    }
    return true;
}

class Union_Find {
private:
    vector<int> t, s;

public:
    Union_Find(int max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(int x, int y) {
        if (same(x, y))
            return;
        int tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        } else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        } else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        } else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }

    int Find(int n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

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

    int get_Size(int a) {
        return s[a];
    }
};

vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}

signed main() {
    int n,a[100000];
    cin>>n;
    rep(i,n)cin>>a[i];
    int memo[100000],mm=0,cnt=0;
    rep(i,n){
        memo[i]=(a[(i+1)%n]-a[(i+0)%n])*2;
        cnt+=a[i];
    }
    int memo2[100000];
    memo2[0]=0;
    for(int i=2;i<n*2;i+=2){
        memo2[i%n]=memo2[(i-2)%n]+memo[(i-2)%n];
        mm+=memo2[i%n];
    }
    int mmm=(cnt-mm)/n;
    rep(i,n){
        cout<<memo2[i]+mmm;
        if(i+1!=n)cout<<" ";
        else cout<<endl;
    }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> v(n+1,0),tmp;
//    tmp.push_back(0);
    for(ll i=1;i<=n;i++) cin>>v[i];
    map<ll,ll> mapi;
    ll ind =1,repeater=0;
    while(true)
    {
        ll d = v[ind];
        ind = d;
        repeater = d;
        if(mapi.find(d)==mapi.end())
        {
            mapi[d]++;
            tmp.push_back(d);
        }
        else
        break;
    }
    ll len = (ll)tmp.size();
    if(k<=len)
    {
        ll pos = k%len;
        if(pos==0) cout<<tmp[len-1]<<endl;
        else
        cout<<tmp[pos-1]<<endl;
        return 0;
    }
    ll rpos;
    for(ll i=0;i<len;i++)
    {
        if(tmp[i]==repeater) 
        {
            rpos = i;
            break;
        }
    }
    vector<ll> ana;
    for(ll i=rpos;i<len;i++) ana.push_back(tmp[i]);
    k -= len;
    ll tlen = len - rpos;
    ll p = k%tlen;
    if(p==0) cout<<tmp[len-1]<<endl;
    else
    cout<<ana[p-1]<<endl;
}

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

int main(){
  string s,t="CODEFESTIVAL2016";
  cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
	if(s[i]!=t[i])ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256