akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-7;
const double PI  = acos(-1.0);

const double length=1;
struct swimmer{
	int tempo,cnt,cnt_max;
	int remain;
	bool operator<(const swimmer &other) const{
		return tempo<other.tempo;
	}
};
int main(){
	int n;
	while(cin>>n,n){
		vector<swimmer> left;
		vector<swimmer> right;
		REP(i,n){
			int t,c;
			cin>>t>>c;
			left.push_back(swimmer());
			left[i].tempo=t;
			left[i].cnt_max=c;
			left[i].remain=t;
		}
		sort(ALL(left));

		int turn;
		for(turn=1;;turn++){
			int left_prev_remain=0;
			REP(i,left.size()){
				double new_remain=left[i].remain-1;
				if(new_remain<left_prev_remain){
					left[i].remain=left_prev_remain;
				}else{
					left[i].remain=new_remain;
					left_prev_remain=new_remain;
				}
			}
			int right_prev_remain=0;
			REP(i,right.size()){
				double new_remain=right[i].remain-1;
				if(new_remain<right_prev_remain){
					right[i].remain=right_prev_remain;
				}else{
					right[i].remain=new_remain;
					right_prev_remain=new_remain;
				}
			}

			vector<swimmer> left_done_swimmers;
			REP(i,left.size()){
				if(left[i].remain==0){
					left_done_swimmers.push_back(left[i]);
				}
			}
			left.erase(left.begin(),left.begin()+left_done_swimmers.size());

			vector<swimmer> right_done_swimmers;
			int num_right_done_swimmers=0;
			REP(i,right.size()){
				if(right[i].remain==0){
					num_right_done_swimmers++;
					right[i].cnt++;
					if(right[i].cnt<right[i].cnt_max){
						right_done_swimmers.push_back(right[i]);
					}
				}
			}
			right.erase(right.begin(),right.begin()+num_right_done_swimmers);

			sort(ALL(left_done_swimmers));
			sort(ALL(right_done_swimmers));
			REP(i,left_done_swimmers.size()){
				left_done_swimmers[i].remain=left_done_swimmers[i].tempo;
			}
			REP(i,right_done_swimmers.size()){
				right_done_swimmers[i].remain=right_done_swimmers[i].tempo;
			}
			right.insert(right.end(),ALL(left_done_swimmers));
			left.insert(left.end(),ALL(right_done_swimmers));
			if(left.size()==0&&right.size()==0){
				break;
			}
		}
		cout<<turn<<endl;
	}
}

Measured memory_bytes: 1224
#include <iostream>

using namespace std;

int N, M;

int main()
{
  	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
  
  cin >> N >> M;
  
  if (N == M)
    cout << "Yes";
  else
    cout << "No";
  
  return 0;
}

Measured memory_bytes: 256
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int D;
vector<int> c(26);
int ss[365][26];
vector<int> ans(0);

double powyabai = 1.21;
double cyabaipow = 1.21;

double evaluate(int day, int kind){

    double yabasa = 0;
    int s = ans.size();
    int idx;
    for(idx = s - 1; 0 <= idx; idx--){
        if(ans[idx] == kind) break;
    }
    yabasa = pow(day - idx, powyabai) * pow(c[kind], cyabaipow);
    double uresisa = ss[day][kind];
    return yabasa + uresisa;
}

int main(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D)rep(j, 26) cin >> ss[i][j];
    rep(i, D){
        double max_eva = -inf;
        double choice = 0;
        rep(j, 26){
            if(chmax(max_eva, evaluate(i, j))) choice = j;
        }
        ans.push_back(choice);
    }
    rep(i, D) pt(ans[i] + 1);
    return 0;
}

Measured memory_bytes: 4140
N, x = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
s = sum(A)
cnt = 0
for i in range(1, len(A)):
    if A[i-1] + A[i] >= x:
        if x >= A[i-1]:
            A[i] -= A[i-1] + A[i] - x
        else:
            A[i] = 0
            A[i-1] -= A[i-1] - x

print(s - sum(A))


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

int main() {
	int n;
	cin>>n;
	int debt=100000;
	for(int i=1;i<=n;i++){
		if((int(debt*1.05)%1000)!=0){
			debt=int(debt*1.05)-(int(debt*1.05)%1000)+1000;
		}else{
			debt=int(debt*1.05);
		}
	}
	cout<<debt<<endl;
	return 0;
}

