akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
  ll x,y;
  cin>>x>>y;
  if(x>y)swap(x,y);
  if(x<2&&y<2){
    cout << "Brown" << endl;
    return 0;
  }
  if(x==0){
    cout << "Alice" << endl;
    return 0;
  }
  if(x==1){
    if(y==2){
      cout << "Brown" << endl;
      return 0;
    }
    else{
      cout << "Alice" << endl;
      return 0;      
    }
  }
  if(abs(x-y)<=1){
      cout << "Brown" << endl;
      return 0;    
  }
  cout << "Alice" << endl;
  return 0;
}


Measured memory_bytes: 256
# frozen_string_literal: true
 
n = readline.to_i
 
t = readline.strip.split.map(&:to_i)
 
m = readline.to_i
 
s = t.inject(:+)
 
m.times do
  p, x = readline.strip.split.map(&:to_i)
  p s - t[p - 1] + x
end

Measured memory_bytes: 1916
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,c,h,k,m,maxi,d,x;
	cin>>n;
	if(n%1000==0)
	{
		cout<<0;
		return 0;
	}
	c=n%1000;
	cout<<1000-c;
}



	

		

Measured memory_bytes: 3636
while True:
	h, w = map(int, raw_input().split())
	if (h == 0) and (w == 0):
		break
	for i in xrange(h):
		line = ""
		for j in xrange(w):
			if (i*j == 0) or ((i-h+1)*(j-w+1) == 0):
				line += "#"
			else:
				line += "."
		print line
	print 

