akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stdlib.h>
#include<utility>
#include<unordered_map>
using namespace std;
#define ll long long
#define pb push_back
#define PI acos(-1)
#define INF 0x3f3f3f3f
inline int re()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*f;
}
/*int a[22];
int vis[22];
int n,m;

void print(int num)
{
    for(int i=1;i<=m;i++)
    {
        if(vis[i]==1){
            num--;
            printf("%d",a[i]);
            if(num==0) puts("");
            else printf("+");
        }
    }
}
void dfs(int pos,int sum,int num)
{
    if(sum>n) return;
    if(sum==n)
    {
        print(num);
        return;
    }
    if(pos==m+1) return;
    vis[pos]=1;
    dfs(pos+1,sum+a[pos],num+1);
    vis[pos]=0;
    dfs(pos+1,sum,num);
}



int main()
{
    while(1)
    {
        cin>>n>>m;
        if(n==0&&m==0) break;
        for(int i=1;i<=m;i++)
        {
            cin>>a[i];
        }
        dfs(1,0,0);
    }
}

*/

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

int a[1111];
int main()
{
    int b,c=0;
    int n,m;
    cin>>n>>m;
    int maxx=0;
    for(int i=1;i<=n;i++) {
        cin>>a[i];
        c+=a[i];
        maxx=max(maxx,a[i]);
    }
    sort(a+1,a+1+n,cmp);
    double t=c/4.0/m;
    int f=0;
    for(int i=1;i<=m;i++)
    {
        if(fabs(a[i]-t)>1e-6)
        {
            if(a[i]<t) {
                f=1;break;
            }
        }
    }
    if(f==1) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


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

#define fori(i,a,b) for (long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 1000000007
#define MAXN 1000000
#define pb push_back
#define vec vector<long long int>
#define ll long long
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count())
#define pi pair<long long int,long long int>
#define sc second
#define fs first

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

    int n,sn,tmp;
    string s;
    cin>>n;
    cin>>s;
    sn = s.size();

    fori(i,0,sn-1)
    {
        if(s[i]+n<='Z')
        s[i] = s[i] + n;
        else
        {
            tmp = n - ('Z'-s[i]);
            s[i] = 'A';
            s[i] += tmp-1;
        }       
    }

    cout<<s;

    return 0;
}

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

int main(){
	int n,k,h,ans;
	ans = 0;
	cin >> n >> k;

	for(int i=0; i<n; i++){
		cin >> h;
		if(h>k-1){
			ans ++;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

void get_prime(vector<size_t> &prime)
{
    vector<int> a(1000000, 1);

    a[0] = a[1] = 0;
    for(size_t i = 2; i < 1000000; ++i)
    {
        if(a[i] == 1) 
        {
            for(size_t j = 2 * i; j < 1000000; j += i)
            {
                a[j] = 0;
            }
        }
    }

    prime.clear();
    for(size_t i = 0; i < 1000000; ++i)
    {
        if(a[i] == 1)
        {
            prime.push_back(i);
        }
    }
}

size_t count_num(size_t N)
{
    size_t c = 0;
    size_t sum = 0;
    size_t add = 0;
    while(1)
    {
            
        ++add;
        sum += add;
        
        if(sum <= N)
        {
            ++c;    
        }
        else
        {
            break;    
        }
    }

    return c;    
}

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

    vector<size_t> prime;
    get_prime(prime);

    vector<size_t> index(prime.size(), 0);

    size_t NN = N;
    for(size_t i = 0; i < prime.size(); ++i)
    {
        while(1)
        {
            if(NN % prime[i] == 0)
            {
                NN /= prime[i];
                index[i]++;
            }
            else
            {
                break;    
            }
        }

        if(NN == 1)
        {
            break;    
        }
    }

    if(NN > 1)
    {
        prime.push_back(NN);
        index.push_back(1);
    }

    size_t count = 0;
    for(size_t i = 0; i < index.size(); ++i)
    {
        if(index[i] > 0)
        {
            count += count_num(index[i]);
        }
    }

    cout << count << endl;
    return 0;    
}

Measured memory_bytes: 8220
/*
 * atcode153-b
 */

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

int
comp_int(const void *p1, const void *p2)
{
  int *i1 = (int *)p1;
  int *i2 = (int *)p2;

  return (*i1 < *i2);
}

int
main(int argc, char *argv[])
{
  int sum = 0;
  int h, n, w, i;

  scanf("%d", &h);
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &w);
    sum += w;
    if (sum >= h) {
      printf("Yes\n");
      return (0);
    }
  }

  printf("No\n");
  
  return (0);
}


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

