akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long n, cnt = 0, ans = 0;
	cin >> n;
	int a[n];
	pair<long long, long long> P[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		P[i] = make_pair(a[i], i);
	}
	sort(P, P + n);
	for (int i = 0; i < n; i++) {
		if (i % 2 != P[i].second % 2) {
			cnt++;
			if (cnt % 2 == 0) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	string a,b,c;
	cin>>a>>b>>c;
	cout<<a[0]<<b[0]<<c[0]<<endl;
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
using namespace std;
bool map[21][21];
int h,w,z,xs,ys,xg,yg;
int ans;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
void DFS(int y,int x,int len){
	if(len>=12)return;
	for(int i=0;i<4;i++){
		int xx=x+dx[i],yy=y+dy[i];
		if(map[yy][xx]==true){
		while(true){
			if(xx<=-1||yy<=-1||xx>=w||yy>=h)break;
			if(xx==xg&&yy==yg){ans=min(ans,len);break;}
			if(map[yy][xx]==false){
				map[yy][xx]=true;
				DFS(yy-dy[i],xx-dx[i],len+1);
				map[yy][xx]=false;
				break;
			}
			xx+=dx[i],yy+=dy[i];
		}
		}
	}
}
int main(){
	while(true){
	cin>>w>>h;
	if(h==0&&w==0)break;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>z;
			if(z==0)map[i][j]=true;
			if(z==1)map[i][j]=false;
			if(z==2){xs=j,ys=i,map[i][j]=true;}
			if(z==3){xg=j,yg=i;map[i][j]=true;}
		}
	}
	ans=11;
	DFS(ys,xs,1);
	if(ans>10)cout<<"-1"<<endl;
	else cout<<ans<<endl;
	}
	return 0;
}

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

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


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string str;
    cin >> str;
    vector <int>    count(0);
    map <char, int> m;
    for (int i = 0; i < (int) str.size(); i++) {
        if (m.count(str.at(i)) == false) {
            m[str.at(i)] = 1;
            continue;
        } else {
            m[str.at(i)]++;
        }
    }
    if (m.size() == 2) {
        if (m[str.at(0)] == 2 && m[str.at(1)] == 2) {
            cout << "Yes" << endl;

            return 0;
        }
    }
    cout << "No" << endl;



    return 0;
}


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

a.sort()

ruiseki = [0] * n
ruiseki[0] = a[0]
for i in range(1,n):
        ruiseki[i] = ruiseki[i-1] + a[i]

ans = 1
for i in range(n-1):
        if ruiseki[n-2-i] * 2 >= a[n-1-i]:
                ans += 1
        else:
                break
print(ans)

Measured memory_bytes: 14320
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, d;
	cin >> n >> d;
	vector<ll> x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	int ans = 0;
	rep(i, n) if((sq(x[i]) + sq(y[i])) <= sq(d)) ans++;
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 6364
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int K = int.Parse(input[1]);
            int Q = int.Parse(input[2]);
            int[] P = new int[N];
            for (var i = 0; i < Q; i++)
            {
                P[int.Parse(Console.ReadLine())-1]++;
            }
            for (var i = 0; i < N; i++)
            {
                if (K - Q + P[i] > 0)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }

    }
}

Measured memory_bytes: 15712
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }

void calc_dist(vector<vector<pair<LL,LL>>>& edge, vector<LL>& cost, LL start){
    priority_queue<pair<LL,LL>, vector<pair<LL,LL>>,  greater<pair<LL,LL>>> q;
    q.push(pair<LL,LL>(0, start));
    while(!q.empty()){
        LL dist = q.top().first;
        LL cur = q.top().second;
        q.pop();
        if(cost[cur] <= dist) continue;
        cost[cur] = dist;
        for(pair<LL,LL> p: edge[cur]){
            if(dist + p.second < cost[p.first]) q.push(pair<LL,LL>(dist + p.second, p.first));
        }
    }
}


