akhauriyash/Code-Regression huggingface dataset:
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//結局、メモ化すれば大丈夫
vector<vector<int>>ko;
vector<int>p;
map<tuple<int,int,int>,tuple<int,int,int>>memo;
tuple<int,int,int> solve(int ter,int A,int B){
	if(ko[ter].size()==0){return mt(p[ter],1,1);}
	if(memo.count(mt(ter,A,B))){return memo[mt(ter,A,B)];}
	SO(ko[ter]);
	int syo=mod,dai=0;
	int ret=-mod;
	do{
		int nA=A;
		int gs=0,gd=0;
		for(auto it:ko[ter]){
			int val,ss,sd;
			tie(val,ss,sd)=solve(it,-B,-nA);
			gs+=ss;gd+=sd;val*=-1;
			if(val>=B){nA=val;break;}
			maxeq(nA,val);
		}
		//if(ret!=nA&&ret!=-mod&&nA<B){cerr<<"bag"<<ret<<" "<<ter<<endl;}
		ret=nA;
		mineq(syo,gs);
		maxeq(dai,gd);
	}while(next_permutation(ko[ter].begin(),ko[ter].end()));
	memo[mt(ter,A,B)]=mt(ret,syo,dai);
	return mt(ret,syo,dai);
}
int main(void){
	int n,i,j;cin>>n;
	p.res(n);
	ko.res(n);
	for(i=0;i<n;i++){cin>>p[i];}
	for(i=0;i<n;i++){
		int d;cin>>d;
		while(d--){
			int c;cin>>c;c--;
			ko[i].pub(c);
		}
	}
	int ret,syo,dai;
	tie(ret,syo,dai)=solve(0,-10001,10001);
	cout<<syo<<" "<<dai<<endl;
	return 0;
}



Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long x = sc.nextLong();
		long yokin = 100;
		int nen = 0;

		while (true){
			nen++;
			yokin = (long) Math.floor(yokin * 1.01);
			if (yokin >= x){
				System.out.println(nen);
				break;
			}
		}
	}
}