int Search(int*, int, int);

int main()
{
  int i;
  int n, q, C=0;
  int *S, *T;

  scanf("%d", &n);
  S = (int*)malloc((n+1) * sizeof(int));
  if(S == NULL)
    {
      printf("malloc failed\n");exit(1);
    }
  for(i=0;i<n;i++)
    {
      scanf("%d", &S[i]);
    }

  scanf("%d", &q);
  T = (int*)malloc(q * sizeof(int));
  if(T == NULL)
    {
      printf("malloc failed\n");exit(2);
    }
  for(i=0;i<q;i++)
    {
      scanf("%d", &T[i]);
    }

  for(i=0;i<q;i++)
    {
      if(Search(S, n, T[i]))C++;
    }

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

  free(S);
  free(T);
  return 0;
}

int Search(int *S, int n, int key)
{
  int i=0;
  S[n] = key;
  while(S[i] != key)
    {
      i++;
      if(i==n)return 0;
    }
  return 1;
}



Measured memory_bytes: 2104
#include <cmath>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 100005
#define mod 1000000007ll
using namespace std;
typedef long long ll;

inline int rd() {
  int x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  return x;
}

int n, cnt[27];

char s[N];

ll ans = 1;

int main() {
  n = rd();
  scanf("%s", s);
  for (int i = 0; i < n; ++i) ++cnt[s[i] - 'a'];
  for (int i = 0; i < 26; ++i) ans = ans * (cnt[i] + 1) % mod;
  printf("%lld\n", (ans - 1 + mod) % mod);
  return 0;
}


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


int main(void) {
   int N;
   cin>>N;
   // vector<int> B;
   multimap<int,int> A;
   // A.reserve(N);
   // B.reserve(N);
   for (int i = 0; i < N;i++) {
      int a;
      cin>>a;
      // B.push_back(a);
      A.insert(make_pair(a,i));
      // A[a] = i;
   }
   auto itr = A.begin();
   // cout<<itr->first<<endl;
   for (int i = 0; i < N/2-1;i++) itr++;
   // itr = itr + N-2/1;
   int a = itr->first;
   itr++;
   int b = itr->first;
   // cout<<b<<" "<<a<<endl;
   if (a == b) cout<<"0"<<endl;
   else cout<<b-a<<endl;
   return 0;
}