Measured memory_bytes: 4212
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int dp[123456][15], k;
signed main() {
	string s; cin >> s;
	dp[0][0] = 1;
	for0(i, s.size()) {
		if (s[i] == '?') {
			for (k = 0; k <= 9; k++) {
				for0(j, 13)dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
			}
		}
		else {
			k = s[i] - '0';
			for0(j, 13)dp[i + 1][(j * 10 + k) % 13] = dp[i][j];
		}
		for0(j, 13)dp[i + 1][j] %= mod;
	}
	cout << dp[s.size()][5] << endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
int main()
{long long n=0,max=0,s=0;
    cin>>n;
    long long a[n];
    for(long long j=0;j<n;j++)
    {
        cin>>a[j];
        if(a[j]>max)
        max=a[j];
        else
        s+=(max-a[j]);
    }
    cout<<s;
}

Measured memory_bytes: 5152
#include <iostream>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;

    bool success = false;
    for (int i = 0; i < s.size(); i++)
    {
        auto u = s.substr(i, s.size()) + s.substr(0, i);
        if (t == u)
        {
            success = true;
        }
    }
    cout << (success ? "Yes" : "No") << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//BEGIN CUT HERE
template <typename T>
struct WeightedUnionFind{
    int n;
    T d;
    vector<int> r,p;
    vector<T> ws;
    WeightedUnionFind(){}
    WeightedUnionFind(int sz,T d_):
    n(sz),d(d_),r(n,1),p(n),ws(n,d){iota(p.begin(),p.end(),0);}
    int find(int x){
        if(x==p[x]){
            return x;
        }else{
            int t=find(p[x]);
            ws[x]+=ws[p[x]];
            return p[x]=t;
        }
    }
    T weight(int x){
        find(x);
        return ws[x];
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    void unite(int x,int y,T w){
        w+=weight(x);
        w-=weight(y);
        x=find(x);y=find(y);
        if(x==y) return;
        if(r[x]<r[y]) swap(x,y),w=-w;
        r[x]+=r[y];
        p[y]=x;
        ws[y]=w;
    }
    T diff(int x,int y){
        return weight(y)-weight(x);
    }
};
int main(){
    int n,m;
    cin >> n >> m;
    WeightedUnionFind<ll>k(n+1,0);
    rep(i,m){
        int l,r,d;
        cin >> l >> r >> d;
        if(k.same(l,r) and k.diff(l,r)!=d){
            puts("No");
            return 0;
        }
        k.unite(l,r,d);
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<cmath>
#include<numeric>
#include<ctime>
#include<locale>
//freopen("std.in","r",stdin);freopen("stdout.out","w",stdout);
using namespace std;
long long a[55];
int main()
{
    long long k=0;
    cin>>k;
    for(long i=0;i<50;i++)
    {
        a[i]=49+k/50;
    }
    k%=50;
    for(long i=0;i<k;i++)
    {
        for(long j=0;j<50;j++)
        {
            if(j!=i)
            {
                a[j]--;
            }
            else
            {
                a[j]+=50;
            }
        }
    }
    printf("50\n");
    for(long i=0;i<50;i++)
    {
        printf("%ld ",a[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
def main(argv)
  (a, b, k) = gets.chomp.split(' ').map(&:to_i)

  x = [0, a - k].max
  m = 0
  m = k - a if a < k
  y = [0, b - m].max

  puts [x, y].map(&:to_s).join(' ')
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		
		String s = sc.next();
		if (s.charAt(0) == '1') ans++;
		if (s.charAt(1) == '1') ans++;
		if (s.charAt(2) == '1') ans++;
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 21588
n = int(input())

sp = []
for i in range(n):
    s, p = map(str, input().split())
    sp.append([s, int(p), i + 1])
    
sp.sort(key=lambda x:x[1], reverse=True)
sp.sort(key=lambda x:x[0])

for e in sp:
    print(e[2])


Measured memory_bytes: 3060
//
//  main.cpp
//  AGC043A2
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;
int main(int argc, const char * argv[]) {
    int H,W;
    cin>>H>>W;
    vector<vector<char>> p(H+1,vector<char>(W+1,'.')); // 盤のデータ #黒　.白
    for (int r=1; r<=H; r++) {
        for (int c=1; c<=W; c++) {
            cin>>p.at(r).at(c);
        }
    }
    vector<vector<int>>dp(H+1,vector<int>(W+1,0)); // ゴールにたどり着くまで 違う色に移動する回数
    for (int i=1; i<=H; i++) {
        for (int j=1; j<=W; j++) {
            int from_Left=0;
            int from_Up=0;
            if (p.at(i).at(j)!=p.at(i).at(j-1)) {
                from_Left=1;
            }
            if(p.at(i).at(j)!=p.at(i-1).at(j)){
                from_Up=1;
            }
            if (i==1) { // １行目は左からのみ
                dp.at(i).at(j)=dp.at(i).at(j-1)+from_Left;
            }
            if(j==1){ // 一列目は上からのみ
                dp.at(i).at(j)=dp.at(i-1).at(j)+from_Up;
            }
            if (i!=1 && j!=1) {
                dp.at(i).at(j)=min(dp.at(i).at(j-1)+from_Left,dp.at(i-1).at(j)+from_Up);
            }
        }
    }
    if (p.at(H).at(W)=='#') {
        dp.at(H).at(W)++;
    }
            cout<<dp.at(H).at(W)/2<<endl;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 50
i64 n_layer[MAX_N + 1];
i64 n_patty[MAX_N + 1];

i64 rec(i64 i, i64 x) {
    if (i == 0) {
        if (x > 0) return 1;
        else return 0;
    }

    if (x >= n_layer[i]) return n_patty[i];

    if (x <= 1) return 0;
    else if (x <= 1 + n_layer[i - 1]) return rec(i - 1, x - 1);
    else if (x <= 1 + n_layer[i - 1] + 1) return n_patty[i - 1] + 1;
    else if (x <= 1 + 2 * n_layer[i - 1] + 1) return n_patty[i - 1] + 1 + rec(i - 1, x - (1 + n_layer[i - 1] + 1));
    else return 2 * n_patty[i - 1];
}

int main() {
    i64 N, X; cin >> N >> X;

    n_layer[0] = 1;
    n_patty[0] = 1;
    REP(i, N) {
        n_layer[i + 1] = 2 * n_layer[i] + 3;
        n_patty[i + 1] = 2 * n_patty[i] + 1;
    }

    i64 n = rec(N, X);
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
/*--ILRS-- sr4saurabh  */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define popb pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=10000000+6;
#define M_PI           3.14159265358979323846
//--------------------------------------------



//--------------------------------------------





//============================================
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
       freopen ("INPUT.txt" , "r" , stdin);
       freopen ("OUTPUT.txt", "w" , stdout);
    #endif

	//THE WATER WAS DEEP, I DROWNED AND THEN CAME FLOATING UP,DEAD!!

       string st;
       string pt;
       cin>>st>>pt;

       int n = st.size();
       int m = pt.size();

       int ans = 10001;


       for(int i = 0 ; i <= n-m ; i++)
       {
       		int k = 0;
       		for(int j = 0; j < m ; j++)
       		{
       			if(st[i+j]!=pt[j])
       				k++;
       		}

       		ans = min(ans, k);
       }

       cout<<ans;











return 0;
}

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

using namespace std;
using ll = long long;

const int N = 200005;

int n, p, a[N], ps[N];

int mul(int aa, int bb) {
	return int(1LL * aa * bb % p);
}
int fexp(int b, int e = p - 2) {
	int ans = 1;
	while(e) {
		if(e & 1) ans = mul(ans, b);
		b = mul(b, b);
		e /= 2;
	}
	return ans;
}

int cnt[N];

int main() {
	scanf("%d %d", &n, &p);
	for(int i = 1; i <= n; i++) scanf("%1d", a + i);
	
	if(__gcd(10, p) == 1) {
		ll ans = 0;
		cnt[0] = 1;
		int pw = 1;
		for(int i = n; i >= 1; i--) {
			ps[i] = (a[i] * pw + ps[i + 1]) % p;
			ans += cnt[ ps[i] ];
			cnt[ ps[i] ]++;
			pw = 10 * pw % p;
		}

		printf("%lld\n", ans);
		return 0;
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		if(a[i] % p == 0) {
			ans += i;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 5384
#include <stdio.h>

int matrixChainOrder();
int min(int ,int); 

int m[100][100],n;
int p[110];

int main()
{
  int i,j,a;

  scanf("%d",&n); // ?????°?????°
  for(i = 0;i < n;i++){
    if(i == n - 1) scanf("%d %d",&p[i],&p[i + 1]);
    else scanf("%d %d",&p[i],&a);
  }

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

  return 0;
}

int matrixChainOrder()
{
  int i,j,l,k,q;

  for(i = 1;i <= n;i++){
    m[i][i] = 0;
  }

  for(l = 2;l <= n;l++){
    for(i = 1;i <= n-l+1;i++){
      j = i+l-1;
      m[i][j] = 2147483647;
      for(k = i;k <= j - 1;k++){
	q = m[i][k] + m[k+1][j] + p[i - 1] * p[k] * p[j];
	m[i][j] = min(m[i][j], q);
      }
    }
  }
  return m[1][n];
}

int min(int m, int q)
{
  if(m < q) return m;
  else return q;
}

Measured memory_bytes: 636
//by Judge
#define HGS_AK_IOI true
#include<cstdio>
#include<cstring>
#include<iostream>
#define Rg register
#define fp(i,a,b) for(Rg int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(Rg int i=(a),I=(b)-1;i>I;--i)
#define ll long long
using namespace std;
const int mod=998244353;
const int M=1e7+3;
typedef int arr[M];
char buf[1<<21],*p1=buf,*p2=buf;
int n,ans; arr pw2,fac,inv;
inline int mul(int x,int y){return 1ll*x*y%mod;}
inline void Pls(int& x,int y){if((x+=y)>=mod)x-=mod;}
inline int qpow(int x,int p=mod-2){ Rg int s=1;
	for(;p;p>>=1,x=mul(x,x)) if(p&1) s=mul(s,x); return s;
}
inline int C(int n,int m){ return mul(fac[n],mul(inv[m],inv[n-m])); }
int main(){ cin>>n,pw2[0]=fac[0]=1,ans=qpow(3,n);
	fp(i,1,n) pw2[i]=mul(pw2[i-1],2),fac[i]=mul(fac[i-1],i);
	inv[n]=qpow(fac[n]); fd(i,n,1) inv[i-1]=mul(inv[i],i);
	fp(i,0,(n-1)>>1) Pls(ans,mod-mul(pw2[i+1],C(n,n-i))); return !printf("%d\n",ans);
}

Measured memory_bytes: 119040
#include <stdio.h>

int main(){
	int i, j;
	int n, m;
	int A[100][100] = {0};
	int b[100] = {0};
	int out[100] = {0};
	
	scanf("%d %d", &n, &m);

	for(i=0; i<n; i++) {
		for(j=0; j<m; j++) {
			scanf("%d", &A[i][j]);
		}
	}

	for(i=0; i<m; i++) {
		scanf("%d",&b[i]);
	}

	for(i=0; i<n; i++) {
		for(j=0; j<m; j++) {
			out[i] += A[i][j] * b[j];
		}
		printf("%d\n", out[i]);
	}

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; i++){
        cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    int stage = N;
    for(int i = 0; i < N - 1; i++){
        if(d.at(i) == d.at(i + 1)){
            stage--;
        }
    }
    cout << stage << endl;
}

Measured memory_bytes: 3584
import sys
from collections import defaultdict, deque
import math

# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 998244353

def solve():
    n = getN()
    nums = getList()
    xors = [[] for i in range(31)]
    for num in nums:
        for i in range(31):
            if num % 2 == 1:
                xors[i].append(1)
            else:
                xors[i].append(0)

            num //= 2
    # for xor in xors:
        # print(xor)

    ans = [0 for i in range(n)]

    for digit, xo in enumerate(xors):
        if sum(xo) % 2 == 0:
            # even
            for i, x in enumerate(xo):
                if x == 1:
                    ans[i] += 2 ** digit

        else:
            # odd
            for i, x in enumerate(xo):
                if x == 0:
                    ans[i] += 2 ** digit


    print(*ans)
def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 228364
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

int main()
{
    int x;
    cin >> x;
    if (x)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
    return 0;
}


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

int main(void){
  int *iroha = calloc(3, sizeof(int));
  scanf("%d%d%d",iroha,iroha+1,iroha+2);
  int count[2]={0,0};
  for(int i = 0; i < 3; i++){
    if( iroha[i] == 5 )count[0] += 1;
    else if( iroha[i] == 7)count[1] += 1;
  }
  
  if( count[0] == 2 && count[1] == 1)printf("YES\n");
  else printf("NO\n");
  free(iroha);
  return 0;
}

Measured memory_bytes: 128
s = input()
ans = 0
memo = []
for i in range(1 << len(s) -1):
    tmp = s[0]
    for j in range(len(s)-1):
        if ((i >> j) & 1):
            tmp+="+"
        tmp += s[j+1]
    if tmp not in memo:
        ans+=eval(tmp)
        memo.append(tmp)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int N;
      cin >> N;
      int a[N];
      for(int i=0;i<N;i++){
      cin >> a[i];
      }
      
      int max=-1;
      int min=1001;
     
      for(int i=0;i<N;i++){
      if(max < a[i])max=a[i];
      if(min > a[i])min=a[i];
      }
      //cout << max << min << endl;
      cout << max-min << endl;
     
      return 0;
    }

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 1; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

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


Measured memory_bytes: 256
n = int(input())
t,a = map(int, input().split())
arr = list(map(int,input().split()))

dig = float("inf")
num = 0

for i in range(n):
    ans = t - arr[i] * 0.006
    if dig > abs(a - ans):
        dig = abs(a - ans)
        num = i + 1
print(num)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x;
  cin >> n >> x;
  vector<int> l(n),d(n);
  for (int i=0;i<n;i++){
    cin >> l[i];
  }
  d[0]=0;
  int count =1;
  for (int i=1;i<n+1;i++){
    d[i]=d[i-1]+l[i-1];
    if(d[i]<=x){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// M
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 303;
int q, n;
ll A[N];
char S[N];
int main()
{
	scanf("%d", &q);
	for (; q; q --)
	{
		scanf("%d", &n);
		for (int i = 0; i < n; i ++)
			scanf("%lld", &A[i]);
		memset(S, 0, sizeof(S));
		scanf("%s", &S);
		bool Sec = 0;
		vector < ll > B;
		for (int i = n - 1; ~ i; i --)
			if (A[i])
			{
				if (S[i] == '0')
				{
					ll a = A[i];
					for (ll b : B)
						a = min(a, a ^ b);
					for (ll &b : B)
						b = min(b, b ^ a);
					if (a) B.push_back(a);
				}
				else
				{
					ll a = A[i];
					for (ll b : B)
						a = min(a, a ^ b);
					if (a) {Sec = 1; break;}
				}
			}
		printf("%d\n", (int)Sec);
	}
	return 0;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int a[1010];
int b[2][1010];
ll s[2],c[2];
int main(){
	cin >> N;
	for(int i=0;i<N;i++)cin >> a[i];
	for(int i=0;i<2;i++){
		for(int j=i;j<N;j+=2){
			if(a[j]>=0){
				b[i][j]=1;
				s[i]+=a[j];
				c[i]++;
			}
		}
	}
	if(c[0]==c[1]&&c[0]==0){
		int mx = -INF;
		int idx = -1;
		for(int i=0;i<N;i++){
			if(mx<a[i]){
				mx = a[i];
				idx = i;
			}
		}
		idx++;
		printf("%d\n",mx);
		printf("%d\n",N-1);
		for(int i=N;i>idx;i--)printf("%d\n",i);
		for(int i=1;i<idx;i++)printf("1\n");
		return 0;
	}
	int t;
	if(c[0]==0)t=1;
	else if(c[1]==0)t=0;
	else t = (s[0]<s[1])?1:0;
	vector<int> answer;
	int id;
	for(id=N-1;id>=0;id--){
		if(b[t][id]==1)break;
		answer.pb(id);
	}
	int cnt = 0;
	int res = id+1;
	for(;id>=0;id--){
		if(b[t][id]==1){
			cnt = 0;
		}else{
			cnt++;
			if(cnt==3){
				answer.pb(id+1);
				res-=2;
				cnt=1;
			}
		}
	}
	if(cnt==1){
		answer.pb(0);
		res--;
	}
	if(cnt==2){
		answer.pb(0);
		answer.pb(0);
		res-=2;
	}
	if(res%2==1)res--;
	for(int i=res-1;i>=0;i-=2){
		answer.pb(i);
	}
	printf("%lld\n",s[t]);
	printf("%d\n",(int)answer.size());
	for(int i=0;i<answer.size();i++){
		printf("%d\n",answer[i]+1);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

int countbits(long bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

void solve() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    sort(all(a));
    int ans = 0;
    RREP(i,0,n) {
        int beki = 0;
        while (pow(2,beki) <= a[i]) ++beki;
        int p = pow(2,beki) - a[i];
        //dump(a[i]);
        //dump(p);
        //dump(i);
        //dump(beki);
        auto it = lower_bound(all(a), p);
        int diff = it - a.begin();
        if (diff == i) {
            ++diff;
            ++it;
        }
        if (it != a.end() && *it == p) {
            ++ans;
            a.erase(a.begin() + i);
            a.erase(a.begin() + diff);
            --i;
            //dump(i);
            //dump(a.size());
        }
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
  long long n;
  long long ans;
  scanf("%ld",&n);
  if(n%2!=0)
  ans=n/2;
  else
  ans=n/2-1;
  printf("%ld",ans);


  return 0;
}


Measured memory_bytes: 128
# 先駆者に天才が多すぎる
import numpy as np
mod = 998244353


def convolve(A, B):
    n = len(A) + len(B) - 1
    fftlen = 1 << (n-1).bit_length()
    fa = np.fft.rfft(A, fftlen)
    fb = np.fft.rfft(B, fftlen)
    inv = (np.fft.irfft(fa * fb, fftlen) + 0.5).astype(np.int64)
    return inv[:n]


def mod_convolve_15(A, B, mod):
    a1, a2 = np.divmod(A, 1 << 15)
    b1, b2 = np.divmod(B, 1 << 15)
    x = convolve(a1, b1) % mod
    y = convolve(a2, b2) % mod
    xy = (convolve(a1 + a2, b1 + b2) - (x + y)) % mod
    res = (x << 30) + (xy << 15) + y
    return res % mod


def mod_convolve_10(A, B, mod):
    a1, a2 = np.divmod(A, 1 << 20)
    a2, a3 = np.divmod(a2, 1 << 10)
    b1, b2 = np.divmod(B, 1 << 20)
    b2, b3 = np.divmod(b2, 1 << 10)
    x = convolve(a1, b1) % mod
    y = convolve(a2, b2) % mod
    z = convolve(a3, b3) % mod
    xy = (convolve(a1 + a2, b1 + b2) - (x + y)) % mod
    yz = (convolve(a2 + a3, b2 + b3) - (y + z)) % mod
    zx = (convolve(a3 + a1, b3 + b1) - (z + x)) % mod
    res = ((((x << 20) % mod) << 20) +
           (((xy << 20) % mod) << 10) +
           ((y + zx) << 20) +
           (yz << 10) % mod + z) % mod
    return res


N, M = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = mod_convolve_10(A, B, mod)
print(*C, sep=" ")

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

using namespace std;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef TurnRed
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;
	for (int i = 1; i <= 9; ++i)
		for (int j = 1; j <= 9; ++j)
			if (i * j == n)
			{
				cout << "Yes\n";
				return 0;
			}
	cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
#include <map>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int s[14];
int main(){
	int a,b,c,d,e;
	for(;~scanf("%d,%d,%d,%d,%d",&a,&b,&c,&d,&e);){
		map<int,int>m;
		memset(s,0,sizeof(s));
		m[a]++,m[b]++,m[c]++,m[d]++,m[e]++;
		s[a]=1,s[b]=1,s[c]=1,s[d]=1,s[e]=1;
		vector<int>v;
		for(a=1;a<=9;a++)if(s[a]&&s[a+1]&&s[a+2]&&s[a+3]&&s[a+4]){puts("straight");goto n;}
		if(s[a]&&s[a+1]&&s[a+2]&&s[a+3]&&s[1]){puts("straight");goto n;}
		for(a=1;a<=13;a++)v.push_back(m[a]);
		sort(v.begin(),v.end());
		reverse(v.begin(),v.end());
		if(v[0]==4)puts("four card");
		else if(v[0]==3)puts(v[1]==2?"full house":"three card");
		else if(v[0]==2)puts(v[1]==2?"two pair":"one pair");
		else puts("null");
		n:;
	}
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int k, q;
int d[5500];
signed main() {
    cin >> k >> q;
    rep(i, k) { cin >> d[i]; }
    rep(i, q) {
        int n, x, m;
        cin >> n >> x >> m;
        vint dcc(k + 1), zcc(k + 1);
        rep(j, k) { dcc[j + 1] = dcc[j] + d[j] % m; }
        rep(j, k) { zcc[j + 1] = zcc[j] + (d[j] % m == 0); }
        n--;
        int sum = dcc[k] * (n / k) + dcc[n % k] + x;
        int h = sum / m - x / m;
        int z = zcc[k] * (n / k) + zcc[n % k];
        cout << n - h - z << endl;
    }
}

Measured memory_bytes: 512
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int count = 0;
        int[] H = new int[N+10];
        H[0] = sc.nextInt();
        for(int i = 1; i < N; i++){
            H[i] = sc.nextInt();
            if(H[i-1] >= H[i]){
                count += 1;
            }else{
                if(count > max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count > max){
            max = count;
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 50960
#include <iostream>
#include <algorithm>

using namespace std;


int main(){
    int w[10],k[10];
    for(int i=0;i<10;++i) cin>>w[i];
    for(int i=0;i<10;++i) cin>>k[i];
    sort(w,w+10);
    sort(k,k+10);
    int sum_w=0;int sum_k=0;
    for(int i=9;i>6;--i){
        sum_w += w[i];sum_k += k[i];
    }
    cout<<sum_w<<" "<<sum_k<<endl;
    return 0;
}

Measured memory_bytes: 3108
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
#define clear(arr, val) memset(arr, val, sizeof(arr))

#define rep(i, n) for (int i = 0; i < n; ++i)

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

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int dist(int x1, int y1, int x2, int y2)
{
	int x = x1 - x2;
	int y = y1 - y2;
	return x * x + y * y;
}
int main()
{
	int T;
	scanf("%d", &T);
	while (T--)
	{
		int N, X, Y, x[1024], y[1024];
		scanf("%d%d%d", &N, &X, &Y);
		for (int i = 0; i <= N; ++i)
			scanf("%d%d", x + i, y + i);


		vector<int> edge[1024];
		for (int i = 1; i <= N; ++i)
			if (dist(x[0], y[0], x[i], y[i]) <= 100)
				edge[0].push_back(i);

		for (int i = 1; i <= N; ++i)
			for (int j = i + 1; j <= N; ++j)
				if (dist(x[i], y[i], x[j], y[j]) <= 2500)
					edge[i].push_back(j), edge[j].push_back(i);


		int res = 0;
		int last[1024];
		fill_n(last, N + 1, -(Y + 1));
		queue<pint> q;

		q.push(pint(0, -X));
		while (!q.empty() && res != -1)
		{
			pint t = q.front(); q.pop();
			int cur = t.first, time = t.second;
			int end = time + X;

			for (int i = 0; i < edge[cur].size(); ++i)
			{
				int to = edge[cur][i];
				if (end > last[to] + Y)
				{
					if (last[to] > 0)
					{
						res = -1;
						break;
					}
					q.push(pint(to, end));
					res = last[to] = end + X;
				}
			}
		}

		if (res == -1)
			puts("You're always welcome!");
		else
			printf("%d\n", res);
	}
}

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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

int point(vector<tuple<int, int, int, int>> dabc, vector<int> A){
    int ans = 0;
    for(int i=0; i<dabc.size(); i++){
        if(A[get<2>(dabc[i])] - A[get<1>(dabc[i])] == get<3>(dabc[i])){
            ans += get<0>(dabc[i]);
        }
    }
    return ans;
}

void max_point(vector<tuple<int, int, int, int>> dabc, int M, vector<int>& A, int j, int& now_max){
    if(j == A.size()){
        int now_point = point(dabc, A);
        if(now_point > now_max){
            now_max = now_point;
        }
    }
    else{
        // いまから j 番目の添え字をいじる
        int f = 1;
        if(j > 0){
            f = A[j-1];
        }
        for(int i=f; i<=M; i++){
            A[j] = i;
            max_point(dabc, M, A, j+1, now_max);
        }
    }
}

signed main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<tuple<int, int, int, int>> dabc;
    for(int i=0; i<Q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        dabc.push_back(make_tuple(d, a, b, c));
    }
    sort(dabc.begin(), dabc.end());

    vector<int> A(N+1, 1);
    int max = 0;
    max_point(dabc, M, A, 1, max);
    cout << max << endl;

    return 0;
}

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

int main(){
	string s;
	cin >> s;
	//aa axa
	for(char c = 'a'; c <= 'z'; c++){
		for(size_t i = 0; i < s.size() - 1; i++){
			if(s[i] == s[i + 1]){
				cout << i + 1 << ' ' << i + 2 << endl;
				return 0;
			}else if(i + 2 < s.size() && s[i] == s[i + 2]){
				cout << i + 1 << ' ' << i + 3 << endl;
				return 0;
			}
		}
	}
	cout << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define lg2 std::__lg
#define popc __builtin_popcountll

typedef long long ll;
typedef std::pair <ll, ll> pr;
const int N = 216, M = N * N, mod = 1000000007;
typedef std::array <ll, N> array;

int n, cm, cg, cnt = 0;
ll K, a[N], b[N], m[N], first[M];
array c[M];
int least[M], o[M];
pr g[M];

inline ll max(const ll x, const ll y) {return x < y ? y : x;}
inline ll min_popc(ll L, ll R) {return L-- ? 1 + popc(L & (-2ll << lg2(L ^ R))) : 0;}

int segun() {
	int i; ll la = 0, tot = 0; std::sort(g, g + cg);
	for (i = 0; i < cg; ++i)
		if (la < g[i].first) tot += la - g[i].first, la = g[i].second;
		else if (la < g[i].second) la = g[i].second;
	return (la + tot) % mod;
}

int main() {
	int i, j, w, sup; ll I, la, cur, mask;
	scanf("%d%lld", &n, &K);
	for (i = 0; i < n; ++i) scanf("%lld", a + i);
	std::sort(a, a + n), sup = lg2(a[n - 1]) + 1;
	for (w = 0; w <= sup; ++w) {
		mask = ~(-1ll << w);
		for (i = 0; i < n; ++i) m[i] = a[i] & mask;
		std::sort(m, m + n), cm = std::unique(m, m + n) - m;
		for (I = i = 0; i < cm && m[i] <= *a; I = m[i++] + 1) {
			if ((least[cnt] = w + min_popc(I, m[i])) > K) continue;
			c[cnt].fill(0), o[cnt] = cnt,
			first[cnt] = la = (*a - m[i]) >> w;
			for (j = 1; j < n; ++j)
				cur = (a[j] - m[i]) >> w, c[cnt][j - 1] = cur - la, la = cur;
			++cnt;
		}
	}
	std::sort(o, o + cnt, [] (const int x, const int y) {return c[x] < c[y];});
	for (cur = j = i = 0; i < cnt; cur += segun()) {
		for (; j < cnt && c[o[i]] == c[o[j]]; ++j);
		for (cg = 0; i < j; ++i)
			g[cg++] = pr(max (0, first[o[i]] - (K - least[o[i]])), first[o[i]] + 1);
	}
	printf("%d\n", int(cur % mod));
	return 0;
}

Measured memory_bytes: 19712
c1=list(map(int,input().split()))
c2=list(map(int,input().split()))
c3=list(map(int,input().split()))

s=0
if(c1[0]-c2[0]==c1[1]-c2[1] and c1[0]-c2[0]==c1[2]-c2[2]):
    s+=1

if(c3[0]-c2[0]==c3[1]-c2[1] and c3[0]-c2[0]==c3[2]-c2[2]):
    s+=1
    
if(s==2):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int main(){
  ios::sync_with_stdio(0);  cin.tie(0); cout<<setprecision(6); cout<<fixed;
  #ifdef DEBUG
  freopen("ip.txt","r",stdin);
  clock_t tStart = clock();
  #endif

  ll n,c,ans=0; cin>>n>>c; vector< pair<ll,ll> > v; vector< pair< pair<ll,ll>, int> > rec;
  for(int i=0;i<n;++i) {int st,fin,ch; cin>>st>>fin>>ch; rec.pb({{st,fin},ch});}
  sort(rec.begin(),rec.end());
  for(ll j=0;j<n;++j){
    int st=rec[j].first.first,fin=rec[j].first.second,ch=rec[j].second; bool found=false;
    for(int i=0;i<v.size() && !found;++i){
      if(v[i].second==ch){
        if(v[i].first<=st) {v[i].first=fin; found=true;}
      }
      else{
        if(v[i].first<=st-1) {found=true; v[i].first=fin; v[i].second=ch;}
      }
    }
    if(!found) {v.pb({fin,ch}); ans++;}
    //for(int i=0;i<v.size();++i) cout<<i+1<<" "<<v[i].first<<" "<<v[i].second<<endl;
  }
  cout<<ans<<'\n';
  #ifdef DEBUG
	cout<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)<<"s.\n";
	#endif
  return 0;
}


Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s, t;
    cin >> s;
    rep(i, s.size()){
        if(i >= s.size()-1)t += s[i];
        else if(s.substr(i, 2) == "BC"){
            t += "D";
            i++;
        }else{
            t += s[i];
        }
    }
    ll cnt = 0, ans = 0;
    rep(i, t.size()){
        if(t[i] == 'A')cnt++;
        else if(t[i] == 'D')ans += cnt;
        else cnt = 0;
    }
    cout << ans << endl;
}


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

int main() {
  int L, R;
  cin >> L >> R;
  
  if( R - L > 2019 ) R = L + 2019;
  
  int ans = 2019;
  for( int64_t i = L; i <= R; i++ ){
    for( int64_t j = i+1; j <= R; j++ ){
      if( i * j % 2019 < ans ) ans = i * j % 2019;
    }
  }
  cout << ans << endl;
}


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

int main(void){
  int h, w;
  string s[26][26];

  char a[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
    'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
    'X', 'Y', 'Z'};

  cin >> h >> w;

  for(int i = 0; i < h; i ++)
    for(int j = 0; j < w; j ++)
      cin >> s[i][j];

  for(int i = 0; i < h; i ++)
    for(int j = 0; j < w; j ++)
      if(s[i][j] == "snuke")
        cout << a[j] << i+1 << endl;

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,m,c=1; cin>>n>>m;
    rep(i,m) c*=2;
    cout<<(m*1900+(n-m)*100)*c<<endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<=(end);i++)
#define REP(i, n) FOR(i,1,n)
#define IFOR(i, begin, end) for(int i=(end);i>=(begin);i--)
#define IREP(i, n) IFOR(i,1,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())

#define ll long long
using namespace std;

int main()
{
	stringstream ss;
    // 入力
    int N;
    cin>>N;
    char A[N],B[N],C[N];
    FOR(i,0,N-1){
    	cin>>A[i];
    }
    FOR(i,0,N-1){
    	cin>>B[i];
    }
    FOR(i,0,N-1){
    	cin>>C[i];
    }
    int ans=0;
    FOR(i,0,N-1){
    	// cout<<A[i]<<endl;
    	// cout<<B[i]<<endl;
    	// cout<<C[i]<<endl;
    	if(A[i]==B[i]){
    		// cout<<i<<endl;
    		// cout<<A[i]<<endl;
    		if(A[i]!=C[i]){
    			ans++;
    			// cout<<"dif1"<<endl;
    		}
    	} else if(A[i]==C[i]){
    		ans++;
    			// cout<<"dif2"<<endl;
    	} else if(B[i]==C[i]){
    		ans++;
    			// cout<<"dif3"<<endl;
    	} else{
    		ans+=2;
    			// cout<<"dif4"<<endl;
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    N, M, X = map(int, input().split())
    lc = []
    la = []
    for _ in range(N):
        ca = list(map(int, input().split()))
        lc.append(ca[0])
        la.append(ca[1:])
    # print(N, M, X)
    # print(lc)
    # print(la)

    min_price = INF
    items = range(N)
    for i in range(1, len(items) + 1):
        for c in combinations(items, i):
            score = [0] * M
            price = 0
            for elem in c:
                price += lc[elem]
                for k in range(M):
                    score[k] += la[elem][k]
            # print(c, price, score, all(map(lambda x: x >= X, score)))
            if all(map(lambda x: x >= X, score)):
                if min_price > price:
                    min_price = price

    if min_price == INF:
        print(-1)
    else:
        print(min_price)

if __name__ == '__main__':
    main()

Measured memory_bytes: 68732
import sys
N = int(input())
d = list(map(int, input().split()))

K_cnt = 0
dsort = sorted(d)

d_left = dsort[int(N/2)-1]
d_right = dsort[int(N/2)]

# ソートして中央値が一致した場合
# ぴったり同じにならない
if d_left == d_right:
    print(0)
else:
    print(d_right-d_left)

Measured memory_bytes: 20808
#include <cstdio>

int inline length(int x){
	int result = 0;
	do{
		result++;
		x /= 10;
	}
	while (x > 0);
	return result;
}

int main(){
	int a, b;
	
	while (scanf("%d %d", &a, &b) != EOF){
		printf("%d\n", length(a + b));
	}
	
	return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	std::string s, t;
	std::cin >> s >> t;
	for (int i = 0; i < n; i++) std::cout << s[i] << t[i];
	std::cout << std::endl;
	return 0;
}



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

int main(){
    int h, n;
    cin >> h >> n;
    vector<pair<int, int>> x(n, pair<int, int>());
    for (int i = 0; i < n; i++){
        cin >> x[i].first >> x[i].second;
    }
    vector<int> dp(h + 1, 0);
    for (int i = 1; i < h + 1; i++){
        dp[i] = ((i + x[0].first - 1) / x[0].first) * x[0].second;
    }

    for (int i = 1; i < n; i++){
        for (int j = 0; j < h + 1; j++){
            if (j < x[i].first) dp[j] = min(dp[j], x[i].second);
            else dp[j] = min(dp[j], dp[j - x[i].first] + x[i].second);
        }
    }
    cout << dp[h] << endl;
}


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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;   
    
    cin>>n>>m;
    x=max({n*m,n-m,n+m});
    cout<<x<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
using namespace std;
int a[1010];
int main(){
    int n,b;
    int total = 0;
    cin >> n >> b;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    for(int i=0;i<b;i++){
        total+=a[i];
    }
    cout << total;
}

Measured memory_bytes: 3616
#include<stdio.h>

int main(void){
	int x,y,t=0;
	while(1){
		scanf("%d %d",&x,&y);
		if((x==0)&&(y==0))break;
		if(x>y){
			t=x;
			x=y;
			y=t;
		}
		printf("%d %d\n",x,y);
	}
return 0;
}



Measured memory_bytes: 2020
s = input()
res = 0
m = 1
p =[0]*2019
for i in map(int,s[::-1]):
    res +=i*m
    res %=2019
    p[res] +=1
    m *=10
    m %=2019
print(p[0]+sum([i*(i-1)//2 for i in p]))

Measured memory_bytes: 9316
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
d = intl()

ans = 0
for i in range(n):
	for j in range(i+1,n):
		ans += d[i]*d[j]
print(ans)

Measured memory_bytes: 9060
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int w, h, n; cin >> w >> h >> n;
    int mx1 = 0, my3 = 0;
    int mx2 = w, my4 = h;
    int a, x, y;
    rep(i, n){
        cin >> x >> y >> a;
        if(a == 1) mx1 = max(mx1, x);
        else if(a == 2) mx2 = min(mx2, x);
        else if(a == 3) my3 = max(my3, y);
        else if(a == 4) my4 = min(my4, y);
    }
    int res;
    if(mx1 >= mx2 || my3 >= my4) res = 0;
    else res = (mx2 - mx1) * (my4 - my3);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256