Measured memory_bytes: 27116
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// long t = System.currentTimeMillis();
		new Main().run();
		// System.err.println(System.currentTimeMillis() - t);
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		solver(sc.nextLong(), sc.nextLong());
	}

	void solver(long n, long a) {
		long ans = n;
		for (int m = 2; m <= 40; ++m) {
			long c = (long) Math.pow(n, 1.0 / m);
			for (long i = Math.max(c - 2, 2); i <= c + 2; ++i) {
				if (a != 0 && a * (m - 1) / a != m - 1)
					continue;
				if (Math.log(i) * (m - 1) > 40 * Math.log(2))
					continue;
				for (int j = 0; j <= m - 1; ++j) {
					long res = a * (m - 1);
					res += j * i + (m - 1 - j) * (i + 1);
					long den = pow(i, j) * pow(i + 1, m - 1 - j);
					if (den == 0)
						continue;
					res += (n + den - 1) / den;
					ans = Math.min(ans, res);
				}
			}
		}
		System.out.println(ans);
	}

	long pow(long a, long n) {
		long ret = 1;
		for (; n > 0; n >>= 1, a *= a) {
			if (n % 2 == 1) {
				ret *= a;
			}
		}
		return ret;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 24916
n = int(input())
a = [int(i) for i in input().split()]
counter = 0
for i in range(1,n-1):
    if a[i] == a[i-1]:
        counter += 1
        a[i] = max([a[i-1],a[i+1]])+1
if a[n-1] == a[n-2]:
        counter += 1
print(counter)





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

void init(vector<int> &uf) {
  int n=static_cast<int>(uf.size());
  rep(i,n) {
    uf[i]=i;
  }
}

int root(vector<int> &uf, int i) {
  if(uf[i]==i) return i;
  return uf[i]=root(uf,uf[i]);
}

void unite(vector<int> &uf, int a, int b) {
  a = root(uf,a);
  b = root(uf,b);
  if(a==b) return;
  uf[a]=b;
}

int main() {
  int n,m;cin>>n>>m;
  vector<int> uf(m+1);
  set<int> s;
  init(uf);
  rep(_i,n) {
    int k;cin>>k;
    int l1;cin>>l1;
    s.insert(l1);
    rep(i,k-1) {
      int l2;cin>>l2;
      s.insert(l2);
      unite(uf,l1,l2);
    }
  }
  set<int> a;
  for(auto &x : s) {
    a.insert(root(uf,x));
  }
  if(a.size()==1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<iomanip>
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) loop(i,0,n)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<pii> vp;
typedef vector<vi> vvi;
typedef vector<string> vs;
Def inf = sizeof(Def) == sizeof(ll) ? 2e18:1e9+10;
int main(){
	int a,b,c;
	while(cin>>a>>b>>c,a){
		int out=0;
		loop(i,1,1100)loop(j,1,1100){
			int x=i*(100+a)/100;
			int y=j*(100+a)/100;
			if(x+y==c){
				out=max(out,i*(100+b)/100+j*(100+b)/100);
			}
		}
		cout<<out<<endl;
	}
}


Measured memory_bytes: 3088
def odd(x):
	if len(x)%2==1:
		return False
	else:
		if x[:(len(x)//2)] == x[(len(x)//2):]:
			return True
		else:
			return False

s = input()
num = 0
while True:
	num += 1
	if odd(s[:(len(s)-num)]):
		print(len(s)-num)
		break


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define x first
#define y second
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)
#define mem(i) memset((i), (-1), (sizeof(i)))
using namespace std;

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

int n, w;
int a[100][2];
ll dp[100][100001];

ll f(int x, int y)
{
	if (x == n) return 0;
	ll &ret = dp[x][y];
	if (ret != -1) return ret;

	ret = f(x + 1, y);
	if (y + a[x][0] <= w) ret = max(ret, f(x + 1, y + a[x][0]) + a[x][1]);
	return ret;
}

int main()
{
	fastio;
	cin >> n >> w;
	rep(i, 0, n) cin >> a[i][0] >> a[i][1];
	mem(dp);
	cout << f(0, 0) << '\n';
}

Measured memory_bytes: 78336
n, m = map(int, input().split())
Authority = [list(map(int, input().split())) for _ in range(m)]
cards = list(range(1, n + 2))
l_list = []
r_list = []
for i in range(m):
    l_list.append(Authority[i][0])
    r_list.append(Authority[i][1])
        
print(len(cards[max(l_list):min(r_list) + 1]))


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


#define lld long long 

		

void solve()
{
	lld n ;
	cin>>n;
	lld a[n];
	for(lld i=0;i<n;i++)
	{
		cin>>a[i];
	}
	/*lld b[n+1][n+1];
	memset(b,0,sizeof(b));
	for(lld i=2;i<=n;i++)
	{
		for(lld j=0;j<=n;j++)
		{
			if(j<i)
			{
				b[i][j]=b[i-1][j];
			}
			else
			{
				b[i][j]=min(b[i-1][j-1]+abs(a[i-1]-a[i-2]),b[i-1][j-2]+abs(a[i-1]-a[i-3]));
			}
		}
	}*/
	/*for(lld i=0;i<=n;i++)
	{
		for(lld j=0;j<=n;j++)
		{
			cout<<b[i][j]<<" ";
		}
		cout<<"\n";
	}*/
	lld dp[n+1];
	memset(dp,0,sizeof(dp));
	for(lld i=2;i<=n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i-1]-a[i-2]),dp[i-2]+abs(a[i-1]-a[i-3]));
	}	
	cout<<dp[n]<<"\n";




}
	
				


int main()

{
	solve();
	
}

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

  char a[301];
  int result=0,c[4]={0},i;

  scanf("%s",a);

  for(i = 0; a[i] != '\0'; i++){

    if(a[i] == 'K') c[0]++; 
    if(a[i] == 'U') c[1]++;
    if(a[i] == 'P') c[2]++;
    if(a[i] == 'C') c[3]++;

    if(c[0] >= 1 && c[1] >= 1 && c[2] >= 1 && c[3] >= 1){

      result++;
      c[0]--;
      c[1]--; 
      c[2]--;
      c[3]--;

    }

  }

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

  return 0;

}

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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> result(n);
  for (int i=1; i<n; i++){
    for(int j=i+1; j<=n; j++){
      int d = min(j-i,abs(x-i)+1+abs(y-j));
      // cout << d << endl;
      result[d] += 1;
    }
  }
  for(int i=1; i<n;i++){
    cout << result[i] << endl;
  }
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	a, b := nextInt(), nextInt()
	sur := surfaceArea(a, b)
	lap := lapLength(a, b)
	fmt.Println(sur, lap)
}

func lapLength(a int, b int) int {
	return 2*a + 2*b
}

