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

int main() {
	int a, b;
  
  	cin >> a >> b;
  
  	if (((a * b) % 2) == 0) {
		cout << "Even" << endl;
    }
  	else {
		cout << "Odd" << endl;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define M 10001
#define N 5005
#define p 1000000007
int a[N],b[M],c[M],d[N],f[N][N],g[N],n,s[N];
void dfs(int u)
{
	s[u]=f[u][1]=1;
	for(int&i=a[u];i;i=b[i])if(!s[c[i]])
	{
		dfs(c[i]);
		for(int j=0;j<=s[c[i]];j++)if(f[c[i]][j])for(int k=1;k<=s[u];k++)g[j+k]=(g[j+k]+(long long)f[c[i]][j]*f[u][k])%p;
		s[u]+=s[c[i]],memcpy(f[u]+1,g+1,s[u]<<2),memset(g+1,0,s[u]<<2);
	}
	if(~s[u]&1)for(int i=2;i<=n;i++)*f[u]=(*f[u]+(long long)f[u][i]*d[i])%p;
}
int main()
{
	scanf("%d",&n),*d=p-1;
	for(int i=2;i<=n;i+=2)d[i]=d[i-2]*(i-1ll)%p;
	for(int i=1,u,v;i<n;i++)scanf("%d%d",&u,&v),b[i<<1]=a[u],c[a[u]=i<<1]=v,b[i<<1|1]=a[v],c[a[v]=i<<1|1]=u;
	dfs(1),printf("%d\n",(p-*f[1])%p);
	return 0;
}

Measured memory_bytes: 97024
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
using namespace std;

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

typedef long long lint;
typedef pair<int,int> P;

lint f(lint x){
	lint out;
	if(x%4==0){
		out = x^0;
	}else if(x%4==1){
		out = 1;
	}else if(x%4==2){
		out = x^1;
	}else{
		out = 0;
	}
	//cout << x << " " << out << endl;
	return out;
}

int main()
{

    lint A,B;
    cin >> A >> B;

    lint ans;
    ans = f(B)^f(A-1);



    cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

int subcount(int n)
{
	if (n <= 0) {
		return 1;
	}
	int c = 0;
	for (int i = 0; i < (1 << n); ++i) {
		bool ok = true;
		for (int k = 0; k + 1 < n; ++k) {
			if ((i & (1 << k)) && (i & (1 << (k + 1)))) {
				ok = false;
				break;
			}
		}
		if (ok) {
			++c;
		}
	}
	return c;
}

int main()
{
	int H, W, K;
	cin >> H >> W >> K;

	long long dp[101][8 + 1] = {};
	dp[1][1] = subcount(W - 2);
	dp[1][2] = subcount(W - 3);
	for (int j = 3; j <= W; ++j) {
		dp[1][j] = 0;
	}

	for (int i = 2; i <= H; ++i) {
		for (int j = 1; j <= W; ++j) {
			if (1 < j) {
				dp[i][j - 1] += 1LL * subcount(j - 3) * subcount(W - j - 1) * dp[i - 1][j];
				dp[i][j - 1] %= MOD;
			}
			dp[i][j] += 1LL * subcount(j - 2) * subcount(W - j - 1) * dp[i - 1][j];
			dp[i][j] %= MOD;
			if (j < W) {
				dp[i][j + 1] += 1LL * subcount(j - 2) * subcount(W - j - 2) * dp[i - 1][j];
				dp[i][j + 1] %= MOD;
			}
		}
	}

	cout << dp[H][K] << endl;
}



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

int main() {
  int a,b,c,d,e;
  scanf("%d %d %d %d %d", &a,&b,&c,&d,&e);
  if(a == 0) {
    printf("1\n");
  } else if(b == 0) {
    printf("2\n");
  } else if(c == 0) {
    printf("3\n");
  } else if(d == 0) {
    printf("4\n");
  } else if(e == 0) {
    printf("5\n");
  }
  return 0;
}


Measured memory_bytes: 1612
from bisect import bisect_left

X, N = map(int, input().split())
plist = list(map(int, input().split()))


if N == 0:
    print(X)

else:
    plist.sort()
    not_plist = [x for x in range(plist[0]-1, plist[-1]+2, 1)  if x not in plist]
    idx = bisect_left(not_plist, X)

    if idx == 0:
        print(X)

    elif idx == len(not_plist):
        print(X)

    else:
        left = X - not_plist[idx-1]
        right = not_plist[idx] - X
        if left <= right:
            print(not_plist[idx-1])
        else:
            print(not_plist[idx])


Measured memory_bytes: 9156
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int tmp = num;
		while(tmp % 2 == 0) {
			tmp /= 2;
		}
		if(tmp == 1) { System.out.println("No"); return; }
		System.out.println("Yes");
		int line = (int)(Math.floor((num + 1) / 4.0) * 4) - 1;
		StringBuilder ans = new StringBuilder();
		for(int i = 1; i < line; i ++) {
			ans.append(i+" "+(i + 1)+"\n");
			ans.append((num + i)+" "+(num + i + 1)+"\n");
		}
		ans.append(line+" "+(num + 1)+"\n");
		int rest = num - line;
		switch(rest) {
		case 0: break;
		case 1:
			ans.append((num / tmp + 1)+" "+(line + 1)+"\n");
			ans.append((num - num / tmp)+" "+(num + line + 1)+"\n");
			break;
		case 2: case 3:
			ans.append((1)+" "+(line + 1)+"\n");
			ans.append((line + 1)+" "+(line + 2)+"\n");
			ans.append((num + 1)+" "+(num + line + 2)+"\n");
			ans.append((num + line + 2)+" "+(num + line + 1)+"\n");
			if(rest == 3) {
				ans.append((num + line + 2)+" "+(line + 3)+"\n");
				ans.append((num + 2)+" "+(num + line + 3)+"\n");
			}
			break;
		}
		System.out.println(ans);
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(){
	int N,number,type[100005]={},max;

	cin>>N;
	REP(i,N){
		cin>>number;
		type[number]++;
	}

	max=type[0]+type[1];
	FOR(i,1,100000) chmax(max,type[i-1]+type[i]+type[i+1]);

	printf("%d\n",max);
	
	return 0;
}



Measured memory_bytes: 640
// AOJ Volume 0 Problem 0015

#include <stdio.h>
#include <string.h>

void clear_num(int num[])
{
    int i;
    
    for (i = 0; i <= 80; i++){
        num[i] = 0;
    }
}


int get_num(int num[])
{
    char s[1000];
    int i;
    int j;

    scanf("%s", s);
    
    if (strlen(s) > 80){
        return (1);
    }
    for (i = strlen(s) - 1, j = 0; i >= 0; i--, j++){
        num[j] = s[i] - '0';
    }
    return (0);
}

int add_num(int sum[], int num1[], int num2[])
{
    int i;
    
    for (i = 0; i < 80; i++){
        sum[i] += (num1[i] + num2[i]);
        if (sum[i] >= 10){
            sum[i] %= 10;
            sum[i + 1]++;
        }
    }
    
    if (sum[80] != 0){
        return (1);
    }
    return (0);
}

void print_num(int num[])
{
    int i;
    
    for (i = 79; i > 0 && num[i] == 0; i--);

    for (; i >= 0; i--){
        printf("%d", num[i]);
    }
    printf("\n");
}

int main(void)
{
    int n;
    int n1[85];
    int n2[85];
    int sum[85];
    int i;
    int error;
        
    scanf("%d", &n);
    
    for (i = 0; i < n; i++){
        clear_num(n1);
        clear_num(n2);
        clear_num(sum);
        
        error = get_num(n1);
        error += get_num(n2);
        if (error == 0){
            error += add_num(sum, n1, n2);
        }
        if (error != 0){
            printf("overflow\n");
        }
        else {
            print_num(sum);
        }
    }

    return (0);
}

Measured memory_bytes: 0
def format_time x
    h, m = x.divmod 3600
    m, s = m.divmod 60
    return "#{h} #{m} #{s}"
end

3.times{
    h1, m1, s1, h2, m2, s2 = gets.chomp.split.map(&:to_i)
    t1 = h1 * 3600 + m1 * 60 + s1
    t2 = h2 * 3600 + m2 * 60 + s2
    puts format_time(t2 - t1)
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N+2);
    vector<int> B(N+1);

    long long init = 0;

    for(int i = 0; i < N+1; i++){
        cin >> A.at(i);
        init += A.at(i);
    }
    for(int i = 0; i < N; i++){
        cin >> B.at(i);
    }

    for(int i = 0; i < N+1; i++){
        if(A.at(i) >= B.at(i)){
            A.at(i) -= B.at(i);
          B.at(i) = 0;
		}else{
            B.at(i) -= A.at(i);
            A.at(i) = 0;
            
        }
        if(A.at(i+1) >= B.at(i)){
                A.at(i+1) -= B.at(i);
              B.at(i) = 0;
            }else{
                                B.at(i) -= A.at(i+1);
                A.at(i+1) = 0;
            }
    }

    long long now = 0;
       for(int i = 0; i < N+1; i++){
        now += A.at(i);
    }

    cout << init - now  << endl;

}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

    int ns[n];
    for (int i = 0; i < n; i++)
    {
        cin >> ns[i];
    }
    for (int i = n - 1; i >= 0; i--)
    {
        cout << ns[i];
        if (i == 0)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }

    return 0;
}


Measured memory_bytes: 3112
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

int min(int X, int Y) {
    return X < Y ? X : Y;
}

int abs(int X, int Y) {
    return X > Y ? X - Y : Y - X;
}

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

    int ans = 753;
    REP(2, i, S.length()) {
        string s = S.substr(i - 2, 3);
        int X = atoi(s.c_str());
        // cout << X << endl;
        ans = min(abs(X - 753), ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
S = list(input())
K = int(input())

if len(set(S)) == 1:
    print((len(S)*K)//2)
    exit()

def n_change(sss):
    s = sss.copy()
    x = 0
    for i in range(1,len(s)):
        if s[i] == s[i-1]:
            s[i] = "X"
            x += 1
    return x

print(n_change(S) + (K-1) * (n_change(2*S) - n_change(S)))


Measured memory_bytes: 3060
#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];
  }
int x=*max_element(A.begin(), A.end());
int y=*min_element(A.begin(), A.end());

  cout<<abs(x-y)<<endl;
}

Measured memory_bytes: 256
let () =
  let a = read_line () in
  let b = read_line () in
  let la = String.length a in
  let lb = String.length b in
  let rec check i =
    if i = la then "EQUAL"
    else
      let c = compare a.[i] b.[i] in
      if c < 0 then "LESS"
      else if c > 0 then "GREATER"
      else check (i+1) in
  let cs = compare la lb in
  let rs = if cs < 0 then "LESS"
           else if cs > 0 then "GREATER"
           else check 0 in
  print_endline rs


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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス //
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

// 関数 //
int gcd(int a, int b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

// End of Template //

int main() {

    string s;
    cin >> s;
    int count = 0;
    rep(i, s.size() / 2) {
        if (s[i] != s[s.size() - i - 1]) {
            count++;
        }
    }
    cou(count);
}

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

lld findGcd(lld a, lld b)
{
    return (b == 0) ? a : findGcd(b, a % b);
}

int main()
{
    lld N;
    cin >> N;
    vector<lld> v(N);
    for(lld i = 0; i < N; i++) {
        cin >> v[i];
    }
    vector<lld> l(N), r(N);
    l[0] = v[0];
    for(lld i = 1; i < N; i++) {
        l[i] = findGcd(l[i - 1], v[i]);
    }
    r[N - 1] = v[N - 1];
    for(lld i = N - 2; i >= 0; i--) {
        r[i] = findGcd(r[i + 1], v[i]);
    }
    lld ans = -1;
    for(lld i = 0; i < N; i++) {
        lld val;
        if(i == 0) {
            val = r[i + 1];
        } else if(i == N - 1) {
            val = l[i - 1];
        } else {
            val = findGcd(l[i - 1], r[i + 1]);
        }
        ans = max(ans, val);
    }
    cout << ans;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 0; i < N; i++){
        string text;
        cin >> text;
        ans += (text == "E869120");
    }
    cout << ans << endl;
}



Measured memory_bytes: 3164
from scipy.misc import comb
N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)

ans = 0
if v[A-1] == v[0]:
    mean = v[0]
    count = 0
    for i in range(N):
        if v[i] == v[0]:
            count += 1
    for i in range(A,min(B,count)+1):
        ans += comb(count,i,exact=True)
else:
    mean = sum(v[:A])/A
    count = 0
    j = N
    for i in range(N):
        if v[i] == v[A-1]:
            j = min(i,j)
            count += 1
    ans = comb(count,A-j,exact=True)
print(mean)
print(ans)

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

int main() {
  int N;
  
  cin >> N;
  
  switch(N%10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << endl;
      break;
    case 3:
      cout << "bon" << endl;
      break;
    default:
      cout << "hon" << endl;
      break;
  }
}

      

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#pragma target("trapv")
using namespace std;
#define bs ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define pb push_back
// #define LOCAL_DEFINE
// #define LOCAL
#define deb(a) cout << #a << " = " << a << '\n'
#define deb2(a, b) cout << #a << " = " << a << ", " << #b << " = " << b << '\n'
#define rep(var,start,end) for(int var=start;var<end;var++)
#define erep(var,start,end) for(int var=start;var<=end;var++)
#define rrep(var,start,end) for(int var=start;var>=end;var--)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pci pair<char,int>
#define pll pair<ll,ll>
#define test int t;cin>>t;while(t--)

ll modularExponentiation(ll n, ll p, ll M){
    ll res = 1;
    while(p){
        if(p&1)
            res = (res * n)%M;
        n = (n*n)%M;
        p >>= 1;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    int a[n][3];
    rep(i,0,n) cin >> a[i][0] >> a[i][1] >> a[i][2];
    int dp[n+1][4];
    for(int i = 0; i <= n; ++i) dp[i][0] = 0;
    for(int i = 0; i <= 3; ++i) dp[0][i] = 0;
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= 3; ++j){
            if(j == 1)
                dp[i][j] = max({dp[i-1][j], dp[i-1][j+2] + a[i-1][j-1], dp[i-1][j+1] + a[i-1][j-1]});
            if(j == 2)
                dp[i][j] = max({dp[i-1][j], dp[i-1][j-1] + a[i-1][j-1], dp[i-1][j+1] + a[i-1][j-1]});
            if(j == 3) 
                dp[i][j] = max({dp[i-1][j], dp[i-1][j-1] + a[i-1][j-1], dp[i-1][j-2] + a[i-1][j-1]});
        }
    }
    cout << max({dp[n][3],dp[n][2],dp[n][1]});
}