int main(){
    LL n, m, s, t;
    cin >> n >> m >> s >> t;
    --s; --t;
    vector<vector<pair<LL,LL>>> edge_yen(n);
    vector<vector<pair<LL,LL>>> edge_snuke(n);
    vector<LL> cost_yen(n, 1e+18);
    vector<LL> cost_snuke(n, 1e+18);
    for(LL i = 0; i < m; ++i){
        LL u, v, a, b;
        cin >> u >> v >> a >> b;
        --u; -- v;
        edge_yen[u].push_back(pair<LL,LL>(v, a));
        edge_yen[v].push_back(pair<LL,LL>(u, a));
        edge_snuke[u].push_back(pair<LL,LL>(v, b));
        edge_snuke[v].push_back(pair<LL,LL>(u, b));
    }
    calc_dist(edge_yen, cost_yen, s);
    calc_dist(edge_snuke, cost_snuke, t);
    vector<LL> ans;
    LL best = 0;
    for(LL i = n-1; i >= 0; --i){
        LL res = (LL)(1e+15) - (cost_yen[i] + cost_snuke[i]);
        best = max<LL>(best, res);
        ans.push_back(best);
    }
    reverse(ans.begin(), ans.end());
    for(LL i = 0; i < n; ++i){
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 19956
S = input()
cnt = 0
if S == 'RRR':
    cnt = 3
elif S == 'RRS' or S == 'SRR':
    cnt = 2
elif 'R' in S:
    cnt = 1
else:
    cnt = 0
# for i in range(len(S)):
#     if(S[i] == 'R'):
#         cnt += 1
#     else:
#         cnt = 0
print(cnt)



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

int main() {
	int H, N;
	cin >> H >> N;
	
	ll tot = 0;
	bool win = false;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		tot += a;
		if (tot >= H) {
			win = true;
			break;
		}
	}

	if (win) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

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

vector<int> zAlgorithm(const string &s) {
  int i = 1, j = 0, n = (int)s.size();
  vector<int> ret(n);
  ret[0] = n;
  while(i < n) {
    while(i + j < n && s[j] == s[i+j]) ++j;
    ret[i] = j;
    if(j == 0) {
      ++i; continue;
    }
    int k = 1;
    while(i + k < n && k + ret[k] < j) ret[i+k] = ret[k], ++k;
    i += k, j -= k;
  }
  return ret;
}

int main() {
  int N; string S;
  cin >> N >> S;
  int ans = 0;
  for(int i = 0; i < N; ++i) {
    auto z = zAlgorithm(S.substr(i, N-i));
    for(int j = 0; j < (int)z.size(); ++j) {
      if(z[j] <= j) ans = max(ans, z[j]);
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
DD = list(map(int, input().split()))
D = Counter(DD)

if DD[0] != 0:
    print(0)
elif D[0] != 1:
    print(0)
else:
    ans = 1
    for i in range(len(D)-1):
        ans *= D[i]**D[i+1]
        ans %= 998244353 
    print(ans)

Measured memory_bytes: 19936
import java.io.*;

class Main{
	public static void main(String[] args) throws IOException{
	
		int x,ans;

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		x=Integer.parseInt(br.readLine());
		ans=x*x*x;
		System.out.println(ans);
	}
}

Measured memory_bytes: 16856
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=(int)(n);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

int solve(int X,int Y) {
    if(X==Y) return 0;
    if(X==0) {
        if(Y<0) {
            return -Y+1;
        }
        else {
            return Y;
        }
    }
    else if(Y==0) {
        if(X<0) {
            return -X;
        }
        else {
            return X+1;
        }
    }
    if(X<Y) {
        if(0<X) {
            return min(Y-X,Y+X+1);
        }
        else if(X<0 && 0<Y) {
            if(X<-Y) {
                return min(-Y-X+1,Y-X);
            }
            else {
                return min(Y-X,Y+X+1);
            }
        }
        else {
            return Y-X;
        }
    }
    else {
        if(0<Y) {
            return min(Y+X+1,-Y+X+2);
        }
        else if(Y<0 && 0<X) {
            if(X<-Y) {
                return min(-Y-X+1,-Y+X+2);
            }
            else {
                return min(Y+X+1,-Y+X+2);
            }
        }
        else {
            return min(-Y+X+2,-Y-X+1);
        }
    }
}
signed main() {
    int X,Y;
    cin>>X>>Y;
    cout<<solve(X,Y)<<endl;
    return 0;
}


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

using namespace std;

int gcd(int x, int y) {
    int r = x % y;
    while (r > 0) {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int sum = a + b;
    int minus = a / gcd(a, b);
    a /= minus;
    cout << sum - a + 1 << '\n';
    return 0;
}


Measured memory_bytes: 3192
awk -M '\
function abs(x){
    return x > 0 ? x : -x
}
{
    X=$1; K=$2; D=$3
    if(K*D <= abs(X)){
        ans = abs(X) - K*D
        print ans;
        exit
    }
    tmp = int(abs(X)/D)
    if(X>0){
        X -= tmp*D
    }else{
        X += tmp*D
    }
    K -= tmp
    b = X
    while(1){
        S[X]++
        if(K==0){
            print abs(X);
            exit
        }
        if(S[X]>1){
            a = X
            break
        }
        b = X
        if(X>0){
            X -= D
        }else{
            X += D
        }
        K--
    }
    if(K%2==0){
        print abs(a)
    }else{
        print abs(b)
    }
    exit
}'

Measured memory_bytes: 4648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,M;
  cin >> N >> M;
vector<vector<int64_t>> data(N ,vector<int64_t>(3));
  for(int i=0;i < N;i++){
  for(int j=0;j < 3;j++){
  cin >> data.at(i).at(j);
  }
  }
  
  int64_t m=0;
  int64_t sum=0;
vector<int64_t> datb(N, 0);
  for(int i=0;i < N;i++){
  datb.at(i) = data.at(i).at(0)+data.at(i).at(1)+data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = data.at(i).at(0)+data.at(i).at(1)-data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = data.at(i).at(0)-data.at(i).at(1)+data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = -data.at(i).at(0)+data.at(i).at(1)+data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = data.at(i).at(0)-data.at(i).at(1)-data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = -data.at(i).at(0)+data.at(i).at(1)-data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = -data.at(i).at(0)-data.at(i).at(1)+data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  for(int i=0;i < N;i++){
  datb.at(i) = -data.at(i).at(0)-data.at(i).at(1)-data.at(i).at(2);
  }
  sort(datb.begin(), datb.end());
  sum=0;
  for(int i=0;i < M;i++){
  sum += datb.at(N-1-i);
  }
  m = max(m, sum);
  
  cout << m;
}

Measured memory_bytes: 256
S = input()
N = len(S)
flg = False

if S==S[::-1]:
  if S[0:int((N-1)/2)]==S[0:int((N-1)/2)][::-1]:
    if S[int((N+3)/2)-1::]==S[int((N+3)/2)-1::][::-1]:
      flg = True
if flg:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 38384
#include <stdio.h>
#include <set>
#include <string>
#include <iostream>
using namespace std;
int main()
{
	string s;
	cin>>s;
	set<string> skup;
	for(int i=0;i<s.size();i++)
	{
		for(int j=1;j<=5 && i+j<=s.size();j++)
		{
			skup.insert(s.substr(i,j));
		}
	}
	int k;
	scanf("%i",&k);
	string res;
	for(int i=1;i<=k;i++)
	{
		res=*skup.begin();
		skup.erase(skup.begin());
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int main(){
  string s[3];
  cin>>s[0]>>s[1]>>s[2];
  cout<<s[0][0]<<s[1][0]<<s[2][0]<<endl;
  return 0;
}


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

#define MOD 1000000007

vector<int> adj[100000];

void mul(int &a, int b) {
    a = (long long) a * b % MOD;
}

pair<int, int> dfs(int u, int p) {
    int black = 1, white = 1;
    for (int v : adj[u])
        if (v != p) {
            auto ret = dfs(v, u);
            mul(black, ret.second);
            mul(white, (ret.first + ret.second) % MOD);
        }
    return {black, white};
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for (int i=0; i<n-1; i++) {
        int x, y;
        cin >> x >> y;
        adj[x-1].push_back(y-1);
        adj[y-1].push_back(x-1);
    }

    auto ret = dfs(0, -1);
    cout << (ret.first + ret.second) % MOD << "\n";

    return 0;
}


Measured memory_bytes: 12672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] args) throws IOException{

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		String str = reader.readLine();

		int x = Integer.parseInt(str);

		System.out.println(x*x*x);

	}
}



Measured memory_bytes: 24220
import java.util.*;
 
public class Main {
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
				
		int n = sc.nextInt();
		
		int robot[][] = new int[n][2];
		
		for(int i=0;i<n;i++) {
			int x = sc.nextInt(), l = sc.nextInt();
			robot[i][0] = x-l;
			robot[i][1] = x+l;
		}
		
		Arrays.sort(robot, Comparator.comparingInt(arr -> arr[1]));
		
		int cnt = 0;
		int r = Integer.MIN_VALUE;
		for(int i=0;i<n;i++) {
			if(robot[i][0] >= r) {
				cnt++;
				r = robot[i][1];
			}
		}
		
		System.out.println(cnt);
		
		
	}
 
}

Measured memory_bytes: 94992
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt(); 
		int[] digits = new int[10];
		
		for (int i = 0; i < k; i++)
			digits[in.nextInt()] = 1;
		
		int start = n;
	
		while (!solve(start, digits)) {
			start++;
		}
		
		System.out.println(start);
	}
	
	public static boolean solve(int s, int[] digits) {
		while (s > 0) {
			if (digits[s % 10] == 1)
				return false;
			s /= 10;
		}
		return true;
	}
}


Measured memory_bytes: 21972
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[][] candies = new int[3][n + 1];
            int[][] dp = new int[3][n + 1];
            for (int i = 1; i < 3; ++i) {
                for (int j = 1; j <= n; ++j) {
                    candies[i][j] = in.nextInt();
                }
            }
            for (int i = 1; i < 3; ++i) {
                for (int j = 1; j <= n; ++j) {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]) + candies[i][j];
                }
            }
            out.println(dp[2][n]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int n;
int a[40000],b[40000];

int main(){
  //cin.tie(0);
  std::ios::sync_with_stdio(false);
  while(cin>>n && n){
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n;i++)cin >> b[i];

    sort(a,a+n,greater<int>());
    sort(b,b+n,greater<int>());

    n >>=1;
    int i;
    for(i=0;i<n;i++){
      if(a[i<<1]>b[i]){
	cout << (i<<1)+1 << endl;
	break;
      }
    }
    if(i==n)cout << "NA\n";
  }
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
 
const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = 998244353;
 
int pow(int a, int b, int m)
{
   int ans=1;
   while(b)
   {
      if(b&1)
         ans=(ans*a)%m;
      b/=2;
      a=(a*a)%m;
   }
   return ans;
}
 
int modinv(int k)
{
   return pow(k, MOD-2, MOD);
}
 
int32_t main(){
   fast;
   int n;
   cin >> n;
   int a[n],f[n] = {0};
   f(i,0,n) cin >> a[i] , f[a[i]]++;
 
   int ans = (f[0] == 1 && a[0] == 0);
 
   f(i,1,n){
      ans = (ans * pow(f[i-1] , f[i] , MOD)) % MOD;
   }
   cout << ans << "\n";
}

Measured memory_bytes: 1792
#include<iostream>
#include <algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

const int mod = 1000000007;
struct mint {
  ll x;

  mint(ll x=0):x((x%mod+mod)%mod){}

  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main() {
  int N;
  cin >> N;
  vector<ll> C(N);
  rep(i,N) cin >> C[i];

  sort(C.begin(), C.end(), greater<>());  
  mint sum = 0;
  mint base = mint(2).pow(N-1);
  rep(i,N) {    
    mint d = base + mint(i)*base/2;
    mint c = C[i];
    sum += c * d;
  }
  mint n = mint(2).pow(N);
  mint ans = sum*n;  
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int dp[100005];

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  
  rep(i, N){
  
  if(i==0){
  dp[i]=0;
  }
  
    else if(i==1){
    dp[i]=abs(A[i]-A[i-1]);
    }
  else if(i==2){
  dp[i]=dp[i-2]+min(abs(A[i-2]-A[i-1])+abs(A[i-1]-A[i]),abs(A[i]-A[i-2]));
  }
    else{
    dp[i]=min(dp[i-2]+min(abs(A[i-2]-A[i-1])+abs(A[i-1]-A[i]),abs(A[i]-A[i-2])),dp[i-3]+abs(A[i-1]-A[i-3])+abs(A[i-1]-A[i]));
    
    
    }
  
  }
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 4016
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		while (n-- > 0) {
			int[][] num = new int[9][9];
			boolean[][] map = new boolean[9][9];
			for (int i = 0; i < 9; i++) {
				int[] x = new int[10];
				for (int j = 0; j < 9; j++) {
					int y = scanner.nextInt();
					num[i][j] = y;
					x[y]++;
				}
				for (int k = 0; k < 9; k++) {
					int c = num[i][k];
					if (x[c] > 1) {
						map[i][k] = true;
					}
				}
			}
			for (int i = 0; i < 9; i++) {
				int[] x = new int[10];
				for (int j = 0; j < 9; j++) {
					int y = num[j][i];
					x[y]++;
				}
				for (int j = 0; j < 9; j++) {
					int c = num[j][i];
					if (x[c] > 1) {
						map[j][i] = true;
					}
				}
			}
			for (int i = 0; i < 9; i += 3) {
				for (int j = 0; j < 9; j += 3) {
					int[] x = new int[10];
					for (int k = i; k < i + 3; k++) {
						for (int l = j; l < j + 3; l++) {
							int y = num[k][l];
							x[y]++;
						}
					}
					for (int k = i; k < i + 3; k++) {
						for (int l = j; l < j + 3; l++) {
							int c = num[k][l];
							if (x[c] > 1) {
								map[k][l] = true;
							}
						}
					}
				}
			}
			for (int i = 0; i < 9; i++) {
				for (int j = 0; j < 9; j++) {
					System.out.print(map[i][j] ? "*" : " ");
					System.out.print(num[i][j]);
				}
				System.out.println();
			}
			if (n != 0)
				System.out.println();
		}

	}
}

Measured memory_bytes: 21532
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b,c; cin >> a >> b >> c;
    cout << min(c, b / a) << "\n";
}

