akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int main()
{
	cin>>a>>b>>c>>d;
	printf("%.13lf ",a*b/2.0);
	if(c*2==a&&d*2==b)cout<<1<<endl;
	else cout<<0<<endl;
}

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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int W;
	cin >> W;
	vector<int> a(W), b(W, -1), c(W, -1);
	for (int i = 0; i < W; i++) {
		cin >> a[i];
		if (a[i] == 0) b[i] = c[i] = 1e8;
	}
	for (int i = 1; i < W; i++) {
		if (b[i - 1] > 0 && b[i] == -1) {
			b[i] = b[i - 1] - 1;
			if (a[i] < 0) {
				b[i] = min(b[i], -a[i]);
			}
		}
	}
	for (int i = W - 2; i >= 0; i--) {
		if (c[i + 1] > 0 && c[i] == -1) {
			c[i] = c[i + 1] - 1;
			if (a[i] < 0) {
				c[i] = min(c[i], -a[i]);
			}
		}
	}
	int res = 0;
	for (int i = 0; i < W; i++) {
		if (a[i] > 0 && max(b[i], c[i]) > 0) {
			res += min(a[i], max(b[i], c[i]));
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 4112
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

string S;

signed main(){
	cin>>S;
	if(S[2]==S[3]&&S[4]==S[5]){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import numpy as np
S = input()
l = []
for i in range(len(S)-2):
    l.append(int(S[i:i+3]))

l = np.array(l)
l -= 753

for i in range(len(l)):
    if l[i] <0:
        l[i] = - l[i]

print(min(l))

Measured memory_bytes: 21676
<?php

while(($in = trim(fgets(STDIN)))!='0 0'){
	$dp=array(array());
	sscanf($in,"%d %d",$n,$s);
	for($i=0;$i<=$n+1;$i++){
		for($j=0;$j<=$s;$j++){
		$dp[$i][$j]=0;
	}
 }
 $dp[0][0]=1;
	for($i=0;$i<=100;$i++){
		for($j=$n;$j>=0;$j--){
			for($m=0;$m+$i<=$s;$m++){
				$dp[$j+1][$m+$i]+=$dp[$j][$m];
			}
		}
	}
	print($dp[$n][$s]."\n");
}

Measured memory_bytes: 8028
s = input().rstrip().split()

n = int(s[1])

if(s[0] == "0"):
  if(n == 100):
    print(101)
  else:
    print(n)
elif(s[0] == "1"):
  if(n == 100):
    print(10100)
  else:
    print(100*n)
elif(s[0] == "2"):
  if(n == 100):
    print(1010000)
  else:
    print(10000*n)

Measured memory_bytes: 3064
//#pragma GCC optimize("-O3")
/*
                C++
                encoding: UTF-8
                Last Modified: 07/Mar/20 05:32:35 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
    ios_base::sync_with_stdio (false), cin.tie (nullptr);
    string s;
    cin>>s;
    char x = s[0];
    bool flag=0;
    fr(i, 1, len(s)) {
        if (s[i]!=x) flag= 1;
    }
    pr(flag?"Yes":"No");
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    L = SI()
    keta = len(L)

    def rec(n):
        if n == 1:
            return 3 if L[keta - n] == "1" else 1

        if L[keta - n] == "1":
            return (pow(3, (n-1), MOD) + rec(n-1) * 2) % MOD
        else:
            return rec(n-1) % MOD

    print(rec(keta))


if __name__ == "__main__":
    main()

Measured memory_bytes: 111400
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

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

  ll prod = 1e18;
  ll ans = 1;
  for(int i = 0; i < N; i++) {
  	if (A[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
    prod /= A[i];
    ans *= A[i];
  }
  
  if (prod == 0) {
  	cout << -1 << endl;
    return 0;
  }
  
  cout << ans << endl;
  
  
  
  return 0;
}


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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


int main() {
    int A, B;

    cin >> A >> B ;

    if (A+B >= 10){
        cout << "error" << endl;
    }else{
        cout << (A+B) << endl;
    }
}

Measured memory_bytes: 256
while True:
    [n, m] = [int(x) for x in raw_input().split()]
    if [n, m] == [0, 0]:
        break

    hoge = range(1, n + 1)

    data = []
    for x in range(n - 1, 1, -1):
        for y in range(x - 1, 0, -1):
            for z in range(y - 1, -1, -1):
                # print((x, y, z))
                s = hoge[x] + hoge[y] + hoge[z]
                if s < m:
                    break
                if s == m:
                    data.append(s)

    print(len(data))

Measured memory_bytes: 6416
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        String date = sc.next();
        String[] dateArray = date.split("/",0);
        if(Integer.parseInt(dateArray[0]) < 2019){
            System.out.println("Heisei");
        } else if(Integer.parseInt(dateArray[0]) == 2019 && Integer.parseInt(dateArray[1]) <= 4){
            System.out.println("Heisei");
        } else{
            System.out.println("TBD");
        }
    }
}


Measured memory_bytes: 23764
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
p = [int(x) - 1 for x in input().split()]
c = list(map(int, input().split()))

#高々N回で1周する
class UnionFind(object):
    def __init__(self, n):
        self._par = list(range(n))
        self.size = [1] * n
 
    def root(self, v):
        if self._par[v] == v:
            return v
        self._par[v] = self.root(self._par[v])
        return self._par[v]
 
    def unite(self, u, v):
        u, v = self.root(u), self.root(v)
        if u == v:
            return False
        if self.size[u] > self.size[v]:
            u, v = v, u # size[u] <= size[v]
        self.size[v] += self.size[u]
        self._par[u] = v
 
    def same(self, u, v):
        return self.root(u) == self.root(v)

uf = UnionFind(n)
for i in range(n):
    uf.unite(i, p[i])

ans = []
for i in range(n):
    ite = uf.size[uf.root(i)]
    #print(ite)
    if k > ite:
        memo = [0 for _ in range(ite+1)]
        tmp = i
        for j in range(ite):
            tmp = p[tmp]
            memo[j+1] = memo[j] + c[tmp]
        div = k // ite
        mod = k % ite
        #print(memo)
        if memo[-1] <= 0:
            ans.append(max(memo[1:]))
        else:
            m = max(memo[1:])
            ans.append(max(max(memo[:mod+1]) + div * memo[-1], (div-1) * memo[-1] + m))
    
    else:
        memo = [0 for _ in range(k+1)]
        tmp = i
        for j in range(k):
            tmp = p[tmp]
            memo[j+1] = memo[j] + c[tmp]
        ans.append(max(memo[1:]))
        

print(max(ans))

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

int main()
{
    int N;
    cin >> N;
    ll d[N];
    for(int i = 0; i < N; ++i) cin >> d[i];
    ll res = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < i; ++j) res += d[i]*d[j];
    }
    cout << res << endl;
    return 0;
}

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

int main()
{
   ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c,t,i;
   cin>>a>>b>>c;
   if(a>c){
       cout<<0;
       return 0;
   }
   t=c/a;
   
   cout<<b*t;
    
}


Measured memory_bytes: 256
#include<cstring>
#include<string>
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int N;
int A[5];
int B[]={10,50,100,500};
int C[5];
int ans[5];
int calc(int tr){

  int sum = tr/500;
  C[3] = tr/500;
  tr -= 500 * (tr/500);

  sum += tr/100;
  C[2] = tr/100;
  tr -= 100 * (tr/100);

  sum += tr/50;
  C[1] = tr/50;
  tr -= 50 * (tr/50);

  sum += tr/10;
  C[0] = tr/10;

  return sum;
}
int main(){
  bool first = true;
  while( cin >> N && N ){
    if( !first ) cout << endl;
    first = false;
    for(int i=0;i<4;i++){
      cin >> A[i];
    }
    int mins = 1000,mint;
    for(int i=0;i<=A[0];i++){
      for(int j=0;j<=A[1];j++){
	for(int k=0;k<=A[2];k++){
	  for(int l=0;l<=A[3];l++){
	    //	    	    printf("%d %d %d %d\n",i,j,k,l);
	    int t = B[0]*i + B[1] *j + B[2]*k + B[3] * l;
	    if( t >= N ){
	      int tr = t-N;
	      int sum = A[0]+A[1]+A[2]+A[3]-i-j-k-l+calc(tr);
	      //    printf("%d %d %d\n",t,tr,sum);
	      if( mins > sum ){
		mins = sum;
		ans[0] = i;
		ans[1] = j;
		ans[2] = k;
		ans[3] = l;
	      }
	    }
	  }
	}
      }
    }
    for(int i=0;i<4;i++){
      if( ans[i] > 0 ){
	cout << B[i] << " " << ans[i] << endl;
      }
    }
  }
}

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

typedef long long ll;
#define re(n) cin >> n
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define ff(i,x,n) for(ll i=(int)x;i<(int)n;i++)
#define f(i,n) ff(i,0,n)
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define te(t) ll t; re(t); while(t--)
#define MOD 1000000007

int main(){
	ll x;
	re(x);
	if(x>=30){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
     
    using namespace std;
     
    int main() {
      long long n, a, b, c, d;
      cin >> n >> a >> b >> c >> d;
      n--;
      for (long long pos = 0; pos <= n; pos++) {
        long long from = a + c * pos - d * (n - pos);
        long long to = a + d * pos - c * (n - pos);
        if (from <= b && b <= to) {
          puts("YES");
          return 0;
        }
      }
      puts("NO");
      return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);

int N, W;
int v[100], w[100];
int dp[10001][101];

int main() {
	cin >> N >> W;
	rep(i, N) { cin >> v[i] >> w[i]; }

	rep(e, W+1){
		dp[e][0] = 0;
	}

	rep(i, N){
		int vv = v[i];
		int ww = w[i];
		rep(e, W+1){
			if(e < ww) {dp[e][i+1] = dp[e][i];}
			else{ dp[e][i+1] = max(dp[e][i], dp[e-ww][i]+vv); }
		}
	}

	cout << dp[W][N] << endl;
}

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

int main() {
	int n,m,a,b;
	bool ans = 0;
	cin >> n>>m;
	vector<int>island_1(n,0);
	vector<int>island_N(n, 0);
	while (m > 0) {
		cin >> a >> b;
		m--;
		if (a == 1 || b == 1) {
			if (a == 1)
				island_1[b - 1]++;
			else
				island_1[a - 1]++;
		}
		if (a == n || b == n) {
			if (a == n)
				island_N[b - 1]++;
			else
				island_N[a - 1]++;
		}
	}
	for (int i = 0;i < n;i++) {
		if (island_1[i] && island_N[i]) {
			ans = 1;
			break;
		}
	}
	if (ans)
		cout << "POSSIBLE" << endl;
	else
		cout << "IMPOSSIBLE" << endl;

	return 0;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define M 1000005
#define P 1000000007
#define LL long long
using namespace std;
int A[M],sum[M];
int main(){
	for(int i=1;i<=100000;i++){
		A[i]=A[i/10]+1;
		if(A[i]%2==0)sum[i]=sum[i-1];
		else sum[i]=sum[i-1]+1;
	}
	int n;
	cin>>n;
	printf("%d\n",sum[n]);
	return 0;
}

Measured memory_bytes: 4736
import collections
N, Q = map(int, input().split())
count = [0] * (N + 1)
g = [[] for _ in range(N+1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for _ in range(Q):
    v, val = map(int, input().split())
    count[v] += val
q = collections.deque()
q.append(1)
check = [0] * (N + 1)
while q:
    v = q.pop()
    check[v] = 1
    for u in g[v]:
        if check[u] == 1:
            continue
        count[u] += count[v]
        q.append(u)
print(*count[1:])

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

int main() {
int n;
int a[5001];
while(1){
	cin>>n;
	if(n==0){
		break;
	}
	for (int kkk=1;kkk<=n;kkk++){
		a[kkk]=0;
	}
	for (int kk=1;kk<=n;kk++){
		cin>>a[kk];
		
	}
	int high=a[1],sum=0;
	for(int i=1;i<=n;i++){
		sum=sum+a[i];
		if(sum>=high){
			high=sum;
		}
		if(sum<=0){
			sum=0;
		
	}}
cout<<high<<endl;

}
	return 0;
}

Measured memory_bytes: 1176
#include <stdio.h>
int main(void)
{
	int n,i,m=0,p=0,q=0;
	long long a[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]%4==0)
		  m++;
		else if(a[i]%2==0)
		  p++;
		else
		  q++;
	}
	if(m-q>=0||(m-q==-1)&&p==0)
	  printf("Yes");
	else
	  printf("No");
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
const int maxn = 510;
int dp[maxn][maxn], n, m, q;
map<pair<int,int>, int >cnt;

int recursion(int l, int r) {
    if(l > r) return 0;
    if(dp[l][r] != -1) return dp[l][r];
    return dp[l][r] = recursion(l+1, r) + recursion(l, r-1) - recursion(l+1, r-1) + cnt[mp(l,r)];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>n>>m>>q;

    int a, b;
    for(int i=0;i<m;i++) {
        cin>>a>>b;
        cnt[mp(a,b)] ++;
    }

    recursion(1, n);

    while(q--) {
        cin>>a>>b;
        cout<<dp[a][b]<<"\n";
    }

    return 0;
}


Measured memory_bytes: 9856
//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
typedef long long int  bigint ;
typedef std::vector< int > vi;
typedef std::vector< long long int > vll;
typedef std::vector< vi > vvi;

using namespace std ;

bigint knapsack( bigint volume[] , bigint weight[] , bigint N , bigint W ){
   
    bigint dp[N+1][W+1] ;
    for( int i = 0 ; i <= N ; i++ ){
        for( int j = 0 ; j <= W ; j++ ){
            if( i == 0 || j == 0 )
                dp[i][j] = 0 ;
        }
    }
    for( int i = 1 ; i <= N ; i++ ){
        for( int j = 1 ; j <= W ; j++ ){
            if( j < weight[i] ){
                dp[i][j] = dp[i-1][j] ;
            }
            else{
                dp[i][j] = max( volume[i] + dp[i-1][j-weight[i]] , dp[i-1][j] ) ;
            }
        }
    }
    return dp[N][W] ;
}
    
int main(){
    FAST();
    bigint N , W ; cin >> N >> W ;
    bigint value[N+1] , weight[N+1] ;
    for( int i = 1 ; i <= N ; i++ ){
        cin >> weight[i] >> value[i] ;
    }
    cout << knapsack(value, weight, N, W ) << endl ;
    return 0 ;
}




Measured memory_bytes: 79104
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,q;
  std::cin>>n>>q;

  std::vector<std::vector<ll>> graph(n);
  std::vector<ll> score(n),query(n,0);

  rep(i,0,n-1){
    ll a,b;
    std::cin>>a>>b;
    a--;b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  rep(i,0,q){
    ll p,x;
    std::cin>>p>>x;
    p--;
    query[p]+=x;
  }

  struct Point{ll now,prev,value;};

  std::queue<Point> que;

  que.push(Point{0,-1,0});

  while(que.size()){
    Point e=que.front();que.pop();
    score[e.now]=e.value+query[e.now];
    for(ll next:graph[e.now]){
      if(next!=e.prev){
        que.push(Point{next,e.now,e.value+query[e.now]});
      }
    }
  }

  rep(i,0,n)std::cout<<score[i]<<" ";

  return 0;
}

Measured memory_bytes: 22640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a;
  cin>>n;
  a=n%10;
  if(a==3)
    cout<<"bon"<<endl;
else if(a==0||a==1||a==6||a==8)
  cout<<"pon"<<endl;
  else
    cout<<"hon"<<endl;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  vector<int> dp(n, INF);
  dp[0]=0;
  for(int i=1; i<n; i++){
    for(int j=1; j<=min(i,k); j++){
      dp[i] = min(dp[i], dp[i-j]+abs(h[i-j]-h[i]));
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 4028
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x != None: x, y = x.left if key < x.key else x.right, x
    if y == None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result != None

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'f': print(['no','yes'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 55880
#include<iostream>
using namespace std;
int main(int argc, char const *argv[]) {
    string str;
    cin >> str;
    int think = 0;
    for(int i=0;i<str.length();i++){
        if(str[i]=='+'){
            think++;
        }else{
            think--;
        }
    }
    cout << think << endl;
    return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n = II()
A = LI()

ans = 0
right = 0
xor = 0
for left in range(n):
    while right < n and xor & A[right] == 0:
        xor ^= A[right]
        right += 1

    ans += right - left

    if left == right:
        right += 1
    else:
        xor ^= A[left]

    # print(left, right, ans)

print(ans)


Measured memory_bytes: 25504
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	int ba = 0, _a = 0, b_ = 0;
	int ans = 0;
	rep(i,n){
		string s;
		cin >> s;

		rep(j,s.size() - 1){
			if(s.substr(j, 2) == "AB") ans++;
		}

		if(s.front() == 'B' and s.back() == 'A') ba++;
		else if(s.front() == 'B') b_++;
		else if(s.back() == 'A') _a++;
	}
	//cout << ba << ' ' << _a << ' ' << b_ << endl;
	//show(ans);

	rep(i,1001){
		{
			int k = min(b_, ba);
			ans += k;
			ba -= k;
		}
		{
			int k = min(_a, ba);
			ans += k;
			ba -= k;
		}
	}
	ans += min(_a, b_);
	ans += max<int>(ba - 1, 0);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

void solve() {
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes";
    else cout << "No";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
    ///cin >> t;
    while(t--) solve(), cout << '\n';
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
      cerr << fixed << setprecision(20);
    }
} iosetup;

int main() {
  lint n;
  cin >> n;
  lint ans = 0, tmp = 10;
  if (n % 2 == 0) {
    while (tmp <= n) {
      ans += n / tmp;
      tmp *= 5;
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int Q = sc.nextInt();
		int H = sc.nextInt();
		int S = sc.nextInt();
		int D = sc.nextInt();
		int N = sc.nextInt();
		sc.close();
		//2L最安
		long s2 = Math.min(8*Q, 4*H);
		s2  = Math.min(s2, 2*S);
		s2 = Math.min(s2, D);
		//1L最安
		long s1 = Math.min(4*Q, 2*H);
		s1 = Math.min(s1, S);
		System.out.println((long)(N/2)*s2 + (long)(N%2)*s1);
	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N, M;
ll x[1010];
ll y[1010];
ll z[1010];

vector<ll> v;

int main () {
  cin >> N >> M;

  rep(i, N) {
    cin >> x[i] >> y[i] >> z[i];
  }

  ll ans = 0;

  for (auto p: {1LL, -1LL}) {
    for (auto q: {1LL, -1LL}) {
      for (auto r: {1LL, -1LL}) {
        v.clear();

        rep(i, N) {
          v.push_back(p * x[i] + q * y[i] + r * z[i]);
        }

        sort(All(v), greater<ll>());

        ll tmp = 0;
        Rep(i, M) {
          tmp += v[i];
        }

        ans = max(ans, tmp);
      }
    }
  }

  cout << ans << "\n";
}

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

using namespace std;

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

    if(a>b) {
        max = b;
        count = a;
    }else{
        max = a;
        count = b;
    }

    for(int i = 0; i < count; i++) {
        cout << max;
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int cnt = 0;
    rep(i, n-2){
        if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'){
            ++cnt;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int N, p[21234], a[212345], b[212345];

    cin >> N;
    REP(i, N)
    {
        cin >> p[i];
        a[i] = (i + 1) * N + 100;
        b[N - i - 1] = (i + 1) * N + 100;
    }

    REP(i, N)
    {
        b[p[i] - 1] += i;
    }

    REP(i, N)
    cout << a[i] << (i == N - 1 ? "\n" : " ");

    REP(i, N)
    cout << b[i] << (i == N - 1 ? "\n" : " ");

    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int a[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    rep(i,1,n)cin>>a[i];
    int q;cin>>q;
    while(q--){
        int val,l,r;
        cin>>l>>r>>val;
        cout<<count(a+l+1,a+r+1,val)<<endl;
    }
}
/* 

count(b,e,kb,e,k): print the number of the specific values kk in ab,ab+1,...,ae−1ab,ab+1,...,ae−1.
9
1 4 1 4 2 1 3 5 6
3
0 9 1
1 6 1
3 7 5
 */


Measured memory_bytes: 3220
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b_list = [int(input()) for _ in range(n)]

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b_list:
            card[i][j] = 1

for i in range(3):
    if sum(card[i]) == 3 or sum([card[0][i], card[1][i], card[2][i]]) == 3:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]]) == 3:
    print('Yes')
    exit()
print('No')

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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	bool flag = false;
	for (int i = 1; i <= B; i++) {
		if ((A*i) % B == C) {
			flag = true;
		}
	}

	string ans;
	if (flag) ans = "YES";
	else ans = "NO";
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=0x3f3f3f3f;
int main(){
	double a,b;
	cin>>a>>b;
	int x1,x2,y1,y2;
	x1=(int)ceil(a/0.08);
	x2=(int)ceil(b/0.1);
	int s=(a+1)*125;
	if(s%10==0) y1=(a+1)*12.5-1;
	else y1=(a+1)*12.5;
	y2=(b+1)*10-1;
	//printf("%d %d %d %d\n",x1,y1,x2,y2);
	if(x1>y2||x2>y1) printf("-1");
	else{
        printf("%d",max(x1,x2));
	}
	return 0;
}


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

void uncapitalize(std::string& str){
	for(int i=0; i<str.size(); i++)
		if('A' <= str[i] && str[i] <= 'Z')
			str[i] = str[i] - 'A' + 'a';
}

int main(){
	std::string w, t;
	int count = 0;
	std::cin >> w;
	uncapitalize(w);
	
	while(1){
		std::cin >> t;
		if(t == "END_OF_TEXT")
			break;
		uncapitalize(t);
		if(t == w)
			count++;
	}
	
	std::cout << count << std::endl;
	return 0;
}

Measured memory_bytes: 1192
import sys



input = sys.stdin.readline
N = int(input())
H = list(map(int,input().split()))

dp = 0
i = 0
dp = [0]*(N)
for i in range(1,N):
    if i ==1:
        dp[i] = dp[i-1] + abs(H[i]-H[i-1])
        continue
    dp[i] = min(dp[i-1] + abs(H[i]-H[i-1]),dp[i-2] + abs(H[i]-H[i-2]))

print(dp[N-1])
        

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    string input; cin>>input;
    ll a[4];
    rep(i,4) a[i]=input[i]-'0';

    for(int x=0;x<8;x++){
        ll sum=a[0];
        string s;
        s+=(char)(a[0]+'0');
        for(int i=0;i<3;i++){
            if(x & (1<<i) ){
                sum+=a[i+1];
                s+='+';
                s+=(char)(a[i+1]+'0');
            }else{
                sum-=a[i+1];
                s+='-';
                s+=(char)(a[i+1]+'0');
            }
        }
        if(sum==7){
            s+="=7";
            cout<<s<<endl;
            return 0;
        }
    }
    return 0;
}

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

