akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#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++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2,62);

int main(){
    int x;
    cin >> x;
    if(400 <= x && x <= 599){
        cout << 8 << endl;
    }
    if(600 <= x && x <= 799){
        cout << 7 << endl;
    }
    if(800 <= x && x <= 999){
        cout << 6 << endl;
    }
    if(1000 <= x && x <= 1199){
        cout << 5 << endl;
    }
    if(1200 <= x && x <= 1399){
        cout << 4 << endl;
    }
    if(1400 <= x && x <= 1599){
        cout << 3 << endl;
    }
    if(1600 <= x && x <= 1799){
        cout << 2 << endl;
    }
    if(1800 <= x && x <= 1999){
        cout << 1 << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <queue>
#include <map>
using namespace std;

typedef pair<int,int> P;

#define N 100010
int main(){
  int n,l;
  int a[N];
  int t[N];
  //  priority_queue<P, vector<P>, greater<P> > q;
  priority_queue<P> q;

  cin >> n >> l;
  for( int i=0;i<n;i++ ){
    cin >> a[i];
    t[i]=0;
    q.push(P(a[i], i));
  }

  int time=0;
  while( !q.empty() ){
    P p = q.top(); q.pop();
    int i = p.second;
    int time = l-p.first;
    a[i] = 0;

    int dt = 0;
    if( i-1>=0 ) dt = t[i-1];
    if( i+1<n  ) dt = max(dt, t[i+1]);

    t[i] += dt + time;
  }
  int ans=0;
  for( int i=0;i<n;i++ ){
    //    cout << (i+1) << " " << t[i] << endl;
    ans = max(ans, t[i] );
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2824
import java.util.Scanner;

public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		for(int i = 1; i < n; i++) {
			int j = i - 1;
			int v = arr[i];
			while(j >= 0 && arr[j] > v) {
				arr[j + 1] = arr[j];
				j--;
			}
			arr[j + 1] = v;
			for(int k = 0; k < n; k++) {
				if(k == n - 1) {
					System.out.println(arr[k]);
				} else {
					System.out.print(arr[k] + " ");
				}
			}
		}
	}
}



Measured memory_bytes: 31948
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin>>n;
    if(n[0]==n[1]&&n[0]==n[2]||n[3]==n[1]&&n[1]==n[2])
        return cout<<"Yes\n",0;
    return cout<<"No\n",0;
    return 0;
}


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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N, K;
	cin >> N >> K;

	vector<int> A(N);
	rep(i, 0, N)cin >> A[i];

	int l = 0, r = 1LL << 34;

	while (r - l > 1)
	{
		int mid = (l + r) / 2;
		int cnt = 0;
		rep(i, 0, N)
		{
			/*int tl = 0, tr = A[i];
			while (tr - tl > 1)
			{
				int tmid = (tr + tl) / 2;
				if ((A[i] + tmid - 1) / tmid <= mid)
				{
					tr = tmid;
				}
				else
				{
					tl = tmid;
				}
			}*/
			cnt += (A[i] + mid - 1) / mid - 1;
		}
		if (cnt <= K)
		{
			r = mid;
		}
		else
		{
			l = mid;
		}
	}

	cout << r << endl;
	
	return 0;
}

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


namespace 競プロCS {
    class ABC086A {

        static void Main(string[] args) {
            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine((nums[0] * nums[1]) % 2 == 0 ? "Even" : "Odd");

        }
    }
}


Measured memory_bytes: 19008
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  cout<<min(b/a,c);
}









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

#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod                     1000000007
#define eps                     1e-9
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof(a))
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
#define PI                      3.14159265358979323846
#define int                     long long
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  map<int, int>              mii;
typedef  long double                 ld;


clock_t time_p=clock();
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Execution Time: "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int32_t main()
{
  FIO
 
  int X,Y,N,M;
  cin>>N>>M>>X>>Y;
  int mxx=X;
  int miy=Y;

  int ax[N],ay[M];

  forn(i,N)
  {
    cin>>ax[i];
    mxx=max(mxx,ax[i]);
  }
  forn(i,M)
  {
    cin>>ay[i];
    miy=min(miy,ay[i]);
  }
  if(mxx<miy)
    cout<<"No War";
  else
    cout<<"War";

  timer();
  return 0;
}  

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int res = 0;
    FOR(i, 1, N) {
        if(S[i] != S[i - 1])
            res++;
    }
    cout << res + 1 << endl;
    return 0;
}

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