Measured memory_bytes: 4992
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 4005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int cs[MAX][3];

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

    int n;
    string str;

    cin>>n;
    cin>>str;

    for(int i = 0; i < n; i++){
        cs[i+1][0] = cs[i][0];
        cs[i+1][1] = cs[i][1];
        cs[i+1][2] = cs[i][2];

        if(str[i] == 'R')
            cs[i+1][0] = cs[i][0] + 1;
        else if(str[i] == 'G')
            cs[i+1][1] = cs[i][1] + 1;
        else
            cs[i+1][2] = cs[i][2] + 1;

    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int d = j - i;
            if(str[i] != str[j]){
                if(str[i] == 'R' && str[j] == 'G'){
                    int temp = cs[n][2] - cs[j][2];
                    if(str[j+d] == 'B')
                        temp--;
                    ans += (ll) temp;
                }
                else if(str[i] == 'R' && str[j] == 'B'){
                    int temp = cs[n][1] - cs[j][1];
                    if(str[j+d] == 'G')
                        temp--;
                    ans += (ll) temp;
                }
                else if(str[i] == 'G' && str[j] == 'R'){
                    int temp = cs[n][2] - cs[j][2];
                    if(str[j+d] == 'B')
                        temp--;
                    ans += (ll) temp;
                }
                else if(str[i] == 'G' && str[j] == 'B'){
                    int temp = cs[n][0] - cs[j][0];
                    if(str[j+d] == 'R')
                        temp--;
                    ans += (ll) temp;
                }
                else if(str[i] == 'B' && str[j] == 'R'){
                    int temp = cs[n][1] - cs[j][1];
                    if(str[j+d] == 'G')
                        temp--;
                    ans += (ll) temp;
                }
                else if(str[i] == 'B' && str[j] == 'G'){
                    int temp = cs[n][0] - cs[j][0];
                    if(str[j+d] == 'R')
                        temp--;
                    ans += (ll) temp;
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


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

const int MAX_V = 30;

vector<int> g[MAX_V]; //????????
vector<int> tp; //????????????????????????????????????

bool visit(int v, vector<int> &color){
    color[v] = 1;
    rep(i,g[v].size()){
        int d = g[v][i];
        if(color[d] == 2) continue;
        if(color[d] == 1) return false;
        if(not visit(d, color)) return false;
    }
    tp.emplace_back(v);
    color[v] = 2;
    return true;
}

bool topologicalSort(int v){
    vector<int> color(v);
    rep(i,v){
        if(not color[i] && not visit(i, color)) return false;
    }
    reverse(all(tp));
    return true;
}

int main(){
    int n;
    while(cin >> n,n){
        rep(i,MAX_V) g[i].clear();
        tp.clear();
        char s[505][15];
        rep(i,505) rep(j,15) s[i][j] = '\0';
        rep(i,n) cin >> s[i];

        bool ans = true;
        rep(i,n){
            range(j,i + 1, n){
                rep(k,15){
                    if(s[i][k] != '\0' && s[j][k] == '\0'){
                        ans = false;
                        break;
                    }else if(s[i][k] == '\0' || s[j][k] == '\0'){
                        break;
                    }else if(s[i][k] != s[j][k]){
                        //cout << s[i][k] << ' ' << s[j][k] << endl;
                        g[s[i][k] - 'a'].emplace_back(s[j][k] - 'a');
                        break;
                    }
                }
            }
        }

        cout << (topologicalSort(30) && ans ? "yes" : "no") << endl;
    }
}

Measured memory_bytes: 8248
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    int Q; cin >> Q;
    while(Q--) {
        int countD = 0, countM = 0, countDM = 0, ans = 0;
        int k; cin >> k;
        vector<int> addDM(1000010, 0);
        rep(i, N) {
            if (S[i] == 'D') countD++;
            else if (S[i] == 'M') {
                countM++; 
                countDM += countD;
                addDM[i] = countD;
            }
            else if (S[i] == 'C') ans += countDM;

            if (i < k - 1) continue;
            if (S[i - k + 1] == 'D') {
                countD--;
                countDM -= countM;
            }
            else if (S[i - k + 1] == 'M') {
                countM--;
            }
            //cout << i << " " << countD << " " << countM << " " << countDM << " " << ans << endl;
        }
        cout << ans << endl;
    }

    return 0;
}


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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll a, x;
  cin >> x >> a;
  if (x < a) {
    COUT(0);
    return;
  }
  COUT(10);

}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*

3 2
*/


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

int main () {

    int N;
    string S;
    cin >> N;
    cin >> S;

    if (S.substr(0,N/2) == S.substr(N/2)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut edge: Vec<Vec<usize>> = vec![Vec::new(); 26];
    let mut vert: Vec<usize> = vec![];
    for i in 0..n {
        let a: Vec<char> = itr.next().unwrap().chars().collect();
        let v = ((a[0] as u8) - ('a' as u8)) as usize;
        edge[v].push(i);
        vert.push(v);
    }

    let mut dp = vec![200_000; n + 1];
    let mut min_char = vec![200_000; 26];
    dp[0] = 0;
    for i in 1..n + 1 {
        dp[i] = std::cmp::min(dp[i], dp[i - 1] + 1);
        dp[i] = std::cmp::min(dp[i], min_char[vert[i - 1]]);
        min_char[vert[i - 1]] = std::cmp::min(min_char[vert[i - 1]], dp[i]);
    }
    println!("{}", dp[n]);
}


Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,flag1=0;
    vector<long long int>s1;
    vector<long long int>s2;
    vector<long long int>s3;
    cin>>n;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            flag1=1;
            break;
        }
    }
    if(flag1==0)
        cout<<n-1<<endl;
    else
    {
        for(i=1;i*i<=n;i++)
        {
            if(n%i==0){
            s1.push_back(i);
            s2.push_back(n/i);}
        }
        /*for(i=0;i<s1.size();i++)
            cout<<s1[i]<<" "<<s2[i]<<endl;*/
        for(i=0;i<s1.size();i++)
        {
            s3.push_back((s1[i]-1)+(s2[i]-1));
        }

    sort(s3.begin(),s3.end());
    cout<<s3[0]<<endl;}
}