Measured memory_bytes: 2980
n,m = map(int,input().split())
even_odd = [[False,False] for _ in range(n)]
path = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path[a].append(b)
    path[b].append(a)

stack = [(0,0)]
even_odd[0][0] = True
evencnt = 0
while stack:
    p,ev = stack.pop()
    if ev == 0:
        evencnt += 1
        if even_odd[p][ev^1]:
            evencnt = -1
            break
    nev = ev^1
    for nxt in path[p]:
        if even_odd[nxt][nev]:continue
        even_odd[nxt][nev] = True
        stack.append((nxt,nev))
if evencnt == -1:
    print(n*(n-1)//2 - m)
else:
    print(evencnt*(n-evencnt) - m)


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

long long MOD = 998244353;
vector<long long> F, RF, R;

long long Comb(long long A, long long B) {
	return (F[A] * ((RF[A - B] * RF[B]) % MOD)) % MOD;
}

long long Calc(long long A, long long B) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		long long C = Calc(A, B / 2);
		return (C * C) % MOD;
	}
	return (A * Calc(A, B - 1)) % MOD;
}

int main() {
	long long N, NG = 0;
	cin >> N;
	F.resize(N + 1), RF.resize(N + 1), R.resize(N + 1);
	F[0] = F[1] = RF[0] = RF[1] = R[0] = R[1] = 1;
	for (int i = 2; i <= N; i++) {
		F[i] = (F[i - 1] * i) % MOD;
		R[i] = MOD - (R[MOD % i] * (MOD / i)) % MOD;
		RF[i] = (RF[i - 1] * R[i]) % MOD;
	}
	long long NOW = 1;
	for (int X = N; X > N / 2; X--) {
		long long COUNT = Comb(N, X);
		COUNT *= NOW;
		COUNT %= MOD;
		NG = (NG + COUNT) % MOD;
		NOW = (NOW * 2) % MOD;
	}
	cout << (Calc(3, N) - NG * 2 + MOD * 2) % MOD << endl;
}