int main()
{
    bs;
    #ifdef LOCAL
    freopen("Contest/input.txt","r",stdin);
    freopen("Contest/output.txt","w",stdout);
    #endif
    solve();
    // test{
    //    solve(); 
    // }
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}

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

static const int INFTY = 2000000000;
static const int MAX_N = 100000;
static int cnt = 0;

struct Card {
    char suit;
    int value;
};

struct Card L[MAX_N / 2 + 2], R[MAX_N / 2 + 2];

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

    tmp = A[r];
    A[r] = A[i + 1];
    A[i + 1] = tmp;
    return i + 1; 
}

void quickSort(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(Card A[], int left, int mid, int right) {
    auto n1 = mid - left;
    auto n2 = right - mid;
    auto i = 0;

    for (i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }
    for (i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }

    L[n1].value = INFTY;
    R[n2].value = INFTY;

    i = 0;
    auto j = 0;

    for (int k = left; k < right; k++) {
        cnt += 1;
        if (L[i].value <= R[j].value) {
            A[k] = L[i];
            i += 1;
        } else {
            A[k] = R[j];
            j += 1;
        }
    }
}

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

bool isStable(struct Card C1[], struct Card C2[], int N) {
    for(int i = 0; i < N; i++)
    {
        if (C1[i].suit != C2[i].suit) {
            return false;
        }        
    }
    return true;
}

void print(struct Card A[], int N) {
    for(int i = 0; i < N; i++)
    {
        cout << A[i].suit << " " << A[i].value << endl;
    }
}

int main() {
    Card C1[MAX_N], C2[MAX_N];
    int N;
    char ch;

    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> C1[i].suit >> C1[i].value;
    }
    
    for (int i = 0; i < N; i++) {
        C2[i] = C1[i];
    }

    quickSort(C1, 0, N - 1);
    mergeSort(C2, 0, N);

    auto stableStr = isStable(C1, C2, N) ? "Stable" : "Not stable";

    cout << stableStr << endl;

    print(C1, N);

    return 0;
}



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

