akhauriyash/Code-Regression huggingface dataset:
/*やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん

（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。

今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、

そこでしこたま酒を飲んでからやりはじめたんや。

3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。

しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。

浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、

先に兄ちゃんがわしの口に糞をドバーっと出して来た。

それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、

3人で出した糞を手で掬いながらお互いの体にぬりあったり、

糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。

しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。

浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると

けつの穴が糞と小便でずるずるして気持ちが良い。

にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。

糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。

それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、

糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。

やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。

ああ～～早く糞まみれになろうぜ。

岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や

糞まみれでやりたいやつ、至急、メールくれや。

土方姿のまま浣腸して、糞だらけでやろうや。*/
#include "bits/stdc++.h"
#include <unordered_set>
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define Sort(a) sort(a.begin(),a.end())
#define cSort(a,cmp) sort(a.begin(),a.end(),cmp)
#define reSort(a) sort(a.rbegin(), a.rend())
static const ll llMAX = numeric_limits<long long>::max();
static const int intMAX = numeric_limits<int>::max();
static const ll  llMIN = numeric_limits<long long>::min();
static const int intMIN = numeric_limits<int>::min();
static const ll d_5 = 100000;
static const ll d9_7 = 1000000007;
static const ll d_9 = 1000000000;
static const double PI=3.14159265358979323846;
//<<std::setprecision(30)
template<class T>
void Printvector(std::vector<T> a){
  int size = a.size();
  rep(i,size){
    cout<<a[i]<<" ";
  }
  cout<<endl;
}
template<class T>
void Printvector(std::vector<std::vector<T>> a){
  int size = a.size();
  rep(i,size){
    int size2=a[i].size();
    rep(j,size2){
      cout<<a[i][j]<<" ";
    }
    cout<<endl;
  }
  cout<<endl;
}
ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  if(b%2==1){
    ll tmp = digitpower(a,(b-1)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    tmp*=a;
    return (tmp)%d9_7;
  }else{
    ll tmp = digitpower(a,(b)/2);
    tmp%=d9_7;
    tmp*=tmp;
    tmp%=d9_7;
    return (tmp)%d9_7;
  }
}