Measured memory_bytes: 234624
//string f(string s){
//    string t(sz(s)-1,' ');
//    rep(i,sz(s)-1)
//        t[i] = abs(s[i+1]-s[i])+'0';
//    return t;
//}
//int g(string s){
//    while(sz(s) > 1){
//        s = f(s);
//    }
//    return s[0]-'0';
//}
//int x(int n){
//    if(n == 0) return 0;
//    return n/2 + x(n/2);
//}
//int w(string s){
//    int total = 0;
//    int n = sz(s);
//    rep(i,n){
//        s[i] = (s[i]-'0')%2;
//        int contrib = x(n-1)-x(i)-x(n-1-i);
//        if(contrib == 0)
//            total ^= s[i];
//    }
//    return total;
//}
//void __(){
//    _(int,n);
//    _(string,s);
//    s = f(s);
//    --n;
//    int m = 1;
//    if(count(all(s),'1') == 0){
//        for(char &c : s){
//            c = (c-'0')/2+'0';
//        }
//        m *= 2;
//    }
//    print w(s)*m;
//}
//
#include <iomanip>
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_ZERO_INT(i,r) for(int i = 0; i < r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
struct _print {
    string sep,end;
    bool space;
    ostream &stream;
    _print(string _sep=" ",string _end="\n",
            ostream &_stream = cout)
        : sep(_sep),end(_end),space(false),
            stream(_stream) {}
    ~_print() { stream << end; }
    template <typename T>
        _print &operator , (const T &t) {
            if (space) stream << sep;
            space = true;
            stream << t;
            return *this;
        }
};
#define print _print(),
#define INPUT_WITHOUT_INIT(type,name) type name; cin >> name
#define GET_INPUT_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define _(...) GET_INPUT_MACRO(__VA_ARGS__,_IWI,_IWI,_IWI,_IWI,_IWI,_IWI,INPUT_WITHOUT_INIT)(__VA_ARGS__)
string f(string s){
    string t(sz(s)-1,' ');
    rep(i,sz(s)-1)
        t[i] = abs(s[i+1]-s[i])+'0';
    return t;
}
int g(string s){
    while(sz(s) > 1){
        s = f(s);
    }
    return s[0]-'0';
}
int x(int n){
    if(n == 0) return 0;
    return n/2 + x(n/2);
}
int w(string s){
    int total = 0;
    int n = sz(s);
    rep(i,n){
        s[i] = (s[i]-'0')%2;
        int contrib = x(n-1)-x(i)-x(n-1-i);
        if(contrib == 0)
            total ^= s[i];
    }
    return total;
}
void __(){
    _(int,n);
    _(string,s);
    s = f(s);
    --n;
    int m = 1;
    if(count(all(s),'1') == 0){
        for(char &c : s){
            c = (c-'0')/2+'0';
        }
        m *= 2;
    }
    print w(s)*m;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        __();
}


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

using namespace std;

string s;
int n;

void Process()
{
    if (n < 3200) cout << "red";
        else cout << s;
}

void Input()
{
    ios_base::sync_with_stdio(0);   cin.tie(0);

    cin >> n >> s;
}

int main()
{
    Input();
    Process();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    int p,y;
    map<pair<int,int>,int> mp;
    pair<int,int> ans[m];
    vector<int> v[n+1];
    for(int i=0;i<m;i++){
        cin >> p >> y;
        mp[make_pair(p,y)]=i;
        v[p].push_back(y);
    }
    int it;
    for(int i=1;i<n+1;i++){
        it=1;
        sort(v[i].begin(),v[i].end());
        for(int u:v[i]){
            ans[mp[make_pair(i,u)]]=make_pair(i,it);
            it++;
        }
    }
    string S;
    for(int i=0;i<m;i++){
        it=10;
        for(int j=0;j<6;j++){
            S[5-j]=(ans[i].first%it)+'0';
            ans[i].first/=10;
        }
        for(int j=0;j<6;j++){
            S[11-j]=(ans[i].second%it)+'0';
            ans[i].second/=10;
        }
        for(int j=0;j<12;j++)cout << S[j];
        cout << endl;
    }
}

Measured memory_bytes: 13952
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<string> blue(N);
    for (int i = 0; i < N; i++)
    {
        cin >> blue[i];
    }
    int M;
    cin >> M;
    vector<string> red(M);
    for (int i = 0; i < M; i++)
    {
        cin >> red[i];
    }

    int ans = 0;
    auto calc = [&](string s) {
        int buf = 0;
        for (string t : blue)
        {
            if (t == s)
                buf++;
        }
        for (string t : red)
        {
            if (t == s)
                buf--;
        }
        return buf;
    };

    for (string t : blue)
    {
        ans = max(ans, calc(t));
    }

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

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

int main(){
    string s;
    cin >> s;
    if (s == "ABC"){
        puts("ARC");
    }
    else{
        puts("ABC");
    }
    return 0;
}
//g++ A.cpp -o A.exe -lm -Wall -O2 -std=c++11

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

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

  int i,j=0;
  for(i=0; i<4; i++){
    if(S.at(i)=='+'){
      j++;
    }else{
      j--;
    }
  }
  cout << j << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] h = new int[n];
		for(int i = 0;i < n;i++){
			h[i] = saori.saori_hayami();
		}
		int ans = 1;
		int num = h[0];
		for(int i = 1;i < n;i++){
			if(num <= h[i]){
				ans++;
			}
			num = Math.max(num, h[i]);
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e3+7;
int cnt[maxn][maxn][2][2];
int pre[maxn][maxn][2][2];
inline int getcnt(int x,int y,int col)
{
    if(x<0||y<0) return 0;
    if(col==0)
        return pre[x][y][0][1]+pre[x][y][1][0];
    return pre[x][y][0][0]+pre[x][y][1][1];
}
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        int x,y;
        string c;
        cin>>x>>y>>c;
        cnt[x%k][y%k][(x/k+y/k)&1][c=="W"]++;
    }
    for(int j=0;j<k;j++)
    {
        for(int p=0;p<2;p++)
        {
            for(int q=0;q<2;q++)
            {
                pre[0][j][p][q]=(j?pre[0][j-1][p][q]:0)+cnt[0][j][p][q];
                pre[j][0][p][q]=(j?pre[j-1][0][p][q]:0)+cnt[j][0][p][q];
            }
        }
    }
    for(int i=1;i<k;i++)
    {
        for(int j=1;j<k;j++)
        {
            for(int p=0;p<2;p++)
            {
                for(int q=0;q<2;q++)
                    pre[i][j][p][q]=(-pre[i-1][j-1][p][q]+pre[i][j-1][p][q]+pre[i-1][j][p][q]+cnt[i][j][p][q]);
            }
        }
    }
    int ans=0;
    for(int i=0;i<k;i++)
    {
        for(int j=0;j<k;j++)
        {
            int cur=getcnt(k-1,k-1,0)-getcnt(i-1,k-1,0)-getcnt(k-1,j-1,0)+2*getcnt(i-1,j-1,0)+getcnt(i-1,k-1,1)-2*getcnt(i-1,j-1,1)+getcnt(k-1,j-1,1);
            cur=max(cur,getcnt(k-1,k-1,1)-getcnt(i-1,k-1,1)-getcnt(k-1,j-1,1)+2*getcnt(i-1,j-1,1)+getcnt(i-1,k-1,0)-2*getcnt(i-1,j-1,0)+getcnt(k-1,j-1,0));
            ans=max(ans,cur);
        }
    }
    print(ans);

}