func surfaceArea(a int, b int) int {
	return a * b
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	int n, k;
  cin >> n >> k;

  double ans = max(0, n - k + 1);
  for(int i = 1; i <= min(n, k - 1); ++i)
  {
    double prob = pow( 2, (int)( -0.0000001 - ceil( log(k / (double)i) / log(2) ) ) );
    // cout << prob << " = " << (int)(-0.0000001 - ceil( log(k / (double)i) / log(2) ) ) << endl;
    ans += prob;
  }
  printf("%.10f\n", ans / (double)n);
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

#define int long long
#define f first

#define s second
using namespace std;

template<typename T> using vc = vector<T>;
using pii=pair<int, int>;

void xmax(int & a, int b){
    a=max(a, b);
}
void xmin(int& a, int b){
    a=min(a, b);
}

void print(vc <int> & a, string s){
    cerr << s << " : ";
    for (int i=0; i<a.size(); i++){
        cerr <<a[i] << " ";
    }
    cerr << endl;
}


vc <string> res;

void do_it(int n, int k, string beg){
    assert(n>=0);
    if (n==0) {
        res.push_back(beg);
        return;
    }
    for (int i=0; i<k; i++){
        char c = 'a'+i;
        do_it(n-1, k, beg+c);
    }
    char c = 'a'+k;
    do_it(n-1, k+1, beg+c);
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifdef LOCAL_RUN
    freopen("input.txt", "r", stdin);
    int ttt;
    cin >> ttt;
    while(ttt--){
    #endif // LOCAL_RUN
    int n;
    cin >> n;
    res.clear();
    string e = "";
    do_it(n, 0, e);
    for (auto x : res){
        cout << x << "\n";
    }

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
}



Measured memory_bytes: 7796
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) FOR(i, 0, n - 1)
using namespace std;
typedef long long ll;
template <class T> inline bool dpmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool dpmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(string S) {
    int ans = 0;
    ll n = S.size();
    string sub;
    ll len_sub;
    string subsub_l, subsub_r;

    for (int i = 1; i < n; i++) {
        sub = S.substr(0, i);
        if (sub.size()%2 != 0) {
            continue;
        } else {
            len_sub = sub.size() / 2;
            subsub_l = sub.substr(0, len_sub);
            subsub_r = sub.substr(len_sub, len_sub);
            if (subsub_l == subsub_r) {
                /* cout << subsub_l << " - " << subsub_r << endl; */
                if (ans < sub.size()) {
                    ans = sub.size();
                }
            }
        }
    }

    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 3620
/* ex7_3
   seira3 */

#include <stdio.h>
#include <stdlib.h>

int arrayIn(int obj,int size, int arr[]){ //objがarr内にあるかどうかを判別する関数,あれば1なければ0を返す
    int count = 0;
    for(int i = 0; i < size; i++){
        if(arr[i]==obj){
            count++;
            break;
        }
    }
    return count;
}

int main(void){
    int row, line, count, countRow, countLine, i, j; //変数宣言
    char **square; //元の迷路の二次元配列のポインタ
    int *whiteRow, *whiteLine; //行,列全て'.'の番号を記憶する配列のポインタ
    scanf("%d %d",&row,&line); //rowとlineに入力
    square = (char**)calloc(row, sizeof(char*)); //squareを動的確保
    if(square == NULL){
        fprintf(stderr, "memory allocation errer.\n");
        exit(1);
    }
    for(i = 0; i < row; i++){ //square[i]を動的確保
        square[i] = (char*)calloc(line, sizeof(char));
        if(square[i] == NULL){
            fprintf(stderr, "memory allocation errer.\n");
            exit(1);
        }
    }
    whiteRow = (int*)calloc(row, sizeof(int)); //whiteRowを動的確保
    if(whiteRow == NULL){
        fprintf(stderr, "memory allocation errer.\n");
        exit(1);
    }
    whiteLine = (int*)calloc(line, sizeof(int)); //whiteLineを動的確保
    if(whiteLine == NULL){
        fprintf(stderr, "memory allocation errer.\n");
        exit(1);
    }
    count = 0; //初期化
    countRow = 0; //初期化
    countLine = 0; //初期化
    for(i = 0; i < row; i++){ //squareに入力
        for(j = 0; j < line; j++){
            scanf(" %c",&square[i][j]);
        }
    }
    for(i = 0; i < row; i++){ //全て-1に初期化(0で初期化すると0番目が全て'.'なときに区別がつかなくなる)
        whiteRow[i] = -1;
    }
    for(i = 0; i < line; i++){ //全て-1に初期化(0で初期化すると0番目が全て'.'なときに区別がつかなくなる)
        whiteLine[i] = -1;
    }
    for(i = 0; i < row; i++){ //何行目に全て'.'なのかを探してwhiteRowに格納する
        count = 0;
        for(j = 0; j < line; j++){
            if (square[i][j] == '.'){
                count++;
            }
        }
        if(count == line){
            whiteRow[countRow] = i;
            countRow++;
        }
    }
    for(i = 0; i < line; i++){ //何列目に全て'.'なのかを探してwhiteLineに格納する
        count = 0;
        for(j = 0; j < row; j++){
            if (square[j][i] == '.'){
                count++;
            }
        }
        if(count == row){
            whiteLine[countLine] = i;
            countLine++;
        }
    }
    for(i = 0; i < row; i++){ //答えを出力する
        for(j = 0; j < line; j++){
            if(arrayIn(i,row,whiteRow) == 0 && arrayIn(j,line,whiteLine) == 0){ //もし全て'.'の行,列に属していなかったら
                printf("%c",square[i][j]);
            }
        }
        if(arrayIn(i,row,whiteRow) == 0){ //行が全て'.'でなければ改行
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1644
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << a * b / 2;
	if (a * b % 2 == 1) {
		cout << ".5";
	}
	cout << " ";
	if (a == c * 2 && b == d * 2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int max=1;
int min=n;
int l;
int r;
for(int i=1;i<=m;i++){
	l=sc.nextInt();
	r=sc.nextInt();
	if(l>max){max=l;}
	if(r<min){min=r;}
}
int ans=min-max+1;
if(ans>=0){
	System.out.println(ans);
}else{
	System.out.println(0);
}
	}}

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

const int N = 5010;
using ll = long long;

int p[N], c[N];
bool vis[N];

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++ i){
        scanf("%d", &p[i]);
    }
    for (int i = 1; i <= n; ++ i){
        scanf("%d", &c[i]);
    }
    ll ret = LLONG_MIN;
    for (int i = 1; i <= n; ++ i){
        if (vis[i]){
            continue;
        }
        int x = i;
        std::vector<int> vec;
        while (!vis[x]){
            vec.emplace_back(c[x]);
            vis[x] = true;
            x = p[x];
        }
        ll sum = 0;
        for (auto u : vec){
            sum += u;
        }
        ll ans = 0;
        int sz = vec.size();
        int kk = k;
        if (sum > 0 && k / sz >= 3){
            int num = k / sz - 2;
            ans += num * sum;
            k -= num * sz;
            ret = std::max(ret, ans);
        }
        else if (sum <= 0){
            if (k > 2 * sz){
                k = k % sz + 2 * sz;
            }
        }
        ll max1 = LLONG_MIN;
        for (int j = 0; j < sz; ++ j){
            ll tot = 0;
            for (int u = 0; u < k; ++ u){
                tot += vec[(j + u) % sz];
                max1 = std::max(max1, tot);
            }
        }
        ans += max1;
        ret = std::max(ans, ret);
        k = kk;
    }
    printf("%lld\n", ret);
    return 0;
}

Measured memory_bytes: 3892
def reach(arr)
  ans = []
  9.times{|i|
    next if arr[i] == 4
    b = arr.clone
    b[i] += 1
    if is_ron(b)
      ans << i + 1
    end
  }
  return ans
end

def is_ron(b)
  9.times{|i|
    if b[i] > 1
      # candidate of head
      c = b.clone
      c[i] -= 2
      if grouping(c)
        return true
      end
    end
  }
  return false
end

def grouping(c)
  7.times{|i|
    if c[i] == 4
      return false if c[i+1] == 0 || c[i+2] == 0
      c[i] -= 1
      c[i+1] -= 1
      c[i+2] -= 1
    end

    if c[i] == 3
      if c[i+1] < 3 || c[i+2] < 3
        c[i] -= 3
      else
        c[i] -= 1
        c[i+1] -= 1
        c[i+2] -= 1
      end
    end

    if c[i] == 2
      return false if c[i+1] < 2 || c[i+2] < 2
      c[i] -= 2
      c[i+1] -= 2
      c[i+2] -= 2
    end

    if c[i] == 1
      return false if c[i+1] < 1 || c[i+2] < 1
      c[i] -= 1
      c[i+1] -= 1
      c[i+2] -= 1
    end
  }
  return false if c - [0, 3] != []
  return true
end


while input = gets
  arr = Array.new(9){0}
  input.chomp.split("").map(&:to_i).each{|i|
    arr[i-1] += 1
  }
  ans = reach(arr)
  if ans.size > 0
    puts ans.join(" ")
  else
    puts 0
  end
end

Measured memory_bytes: 8804
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define lout cout
#else
stringstream devnull;
#define lout devnull
#endif

int main()
{
  int n;
  scanf("%d", &n);

  list<int> li;
  for (int i = 0; i < n; i++)
  {
    char com[20];
    int x;
    scanf("%s%d", com, &x);

    if (com[0] == 'i') //if (c == "insert")
    {
      li.push_front(x);
      lout << "insert " << x << endl;
    }
    else if (com[0] == 'd')
    {
      if (com[6] == '\0') //if (c == "delete")
      {
        auto it = find(li.begin(), li.end(), x);
        if (it != li.end())
          li.erase(it);
        lout << "delete " << x << endl;
      }
      else if (com[6] == 'F') //if (c == "deleteFirst")
      {
        li.pop_front();
        lout << "deleteFirst" << endl;
      }
      else if (com[6] == 'L') //if (c == "deleteLast")
      {
        li.pop_back();
        lout << "deleteLast" << endl;
      }
    }

#ifdef LOCAL
    //vcout(li, " ");
    {
      list<int> li_ = li;
      while (not li_.empty())
      {
        cout << li_.front();
        if (li_.size() > 1)
        {
          cout << " ";
        }
        li_.pop_front();
      }
    }
    cout << endl;
#endif
  }

  for (auto it = li.begin(); it != li.end(); it++)
  {
    static bool first = true;
    if (!first)
    {
      printf(" ");
    }
    first = false;
    printf("%d", *it);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 66956
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;

static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
    public static Queue<T> ToQueue<T>(this IEnumerable<T> seq) => new Queue<T>(seq);
    public static Stack<T> ToStack<T>(this IEnumerable<T> seq) => new Stack<T>(seq);
    public static HashSet<T> ToHashSet<T>(this IEnumerable<T> seq) => new HashSet<T>(seq);
}
static class MyMath
{
    static public long GCD(long a, long b) => (a < b) ? GCD(b, a) : ((b == 0) ? a : GCD(b, a % b));
    static public long LCM(long a, long b) => (a > b) ? (a / GCD(a, b) * b) : (b / GCD(a, b) * a);
    static private readonly long _m = 1000000000 + 7;
    static public long Mod(long val) => (val % _m + _m) % _m;
    static private long ExtGCD(long a, long b, ref long x, ref long y) => (b == 0) ? (a + (x = 1) * 0 + (y = 0) * 0) : (ExtGCD(b, a % b, ref y, ref x) + (y -= a / b * x) * 0);
    static private long ModInverseInner(long a, long dummy1 = 0, long dummy2 = 0) => ExtGCD(a, _m, ref dummy1, ref dummy2) * 0 + Mod(dummy1);
    static public long ModInverse(long a) => ModInverseInner(a, 0, 0);
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        string s = Console.ReadLine();

        long[] dp = new long[13];
        dp[0] = 1;
        int keta = 1;
        
        for(int i = s.Length - 1; i >= 0; i--)
        {
            long[] nextDP = new long[13];

            if (s[i] == '?')
            {
                for (int j = 0; j <= 9; j++)
                {
                    int amari = (j * keta) % 13;
                    for (int k = 0; k < 13; k++)
                    {
                        nextDP[(k + amari) % 13] += MyMath.Mod(dp[k]);
                        nextDP[(k + amari) % 13] = MyMath.Mod(nextDP[(k + amari) % 13]);
                    }
                }
            }
            else
            {
                int val = int.Parse(s[i].ToString());
                int amari = (val * keta) % 13;
                for(int j = 0; j < 13; j++)
                {
                    nextDP[(j + amari) % 13] = MyMath.Mod(dp[j]);
                }
            }

            keta *= 10;
            keta %= 13;

            dp = nextDP;
        }

        Console.WriteLine(dp[5]);
    }
    
}

Measured memory_bytes: 17492
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <map>
#include <numeric>

using namespace std;

int main() {

  int n;

  cin >> n;

  float x;
  string type;

  float total = 0;

  for(int i = 0; i < n ; i++){
    cin >> x >> type;
    if(*type.begin() =='J'){
      total += x;
    } else {
      total += x * 380000;
    }
  }  

  cout << total << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,n;
	cin>>h>>n;
	int sum=0;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++)
	sum+=a[i];
	if(sum<h)
	cout<<"No"<<"\n";
	else
	cout<<"Yes"<<"\n";
	
}

Measured memory_bytes: 640
def f():
 c=0
 for W in iter(input,'0'):
  c+=1
  W=int(W)
  d=[0]*-~W
  for _ in[0]*int(input()):
   v,w=map(int,input().split(','))
   for i in range(W,w-1,-1):
    if d[i]<d[i-w]+v:d[i]=d[i-w]+v
  print(f'Case {c}:\n{d[W]}\n{d.index(d[W])}')
if'__main__'==__name__:f()


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int N, M;
    cin >> N >> M;
    vector<int> s(M);
    vector<int> c(M);
    rep(i, M) cin >> s[i] >> c[i];
    int maxNum = 10;
    int startNum = 0;
    if(N == 2){
        startNum = 10;
        maxNum = 100;
    }else if(N == 3){
        startNum = 100;
        maxNum = 1000;
    }
    for(int ans = startNum; ans < maxNum; ans++){//0から999まで全探索
        bool flag = true;
        rep(i, M){
            string str = to_string(ans);
            if(str[s[i] - 1] != (c[i] + 48)) flag = false;
        }
        if(flag == true){
            cout << ans << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

int main(){
    int N;
    cin >> N;
    int A[N+1];
    int B[N+1];
    for(int i=0; i<N+1; i++) B[i] = 0;
    for(int i=2; i<N+1; i++) cin >> A[i];
    for(int i=2; i<N+1; i++) {
      B[A[i]]++;
    }
    for(int i=1; i<N+1; i++) cout << B[i] << endl;

  return 0;
}


Measured memory_bytes: 5196
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		String result = "No";
		if(a == b + c || b == a + c || c == a + b)  result = "Yes";
		System.out.println(result);
	}

}


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

int main() {
  int a, b;
  cin >> a >> b;
  int c = a + b;
  if (c < 24) cout << c << endl;
  else cout << c - 24 << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	stdin.Scan()
	s := stdin.Text()
	flag := true
	k := map[rune]bool{'R': true, 'U': true, 'D': true}
	g := map[rune]bool{'L': true, 'U': true, 'D': true}
	q := map[int]map[rune]bool{1: g, 0: k}
	for i := 0; i < len(s); i++ {
		if !q[i%2][rune(s[i])] {
			flag = false
		}
	}
	fmt.Println(map[bool]string{true: "Yes", false: "No"}[flag])
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(V) V.begin(), V.end()
#define PB push_back
using namespace std;
typedef long long ll;

int main() {
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
}

Measured memory_bytes: 3556
def gcd(x, y):
    if y > x:
        x, y = y, x
    while y != 0:
        x, y = y, x % y
    return x


N = int(input())
A = [int(i) for i in input().split()]
ans = A[N - 1]
for i in range(N - 1):
    ans = gcd(ans, A[i])
print(ans)


Measured memory_bytes: 14252
import numpy
M=10**9+7
n,k=map(int,raw_input().split())
a=numpy.matrix([map(int,raw_input().split())for i in[0]*n],dtype='O')
b=numpy.eye(n,dtype='O')
while k:
 if k&1:b=b*a%M
 a=a*a%M
 k/=2
print b.sum()%M

Measured memory_bytes: 19556
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N

for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

for cx in range(0, 101):
    for cy in range(0, 101):
        f_i = 0
        for i in range(N):
            if h[i] != 0:
                f_i = i
        H = h[f_i] + abs(x[f_i]-cx) + abs(y[f_i]-cy)
        for i in range(N):
            if H - abs(x[i]-cx) - abs(y[i]-cy) < 0 and h[i] == 0:
                continue
            if H != h[i] + abs(x[i]-cx) + abs(y[i]-cy):
                break
        else:
            print(cx, cy, H)
            exit()
        continue

Measured memory_bytes: 3188
#include <stdio.h>

int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	int correct=(n-m)*100,incorrect=m*1900,t=1;
	for (int i=0;i<m;i++) t*=2;
	printf("%d\n",(correct+incorrect)*t);
	return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	string S; cin >> S;
	int n = S.size() + 1;
	V<int> vl(n), vr(n);

	rep(i, n-1) {
		vl[i+1] = (S[i] == '<' ? vl[i] + 1 : 0);
	}

	for (int i = n-2; i >= 0; --i) {
		vr[i] = (S[i] == '>' ? vr[i+1] + 1 : 0);
	}

	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += max(vl[i], vr[i]);
	}

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

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

int max(int a, int b)
{
  if (a>b) return a;
  else return b;
}
int min(int a, int b)
{
  if (a<b) return a;
  else return b;
}
 
int compare_int(const void *a, const void *b)
{
  return *(int*)b - *(int*)a;
}

int main()
{
  int k, n;
  scanf("%d %d", &k, &n);
  int a[n];
  for(int i=0;i<n;i++) scanf("%d", &a[i]);
  
  qsort(a, n, sizeof(int), compare_int);
  
  int b[n];
  for(int i=1;i<n;i++) b[i]=a[i-1]-a[i];
  
  b[0]=min(abs(a[0]-a[n-1]), abs(a[n-1]+k-a[0]));

  int max=0;
  for(int i=0;i<n;i++){
    if(b[i]>max) max = b[i];
  }
  printf("%d", k-max);
  return 0;
}

Measured memory_bytes: 1788
#include <stdio.h>
#define FOR(i,L,R) for (int i = L; i < R; i++)
#define READ(n) int (n); scanf("%d",&(n))
#define getInt(a) scanf("%d", &a)
    
int min(int a, int b){
    if (a <= b) return a;
    else return b;
}

int main(){
    READ(n);
    int monsters[n + 1], heroes[n];
    long long cnt = 0;
    FOR(i, 0, n + 1){
        getInt(monsters[i]);
    }
    FOR(i, 0, n) getInt(heroes[i]);
    
    for (int i = 0; i < n; i++){
        int x = min(monsters[i], heroes[i]);
        heroes[i] -= x;
        monsters[i] -= x;
        cnt += x;
        int y = min(monsters[i + 1], heroes[i]);
        monsters[i + 1] -= y;
        cnt += y;
    }
    
    printf("%lld\n", cnt);
}

Measured memory_bytes: 896
from collections import Counter
n = int(input())
a = [min(x//400, 8) for x in map(int, input().split())]
a = Counter(a)

if len(a) == 1 and a[8] != 0:
    min_a = 1
    max_a = a[8]
elif a[8] != 0:
    min_a = len(a)-1
    max_a = min_a+a[8]
else:
    min_a = max_a = len(a)
print(min_a, max_a)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

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

  map<int, int> mp;
  rep(i,0,M-1) {
    int a, b;
    cin >> a >> b;
    if (a == 1) mp[b]++;
    if (b == N) mp[a]++;
  }

  string ans = "IMPOSSIBLE";
  for (auto p : mp) {
    if (2 <= p.second) ans = "POSSIBLE";
  }

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


Measured memory_bytes: 12980
#include<bits/stdc++.h>
using namespace std;
#define int long
struct node{
  int key;
  node *left,*right,*parent;
  node(){}
  node(int key):key(key){left=right=parent=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key)x=x->left;
    else x=x->right;
  }
  z.parent=y;
  if(y==NULL)root=new node(z);
  else if(z.key<y->key)y->left=new node(z);
  else y->right=new node(z);
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    insert(node(x));
  }
  return 0;
}



Measured memory_bytes: 26592
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    string s;
    cin >> s;

    sort(s.begin(), s.end());

    if(s == "abc")
        cout << "Yes";
    else
    {
        cout << "No";
    }
    cout << endl;
    

    return 0;
}



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