Measured memory_bytes: 3624
s = input()
r_s = ''.join(list(reversed(s)))

dream = "maerd"
dreamer = "remaerd"
erase = "esare"
eraser = "resare"

flag = True

while flag:
    if r_s.startswith(dream):
        r_s = r_s[5:]
    elif r_s.startswith(dreamer):
        r_s = r_s[7:]
    elif r_s.startswith(erase):
        r_s = r_s[5:]
    elif r_s.startswith(eraser):
        r_s = r_s[6:]
    else:
        flag = False

if r_s == "":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define int long long
#define rg register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
    return f*x;
}
int a[400001],b[400001],n,ans,c[4000001],sum[400001];
int lowbit(int x){
	return x&(-x);
}
void Add(int x,int v){
	while(x<=n+400000)
		c[x]+=v,x+=lowbit(x);
}
int Sum(int x){
	int ans=0;
	while(x)
		ans+=c[x],x-=lowbit(x);
	return ans;
}
int tot;
bool check(int x){
	for(int i=1;i<=n;i++){
		sum[i]=sum[i-1];
		if(a[i]<x)
			sum[i]--;
		else if(a[i]>=x) sum[i]++;
	}
	tot=0;
	Add(400000,1);
	for(int i=1;i<=n;i++)
		Add(sum[i]+400000,1),tot+=Sum(sum[i]+400000)-1;
	Add(400000,-1);
	for(int i=1;i<=n;i++)
		Add(sum[i]+400000,-1);
	return tot*2>=(n*(n+1)/2);
}
main(){
	n=read();
	for(int i=1;i<=n;i++)
		b[i]=a[i]=read();
	sort(b+1,b+1+n);
	int l=1,r=n;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(b[mid]))
			l=mid+1,ans=b[mid];
		else r=mid-1;
	}
	printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 11264
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	n, _ := sc.NextInt()
	ans := solve(n)
	fmt.Println(ans)
}