int main()
{
	int n,k;
	cin >> n >> k;
	int h[n];
	for(int i = 0; i < n; i++)
		cin >> h[i];

	int cost[n];
	int loopCount = min(k,n);
	for(int i = 0; i <= loopCount; i++){
		int minCost = abs(h[i] - h[0]);
		for(int j = 0; j < i; j++)
			minCost = min(minCost, cost[j] + abs(h[j] - h[i]));
		cost[i] = minCost;
	}

	for(int i = k; i < n; i++){
		int minCost = cost[i-1] + abs(h[i] - h[i-1]);
		for(int j = 2; j <= k; j++)
			minCost = min(minCost, cost[i-j] + abs(h[i] - h[i-j]));
		cost[i] = minCost;
	}
	
	cout << cost[n-1] << "\n";

	return 0;
}


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

int main(){
	string s;
	int snum[1001];
	int count = 0;
	int ansnum=0;
	int anscount=-1;

	cin >> s;
	for(int i=0;i<s.size();){
		if(s[i] == 'e'){
			snum[count] = 1;
			count++;
			i += 3;
		}else{
			snum[count] = 2;
			count++;
			i += 7;
		}
	}

	int countbuf = 0;
	for(int i=0;i<count-1;i++){
		if(snum[i] != snum[i+1]){
			countbuf++;
		}else{
			if(anscount < countbuf){
				ansnum = snum[i];
				anscount = countbuf;
			}
			countbuf = 0;
		}
	}

	if(anscount < countbuf){
		ansnum = snum[count-1];
	}

	if(ansnum == 1){
		cout << "egg" << endl;
	}else{
		cout << "chicken" << endl;
	}
}

Measured memory_bytes: 0
from collections import deque
import sys
input = sys.stdin.buffer.readline

H, W, K = map(int, input().split())
sx, sy, tx, ty = map(lambda a: int(a) - 1, input().split())
INF = 10**18

A = [input().decode() for _ in range(H)]

minDist = [[INF] * W for _ in range(H)]
minDist[sx][sy] = 0
que = deque([(0, sx, sy)])

while que:
    dist, nx, ny = que.popleft()

    for i in range(1, K + 1):
        if nx + i >= H:
            break
        if minDist[nx + i][ny] <= dist or A[nx + i][ny] == '@':
            break
        if minDist[nx + i][ny] > dist + 1:
            minDist[nx + i][ny] = dist + 1
            que.append((dist + 1, nx + i, ny))
    for i in range(1, K + 1):
        if nx - i < 0:
            break
        if minDist[nx - i][ny] <= dist or A[nx - i][ny] == '@':
            break
        if minDist[nx - i][ny] > dist + 1:
            minDist[nx - i][ny] = dist + 1
            que.append((dist + 1, nx - i, ny))
    for i in range(1, K + 1):
        if ny + i >= W:
            break
        if minDist[nx][ny + i] <= dist or A[nx][ny + i] == '@':
            break
        if minDist[nx][ny + i] > dist + 1:
            minDist[nx][ny + i] = dist + 1
            que.append((dist + 1, nx, ny + i))
    for i in range(1, K + 1):
        if ny - i < 0:
            break
        if minDist[nx][ny - i] <= dist or A[nx][ny - i] == '@':
            break
        if minDist[nx][ny - i] > dist + 1:
            minDist[nx][ny - i] = dist + 1
            que.append((dist + 1, nx, ny - i))

ans = minDist[tx][ty]
print(ans if ans < INF else -1)


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
	int x;
	cin>>x;
	cout<<1000*(x/500)+5*((x%500)/5)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define cent 100
#define INF 100000000

int Graph[cent+1][cent+1], care[cent+1], size[cent+1];

void depthFirstSearch(int pi, int time);