Measured memory_bytes: 384
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text.RegularExpressions;
    using System.Text;
    using System.Net;

     
    public class Program
    {

        public void Proc() {
            int len = int.Parse(Reader.ReadLine());
            int[][] blocks = new int[2][];
            for(int i=0; i<2; i++) {
                blocks[i] = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
            }
            int ans = 0;
            for(int i=0; i<len; i++) {
                int subTotal = 0;
                for(int j=0; j<=i; j++) {
                    subTotal+=blocks[0][j];
                }
                for(int j=i; j<len; j++) {
                    subTotal+=blocks[1][j];
                }
                ans = Math.Max(ans, subTotal);
            }
            Console.WriteLine(ans);
        }

        public class Reader {
            public static bool IsDebug = false;
            private static System.IO.StringReader SReader;
            private static string InitText = @"





5
3 2 2 4 1
1 2 2 2 1







";
            public static string ReadLine() {
                if(IsDebug) {
                    if(SReader == null) {
                        SReader = new System.IO.StringReader(InitText.Trim());
                    }
                    return SReader.ReadLine();
                } else {
                    return Console.ReadLine();
                }
            }
        }
        public static void Main(string[] args)
        {
            #if DEBUG
            Reader.IsDebug = true;
            #endif
            Program prg = new Program();
            prg.Proc();
        }
    }

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

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 2000007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>

// get value
#define FF first
#define SS second

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T min(T a, T b, T c, T d) {
    return min(a, min(b, min(c, d)));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

template <class T>
T max(T a, T b, T c, T d) {
    return max(a, max(b, max(c, d)));
}

bool cmp(const int& a, const int& b) {return a > b;}

int t[maxN];

int main() {
//    #ifndef ONLINE_JUDGE
//        freopen("tmp.inp", "r", stdin);
//        freopen("tmp.out", "w", stdout);
//    #endif // ONLINE_JUDGE

    int n, c, k;
    scanf("%d%d%d", &n, &c, &k);

    int cnt = 1;
    fto (i, 1, n) scanf("%d", &t[i]);
    sort(t+1, t+n+1);

//    fto (i, 1, n) cout << t[i] << " ";
//    puts("");

    queue <int> q;
    fto (i, 1, n) {
        if (q.empty() || (q.size() < c && q.front()+k >= t[i])) q.push(t[i]);
        else {
            ++cnt;
            while (q.size()) q.pop();
            q.push(t[i]);
        }
    }

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt(),M=sc.nextInt(),X=sc.nextInt();
		int[] A=new int[M];
		int cstL=0,cstR=0;
		for(int i=0;i<M;i++){
			A[i]=sc.nextInt();
			if(A[i]<X){
				cstL=cstL+1;
			}else{
				cstR=cstR+1;
			}
		}
		int cst=cstL;
		if(cst>cstR){
			cst=cstR;
		}
		System.out.println(cst);
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
//double pi=3.1415926535898;
//double pi=acos(-1.0);
#define scarr(a,s,e) for(int i=s;i<=int(e);i++) scanf("%d ",&a[i]);
#define prarr(a,s,e) for(int i=s;i<=int(e);i++) printf("%d ",a[i]);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define mkp        make_pair
#define fr         first
#define se         second
#define sc(x)      scanf("%d",&x)
#define pr(x)      printf("%d ",x)
#define scl(x)     scanf("%lld",&x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define r0         return 0;
#define CC         continue;
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x);
#define bb(x)      cerr<< x <<endl;
#define ii         pair<int,int>
//#define max(a,b) a<b?b:a
//#define min(a,b) a<b?a:b
const ll M   = 1e7+9 ;
const ll inf = 1e19  ;
const int si = 1e5+9 ;
//////////////////////    Hi    ^_^  hack me if you can :P
int T, N, D;
int ans;
int main() {
 
  for (scanf("%d", &T); T > 0; T--) {
    scanf("%d%d", &N, &D);
    ans = (N - 1) * 127;
    ans += (N % 2 == 0) ? 127 - D : D;
    printf("%d\n", ans);
  }

    r0;
}


/*

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

*/
/*
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);
for (int i=0;i<n;i++)            Hi    ^_^  hack me if you can :P
int mx[]= {0,0,1,1,1,-1,-1,-1};
int my[]= {1,-1,0,1,-1,0,1,-1};
bool inside (int i,int j) {return (i>=0 && i<n && j>=0 && j<m);}
*/


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n;
	int ans = 1;
	scanf("%d", &n);
	while (ans <= n)
	{
		ans = ans * 2;
	}
	if (ans == 1)
	{
		printf("1");
	}
	else
	{
		printf("%d", ans / 2);
	}
	return 0;
}