func solve(n int) (ans string) {
	divisor := 26
	rs := []int{}
	for {
		n--
		r := n % divisor
		n /= divisor
		rs = append(rs, r)
		if n == 0 {
			break
		}
	}
	return toString(rs)
}

func toRune(r int) rune {
	return 'a' + rune(r)
}

func toString(rs []int) string {
	runes := make([]rune, len(rs))
	for i := range runes {
		runes[i] = toRune(rs[len(rs)-1-i])
	}
	return string(runes)
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}


Measured memory_bytes: 1780
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int i=0 ; i<b ; i++)scanf("%d",&a[i])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{
	int a[3][12],b[3][12],c[3][12],d[3][12];
	forin(i,0,3)
	{
		forin(j,0,10)
		{
			a[i][j]=0;
			b[i][j]=0;
			c[i][j]=0;
			d[i][j]=0;
		}
	}
	
	int n;
	scd(n);
	int x,f,r,v;
	forin(i,0,n)
	{
		scanf("%d %d %d %d",&x,&f,&r,&v);
		f--;
		r--;
		if(x==1)
		a[f][r]+=v;
		else if(x==2)
		b[f][r]+=v;
		else if(x==3)
		c[f][r]+=v;
		else if(x==4)
		d[f][r]+=v;
	}
	forin(i,0,3)
	{
		forin(j,0,10)
		printf(" %d",a[i][j]);
		newline;
	}
	forin(i,0,20)
	printf("#");
	newline;
	forin(i,0,3)
	{
		forin(j,0,10)
		printf(" %d",b[i][j]);
		newline;
	}
	forin(i,0,20)
	printf("#");
	newline;
	forin(i,0,3)
	{
		forin(j,0,10)
		printf(" %d",c[i][j]);
		newline;
	}
	forin(i,0,20)
	printf("#");
	newline;
	forin(i,0,3)
	{
		forin(j,0,10)
		printf(" %d",d[i][j]);
		newline;
	}
	return 0;
}

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