void bottom(int step[], int n, int k)
{
	int dp[k + 1] = {};
	dp[0] = 0; //0 is losing and 1 winning for 1st player
	for (int i = 1; i <= k; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (i - step[j] >= 0 && (dp[i - step[j]] == 0))
			{
				dp[i] = 1;
				break;
			}
		}
	}
	if (dp[k] == 1)
		cout << "First";
	else
		cout << "Second";
	return;
}
int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n, k;
	cin >> n >> k;
	int step[n];
	for (int i = 0; i < n; i++)
	{
		cin >> step[i];
	}
	bottom(step, n, k);
}
// 3 8
// 3 30
// 4 50
// 5 60

Measured memory_bytes: 1024
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

const int N = 407;
int a[N];
long long dp[N][N];
int n;
const long long inf = 1e16;
long long sum[N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + a[i];
    
    for (int l = 2; l <= n; ++l) {
        for (int i = 1; i + l - 1 <= n; ++i) {
            int j = i + l - 1;
            dp[i][j] = inf;
            for (int k = i; k < j; ++k) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j]);
            dp[i][j] += sum[j] - sum[i - 1];
        }
    }
    printf("%lld\n", dp[1][n]);
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n, k, a[200005];
int main() {
   cin >> n >> k;
   for (int i=0; i<n; i++) cin >> a[i];
   
   for (int i=0; i<n-k; i++) {
       if (a[i+k]>a[i]) cout << "Yes\n";
       else cout << "No\n";
   }
}