Measured memory_bytes: 31872
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;

void insert(int);
void inorder(Node);
void preorder(Node);
Node find(Node,int);

Node root;

Node find(Node u,int k){
  while(u!=NIL && k!=u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){

  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);

  inorder(u->right);
}

void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  Node u;
  
  scanf("%d",&n);

  for (i=0;i<n;i++ ){
    scanf("%s", com);
    if (com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    } else if (com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
     else if (com[0] == 'f'){
      scanf("%d", &x);
      u = find(root,x);
      if(u!=NIL)printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}



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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      std::string ss; scan(ss);
      Int res = 0;
      for(Int i = 0; i < (Int)ss.size(); ++i) {
         if( ss[i] == '1' ) res += 1;
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, i, j, top, bot, p, s;

	scanf("%d%d", &a, &b);

	s = 0;
	for(i = a; i <= b; i++){
		p = 1;
		for(j = 0; j < 2; j++){
			switch(j){
				case 0:
					top = i / 10000;
					bot = i % 10;
					break;
				case 1:
					top = i / 1000 % 10;
					bot = i / 10 % 10;
					break;
			}
			if(top != bot){
				p = 0;
			}
		}
		if(p){
			s++;
		}
	}

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

	return 0;
}


Measured memory_bytes: 128
s = gets.chomp
ans = []
tmp = ""
s.each_char.with_index do |c, i|
  if i == 0
    ans << c
  else
    if tmp + c == ans[-1]
      tmp << c
    elsif tmp.size > 0
      tmp << c
      ans << tmp
      tmp = ""
    else
      ans << c
    end
  end
end

p ans.size


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

int main(){
    int n;
    cin >> n;
    int c0=0, c1=0, c2=0, c3=0;

    for (int i=0; i<n; i++){
        string s;
        cin >> s;
        if(s == "AC"){
            c0++;
        }else if(s == "WA"){
            c1++;
        }else if(s == "TLE"){
            c2++;
        }else if(s == "RE"){
            c3++;
        }
    }
    cout << "AC x " << c0 << endl;
    cout << "WA x " << c1 << endl;
    cout << "TLE x " << c2 << endl;
    cout << "RE x " << c3 << endl;
}

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

const int INF = 1e9;

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

    int n, d;
    cin >> n >> d;
    
    int resp = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (sqrt(a * 1ll * a + b * 1ll * b) <= d) {
            resp++;
        }
    }
    cout << resp << endl;

	return 0;
}

Measured memory_bytes: 3652
H,W = map(int, input().split())
T = []
T.append(["."]*(W+2))
for _ in range(H):
  s = "."+input()+"."
  T.append(list(s))
T.append(["."]*(W+2))
for h in range(1, H+1):
  for w in range(1, W+1):
    if T[h][w]==".":
      S = [T[a][b] for b in range(w-1, w+2) \
           for a in range(h-1, h+2)]
      T[h][w]=S.count("#")
for h in range(1, H+1):
  print(*T[h][1:W+1], sep="")

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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 n, a[110];

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];

    bool ok = true;
    rep(i, n) {
        if (a[i] % 2 == 0) {
            if (a[i] % 3 == 0 || a[i] % 5 == 0) continue;
            else ok = false;
        }
    }
    cout << (ok ? "APPROVED" : "DENIED") << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