// long long Factorial(int n) {
//     long long product = 1;
//     for(int i=2;i<=n;i++)
//         product *= i;
//     return product;
// }

int main(int argc, char const *argv[])
{
    int n,m;
    cin >> n >> m;
    long long res = ((n*(n-1))/2) + ((m*(m-1))/2);
    cout << res << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
    static int sum, b;
    public static void main(String[] args){
	BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	try{
	    while(true){
		String[] st = sc.readLine().split(" ");
		int a;
		a = Integer.valueOf(st[0]);
		b = Integer.valueOf(st[1]);
		if(a==0 && b==0)
		    break;
		sum = 0;
		calc(0, a, 0);
		System.out.println(sum);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
    
    static void calc(int i, int j, int k) throws Exception{
	if(j==0){
	    if(k==b)
		sum++;
	    return;
	}
	for(int l=i; l<=9; l++)
	    calc(l+1, j-1, k+l);
    }
}

Measured memory_bytes: 8972
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

const int P=1000000007;

vector<int> f,d;
int n,K,ans;

inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

void generate_state()
{
	for (int x=1;x*x<=n;++x)
		if (!(n%x))
		{
			d.push_back(x);
			if (x*x!=n) d.push_back(n/x);
		}
	sort(d.begin(),d.end()),f.reserve(d.size());
}

inline void update(int &x,int y){(x+=y)%=P;}

void dp()
{
	for (int i=0;i<(int)d.size();++i)
	{
		f[i]=quick_power(K,d[i]+1>>1);
		for (int j=0;j<i;++j) if (!(d[i]%d[j])) update(f[i],P-f[j]);
		if (d[i]&1) update(ans,1ll*f[i]*d[i]%P);
		else update(ans,1ll*f[i]*(d[i]>>1)%P);
	}
}

int main()
{
	//freopen("rotpal.in","r",stdin),freopen("rotpal.out","w",stdout);
	scanf("%d%d",&n,&K),generate_state(),dp(),printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

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

class Program
{
    static void Main()
    {
        while (true)
        {
            bool flag = true;
            long[] beta = new long[1500];
            char[] alpha = Console.ReadLine().ToCharArray();


            for (int i = 0; i < alpha.Length; i++)
            {
                beta[i] = int.Parse(alpha[i].ToString());
                beta[1499] += beta[i];
            }
            
            //if (char.IsUpper(alpha[i]) == true)
            //{
            //    alpha[i] =char.ToLower(alpha[i]);
            //}
            //else if (char.IsLower(alpha[i]) == true)
            //{
            //    alpha[i]=char.ToUpper(alpha[i]);
            //}
            if (alpha[0] == '0') { flag = false; break; }

            if (flag == true)
            {
                Console.Write(beta[1499]);

                Console.WriteLine();
            }
        }
    }
}


Measured memory_bytes: 15972
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test(n) cout << "test" << n << endl;
#define fixsp(n) fixed << setprecision(n)
#define defsp(n) defaultfloat << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define vector3D(K, N, M, DP) vector<vector<vector<ll>>> DP(K, vector<vector<ll>>(N, vector<ll>(M)));
#define vector4D(K, N, M, O, DP) vector<vector<vector<vector<ll>>>> DP(K, vector<vector<vector<ll>>>(N, vector<vector<ll>>(M, vector<ll>(O))));
#define zenbu(a) a.begin(), a.end()
#define rzenbu(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}
template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};
template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}

/* ここからコード開始 */

int H, W;
vector<string> fi;

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

int main() {
    cin >> H >> W;
    fi.resize(H);
    for (int i = 0; i < H; ++i) cin >> fi[i];

    // 多点をスタートとして扱う
    vector<vector<int> > dist(H, vector<int>(W, -1));
    using pint = pair<int,int>;
    queue<pint> que;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (fi[i][j] == '#') {
                dist[i][j] = 0;
                que.push(pint(i, j));
            }
        }
    }

    // BFS
    while (!que.empty()) {
        auto cur = que.front();
        que.pop();
        for (int dir = 0; dir < 4; ++dir) {
            int nx = cur.first + dx[dir];
            int ny = cur.second + dy[dir];
            if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if (dist[nx][ny] == -1) {
                dist[nx][ny] = dist[cur.first][cur.second] + 1;
                que.push(pint(nx, ny));
            }
        }
    }
    int res = 0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            res = max(res, dist[i][j]);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 13456
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstring>
#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define INF 100000000
#define uint unsigned int

using namespace std;


int main() {
	int a, b;
	cin >> a >> b;

	cout <<  max(a + b, max (2 * a - 1, 2 * b - 1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
	// freopen("Input.txt","r",stdin); freopen("Output.txt","w",stdout);
	int n,k,d,tmp;
	cin>>n>>k;
	int arr[n+1]{};
	while(k--){
       cin>>d;
       for(int i=1;i<=d;++i){
       	   cin>>tmp;
       	   arr[tmp]=1;
       }
	}
	int ans=count(arr+1,arr+n+1,0);
	cout<<ans<<"\n";

}

Measured memory_bytes: 3568
#include<stdio.h>

int main(){
  int i,j,k=0;
  int N;
  scanf("%d",&N);
  k=N;
  char S[N];
  scanf("%s",S);
  for(i=0;i<N-1;i++){
    if(S[i] == S[i+1])
      k--;
  }
  printf("%d\n",k);
  return 0;
}



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

#define ll       long long
#define ull      unsigned ll
#define pii      pair<int, int>
#define pll      pair<ll, ll>
#define mp       make_pair
#define ff       first
#define ss       second
#define sz(x)    (int) x.size()
#define all(v)   v.begin(), v.end()

template <typename T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <typename T> inline void smax(T &a, T b) {a = a > b ? a : b;}

#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) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}

template <typename T> inline void Int(T &n) {
    n = 0; int f = 1; register int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l); }

const int mod = (int) 1e9 + 7;

inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll) a * b % mod;}