Measured memory_bytes: 128
import itertools
from operator import add
n,m,x = map(int,input().split())
li = []
money=100000000
for i in range(n):
	li.append(list(map(int,input().split())))

for i in range(1, n+1, 1):
	for v in itertools.combinations(li, i):
		sum_li = [0]*(m+1)
		for j in v:
			sum_li = [x+y for (x, y) in zip(sum_li,j)]
		for j in range(m):
			if(sum_li[j+1] < x):
				break
		else:
			money = min(sum_li[0], money)

print(money if(money != 100000000) else -1)



Measured memory_bytes: 9272
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int cnt[3] = {};
    rep(i, n) {
        int p;
        cin >> p;
        if (p <= a) cnt[0]++;
        else if (b+1 <= p) cnt[2]++;
        else cnt[1]++;
    }
    cout << *min_element(cnt, cnt+3) << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import qualified Data.IntMap.Strict as IM
-- import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
import Debug.Trace
-- trace _ = id

solve :: Int -> Int -> [(Int,Int)] -> [Int]
solve bN bM lstAB = map (\x -> (combi2 bN) - x) conn
  where
  conn = map (\(_,_,x) -> x) tr
  tr = tail $ reverse $ scanl' op (IM.empty, initCC, 0) (reverse lstAB)
  initCC = IM.fromDistinctAscList [(i,1) | i <- [1..bN]]
  op (!uf, !cc, !count) (a,b)
      -- | traceL "op" (show (a,b)) False = undefined
      | a' == b'  = (uf2, cc, count)
      | otherwise = (newUF, newCC, newCount)
    where
    (uf1, a') = getTop a uf
    (uf2, b') = getTop b uf1
    {-
    getTop x ufX | traceL "getTop" (show (x, ufX)) False = undefined
    getTop x ufX = traceL "getTopFin" (show aaa) aaa
      where aaa = getTopZ x ufX
    -}
    getTop x ufX = case IM.lookup x ufX of
      Nothing -> (ufX, x)
      Just y -> let (ufZ, z) = getTop y ufX
                in (IM.adjust (const z) x ufZ, z)
    -- newUF = traceL "newUF" (show (b', a', uf2, newUFZ)) newUFZ
    newUF = IM.insert b' a' uf2
    nA = cc IM.! a'
    nB = cc IM.! b'
    nSum = nA + nB
    newCount = count + (combi2 nSum) - (combi2 nA) - (combi2 nB)
    newCC = IM.adjust (const nSum) a' cc
    

combi2 n = (n * (n-1)) `div` 2

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> [Int]
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_bN,bs_bM]:remLines1 = remLines0
      bN = readBInt bs_bN
      bM = readBInt bs_bM
      lstAB = map (\[x1,x2] -> (readBInt x1,readBInt x2)) remLines1
  in solve bN bM lstAB

outAnswer :: [Int] -> IO ()
outAnswer ns = putStr (unlines (map show ns))

main :: IO ()
main = outAnswer . tmain =<< B.getContents

traceL :: Show a => String -> a -> b -> b
traceL label showObj val = trace (label ++ " " ++ show showObj) val

-------------------------------------------------------------------------------

inp1 = "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"
inp2 = "6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n"
inp3 = "2 1\n1 2\n"
tv1 = tmain $ B.pack inp1
tv2 = tmain $ B.pack inp2
tv3 = tmain $ B.pack inp3
test1 = tv1 == [0,0,4,5,6]
test2 = tv2 == [8,9,12,14,15]
test3 = tv3 == [1]
alltest = test1 && test2 && test3



Measured memory_bytes: 377212
#include<cstdio>
#include<list>
#include<algorithm>
using namespace std;

int main() {
  int q, x;
  char com[20];
  list<int> v;
  scanf("%d", &q);
  for (int i = 0; i < q; i ++) {
    scanf("%s", com);
    if (com[0] == 'i') {
      scanf("%d", &x);
      v.push_front(x);
    } else if (com[6] == 'L') {
      v.pop_back();
    } else if (com[6] == 'F') {
      v.pop_front();
    } else if (com[0] == 'd') {
      scanf("%d", &x);
      for (list<int>::iterator it = v.begin(); it != v.end(); it ++) {
        if (*it == x) {
          v.erase(it);
          break;
        }
      }
    }
  }

  int i = 0;
  for (list<int>::iterator it = v.begin(); it != v.end(); it ++) {
    if (i ++) printf(" ");
    printf("%d", *it);
  }
  printf("\n");
}



Measured memory_bytes: 33940
import java.util.Scanner;

public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
}

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