char str[102]={0};
int main()
{
    int n;
    int i,count=0;
    scanf("%d",&n);
    scanf("%s",str);
    for(i=0;i<n;i++)
    {
        if(str[i]=='R')
        {
            count++;
        }
    }
    if(2*count>n)
    {
        printf("Yes\n");    
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
         
        int[] science = new int[4];
        int minsc = 100;
        int sumsc = 0;

        for(int i = 0; i < 4; i++) {
            science[i] = sc.nextInt();
            minsc = Math.min(minsc, science[i]);
            sumsc += science[i];
        }
        sumsc -= minsc;
         
        int sumso = sc.nextInt();
        int x = sc.nextInt();
        if(sumso < x) {
            sumso = x;
        }
         
        System.out.println(sumsc + sumso);
    }
}


Measured memory_bytes: 26120
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n= sc.nextLong();
		long temp=0;
		long a=0;
		long b;
		while(true){
			a++;
          	double t=Math.pow(a,5)-n;
          	if(t>=0){
            	b=(long)Math.pow(t,0.2);
            }else{
            	b=-(long)Math.pow(-t,0.2);
            }
			temp=(long)(Math.pow(a,5)-Math.pow(b,5));
			if(temp==n){
				break;
			}
		}
		
		System.out.println(a+" "+b);
	}
}


Measured memory_bytes: 27088
//agc006_b.cpp
//Sun Jul 28 19:35:16 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (x==2*n-1||x==1){
		cout << "No" << endl;
		return 0;
	}else {
		cout << "Yes" << endl;
	}

	if (n==2){
		cout << 1 << endl;
		cout << 2 << endl;
		cout << 3 << endl;
		return 0;
	}

	int num = 1;
	if (x==2*n-2){
		for (int i=0;i<n-3;i++){
			while (num>=x-2 && num<=x+1){
				num++;
			}
			cout << num << endl;
			num++;
		}
		cout << x-1 << endl;
		cout << x+1 << endl;
		cout << x << endl;
		cout << x-2 << endl;
		for (int i=n+1;i<2*n-1;i++){
			while (num>=x-2 && num<=x+1){
				num++;
			}
			cout << num << endl;
			num++;
		}
	}else {
		for (int i=0;i<n-3;i++){
			while (num>=x-1 && num <= x+2){
				num++;
			}
			cout << num << endl;
			num++;
		}
		cout << x+1 << endl;
		cout << x-1 << endl;
		cout << x << endl;
		cout << x+2 << endl;
		for (int i=n+1;i<2*n-1;i++){
			while (num>=x-1 && num <= x+2){
				num++;
			}
			cout << num << endl;
			num++;
		}
	}

}

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    priority_queue<int,vector<int>,greater<int>> que;
    for(int i=0; i<n; i++){
        cin >> v[i];
        que.push(v[i]);
    }
    double ans;
    int tmp1=que.top();que.pop();
    int tmp2=que.top();que.pop();
    ans=(double)(tmp1+tmp2)/2;
    while(!que.empty()){
        int tmp=que.top();que.pop();
        ans=(ans+tmp)/2;
    }
    cout << fixed << setprecision(10) << ans << endl;

    

}

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

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

int n, a, b, friends[100005], fri, ans;

/***************************************

           imos???version

***************************************/

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

  std::cin >> n;
  rep(i,n) {
    std::cin >> a >> b;
    a--;
    friends[a]++;
    friends[b]--;
  }

  for (int i = 1; i <= n; ++i) friends[i] += friends[i-1];

  rep(i,n+1) {
      if (friends[i] >= i) {
          ans = std::max(ans, i);
      }
  }

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

  return 0;
}

Measured memory_bytes: 3580
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;
map<ll,ll> mp;int a,b,c,d,t;ll n;
ll dfs(ll u)
{
	if(!u)return mp[0]=0;
	if(u==1)return mp[1]=d;
	if(mp.count(u))return mp[u];
	ll res=min(1e18,(double)u*d);
	ll l2=u/2,r2=(u+1)/2,l3=u/3,r3=(u+2)/3,l5=u/5,r5=(u+4)/5;
	res=min(res,dfs(l2)+a+1ll*abs(l2*2-u)*d);res=min(res,dfs(r2)+a+1ll*abs(r2*2-u)*d);
	res=min(res,dfs(l3)+b+1ll*abs(l3*3-u)*d);res=min(res,dfs(r3)+b+1ll*abs(r3*3-u)*d);
	res=min(res,dfs(l5)+c+1ll*abs(l5*5-u)*d);res=min(res,dfs(r5)+c+1ll*abs(r5*5-u)*d);
	return mp[u]=res;
}
int main()
{
	scanf("%d",&t);while(t--){scanf("%lld%d%d%d%d",&n,&a,&b,&c,&d);mp.clear();printf("%lld\n",dfs(n));}
	return 0;
}

