akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    set<char> c;
    for (int i = 0; i < n; i++) {
        char tmp; cin >> tmp;
        c.insert(tmp);
    }

    if (c.size() == 4) cout << "Four" << endl;
    else cout << "Three" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct {
    int code;
    int num;
} stu;

int cmp( const void *p, const void *q ) {
    return ((stu*)p)->num - ((stu*)q)->num;
}

int main(void) {
 
  int n;
  stu list[100001];
  scanf("%d",&n);
  int tmp,cnt=0;
  for(int i=0;i<n;i++){
    list[i].code=i;
    scanf("%d",&list[i].num);
  }
  
  qsort( list, n, sizeof(stu), cmp );

  for(int i=0;i<n;i++){
    printf("%d ",list[i].code+1);
  }

  printf("\n");

  return 0;
}

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

using namespace std;

int main(void)

{
    string s, s1;
    int a, b, i, j, Q, flag = 0, c;
    char ch;
    cin>>s;
    for(i = s.size()-1; i >= 0; i--){
        s1 += s[i];
    }
    cin>>Q;
    while(Q--){
        cin>>a;
        if(a == 1 && flag == 0){
            flag = 1;
        }
        else if(a == 1 && flag == 1){
            flag = 0;
        }
            else if(a == 2){
            cin>>c>>ch;
            if(c == 1 && flag == 0){
                s.insert(0,1, ch);
                s1 += ch;
            }
            else if(c == 1 && flag == 1){
                s1.insert(0,1, ch);
                s += ch;
            }
            else if(c == 2 && flag == 0){
                s1.insert(0,1, ch);
                s += ch;
            }
            else{
                s.insert(0,1, ch);
                s1 += ch;
            }
    }
    }
    if(flag == 0)
        cout<<s<<"\n";
    else
    cout<<s1<<"\n";
    return 0;
}

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

int n;
int v[100010];
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		int a, b;
		cin >> a >> b;
		++v[a];
		--v[b+1];
	}
	for(int i=1; i<=n+1; ++i){
		v[i] += v[i-1];
		if(v[i]+1>=i)
			ans = max(ans, i-1);
	}
	cout << ans << "\n";
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, k, a[200000];

template<typename T> class SegTree {
private:
	T * a = NULL;
	int M, S;
	T (*F)(T, T);
	T I;

public:
	// [0, size) が使用可能になる、func が演算、id は単位元
	void init(int size, T (*func)(T, T), T id) {
		assert(size > 0);
		M = size;
		F = func;
		I = id;
		S = 1;
		while(S < size) { S *= 2; }
		delete[] a;
		a = new T[S * 2];
		inc(i, S * 2) { a[i] = I; }
	}
	
	// 参照（値を変更した後は calc() を呼ぶこと）
	T & operator[](int p) {
		assert(inID(p, 0, M));
		p += S;
		return a[p];
	}
	
	// テーブルの再計算
	void calc() {
		decID(i, 1, S) {
			a[i] = F(a[i * 2], a[i * 2 + 1]);
		}
	}
	
	// a[p] を v に変更し再計算
	void update(int p, T v) {
		assert(inID(p, 0, M));
		p += S;
		a[p] = v;
		while(p != 1) {
			p /= 2;
			a[p] = F(a[p * 2], a[p * 2 + 1]);
		}
	}
	
	// [l, r) に f を適用した結果を返す
	T range(int l, int r) {
		assert(inID(l, 0, M));
		assert(inII(r, 0, M));
		assert(l <= r);
		l += S;
		r += S;
		
		T v = I, w = I;
		while(l < r) {
			if(l + 1 == r) { v = F(v, a[l]); break; }
			
			if(l % 2 == 1) { v = F(v, a[l]); }
			if(r % 2 == 1) { w = F(a[r - 1], w); }
			
			l = (l + 1) / 2;
			r = r / 2;
		}
		
		return F(v, w);
	}
};

template<typename T> T add(T x, T y) { return x + y; }