int main()
{
    unsigned long a, b;
    cin >> a >> b;
    
    cout << a/b << ' ' << a%b << ' ';
    cout << fixed << setprecision(5) << a / (double) b << endl;
    
    return 0;
}


Measured memory_bytes: 3260
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

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



int main() {
    int N,M;
    cin >> N >> M;

    int ans1 = N*(N-1)/2;
    int ans2 = M*(M-1)/2;

    cout << ans1 + ans2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <math.h>
#include <stdio.h>
using namespace std;
int main(){
	int n,m,p;
	while(cin>>n>>m>>p,n||m||p){
		int num,sum=0;;
		for(int i=0;i<n;i++){
			int x;
			cin>>x;
			sum+=x;
			if(i==m-1){
				num=x;
			}
			
		}
		sum*=100;
		sum=sum*(100-p)/100;
		
		if(num==0){
			cout<<0<<endl;
		}else{
			cout<<sum/num<<endl;
		}
	}
	return 0;
}

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

int main()
{
  int N;

  cin >> N;

  vector<long long> A(N);

  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    if (A.at(i) == 0)
    {
      cout << 0 << endl;
      return 0;
    }
  }

  long long result = 1;

  for (int i = 0; i < N; i++)
  {
    if (A.at(i) <= 1000000000000000000 / result)
    {
      result *= A.at(i);
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << result << endl;
}


Measured memory_bytes: 4012
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		
		long A=sc.nextLong();
		long B=sc.nextLong();
		long C=sc.nextLong();
		long K=sc.nextLong();
		
		if(A+B<K) {
			long t=K-A-B;
			p(A-t);
		}else p(Math.min(K, A));
		
		
	}
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 35776
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll n;
  cin >> n;
  vll d(n);
  rep(i,n)cin >> d[i];

  vsort(d);

  ll r = d[sz(d) / 2 - 1];
  ll l = d[sz(d) / 2];

  ll ans = l - r;

  cout << ans << endl;
  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 1024
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();

        var dic = new Dictionary<int, int>();
        foreach(var c in s) {
            if (dic.ContainsKey(c)) dic[c]++;
            else dic[c] = 1;
        }

        return (dic.Count == 2 && dic.All(x => x.Value == 2)) ? Yes : No;
    }
}