int main(){
    int u, n;
    scanf("%d", &n);
    
    for(int i = 1; i <= n; ++i)
    {
        care[i] = INF;
        scanf("%d", &u);
        scanf("%d", &size[u]);
        for(int j = 1; j <= size[u]; ++j) scanf("%d", &Graph[u][j]);
    }

    depthFirstSearch(1, 0);

    for (int i = 1; i <= n; ++i) printf("%d %d\n", i, (care[i] == INF) ? -1 : care[i]);

    return 0;
}

void depthFirstSearch(int pi, int time)
{
    care[pi] = time;
    for(int i = 1; i <= size[pi] ; ++i) if(time+1 < care[Graph[pi][i]]) depthFirstSearch(Graph[pi][i], time+1);
}


Measured memory_bytes: 2056
#include <cmath>
#include <iostream>

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

bool is_prime(int n) {
    if (n % 2 == 0) return false;
    for (int i = 3; i <= std::sqrt(n); i += 2)
        if (n % i == 0) return false;
    return true;
}

int main() {
    int n, x;
    while (std::cin >> n >> x && n > 0 && x > 0) {
        auto course = new bool[x + 1]();
        rep(i, x + 1) course[i] = false;

        int prices[n];
        rep(i, n) { std::cin >> prices[i]; }
        course[0] = true;

        int max = -1;
        rep(i, x + 1) rep(j, n) {
            if (i - prices[j] >= 0 && course[i - prices[j]]) {
                if (is_prime(i)) max = i;
                course[i] = true;
                break;
            }
        }
        if (max < 0)
            std::cout << "NA" << std::endl;
        else
            std::cout << max << std::endl;
        delete[] course;
    }
}

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