int main()
{
	int N;
	int A[2][110]={};
	int ans=0;
	
	cin >> N;
	for(int i=0;i<2;i++)
		for(int j=0;j<N;j++)
			cin >> A[i][j];
	
	for(int i=0;i<N-1;i++)
	{
		A[0][i+1]+=A[0][i];
		A[1][N-i-2]+=A[1][N-i-1];
	}
	
	for(int i=0;i<N;i++)
		ans=max(ans,A[0][i]+A[1][i]);
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
int main() {
	cin >> N;
	A.resize(N);
	for (auto& x : A) cin >> x;
	vector<vector<int>> dp(N+1, vector<int>(2));
	dp[0][0] = dp[0][1] = 1;
	for (int i = 1; i < N; ++ i) {
		dp[i][0] = min(dp[i-1][0] + (A[i-1] < A[i]), dp[i-1][1] + 1);
		dp[i][1] = min(dp[i-1][0] + 1, dp[i-1][1] + (A[i-1] > A[i]));
	}
	cout << min(dp[N-1][0], dp[N-1][1]) << endl;
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int main()
{
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3588
import Control.Applicative

testOrder :: Int -> Int -> Int -> Bool

testOrder a b c
    | a < b && b < c
        = True
        
    | otherwise
        = False
    
solve :: [Int] -> Bool

solve input
    = testOrder a b c where
        a = input !! 0
        b = input !! 1
        c = input !! 2

output :: Bool -> String

output True
    = "Yes"
    
output False
    = "No"
    
main :: IO ()
    
main
    = do
        input <- map read.words <$> getLine
        putStrLn $ output $ solve input

Measured memory_bytes: 3620
#include <bits/stdc++.h>
 #define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
 #define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
 #define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
 #define REP(i, n) FOR((i), 0, (n))
 #define REPe(i, n) FORe((i), 0, (n))
 #define rREP(i, n) rFOR((i), 0, (n))
 #define all(v) (v).begin(), (v).end()
 using namespace std;
 using ll = long long;
 using P = pair<int,int>;
 
 int main() {
   int n, m;
   cin >> n >> m;
   int ans = 0;
   ans += n*(n-1)/2;
   ans += m*(m-1)/2;
   cout << ans << endl;
 
   return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  int a,b,k;
  cin >> a >> b >>k;
  int key = 0;
  for(int i=100;i>=1;i--){
    if(a%i==0 && b%i==0) key++;
    if(key==k){
      cout << i << endl;
      return 0;
    }
  }
}


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

int main(){
    int ans=0,sum=0;
    int n,W;
    int sumV=0,maxV=0;
    
    cin >>n>>W;
    
    int w[n+1],v[n+1];
    
    w[0]=0;
    v[0]=0;
    
    for (int i = 1; i <= n; i++) {
        cin >> w[i] >> v[i];
        sumV += v[i];
    }
    
    int dp[sumV+1][n+1];
    
    for (int i = 0; i < sumV+1; i++) {
        for (int j = 0; j < n+1; j++) {
            
            dp[i][j]=W+1;
            
        }
    }
    dp[0][0]=0;

    for (int i = 0; i < sumV+1; i++) {
        for (int j = 1; j < n+1; j++) {
            
            if(i-v[j] >= 0){
                
                dp[i][j]=min(dp[i-v[j]][j-1] + w[j],dp[i][j-1]);
            }else{
                dp[i][j]=dp[i][j-1];
            }
            if(dp[i][j] <= W){
                maxV=max(i,maxV);
            }
            
        }
    }


    //cout <<fixed<<setprecision(16)<< << endl;
    cout << maxV << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 39680
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i += 2) {
        int count = 0;
        for (int j = 1; j <= i; ++j) {
            if(i % j == 0)count++;
        }
        if(count == 8)ans++;
    }
    print(ans);
}


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

int conv(char c){
	switch(c){
		case 'a':
			return 0;
		case '(':
			return 1;
		case ')':
			return 2;
		case '[':
			return 3;
		case ']':
			return 4;
		case '+':
		case '*':
			return 5;
		default:
			return -1;
	}
	return -1;
}

const vector<vector<int>> rule={{0,5,6},{6,0,0},{1,0,7},{7,2,0},{3,0,8},{8,4,0}};

bool dp[210][210][9];


int main(void){
	int n,m,s,t;
	while(cin >> n >> m >> s >> t,n){
		rep(i,n)rep(j,n)rep(k,9) dp[i][j][k]=false;

		using state = tuple<int,int>;
		queue<state> q;

		s--,t--;
		rep(i,m){
			int a,b;
			char tmp;
			cin >> a >> b >> tmp;
			int c = conv(tmp);
			dp[a-1][b-1][c] = true;
			q.push(state(a-1,b-1));
		}

		while(!q.empty()){
			int i,j;
			tie(i,j) = q.front(); q.pop();
			
			rep(k,n){
				for(auto &elem:rule){
					const int a = elem[0], b = elem[1], c = elem[2];
					if(dp[i][j][a] and dp[j][k][b] and !dp[i][k][c]){
						dp[i][k][c] = true;
						q.push(state(i,k));
					}
					if(dp[k][i][a] and dp[i][j][b] and !dp[k][j][c]){
						dp[k][j][c] = true;
						q.push(state(k,j));
					}				
				}
			}
		}

		if(dp[s][t][0])
			puts("Yes");
		else
			puts("No");

	}
	return 0;
}

Measured memory_bytes: 5232
import math
 
n=int(input())
s=input()
ng=len(s)
r=[]
g=[]
b=[]
 
for i in range(ng):
    if s[i]=='R':
        r.append(i)
    elif s[i]=='G':
        g.append(i)
    else:
        b.append(i)
 
kihon=math.factorial(n)%998244353
combo=0
list1=[]
list2=[]
list3=[]
 
deka=[]
tibi=[]
 
for i in range(n):
    moto=[r[i],g[i],b[i]]
    jun = sorted([r[i],g[i],b[i]])
    list1.append(jun[0])
    list2.append(jun[1])
    list3.append(jun[2])
    deka.append(moto.index(jun[2]))
    tibi.append(moto.index(jun[0]))
 
dekalist=[1]
tibilist=[1]
for i in range(n-1):
    next=max(1, dekalist[-1]-1)
    if i+next<n:
        while deka[i]==deka[i+next] and list3[i]>=list2[i+next]:
            next+=1
            if i+next==n:
                break
    dekalist.append(next)
    
    next2=max(1, tibilist[-1]-1)
    if i+next2<n:
        while tibi[n-1-i]==tibi[n-1-i-next2] and list1[n-1-i]<=list2[n-1-i-next2]:
            next2+=1
            if i+next2==n:
                break
    tibilist.append(next2)
 
 
for dl in dekalist:
    kihon=(kihon*dl)%998244353
for tl in tibilist:
    kihon=(kihon*tl)%998244353
 
print(kihon%998244353)

Measured memory_bytes: 88040
S = input()
N = len(S)
even_white = 0
odd_white = 0
for i in range(N):
    if i % 2 == 0:
        if S[i] == '1':
            even_white += 1
    else:
        if S[i] == '1':
            odd_white += 1
even_black = (N + 1) // 2 - even_white
odd_black = N // 2 - odd_white
# cost to change S into '0101..'
cost01 = even_white + odd_black
# cost to change S into '1010..'
cost10 = even_black + odd_white
cost = min(cost01, cost10)
print(cost)

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  char turn = 'a', ans;
  int at = 0, bt = 0, ct = 0;
  while(1){
    if (turn == 'a') {
      if (at == a.size()) {
        ans = 'A';
        break;
      }
      turn = a.at(at);
      at++;
    }
    else if (turn == 'b') {
      if (bt == b.size()) {
        ans = 'B';
        break;
      }
      turn = b.at(bt);
      bt++;
    }
    else if (turn == 'c') {
      if (ct == c.size()) {
        ans = 'C';
        break;
      }
      turn = c.at(ct);
      ct++;
    }
  }
  cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

int main(){
  int n, a, b, c, x;
  while(cin >> n >> a >> b >> c >> x and n + a + b + c + x){
    int target[n];
    int got = 0;
    int res = -1;
    REP(i, n) cin >> target[i];
    REP(t, 10001){
      if(x == target[got]) got++;
      if(got==n) { res = t; break; }
      x=(a*x+b)%c;
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 3016
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong(), b = in.nextLong();
		in.close();
		long targ = getGCD(a, b);
		long cnt = 1;
		Long div = 2L;
		while ( div <= Math.sqrt(targ) ) {
			if ( targ % div == 0 ) cnt++;
			
			while ( targ % div == 0 ) targ /= div;
			
			div += 1;
		}

		if ( targ != 1 ) cnt++;
		System.out.println(cnt);
	}

	private static long getGCD(long a, long b) {
		if ( b == 0 ) return a;
		else return getGCD(b, a % b);
	}
}

Measured memory_bytes: 38228
#!/usr/bin/env python3
w, h, n = map(int, input().split())
xya = [map(int, input().split()) for _ in range(n)]
x, y, a = [list(i) for i in zip(*xya)]

arr = [[0] * w for i in range(h)]

for i in range(n):
    if a[i] == 1:
        for j in range(h):
            for k in range(x[i]):
                arr[j][k] = 1
    
    elif a[i] == 2:
        for j in range(h):
            for k in range(x[i], w):
                arr[j][k] = 1

    elif a[i] == 3:
        for j in range(y[i]):
            arr[j] = [1 for _ in arr[j]]

    elif a[i] == 4:
        for j in range(y[i], h):
            arr[j] = [1 for _ in arr[j]]

ans = 0
for s in arr:
    ans += s.count(0)

print(ans)

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

int main() {
	string s;
  	cin >> s;
  	if (s.length() % 2) {
        cout << "No";
        return 0;

  	}
  	long long h = 0, i = 0;
  	for (int i = 0; i < s.length(); i++) {
		if (i % 2) {
        	if (s[i] != 'i') {
             	cout << "No";
              return 0;
            }
        } else {
          if (s[i] != 'h') {
             	cout << "No";
              return 0;
            }
        }
    }
  cout << "Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
namespace vectorops {
template <typename T>
vector<T>& operator+=(vector<T>& a, const vector<T>& b) {
	assert(a.size() == b.size());
	for (int i = 0; i < a.size(); ++i) a[i] += b[i];
	return a;
}
template <typename T>
vector<T> operator+(vector<T> a, const vector<T>& b) {
	return a += b;
}
template <typename T>
vector<T>& operator-=(vector<T>& a, const vector<T>& b) {
	assert(a.size() == b.size());
	for (int i = 0; i < b.size(); ++i) a[i] -= b[i];
	return a;
}
template <typename T>
vector<T> operator-(vector<T> a, const vector<T>& b) {
	return a -= b;
}
template <typename T>
vector<T> operator-(vector<T> a) {
	for (int i = 0; i < a.size(); ++i) a[i] = -a[i];
	return a;
}
template <typename T>
vector<T> operator+=(vector<T>& a, const T& b) {
	for (int i = 0; i < a.size(); ++i) a[i] += b;
	return a;
}
template <typename T>
vector<T> operator-=(vector<T>& a, const T& b) {
	for (int i = 0; i < a.size(); ++i) a[i] -= b;
	return a;
}
template <typename T>
vector<T> operator*=(vector<T>& a, const T& b) {
	for (int i = 0; i < a.size(); ++i) a[i] *= b;
	return a;
}
template <typename T>
vector<T> operator*(vector<T> a, const T& b) {
	return a *= b;
}
template <typename T>
vector<T> operator/(vector<T> a, const T& b) {
	return a /= b;
}
template <typename T>
vector<T> operator/=(vector<T>& a, const T& b) {
	for (int i = 0; i < a.size(); ++i) a[i] /= b;
	return a;
}
}; // namespace vectorops
using namespace vectorops;
char str[1000005];
int main() {
	const int INF = 1e9;
	scanf("%s", str);
	int n = strlen(str);
	int lo = 1, hi = 2 * n;
	while (lo < hi) {
		int d = (lo + hi) >> 1;
		vector<int> imn = {0, 1};
		vector<int> imx = {d - (d & 1), d - !(d & 1)};
		auto mn = imn, mx = imx;
		for (int i = 0; i < n; ++i) {
			if (str[i] == '0') {
				mn -= 1;
				mx -= 1;
			} else if (str[i] == '1') {
				mn += 1;
				mx += 1;
			} else {
				mn -= 1;
				mx += 1;
			}
			swap(mn[0], mn[1]);
			swap(mx[0], mx[1]);
			for (int j = 0; j < 2; ++j) {
				mn[j] = max(mn[j], imn[j]);
				mx[j] = min(mx[j], imx[j]);
				if (mn[j] > mx[j]) {
					mn[j] = INF;
					mx[j] = -INF;
				}
			}
		}
		if (mn[0] <= mx[0] || mn[1] <= mx[1]) hi = d;
		else lo = d + 1;
	}
	printf("%d\n", lo);
}


Measured memory_bytes: 4756
import functools

n = int(input())
a = list(map(int, input().split()))

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n

def lcm_list(nums):
        return functools.reduce(lcm, nums)

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

Measured memory_bytes: 263140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define root sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : ' ');
  }
  // os << '}';
  return os;
}

int main()
{
  int r;
  cin >> r;
  double ans = 3.141592648777698869248;
  printf("%.10lf\n", r * 2 * ans);
}

Measured memory_bytes: 3716
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define mod (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
ll dp[3333][3333][2];
int main(){
	ll n,s;
	cin>>n>>s;
	vector<ll>a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<=s;j++){
		  dp[i+1][j][0]+=dp[i][j][0];
		  if(!j)dp[i+1][j][0]++;
		  dp[i+1][j][1]+=dp[i][j][0]+dp[i][j][1];
		  if(!j)dp[i+1][j][1]++;
		  dp[i+1][j][0]%=mod;
		  dp[i+1][j][1]%=mod;
		  if(j+a[i]<=s){
			  dp[i+1][j+a[i]][0]+=dp[i][j][0];
			  dp[i+1][j+a[i]][1]+=dp[i][j][0];
			  if(!j){
				  dp[i+1][j+a[i]][0]++;
				  dp[i+1][j+a[i]][1]++;
			  }
		  }
		  dp[i+1][j][0]%=mod;
		  dp[i+1][j][1]%=mod;
		}
	}
	cout<<dp[n][s][1]%mod;
}

