akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int n,p; cin >>n >>p;
  vector<int> a(n); rep(i, n) cin >>a[i];
  rep(i, n) a[i] %= 2;
  vector<vector<ll>> dp(n+1, vector<ll>(2, 0));
  // dp[i][j] := i個目まで選んで、余りが j になるような場合の数
  dp[0][0] = 1;
  for (int i=0; i<n; i++){
    for (int j=0; j<2; j++){
      // i を食べない
      dp[i+1][j] += dp[i][j];
      // i を食べる
      dp[i+1][(j+a[i])%2] += dp[i][j];
    }
  }
  ll res = dp[n][p];
  cout <<res <<endl;
}

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

using namespace std;

const int N = 200005;
int cnt[N], aux[N];

int main() {
    int n, k;
    cin >> n >> k;
    map <int, int> mp;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        cnt[x]++;
    }
    int sz = 0;
    for (int i = 1; i < N; i++) {
        if (cnt[i]) {
            aux[sz++] = cnt[i];
        }
    }
    sort(aux, aux + sz);
    int res = 0;
    for (int i = 0; i < sz - k; i++) {
        res += aux[i];
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 4980
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

LL dp[100010][13];
LL MOD = 1000000007;

void solve() {
  string s;
  cin >> s;
  if(s[0] == '?') {
    REP(i, 10) dp[0][i] = 1;
  } else {
    dp[0][s[0]-'0'] = 1;
  }

  FOR(i, 1, SZ(s)) REP(j, 13){
    if(s[i] == '?') {
      REP(k, 10) {
        dp[i][(j*10+k)%13] = (dp[i][(j*10+k)%13] + dp[i-1][j]) % MOD;
      }
    } else {
      dp[i][(j*10+s[i]-'0')%13] = (dp[i][(j*10+s[i]-'0')%13] + dp[i-1][j]) % MOD;
    }
  }

  cout << dp[SZ(s)-1][5] << endl;
}

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


Measured memory_bytes: 10624
import java.io.*;
import java.util.Scanner;
 
public class Main {
    public static String sort(int a, int b, int c) {
        if (a <= b) {
            if (b <= c) {
                return  a + " " + b + " " +c;
            } else if (a <= c) {
                return a + " " + c + " " +b;
            } else {
                return c + " " + a + " " +b;
            }
        } else {
            if (b > c) {
                return c + " " + b + " " +a;
            } else if (a <= c) {
                return b + " " + a + " " +c;
            } else {
                return b + " " + c + " " +a;
            }
        }
    }
 
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println(sort(a,b,c));
    }
}


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

const int N=1e5+10;
vector <int> E[N];
int color[N],cnt[3];

int main(){
	ios_base::sync_with_stdio(false);
	queue <int> que;
	int n,x,y;
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>x>>y;
		E[x].push_back(y);
		E[y].push_back(x);
	}
	color[1]=1,color[n]=2;
	que.push(1);
	que.push(n);
	while(!que.empty()){
		int tmp=que.front();
		que.pop();
		cnt[color[tmp]]++;
		for(int i=0;i<E[tmp].size();i++){
			int v=E[tmp][i];
			if(color[v]) continue;
			color[v]=color[tmp];
			que.push(v);
		}
	}
	if(cnt[2]>=cnt[1]) cout<<"Snuke"<<endl;
	else cout<<"Fennec"<<endl;
	return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long int lli;
#define pb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define INF 1000000000
#define fastio	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

string s;

int main(){
    fastio;
    cin>>s;
    int sum1 = 0,sum2 = 0;
    string s1 = "",s2 = "";
    for(int i = 0;i<s.length();i+=2){
        s1 += '0';
        s1 += '1';
        s2 += '1';
        s2 += '0';
    }

    for(int i = 0;i<s.length();i++){
        sum1 += abs((s[i] - '0') - (s1[i] - '0'));
        sum2 += abs((s[i] - '0') - (s2[i] - '0'));
    }
    cout<<min(sum1,sum2)<<endl;
    
    return 0;
}


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

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int data[25][2] = {0};
		for (int i = 0; i < n; i++) {
			cin >> data[i][0] >> data[i][1];
		}
		for (int i = n-1; i > 0; i--) {
			for (int j = 0; j < i; j++) {
				if (data[j][1] > data[j+1][1]) {
					swap(data[j][0], data[j+1][0]);
					swap(data[j][1], data[j+1][1]);
				}
			}
		}
		int counter = 0;
		bool hantei = true;
		for (int i = 0; i < n; i++) {
			if (data[i][1] >= data[i][0]+counter) {
				counter += data[i][0];
			} else {
				hantei = false;
				break;
			}
		}
		if (hantei) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    ll n;
    cin>>n;
    ll ans=0;
    for (int i = 1; i<=n; ++i)
    {
        ll a;
        cin>>a;
        if(i%2==1){
            if(a%2==1){
                ans++;
            }
        }
    }
    cout<<ans;

    return 0;
}

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