int main(){
    int N;
    int a[110];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>()); 
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i){
        if (i % 2 == 0){ //先頭から偶数番目ならaliceターン
            Alice += a[i];
        }else{
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  string str;
  cin >> str;
  int n = stoi(str);
  vector<int> vals(n);
  for(auto& x : vals){
    cin >> str;
    x = stoi(str);
  }
  auto pm = max_element(vals.cbegin(), vals.cend());
  auto loc = distance(vals.cbegin(), pm);
  int me = *pm;
  vals[loc] = 0;
  int me2 = *max_element(vals.cbegin(), vals.cend());
  vector<int> ret(n, me);
  ret[loc] = me2;
  for(const auto& y : ret)
    cout << y << endl;
  return 0;
}

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

int main() {
  long long x,y;
  cin>>x>>y;
  long long a=x;
  int ans=1;
  while(1){
    a*=2;
    if(a<=y) ans++;
    else break;
  }
  cout<<ans<<endl;
}


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

int main() {
	std::vector<int> v(5);
	int k;

	for (size_t i = 0; i < 5; i++)
	{
		std::cin >> v[i];
	}
	std::cin >> k;

	std::sort(v.begin(), v.end());

	bool flag = true;

	for (size_t i = 0; i < 5; i++)
	{
		for (size_t j = i + 1; j < 5; j++)
		{
			if (v[j] - v[i] > k) {
				flag = false;
			}
		}
	}

	if (flag) {
		std::cout << "Yay!" << std::endl;
	}
	else {
		std::cout << ":(" << std::endl;
	}
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    i64 N;
    cin >> N;
    vector<i64> a(N);
    rep(i,0,N) cin >> a[i];

    i64 ans=0;
    for(;;){
        vector<i64> times(N);
        i64 sum=0;
        rep(i,0,N){
            if(a[i]<N) continue;
            times[i]=a[i]/N;
            sum+=times[i];
        }
        if(sum==0) break;
        ans+=sum;
        rep(i,0,N) a[i]=a[i]-N*times[i]+sum-times[i];
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5,p=1e9+7;
struct ele{int k,b,id;
	inline bool operator<(const ele&x)const{return k>x.k;}
}o[N];
struct what{int a,b;
	inline bool operator<(const what&x)const{return b==x.b?a<x.a:b<x.b;}
}w[N];
inline bool cmp(const ele&x,const ele&y){return x.b<y.b;}
int n,L[N],R[N],s[N];
inline int query(int x){int ans=0;for(++x;x;x-=x&-x)ans=(ans+s[x])%p;return ans;}
inline void modify(int x,int val){for(++x;x<N;x+=x&-x)s[x]=(s[x]+val)%p;}
int main(){
	ios::sync_with_stdio(false);cin>>n;
	for(int i=1;i<=n;++i)cin>>o[i].b>>o[i].k;
	sort(o+1,o+1+n);for(int i=1;i<=n;++i)o[i].id=i;
	sort(o+1,o+1+n,cmp);
	int tmp=n+1;
	for(int i=1;i<=n;++i){
		tmp=min(tmp,o[i].id);
		w[i].a=tmp;
	}tmp=0;
	for(int i=n;i;--i){
		tmp=max(tmp,o[i].id);
		w[i].b=tmp;
	}
	sort(w+1,w+1+n);modify(0,1);
	for(int i=1;i<=n;++i){
		tmp=query(w[i].b);
		if(w[i].a!=1)tmp=(tmp+p-query(w[i].a-2))%p;
		modify(w[i].b,tmp);
	}cout<<(query(n)-query(n-1)+p)%p<<endl;return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int N;
    cin >> N;
    lint i = 1;
    while (i * i <= N)
        i++;
    i--;
    cout << i * i << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

int main () {
  string S;
  cin >> S;
  int N = S.size();
  long long sum = 0;
  long long count = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'W'){
      sum += i;
      count++;
    }
  }
  for (int i = 0; i < count; i++) {
    sum -= i;
  }
  cout << sum << endl;
}
   

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(c>=a&&c<=b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> L(n);
    for(int i = 0; i < n; i++){
        std::cin >> L[i];
    }

    if(n < 3){
        std::cout << 0 << std::endl;
        return 0;
    }

    int cnt = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                if(L[i] == L[j] || L[i] == L[k] || L[j] == L[k]) continue;
                bool ok = (L[i] + L[j]) > L[k];
                ok &= (L[i] + L[k]) > L[j];
                ok &= (L[j] + L[k]) > L[i];
                if(ok) cnt++;
            }
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3628
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
	int n,k;
	cin>>n>>k;
	vi a(n);
	rep(i,n)cin>>a[i];
	sort(all(a));
	ll ans=0;
	rep(i,k)
	{
		ans+=a[i];
	}
	cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ers erase
#define ins insert
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) cout << #x << "= " << x << '\n';
#define kill(x) return cout << x, 0;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 25;

ll H, W, ans = INF;


int main(){
	cin >> H >> W;
	for (int i = 1; i < H; i++){
		ll area = W * i;
		ll max_area = (W - 1) * (H - i);
		ll min_area = H - i;
		ans = min(ans, max(max(area, max_area), min_area) - min(min(area, max_area), min_area));
		max_area = (W / 2) * (H - i);
		min_area = (W / 2 + (W % 2)) * (H - i);
		ans = min(ans, max(max(area, max_area), min_area) - min(min(area, max_area), min_area));
	}
	swap(H, W);
	for (int i = 1; i < H; i++){
		ll area = W * i;
		ll max_area = (W - 1) * (H - i);
		ll min_area = H - i;
		ans = min(ans, max(max(area, max_area), min_area) - min(min(area, max_area), min_area));
		max_area = (W / 2) * (H - i);
		min_area = (W / 2 + (W % 2)) * (H - i);
		ans = min(ans, max(max(area, max_area), min_area) - min(min(area, max_area), min_area));
	}
	ll sagh = H / 3 + (H % 3 != 0);
	ans = min(ans, W * sagh - W * (H / 3));
	swap(H, W);
	sagh = H / 3 + (H % 3 != 0);
	ans = min(ans, W * sagh - W * (H / 3));
	cout << ans;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n, k;
int d[10];
 
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= k; i++) {
		int in;
		cin >> in;
		d[in] = 1;
	}	
 	for(int i = n; 1; i++) {
 		int tmp = i;
 		bool flag = 1;
 		while(tmp) {
 			if (d[tmp % 10]) {
				flag = 0;
				break;
			}	
			tmp /= 10;
		}
		if (flag) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

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

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

//はじめが１のを探索する２のを探索する3のを探索する４のを探索する・・・
//後ろが１のを探索する2のをたんさく３のを４のを
 
int main() {
 int N;
 cin >> N;

 int cnt;

 int he[10][10];
 int chouhuku = 0;
 //初期化
 REP(i,10){
   REP(j,10){
     he[i][j] = 0;
   }
 }

 int h;
 int e;

 FOR(i,1,N + 1){
   if(i < 10){
     h = i;
     e = i;
   }else if(i < 100){
     h = i / 10;
     e = i % 10;
   }else if(i < 1000){
     h = i / 100;
     e = (i % 100) % 10;
   }else if(i < 10000){
     h = i / 1000;
     e = ((i % 1000) % 100) % 10;
   }else if(i < 100000){
     h = i / 10000;
     e = (((i % 10000) % 1000) % 100) % 10;
   }else{
     h = i / 100000;
     e = ((((i % 100000) % 10000) % 1000) % 100) % 10;
   }
   he[h][e]++;
   if(h == e){
    chouhuku++;
   }
 }


 int result = 0;

 int x = 1;

 FOR(i,1,10){
   FOR(j,x,10){
     result += he[i][j] * he[j][i];
   }
 }
 if(N < 10){
   cout << N << endl;
 }else{
   cout << result << endl;
 }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define W while
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffor(i,a,b) for(ll i=a;i<=b;i++)
#define rfor(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"
#define go_t ll testcases; cin>>testcases; while(testcases--)
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';
using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 2005;
const ll maxN = 1e5 + 5;
const ll MAX_SIZE = 1e8 + 8;

ll power(ll x, ll y, ll M = MOD) // default argument
{ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;}

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	// WHILE(!(SUCCEED == TRY()));
	// BEFORE WRITING MAKE SURE YOU HAVE ANALYSED THE CONSTRAINTS
	// AND THINK THROUGH THE LOGIC ONCE MORE
	FIO
	char ch; cin >> ch;
	if (ch <= 'Z' && ch >= 'A') cout << 'A' << endl;
	else cout << 'a' << endl;
	return 0;
}

Measured memory_bytes: 3608
n = int(input())
s = [input() for _ in range(n)]

s_unique = list(set(s))

dic = {}
for u in s_unique:
    dic[u] = 0

for word in s:
    dic[word] += 1

max = max(dic.values())

l = []
for u in s_unique:
    l.append([dic[u], u])

l.sort(reverse=True)

l_ans = []
for a in l:
    if a[0] != max:
        continue
    l_ans.append(a[1])

l_ans.sort()

for ans in l_ans:
    print(ans)

Measured memory_bytes: 57228
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let s = next()
    let t = next()
    let ans = t.length
    for(let i = 0; i<s.length - t.length + 1; i++){
        let tmp = t.length 
        for(let j = 0; j<t.length; j++){
            if(s[i+j] == t[j]){
                tmp--
            }
        }
        ans = Math.min(ans, tmp)
    }
    console.log(ans)
    return
}
Main()


Measured memory_bytes: 32640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int mod=1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string yesno(bool ans){
  return (ans?"Yes":"No");
}

int main() {
  int n;cin>>n;
  vector<int> a(n+2,0);
  rep(i,n){
    cin>>a[i+1];
  }
  int sum=0;
  fori(i,1,n+2){
    sum+=abs(a[i]-a[i-1]);
  }
  int ans=INT_MAX;
  fori(i,1,n+1){
    ans=sum+abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i]);
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<math.h>

using namespace std;
typedef unsigned long long ll;
int main()
{
    int n;
    cin >> n;
    ll sum = 1;
    vector<ll> v(n, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        if(v[i]==0)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i = 0; i < n; i++)
    {

        if (sum > 1000000000000000000/v[i])
        {
            cout << -1 << endl;
            return 0;
        }
        sum *= v[i];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4024
#include <iostream>
#include <string>

using namespace std;

int bubbleSort(int A[], int N);

int main() {
	int N;
	int count = 0;
	cin >> N;

	int A[N];

	for (int i = 0; i < N; i++) {
		cin >> A[i];	
	}

	count = bubbleSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i < N - 1)
			cout << A[i] << " ";
		else
			cout << A[i] << endl;
	}
	cout << count << endl;
}

int bubbleSort(int A[], int N) {
	int flag = 1;
	int count = 0;

	while (flag) {
		flag = 0;
		for (int j = N - 1; j > 0; j--) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = 1;
				count++;
			}
		}
	}
	return count;
}


