akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,ans=0;cin>>n;
  rep(i,n) {
    cin>>a;
    while(a%2==0) {a/=2;ans++;}
  }
  print(ans);
  return 0;
}

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

using namespace std;

int main()
{
    long long int n, a, b;

    cin >> n >> a >> b;

    long long int ans = n / (a + b);

    ans = ans * a;
    ans = ans + min(a, n % (a+b));

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m;
  cin >> n >> m;
  vl x(n + 1), y(m + 1);
  cin >> x[0];
  cin >> y[0];
  rep(i, n) { cin >> x[i + 1]; }
  rep(i, m) { cin >> y[i + 1]; }
  sort(ALL(x));
  sort(ALL(y));
  if (x[n] < y[0]) {
    cout << "No War" << endl;
  } else {
    cout << "War" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N,Q = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
PX = [tuple(map(int,input().split())) for i in range(Q)]
es = [[] for _ in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)
ex = [0] * N
for p,x in PX:
    ex[p-1] += x

ans = [None] * N
def dfs(v=0,c=0,p=-1):
    c += ex[v]
    ans[v] = c
    for to in es[v]:
        if to==p: continue
        dfs(to,c,v)

dfs()
print(*ans)

Measured memory_bytes: 328180
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    string S;
    cin >> S;
    rep(i, 0, S.size()){
        if(i % 2 == 0){
            if(S.at(i) == 'L'){
                cout << "No" << endl;
                return 0;
            }
        }
        if(i % 2 == 1){
            if(S.at(i) == 'R'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int f(int x) {
  int s = 0;
  while (x > 0) {
    s += x % 10;
    x /= 10;
  }
  return s;
}

int main() {
  int n;
  cin >> n;
  if (n % f(n) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    int t,cnt=0;
    string s;
    cin >> t >> s;
    for(int i=0;i<=t-3;i++)
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
            cnt++;
    cout << cnt;
    return 0;
}


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

int mn[26],c[60][26];

int main(){
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        rep(j,s.size()){
            c[i][s[j]-'a']++;
        }
    }
    string ans="";
    rep(i,26)mn[i]=1e9;
    rep(i,n){
        rep(j,26){
            mn[j]=min(mn[j],c[i][j]);
        }
    }
    rep(i,26)if(mn[i]!=1e9)cout<<string(mn[i],char('a'+i));
    cout<<endl;
}

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

#define MAX 1000000001

struct Card{
    char suit;
    int value;
};

int partition(struct Card A[], int p, int r){
    int x = A[r].value;
    int i = p-1;
    for(int j = i+1; j < r; j++){
        if(A[j].value <= x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

void quickSort(struct Card A[], int p, int r){
    if(p < r){
        int q = partition(A, p, r);
        quickSort(A, p, q-1);
        quickSort(A, q+1, r);
    }
}

void merge(struct Card A[], int left, int mid, int right){
    int n1 = mid-left;
    int n2 = right-mid;
    struct Card L[n1+1];
    struct Card R[n2+1];
    for(int i = 0; i < n1; i++) L[i] = A[left+i];
    for(int i = 0; i < n2; i++) R[i] = A[mid+i];
    L[n1].value = MAX;
    R[n2].value = MAX;

    int li = 0;
    int ri = 0;

    for(int i = left; i < right; i++){
        if(L[li].value <= R[ri].value){
            A[i] = L[li];
            li++;
        }else{
            A[i] = R[ri];
            ri++;
        }
    }
}

void mergeSort(struct Card A[], int left, int right){
    if(left+1 < right){
        int mid = (left+right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main(){
    int n;
    cin >> n;
    struct Card A[n], B[n];
    for(int i = 0; i < n; i++){
        char s;
        int val;
        cin >> s >> val;
        A[i].suit = B[i].suit = s;
        A[i].value = B[i].value = val;
    }

    mergeSort(A, 0, n);
    quickSort(B, 0, n-1);

    bool isStable = true;
    for(int i = 0; i < n; i++){
        if(A[i].suit != B[i].suit){
            isStable = false;
            break;
        }
    }

    if(isStable)    cout << "Stable" << endl;
    else            cout << "Not stable" << endl;

    for(int i = 0; i < n; i++){
        cout << B[i].suit << " " << B[i].value << endl;
    }

    return 0;
}


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

int main() {
				// *constraint*
  int N;    	// 1<=N<=100
  char S;		// Si は'P' or 'W' or 'G' or 'Y'
  				// Si = 'p',Sj = 'W',Sk = 'G' を満たすi,j,kが存在する
  cin  >> N;
  bool hasY = false;
  int i = 0;
  while (i < N) {
    cin >> S;
    if(S == 'Y'){
      hasY = true;
      break;
    }
    i ++;
  }

  if(hasY){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }

}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int a,b;
double aa,bb,cc;
vector<int>v;
int main()
{
    cin>>a>>b;
    aa=a+b;
    bb=a-b;
    cc=a*b;
    cout<<max(aa,max(bb,cc))<<endl;
	return 0; 
}

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

public class Main {
    static int f[] = new int [45];
    
    public static int fib(int n){
        if (n == 0) return 1;
        if (n == 1) return 1;
        
        if (f[n-1] == 0){
            f[n-1] = fib(n-1);
        }
         if (f[n-2] == 0){
            f[n-2] = fib(n-2);
        }
        int ans = f[n-1] + f[n-2];
        
        return ans;
    }
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int N = in.nextInt();
        
        System.out.println(fib(N));

    }
    
}

Measured memory_bytes: 26304
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int a[N];
int ans[N];
int n;

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

Measured memory_bytes: 1152
S = input()

#print(S.count("R"))

con = S.count("R")

if con == 1:
    print(1)

elif con == 3:
    print(3)

elif con == 2:
    for j in range(3):
        if S[j] =="R":
            if S[j+1] =="R":
                print(2)
                break

            else:
                print(1)
                break

elif con == 0:
    print(0)


Measured memory_bytes: 9104
# coding:utf-8

_ = int(input())
h_list = [int(x) for x in input().split(' ')]

# 2回連続で-1の手順を適用しないといけない場合はアウト
# -1手順適用フラグ
big_f = False

no_f = False

for i, h in enumerate(h_list[:-1]):
    left = h_list[i]
    right = h_list[i+1]
    if left < right:
        big_f = False
        continue
    elif left == right:
        continue
    elif left - right == 1:
        if big_f:
            no_f = True
            break
        else:
            big_f = True
    elif left - right >= 2:
        no_f = True
        break

if no_f:
    print('No')
else:
    print('Yes')


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

typedef long long ll;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  set <string> ms;
  int n;
  string s;
  cin >> n;
  while (n--) {
    cin >> s;
    ms.insert(s);
  }
  cout << ms.size() << '\n';
  return 0;
}

Measured memory_bytes: 19288
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a*b==c*d)cout<<a*b;
  else cout<<(a*b>c*d?a*b:c*d);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong h, w, n;

int main() {
    cin >> h >> w >> n;
    if (h < w) swap(h, w);

    cout << (n + h - 1) / h << endl;

    return 0;
}


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

int main()
{
	string s;
	int i;
	cin >> i;
	s = to_string(i);

	if (s[0] == s[1] && s[1] == s[2])
	{
		cout << s << endl;
	}
	else 
	{
		while (true)
		{
			i++;
			s = to_string(i);
			if (s[0] == s[1] && s[1] == s[2])
			{
				cout << i << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {

  int a,b,c;

  std::cin >> a >> b >> c;

  int d = 0;

  for (int x = a; x <= b; x++) {
    if (c % x == 0) {
      d++;
    }
  }

  std::cout << d << '\n';

  return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c>a+b)cout<<"NA"<<endl;
    else{
	cout<<max(0,c-a)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3100
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)

	var X = make([][]int, n)
	for j := 0; j < n; j++ {
		var tmp = make([]int, d)
		for i := 0; i < d; i++ {
			fmt.Scan(&tmp[i])
		}
		X[j] = tmp
	}

	count := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			sum := 0.0
			for k := 0; k < d; k++ {
				sum += math.Pow(float64(X[i][k])-float64(X[j][k]), 2.0)
			}
			dis := math.Sqrt(sum)
			if dis == math.Trunc(dis) {
				count++
			}
		}
	}
	fmt.Println(count)

}


Measured memory_bytes: 512
#2019/10/01
N, *l_r = [list(map(int, i.rstrip("\n").split())) for i in open(0).readlines()]
#print(N, l_r)

print(sum([l_r[i-1][1] - l_r[i-1][0] + 1 for i in range(N[0])]))

Measured memory_bytes: 3444
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int ,int> P;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, d; cin >> H >> W >> d;
  FOR(i,0,H) {
    FOR(j,0,W) {
      int x = ((i + j) / d) % 2;
      int y = ((i - j + 1000 * d) / d) % 2;
      cout << (x==0?(y==0?'R':'Y'):(y==0?'G':'B'));
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 640
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る 
	input = input.split("\n");

	var array1 = input[0].split("");
	var array2 = input[1].split("");
	//console.log(array1);
	//console.log(array2);

	var flag = 0;
	for(var i=0;i<3;i++){
		if(array1[i] === array2[2-i]){
		}else{
			flag=1;	
		}
	}
	if(flag===0){
		console.log("YES");
	}else{
		console.log("NO");
	}

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int W = 6;
const int H = 12;
const int HW = H * W;

const int DEL = 4;

const int dxs[] = {1, 0, -1, 0}, dys[] = {0, 1, 0, -1};

/* typedef */

typedef pair<int,int> pii;
typedef queue<pii> qpii;
typedef vector<pii> vpii;

/* global variables */

char flds[H][W];
bool used[H][W];

/* subroutines */

bool del_blocks() {
  bool deleted = false;
  memset(used, false, sizeof(used));

  for (int y0 = 0; y0 < H; y0++)
    for (int x0 = 0; x0 < W; x0++) {
      if (used[y0][x0]) continue;
      used[y0][x0] = true;

      char ch = flds[y0][x0];
      if (ch == '.' || ch == 'O') continue;

      qpii q;
      vpii blk, oblk;

      pii st(x0, y0);
      q.push(st);
      blk.push_back(st);

      while (! q.empty()) {
	pii u = q.front(); q.pop();
	int& ux = u.first;
	int& uy = u.second;

	for (int di = 0; di < 4; di++) {
	  int vx = ux + dxs[di], vy = uy + dys[di];
	  if (vx >= 0 && vx < W && vy >= 0 && vy < H) {
	    if (! used[vy][vx] && flds[vy][vx] == ch) {
	      used[vy][vx] = true;
	      pii v(vx, vy);
	      q.push(v);
	      blk.push_back(v);
	    }
	    else if (flds[vy][vx] == 'O') {
	      used[vy][vx] = true;
	      oblk.push_back(pii(vx, vy));
	    }
	  }
	}
      }

      if (blk.size() >= DEL) {
	deleted = true;
	for (vpii::iterator vit = blk.begin(); vit != blk.end(); vit++)
	  flds[vit->second][vit->first] = '.';
	for (vpii::iterator vit = oblk.begin(); vit != oblk.end(); vit++)
	  flds[vit->second][vit->first] = '.';
      }
    }

  return deleted;
}

void drop() {
  for (int x = 0; x < W; x++) {
    int y0, y1;
    for (y0 = 0, y1 = 0; y0 < H; y0++)
      if (flds[y0][x] != '.') flds[y1++][x] = flds[y0][x];
    for (; y1 < H; y1++) flds[y1][x] = '.';
  }
}

void print_fields() {
  for (int y = H - 1; y >= 0; y--) {
    for (int x = 0; x < W; x++) putchar(flds[y][x]);
    putchar('\n');
  }
}

/* main */

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

  while (n--) {
    for (int y = H - 1; y >= 0; y--) {
      string line;
      cin >> line;
      for (int x = 0; x < W; x++) flds[y][x] = line[x];
    }
    //print_fields();

    int seq = 0;

    while (del_blocks()) {
      seq++;
      drop();
      //print_fields();
    }

    cout << seq << endl;
  }

  return 0;
}

Measured memory_bytes: 1212
s = gets.chomp!.to_i

a = s
ans = {}
ans[a] = 1

def f(n)
    if n % 2 == 0
        n / 2
    else
        3 * n + 1
    end
end

count = 1
loop do
    a = f(a)
    count += 1
    if ans[a]
        puts count
        break
    else
        ans[a] = 1
    end
end



Measured memory_bytes: 1788
let min_list list = List.fold_right min list max_int;;

let () = Scanf.scanf "%d\n%d\n%d\n%d\n%d\n%d" (fun n a b c d e -> 
  let min_val = min_list [a; b; c; d; e] in
    (if n mod min_val = 0 then n / min_val + 4
    else n / min_val + 5) |> print_int
);;

Measured memory_bytes: 2432
N, K = map(int, input().split())

sum = 0
R = 0

for i in range(1, N+1):
    Sold = sum
    Road = R
    j = 1
    if i >= K:
        sum += 1
    else:
        while i*(2**j) < K:
            j += 1
        X = 1/(2**j)
        collectX = Road + X
        sumNext = Sold + collectX
        DeltaS = sumNext - Sold
        Rnext = collectX - DeltaS
        sum = sumNext
        R = Rnext
#    print(sum, end="|")

print(sum/N)


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

using namespace std;

int n;
string s;

string a[]={"dream","dreamer","erase","eraser"};
int dp[100005];

bool solve(int ind){
	if(ind==n)
		return 1;
	
	if(dp[ind]!=-1)
		return dp[ind];
	
	bool ans=0;
	for(int i=0;i<4;i++){
		if(n-ind >= a[i].size()){
			if(s.substr(ind,a[i].size()) == a[i]){
				ans|=solve(ind+a[i].size());
			}
		}
	}
	
	return (dp[ind]=ans);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> s;
	n=s.size();
	
	memset(dp,-1,sizeof(dp));
	cout << (solve(0)?"YES":"NO") << endl;
	
	return 0;
}

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

int main() {
	int W;
	int H;
	int x;
	int y;
	int r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(r<=(y-0)&&r<=(x-0)&&r<=(H-y)&&r<=(W-x)){
	printf("Yes\n");
	}else{
	printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1012
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  long long int A, B;
  scanf("%lld%lld", &A, &B);
  
  if(A > 2*B){
    std::cout << A - 2*B << std::endl;
  }
  else{
    std::cout << 0 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S; cin >> S;
    S[3] = '8';
    cout << S << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int n,i,m,s=0;
    scanf("%d",&n);
    m=n;
    while(m/10!=0){
        s+=m%10;
        m=m/10;
    }
    s+=m;
    if(n%s==0)
        printf("Yes\n");
    else 
        printf("No\n");
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	int res = 0, cnt = 0;
	for (int i = 0; i < 3; ++i) {
		if (s[i] == 'R')
			cnt += 1;
		else {
			res = max(res, cnt);
			cnt = 0;
		}
	}
	res = max(res, cnt);
	cout << res << '\n';
}

Measured memory_bytes: 3604
x=int(input())
ans=[]
for a in range(1001):
    for b in range(-1000,1001):
        if a==b==0:
            pass
        else:
            if x%(a**4+a*a*a*b+a*a*b*b+a*b*b*b+b**4)==0:
                if a**5-b**5==x:
                    print(a,b)
                    exit()

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
#define INF 1000000
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<int, int> P;

struct edge{ int u, v; lli cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
	vector< vector<lli> > distance_matrix;
};


template <typename T>
vector<int> argsort(const vector<T> &v) {

  // initialize original index locations
  vector<int> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  sort(idx.begin(), idx.end(),
       [&v](int i1, int i2) {return v[i1] < v[i2];});

  return idx;
}

template<typename T>
void displayVector(vector<T> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}

int count_comb(int a, int b, int c){
  if(a!=b && b!=c){ return 6; }
  else if( a==b && b==c){ return 1; }
  else{ return 3; }
}

string sub(string str, int start, int end){
  // require : start < end
  return str.substr(start, end-start+1);
}

struct C{ int a; int b; };

int main(){
  int n, k; cin >> n >>k;
  vector<lli> res(n); 
  REP(i, n){ cin >> res[i]; }

  REP(i, n){
    if(i<k){ 
    } else{ 
      if(res[i] > res[i-k]){ cout << "Yes" << endl; 
      } else{ cout << "No" << endl; }
    }
  }
  return 0;
}

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

Measured memory_bytes: 584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {
 int a,b;
    cin>>a>>b;
    if(a+b>=10)fin("error");
    else fin(a+b);
    // cout<<((a+b<10)?(a+b):"error")<<endl;
}


Measured memory_bytes: 256
n,m=[int(i) for i in input().split()]
pp=[[0 for i in range(2)] for j in range(m)]
ans=0

#深さ優先探索---------------------------------
#参照元：Python3でグラフの実装＆深さ優先探索・幅優先探索の実装
#http://muromura.hatenablog.com/entry/2017/07/16/025414
def dfs(Graph, Start, Vn, Visited=None):
  
##追加（空から読んでも動くように修正）-----------------------
  if Graph[Start]==[] and Visited==None: 
        Next=Start+1        
        dfs(Graph, Next, Vn, Visited)  #再帰
  else:
##--------------------------------------------------------
    if (Visited==None):  Visited = [] #開始点のときに探索済みリストをつくる
    Visited.append(Start)  #現在の頂点を探索済みリストに加える
#    print(Start, "\n", Visited)  #現在の頂点と探索済みリストを表示
#    print(len(Visited))
    if len(Visited)==Vn:
        global ans
        ans=ans+1
    for Next in Graph[Start]:  #次に探索する頂点の候補
        if ( Next in Visited ):  continue  #訪問済みリストにある頂点は飛ばす
        dfs(Graph, Next, Vn, Visited)  #再帰
#--------------------------------------------------------        

for i in range(m) :
    pp[i] =[int(i) for i in input().split()]

for i in range(m) : #辺を１つ削除してその辺が橋かどうかを深さ優先探索で調べる
    p=pp[:]
    del p[i]

#隣接リスト
    l = [[] for i in range(n+1)] #頂点の数+1
    for pi in p:  #0-originedに注意
        l[pi[0]].append(pi[1])
        l[pi[1]].append(pi[0])
#    print(l)
    
    #頂点０（１）から探索
    dfs(l, 0, n)
#    print(ans)
print(m-ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void)
{
	int n,i,j,k,p,q,check,e;
	int ind[1001]={0};
	int po[1001]={0};
	
	while(scanf("%d",&n))
	{
		if(n==0)
		break;
		k = 0;
		for(i=0;i<n;i++)
		{
			check = 0;
			scanf("%d %d %d",&e,&p,&q);
			for(j=0;j<k;j++)
			{
				if(ind[j]==e)
				{
					po[j]+=p*q;
					check = 1;
					break;
				}
			}
			if(check==0)
			{
				ind[k] = e;
				po[k] = p*q;
				k++;
			}
		}
		check = 0;
		for(i=0;i<k;i++)
		{
			if(po[i]>=1000000)
			{
				printf("%d\n",ind[i]);
				check = 1;
			}
		}
		if(check==0)
		printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
string s;
int main(){
    cin>>s;
    if(s.size()%2==0){
        int cnt=0;
        for(int i=0;i<s.size()/2;i++){
            if(s[i]!=s[s.size()-1-i]) cnt++;
        }
        cout<<cnt<<endl;
    }
    else{
        int cnt1=0;
        int cnt2=0;
        for(int i=0;i<s.size()/2;i++){
            cnt1++;
            if(s[i]!=s[s.size()-1-i]) cnt2++;
            if(cnt1==s.size()) break;
        }
        cout<<cnt2<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N, K = map(int, input().split())
A = [int(i) for i in input().split()]
ans = 0

for i in range(K, N):
  ans = A[i]-A[i-K]
  if(ans<=0):
    print("No")
  else:
    print("Yes")




Measured memory_bytes: 97964
#include<bits/stdc++.h>
#define ll long long
#define R register
using namespace std;
const int N =2e6+200;
template <class Ruby_Rose> inline void read(Ruby_Rose &x)
{
 	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}
int n, ans, cnt, x[N], y[N], z[N], good[N];
inline int check()
{
	int flag=0;
	for(R int i=1; i<=cnt; i++)
	{
		if(good[x[i]] && good[y[i]]!=z[i])
		{
			flag=1; break;
		}
	}
	return (!flag);
}
inline void dfs(int u, int size)
{
	if(u==n+1)
	{
		if(check())ans=max(ans, size);
		return;
	}
	good[u]=0; dfs(u+1, size);
	good[u]=1; dfs(u+1, size+1);
}
int main()
{
	read(n);
	for(R int i=1, qa; i<=n; i++)
	{
		read(qa);
		for(R int j=1; j<=qa; j++)x[++cnt]=i, read(y[cnt]), read(z[cnt]);	
	}	
	dfs(1, 0);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6400
import sys

#+++++

def mk_next(pre, value):
	pre_v=pre[0]
	pre_p=pre[1]
	
	if value > pre_v:
		return (value, 'a')
	elif value == pre_v:
		return pre
	elif value +1 == pre_v and pre_p == 'a':
			return (value, 'u')
	else:
		return 'x'
			
def main():
	n = int(input())
	l = list(map(int, input().split()))
	st=(l[0], 'a')
	for v in l[1:]:
		st = mk_next(st, v)
		if st =='x':
			print('No')
			return 
	print('Yes')
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 14572
import sys
import numpy as np
input=sys.stdin.readline

n,k=map(int,input().split())
d=list(map(int,input().split()))
res=[]
for i in range(10):
  if i not in d:
    res.append(i)
ans=0
ansmax=0
ansmin=0
n_s=str(n)
l=len(n_s)
M=max(res)
for i in range(l):
    ansmax+=M*10**(l-i-1)
if n>ansmax:
    if res[0]!=0:
        ans=res[0]*10**l
    else:
        ans=res[1]*10**l
    for i in range(l):
        ans+=res[0]*10**(l-i-1)
    print(ans)
    exit()
res=np.array(res)
flag=False
for i in range(l):
    j=n//(10**(l-i-1))
    if not flag:
        if j not in res:
            p=np.searchsorted(res,j, side="left")
            m=res[p]
            ans+=m*10**(l-i-1)
            flag=True
            continue
        else:
            ans+=j*10**(l-i-1)
    if flag:
        ans+=res[0]*(10**(l-i-1))
    n=n%(10**(l-i-1))
print(ans)

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;

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

string s;
cin>>s;
int n=s.size();
if(n%2)
{
	if(s[0]==s[n-1])
	cout<<"Second";
	else
	cout<<"First";
}
else
{
	if(s[0]==s[n-1])
	cout<<"First";
	else
	cout<<"Second";
}
}








Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int main(){
  int K, N;
  rd(N);
  rd(K);
  if( (N+1)/2 >= K ){
    wt_L("YES");
    putchar_unlocked('\n');
  }
  else{
    wt_L("NO");
    putchar_unlocked('\n');
  }
  return 0;
}
// cLay varsion 20180730-1

// --- original code ---
// {
//   int N, K;
//   rd(N,K);
//   if( (N+1)/2 >= K ) wt("YES"); else wt("NO");
// }


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

int mypow(int mpx,int mpn){
	if(mpn==0) return 1;
	if(mpn%2==0) return mypow((mpx*mpx),mpn/2);
	else return (mpx*mypow(mpx,mpn-1));
} 

int main() {
	// your code goes here
	int n,i,j,ca=0,cb=0;
	long long s[300000],max=0,ma,mb,sm=1;
	vector<long long> nod;
	priority_queue<long long> a,b,c;
	cin >> n;
	for(i=0;i<mypow(2,n);i++){
		cin >> s[i];
		if(max<s[i]) max=s[i];
		a.push(s[i]);
	}
	sort(s,s+mypow(2,n));
	nod.push_back(s[0]);
	for(i=1;i<mypow(2,n);i++){
		if(s[i-1]!=s[i]) nod.push_back(s[i]);
	}
	for(i=0;i<n;i++){
		if(s[mypow(2,n)-mypow(2,i)]<=nod[n-i-1]){
			cout << "No" << endl;
			return 0;
		}
	}
	s[0]=1;
	for(i=1;i<=n;i++){
		for(j=mypow(2,i-1);j<mypow(2,i);j++){
			s[j]=s[j-mypow(2,i-1)]+1;
		}
	}
	for(i=0;i<mypow(2,n);i++){
		b.push(s[i]);
	}
	ma=a.top(); mb=b.top();
	a.pop(); b.pop();
	for(i=1;i<mypow(2,n);i++){
		if(ma>a.top()) ca++;
		if(mb>b.top()) cb++;
		if(cb>ca){
			cout << "No" << endl;
			return 0;
		}
		ma=a.top(); mb=b.top();
		a.pop(); b.pop();
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 9712
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back
bool ans=0;
void f(int a,int b,int c,int k)
{
    if(a<b && b<c)
    {
        ans=1;
        return;
    }
    if(k==0)
    {
        return;
    }
    f(2*a,b,c,k-1);
    f(a,2*b,c,k-1);
    f(a,b,2*c,k-1);
}
void solve()
{
    int a,b,c,k;cin>>a>>b>>c>>k;
    f(a,b,c,k);
    if(ans)
        cout<<"Yes"<<nl;
    else
        cout<<"No"<<nl;
}

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

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 

int main() {
    ll h;
    cin >> h;
    int i= 0;
    while(h>=pow(2,i)){
        i++;
    }
    cout << setprecision(13) << pow(2,i) -1 << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

const int N = 2500 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 3e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

#define int ll

typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, cnt[2], x, p, c[55][55], ans;
main() {
    file("censor");
    ios;
    cin >> n >> p;
    fo(i, 1, n, 1) cin >> x, cnt[x % 2]++;
    fo(i, 0, 50, 1) {
        c[i][0] = c[i][i] = 1;
        fo(j, 1, i - 1, 1) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
    fo(i, 0, n, 1) {
        fo(j, 0, n, 1) {
            if (i <= cnt[0] and j <= cnt[1]) {
                if (j % 2 == p) {
                    ans += c[cnt[0]][i] * c[cnt[1]][j];
                }
            }
        }
    }
    cout << ans;
    return 0;
}
/**

*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define all(x) (x).rbegin(), (x).rend()
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;
    int arr[5]={0};
    for(int i=0;i<n;i++)
    {
        string x;
        cin>>x;
        if(x=="AC"){
            arr[0]++;
        }else if(x=="WA"){
        arr[1]++;
        }else if(x=="TLE"){
        arr[2]++;
        }else{
        arr[3]++;
        }

    }
   cout<<"AC x "<<arr[0]<<endl;
   cout<<"WA x "<<arr[1]<<endl;
   cout<<"TLE x "<<arr[2]<<endl;
   cout<<"RE x "<<arr[3];

    return 0;

}


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

using namespace std;

long long cnt[1000000]={};
int main(void){
    long long N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++){
        int a,b;
        cin>>a>>b;
        cnt[a]+=b;
    }
    long long sum=0;
    for(int i=0;i<100001;i++){
        cnt[i]+=sum;
        sum=cnt[i];
    }
    
 
    for(int i=0;i<100001;i++){
        if(K<=cnt[i]){
            cout<<i<<endl;
            return 0;
        }
 
    }
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main ( )
{
	char c ;
	while ( true ) {
		c = getchar ( ) ;
		if ( c == EOF ) {
			break ;
		}
		else if ( c == '\n' ) {
			putchar ( '\n' ) ;
		}
		else if ( c >= 'A' && c <= 'Z' ) {
			c -= 3 ;
			if ( c < 'A' ) {
				c += 26 ;
			}
			putchar ( c ) ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n=n%10;
	//cout<<n;
	if(n==2||n==4||n==5||n==7||n==9)
	{
		cout<<"hon";
	}
	else if(n==0||n==1||n==6||n==8)
	{
		cout<<"pon";
	}
	else cout<<"bon";
	return 0; 
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1.0e-4;
const double EPS = 1.0e-10;
double solve(double d, double r1, double r2) {
    double p = (d + r1 + r2) * 0.5;
    double s = sqrt(p * (p - d) * (p - r1) * (p - r2));
    double c1 = (r1 * r1 + d * d - r2 * r2) / (2 * r1 * d);
    double c2 = (r2 * r2 + d * d - r1 * r1) / (2 * r2 * d);
    return r1 * r1 * acos(c1) + r2 * r2 * acos(c2) - 2 * s;
}
int Uw, Uh, A, B, AB;
int main() {
    while(scanf("%d %d %d %d %d", &Uw, &Uh, &A, &B, &AB) == 5 && Uw) {
        double rA = sqrt(A / pi), rB = sqrt(B / pi);
        double l = abs(rA - rB), r = abs(rA + rB), d;
        for(int i = 0; i < 100; i ++) {
            d = (l + r) * 0.5;
            if(solve(d, rA, rB) + EPS < AB) {
                r = d;
            } else {
                l = d;
            }
        }
        double a1 = Uw - rA - rB;
        double a2 = Uh - rA - rB;
        double dd = sqrt(a1 * a1 + a2 * a2);
        double dx = d / dd * a1;
        double dy = d / dd * a2;
        double ax = rA, ay = rA, bx = ax + dx, by = ay + dy;
        if(a1 * a1 + a2 * a2 + EPS < d * d) {
            goto impossible;
        }
        if(bx < rB + eps) {
            double delta = rB - bx;
            ax += delta;
            bx += delta;
        }
        if(by < rB + eps) {
            double delta = rB - by;
            ay += delta;
            by += delta;
        }
        if(!(ax + eps > rA && ax < Uw - rA + eps)) {
            goto impossible;
        }
        if(!(ay + eps > rA && ay < Uh - rA + eps)) {
            goto impossible;
        }
        if(!(bx + eps > rB && bx < Uw - rB + eps)) {
            goto impossible;
        }
        if(!(by + eps > rB && by < Uh - rB + eps)) {
            goto impossible;
        }
//        printf("%.10f %.10f %.10f\n", l, rA, rB);
        printf("%.10f %.10f %.10f %.10f %.10f %.10f\n", ax, ay, rA, bx, by, rB);
//        assert(ax + eps > rA && ax < Uw - rA + eps);
//        assert(ay + eps > rA && ay < Uh - rA + eps);
//        assert(bx + eps > rB && bx < Uw - rB + eps);
//        assert(by + eps > rB && by < Uh - rB + eps);
//        assert(abs(d * d - (ax - bx) * (ax - bx) - (ay - by) * (ay - by)) < eps);
        continue;
        impossible:
            printf("impossible\n");
    }
    return 0;
}

Measured memory_bytes: 3384
use proconio::input;
use proconio::marker::Chars;

macro_rules! chmax {
    ($max_v: expr, $v: expr) => {
        if $v > $max_v {
            $max_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        s: Chars,
        t: Chars,
    };
    let mut dp = vec![vec![0; t.len() + 1]; s.len() + 1];
    for (i, &s_i) in s.iter().enumerate() {
        for (j, &t_i) in t.iter().enumerate() {
            if s_i == t_i {
                chmax!(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            chmax!(dp[i + 1][j + 1], dp[i + 1][j]);
            chmax!(dp[i + 1][j + 1], dp[i][j + 1]);
        }
    }

    let mut p = (s.len(), t.len(), vec![]);
    while p.0 > 0 && p.1 > 0 {
        p = if dp[p.0 - 1][p.1] == dp[p.0][p.1] {
            (p.0 - 1, p.1, p.2)
        } else if dp[p.0][p.1 - 1] == dp[p.0][p.1] {
            (p.0, p.1 - 1, p.2)
        } else {
            p.2.push(s[p.0 - 1]);
            (p.0 - 1, p.1 - 1, p.2)
        }
    }
    println!("{}", p.2.iter().rev().collect::<String>());
}


Measured memory_bytes: 37324
import math

A, B, H, M = map(int, input().split())

c = math.cos(math.radians(360 - abs(30 * H + 0.5 * M - 6 * M)))
X_2 = A ** 2 + B ** 2 - 2 * A * B * c
X = math.sqrt(X_2)

print(X)

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

int n;
long double temp,sum=0;
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    

    cin>>n;
    rep(i,1,n)
    {
        cin>>temp>>s;
        if(s=="BTC")
            sum+=temp*380000;
        else
            sum+=temp;
    }
    cout<<setprecision(20)<<sum;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define SIZE 11

int main(void)
{
    char s1[SIZE], s2[SIZE], s3[SIZE];
    int a, b;

    scanf("%s %s %s", s1, s2, s3);
    a = strlen(s1);
    b = strlen(s2);
    if (s1[a-1] == s2[0] && s2[b-1] == s3[0])
    printf("YES");
    else
    printf("NO");

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
  int n,k;cin  >> n >> k;
  int count = 0;
  for(int i = 0;i<n;i++) {
    int a;cin >> a;
    if(a>=k) count++;
  }
  cout << count << endl;
  return 0;
}

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

const int maxn = 2005;
const int P = 924844033;
int n, k, fact[maxn], dp[2][maxn][2][2];

void update(int &a, int b) {
	a += b;
	(a >= P) && (a -= P);
	(a < 0) && (a += P);
}

int main() {
	scanf("%d %d", &n, &k);
	fact[0] = 1;
	for (int i = 1; i <= 2000; i++) {
		fact[i] = 1ll * fact[i - 1] * i % P;
	}
 	int cur = 0, nxt = 1;
 	dp[0][0][1][0] = 1;
	for (int x = 1; x <= k; x++) {
		for (int j = x; j <= n; j += k) {
			memset(dp[nxt], 0, sizeof(dp[nxt]));
			for (int i = 0; i <= n; i++) {
				for (int v0 = 0; v0 < 2; v0++) {
					for (int v1 = 0; v1 < 2; v1++) {
						if (dp[cur][i][v0][v1]) {
							if (j + k > n) {
								update(dp[nxt][i][1][0], dp[cur][i][v0][v1]);
								if (v0 == 0) {
									update(dp[nxt][i + 1][1][0], dp[cur][i][v0][v1]);
								}
							} else {
								update(dp[nxt][i][v1][0], dp[cur][i][v0][v1]);
								if (v0 == 0) {
									update(dp[nxt][i + 1][v1][0], dp[cur][i][v0][v1]);
								}
								update(dp[nxt][i + 1][v1][1], dp[cur][i][v0][v1]);
							}
						}
					}
				}
			}
			swap(cur, nxt);
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		int temp = 0;
		for (int v0 = 0; v0 < 2; v0++) {
			for (int v1 = 0; v1 < 2; v1++) {
				update(temp, dp[cur][i][v0][v1]);
			}
		}
		temp = 1ll * temp * fact[n - i] % P;
		if (i & 1) {
			update(ans, -temp);
		} else {
			update(ans, temp);
		}
	}
	printf("%d\n", ans);
	return 0;//
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

  int P,Q,R,min;
  
  
  scanf("%d %d %d",&P,&Q,&R);
  
  if((Q+R)>(P+R))min = P+R;
  else min = Q+R;
  if((P+Q)<min)min = P+Q;
  
  printf("%d",min);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
#define out(a) printf("%d",a)
#define ln printf("\n")
const int N=1e5+50;
const int MOD=1e9+7;
const int inf=0x7f7f7f7f;
using namespace std;
int n;
char s[N];
int main()
{
	scanf("%d",&n);
	scanf("%s",s);
	if (n>=3200) puts(s);
	else puts("red");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 2e5 + 7;

int a[N], bit[N];

int qry(int pos) {
	int ret = 0;
	for(;pos;pos-=pos&-pos)
		ret += bit[pos];
	return ret;
}

void add(int pos) {
	for(;pos < N;pos += pos&-pos)
		bit[pos]++;
}

signed main()
{
	IO_OP;
	
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> a[i];
	vi v;
	for(int i = 1; i <= n; i++) a[i] += a[i-1];
	for(int i = 0; i <= n; i++) a[i] -= i * k, v.PB(a[i]);
	sort(ALL(v));
	v.resize(unique(ALL(v))-v.begin());
	int ans = 0;
	for(int i = 0; i <= n; i++) {
		int tt = lower_bound(ALL(v), a[i]) - v.begin() + 1;
		ans += qry(tt);
		add(tt);
	}
	cout << ans << endl;
}






Measured memory_bytes: 5104
n = int(input())
h = [list(map(int, input().split())) for i in range(n)]
dp = [h[0]]
for i in range(1,n):
    dp.append([max(dp[i-1][1],dp[i-1][2]) + h[i][0],
               max(dp[i-1][0],dp[i-1][2]) + h[i][1],
               max(dp[i-1][0],dp[i-1][1]) + h[i][2]])
print(max(dp[-1]))

Measured memory_bytes: 70616
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int a[] = new int[10001];
    
    for(int i = 0; i < 10001; i++)
      a[i] = 0;

    for(int i=1; i <= 100; i++){
      for(int j=1; j<= 100; j++){
        for(int k=1; k<=100; k++){
          int r = i*i + j*j + k*k + i*j + i*k + j*k;
          if(r < 10001) {
            a[r]++;
          }
        }
      }
    }
    for(int i = 1; i <= n; i++)
      System.out.println(a[i]);
  }
}


Measured memory_bytes: 30068
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

int a[30];
int main(){
	int n;
	rep(i,11){
		a[i]=1150;
	}
	reep(i,11,21){
		a[i]+=a[i-1]+125;
	}
	reep(i,21,31){
		a[i]+=a[i-1]+140;
	}
	while(cin>>n,n!=-1){
		if(n>30){
			cout<<-a[30]-(n-30)*160+4280<<endl;
		}
		else{
			cout<<-a[n]+4280<<endl;
		}
	}
}

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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

bool reach(string& s, int l, int r) {
	FOR(i, l, r)if (s[i] == '#' && s[i + 1] == '#')return false;
	return true;
}

bool cross(string &s, int l, int r) {
	FOR(i, l, r + 1)if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')return true;
	return false;
}

int main()
{
	int N, A, B, C, D;
	string S;
	cin >> N >> A >> B >> C >> D >> S;
	A--; B--; C--; D--;

	if (!reach(S, A, C) || !reach(S, B, D)) {
		cout << "No" << endl;
		return 0;
	}
	if (D < C && !cross(S, B, D)) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 640
def v_block():
    block.insert(0, [' ']*5)
    for l, line in enumerate(block):
        if line[q-1:q+p-1] != [' ']*p:
            break
    else:
        l += 1
    block[l-1][q-1:q+p-1] = ['*']*p
    return delete()


def h_block():
    for _p in range(p):
        block.insert(0, [' ']*5)
    for l, line in enumerate(block):
        if line[q-1] == '*':
            break
    else:
        l += 1
    for _l in range(l-1, l-p-1, -1):
        block[_l][q-1] = '*'
    return delete()
                

def delete():
    l = 0
    while True:
        if block[l] == [' ']*5 or block[l] == ['*']*5:
            del block[l]
        else:
            l += 1
        if len(block) == l:
            return


def count():
    x = 0
    for line in block:
        for b in line:
            if b == '*':
                x += 1
    else:
        print(x)


while True:
    n = int(input())
    if n == 0:
        break
    block = [[' ']*5]
    for i in range(n):
        d, p, q = map(int, input().split())
        if d == 1:
            v_block()
        else:
            h_block()
    else:
        count()

Measured memory_bytes: 8300