string str;

int main() {
  cin >> str;
  if (str == "ABC") {
    cout << "ARC" << endl;
  }else{
    cout << "ABC" << endl;
  }
  return 0;
}


Measured memory_bytes: 3580
#ifdef Rahul
# include "RAHUL.h"
#else
# include <bits/stdc++.h>
  using namespace std;
# define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;


int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  i64 n; cin >> n;
  int ans = 0;
  i64 x = n;
  for (i64 p = 2; p * p <= n; ++p) {
    int cnt = 0;
    while (x % p == 0) {
      ++cnt;
      x /= p;
    }
    for (int i = 1; cnt >= i; ++i) {
      ++ans, cnt -= i;
    }
  }
  if (x > 1) ++ans;
  cout << ans << '\n';
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> pii;
const int maxn = 5000 + 10;
int n;
long long dp[maxn][maxn];
vector<pii> v;


int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    v.resize(n + 1);
    for(int i = 1; i <= n; i++){
        cin>>v[i].first>>v[i].second;
    }
    sort(v.begin() + 1,v.end(), [](auto x,auto y){ return x.first + x.second < y.first + y.second;});
    memset(dp,0x3f,sizeof(dp));
    dp[0][0] = 0;
    for(int i = 1; i < (int) v.size(); i++){
        for(int j = 1; j <= i; j++){
            dp[i][j] = dp[i - 1][j];
            if(dp[i - 1][j - 1] <= v[i].first) dp[i][j] = min(dp[i - 1][j - 1] + v[i].second,dp[i][j]); 
        }
    }
    int ans = 0;
    for(int i = 1; i < (int) v.size(); i++){
        if(dp[n][i] != dp[1][0]) ans = i;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 196480
#include<stdio.h>

int main(void){
      int n;
      int num;
      scanf("%d", &n);
          int max = -1000000;
          int min = 1000000;
          long long sum = 0;
          for (int i = 0; i < n; i++) {
              scanf("%d", &num);
              if(max < num) max = num;
              if(min > num) min = num;
              sum += num;
          }
        printf("%d %d %lld\n",min,max,sum); 
      
  
   return 0;
}


Measured memory_bytes: 2108
#include <vector>
#include <math.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int n, u, k, v, dp[101];
bool li[101][101];


int main(){
	fill(dp, dp + 101, -1);
	for (int i = 0; i < 101; i++) {
		fill(li[i], li[i] + 101, false);
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			li[u][v] = true;
		}
	}
	vector<int> l = vector<int>(1, 1);
	vector<int> l2 = vector<int>();
	dp[1] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < l.size(); j++) {
			for (int k = 1; k <= n; k++) {
				if (li[l[j]][k] && dp[k] < 0) {
					dp[k] = i;
					l2.push_back(k);
				}
			}
		}
		l2.swap(l);
		vector<int>().swap(l2);
	}
	for (int i = 1; i <= n; i++) {
		cout << i << " " << dp[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3100
N = int(input())
T, A = (int(i) for i in input().split())
H = [int(i) for i in input().split()]

H_T = [0 for i in range(len(H))]
for i in range(len(H)):
    H_T[i] = float(T) - float(H[i])*0.006

min = 1000
index = 0
for i in range(len(H_T)):
    if(abs(H_T[i] - A) < min):
        index = i
        min = abs(H_T[i] - A)
print(index+1)


Measured memory_bytes: 3064
n=int(input())
s=input()

w=0
for i in s:
        if i==".":
                w+=1

b=0
min=10**5+1
for i in range(len(s)):
        temp=0
        if i>=1 and s[i-1]=="#":
                b+=1
        if s[i]==".":
                w-=1
        temp=w+b
        if temp<min:
                min=temp

print(min)

Measured memory_bytes: 3500
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:i64, m:i64};

    println!("{}", (m*1900i64+(n-m)*100)* 2i64.pow(m as u32));

}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0,i;
	string s;
	char c;
	cin>>n>>s;
	ans=count(s.begin(),s.end(),'R');
	if(ans==n)
	cout<<0;
	else
	{
		int cnt=ans;
	for(i=0;i<cnt;i++)
	{
		if(s[i]=='R')
		ans--;
	}
	cout<<ans;
	}
  return 0;
}