const int inf = (int) 2e9 + 5;
const ll  Inf = (ll) 2e18 + 5;
const int N   = (int) 2e5 + 5;



int solve() {
    int n, k; Int(n, k);
    std::vector<int> cnt(n + 1, 0);
    for(int i = 1; i <= k; i++) {
        int d; Int(d);
        while(d--) {
            int x; Int(x);
            cnt[x]++;
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        ans += (cnt[i] == 0);
    }
    printf("%d\n", ans);
    return 0;
}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int test = 1, tc = 0;
    //Int(test);
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
    return 0;
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define ll long  long int 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);



int main()
{
	


  ll  n,k;
  cin>>n>>k;
  ll a[n+1];
  
  for (int i = 1; i <=n; ++i)
  {
  	 cin>>a[i];
  	

  }

 
   for (int i = k+1; i<=n; ++i)
  {
  	//cout<<a[i]<<" "<<a[i-k]<<endl;
  	if(a[i]>a[i-k])
  		cout<<"Yes";
  	else
  		cout<<"No";
  	cout<<"\n";
  }
  




return 0;
}



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

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

ll power(ll a,ll b,ll m=1e9+7)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1;
    ll ret=power(a,b/2);
    ret=(ret%m*ret%m)%m;
    if(b&1)
    ret=(ret%m*a%m)%m;
    return ret;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