Measured memory_bytes: 4364
#include<iostream>
using namespace std;
const int N=3e3+2;
const int mod=1e9+7;
int sum[N],dp[N],max1[N],dp1[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,m,now=0;
	string s;
	cin>>n>>m>>s;
	s=' '+s;
	for(i=1;i<=n;i++){
		sum[i]=sum[i-1];
		if(s[i]=='1'){
			sum[i]++;
		}
	}
	for(i=1;i<=m;i++){
		cin>>j>>k;
		max1[j]=max(max1[j],k);
	}
	dp[0]=1;
	for(i=1;i<=n;i++){
		if(max1[i]){
			now=max(now,max1[i]);
		}
		now=max(now,i);
		for(j=0;j<=min(sum[now],i);j++){
			if(j){
				dp1[j]=dp[j-1];
			}
			else{
				dp1[j]=0;
			}
			if(i-j<=now-sum[now]){
				dp1[j]+=dp[j];
				if(dp1[j]>=mod){
					dp1[j]-=mod;
				}
			}
		}
		for(j=0;j<=sum[now];j++){
			dp[j]=dp1[j];
		}
	}
	cout<<dp[sum[n]];
}

Measured memory_bytes: 256
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا
/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ

#include <bits/stdc++.h>
#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define LL long long
#define ll long long
#define LD double