Measured memory_bytes: 3752
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();

    	String[][] A=new String[N][N];

    	for(int i=0;i<N;i++) {
    		A[i]=sc.next().split("");
    	}

    	String[][] B=new String[M][M];

    	for(int i=0;i<M;i++) {
    		B[i]=sc.next().split("");
    	}

    	int set=N-M;

    	for(int x=0;x<=set;x++) {
    		
    		for(int y=0;y<=set;y++) {
    			boolean isMatch=true;
    			for(int i=0;i<M;i++) {
    				for(int j=0;j<M;j++) {
    					if(!A[x+i][y+j].equals(B[i][j])) {
    						isMatch=false;
    					}
    				}
    			}

    			if(isMatch) {
    				System.out.println("Yes");
    				return;
    			}

    		}
    	}

    	System.out.println("No");

    }

}



Measured memory_bytes: 22228
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
using namespace std;
template<class T>il read(T &x){
	x=0;int f=1;char k=getchar();
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>9) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
const int N = 2e5+5;
int n,sz,s[N],val[N],cnt[N];
ll ans;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i)
		read(val[i]),s[i]=val[i];
	sort(s+1,s+1+n),sz=unique(s+1,s+1+n)-s-1;
	for(ri i=1;i<=n;++i)
		++cnt[lower_bound(s+1,s+1+sz,val[i])-s];
	for(ri i=1;i<=sz;++i) ans+=1ll*cnt[i]*(cnt[i]-1)/2;
	for(ri i=1;i<=n;++i){
		int id=lower_bound(s+1,s+1+sz,val[i])-s;
		print(ans-(cnt[id]-1)),puts("");
	}
	return 0;
}

Measured memory_bytes: 4096
from heapq import heappush, heappop

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

pq = []
for i in range(n):
    heappush(pq, -a[i])

for i in range(m):
    a_max = - heappop(pq)
    if a_max == 0:
        break
    a_max //= 2
    heappush(pq, -a_max)

ans = -sum(pq)
print(ans)


Measured memory_bytes: 14184
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll A, B, C;