Measured memory_bytes: 156228
'use strict';

function main(stdin) {
  const input = stdin.split(' ').map(v => parseInt(v, 10));
  const A = input[0];
  const B = input[1];

  const p = A - 1;
  let cur = 1;
  let ans = 0;

  while (cur < B) {
    cur += p;
    ++ans;
  }
  
  console.log(ans);
}

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

Measured memory_bytes: 7372
import numpy as np

n,m,x=list(map(int,input().split()))
lis=[]
for i in range(n):
    l=list(map(int,input().split()))
    lis.append(l)


min=-1
for nnn in range(2**n):
    index=[]
    a=nnn
    for i in range(n):
        index.append(a%2)
        a//=2

    money=0
    xs=np.zeros(m)
    for i in range(n):
        if index[i]==1:
            money+=lis[i][0]
            xs+=np.array(lis[i][1:])
    if np.amin(xs)>=x:
        if min==-1:
            min=money
        elif min>money:
            min=money

print(min)

Measured memory_bytes: 27196
from collections import deque
N,K = map(int,input().split())
es = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(N-1)]
tr = [[] for i in range(N)]
for a,b in es:
    tr[a].append(b)
    tr[b].append(a)

def reachable_points(root_v, cant_visit_v):
    visited = [0] * N
    visited[root_v] = visited[cant_visit_v] = 1
    q = deque([(root_v,0)])
    ret = 0
    while q:
        v,dep = q.popleft()
        if dep == K//2: break
        for to in tr[v]:
            if visited[to]: continue
            ret += 1
            q.append((to,dep+1))
            visited[to] = 1
    return ret