void solve()
{
    string s,t;
    cin>>s>>t;
    ll i,j;
    ll ans=imx;
    for(i=0;i<s.size()-t.size()+1;i++)
    {
        ll k=0;
        for(j=0;j<t.size();j++)
        {
            if(t[j]!=s[j+i])
            k++;
        }
        ans=min(ans,k);
    }
    cout<<ans<<endl;
}

int main()
{
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        solve();
    }
    return 0;
}


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

int main()
{
	char s[100], t[100];
	scanf("%s", s);
	scanf("%s", t);
	int i,j;
	char tmp;
	for ( i = 0; i < strlen(s); i++)
	{
		for ( j = i+1; j < strlen(s); j++)
		{
			if (s[i] > s[j])
			{
				tmp = s[i];
				s[i] = s[j];
				s[j] = tmp;
			}
		}
	}
	for (i = 0; i < strlen(t); i++)
	{
		for (j = i + 1; j < strlen(t); j++)
		{
			if (t[i] < t[j])
			{
				tmp = t[i];
				t[i] = t[j];
				t[j] = tmp;
			}
		}
	}
	for (i = 0; i < strlen(s) && i < strlen(t); i++)
	{
		if (s[i]<t[i])
		{
			printf("Yes");
			return 0;
		}
		else if (s[i] > t[i])
		{
			printf("No");
			return 0;
		}
	}
	if (i == strlen(s) && i < strlen(t))
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
ll a[N];
ll b[N];
ll ans;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        ll x;
        cin>>x;
        b[i]=x;
        a[i]=a[i-1]+x;
    }
    for(int i=1;i<=n;i++)
    {
        ans=(ans+(b[i]*(a[i-1]%mod)%mod))%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6756
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

int H,W;
bool A[100][100];
int row[100];
int col[100];

int main(){
    cin >> H >> W;
    char a;
    REP(i, H){
        REP(k, W){
            cin >> a;
            if(a == '.'){
                A[i][k] = true;
                row[i]++;
                col[k]++;
            }
        }
    }

    REP(i, H){
        if(row[i] == W) continue;
        REP(k, W){
            if(col[k] == H) continue;
            if(A[i][k]) cout << ".";
            else cout << "#";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
l = list(map(int,input().split()))
a,b,k = l[0],l[1],l[2]
c = []
for i in range(a,min(a+k,b)):
    c.append(i)
for i in range(max(b-k+1,a),b+1):
    if i not in c:
        c.append(i)
for i in c:
    print(i)

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

int main() {
    int64_t N, K;
    string S;
    cin >> N >> S >> K;
    for (int64_t i = 0; i < N; i++) {
        if (S[i] != S[K - 1]) {
            S[i] = '*';
        }
    }

    cout << S << endl;
}

Measured memory_bytes: 256