int main(){
  int a, b;
  scanf("%d %d", &a, &b);
  int x = min(a, b);
  int y = max(a, b);
  REP(i, y) printf("%d", x);
  printf("\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef local
#define debug(a...) qqbx(#a, a)
template <typename H, typename ...T> void qqbx(const char *s, const H &h, T&&...a) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr<<*s;
    std::cerr<<" = "<<h<<(sizeof...(T) ? ", " : "\n");
    if constexpr(sizeof...(T)) qqbx(++s, a...);
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v),end(v)

using namespace std;
const int MOD = 1000000007;
int64_t modpow(int64_t e, int64_t p) {
    int64_t r = 1;
    while(p) {
        if(p&1) r = r*e%MOD;
        e = e*e%MOD;
        p>>=1;
    }
    return r;
}
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    cout << (modpow(10, n) - modpow(9, n) * 2 % MOD + modpow(8, n) % MOD + MOD) % MOD << '\n';
}


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

int main() {
	
	ll n; cin >> n;
	vector<ll> num(n + 1, 0);
	for (ll i = 1; i <= n; i++) {
		for (ll j = i; j <= n; j += i) {
			num[j]++;
		}
	}
	ll ans = 0;
	for (ll i = 1; i <= n; i++) {
		ans += i * num[i];
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int a,b;
    int count = 0;
    cin >> a >> b;
    for(int i=0;i<=b - a;i++){
        int temp = a+i;
        int c[5];
        for(int j=0;j<5;j++){
            c[j] = temp % 10;
            temp /= 10;
        }
        if(c[0] == c[4] && c[1] == c[3]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
def judge(a,b,edge): #a,bがedgeで繋がっていたらTrue、いなかったらFalse
    if edge[a][b] == 1:
        return True
    else:
        return False
n,m = map(int,input().split())
edge=[[0 for _ in range(n+1)] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int,input().split())
    edge[a][b] = 1
    edge[b][a] = 1
lis_permutations = itertools.permutations(range(2,n+1))
count = 0
for one_case in lis_permutations:
    one_case_1 = [1]
    for j in one_case:
        one_case_1.append(j)
    true = 1
    for i in range(len(one_case_1)-1):
        start = one_case_1[i]
        goal = one_case_1[i+1]
        if not judge(start,goal,edge):
            true = 0
            break
    if true ==1:
        count += 1
print(count)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long LL;
const int MAXN = 2*100000;
int N, Q, ans, score[MAXN], cnt[MAXN];
vector<vector<int> > mapp(MAXN);

void dfs(int u, int p) {

    if(p != -1){
        score[u] = score[p]+score[u];
    }

    for(int i = 0; i < mapp[u].size(); i++){

        if(mapp[u].at(i) == p){
            continue;
        }
        dfs(mapp[u].at(i),u);
    }

}


int main() {

    memset(cnt, 0, sizeof(cnt));//点数をリセット
    memset(score, 0, sizeof(score));//追加するスコア情報
    cin >> N >> Q;

    for(int i = 0; i < N - 1; i++){
        int tmp1, tmp2;
        vector <int > v_tmp;
        cin >> tmp1 >>tmp2;
        tmp1--;
        tmp2--;
        mapp[tmp1].push_back(tmp2);
        mapp[tmp2].push_back(tmp1);
    }

    for(int i = 0; i < Q; i++){
        int tmp1, tmp2;
        cin >> tmp1 >>tmp2;
        tmp1--;
        score[tmp1] += tmp2;
    }

    dfs(0,-1);

    for(int i = 0; i < N; i++){
        cout << score[i] << endl;
    }
	return 0;
}



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

long long number(long long x, long long c,long long d)
{
    long long temp;
    long long tempc = c;
    long long tempd = d;
    if(d > c){
        temp = c;
        c = d;
        d = temp;
    }
    while(c%d){
        temp = c%d;
        c = d;
        d = temp;
    }
    return x-x/tempc-x/tempd+x/((tempc/d)*(tempd/d)*d);
}

int main()
{
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << number(b,c,d)-number(a-1,c,d) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(x) begin(x), end(x)
using namespace std;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main() {
    // input
    int n, k; scanf("%d%d", &n, &k);
    vector<int> l(n), r(n), c(n);
    repeat (i, n) {
        scanf("%d%d%d", &l[i], &r[i], &c[i]);
        -- c[i];
    }
    // solve
    map<int, vector<int> > from_l;
    repeat (i, n) {
        from_l[l[i]].push_back(i);
    }
    int free_tvs = 0;
    reversed_priority_queue<pair<int, int> > used_tvs;
    for (auto & event : from_l) {
        int t = event.first;
        while (not used_tvs.empty() and used_tvs.top().first < t) {
            free_tvs += 1;
            used_tvs.pop();
        }
        vector<int> fixed_tvs(k);
        while (not used_tvs.empty() and used_tvs.top().first == t) {
            fixed_tvs[used_tvs.top().second] += 1;
            used_tvs.pop();
        }
        for (int i : event.second) {
            if (fixed_tvs[c[i]]) {
                fixed_tvs[c[i]] -= 1;
            } else if (free_tvs) {
                free_tvs -= 1;
            }
            used_tvs.emplace(r[i], c[i]);
        }
        free_tvs += accumulate(whole(fixed_tvs), 0);
    }
    int result = free_tvs + used_tvs.size();
    // output
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 12416
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  string S, T;
  cin >> S >> T;
  out(T + S);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>

using namespace std;
typedef long long ll;


int main() {
	ll H, W;
	cin >> H >> W;
	if (H == 1 || W == 1) cout << 1 << endl;
	else cout << (H * W + 1) / 2 << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <cmath>
#include <cstring>
#include <climits>
#include <iomanip>
using namespace std;

#define FORN(i, j, k) for(int i=j;i<k;i++)
#define FORR(i, j, k) for(int i=j;i>=k;i--)
#define REP(i, n) FORN(i, 0, n)
#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'

const int MODO = 1e+9 + 7;
const int MAX = 1e+5 + 5;

int n, k;

void solve(){
	int a[n];
	REP(i, n){
		cin >> a[i];
	}
	
	int dp[k+1];
	memset(dp, 0, sizeof(dp));
	dp[0] = 0;
	FORN(i, 1, k+1){
		REP(j, n){
			if(i-a[j]>=0 && dp[i-a[j]]==0){
				dp[i] = 1;
			}
		}
	}
	cout << (dp[k] ? "First" : "Second") << endl;
	return;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	solve();
	return 0;
}


Measured memory_bytes: 4424
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    int N, L;
    cin >> N >> L;
    string s[110];
    REP(i, N) cin >> s[i];
    sort(s, s + N);
    string ans = "";
    REP(i, N) ans +=s[i];
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N,ans=0;
  cin>>N;
  rep(i,N){
    int a; cin>>a;
    if(i%2==0&&a%2==1) ans++;
  }
  cout<<ans;
    
}


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

int main() {
	int N, H[20], ans = 1, m;
	cin >> N >> m;//旅館の数と西の山の高さ//
	for (int i = 1; i < N; i++) {
		cin >> H[i];//山の高さ
		if (H[i] >= m) {
			ans++;
			m = H[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  string S;
  string T;
  cin >> S>>T;
  int count=0;
  
  rep(i,3) {
    if(S.at(i)==T.at(i)) {
count++;
    }
  }
  cout << count << endl;
}
    

  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    string str;
    cin >> str;
    
    int l = str.size();
    int ans = 0;
    for( int i = 0; i <= l ; ++i)  {
        if(i % 2 == 0) {
            if( str[i] == 'p') {
                ans--;
            }
        }else{
            if( str[i] == 'g') {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var N, K int
var A []int

func main() {
	sc.Split(bufio.ScanWords)
	N, K = nextInt(), nextInt()
	A = make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	res := 0
	right := 0

	for {
		if res == 0 {
			right += K
		} else {
			right += K - 1
		}
		res++

		if right >= N {
			break
		}
	}

	fmt.Println(res)

}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
  string s;
  cin>>s;

sort(s.begin(),s.end());
for(char MOZI='a';MOZI<='z';MOZI++){
  if(s.find(MOZI)==s.npos){
    cout<<MOZI<<endl; return 0;
  }
}
cout<<"None";
}


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

int main() {

  int N, M, X;
  cin >> N >> M >> X;

  int cost1 = 0;
  int cost2 = 0;
  
  for (int i = 0; i < M; i++) {
    int A;
    cin >> A;
    if (A < X) {
      cost1++;
    } else {
      cost2++;
    }
  }

  cout << min(cost1, cost2) << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long int n,b=0,x=0,y=0,z=0,u=0,v=0,w=0,g=0,h=0,min,max;
	cin>>n;
	long int i,a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
				
				
				if(a[i]>=1 && a[i]<=399)
				{
					x=1;
				}
				if(a[i]>=400 && a[i]<=799)
				{
					y=1;
				}
				if(a[i]>=800 && a[i]<=1199)
				{
					z=1;
				}
				if(a[i]>=1200 && a[i]<=1599)
				{
					u=1;
				}
				if(a[i]>=1600 && a[i]<=1999)
				{
					v=1;
				}
				if(a[i]>=2000 && a[i]<=2399)
				{
					w=1;
				}if(a[i]>=2400 && a[i]<=2799)
				{
					g=1;
				}
				if(a[i]>=2800 && a[i]<=3199)
				{
					h=1;
				}
				if(a[i]>3199)
				{
					b++;
				}
	}
	
	min=x+y+z+u+v+w+g+h;
	max=min+b;
	if(min==0)
	{
		min=1;
	}

	cout<<min<<" "<<max<<endl;
	
}

Measured memory_bytes: 3544
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();

		String[] array_a = a.split("");
		String[] array_b = b.split("");
		String[] array_c = c.split("");

		String card = array_a[0];

		int num_a = 1;
		int num_b = 0;
		int num_c = 0;
		
		int roop_count = 0;

		roop: while (true) {
			roop_count++;
			if(roop_count > 1000000){break roop;}
			switch (card) {
			case "a":
				if (num_a == array_a.length ) {
					break roop;
				}
				;
				card = array_a[num_a];
				num_a++;
				break;
			case "b":
				if (num_b == array_b.length ) {
					break roop;
				}
				;
				card = array_b[num_b];
				num_b++;
				break;

			case "c":
				if (num_c == array_c.length ) {
					break roop;
				}
				;
				card = array_c[num_c];
				num_c++;
				break;

			}

		}
		System.out.println(card.toUpperCase());
	}

}


Measured memory_bytes: 9556
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_H = 2000, MAX_W = 2000;
int H, W;
string field[MAX_H];

int b[MAX_H][MAX_W], t[MAX_H][MAX_W], l[MAX_H][MAX_W], r[MAX_H][MAX_W];

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

  cin >> H >> W;
  rep(i, H) cin >> field[i];

  rep(i, H) {
    rep(j, W) {
      if (field[i][j] == '#') l[i][j] = j;
      else l[i][j] = (j == 0 ? -1 : l[i][j-1]);
    }
  }

  rep(i, H) {
    rrep(j, W) {
      if (field[i][j] == '#') r[i][j] = j;
      else r[i][j] = (j == W-1 ? W : r[i][j+1]);
    }
  }

  rep(i, H) {
    rep(j, W) {
      if (field[i][j] == '#') b[i][j] = i;
      else b[i][j] = (i == 0 ? -1 : b[i-1][j]);
    }
  }

  rrep(i, H) {
    rep(j, W) {
      if (field[i][j] == '#') t[i][j] = i;
      else t[i][j] = (i == H-1 ? H : t[i+1][j]);
    }
  }
    
  int ans = 0;
  rep(i, H) {
    rep(j, W) {
      if (field[i][j] == '#') continue;
      int tmp = t[i][j]-b[i][j]-1 + r[i][j]-l[i][j]-1 -1;
      ans = max(ans, tmp);
    }
  }
  
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 68864
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////
void solve(){
  int n ;
  cin >> n ;
  ll p = 1 ;
  ll inf = 1e18 ;
  vector < ll > a(n) ;
  for( int i = 0 ; i < n ; i++){
    cin >> a[i] ;
    if(a[i]==0){
        cout << 0 ;
        return ;
    }
  }
  // x*p > inf
  for( int i = 0 ; i < n ; i++){
        ll d = inf / p ;
        if(a[i]>d){
            cout << -1 ;
            return ;
        }
        p *= a[i] ;
  }
  cout << p ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1 ;
    //cin >> t ;
    int case1 = 1 ;
    while(t--){
        //cout << "Case #" << case1 << ": " ;
        case1++;
        solve( );
    }
}


Measured memory_bytes: 3988
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
int main() {
    int N,t[100000],x[100000],y[100000],nx=0,ny=0,nt=0;
    bool b=1;
    cin>>N;
    rep(i,N){cin>>t[i]>>x[i]>>y[i];
        int nn=t[i]-nt;
        nn-=abs(nx-x[i])+abs(ny-y[i]);
        if(nn%2==1)b=0;
        if(nn<0)b=0;
        nx=x[i];ny=y[i];nt=t[i];
        if(!b)break;
    }
    cout<<(b?"Yes":"No")<<endl;
   return 0;
}

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



int main(void){


	char W[11];
	char T[1001];
	char t[] = "END_OF_TEXT";
	int j,i;
	int count = 0;



	scanf("%s",W);

	for(i = 0;W[i] != '\0' ;i++){
	
			if(W[i] >= 'A' && W[i] <= 'Z'){
				W[i] += 32;
			
 
			}
	
	}

	while(1){

		
		scanf("%s",T);
		
		if(strcmp(T,t) == 0){
	
				break;
		}

	
	
		for(i = 0;T[i] != '\0' ;i++){
			
			if(T[i] >= 'A' && T[i] <= 'Z'){
				T[i] += 32;
			
 
			}

		}	
			




	

		j = strcmp(T,W);
	
		if(j == 0){
			count++;
		}


		

	}

	

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

return 0;



}

Measured memory_bytes: 544
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = a; i < min(a + k, b + 1); i++)
        cout << i << endl;
    for (int i = max(b - k + 1, a + k); i < b + 1; i++)
        cout << i << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;
const int MAXN = 200005; 
int n;
char str[MAXN];

int main()
{
	scanf("%s",str+1);
	n = strlen(str+1);
	int ans = 0;
	string now = "", lst = "";
	for(int i = 1; i<=n; i++)
	{
		now += str[i];
		if(now!=lst)
			ans++, lst = now, now = "";
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, ll> P; 
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[3333];
ll b[3333],dp[3333][3333][2];

int main(void){
	int n,t,i,j;
	ll ans = 0ll;
	cin >> n >> t;
	for(i=0; i<n; ++i){
		cin >> a[i] >> b[i];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<t; ++j){
			dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][0]);
			dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][1]);
			dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][0]+b[i]);
			if(j+a[i]<t){
				dp[i+1][j+a[i]][0] = max(dp[i+1][j+a[i]][0],dp[i][j][0]+b[i]);
				dp[i+1][j+a[i]][1] = max(dp[i+1][j+a[i]][1],dp[i][j][1]+b[i]);
			}
		}
	}
	for(i=0; i<=n; ++i){
		for(j=0; j<t; ++j){
			ans = max({ans,dp[i][j][0],dp[i][j][1]});
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 157952
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c,d = li()

if a*b < c*d:
    print(c*d)
else:
    print(a*b)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        long ans = IntStream.range(0, (int) Math.pow(2, S.length() - 1)).boxed().map(flag -> {
            List<Integer> indexes = flagToIndexes(flag, S.length() - 1);
            // System.out.println(indexes);
            return subs(indexes, S).stream().map(s -> Long.parseLong(s)).reduce(0L, (accm, x) -> accm + x);
        }).reduce(0L, (accm, x) -> accm + x);

        System.out.println(ans);
    }

    public static List<Integer> flagToIndexes(int flag, int length) {
        List<Integer> indexes = new ArrayList<>();
        indexes.add(0);
        for (int i : IntStream.range(0, length).toArray()) {
            if ((flag >> i) % 2 == 1) {
                indexes.add(i + 1);
            }
        }
        indexes.add(length + 1);
        return indexes;
    }

    public static List<String> subs(List<Integer> indexes, String str) {
        List<String> substrs = new ArrayList<String>();
        for (int i : IntStream.range(1, indexes.size()).toArray()) {
            substrs.add(str.substring(indexes.get(i - 1), indexes.get(i)));
        }
        return substrs;
    }
}

Measured memory_bytes: 28372
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int sx,sy,tx,ty;
	cin>>sx>>sy>>tx>>ty;
	for(int i = sx;i < tx; i++)
		cout<<'R';
	for(int j = sy; j< ty; j++)
		cout<<'U';
	for(int i = tx; i>sx; i--)
		cout<<'L';
	for(int j = ty; j> sy; j--) cout<<'D';

		cout<<'D';
	for(int i = sx;i < tx; i++)
		cout<<'R';
	cout<<'R';
	for(int j = sy; j< ty; j++)
		cout<<'U';
	cout<<'U';
	cout<<"LU";
	for(int i = tx; i>sx; i--)
		cout<<'L';
	cout<<'L';
	for(int j = ty; j> sy; j--) cout<<'D';
		cout<<"DR";
	return 0;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
oks = [True]*(N+1)
mod = 1e9+7
for i in range(M):
    a = int(input())
    oks[a]=False
dp = [0]*(N+1)
dp[0]=1
if oks[1]:
    dp[1]=1
else:
    dp[1]=0
for i in range(2,N+1):
    if oks[i]:
        dp[i]=dp[i-1]+dp[i-2]
        dp[i]%=mod
print(int(dp[N]))

Measured memory_bytes: 13476
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
const int N=100005;
int n,a,b,x,y,cntx,cnty,d,tmp[N];
long long ans;
bool vis[N];
map<int,int> idx,idy;
queue<int> q;
struct point{
	int x,y,id;
	point(){}
	point(int x,int y,int id):x(x),y(y),id(id){}
}p[N];
struct data{
	int v,id;
	data(){}
	data(int v,int id):v(v),id(id){}
	bool operator < (const data &n) const{
		return v==n.v?id<n.id:v<n.v;
	}
};
set<data> sx[N],sy[N];
vector<int> vx[N],vy[N]; 
bool cmpx(point a,point b){
	return a.x==b.x?a.y<b.y:a.x<b.x;
}
bool cmpy(point a,point b){
	return a.y==b.y?a.x<b.x:a.y<b.y;
}
bool cmp(point a,point b){
	return a.id<b.id;
}
int qx(int x,int l,int r){
	return upper_bound(vx[x].begin(),vx[x].end(),r)-lower_bound(vx[x].begin(),vx[x].end(),l);
}
int qy(int x,int l,int r){
	return upper_bound(vy[x].begin(),vy[x].end(),r)-lower_bound(vy[x].begin(),vy[x].end(),l);
}
void gaox(int x,int l,int r){
	tmp[0]=0;
	set<data>::iterator it1=sx[x].lower_bound(data(l,0));
	set<data>::iterator it2=sx[x].upper_bound(data(r,1e9));
	while(it1!=it2){
		tmp[++tmp[0]]=it1->id;
		if(!vis[tmp[tmp[0]]]){
			vis[tmp[tmp[0]]]=true;
			q.push(tmp[tmp[0]]);
		}
		it1++;
	}
	for(int i=1;i<=tmp[0];i++){
		sx[idx[p[tmp[i]].x]].erase(data(p[tmp[i]].y,tmp[i]));
		sy[idy[p[tmp[i]].y]].erase(data(p[tmp[i]].x,tmp[i]));
	}
}
void gaoy(int x,int l,int r){
	tmp[0]=0;
	set<data>::iterator it1=sy[x].lower_bound(data(l,0));
	set<data>::iterator it2=sy[x].upper_bound(data(r,1e9));
	while(it1!=it2){
		tmp[++tmp[0]]=it1->id;
		if(!vis[tmp[tmp[0]]]){
			vis[tmp[tmp[0]]]=true;
			q.push(tmp[tmp[0]]);
		}
		it1++;
	}
	for(int i=1;i<=tmp[0];i++){
		sx[idx[p[tmp[i]].x]].erase(data(p[tmp[i]].y,tmp[i]));
		sy[idy[p[tmp[i]].y]].erase(data(p[tmp[i]].x,tmp[i]));
	}
}
int main(){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x,&y);
		p[i]=point(x+y,x-y,i);
	}
	sort(p+1,p+n+1,cmpx);
	for(int i=1;i<=n;i++){
		idx[p[i].x]=i==1||p[i].x!=p[i-1].x?++cntx:cntx;
		sx[cntx].insert(data(p[i].y,p[i].id));
		vx[cntx].push_back(p[i].y);
	}
	sort(p+1,p+n+1,cmpy);
	for(int i=1;i<=n;i++){
		idy[p[i].y]=i==1||p[i].y!=p[i-1].y?++cnty:cnty;
		sy[cnty].insert(data(p[i].x,p[i].id));
		vy[cnty].push_back(p[i].x);
	}
	sort(p+1,p+n+1,cmp);
	d=max(abs(p[a].x-p[b].x),abs(p[a].y-p[b].y));
	vis[a]=true;
	q.push(a);
	while(!q.empty()){
		int u=q.front(),v;
		q.pop();
		v=idx[p[u].x-d];
		if(v){
			ans+=qx(v,p[u].y-d,p[u].y+d);
			gaox(v,p[u].y-d,p[u].y+d);
		}
		v=idx[p[u].x+d];
		if(v){
			ans+=qx(v,p[u].y-d,p[u].y+d);
			gaox(v,p[u].y-d,p[u].y+d);
		}
		v=idy[p[u].y-d];
		if(v){
			ans+=qy(v,p[u].x-d+1,p[u].x+d-1);
			gaoy(v,p[u].x-d,p[u].x+d);
		}
		v=idy[p[u].y+d];
		if(v){
			ans+=qy(v,p[u].x-d+1,p[u].x+d-1);
			gaoy(v,p[u].x-d,p[u].x+d);
		}
	}
	printf("%lld\n",ans/2);
	return 0;
}

Measured memory_bytes: 38528
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
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;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
#define INT_MAX 1<<30
const ll mod = 1e9+7;


int main(){
	ll a,b,k; cin >> a >> b >> k;
	if(a>=k) cout << a-k << " " << b << endl;
	else if(a+b>=k) cout << 0 << " " << b+a-k << endl;
	else cout << "0 0" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

//#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;cin>>n;
    if((n%1000) == 0)cout<<"0\n";
    else
         cout<< 1000 - (n%1000)<<"\n";
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

vector<ll> divisor(ll n) {
	vector<ll> res;
	for(ll i = 2; i*i <= n; i++) {
		if(n % i == 0) {
			res.push_back(i);
			if(i != n/i) res.push_back(n/i);
		}
	}
	return res;
}

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

	vector<int> v(n);
	rep(i, n) cin >> v[i];

	map<ll, int> m;
	rep(i, n) {
		vector<ll> ret = divisor(v[i]);
		ret.push_back(1);
		ret.push_back(v[i]);
		rep(j, ret.size()) m[ret[j]]++;
	}

	map<ll, int>::iterator ite;
	for(ite = m.begin(); ite != m.end(); ite++) {
		if(ite->second >= n) cout << ite->first << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;

int N;
int a[100010];
int ans;
int cnt[100030];

int main() {
	cin>>N;
	ans = 0
      ;
	Rep(i,100020) cnt[i]=0;
	Rep(i,N) cin>>a[i];
	Rep(i,N){
		if(a[i]>100000){
			ans++;
		}
		else{
			cnt[a[i]]++;
			
		}
	}
	Rep(i,100010){
		if(cnt[i]>=i){
			ans += cnt[i]-i;
		}
		else{
			ans += cnt[i];
		}
	}
	cout<<ans<<endl;
	
	
	return 0;
}


Measured memory_bytes: 1024
// LNU_Algotesters
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <fstream>
#include <complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 100 *1000 + 47;
const int MOD = INF;


int A[MAX];
LL SP[MAX];
LL SN[MAX];
int main()
{
    //freopen("in.txt", "r", stdin);
    //ios::sync_with_stdio(false); cin.tie(0);
    
    int n, k;
    scanf("%d%d", &n, &k);
    FOR(i, 0, n)scanf("%d", A + i);
    
    FOR(i, 0, n)
    {
        if (A[i] > 0)
            SP[i] = A[i];
        else SN[i] = A[i];
        
        if (i) SP[i] += SP[i-1], SN[i] += SN[i-1];
    }
    LL ans = 0;
    FOR(i, 0, n)
    {
        int R = i;
        int L = i - k + 1;
        if (L < 0)continue;
        LL s = SN[R] + SP[R];
        if (L)s -= SN[L-1] + SP[L-1];
        
        s = max(0LL, s);
        s += SP[n-1] - SP[R] + (L ? SP[L-1] : 0);
        
        ans = max(ans, s);
        
    }
    printf("%lld\n", ans);
    
    
}




Measured memory_bytes: 2176
import math

def is_prime(q):
    p = math.sqrt(q)
    p = int(p)
    flag = True
    for i in range(2,p+1):
        if q%i==0:
            flag = False
            break
        else:
            continue
    return flag

x = int(input())
while True:
    a = is_prime(x)
    if a:
        print(x)
        exit()
    else:
        x+=1

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();

		if(K <= A + B) {
			System.out.println(Math.min(K, A));
		}else {
			System.out.println(A-(K-A-B));
		}
	}
}


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

int main() {
    int n, ans = 0;
    string s, t[105];
    cin >> n >> s;
    for(int i=0;i<n;i++){
        cin >> t[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<t[i].size();j++){
            if(s[0]==t[i][j]){
                for(int l=1;j+l*(s.size()-1)<t[i].size();l++){
                    bool ok = true;
                    for(int k=1;k<s.size();k++){
                        ok &= s[k] == t[i][j+l*k];
                    }
                    if(ok){
                        ans++;
                        j = t[i].size();
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3200
// Vivek Rai
// Blazer_007

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

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

#define fastio 		ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp	     make_pair
#define inf         0x3f3f3f3f
//#define INF         0x3f3f3f3f3f3f3f3fLL
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define ppi	    pair<ll,pii>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define see(x)	    cout<<x<<endl;
#define see2(x,y)   cout<<x<<" "<<y<<endl;
#define see3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define bit(x, y)   (((x)>>(y))&1)
#define bpt(x)      (__builtin_popcount(x))
#define bptl(x)     (__builtin_popcountll(x))
#define loop(i,a,b)  for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define N 2000010

using namespace std;
//using namespace __gnu_pbds;

//typedef priority_queue<int> maxHeap;
//typedef priority_queue<int,vector<int>,greater<int>()) minHeap;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// find_by_order(index) -> value at given index or Kth smallest element in set
// order_of_key(X) -> number of elements strictly less than X
//typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

void solution(){

	int n;
	cin >> n;
	int a,b,c;
	ll ans1 = 0,ans2 = 0,ans3=0;
	loop(i,0,n){
		cin >> a >> b >> c;
		ll temp1 = a + max(ans2,ans3);
		ll temp2 = b + max(ans1,ans3);
		ll temp3 = c + max(ans1,ans2);
		ans1 = temp1;
		ans2 = temp2;
		ans3 = temp3;
	}
	cout << max({ans1,ans2,ans3}) << endl;
}

signed main(){
    fastio
    //#ifndef ONLINE_JUDGE
    //	freopen("input.txt", "r" , stdin);
    //	freopen("output.txt", "w", stdout);
    //#endif

    ll t=1;
    // cin>>t;
    loop(i,1,t+1){
    	//cout<<"Case #"<<i<<": ";
    	solution();
    }
}




Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product

sys.setrecursionlimit(50000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@lru_cache(maxsize=None)
def r(N):
    if N == 0:
        return 0

    c = 1
    while True:
        if c * 9 <= N:
            c *= 9
        else:
            break
    b = 1
    while True:
        if b * 6 <= N:
            b *= 6
        else:
            break
    if c >= 9:
        ac = r(N - c) + 1
    else:
        ac = sys.maxsize

    if b >= 6:
        ab = r(N - b) + 1
    else:
        ab = sys.maxsize

    return min(N, ab, ac)


@mt
def slv(N):
    return r(N)


def main():

    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6476
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>

int main(){
  constexpr int a = 26;
  int n;
  std::cin>>n;
  std::vector<std::string> strs(n);
  for(auto &&s:strs)
    std::cin>>s;

  std::vector<std::array<int,a>> alphapat(n);
  for(int i=0;i<n;++i){
    for(const auto &c:strs[i]){
      alphapat[i][c-'a']++;
    }
  }

  std::array<int,a> common;
  for(int i=0;i<a;++i){
    common[i] = 51;
    for(int j=0;j<n;++j){
      if(alphapat[j][i]<common[i]) common[i] = alphapat[j][i];
    }
  }
  
  for(int i=0;i<a;++i){
    if(common[i]!=0){
      std::string str(common[i],'a'+i);
      std::cout<<str;
    }
  }
  std::cout<<std::endl;
  return 0;
}

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

using namespace std;

int main(){
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(x>=r && x<=w-r && y>=r && y<=h-r) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

void solve()
{
    ll n;
    cin>>n;
    ll mx1=-1e10,mn1=1e10,mn2=1e10,mx2=-1e10;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y; 
        mx1=max(mx1,x+y);
        mn1=min(mn1,x+y);
        mx2=max(mx2,x-y);
        mn2=min(mn2,x-y);
    }
    cout<<max(mx1-mn1,mx2-mn2);
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++) solve();
    return 0;
}



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

// ll A, B, C;
// scanf("%ld %ld %ld", &A, &B, &C);
// printf("%ld %ld %ld", A, B, C);

int main()
{
    char A[10];
    scanf("%s", &A);

    if(A[2]==A[3]&&A[4]==A[5]){
        printf("Yes");
    } else{
        printf("No");
    }

    return 0;
}


Measured memory_bytes: 256