def reachable_edges(root_e):
    a,b = es[root_e]
    return reachable_points(a,b) + reachable_points(b,a)

if K%2:
    ans = N
    for center_e in range(N-1):
        ans = min(ans, N - 2 - reachable_edges(center_e))
    print(ans)
else:
    ans = N
    for center_v in range(N):
        ans = min(ans, N - 1 - reachable_points(center_v, center_v))
    print(ans)

Measured memory_bytes: 3944
from itertools import combinations

def read_input():
    d, g = map(int, input().split())

    points = []
    for i in range(d):
        points.append(tuple(map(int, input().split())))

    return d, g, points


def extract(x, lst):
    # xを2進数でlen(lst)桁に変換する
    bin_x = bin(x)[2:]
    bin_x = '0'* (len(lst) - len(bin_x)) + bin_x

    return [l for l, b in zip(lst, bin_x) if b == '1']


def submit():
    d, g, points = read_input()
    points = [(i*100, p, c) for i, (p, c) in enumerate(points, start=1)]

    min_count = float('inf')
    for fp in points:
        # fpを除き、完全に解く問題セットを選ぶ

        rest_points = points.copy()
        rest_points.remove(fp)
        for i in range(2 ** len(rest_points)):
            # コンプする問題を抽出
            comps = extract(i, rest_points)
            solved = 0
            get_points = 0
            for c in comps:
                solved += c[1]
                get_points += c[0] * c[1] + c[2]

            if g > get_points:
                rest = g - get_points
                if rest > fp[0] * fp[1] + fp[2]:
                    # fpだけではgは満たせないので失敗
                    continue
                else:
                    if rest > fp[0] * fp[1]:
                        # ボーナス込みで満たせる
                        solved += fp[1]
                    elif rest % fp[0]:
                        solved += rest // fp[0] + 1
                    else:
                        solved += rest // fp[0]
            
            if min_count > solved:
                min_count = solved

    print(min_count)