int main() {
	cin >> n >> k;
	inc(i, n) { cin >> a[i]; }
	
	vector<pair<LL, int>> vp;
	LL sum = 0;
	vp.EB(sum, 0);
	inc(i, n) {
		sum += a[i] - k;
		vp.EB(sum, i + 1);
	}
	sort(ALL(vp));
	
	LL ans = 0;
	SegTree<int> st;
	st.init(n + 1, add, 0);
	inc(i, vp.size()) {
		ans += st.range(0, vp[i].SE);
		st.update(vp[i].SE, 1);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 7536
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    string S, T;
  cin >> S >> T;
  T.pop_back();
  if(S == T) cout << "Yes" << endl;
  else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3620
//Print a Rectangle

#include <iostream>
#include <cassert>

int main()
{
  while (1) {
    int height, width;
    std::cin >> height >> width;

    assert(height >= 0 && height <= 300);
    assert(width >= 0 && width <= 300);
    if (!height && !width) break;

    for (int h = 0; h < height; ++h) {
      for (int w = 0; w < width; ++w) {
        std::cout << '#';
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1152
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define FOR(i, n) for (int(i) = 0; (i) < n; (i)++)
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who cannot acknowledge themselves, will invariably fail

    int n;
    cin >> n;
    int arr[n];
    int prev = -1;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        arr[i]--;
    }
    int brr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> brr[i];
    }
    int crr[n - 1];
    for (int i = 0; i < n - 1; i++)
    {
        cin >> crr[i];
    }
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += brr[arr[i]];
        if (i)
        {
            if (prev == arr[i] - 1)
            {
                sum += crr[prev];
            }
        }
        prev = arr[i];
    }
    cout << sum;
    return 0;
}

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

const int MAXN = 1000;
const int MAXM = 200000;

vector<int>G[MAXN + 5]; int to[MAXM + 5];
void addedge(int u, int i) {G[u].push_back(i);}

int tag[MAXN + 5], que[2*MAXN + 5];
bool ans1[MAXM + 5], ans2[MAXM + 5];

int n, m;
int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=m;i++) {
		int a; scanf("%d%d", &a, &to[i]);
		addedge(a, i);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) tag[j] = 0;
		int s = 1, t = 0;
		for(int p=0;p<G[i].size();p++)
			tag[que[++t] = to[G[i][p]]] = G[i][p];
		while(s<=t) {
			int x = que[s++], y = tag[x];
			for(int p=0;p<G[x].size();p++) {
				int q = to[G[x][p]];
				if( q != i ) {
					if( tag[q] != -1 ) {
						if( tag[q] == 0 )
							tag[que[++t] = q] = y;
						else if( tag[q] != y )
							tag[que[++t] = q] = -1;
					}
				}
				else ans1[G[x][p]] = 1;
			}
		}
		for(int p=0;p<G[i].size();p++)
			if( tag[to[G[i][p]]] == -1 ) ans2[G[i][p]] = 1;
	}
	for(int i=1;i<=m;i++)
		puts(ans1[i] ^ ans2[i] ? "diff" : "same");
}

Measured memory_bytes: 5976
package main

import (
	"fmt"
)

func main() {
	var N, D, X, r int
	fmt.Scan(&N, &D, &X)
	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}
	for i := 0; i < N; i++ {
		j := 1
		r++
		for {
			if arr[i]*j+1 > D {
				break
			}
			r++
			j++
		}
	}
	fmt.Println(r + X)
}

Measured memory_bytes: 512
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
        double count = 0;
        int countInt = 0;
        count = (b-1) / (a-1);
        while(count > 0){
        	countInt++;
            count =  count - 1.0;
        }
      System.out.println(countInt);
	}
 
}

Measured memory_bytes: 26452
n, x = map(int, input().split())
a = list(map(int, input().split()))
acopy = a[:]
ans = 0
for i in range(len(a)-1):
    n = a[i]+a[i+1]
    if n > x:
        if a[i+1] < (n-x):
            a[i+1] = 0
            ans += n-x
        else:
            a[i+1] -= (n-x)
            ans += n-x
print(ans)


Measured memory_bytes: 14156
import * as fs from 'fs';


let [N_line, A_line] = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
let N = Number(N_line);
let a = A_line.split(" ").map(Number);
let A = new Array(N).fill(0);

for(let i=0; i<N; i++) {
    A[a[i]-1] = i; // number A to index
}

function range(N: number): number[] {
    return new Array(N).fill(0).map((v, i) => i);
}

let left = range(N),
    right = range(N),
    answer = 0;