Measured memory_bytes: 3124
eval"N,*T,Z=#{`tr -! ,`}1"
T<<0
N.times{|i|a,b=T[N+i,2]
Z=Z*[[[a,t=T[i]].min,0,-1[a-t]][s=T[i-1]<=>t],0,(s%3-1)[t-a]][b<=>a]%(10**9+7)}
p Z

Measured memory_bytes: 41792
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int,int> pii;

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

  vector<pii> a(m);
  rep(i,m){
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end());

  vector<int> l(n,0), r(n,0);
  rep(i,m){
    int y = a[i].second - 1;
    l[y+1] = l[y] + 1;
    r[y] = r[y+1] + 1;
  }

  rep(i,n){
    cout << r[i] + l[i] + 1 << " \n"[i==n-1];
  }
}
  

Measured memory_bytes: 5176
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

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

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


//改造
typedef long long int ll;
using namespace std;


//ここから編集する
ll mod = 1000000007;


int main() {
    int W, H;
    cin >> W >> H;
    vector<vector<bool> > v(W, vector<bool>(H, false));//v[i][j]は左下の座標が(i,j)になってるところの色を表す。

    int N;
    cin >> N;
    REP(i, 0, N) {
        int x, y, a;
        cin >> x >> y >> a;
        REP(j, 0, W) {
            REP(k, 0, H) {
                if (a == 1) {
                    if (j < x) {
                        v[j][k] = true;
                    }
                }
                if (a == 2) {
                    if (j >= x) {
                        v[j][k] = true;
                    }
                }
                if (a == 3) {
                    if (k < y) {
                        v[j][k] = true;
                    }
                }
                if (a == 4) {
                    if (k >= y) {
                        v[j][k] = true;
                    }
                }

            }
        }
    }
    int ans = 0;
    REP(i,0,W){
        REP(j,0,H){
            if(!v[i][j]){
                ans++;
//                cout << 1;
            }else{
//                cout << 0;
            }

        }
//        cout << endl;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
W,H,N = map(int,input().split())
xya = []
for i in range(N):
  x,y,a = map(int,input().split())
  xya.append([x,y,a])

right = W
left = 0
top = H
bottom = 0

for i in range(N):
  if xya[i][2] == 1 and  xya[i][0] > left:
    left = xya[i][0]
  elif xya[i][2] == 2 and xya[i][0] < right:
    right = xya[i][0]
  elif xya[i][2] == 3 and xya[i][1] > bottom:
    bottom = xya[i][1]
  elif xya[i][2] == 4 and xya[i][1] < top:
    top = xya[i][1]

if top <= bottom or right <= left:
  print(0)
else:
  print((top - bottom ) * (right - left))

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

int main () {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a *= a;
		b *= b;
		c *= c;
		if (a + b == c || b + c == a || c + a == b) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
string s;
int a[30],ans;
int main()
{
	int book=0;
	cin>>s;
	int l=0;
	int r=s.size()-1;
	while(l<r)
	{
		if(s[l]==s[r]){
			l++;
			r--;
		}
		else if(s[l]=='x'&&s[r]!='x'){
			ans++;
			l++;
		}
		else if(s[l]!='x'&&s[r]=='x'){
			ans++;
			r--;
		}
		else if(s[l]!='x'&&s[r]!='x')
		{
			cout<<"-1";
			return 0;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int n;
  string s;
  cin >> n >> s;
  int left = 0, right = 0;
  rep(i, n){
    if(s[i] == '('){
      left ++;
    } else {
      if(left > 0){
	left --;
      } else {
	right ++;
      }
    }
  }
  rep(i, right){
    cout << '(';
  }
  cout << s;
  rep(i, left){
    cout << ')';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())
li = list(map(int,input().split()))


c = collections.Counter(li)
#print(c.items())
# dict_items([('a', 4), ('b', 1), ('c', 2)])

kakutei = 0
count = 0
for dd in c.items():
    kazu = dd[1]
    if kazu % 2 == 0:
        count += 1
    kakutei += 1
print(kakutei - count%2)

Measured memory_bytes: 62124
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(),s.end()), s.end());
  cout << (n==s.size()? "yes" : "no") << endl;
}

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

int main() {
 int n;
 cin >> n;
 vector<int64_t> v(n+1);
 v.at(0)=2;
 v.at(1)=1;
 for(int i=2;i<n+1;i++){
   v.at(i) = v.at(i-1)+v.at(i-2);
  // cout << v.at(i)<<endl;
 }
  cout << v.at(n);
}
  
  

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

//最大公約数を求める//
int gcd(int a,int b){
	int z;
	if(a!=b){
		if(a>b){
			z = gcd(a-b,b);
		}else{
			z = gcd(a,b-a);
		}
	}else{
		z = a;
	}
	return z;
}

int main(void){
	long long int a, b, c, d;
	cin >> a >> b >> c >> d;
	long long int Nac, Nad, Nbc, Nbd, Nae, Nbe;
	long long int Na, Nb;
	long long int numa, numb;
	long long int e;
	long long int ans;
	e = (c*d)/gcd(c,d);
	
	Nac = (a-1)/c;
	
	Nad = (a-1)/d;
	
	Nae = (a-1)/e;
		
	numa = Nac+Nad-Nae;
	
	
	Nbc = b/c;
	
	Nbd = b/d;
	
	Nbe = b/e;

	numb = Nbc+Nbd-Nbe;
	
	ans = (b-a+1)-(numb-numa);
	cout << ans << endl;
	return 0;
}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){

	int n; cin >> n;
	int ans = 0;
	FOR(i, 1, n+1){
		if(i%2==0)continue;
		int n = 0;
		FOR(j, 1, i+1){
			if(i%j==0)n++;
		}
		if(n==8)ans++;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split())) 

count = 1
i = 0

tmp = 0
while i < N:
  if count == A[i]:
    tmp += 1
    count += 1
  i += 1

if tmp == 0:
	print(-1)
else:
	print(N - tmp)

Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s; i < n; i++)
const int maxn = 100005;
int N;
int h[maxn][3];
int d[maxn][3];

int dp(int a, int b){
	if(d[a][b]) return d[a][b];
	int ans = 0;
	rep(i,0,3){
		if(i==b)continue;
		ans = max(ans, dp(a-1, i)+h[a][b]);
	}
	return d[a][b] = ans;
}

int main(){
	cin>>N;
	rep(i,0,N){
		scanf("%d%d%d", &h[i+1][0], &h[i+1][1], &h[i+1][2]);
	}
	d[1][0] = h[1][0];
	d[1][1] = h[1][1];
	d[1][2] = h[1][2];
	int ans = max(dp(N,0), dp(N,1));
	ans = max(ans, dp(N,2));
	cout<<ans<<endl;
}

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

int compare(const void *a, const void *b){
	int *A = (int *)a;
	int *B = (int *)b;
	if (*A > *B) return 1;
	if (*A < *B) return -1;
	return 0;
}
int main(){
	int N;
	scanf("%d",&N);
	int A[N];
	for(int i=0;i<N;i++)scanf("%d",&A[i]);
	qsort(A,N,sizeof(int),compare);
	int ans=0;
	int c=1;
	for(int i=0;i<N-1;i++){
		if(A[i]==A[i+1])c++;
		else{
			if(c%2==1)ans++;
			c=1;
		}
	}
	if(c%2==1)ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>

using namespace std;

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

	string t[] = { "KIHBR",
				   "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA",
				   "AKIHABR", "AKIHBAR", "AKIHBRA", "KIHABAR", "KIHABRA", "KIHBARA",
				   "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR",
				   "AKIHABARA" };
	for (int i = 0; i < 16; i++) {
		if (s == t[i]) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;

	return 0;
}

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

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; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
using mint = modint998244353;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 998244353LL;

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

mint ten[200005],one[200005];

struct S{
    mint a;
    int len;
};

S op(S x,S y){
    return S{x.a*ten[y.len]+y.a,x.len+y.len};
}

S e(){
    return S{0,0};
}

S mapping(mint f,S x){
    if(f==0) return x;
    return S{one[x.len]*f,x.len};
}

mint composition(mint a,mint b){
    if(a==0) return b;
    return a;
}

mint id(){
    return 0;
}


int main(){
    ll N,Q;
    cin>>N>>Q;
    ten[0] = (mint)1;
    rep(i,200004) {
        ten[i+1] = ten[i] * 10;
    }
    one[0] = 0;
    rep(i,200004){
        one[i+1] += ten[i]+one[i];
    }
    lazy_segtree<S,op,e,mint,mapping,composition,id> seg(N);
    rep(i,N) {
        seg.set(i,S{1,1});
    }
    rep(i,Q){
        int l,r,d;
        cin>>l>>r>>d;
        l--;
        seg.apply(l,r,d);
        cout<<seg.all_prod().a.val()<<endl;
    }
}

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

using namespace std;

struct edge{
  int to,cap,rev;
};

vector<edge> G[307];
bool used[307];

void add_edge(int from,int to,int cap){
  G[from].push_back({to,cap,(int)G[to].size()});
  G[to].push_back({from,0,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	//	cout<<v<<' '<<e.to<<endl;
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(begin(used),end(used),false);
    int f=dfs(s,t,1<<29);
    if(f==0)return flow;
    flow+=f;
  }
}
      
int main(){
  for(int H,W,C,M,NW,NC,NM;cin>>H>>W>>C>>M>>NW>>NC>>NM,H>=0;){
    for(auto &e:G){
      e.clear();
    }
    int s=H+2*W+2*C+M;
    for(int i=0;i<H;i++){
      add_edge(s,i,1);
      add_edge(i,s+1,1);
    }
    for(int i=0;i<W;i++){
      add_edge(H+i,H+W+i,1);
      add_edge(H+W+i,s+3,1);
      int n;
      cin>>n;
      while(n--){
	int id;
	cin>>id;
	add_edge(id-1,H+i,1);
      }
    }
    add_edge(s+1,s+2,NW);
    for(int i=0;i<C;i++){
      int o=H+2*W;
      add_edge(o+i,o+C+i,1);
      add_edge(s+2,o+i,1);
      add_edge(o+C+i,s+5,1);
      int n;
      cin>>n;
      while(n--){
	int id;
	cin>>id;
	add_edge(H+W+id-1,o+i,1);
      }
    }
    add_edge(s+3,s+4,NC);
    for(int i=0;i<M;i++){
      add_edge(s+4,H+2*W+2*C+i,1);
      add_edge(H+2*W+2*C+i,s+6,1);
      int n;
      cin>>n;
      while(n--){
	int id;
	cin>>id;
	add_edge(H+2*W+C+id-1,H+2*W+2*C+i,1);
      }
    }
    add_edge(s+5,s+6,NM);
    cout<<max_flow(s,s+6)<<endl;
  }
}

Measured memory_bytes: 1452
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
template< typename T >
size_t longest_increasing_subsequence(const vector< T > &a, bool strict) {
  vector< T > lis;
  for(auto &p : a) {
    typename vector< T >::iterator it;
    if(strict) it = lower_bound(begin(lis), end(lis), p);
    else it = upper_bound(begin(lis), end(lis), p);
    if(end(lis) == it) lis.emplace_back(p);
    else *it = p;
  }
  return lis.size();
}

void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);


  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
    sort(ALL(vec));
  cout<<longest_increasing_subsequence(vec,1)<<endl;
  

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

template <class T> T bit_to_int(string s) {
    T ans  = s[s.size() - 1] - '0';
    T time = 2;
    for (T i = s.size() - 2; i >= 0; i--) {
        ans += time * (s[i] - '0');
        time *= 2;
    }
    return ans;
}
template <class T> string int_to_bit(T x) {
    string ans = "";
    while (x != 0) {
        ans = to_string(x % 2) + ans;
        x /= 2;
    }
    return ans;
}

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

    ll N;
    cin >> N;
    string ans = "";
    ll time   = 1;
    while (N != 0) {
        if (N % (time * 2) == 0) {
            ans = "0" + ans;
        } else {
            ans = "1" + ans;
            N -= time;
        }
        time *= -2;
    }
    if (ans.empty())
        ans = "0";
    print(ans);

    return 0;
}

Measured memory_bytes: 256