if __name__ == "__main__":
    submit()


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

const long long INF = 5e18;

void solve() {
    long long N, K;
    cin >> N >> K;
    vector<long long> x(N), y(N);
    for (int i = 0; i < N; i++) cin >> x.at(i) >> y.at(i);
    long long ans = INF;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            long long x0 = min(x.at(i), x.at(j)), x1 = max(x.at(i), x.at(j));
            for (int k = 0; k < N - 1; k++) {
                for (int l = k + 1; l < N; l++) {
                    long long y0 = min(y.at(k), y.at(l)), y1 = max(y.at(k), y.at(l));
                    int count = 0;
                    for (int m = 0; m < N; m++) {
                        if (x0 <= x.at(m) && x.at(m) <= x1 && y0 <= y.at(m) && y.at(m) <= y1) count++;
                    }
                    if (count >= K) {
                        ans = min(ans, (x1 - x0) * (y1 - y0));
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()
start = [0] * k
c = '0'
ret = 0
for i in range(len(s)):
    if c == '0' and s[i] == '1':
        start.append(i)
    elif c == '1' and s[i] == '0':
        ret = max(ret, i - start.pop(0))
    c = s[i]
ret = max(ret, n - start.pop(0))
print(ret)

Measured memory_bytes: 4340
N=int(input())
H = list(map(int, input().split()))
I=[H[i]-H[i+1] for i in range(N-1)]
a=0
n=0
j=0
while j<N-1:
  if I[j]>=0:
    j+=1
    n+=1
  else:
    j+=1
    a=max(n,a)
    n=0
a=max(n,a)
print(a)

Measured memory_bytes: 14252
n = int(input())
v = list(map(int, input().split()))

odd = dict()
even = dict()

for i in range(n):
    if i % 2 == 0:
        if even.get(v[i]) == None:
            even[v[i]] = 1
        else:
            even[v[i]] += 1
    else:
        if odd.get(v[i]) == None:
            odd[v[i]] = 1
        else:
            odd[v[i]] += 1


odd_max_v = max(odd.values())
odd_max_key = max(odd, key = odd.get)
even_max_v = max(even.values())
even_max_key = max(even, key = even.get)

ans = n
if odd_max_key != even_max_key:
    ans = n - odd_max_v - even_max_v
else:
    odd[odd_max_key] = 0
    even[even_max_key] = 0

    odd_max_v2 = max(odd.values())
    even_max_v2 = max(even.values())

    ans = min(n - odd_max_v - even_max_v2, n - odd_max_v2 - even_max_v)
print(ans)


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

const int N = 1e5+5;

int n, k, A[N];

int main() {
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; ++i) scanf("%d", A+i);
    int mn = 1e9;
    for(int l = 1, r = k; r <= n; ++l, ++r) if(A[l] <= 0 and A[r] >= 0) 
        mn = min(mn, min(2*(-A[l]) + A[r], -A[l] + 2*A[r]));
    else 
        mn = min(mn, A[r] < 0 ? (-A[l]) : A[r]);
    printf("%d\n", mn);
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  ll i,ans=0;
  vec v(3);
  cin>>v[0]>>v[1]>>v[2];
  if((v[0]+v[1])%2){
    ans++;
    if((v[0]+v[2])%2==0)v[0]++,v[2]++;
    else v[1]++,v[2]++;
  }else if((v[0]+v[2])&1){
    ans++;
    v[0]++;
    v[1]++;
  }
  vrsort(v);
  ans+=(v[0]-v[1])/2;
  ans+=(v[0]-v[2])/2;
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    string s;
    cin>>s;
    int a=0;
    int64_t ans=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'){
            a++;
            continue;
        }else if(i+1<s.size()&&s[i]=='B'&&s[i+1]=='C'){
            ans+=a;
            i++;
        }else{
            a=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 832
#include<iostream>

using ll = long long;
using namespace std;
int main(){
	int n;
	cin >> n;
	ll ans = -1.5e15;
	ll nmin = 1.5e15;
	for(int i=0;i<n;++i){
		ll d;
		cin >> d;
		ll num = d - nmin;
		ans = ans < num ? num : ans;
		nmin = nmin > d ? d : nmin;
	}
	cout << ans << endl;

	return 0;
}



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

int main() {
    long long N;
    cin >> N;
    vector<long long> A(5);
    for (int i = 0; i < 5; i++) cin >> A[i];
    sort(A.begin(), A.end());

    long long ans = (N + A[0] - 1) / A[0];
    cout << ans + 4 << endl;
}

Measured memory_bytes: 256
def bubbleSort(A,N,cnt=0):
    flag = 1
    while flag:
        flag = 0
        for i in range(N-1,0,-1):
            if A[i-1] > A[i]:
                A[i-1] , A[i] = A[i] , A[i-1]
                cnt += 1
                flag = 1
    return A , cnt

N = int(input())
A = list(map(int,input().split()))
X , cnt = bubbleSort(A,N)
print(*X)
print(cnt)

Measured memory_bytes: 7784
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
	int sum=0,a;
	for(int i=0;i<4;++i){
		cin>>a;
		sum+=a;
	}
	cout<<sum/60<<endl<<sum%60<<endl;


	return 0;
}

Measured memory_bytes: 3028
# -*- coding: utf-8 -*-
#ARC65C
import copy
import sys
#import math

hoge = input()
n = len(hoge)

while(1):
	n = len(hoge)
	if(n==0):
		print("YES")
		sys.exit()
	if(n<=4):
		print("NO")
		sys.exit()
	else:
		if(hoge[-5:]=="dream"):
			tmp=copy.copy(hoge[0:-5])
			hoge=tmp
		elif(hoge[-5:]=="erase"):
			tmp=copy.copy(hoge[0:-5])
			hoge=tmp
		elif(n<=5):
			print("NO")
			sys.exit()
		else:
			if(hoge[-6:]=="eraser"):
				tmp=copy.copy(hoge[0:-6])
				hoge=tmp
			elif(n<=6):
				print("NO")
				sys.exit()
			else:
				if(hoge[-7:]=="dreamer"):
					tmp=copy.copy(hoge[0:-7])
					hoge=tmp
				else:
					print("NO")
					sys.exit()
	
	


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

int main(){
    int k,s;
    cin >> k >> s;
    int ans = 0;
    for(int i=0; i<=k; i++){
        for(int j=0; j<=k; j++){
            if(0<=s-i-j && s-i-j<=k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256