void solve() {
	cin >> A >> B >> C;
	if(C - A - B <= 0) cout << "No\n";
	else {
		if(4 * A * B < (C - A - B) * (C - A - B)) cout << "Yes\n";
		else cout << "No\n";
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <utility>

using namespace std;
typedef pair<int,int> pii;

#define foreach(i, n) for (typeof(n) i = 0; i < (n); ++i)

inline bool between(int lower, int upper, int x) { return lower <= x && x < upper; }
inline bool between(pii lower, pii upper, pii x) {
    return between(lower.first, upper.first, x.first)
        && between(lower.second, upper.second, x.second);
}
pii dirctions[4] = { pii(0,-1), pii(0,1), pii(-1,0), pii(1,0) };
template <typename S, typename T> inline
pair<S,T> operator+(const pair<S,T> & p, const pair<S,T> & q) {
    return pair<S,T>(p.first + q.first, p.second + q.second);
}

#define MAX_H 100
#define MAX_W 100

int H, W;
char data[MAX_H][MAX_W];
stack<pii> stk;

int main() {
    while (true) {
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        foreach (i, H) foreach (j, W) cin >> data[i][j];

        int cnt = 0;
        foreach (i, H) {
            foreach (j, W) {
                char self = data[i][j];
                if (not self) continue;
                ++ cnt;
                stk.push(pii(i,j));
                while (not stk.empty()) {
                    pii pos = stk.top();
                    stk.pop();
                    foreach (d, 4) {
                        pii nxt = pos + dirctions[d];
                        if (not between(pii(0,0), pii(H,W), nxt)) continue;
                        if (data[nxt.first][nxt.second] != self) continue;
                        data[nxt.first][nxt.second] = 0;
                        stk.push(nxt);
                    }
                }
                stk = stack<pii>();
            }
        }

        cout << cnt << endl;
    }
}

Measured memory_bytes: 1272
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
// #define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int a,b;
	cin>>a>>b;
	cout<<max({a+b,a-b,a*b})<<endl;
}


Measured memory_bytes: 256
#include <iostream>

const int nmax=40,abmax=10,inf = 1000000;
int a[nmax],b[nmax],c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];
int main(){
  int n,ma,mb;
  std::cin >> n >> ma >> mb;
  for(int i=0;i<n;++i)
    std::cin >> a[i] >> b[i] >> c[i];

  for(int i = 0; i <= n; ++i)
    for(int ca = 0; ca <= nmax*abmax; ++ca)
      for(int cb = 0; cb <= nmax*abmax; ++cb)
        dp[i][ca][cb]=inf;

  dp[0][0][0]=0;
  
  for(int i=0;i<n;++i)
    for(int ca = 0; ca <= nmax*abmax; ++ca)
      for(int cb = 0; cb <= nmax*abmax; ++cb){
        if(dp[i][ca][cb]==inf)
          continue;
        dp[i+1][ca][cb]=std::min(dp[i+1][ca][cb],dp[i][ca][cb]);
        dp[i+1][ca+a[i]][cb+b[i]]=
          std::min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
      }

  int ans=inf;
  for(int ca = 1; ca <= nmax*abmax; ++ca)
    for(int cb = 1; cb <= nmax*abmax; ++cb)
      if(ca*mb==cb*ma)
        ans=std::min(ans,dp[n][ca][cb]);
  
  if(ans==inf)
    ans=-1;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 25984
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

string my_readln() { return chomp(readln()); }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = my_readln.split;
	auto N = tokens[0].to!long;
	auto A = my_readln.split.to!(long[]);

	foreach (i, ref e; A) e -= (i + 1);
	A.sort();
	long ans;
	foreach (e; A) ans += abs(e - A[$/2]);

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 11224
#include<bits/stdc++.h>
#define show(x) cout<<#x" = "<<x<<endl;
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> iipair;
typedef pair<unsigned,unsigned> uupair;
typedef vector<int> vec;
typedef vector<unsigned> uvec;
typedef vector<ll> llvec;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,k;
    cin>>n>>k;
    llvec h(n);
    for(unsigned i=0;i<n;cin>>h[i++]);
    sort(h.begin(),h.end());
    ull count=0;
    for(ll i=0;i<=n-k-1;++i) count+=h[i];
    cout<<count;
}

Measured memory_bytes: 1792