Measured memory_bytes: 13152
#coding:utf-8
n = int(input())
x = list(map(int, input().split()))
ans = 100000000000000000000

for i in range(1, 101):
    p = i
    power = 0
    for j in range(n):
        power += (x[j] - p)*(x[j] - p)
    if power < ans:
        ans = power

print(ans)



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

namespace A
{

    class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLineStringSplit();
            Console.WriteLine($"{s[2]} {s[0]} {s[1]}");
            ReadLine();

        }

        //最大公約数
        static int gcd(int a, int b)
        {
            if (a > b) {
                return gcd(b, a);
            }

            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }

            return a;
        }

        //最小公倍数
        static int lcm(int a, int b) => a * b / gcd(a, b);

        /// <summary>
        /// コンビネーション
        /// </summary>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        public static string ReadLine() => Console.ReadLine();
        public static int ReadLineInt() => int.Parse(Console.ReadLine());
        public static string[] ReadLineStringSplit(char a = ' ') => ReadLine().Split(a).ToArray();
        public static int[] ReadLineIntSpilit(char a = ' ') => ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        static string[] GetAplhaLowerArray() => new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rep(i,a,n) for(int i=(a);i<=(n);++i)
#define dep(i,a,n) for(int i=(a);i>=(n);--i)
#define eps 1e-8
#define pi 3.1415926535897
#define sqr(x) ((x)*(x))
#define MAX(a,b) a=max(a,b)
#define MIN(a,b) a=min(a,b)
#define SZ(x) ((int)(x).size())
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define POSIN(x,y) (1<=(x)&&(x)<=n&&1<=(y)&&(y)<=m)
#define all(x) (x).begin(),(x).end()
#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#ifdef LOCAL
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...) 
#endif
typedef long long ll;
typedef double lf;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<lf,lf> pff;
typedef complex<double> CD;
const int inf=0x3f3f3f3f;
const int mo=1000000007;
inline void gn(long long&x){
	int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
	while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
template<class T1,class T2>inline void gn(T1&r,T2&s){gn(r),gn(s);}
template<class T1,class T2,class T3>inline void gn(T1&r,T2&s,T3&t){gn(r),gn(s),gn(t);}
template<class T1,class T2,class T3,class T4>inline void gn(T1&r,T2&s,T3&t,T4&u){gn(r),gn(s),gn(t),gn(u);}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
const int DX[]={1,0,-1,0},DY[]={0,1,0,-1};
ll powmod(ll a,ll b) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll powmod(ll a,ll b,ll mo) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//*******************************************

const int N=1111111,M=111111;
int l,m,n,t,C;
int a[N];
int main(){
#ifdef LOCAL
	freopen("C.in","r",stdin);//freopen("C.out","w",stdout);
#endif
	scanf("%d%d",&n,&m);
	rep(i,1,n)scanf("%d",&a[i]);
	rep(i,m+1,n)puts(a[i]>a[i-m]?"Yes":"No");
	return 0;
}


Measured memory_bytes: 4580
#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;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m,a,b,h;

	cin >> a >> b >> h >> m;
	double mn=(double)m/(double)60;
	double hr=((double)h+mn)/(double)12;
	
	hr*=(double)360;
	mn*=(double)360;

	double ang=abs(hr-mn);

	double d=3.14159265358979323846264338327950288419716939937510;


	ang/=(double)180;
	ang*=d;

	double sa=a,sb=b;

	double f=sqrt(sa*sa+sb*sb-2*a*b*cos(ang));

	printf("%.15lf\n",f);
}