#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define S second
#define F first
#define PI acos(-1)
#define MAX 5000005
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);


int main() {
    HabdModeActive
    int n;
    cin>>n;
    int arr[n];
    for(int i=0 ; i<n; i++)
        cin>>arr[i];
    reverse(arr,arr+ n );
    vector<int> se;
    for(int i = 0 ; i<n ; i++)
    {
        auto it = upper_bound(se.begin() , se.end() , arr[i]);
        if(it != se.end()) *it = arr[i];
        else se.push_back(arr[i]);
    }
    cout<<se.size();
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
int main()
{
  double r; cin >> r;
  double pi2 = 6.28318530717958623200;
  
  printf("%.7f\n", pi2*r);
  return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int w,h,n;
  cin >> w>> h >> n;
  int board[h][w];
  for(int i=0;i<h;i++){for(int j=0;j<w;j++){board[i][j]=1;}}
  
  for(int turn=0;turn<n;turn++){
    int x,y,a;
    cin >> x >> y >> a;
    switch(a){
      case 1:
        for(int i=0;i<h;i++){for(int j=0;j<x;j++){board[i][j]=0;}}
        break;
      case 2:
        for(int i=0;i<h;i++){for(int j=x;j<w;j++){board[i][j]=0;}}
        break;
      case 3:
        for(int i=0;i<y;i++){for(int j=0;j<w;j++){board[i][j]=0;}}
        break;
      case 4:
        for(int i=y;i<h;i++){for(int j=0;j<w;j++){board[i][j]=0;}}
        break;
    }
  }
  
  int count=0;
  for(int i=0;i<h;i++){for(int j=0;j<w;j++){count+=board[i][j];}}
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

int main() {
    int N; cin >> N;
    vl A(N); rep(i, N) cin >> A[i];

    ll sum = 0;
    for (int i = 0; i < N - 1; i++) {
        if (A[i] <= A[i + 1]) continue;

        sum += A[i] - A[i + 1];
        A[i + 1] = A[i];
    }

    cout << sum << endl;
}


Measured memory_bytes: 4788
using System;
using System.Linq;
using System.Text;

namespace ITP1_5_D_Structured_Programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse( Console.ReadLine() );
            Console.WriteLine( Enumerable
                .Range( 1, input )
                .Where( n => n % 3 == 0 || n.ToString().Contains( "3" ) )
                .Aggregate( new StringBuilder(), (acc, n) => acc.AppendFormat( " {0}", n ) ) );
        }
    }
}