for(let i=N-1; i>=0; i--) {
    let l = left[A[i]], r = right[A[i]];
    answer += (i+1)*(A[i]-l+1)*(r-A[i]+1);
    if (l-1 >= 0) {
        right[l-1] = r;
    }
    if (r+1 < N) {
        left[r+1] = l;
    }
}

console.log(answer);


Measured memory_bytes: 53540
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;

int main() {
  ll N, Y;
  cin >> N >> Y;
  bool no = 1;
  for(ll i = 0; i < N + 1; i++) {
    for(ll j = 0; j < N - i + 1; j++) {
      if(Y == 10000 * i + 5000 * j + 1000 * (N - i - j)) {
        cout << i << " " << j << " " << N - i - j << endl;
        no = 0;
        break;
      }
    }
    if(no == 0) break;
  }
  if(no == 1) cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	int N;
	cin >> N;
	int sumofT=0;
	int T[N];
	for(int i=0;i<N;i++){
		int t;
		cin >> t;
		T[i]=t;
		sumofT+=t;
	}

	int M;
	cin >> M;
	for(int i=0;i<M;i++){
		int P,X;
		cin >> P >> X;
		cout << (sumofT+X-T[P-1]) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
// Problem : B - An Odd Problem
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n,a;
    cin>>n;
    int ans = 0;
    for(int i=1;i<=n;i++){
        cin>>a;
        if(i%2 && a%2) ans++;
    }
    cout<<ans;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  while( A > 0 && C > 0 ){
    C -= B;
    if( 0 >= C ){
      cout << "Yes" <<endl;
      break;
    }
    A -= D;
    if( 0 >= A ){
      cout << "No" <<endl;
      break;
    }
  }
}

Measured memory_bytes: 3636
#include <stdio.h>

int c[3][3]={0};

int main(){
    for (int i=0;i<3;i++){
	for (int j=0;j<3;j++){
	    scanf("%d",&c[i][j]);
	}
    }

    int sub=0;
    for (int i=1;i<3;i++){
       	sub=c[i][0]-c[i-1][0];
	for (int j=1;j<3;j++){
	    if (sub != (c[i][j]-c[i-1][j])){
		printf("No\n");
		return 0;
	    }
	}
    }

    printf("Yes\n");

    return 0;
}

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

int main(){
    int n;
    double s[1000];
    double m,a2;
    while(true){
        m = 0;
        a2 = 0;
        cin >> n;
        if(n==0) break;
        for(int i=0; i<n; i++){
            cin >> s[i];
            m += s[i];
        };
        m = m/n;
        for(int i=0; i<n; i++){
            a2 += pow(s[i]-m,2);
        };
        a2 = pow(a2/n,0.5);
        cout << fixed << setprecision(8) << a2 << endl;
    };
    return 0;
}


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

void solve() {
    int a, b;
    cin >> a >> b;
    cout << a * b - a - b + 1 << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
using ll = long long;
signed main() { 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m; 
	cin>>n>>m;
	
	ll tot = 0;
	for(int i = 0; i < m; i++){
		int a;
		cin>>a;
		tot += a;
	}
	if(tot > n){
		cout << -1;
	}else{
		cout << n-tot;
	}
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main()
{
    ll k, n;
    cin >> k >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    ll ans = v[n - 1] - v[0];
    rep(i, n - 1)
    {
        ans = min(ans, k - (v[i + 1] - v[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include "unistd.h"
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream&o,const pair<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
template<typename T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
//V<ll>fac,rfac;void setFac(int n,int mod){fac=rfac=V<ll>(++n);fac[0]=1;FOR(i,1,n)fac[i]=fac[i-1]*i%mod;rfac[n-1]=modInv(fac[n-1],mod);FORR(i,n-1,1)rfac[i-1]=rfac[i]*i%mod;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

void RE(){cout<<1/0;}
void TLE(){sleep(100);}
void WA(){cout<<char(0);exit(0);}

const int N = 1e5;
int n, t1, t2, c1, c2;
int m[26];
string s;
ll ans = 1;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  m['R'-'A'] = 1;
  m['G'-'A'] = 2;
  m['B'-'A'] = 4;
  cin >> n >> s;
  FOR(i, 0, n*3){
    int d = m[s[i]-'A'];
    if(c2 && (t2+d)==7){
      ans = ans * c2 % MOD;
      c2--;
    }else if(!c1){
      c1++;
      t1 = d;
    }else if(t1==d){
      c1++;
    }else{
      t2 = t1+d;
      c2++;
      ans = ans * c1 % MOD;
      c1--;
    }
  }
  FOR(i, 1, n+1) ans = ans * i % MOD;
  cout << ans << endl;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int a=0,b=0,c=0;
signed main(){
    cin>>s;
    int l=s.size();
    rep(i,l){
        if(s[i]=='a')a++;
        else if(s[i]=='b')b++;
        else c++;
    }
    if(l==1)puts("YES");
    else if(a&&b&&c){
        int ar[]={a,b,c};
        sort(ar,ar+3);
        if(ar[2]-ar[0]>1)puts("NO");
        else puts("YES");
    }
    else if((a&&b)||(b&&c)||(c&&a)){
        if(l==2)puts("YES");
        else puts("NO");
    }
    else puts("NO");
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>

int main()
{
    int n, red=0;
    std::cin >> n;
    char s[n+1];
    std::cin >> s;
    for(int i=0; i<n; i++){
        if(s[i] == 'R') red++;
    }
    if(2*red > n) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 256
import itertools
import math
D, G = map(int, raw_input().split())
p = [0]*D
c = [0]*D
for i in range(D):
  p[i], c[i] = map(int, raw_input().split())
r = sum(p)
for a in itertools.product([True, False], repeat=D):
  s = 0
  b = 0
  for i in range(D):
    if a[i]:
      s += p[i]
      pi = p[i]
      ci = c[i]
      b += (100*(i+1)*pi)+ci
  for i in range(D-1,-1,-1):
    if b>=G:
      break
    if not a[i]:
      d = min(p[i]-1, int(math.ceil(1.0*(G-b)/(100*(i+1)))))
      s += d
      b += 100*(i+1)*d
  if b>=G:
    r = min(r, s)
print r

Measured memory_bytes: 2696
#include <stdio.h>

typedef unsigned char   u1;
typedef unsigned short  u2;
typedef unsigned long   u4;
typedef signed char     s1;
typedef signed short    s2;
typedef signed long     s4;

int main(void)
{
    u4 k;
    u4 i;
    u4 score;
    double n;
    double vic;
    double total = 0.0;

    scanf("%lf %ld", &n, &k);

    for (i = 1UL; i <= (u4)n; i++)
    {
        score = i;
        vic = 1.0;
        while (score <= k - 1UL)
        {
            vic*=0.5;
            score*=2UL;
        }
        total+=(1.0 / n * vic);
    }

    printf("%.12lf\n", total);

    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	int n = 10;
	int aa, bb;
	while (true){
		aa = (n * 8) / 100;
		bb = n / 10;
		if (aa == a && bb == b) {
			cout << n << endl;
			return 0;
		}
		if (aa > a || bb > b) {
			cout << -1 << endl;
			return 0;
		}
		n++;
	}

	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
	vector<int> vec(5, 0);
	for(int i = 0; i < 5; ++i){
		cin>>vec[i];
	}
	int k;
	cin>>k;
	bool ok = true;
	for(int i = 0; i < 5; ++i){
		for(int j = 0; j < 5; ++j){
			if(abs(vec[i] - vec[j]) > k)ok = false;
		}
	}
	if(ok){
		cout<<"Yay!"<<endl;
	}
	else cout<<":("<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }

    class Program
    {
        private long X, Y;
        private void Scan()
        {
            var sc = new Scanner();
            X = sc.NextLong();
            Y = sc.NextLong();
        }

        public void Solve()
        {
            Scan();
            for (int i = 1; i <= 100; i++)
            {
                X *= 2;
                if(X>Y)
                {
                    Console.WriteLine(i);
                    return;
                }
            }
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
bool is_prime(lli x) {
  for(lli i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}
int main() {
  lli A,B,C=INF,D=0,E=0,F=0,G=0,H=0,N,M;
  string S,K,L;
  cin >> A >> B >> C;
  rep(i,1,100000000){
    if((A*i)%B==C){
      Out("YES");
      C=0;
      break;
    }
  }
  if(C)Out("NO");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#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__) << "] "
using ll = long long;

void test_case(){
	int n,m; cin >> n >> m;
	cout<<n*m;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


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

double K, R, L;
double P, E, T;

double solve(double l, double r, double k){
	double h = (l + r) / 2;

	if(k == K){//k???????????¢?´¢??????????????????
		if(abs(h - T) < E) return 1.0;
		else return 0.0;
	}

	//?????????
	//????????????????????£???????????¢?´¢???????????¶???????????????E?????????????????????
	if(T - E <= l && r <= T + E) return 1;
	//????????????????????£???????????¢?´¢???????????¶???????????????E???????????????????????????
	if(r < T - E || T + E < l) return 0;

	double tmpp = 0;//?¢???????????¨?(??¬???????±?????????§???)
	if(h >= T){//?????????????????????
		tmpp += (1 - P) * solve(l, h, k + 1);//correct
		tmpp += P * solve(h, r, k + 1);//mistake
	}else{//?????????????????????
		tmpp += (1 - P) * solve(h, r, k + 1);//correct
		tmpp += P * solve(l, h, k + 1);//mistake
	}
	return tmpp;
}

int main(void){
	cin >> K >> R >> L >> P >> E >> T;
	swap(R, L);
	printf("%.9f\n", solve(L, R, 0));
	return 0;
}

Measured memory_bytes: 3300
/*
* AUTHOR : Haoyang(Max) Chen
* INSTITUTION : Australian National Unversity
*/

#include <cmath>
#include <iostream>
#include <vector>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <random>
#include <string>
using namespace std;

#define ll long long

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

	int a, m, n;
	cin >> a;

	if (a < 100) {cout << 0 << "\n";}
	else{
		// m indicates how many 0,1,2,3,4,5 we could use
		m = a / 100;
		// n indicates the sum combination for the five numbers
		n = a % 100;
		if (n > m * 5){
			cout << 0 << "\n";
		}
		else{
			cout << 1 << "\n";
		}

	}


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[5],b,c;
int main()
{
    cin>>a[1]>>a[2]>>a[3];
    sort(a+1,a+4);
    if(a[2]-a[1]==a[3]-a[2])
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char a[10000];
	scanf("%s",a);
	if(strcmp(a,"Sunny")==0)
	printf("Cloudy\n");
	if(strcmp(a,"Cloudy")==0)
	printf("Rainy\n");
	if(strcmp(a,"Rainy")==0)
	printf("Sunny\n");
}

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

int main() {
  int N,K,tmp;
  scanf("%d", &N);
  map<int,int> ord;
  for (int i=0; i < N; i++) {
    cin >> tmp;
    ord[tmp] = i;
    ord[tmp]++;
  }
  for (auto p : ord) {
    auto value = p.second;
    if (p.first == N) cout << value << endl;
    else  cout << value << " ";
  }
}

Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <iomanip>

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

using namespace std;
using std::swap;

vector<long long int> v;
vector<long long int> w;



int main() {
	double n;
	cin >> n;
	n = n * 2 * 3.14159265358979323846;
	cout << n << "\n";
	return 0;
}

Measured memory_bytes: 3776
def resolve():
    n, m, l = map(int, input().split())
    a = [list(map(int, input().split())) for i in range(n)]
    b = [list(map(int, input().split())) for i in range(m)]

    c = []

    for i in range(n):
        tmp = []
        for j in range(l):
            x = 0
            for k in range(m):
                x += a[i][k] * b[k][j]
            tmp.append(x)
        c.append(tmp)

    for line in c:
        print(*line)



resolve()


Measured memory_bytes: 7064
n, m = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)

x = a.inject(:+)
y = x.to_f / (4.0 * m)

if a.select { |k| k >= y }.size >= m
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 1788
function main(input){
	const reverse = (s) => {
        return s.split('').reverse().join('');
    };

  const WEEK = ['SUN','MON','TUE','WED','THU','FRI','SAT'].map(reverse);
  const S = reverse(input.split('\n')[0]);

	var index = 0;
	for (var i=0 ; i<=WEEK.length ; i++) {
			if (WEEK[i] === S) {
              	index = 7-i
				console.log(index)
				break;
			}
	}

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
  int n;
  cin >> n;
  int max=-1,num=0,i2;
  int max_index=1;
  for(int i=1;i<=n;i++){
    i2=i;
    while(i2>0){
      i2/=2;
      num++;
    }
    if(num>max){
      max=num;
      max_index=i;
    }
    num=0;
  }
  cout<<max_index<<endl;
}


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

int main(){
    int n; cin>>n;
    string s; cin>>s;
    for(int i=0; i<s.size(); i++){
        if(s[i]+n<='Z') s[i]=s[i]+n;
        else s[i]=s[i]+n-26;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	a = input()
	r = ['1' if c == '9' else '9' for c in a]
	ret=''.join(r)
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int table[26];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int a[3];cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7) cout << "YES";
    else cout << "NO";
    cout << endl;
    return 0;
}

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

int main() {
	long long N, X, M;
	cin >> N >> X >> M;
	set<long long>s;
	map<long long, long long>p;
	vector<long long>Ans(M + 10);
	s.insert(X);
	p[X] = 0;
	long long ans = X;
	Ans[0] = ans;
	for (long long i = 1; i < N; ++i) {
		X *= X;
		X %= M;
		ans += X;
		Ans[i] = ans;
		if (s.count(X)) {
			ans = 0;
			long long memo = N - i;
			memo %= (i - p[X]);
			if (0 != p[X]) {
				ans += Ans[p[X] - 1];
			}
			ans += (Ans[i] - Ans[p[X]])*((N - p[X]) / (i - p[X]));
			if (0 != p[X]) {
				ans += (Ans[p[X] + memo - 1] - Ans[p[X] - 1]);
			}
			else {
				if (0 != memo) {
					ans += Ans[p[X] + memo - 1];
				}
			}
			cout << ans << endl;
			return 0;
		}
		s.insert(X);
		p[X] = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9508
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int t = sc.nextInt();
        int tmps = n / x;
        int tmpa = n % x;
        if (tmpa == 0) {
            System.out.println(tmps * t);
        } else {
            System.out.println((tmps + 1) * t);
        }
    }
}


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

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000000000000
#define mod 1000000007

/*方針*/
/*bfsで小さい順に全て調べ上げる(ある数がルンルン数なら末尾にルンルン数になるように追加 ただし、小さい順に追加)*/

//ex)112233はlunlun数であり、この末尾に2 3 4 を追加したものをqueueにpushする
//
//➀1~9はlunlun数なのでqueueにpush
//➁que.front()に対して、末尾にlunlun数になるように一桁追加する(小さい順に追加)
//➂➁のようにbfsを続けて、k個調べ終わったら、k個目のlunlunが答えなので出力
ll k,ans;

int main(){
	cin>>k;

	ll num=0;
	queue<ll> que;
/*➀*/	for(ll i=1;i<=9;i++){
		que.push(i);
	}

/*➁*/	while(num<k){
		ll now=que.front();
		que.pop();
		
		ans=now;
		num++;

		if((now%10)-1>=0){
			que.push(now*10+(now%10)-1);
		}
		que.push(now*10+now%10);
		if((now%10)+1<=9){
			que.push(now*10+(now%10)+1);
		}
	}
	
/*➂*/	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5088
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define for1(i, m, n) for (int i = m; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = s.size();
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < s.size(); j++) {
            string tmp = s;
            if (tmp.erase(i, j) == "keyence") {
                puts("YES");
                return 0;
            }
        }
    }
    puts("NO");
    return 0;
}

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

const int MAX_V=300005;
vector<int> G[MAX_V];
int d[MAX_V];
int V;

void bfs(int s){
  queue<int> q;
  q.push(s);
  rep(i,3*V) d[i]=-1;
  d[s]=0;
  while(q.size()){
    int v1=q.front(); q.pop();
    for(int v2:G[v1]){
      if(d[v2]!=-1) continue;
      d[v2]=d[v1]+1;
      q.push(v2);
    }
  }
}

int main(){
  int m;
  cin>>V>>m;
  rep(i,m){
    int u,v;
    cin>>u>>v;
    u--; v--;
    rep(j,3){
      G[3*u+j].push_back(3*v+(j+1)%3);
    }
  }
  int s,t;
  cin>>s>>t;
  s--; t--;
  bfs(3*s);
  if(d[3*t]==-1) cout<<-1<<endl;
  else cout<<(d[3*t]+1)/3<<endl;
  return 0;
}





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

int n, k, q, c[100005];
int main() {
	int i, t;
	cin >> n >> k >> q;
	for(i=0; i<q; i++) scanf("%d", &t), c[t]++;
	for(i=1; i<=n; i++) puts(c[i] > q-k ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 1024
n,m = map(int, input().split())
listA = [int(input()) for i in range(m)]
listB = [0]*(n+2)
for k in range(m):
    listB[listA[k]] = 1
if(n==1 and listB[1]==0):
    a,b = 1,1
elif(n==1 and listB[1]==1):
    a,b = 0,0
elif(listB[1]==1 and listB[2]==1):
    a,b = 0,0
elif(listB[1]==1):
    a,b = 0,1
elif(listB[2]==1):
    a,b = 1,0
else:
    a,b = 1,2

for j in range(1, n-1):
    if(listB[j+2]!=0):
        a,b = b,0
    if(listB[j+2]==0):
        a,b = b,a+b

print(b%1000000007)



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



int main(void){
  int N;
  cin >> N ;
  int ans = 0,tmp = 0;
  int x[N];
  for(int i = 0; i < N;i++){
    cin >> x[i];
    tmp += x[i];
  }
  tmp = (int)floorf((float)tmp / N + 0.5);
  for(int i = 0; i < N;i++){
    ans += (x[i] - tmp)*(x[i] - tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
def resolve():
    MOD = 10 ** 9 + 7
    N = int(input())
    S = input()

    # i番目の数字より大きい数字が残りj個の通り数
    dp = [[0] * (N + 1) for _ in range(N + 1)]
    for j in range(N):
        dp[0][j] = 1

    for i in range(N):
        cum = [0] * (N + 1)
        for j in range(N):
            cum[j+1] = (cum[j] + dp[i][j]) % MOD

        for j in range(N - i - 1):
            if S[i] == "<":
                dp[i+1][j] = (cum[N]-cum[j+1]) % MOD
            else:
                dp[i+1][j] = (cum[j+1] - cum[0]) % MOD

    print(dp[N - 1][0])


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 144680
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n+1);
  a[0] = 0;
  rep(i,n) cin >> a.at(i+1);
  rep(i,n) a.at(i+1)--;
  
  a.at(0) %= k;
  rep(i,n) a.at(i+1) = (a.at(i+1) + a.at(i))%k;
  map<ll,set<ll>> mp;
  rep(i,n+1){
    mp[a[i]].insert(i);
  }
  
  ll ans = 0;
  for(auto p:mp){
    queue<ll> q;
    for(auto z:p.second){
      while(!q.empty()){
        if(q.front() <= z-k){ q.pop();}
        else{ break;}
      }
      ans += (int)q.size();
      q.push(z);
      //cout << z<< endl;
    }
  }
  
  cout << ans << endl;
    
  return 0;
}



Measured memory_bytes: 29952
import java.util.Scanner;

public class Main {

    private static final long MOD = 1_000_000_007;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());
        long[] arr = new long[N];
        for (int i = 0; i < N; i++) {
            arr[i] = Long.parseLong(scanner.next());
        }
        scanner.close();

        long ans = 0;
        for (int k = 0; k < 60; k++) {
            long x0 = 0;
            long x1 = 0;
            for (int i = 0; i < N; i++) {
                // k桁目をbit演算で取り出す
                long x = (arr[i] >> k) & 1;
                // k桁目が 0, 1 どちらかを数えておく
                if (x == 0) {
                    x0++;
                } else {
                    x1++;
                }
            }

            // p は 2の冪 (1,2,4,8...)
            long p = 1;
            for (int i = 0; i < k; i++) {
                p *= 2;
                p %= MOD;
            }

            // x0 * x1 が 0, 1 の組み合わせ数
            long count = (x0 * x1) % MOD;
            ans += count * p;
            ans %= MOD;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 63176
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)]

S = 0
num = [0] * 100001
for a in A:
    S += a
    num[a] += 1
for i in range(Q):
    S += (BC[i][1] - BC[i][0]) * num[BC[i][0]]
    print(S)
    num[BC[i][1]] += num[BC[i][0]]
    num[BC[i][0]] = 0


Measured memory_bytes: 32248
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long

using namespace std;

int dp[3005][3005];
string s,t;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> s >> t;
    memset (dp,0,sizeof(dp));
    for (int i=0;i<=s.size();i++) {
        for (int j=0;j<=t.size();j++) {
            if (i==0||j==0) dp[i][j]=0;
            else if (s[i-1]==t[j-1]) dp[i][j]=1+dp[i-1][j-1];
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    /*
    for (int i=0;i<=s.size();i++) {
        for (int j=0;j<=t.size();j++) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    int len=dp[s.size()][t.size()];
    string lcs="";
    int a=s.size(),b=t.size();
    while (lcs.size()!=len) {
        if (s[a-1]==t[b-1]) {
            lcs+=s[a-1];
            a--;
            b--;
        } else if (dp[a-1][b]>dp[a][b-1]) {
            a--;
        } else b--;
        //cout << lcs << endl;
    }
    reverse(lcs.begin(),lcs.end());
    cout << lcs << endl;
    return 0;
}


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

using namespace std;

int main()
{
	for(string s;getline(cin,s);){
		vector<vector<int> > a;
		for(int i=0;i<s.size();){
			int x;
			if(s[i]=='c')
				x=1,i+=7;
			else
				x=2,i+=3;
			if(a.size()==0 || x==a.back().back())
				a.push_back(vector<int>(1,x));
			else
				a.back().push_back(x);
		}
		int h=a.size(),w=0;
		for(int i=0;i<h;i++)
			w=max<int>(w,a[i].size());
		for(int i=0;i<h;i++)
			while(a[i].size()<w)
				a[i].push_back(-1);
		for(int i=0;i<h;i++)
			if(a[i][w-1]!=-1){
				cout<<(a[i][w-1]==1?"chicken":"egg")<<endl;
				break;
			}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
int main()
{
	char a[100],b[100],c[100];
	scanf("%s%s%s",a,b,c);
	int x = strlen(a), y = strlen(b), z = strlen(c);
	if(a[x-1] == b[0] && b[y-1] == c[0]) printf("YES");
	else printf("NO");
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 3e5 + 100;
const ll INF = (ll) 9223372036854775;
const ld EPS = (ld) 1e-8;

vector<pll> E;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;
	cin >> n;
	if(n == 3){
		cout << "2\n1 3\n2 3\n";
		return 0;
	}
	ll nn = n;
	if(n % 2 == 1) nn--;
	for(int i = 1; i <= nn; i++){
		for(int j = i + 1; j<=nn;j++){
			if(i + j == nn + 1) continue;
			E.pb({i, j});
		}
	}
	if(n % 2 == 1){
		for(int i = 1; i < n; i++) E.pb({i, n});
	}
	cout << E.size() << '\n';
	for(auto x : E) cout << x.F << " " << x.S << '\n';
 	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/




Measured memory_bytes: 512
#include <stdio.h>

#define N 2000001

int B[N], C[N];

void countingSort(int A[], int B[], int k, int n){
  int i, j;

  for(i = 0; i <= k; i++){
    C[i] = 0;
  }
  for(j = 1; j <= n; j++){
    C[A[j]]++;
  }   
  for(i = 1; i <= k; i++){
    C[i] = C[i] + C[i - 1];
  } 
  for(j = n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1; i <= n; i++){
    printf("%d", B[i]);
    if(i != n) printf(" ");
  }
  printf("\n");

}

int main(){
  int A[N];
  int i, j, n, k = 0;

  scanf("%d", &n); 
  for(i = 1; i <= n; i++){
    scanf("%d", &A[i]);
    if(k < A[i]) k = A[i];
  }

  countingSort(A, B, k, n);

  return 0;
}



Measured memory_bytes: 17384
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
 
    ll t=1;
    //cin>>t;
    while(t--)
    {
       string s;
       cin>>s;
       s=="ABC"? cout<<"ARC":cout<<"ABC";
    }
    return 0;
}

Measured memory_bytes: 3596
def is_number(num):
    try:
        int(num)
        return True
    except:
        return False

A, B = map(int, input().split())
S = input()
for i in range(A):
    if not is_number(S[i]):
        print("No")
        exit()
if S[A] != "-":
    print("No")
    exit()
for i in range(A + 1, A + B):
    if not is_number(S[i]):
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 38384
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll K,X;
	while(cin>>K>>X) {
		VI ans;
		RANGE(i, X-K+1, X+K) {
			ans.PB(i);
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


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

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

      if(c-a-b > 0 && (c-a-b) * (c-a-b) > 4 * a * b){
            cout << "Yes" << endl;
      }else{
            cout << "No" << endl;
      }
}


Measured memory_bytes: 256