Measured memory_bytes: 4216
#include<iostream>
#include<string>
#include<stdio.h>
#include <algorithm>
#include <set>
#include<math.h>
#include<vector>

using namespace std;

int main(){
    string s;
    cin >> s ;
    for(int i = 1;i < s.size();i++){
        s.erase(i,1);
    }
    cout << s << endl;

   
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define inf 99999999
#define itn int
#define NMAX 1000010 
int main(){
    FAST;
    string s;
    cin>>s;
    if(s=="ABC"){
        cout<<"ARC";
    }
    else{
        cout<<"ABC";
    }
    return 0;
}

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

using namespace std;

char s[15];

int f(int a,int b){
    int ans=0;
    while(a<=b){
        ans=ans*10+s[a]-'0';
        a++;
    }
    return ans;
}

//2019/04/30

int main()
{
    int y,m,d;
    cin>>s;
    y=f(0,3);
    m=f(5,6);
    d=f(8,9);
    if(y>2019)cout<<"TBD";
    else if(y<2018)cout<<"Heisei";
    else if(y==2019){
        if(m>4)cout<<"TBD";
        else if(m<4)cout<<"Heisei";
        else if(m==4){
            if(d>30)cout<<"TBD";
            else if(d<=30)cout<<"Heisei";

        }
    }
    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main(void)
{
  int len;
  char *s=(char *)malloc(128);
  scanf("%d",&len);
  scanf("%s",s);
  if(strlen(s)<=len){
    printf("%s\n",s);
  }else{
    for(int i=0;i<len;i++){
      printf("%c",*(s+i));
    }
    puts("...");
  }
}


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

int main()
{
    ll a,b,c,x,y,ans;
    while(~scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&x,&y))
    {
        ans=0;
        if(2*c<=a+b)
        {
            ans+=2*c*min(x,y);
            ll k=max(x,y)-min(x,y);
            if(x>y)
            {
                if(2*c<=a)
                    ans+=k*2*c;
                else
                    ans+=k*a;
            }
            else
            {
                if(2*c<=b)
                    ans+=k*2*c;
                else
                    ans+=k*b;
            }
        }
        else
            ans+=x*a+y*b;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
R, C, K = map(int, input().split())

V = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
    r, c, v = map(int, input().split())
    V[r][c] = v

dp0 = [[0]*(C+1) for _ in range(R+1)]
dp1 = [[0]*(C+1) for _ in range(R+1)]
dp2 = [[0]*(C+1) for _ in range(R+1)]
dp3 = [[0]*(C+1) for _ in range(R+1)]
for i in range(R+1):
    for j in range(C+1):
        v = V[i][j]

        max_p = 0
        if i > 0:
            max_p = max(dp0[i-1][j], dp1[i-1][j], dp2[i-1][j], dp3[i-1][j])

        la = lb = lc = ld = 0
        if j > 0:
            la = dp0[i][j-1]
            lb = dp1[i][j-1]
            lc = dp2[i][j-1]
            ld = dp3[i][j-1]

        dp0[i][j] = max(dp0[i][j], max_p, la)
        dp1[i][j] = max(dp0[i][j], max_p + v, lb, la + v)
        dp2[i][j] = max(dp2[i][j], lc, lb + v)
        dp3[i][j] = max(dp3[i][j], ld, lc + v)


print(max(dp0[R][C], dp1[R][C], dp2[R][C], dp3[R][C]))


Measured memory_bytes: 433808
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main()
{
    string S;
    cin >> S;
    int month = atoi(S.substr(5, 2).c_str());
    int day = atoi(S.substr(8, 2).c_str());
    if (month <= 4)
    {
        cout << "Heisei" << endl;
    }
    else
    {
        cout << "TBD" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  string a,b,c;
  cin >> a >> b >> c;
  
  char A = a[0] - 32;
  char B = b[0] - 32;
  char C = c[0] - 32;
  
  cout << A << B << C << endl;
  
  return 0;
}

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

vector<long long> s(5);
int main(){
    long long N;
    cin >> N >> s[0] >> s[1] >> s[2] >> s[3] >> s[4];
    sort(s.begin(), s.end());
    long long ans = ceil((double)N / s[0]) + 4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
@colors = [
    [0, "black", 0, 0, 0],
    [1, "blue", 0, 0, 255],
    [2, "lime", 0, 255, 0],
    [3, "aqua", 0, 255, 255],
    [4, "red", 255, 0, 0],
    [5, "fuchsia", 255, 0, 255],
    [6, "yellow", 255, 255, 0],
    [7, "white", 255, 255, 255]
]

def color str
    r = str[1..2].to_i(16)
    g = str[3..4].to_i(16)
    b = str[5..6].to_i(16)
    arr = []
    @colors.each{|index, name, rk, gk, bk|
        arr << [index, name, (r-rk)**2 + (g-gk)**2 + (b-bk)**2]
    }
    arr.sort_by{|i, n, d| [d, i]}.first[1]
end

while true
    line = gets.chomp
    break if line == "0"
    puts color(line)
end


Measured memory_bytes: 6988