Measured memory_bytes: 4104
#include<stdio.h>
 
int main(void){
    int i=0,count=0,p;
    char str[100001]={0};
    scanf("%s",str);
    while(str[i]=='p'||str[i]=='g'){
        i++;
        if(str[i]=='p'){
            count++;
        }
    }
    p=i/2;
    printf("%d\n",p-count);
    return 0;
}

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

int main(){
    int N, minNum=2e9;
    double tmp=0, ans;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++){
	cin >> a[i];
	tmp += 1/(double)a[i];
    }

    ans = 1/tmp;

    printf("%.8f\n", ans);
    

    
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
#define max(a, b) (a) < (b) ? (b) : (a)
long a[1010];
long DP[100008];
long N;
bool Solve (long x) 
{
    if(x == 0)
        return 0;
	if (DP[x] != -1) 
        return DP[x];
	long maxx = 0;
	for (int i = 0; i < N; i++) {
		if (x >= a[i]) 
		    maxx = max(maxx, Solve(x - a[i]) ^ 1);
	}
	return DP[x] = maxx;
}

int main()
{
	long k;
    cin>>N>>k;
    for(int i = 0; i < N; ++i)
        cin>>a[i];
    memset(DP, -1, sizeof(DP));
    if(Solve(k))
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}

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