unordered_map<ll,ll> prime_factor(int64_t n) {
  unordered_map<ll,ll> ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
/*struct datas{
  int num;
  int index;
};
bool cmp(const datas &a, const datas &b)
{
    return a.num < b.num;
}*/
template<class T>
vector<T> getaccum(vector<T> a){
  int size=a.size();
  vector<T> ans(size);
  ans[0]=a[0];
  for(int i=0;i<size-1;i++){
    ans[i+1]=ans[i]+a[i+1];
    ans[i+1]%=d9_7;
  }
  return ans;
}


int main(void){
  int a,b;
  string s,t,u;
  cin>>s>>t>>a>>b>>u;
  if(s==u){
    cout<<a-1<<" "<<b<<endl;
  }else{
    cout<<a<<" "<<b-1<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#!python3.8
# -*- coding: utf-8 -*-
# abc170/abc170_d
from collections import Counter

def main():
    N = input()
    A = sorted(map(int, input().split(' ')))
    B = Counter(A)
    for a in A:
        if B[a] == 0:
            continue
        if B[a] > 1:
            B[a] = 0
        for i in range(2, A[-1] // a + 1):
            B[a * i] = 0
    print(sum(B.values()))
    return

main()


Measured memory_bytes: 96584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

signed main() {
  int N, M; cin >> N >> M;
  priority_queue<int> A;
  int a = 0;
  rep(i, N) {
    cin >> a;
    A.push(a);
  }
  int b = 0, c = 0;
  map<int,int> C;
  rep(i, M) {
    cin >> b >> c;
    C[-c] += b;
  }

  int ans = 0;
  int n = 0;
  
  for(pair<int,int> p : C) {
    p.first *= -1;
    while(p.second > 0) {
      n++;
      if(p.first > A.top()) {
        ans += p.first;
        p.second--;
      } else {
        ans += A.top();
        A.pop();
      }
      if(n == N) {
        cout << ans << endl;
        return 0;
      }
    }
  }
  
  while(n < N) {
    n++;
    ans += A.top();
    A.pop();
  }

  
  cout << ans << endl;

}

Measured memory_bytes: 7284
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int k,n;
    cin>>k>>n;int min1=0;VI ar(n);
    for(int i=0;i<n;i++)
    cin>>ar[i];
    sort(all(ar));
    for(int i=1;i<n;i++)min1=max(min1,ar[i]-ar[i-1]);
    min1=max(min1,ar[0]+k-ar[n-1]);
    cout<<k-min1<<endl;
}


return 0;
}





Measured memory_bytes: 1792
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ll mas = -1, cuk = -1, wod = -1;
    for (ll i = 0; 100 * a * i <= f; ++i)
    {
        ll s1 = 100 * a * i;
        for (ll j = 0; s1 + 100 * b * j <= f; ++j)
        {
            ll s2 = s1 + 100 * b * j;
            for (ll k = 0; s2 + k * c <= f; ++k)
            {
                ll s3 = s2 + k * c;
                for (ll o = 0; s3 + o * d <= f; ++o)
                {
                    ll s4 = s3 + o * d;
                    ll W = 100 * a * i + 100 * b * j;
                    ll C = k * c + o * d;
                    if (s4 == 0)
                        continue;
                    if (100 * C * (e + 100) <= (C + W) * 100 * e)
                    {
                        if (mas == -1 || (100 * cuk * (C + W) < 100 * C * (cuk + wod)))
                        {
                            mas = s4;
                            cuk = C;
                            wod = W;
                        }
                    }
                }
            }
        }
    }
    cout << mas << " " << cuk;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s;
    cin >> s;
    rep(i,s.size()-1){
        if(s[i]=='A'&&s[i+1]=='C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string w;
	cin >> w;
	map<char, int> m;

	for (int i = 0; i < w.length(); i++) {
		if (m.count(w[i]) == 0) {
			m[w[i]] = 1;
		}
		else {
			m[w[i]]++;
		}
	}
	
	for (std::map<char, int>::iterator itr = m.begin(), itr_end = m.end(); itr != itr_end; ++itr) {
		if (itr->second % 2 != 0) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

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

using namespace std;
struct Edge {
    int u,v,d;
    Edge() {}
    Edge(int _u,int _v,int _d): u(_u),v(_v),d(_d){}
};

void solve() {
    int L; cin >> L;
    int n = 32-__builtin_clz(L);
    vector<Edge> e;
    for (int i = 1; i < n; i++) {
        e.emplace_back(i-1,i, 0);
        e.emplace_back(i-1,i,1<<(i-1));
    }
    int crt = 1 << (n-1);
    L -= crt;
    while (L) {
        int h = 31-__builtin_clz(L);
        e.emplace_back(h, n-1, crt);
        L -= 1<<h;
        crt+= 1<<h;
    }
    int m = e.size();
    cout << n << ' ' << m <<"\n";
    for (auto& x: e) {
        cout << x.u+1 << ' '<<x.v+1<<' '<<x.d<<"\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		//sc??¨dice??????????????????????????????
		Scanner sc = new Scanner(System.in);
		String strDice = sc.nextLine();
		Dice5 dice = new Dice5(strDice);

		//????????°????????????????????°?????????
		int q = sc.nextInt();
		for(int i = 0; i < q; i++){

			//?????¢??¨?????¢???????????????
			int topNum = sc.nextInt();
			int frontNum = sc.nextInt();

			//Dice5?????????????????????searchRight???????????????????????????
			dice.search(topNum, frontNum);
			System.out.println(dice.getAns());
		}
		sc.close();
	}
}
class Dice5{
	//?????£?????????
	private int[] dice = new int[6];

	//?????????????????????(???????????§?????????????????´???)
	Dice5(String strDice){
		String[] sdice = strDice.split(" ");
		for (int i = 0; i < 6; i++) {
			dice[i] = Integer.parseInt(sdice[i]);
		}
	}

	//???????????????????????\????????????(????????§??????????????????)
	void rollN(char N){
		int temp = dice[0];
		dice[0] = dice[1];
		dice[1] = dice[5];
		dice[5] = dice[4];
		dice[4] = temp;
	}

	void rollS(char S){
		int temp = dice[0];
		dice[0] = dice[4];
		dice[4] = dice[5];
		dice[5] = dice[1];
		dice[1] = temp;
	}

	void rollE(char E){
		int temp = dice[0];
		dice[0] = dice[3];
		dice[3] = dice[5];
		dice[5] = dice[2];
		dice[2] = temp;
	}

	void rollW(char W){
		int temp = dice[0];
		dice[0] = dice[2];
		dice[2] = dice[5];
		dice[5] = dice[3];
		dice[3] = temp;
	}
	void rollL(char L){
		int temp = dice[3];
		dice[3] = dice[2];
		dice[2] = dice[4];
		dice[4] = dice[5];
		dice[5] = temp;

	}

	void rollR(char R){
		int temp = dice[2];
		dice[2] = dice[3];
		dice[3] = dice[5];
		dice[5] = dice[4];
		dice[4] = temp;
	}

	//?????¢??¨?????¢?????°???????????????
	void search(int topNum , int frontNum){
		//????????????????????????????????°
		char action = 'a';
		//?????¢?????°????????????????????????
		for(int i = 0; i < 8; i++){

			//??\?????????????????¢?????°??¨?????¨???????????????????????¢??????????????????????????????????????????
			if(frontNum == dice[1]){
				break;
				//????????\?????????????????¬'N'????????????
				//????????????3?????¢?????????????????´???????????¨???????¨???????????????¢?????????
			} else {
				if(i == 3){
					rollE('E');
				} else {
					rollN('N');
				}
			}
		}
		//?????¢????????????????????????
		for(int i = 0; i < 3; i++){
			//????????????
			//System.out.println("?????????????????¢this.dice[1]???= " + this.dice[0]);

			//??\?????????????????¢?????°??¨?????¨???????????????????????¢??????????????????????????????????????????
			if(topNum == dice[0]){
				break;
				//????????§?????????????¨?????????¢?????????
			} else {
				rollW('W');
			}
		}
	}


	int getAns(){
		return dice[2];
	}
}

Measured memory_bytes: 26212
import java.util.Scanner;


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

        int N = input.nextInt();

        String S = input.next();

        int count = 1;
        for(int i = 0; i < N - 1; i++){
            if (!S.substring(i,i+1).equals(S.substring(i+1,i+2))){
                count++;
            }
        }

        System.out.println(count);

    }
}

Measured memory_bytes: 33944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll n;
    cin >> n;
    ll h = (n / 500) * 1000;
    h += (n % 500) - ((n % 500) % 5);

    cout << h << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

//设F[i]表示长度为i的序列的答案 
//如果A[1] = 1，那么它对于后面的元素没有影响，这一部分数量就是F[i - 1]
//如果A[1] > 1且A[2] > 1，那么由于A[1] > 1，所以A[3] = A[2] > 1，以此类推可以得到A[2] = A[3] = ...，这一部分答案为(N - 1)^2
//如果A[1] > 1且A[2] = 1，那么A[2] = A[3] = ... = A[1 + A[1]] = 1。如果1 + A[1] >= i，那么后面就全部是1。否则答案为F[i - 1 - A[1]] 

const int Max_N(1000050);
const int MOD(1000000000 + 7);
typedef long long int LL;

inline void update(int &a, const int &b)
{
	((a += b) >= MOD) ? (a -= MOD) : 0;
}

inline int Mult(const int &a, const int &b)
{
	return (a * 1LL) * b % MOD;
}

int N, F[Max_N], S[Max_N];

int main()
{
	scanf("%d", &N);
	S[1] = F[1] = N;
	for (int i = 2;i <= N;++i)
	{
		update(F[i], F[i - 1]);
		update(F[i], Mult(N - 1, N - 1));
		update(F[i], N - i + 2 - (i - 1 == 1));
		if (i >= 3)
			update(F[i], S[i - 3]);
		S[i] = (S[i - 1] + F[i]) % MOD;
	}
	printf("%d", F[N]);
	return 0;
}

Measured memory_bytes: 7936
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

string s; 
int f1[1000005],f2[1000005];

int main(void){
	cin>>s;
	int n=s.size();
	memset(f1,0x3f,sizeof(f1));
	memset(f2,0x3f,sizeof(f2));
	f1[0]=min(s[0]-'0',11-(s[0]-'0'));
	f2[0]=min(s[0]-'0'+1,10-(s[0]-'0'));
	for(int i=1;i<=n-1;i++){
		int num=s[i]-'0';
		f1[i]=min(f1[i-1]+num,f2[i-1]+10-num);
		f2[i]=min(f1[i-1]+num+1,f2[i-1]+9-num);
	}
	printf("%d\n",f1[n-1]);
}

Measured memory_bytes: 9220
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <vector>
#include <stdio.h>
#include <iostream>
#include <unordered_set>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <random>
#include <time.h>
#include <cassert>


#define prev askdnsajd
#define rank asasdmdnasd
#define next lsjndajbs
#define hash asmdklansd
#define index asdklnas
#define right sld
#define left sldl

using namespace std;

typedef long long ll;
typedef long double dbl;

template<class T>
void print(vector<T> s){
    for (T x : s)
        cout << x << " ";
    cout << endl;
}

mt19937 mrand(random_device{} ());
int rnd() {
    return mrand();
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(){
    ll n,y; cin >> n >> y;
    y /= 1000;
    for(int i=y/10;i>=0;i--){
        for(int j=(y-i*10)/5;j>=0;j--){
            int k = y - 10 * i - 5 * j; 
            if(i+j+k == n && 10*i+5*j+k==y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
def div_by_two(x, div_times):
	x = x / 2
	if x == int(x):
		div_times += 1
		div_times = div_by_two(x, div_times)
		
	return div_times
		

N = int(input())

ans = 1
max_div_times = 0
for i in range(1, N+1):
	div_times = div_by_two(i, 0)
	if div_times > max_div_times:
		max_div_times = div_times
		ans = i
		
print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N;
    cin>>N;
    
    vector<ll> A(N+1);
    rep(i,N+1){
        cin>>A.at(i);
    }
    if(A.at(N)==0){cout<<-1<<endl;return 0;}
    if(A.at(0)==1 && N==0){cout<<1<<endl;return 0;}
    if(A.at(0)!=0){cout<<-1<<endl;return 0;}
    vector<ll> S(N+1);
    S.at(N)=A.at(N);
    for(int i=N;i>=1;i--){
        S.at(i-1)=S.at(i)+A.at(i-1);
    }
    vector<ll> T(N+1);
    T.at(0)=1;
    for(int i=1;i<=N;i++){
        ll nex=T.at(i-1);
        nex-=A.at(i-1);
        nex*=2;
        if(nex==0 && S.at(i)>0){cout<<-1<<endl;return 0;}
        if(nex<0){cout<<-1<<endl;return 0;}
        T.at(i)=min(nex,S.at(i));
    }
    if(T.at(N)!=A.at(N)){cout<<-1<<endl;return 0;}
    ll ans=0;
    rep(i,N+1){
        ans+=T.at(i);
    }
    cout<<ans<<endl;

    /*rep(i,N+1){
        cout<<A.at(i)<<" ";
    }
    cout<<endl;
    rep(i,N+1){
        cout<<S.at(i)<<" ";
    }
    cout<<endl;
    rep(i,N+1){
        cout<<T.at(i)<<" ";
    }*/
}

Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
#define FRO freopen("in.txt","r",stdin);


int main()
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        int n,i,j,t,tcs=1e8,k,m,u,v;
        string str;
        cin>>n>>str;
        vector<int>carr(n+1,0);
        vector<int>rcarr(n+1,0);
        for(i=0;i<n;i++)
        {
                if(str[i]=='#')
                {
                        carr[i]=1;
                        rcarr[i]=1;
                }
                else
                {
                        carr[i]=0;
                        rcarr[i]=0;
                }
        }
        for(i=1;i<n;i++)
        {
                rcarr[i]+=rcarr[i-1];
        }
        for(i=n-2;i>=0;i--)
        {
                carr[i]+=carr[i+1];
        }

        carr[n]=0;
        for(i=0;i<n;i++)
        {
                k=rcarr[i]+(n-i-1)-carr[i];
                tcs=min(tcs,k);
        }
        cout<<tcs;
	return 0;
}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n;
string s;
int ab, a, b;
signed main() {
	cin >> n;
	int ans = 0;
	rep(i, n) {
		cin >> s;
		rep(j, s.size() - 1) {
			if (s[j] == 'A' && s[j + 1] == 'B')ans++;
		}
		if (s[0] == 'B' && s.back() == 'A')ab++;
		else if (s[0] == 'B')b++;
		else if (s.back() == 'A')a++;
	}
	if (ab) {
		if (a || b) {
			ans += ab + min(a, b);
		}
		else ans += ab - 1;
	}
	else {
		ans += min(a, b);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, m;
  cin >> n >> m;

  int card[100100] = {};

  REP(i,m){
    int l, r;
    cin >> l >> r;
    l--; r--;
    card[l]++;
    card[r+1]--;
  }
  REP(i,n){
      card[i+1] += card[i];
  }

  int ans = 0;
  REP(i,n){
      if(card[i] == m) ans++;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if(s[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	int f = 0;
	unsigned int k;
	for(unsigned int i = 2; i < s.size() - 1; i++){
		if(s[i] == 'C'){
			f += 1;
			if(f == 2){
				cout << "WA" << endl;
				return 0;
			}
			k = i;
		}
	}
	if(f == 0){
		cout << "WA" << endl;
		return 0;
	}
	for(unsigned int i = 1; i < s.size(); i++){
		if(i == k) continue;
		if(s[i] < 97 || s[i] > 122){
			cout << "WA" << endl;
			return 0;
		}
	}
	cout << "AC" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n;
  int m;
  int c=0,w=0;
  cin >> n >> m;
  bool p[n]={};
  int wa[n]={};
  for(int j=0;j<m;j++){
    int i;
    string s;
    cin >> i >> s;
    if(p[i-1]==false && s=="AC"){
      c++;
      w+=wa[i];
      p[i-1] = true;
    }else if(p[i-1]==false && s=="WA") wa[i]++;
  }
  cout << c << " " << w <<endl;
  return 0;
}

Measured memory_bytes: 768
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>A(N);
    int ans = 0;
    rep(i, N) {
        cin >> A[i];
        ans += A[i] - 1;
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int i,n,c=0;
    cin>>n;
    int a[n],b[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b,b+n);
    for(i=0;i<n;i++)
    {
        if(a[i]!=b[i])
            c++;
    }
    if(c==2 || c==0)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void){
    char anus[114];
    scanf("%s",anus);
    int ans=100000;
  int sex = strlen( anus);
    for(int i=0;i<26;i++){
        int kari=-1;
        int karians=100000;
        for(int j=0;j<sex;j++){
            if(anus[j]==(char)'a'+i){
                if(kari==-1)karians=j;
                else if(karians<j-kari-1)karians=j-kari-1;
                kari=j;
            }
            if(j==sex-1)if(karians<(sex-1-kari))karians=sex-1-kari;
        }
        if(ans>karians){ans=karians;}
    }
    printf("%d",ans);
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  cout << (1900 * M + 100 * (N - M)) * pow(2, M) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // cout << fixed << setprecision(10);
    LL bank = 100;
    LL x;
    cin >> x;
    FOR(i, 1, 400000000)
    {
        double temp = ((double)bank * 101) / 100;
        bank = (LL)temp;
        if(x <= bank)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << "error";
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main() {
    ll x, a, b;
    cin >> x >> a >> b;
    x -= a;
    x -= (x / b) * b;
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 3632
b = []
c = []
while True:
    a = input().split()
    a[0] = int(a[0])
    a[1] = int(a[1])
    if a[0] == 0 and a[1] == 0:
        break
    else:
        b.append("#"*a[1])
        c.append(a[0])
for i in range(len(c)):
    for j in range(c[i]):
        print(b[i])
    print("\n",end="")


Measured memory_bytes: 5628
#include<bits/stdc++.h>
#define st first
#define nd second


using ll = long long;
using namespace std;
using pii = pair<int, int>;

const int N = 1e5 + 10;
ll a[3][N];
int n[3];
int main(){
	int x, y;
	scanf("%d %d", &x, &y);
	for(int i = 0; i <3; i++){
		scanf("%d", &n[i]);
	}
	for(int i = 0; i < 3; i++){
		for(int j = 1; j <= n[i];j ++){
			scanf("%lld", &a[i][j]);
		}
	}
	sort(a[0] + 1, a[0] + n[0] +1);
	reverse(a[0] + 1, a[0] + n[0] + 1);
	sort(a[1] + 1, a[1] + n[1] + 1);
	reverse(a[1] +1, a[1] + n[1] + 1);
	ll ans  = 0, val = 0;
	for(int i = 1; i <= x; i++) val += a[0][i];
	for(int i = 1; i <= y; i++) val += a[1][i];
	int it[2] = {x, y};
	sort(a[2] + 1, a[2] + n[2] + 1);
	reverse(a[2] + 1, a[2] + n[2] + 1);
	for(int i = 1; i <= n[2] ;i++){
		a[2][i] += a[2][i-1];
	}
	ans = val;
	ll sum = 0;
	int pos;
	for(int i = 1; i <= min(x + y, n[2]); i++ ){
		ll mi = 1e18;
		for(int j = 0; j < 2; j++){
			if(it[j] == 0) continue;
			if(a[j][it[j]] < mi){
				mi =a[j][it[j]];
				pos = j;
			}
		}
		sum += mi;
		it[pos]--;
		ans = max(ans, val - sum + a[2][i]);
	}
	printf("%lld",ans);

}

Measured memory_bytes: 2560
# coding: utf-8
# Your code here!

while True:
   l = [0]*10
   n = int(input())
   if n == 0: break

   for i in range(n):
      c = int(input())
      l[c] += 1
   #print(l)

   for i in range(10):
      if l[i] == 0:
         print("-")
      else:
         for j in range(l[i]):
            print("*", end = "")
         print("")


Measured memory_bytes: 7592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1; i>=(a); i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl;})

int main(){
	cin.sync_with_stdio(0);

	ll n;
	ll d;

	cin >> n;
	cin >> d;
	d = d * d;
	vpll points(n);
	FOR(i, 0, n){
		cin >> points[i].xx;
		cin >> points[i].yy;
	}

	ll count = 0;

	FOR(i, 0, n){
		if(d >= ((points[i].xx * points[i].xx) + (points[i].yy * points[i].yy))){
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 6428
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let s: String = read();
    let s: Vec<u8> = s.into_bytes();
    let mut o = 0;
    for c in s {
        if c == 'g' as u8 {
            o += 1;
        } else {
            o -= 1;
        }
    }
    println!("{}", o / 2);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,d,x; cin >> n >> d >> x;
    int ans = 0;
    rep(i,n) {
        int a; cin >> a;
        int cnt = 0;
        for (int j = 1; j <= d; )
        {
            j += a;
            cnt++;
        }
        //cout << cnt << endl;
        ans += cnt;
    }
    cout << ans+x << endl;
    return 0;
}

Measured memory_bytes: 256
/*
   Push yourself, because no one else is going to do it for you.
*/
#include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define set_zero(a) memset(a,0,sizeof(a));
#define ll long long int
#define PI 2 * acos(0.0)
#define MAX 10000000000000000
#define in(a) scanf("%d",&a);
#define out(a) printf("%d",a);
#define INF 1000000 
#define M 1000000007
using namespace std;
int main(){ 
   fast_io
   ll n;
   cin>>n;
   ll a[n];
   for(ll i = 0;i<n;i++) cin>>a[i];
   ll ans = a[0];
   ll sum = 1;
   for(ll i = 1;i<n;i++){
       if(ans > a[i]){
            sum++;
       }
       ans = min(a[i],ans);
   }
   cout<<sum<<endl;
   return 0; 
}  

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

using namespace std;

struct pessoas{
	char way[112];
};


int cmp_ord(const void * a,const void * b){
	pessoas x = *((pessoas *)a);
	pessoas y = *((pessoas *)b);

	return strcmp(x.way,y.way);
}


int main() {
	int N,L;
	pessoas vet[112];
	scanf("%d%d", &N,&L);
	for (int i = 0;i < N;i++){
		scanf(" %s", vet[i].way);
		// printf("%s", vet[i].way);
	}
	qsort(vet,N,sizeof(pessoas),cmp_ord);
	// puts("oi");
	for (int i = 0;i < N;i++) {
		printf("%s",vet[i].way);
	}
	puts("");

}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

ll pow_f(ll b, ll e) {
    ll ans = 1;
    b = b % M;
    while (e) {
        if (e&1) {
            ans = (ans * b) % M;
        }
        b = (b * b) % M;
        e >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    if (r > n || n < 0 || r < 0) { return 0; }
    if (n == r || r == 0) { return 1; }
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = 1; i <= r; ++i) {
        ans = (ans * (n-i+1))/(i); 
    }
    return ans;
}

ll nCr(tuple<ll,ll> t) {
    auto n = get<0>(t);
    auto k = get<1>(t);
    return nCr(n+k-1, k);
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<bool> snuke(n, false);
    for (int i = 0; i < k; ++i) {
        int d;
        cin >> d;
        for (int j = 0; j < d; ++j) {
            int snukeid;
            cin >> snukeid;
            snuke[snukeid-1] = true;
        }
    }

    int ans = 0;
    for (auto i : snuke) {
        ans += (i) ? 0 : 1;
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    cin >> m;
    vector<int> q(m);
    rep(i,m) cin >> q[i];
    vector<int> ans(m);
    rep(bit,(1<<n)) {
        int sum=0;
        rep(i,n) {
            if (bit & (1<<i)) sum+=a[i];
        }
        rep(i,m) {
            if (q[i]==sum) ans[i]=1;
        }
    }
    rep(i,m) {
        if (ans[i]==1) cout << "yes" << endl;
        else cout << "no" << endl;
    }

    return 0;
}


Measured memory_bytes: 3164
N,D = map(int,input().split())
X = [list(map(int,input().split())) for i in range(N)]
cnt = 0
for i in range(0,N):
    for j in range(0,N):
        if i >= j:
            pass
        else:
           dif = [(y-x)**2 for (x,y) in zip(X[i],X[j])]
           J = sum(dif)**(1/2)
           if J.is_integer():
               cnt += 1
print(cnt)

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

int main() {
    int N,i,C,r=0;
    cin >> N;
    vector<int> V(N);

    for(i=0; i<N; i++)
        cin >> V.at(i);
    for(i=0; i<N; i++) {
        cin >> C;
        if(V.at(i)-C>0)
            r += V.at(i)-C;
    }

    cout << r << endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> ac(n), pena(n);
    rep(i, m) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if (ac.at(p)) continue;
        if (s == "AC") {
            ac.at(p) = 1;
        } else {
            pena.at(p)++;
        }
    }

    int AC = 0, PENA = 0;
    rep(i, n) {
        AC += ac.at(i);
        if(ac.at(i)) PENA += pena.at(i);
    }

    cout << AC << " " << PENA << endl;

    return 0;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
const int N = 8003;
string s;
int x, y;
vector <pii> a, b;
bool can[N][2 * N];
void make(string s, vector <pii> &a, vector <pii> &b) {
    try {
        a.clear(); b.clear();
        int cnt = 0, flip = 0;
        s += 'T';
        for (auto x: s) {
            if (x == 'T') {
                if (!flip) {
                    if (a.size() == 0)
                        a.push_back(make_pair(cnt, cnt));
                    else
                        a.push_back(make_pair(cnt, -cnt));
                }
                else b.push_back(make_pair(cnt, -cnt));
                cnt = 0;
                flip = 1 - flip;
            } else cnt++;
        }
    } catch (exception ex) {
        return;
    }
}
bool canReach(int des, vector <pii> c) {
    memset(can, 0, sizeof(can));
    can[0][N] = true;
    int n = c.size();
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 2 * N; j++)
            if (can[i - 1][j]) {
                can[i][j + c[i - 1].first] = can[i][j + c[i - 1].second] = true;
            }
    }
    return can[n][des + N];
}
int main() {
    try {
        cin >> s >> x >> y;
        make(s, a, b);
        if (canReach(x, a) && canReach(y, b)) {
            cout << "Yes";
        } else cout << "No";
    } catch (exception ex) {
    }
    return 0;
}


Measured memory_bytes: 125440
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		double w = sc.nextDouble();
		double h = sc.nextDouble();
		double x = sc.nextDouble();
		double y = sc.nextDouble();
		
		double a = (w * h) / 2;
		
		System.out.print(a + " ");
		
		if ((w / 2) == x && (h / 2) == y) {
			System.out.print("1");
		} else {
			System.out.print("0");
		}
	}	
}


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

int main(void){
    int N,C,K;
    cin>>N>>C>>K;
    
    vector<int> T(N);
    for(int i=0;i<N;i++) cin>>T[i];
    
    sort(T.begin(),T.end());
    int ans=0;
    
    for(int i=0;i<N;i++){
        ans++;
        int s=T[i]+K,sum=0;
        int p=i;
        while(sum<C){
            if(s<T[p]||p==N)break;
            sum++;
            p++;
        }
        i=p-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
import java.math.BigDecimal;
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		double num;
		Scanner sc = new Scanner(System.in);
		Doctor d;
		
		while(true){
			num = sc.nextDouble();
			if(num < 0){
				break;
			}
			d = new Doctor(num);
			if(d.judge()){
				System.out.println(d.getBD());
			}else{
				System.out.println("NA");
			}
		}
	}
}

class Doctor {
	double num;
	String bd;
	int integers;
	double decimals;
	
	Doctor(double num){
		this.num = num;
		bd = "";
		integers = (int)num;
		decimals = num-integers;
	}
	
	public boolean judge(){
		if(integers>255 || decimals>0.9375){
			return false;
		}
		return true;
	}
	
	private boolean toBinaryDigits(){
		String tmp = "";
		int count = 1;
		
		for(int i=integers;i>0;i/=2){
			tmp += i%2;
		}
		StringBuffer sb = new StringBuffer(tmp);
		for(int i=0;i<8-tmp.length();i++){
			bd += "0";
		}
		bd += sb.reverse().toString()+".";
		
		decimals = new BigDecimal(decimals).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
		while(true){
			if(decimals == 0){
				bd += "0000";
				break;
			}
			
			if(count > 4){
				return false;
			}
			decimals *= 2;
			if(decimals >= 1){
				decimals -=1;
				bd += "1";
				if(decimals == 0){
					for(int i=0;i<4-count;i++){
						bd += "0";
					}
					break;
				}
			}else{
				bd += "0";
			}
			count++;
		}
		
		return true;
	}
	
	public String getBD(){
		if(toBinaryDigits()){
			return bd;
		}
		return "NA";
	}
}

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

int main(){
	int n,temp;
	bool flag=true;
	int c=0;
//	vector<int> res;
	cin>>n;
	int h[n+1]={0};
	for(int i=1;i<=n;i++){
		cin>>temp;
		h[temp]=i;
	}
	for(int i=1;i<=n;i++){
		if(h[i]==i)
			continue;
		if(h[h[i]]!=i){
			flag=false;
			break;
		}
		h[h[i]]=h[i];
		c++;
		if(c>1){
			flag=false;
			break;
		}
	}
	if(flag)
		cout<<"YES"<<endl;	
	else
		cout<<"NO"<<endl;
}

Measured memory_bytes: 256
using System;

namespace Volume0_0008
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                String input = Console.ReadLine();

                if (input == null) break;

                int n = Convert.ToInt32(input);
                int cnt = 0;

                for(int a = 0; a < 10;a++)
                    for(int b = 0; b < 10;b++)
                        for(int c = 0; c < 10;c++)
                            for(int d = 0; d < 10;d++)
                                if (a + b + c + d == n) cnt++;
                Console.WriteLine(cnt);

            }
        }
    }
}

Measured memory_bytes: 5652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int h, w, k;
	cin >> h >> w >> k;

	string grid[h];
	rep(i, h) cin >> grid[i];

	int first_row = -1;
	rep(i, h) rep(j, w) if(grid[i][j] == '#' && first_row == -1) first_row = i;

	int color = 1;
	vector<int> first_row_pattern(w);
	int cnt = 0;
	rep(j, w){
		if(grid[first_row][j] == '#'){
			cnt++;
			if(cnt >= 2) color++;
		}
		first_row_pattern[j] = color;
	}

	vector<vector<int>> ans(h, vector<int>(w, 0));

	for(int i = 0; i <= first_row; i++) {
		rep(j, w) ans[i][j] = first_row_pattern[j];
	}

	for(int i = first_row + 1; i < h; i++){
		bool isstraw = false;
		rep(j, w) if(grid[i][j] == '#') isstraw = true;

		if(!isstraw){
			rep(j, w) ans[i][j] = ans[i-1][j];
		}else{
			color++;
			int ccnt = 0;

			rep(j, w){
				if(grid[i][j] == '#'){
					ccnt++;
					if(ccnt >= 2) color++;
				} 				
				ans[i][j] = color;
			}
		}
	}

	rep(i, h) rep(j, w) cout << ans[i][j] << (j == w - 1 ? "\n" : " ");
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
inline ll solve( ll x ) {
	if(x<0) return 0;
	if(x%4==1) return 1;
	if(x%4==2) return x+1;
	if(x%4==3) return 0;
	if(!(x%4)) return x;
}  
int main() {
	ll l=_,r=_;
	cout<<(solve(r)^solve(l-1));
}

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

using namespace std;

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



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

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

	int n;
	cin >> n;
	cout << (n+1)/2 << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9



int main() {
	int N, K;
	cin >> N >> K;
	if (N >= 2 * K - 1) cout << "YES" << endl;
	else cout << "NO" << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n, num[3] = {0}, i, j;
    
    scanf("%d", &n);
    scanf("%d %d", &num[0], &num[1]);
    if (n == 2) {
        for (i = 1; i < num[0] / 2 || i < num[1] / 2; i++) {
            if (num[0] % i == 0 && num[1] % i == 0) {
                printf("%d\n", i);
            }
        }
    }else{
        for (i = 1; i < num[0] /2 || i < num[1] / 2 || i < num[2]; i++) {
            if (num[0] % i == 0 && num[1] % i == 0) {
                printf("%d\n", i);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < n; i++)
#define Rep(i,n) for (int i = n; i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define P pair<int, int>
#define F first
#define S second
#define prique priority_queue<P, vector<P>, greater<P>>
using namespace std;

int n,a,x[55],y[55];
int ans=4000000000000000000;
int cnt;

signed main() {
	cin>>n>>a;
	rep(i,n)cin>>x[i]>>y[i];
	rep(i,n){
		for(int j=i+1;j<n;j++){
			rep(k,n){
				for(int l=k+1;l<n;l++){
					cnt=0;
					rep(m,n){
						if(min(x[i],x[j])<=x[m]&&x[m]<=max(x[i],x[j])&&min(y[k],y[l])<=y[m]&&y[m]<=max(y[k],y[l]))cnt++;
					}
					if(cnt>=a){
						ans=min(ans,(abs(x[i]-x[j]))*(abs(y[k]-y[l])));
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main(){
    let num: i64 = read();
    let mut ans = num;

    for cand in 1..((num as f64).sqrt() as i64) + 1 {
        if num % cand == 0 {
            let took = cand + (num / cand) - 2;
            if ans >= took {
                ans = took;
            }
        }
    }

    println!("{}", ans);
}



Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
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; }

int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int A, B; cin >> A >> B;
  if (A == B) {
    cout << 0 << endl;
  }
  else if ((A + B) % 2 == 0) {
    cout << (A + B) / 2 << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 3604