Measured memory_bytes: 20824
#include <stdio.h>

int main()
{
    long long int a, b, x, y, t, gcd, lcm;

    while(scanf("%lld %lld", &a, &b)!= EOF){
        x=a;
        y=b;

        while(y!=0){
            t=y;
            y=x%y;
            x=t;
        }
        gcd=x;
        lcm=a*b/gcd;
        printf("%lld %lld\n", gcd, lcm);
    }
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; ++i){
    cin >> a[i];
    a[i] -= i+1;
  }
  sort(a.begin(),a.end());
  int mid = a[n/2];
  long long ans = 0;
  for(int i=0; i<n; ++i){
    ans += abs(a[i]-mid);
  }
  cout << ans << endl;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int cnt = 0;
    while (b <= a) {
        b *= 2;
        ++cnt;
    }
    while (c <= b) {
        c *= 2;
        ++cnt;
    }
    if (cnt <= k) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int a;
int x[52];
// 何個 総和
ll dp[52][2521];

int main(){
  scanf("%d%d",&n,&a);
  REP(i,n)scanf("%d",x+i);
  dp[0][0] = 1;
  REP(i,n)FORR(k,0,n)FORR(j,0,2521-x[i]){
    dp[k+1][j+x[i]] += dp[k][j];
  }
  ll ans = 0;
  REP(i,n){
    ans += dp[i+1][(i+1)*a];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int,int>
#define pl pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
const ll DEP = (1LL << 50);
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
template<typename T>
T GCD(T x,T y){
    return y ? GCD(y,x%y) : x;
}
template<typename T>
string toString( const T &a ){
    ostringstream oss;
    oss << a;
    return oss.str();
};
int N,y,m,d;
int day(int y,int m,int d){
    int cnt = d;
    for(int i = 1; i < y; i++){
        if(i % 3 == 0) cnt += 200;
        else cnt += 195;
    }
    if(y % 3 == 0){
        cnt += 20*(m-1);
    } else {
        for(int i = 1; i < m; i++){
            if(i % 2 == 1){
                cnt += 20;
            } else {
                cnt += 19;
            }
        }
    }
    return cnt;
}
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> y >> m >> d;
        cout << day(1000,1,1) - day(y,m,d) << endl;
    }
}


Measured memory_bytes: 3100