int main(void){
    string s;
    string words[4] = {"dream", "dreamer", "erase", "eraser"};
    cin >> s;
    reverse(s.begin(), s.end());
    for(int i = 0; i < 4; i++){
        reverse(words[i].begin(), words[i].end());
    }
    while(!s.empty()){
        bool hit = false;
        for(int i = 0; i < 4; i++){
            string sub = s.substr(0, words[i].size());
            if(sub == words[i]){
                s.erase(s.begin(), s.begin() + words[i].size());
                hit = true;
                break;
            }
        }
        if(!hit){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 3732
n, p = map(int, input().split())
array = [int(x) for x in input().split()]

even = 0
odd = 0

for item in array:
    if item % 2 == 0:
        even += 1
    else:
        odd += 1

if even == n:
    if p == 0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a, b, ans;
	cin >> a >> b;
	if (a == b) ans = 0;
	else if (a < b) ans = min(b - a, abs(a + b) + 1);
	else ans = min(abs(a + b) + 1, abs(a - b) + 2);
	cout << ans << endl;
}

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

int main(){
  int n; cin >> n;
  int a[n], b[100010]={};
  for(int i=0; i<n; i++) {
    cin >> a[i];
    b[a[i]]++;
    if(a[i]>0) b[a[i]-1]++;
    if(a[i]<n) b[a[i]+1]++;
  }
  cout << *max_element(b, b+100010) << endl;
  return 0;
}

Measured memory_bytes: 4336
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
const int MOD = 1000000007;
// long long a;
int main(){
  int a;
  cin >> a;
  if(a < 1200) cout <<"ABC" <<endl;
  else cout <<"ARC" <<endl;
}


Measured memory_bytes: 256
[x,y,a,b,c]= list(map(int,input().split(" ")))
p = list(map(int,input().split(" ")))
q= list(map(int,input().split(" ")))
r= list(map(int,input().split(" ")))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
lst=[]
p_=[[p[i],1] for i in range (a)]
q_=[[q[i],2] for i in range (b)]
r_=[[r[i],3] for i in range (c)]
lst = sorted(p_+q_+r_,reverse=True)

ans = 0
count =0
for i in range (len(lst)):
    if lst[i][1]==1 and x>0:
        x = x -1
        ans = ans + lst[i][0]
    if lst[i][1]==2 and y>0:
        y = y -1
        ans = ans + lst[i][0]
    if lst[i][1]==3 and x+y>0:
        count =count+1
        ans = ans + lst[i][0]
    if count == x+y:
        break

print(ans)

Measured memory_bytes: 51588
#include<stdio.h>
#define M 50000
int main(){
  int i,j,n,p[M]={1,1};
  for(i=3;i*i<M;i+=2){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  while(scanf("%d",&n),n){
    for(i=j=3;i+i<=n;i+=2)j+=(1-p[n-i])*(1-p[i]);
    if(n==4)j++;
    printf("%d\n",j-3);
  }
  return 0;
}

Measured memory_bytes: 804
W, H, N = map(int, input().split())
x, y, a = [0] * N, [0] * N, [0] * N
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())
    
xmin = 0
xmax = W
ymin = 0
ymax = H

for i in range(N):
    if a[i] == 1:
        xmin = max(x[i], xmin)
    elif a[i] == 2:
        xmax = min(x[i], xmax)
    elif a[i] == 3:
        ymin = max(y[i], ymin)
    else:
        ymax = min(y[i], ymax)

height = ymax - ymin
width = xmax - xmin

if height <= 0 or width <= 0:
    print(0)
else:
    print(height * width)

Measured memory_bytes: 9136
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = map(int,input().split())

# = list(map(int,input().split()))

# = [list(map(int,input().split())) for _ in range(XXXX)]

h1,m1,h2,m2,k = map(int,input().split())

start = 60*h1+m1
end = 60*h2+m2

waketime = end - start

if waketime >= k:
    print(waketime - k)
else:
    print(0)



Measured memory_bytes: 61548
#include <iostream>
#include <fstream>

using namespace std;

int main(){
    int a,b,c;
    string res;

    cin >> a >> b >> c;

    //a+b == c
    //a+c == b
    //b+c == a 

    if(a+b == c || a+c == b || b+c == a)
    {
        res = "Yes";
    }
    else res = "No";

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

var n, k, r, s, p int
var t string
var point = make(map[rune]int)

func main() {
	fmt.Scan(&n)
	fmt.Scan(&k)
	fmt.Scan(&r)
	fmt.Scan(&s)
	fmt.Scan(&p)
	fmt.Scan(&t)

	point['s'] = r
	point['p'] = s
	point['r'] = p

	js := make([]string, k)

	for i, tt := range t {
		js[i%k] += string(tt)
	}

	sum := 0
	for _, j := range js {
		sum += don(j)
	}
	fmt.Print(sum)
}

func don(j string) int {
	var sum int

	ru := []rune(j)
	for i, ss := range ru {
		if i == 0 {
			sum += point[ss]
			continue
		}
		if ru[i-1] != ss {
			sum += point[ss]
		} else {
			ru[i] = 'x'
		}
	}
	return sum
}


Measured memory_bytes: 8836
#include <bits/stdc++.h>
 
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    vector<int> a(3);
    cin>>a[0]>>a[1]>>a[2];
    sort(a.begin(),a.end());
    int ans=0;
    ans+=a[1]-a[0];
    ans+=a[2]-a[1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<ll,ll>P;
typedef pair<P,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}
ll C[100005]={};

vector<P> v;
vector<ll> ma2;

int n,m;
int a,b,c;
int main() {
	cin>>n>>a>>b;
	cout<<min(a,b)<<" "<<max(0,(a+b)-n)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;
// ついでに有理数型
using rat = boost::rational<bint>;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(std::string S, std::string T){
  ll ans = 0;
  for (int i = 0; i < S.length(); i++) {
    if(S[i] != T[i])ans ++;
  }
  cout << ans << endl;
}

int main(){
    std::string S;
				std::cin >> S;
				std::string T;
				std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 4100
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    cout<<n*(n-1)/2;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n, k;
  cin >> n >> k;
  vecint a(n);
  REPe(e, a) cin >> e;
  vector<string> ans;
  REP(i, n - k) {
    string x = "Yes";
    if (a[i] >= a[k + i]) {
      x = "No";
    }
    ans.push_back(x);
  }
  REPe(e, ans) cout << e << endl;
}


Measured memory_bytes: 12356
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+10;
typedef long long ll;
int n;
int a[MAXN];

ll calc(int state) {
    ll tot = 0, cnt = 0;
    for(int i=0;i<n;i++) {
        tot += a[i];
        if(state%2==0 && tot<=0) {
            //make positive
            cnt += (1-tot);
            tot = 1;
        } else if(state%2==1 && tot>=0) {
            //make negative
            cnt += (tot-(-1));
            tot = -1;
        }
        state = 1-state;
    }
    return cnt;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    
    cout << min(calc(0), calc(1)) << endl;
    
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(v,n) sort(v,v+n)
#define rep(i,n) FOR(i,0,n)
#define EPS (1e-7)
#define INF (1e9)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQI;
typedef priority_queue<int,vector<int>,greater<int> > PQSI;
typedef priority_queue<ll> PQL;
typedef priority_queue<ll,vector<ll>,greater<ll> > PQSL;

const int MOD = 1000000007;
struct mint { int n; mint(int n_ = 0) : n(n_) {} };
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};
void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(abs(n)); return n >= 0 ? I_[n] : -I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

template<typename T>
T gcd(T x, T y){
    if (y == 0) return x;
    else return gcd(y, x % y);
}

template<typename T>
T lcm(T x, T y){
    return (x / gcd(x, y)) * y;
}

template<typename T>
T ceil(T x, T y){
    return (x + (y - 1)) / y;
}
int a;
int main(void){
    cin >> a;
    cout << 3*a*a << endl;
    return 0;
}



















Measured memory_bytes: 764
import sys
for l in sys.stdin:
	if l == '-1 -1 -1\n': break
	m,f,r = map(int, l.split())
	s = m + f
	if -1 in [m,f]: g = 'F'
	elif s >= 80: g = 'A'
	elif s >= 65: g = 'B'
	elif s >= 50: g = 'C'
	elif s >= 30: g = 'D' if r < 50 else 'C'
	else: g = 'F'
	print(g)



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define _Sync ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
#define _End return cout << '\n' , 0 ;
#define fo(i,x,y) for (int i = x; i < y; i++)
#define fd(i,x,y) for(int i = x; i>= y; i--)
#define ll long long
#define clr(A,x) memset(A, x, sizeof A)
#define pb push_back
#define mod 1000000007
#define debug(x) cout <<#x << " = " << x << endl
#define PI 3.14159265
#define MAXN 100001

using namespace std;


int main ()
{
    _Sync
    //freopen("D:/input.txt","r",stdin);
    int n;
    cin>>n;
    vector<int> data(n);
    fo(i,0,n){
        cin>>data[i];
    }
    int ans =0;
    bool valido = false;
    fo(i,0,n){
        valido =true;
        fo(j,0,i){
            if(data[i]<data[j]){
               valido = false;
               break;
            }
        }
        if(valido)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#define INF 1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

void make_table(VVI cost, vector<vector<PII> > &adjacent, int n, int ex_num); 

void dijk(VVI cost, vector<vector<PII> > &adjacent, int n, int ex_num) { 
    VI answer(ex_num, INF);
    priority_queue<PII> pq;
    pq.push(make_pair(0, 0));

    while(!pq.empty()) {
        int cost = -pq.top().first;
        int node = pq.top().second;
        pq.pop();
        for (int i = 0; i < (int)adjacent[node].size(); i++) {
            int to_cost = adjacent[node][i].first;
            int to_node = adjacent[node][i].second;
            if (cost + to_cost < answer[to_node]) {
                pq.push(make_pair(-(cost + to_cost), to_node));
                answer[to_node] = cost + to_cost;
            }
        }
    }
    cout << answer[ex_num - 1] << endl;
    return; 
}

int main(void) {
    while(1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        VVI cost(n, VI(n + 1));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n + 1; j++) {
                cin >> cost[i][j];
            }
        }

        int ex_num = pow(2, n);
        vector<vector<PII> > adjacent(ex_num);
        make_table(cost, adjacent, n, ex_num);
        dijk(cost, adjacent, n, ex_num);
    }
    return 0;
}

void make_table(VVI cost, vector<vector<PII> > &adjacent, int n, int ex_num) {
    for (int i = 0; i < ex_num; i++) {
        for (int j = 0; j < n; j++) {
            if ((i & (1 << j)) != 0) {
                continue;
            }
            int min_cost = cost[j][0];
            for (int k = 0; k < n; k++) {
                if ((i & (1 << k)) != 0) {
                    min_cost = min(min_cost, cost[j][k + 1]); 
                }
            }
            int new_node = (i | (1 << j));
            adjacent[i].push_back(make_pair(min_cost, new_node));
        }
    }
    return;
}

Measured memory_bytes: 12340
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;


signed main() {
  int N;
  cin >> N;
  vector<int> A(N+10, 0);
  for( int i = 1; i <= N; i++ ){
    for( int j = 1; i*j <= N; j++ ){
      A[i*j]++;
    }
  }

  int ans = 0;
  for( int i = 1; i <= N; i++ ){
    ans += i*A[i];
  }
  cout << ans << endl;
}


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

int main(){
    long long X;
    cin >> X;
    
    int n=0;
    long long m=100;
    while(X>m){
        m = (long long) m * 1.01;
        //cout << m << endl;
        n++;
    }
    cout << n << endl;
    
    return 0;
}









Measured memory_bytes: 3592