akhauriyash/Code-Regression huggingface dataset:
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1 == 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        string a, b;
        cin >> a >> b;
        a += b[b.length() - 1];
        if (a == b)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3676
dict_list = {'S': [], 'H': [], 'C': [], 'D': []}
out_list = {'S': [], 'H': [], 'C': [], 'D': []}
count = int(input())
for i in range(count):
    x, y = input().split()
    dict_list[x].append(int(y))

for key, value in dict_list.items():
    for num in range(1, 14):
        if num not in value:
            out_list[key].append(num)

for key, value in out_list.items():
    for num in value:
        print('{a} {b}'.format(a=key, b=num))



Measured memory_bytes: 5600
// #include<iostream>
// #include<vector>
// #include<algorithm>
// #include<map>
// #include<cstring>
// #include<math.h>
// #include<bitset>
// #include<queue>
// #include<set>
// #include<iomanip>
// #include<math.h>
// #include<assert.h>
// #include<string>
// #include<cstdlib>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------

vector<int> num(4);
vector<int> ans;
void dfs(int x,int n,vector<int> vec){
  if(n == 4){
    if(x == 7){
      ans = vec;
      return;
    }
  }else{
    vector<int> vec1,vec2;
    vec1 = vec;
    vec2 = vec;
    vec1.push_back(0);
    vec2.push_back(1);
    dfs(x+num[n],n+1,vec1);
    dfs(x-num[n],n+1,vec2);
  }
}

int main(){
  string S;
  cin >> S;
  for(int i=0; i<4; i++){
    num[i] = S[i] - '0';
  }
  vector<int> a;
  dfs(num[0],1,a);
  for(int i=0; i<4; i++){
    if(i == 3){
      cout << S[i] << "=7" << endl;
      return 0;
    }
    cout << S[i];
    if(ans[i] == 0){
      cout << "+";
    }else{
      cout << "-";
    }
  }
  return 0;
}


Measured memory_bytes: 256
/**
 * C - Strange Bank
 * https://atcoder.jp/contests/abc099/tasks/abc099_c
 * 
 * ポイント
 * 動的計画法(DP)
 **/
#include<iostream>
#include<cmath>

using namespace std;

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
    if(n==0) return 0;
    if(memo[n] != -1) return memo[n];

    int res = n;

    for(int pow6=1; pow6<=n; pow6*=6) res = min(res, rec(n-pow6)+1);

    for(int pow9=1; pow9<=n; pow9*=9) res = min(res, rec(n-pow9)+1);

    return memo[n] = res;
}


int main() {
    int n; cin >> n;
    
    for(int i=0; i<MAX_N; ++i) memo[i] = -1;
    cout << rec(n) << endl;

    return 0;
}

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

int main(void){
   int k;
   char s[100];
   char S[100];

   scanf("%d", &k);
   scanf("%s", s);
   int x = strlen(s);

   strncpy(S, s, k);
   S[k] = '\0';

   if(x <= k){
      printf("%s\n", s);
   }else{
      printf("%s...\n", S);
   }
   return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x, y;
  for (int i = 1; i <= n; i++) {
    int xi, yi;
    cin >> xi >> yi;
    x.push_back(xi);
    y.push_back(yi);
  }
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
    
  vector<string> vs;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      string s;
      if (x[i] > x[j])
        s = to_string(x[i]-x[j]) + "," + to_string(y[i]-y[j]);
      else if (x[i] < x[j])
        s = to_string(x[j]-x[i]) + "," + to_string(y[j]-y[i]);
      else {
        if (y[i] > y[j])
          s = to_string(x[i]-x[j]) + "," + to_string(y[i]-y[j]);
        else
          s = to_string(x[j]-x[i]) + "," + to_string(y[j]-y[i]);
      }
      vs.push_back(s);
    }
  }
  
  sort(vs.begin(), vs.end());
  
  int count = 0, max = 1;
  for (int i = 0; i < vs.size() - 1; i++) {
    count++;
    if (vs[i] != vs[i+1]) {
      if (count > max) {
        max = count;
      }
      count = 0;
    }
  }
  
  cout << (n - max) << endl;
    
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
#include <limits.h>
#include <bitset>

#include <tuple>
#include <unordered_map>

#define mp       make_pair
#define pb       push_back
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
bool prime[10000010];
int n;
void sieve(){
	for (int i = 0; i < 10000010; i++){
		prime[i] = true;
	}
	prime[0] = false;
	prime[1] = false;
	for (ll i = 2; i * i <= 10000010; i++){
		if (prime[i]){
			for (ll j = i*i; j <= 10000010; j += i){
				prime[j] = false;
			}
		}
	}
	return ;
}
int main(){
	sieve();
	while (true){
		cin >> n;
		if (n == 0)break;
		for (ll i = n; i >= 0; i--){
			if (prime[i] && prime[i - 2] && prime[i - 6] && prime[i - 8]){
				cout << i << endl;
				break;
			}
		}

	}

	return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);

    cout<<a<<' '<<b<<' '<<c<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
     string x,y;cin>>x>>y;
     int a;
     double b;
     x+=y;
     a=stoi(x);
     b=sqrt(a);
     a=sqrt(a);
     if((b-a)==0)
     cout<<"Yes";
     else cout<<"No";
    
    return 0;
   }

Measured memory_bytes: 3580
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int a, b;
	while(cin >> a >> b) {
		cout << max(0, a - 2 * b) << endl;
	}
	return 0;
}


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

using namespace std;

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;*/

    const int inf=1e9+5;
    int x[]={0,0,-1,1};
    int y[]={1,-1,0,0};

    int n,m;cin>>n>>m;
    vector<vector<char>> g(n+2,vector<char>(m+2));
    vector<vector<bool>> was(n+2,vector<bool>(m+2));
    vector<vector<int>> d(n+2,vector<int>(m+2,inf));
    vector<pair<int,int>> start;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>g[i][j];
            if(g[i][j]=='#'){
                start.push_back({i,j});
            }
        }
    }
    queue<pair<int,int>> q;
    for(auto& x:start){
        q.push(x);
        d[x.first][x.second]=0;
        was[x.first][x.second]=1;
    }
    int ans=0;
    while(!q.empty()){
        auto c=q.front();
        q.pop();
        vector<pair<int,int>> v;
        for(int i=0;i<4;i++){
            v.push_back({c.first+x[i],c.second+y[i]});
        }
        for(auto& x:v){
            if(x.first>n||x.first<1||x.second>m||x.second<1||was[x.first][x.second]){
                continue;
            }
            q.push(x);
            d[x.first][x.second]=min(d[x.first][x.second],d[c.first][c.second]+1);
            ans=max(ans,d[x.first][x.second]);
            was[x.first][x.second]=1;
        }
    }
    cout<<ans;

    /*#ifndef ONLINE_JUDGE
        cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
    #endif*/
    return 0;
}

Measured memory_bytes: 21352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n;
 	cin >> n;
 	vector <ll> vec(n);
 	for (ll i = 0; i < n; i++) {
 		cin >> vec[i];
 	}
 	vector <ll> pref = vec;
 	for (ll i = n - 2; i >= 0; i--) pref[i] = (pref[i] + pref[i + 1]) % mod; 
 	ll ans = 0;
 	for (ll i = 0; i < n - 1; i++) {
 		ans += (vec[i] * pref[i + 1]) % mod;
 		ans %= mod;
 	}
 	cout << ans << endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector <int>d = {};
    int i;
    for(i = 0;i < n;i++){
        int m;
        cin >> m;
        int j;
        for(j = 0;j < d.size();j++){
            if(m == d.at(j)){
                break;
            }
        }
        if(j == d.size()){
            d.push_back(m);
        }
    }
    cout << d.size() << endl;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int MX = 1e9 + 5;
const int N = 18;
const int SZ = (1 << 18) + 5;
int dp[N + 2][SZ][2];
int arr[SZ];
int n;

int solve(int idx, int msk, int have) {
    if (idx == -1) {
        if (have == 1)return arr[msk];
        return -MX;
    }

    int &ret = dp[idx][msk][have];
    if (~ret)return ret;

    if ((msk >> idx) & 1) {
        if (have == 1) {
            ret = max(solve(idx - 1, msk - (1 << idx), have), solve(idx - 1, msk, have));
        } else {
            ret = solve(idx - 1, msk, have);
            ret = max(ret, solve(idx - 1, msk - (1 << idx), have));
            ret = max(ret, solve(idx - 1, msk - (1 << idx), 1) + solve(idx - 1, msk, 1));
        }
    } else {
        ret = solve(idx - 1, msk, have);
    }

    return ret;
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    loop(i, (1 << n)) {
        cin >> arr[i];
    }

    int mx = 0;
    memset(dp, -1, sizeof dp);
    range(i, 1, (1 << n) - 1) {
        mx = max(mx, solve(n - 1, i, 2));
        cout << mx << endl;
    }


    return 0;
}


Measured memory_bytes: 45056
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int n[2][50],p=0,temp,dd,bb=1;
	while(1){
		scanf("%d,%d",&n[0][p],&n[1][p]);
		if(n[0][p]==0&&n[1][p]==0)break;
		p++;
	}	
	for(int i=0;i<p;i++){
		for(int k=i+1;k<p;k++){
			if(n[1][i]<n[1][k]){
				temp=n[1][i];
				n[1][i]=n[1][k];
				n[1][k]=temp;
				temp=n[0][i];
				n[0][i]=n[0][k];
				n[0][k]=temp;
			}
		}
	}
	dd=n[1][0];
	for(int i=0;i<p;i++){
		if(n[1][i]==dd)n[1][i]=bb;
		else if(n[1][i]<dd){
			dd=n[1][i];
			bb++;
			n[1][i]=bb;
		}
	}
	for(int i=0;i<p;i++){
		for(int k=i+1;k<p;k++){
			if(n[0][i]>n[0][k]){
				temp=n[1][i];
				n[1][i]=n[1][k];
				n[1][k]=temp;
				temp=n[0][i];
				n[0][i]=n[0][k];
				n[0][k]=temp;
			}
		}
	}
	while(scanf("%d",&temp)!=EOF){
		cout<<n[1][temp-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    long long b[n];
    long long a;

    if(n%2==0){
        for(int i=0;i<n;i++){
            cin>>a;
            if(i%2==0){
                b[(n+i)/2]=a;
            }else{
                b[(n-i-1)/2]=a;
            }
        }
    }else{
        for(int i=0;i<n;i++){
            cin>>a;
            if(i%2==0){
                b[(n-i-1)/2]=a;
            }else{
                b[(n+i)/2]=a;
            }
        }
    }
    for(int i=0;i<n-1;i++){
        cout<<b[i]<<" ";
    }
    cout<<b[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){
	for (;;){
		char num[1001];
		int x = 0;
		cin >> num;
		if (num[0] =='0' ){
			break;
		}
		for (int i = 0;; i++){
			x += (num[i]-'0');
			if (num[i] == '\0'){
				break;
			}
		}
		cout << x + 48 << endl;;
	}
	return 0;
	}


Measured memory_bytes: 3100
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
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);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll sum = 0;
    bool same = true;
    int ma = INT_MAX;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        sum += a;
        if(a > b) chmin(ma, b);
        if(a != b) same = false;
    }
    if(same) cout << 0 << endl;
    else cout << sum-ma << endl;
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;

namespace B
{
	class Program
	{
		static void Main()
		{
			var S = Console.ReadLine();

			List<int> lens = new List<int>();
			lens.Add(0);

			int i = 0;
			foreach (var c in S) {
				if (c == 'A' || c == 'C' || c == 'G' || c == 'T') lens[i]++;
				else {
					lens.Add(0);
					i++;
				}
			}

			Console.WriteLine(lens.Max());
		}
	}
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

#define mx 550005
#define mx2 1003

int dt[mx];

int main(){
    int n;
    scanf("%d",&n);
    dt[4]=1;
    dt[7]=1;
    for(int i=7;i<=n;i++){
        if(dt[i-4]){
            dt[i]=1;
        }
        if(dt[i-7]){
            dt[i]=1;
        }
    }
    if(dt[n])   printf("Yes");
    else    printf("No");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 const int INF = 2147483647;

 int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> bridge;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        pair<int,int> pr = make_pair(b,a);
        bridge.push_back(pr);
    }
    sort(bridge.begin(),bridge.end());
    int cnt = 0;
    int endtime = 0;
    for(int i=0;i<m;i++){
        if(bridge[i].second >= endtime){
            endtime = bridge[i].first;
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
 }

Measured memory_bytes: 1400
#include<stdio.h>

int tt[256],rr[256];
int abs(int x) { if (x < 0)return -x; return x; }
int main() {
	tt['('] = 1; tt[')'] = 1;
	tt['{'] = 2; tt['}'] = 2;
	tt['['] = 3; tt[']'] = 3;
	rr['('] = 1; rr[')'] = -1;
	rr['{'] = 1; rr['}'] = -1;
	rr['['] = 1; rr[']'] = -1;

	while (1) {
		int n, m;
		int cnt1[11] = { 0, }, cnt2[11] = { 0, };
		int CX1[11][4] = { 0, }, CX2[11][4] = { 0, };
		int ans[11] = { 0, };
		int cnt[11] = { 0, };
		int i, j;

		scanf("%d%d", &n, &m);
		if (n == 0 && m == 0)break;
		char x[100];
		for (i = 0; i < n; i++) {
			scanf("%s", x);
			bool flag = 1;
			for (j = 0; x[j]; j++) {
				if (x[j] != '.')flag = 0;
				if (flag&&x[j] == '.')cnt1[i]++;
				CX1[i][tt[x[j]]] += rr[x[j]];
			}
		}
		for (i = 0; i < m; i++) {
			ans[i] = -2;
			scanf("%s", x);
			bool flag = 1;
			for (j = 0; x[j]; j++) {
				if (x[j] != '.')flag = 0;
				if (flag&&x[j] == '.')cnt2[i]++;
				CX2[i][tt[x[j]]] += rr[x[j]];
			}
		}
		int r, c, s;
		for (r = 1; r <= 20; r++) {
			for (c = 1; c <= 20; c++) {
				for (s = 1; s <= 20; s++) {
					int S = 0;
					bool flag = 1;
					for (i = 0; i < n; i++) {
						if (cnt1[i] != S) {
							flag = 0;
							break;
						}
						S += CX1[i][1] * r + CX1[i][2] * c + CX1[i][3] * s;
					}
					if (!flag)continue;
					for (i = 0; i < m; i++) {
						if (ans[i] == -2)ans[i] = S;
						if (ans[i] != S)ans[i] = -1;
						S += CX2[i][1] * r + CX2[i][2] * c + CX2[i][3] * s;
					}
				}
			}
		}
		for (i = 0; i < m; i++) {
			printf("%d", ans[i]);
			if (i != m - 1)printf(" ");
		}
		puts("");
	}
	
	return 0;
}


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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

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

	auto N=in(),C=in(),K=in();
	auto T=vecin(N);
	sort(ALL(T));

	ll S=0;
	ll X=0;
	while(X<N){
		ll T0 = T[X];
		ll Y = X;
		while(Y<N && T[Y]<=T0+K && Y-X<C){
			Y++;
		}
		S++;
		X = Y;
	}
	
	out(S);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  string s;
  cin >> s;
  i64 K;
  cin >> K;
  i64 ans = 0;
  i64 left = 0;
  i64 right = 0;
  {
    i64 i = 0;
    for(;i < s.size();i++) {
      if(s.front() == s[i]) continue;
      break;
    }
    left = i;
    i = s.size() - 1;
    for(;i >= left;i--) {
      if(s.back() == s[i]) continue;
      break;
    }
    right = i;
    if(left == s.size()) {
      i64 len = (i64)s.size() * K;
      cout << len / 2 << endl;
      return 0;
    }
  }
  char c = '$';
  i64 cnt = 0;
  i64 center = 0;
  for(int i = left; i <= right; i++) {
    if(c == s[i]) {
      cnt++;
      if(cnt % 2 == 0) {
        center++;
      }
    }
    else {
      cnt = 1;
    }
    c = s[i];
  }
  right = s.size() - 1 - right;
  if(s.front() == s.back()) {
    cout << left / 2 + right / 2 + center * K + ((left + right) / 2) * (K - 1) << endl;
  }
  else {
    cout << (left / 2 + right / 2 + center) * K << endl;
  }
}


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

typedef long long ll;

using namespace std;

int main()
{
    string s;

    cin >> s;

    ll lose = 0;
    for (auto i : s)
    {
        if (i == 'x') lose++;
    }

    if (15 - lose > 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc142_d2.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

// 素因数分解
vector<pl> prime_factorize(ll N) {
  vector<pl> res;
  for (ll a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    ll ex = 0;  // 指数

    while (N % a == 0) {
      ++ex;
      N /= a;
    }

    res.push_back({a, ex});
  }

  // 最後に残った数について
  if (N != 1) res.push_back({N, 1});
  return res;
}

/** 約数に含まれる素数を列挙する。
 * gcdまでの素数の数え上げでは間に合わない。
 * 素因数分解が高速
 * #prime_factorize #integer
 */
int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll a, b;
  cin >> a >> b;

  ll ans = 1;
  ll g = gcd(a, b);
  // 最大公約数の素因数はすべて公約数
  vector<pl> p = prime_factorize(g);
  ans += p.size();

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n,k;
int ans[200005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>k;
	
	if (k==1 || k==2*n-1){
		cout<<"No"<<endl;
		return 0;
	}
	
	if (n==2){
		cout<<"Yes"<<endl;
		cout<<"1"<<endl;
		cout<<"2"<<endl;
		cout<<"3"<<endl;
		return 0;
	}
	
	vector<int> rem;
	
	if (k==2){
		ans[n-2]=3;
		ans[n-1]=1;
		ans[n]=2;
		ans[n+1]=4;
		
		rep(x,5,2*n) rem.push_back(x);
	}
	else{
		ans[n-2]=k-2;
		ans[n-1]=k+1;
		ans[n]=k;
		ans[n+1]=k-1;
		
		rep(x,1,2*n) if (x<k-2 || k+1<x) rem.push_back(x);
	}
	
	rep(x,1,2*n) if (ans[x]==0){
		ans[x]=rem.back();
		rem.pop_back();
	}
	
	cout<<"Yes"<<endl;
	rep(x,1,2*n) cout<<ans[x]<<endl;
}


Measured memory_bytes: 3188
def read():
    return int(input())


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


def readmap():
    return map(int, input().split())


N = read()
x = []
y = []
h = []
for i in range(N):
    xi, yi, hi = readmap()
    x.append(xi)
    y.append(yi)
    h.append(hi)
    if hi > 0:
       idx = i

for cx in range(101):
    for cy in range(101):
        H = h[idx] + abs(x[idx] - cx) + abs(y[idx] - cy)
        ok = True
        for i in range(N):
            if h[i] != max(0, H - abs(x[i] - cx) - abs(y[i] - cy)):
                ok = False
                break
        if ok:
            print(cx, cy, H)
            quit()


Measured memory_bytes: 3064
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string str;
    cin >> str;
    vector<pair<int, int>> over_3;

    for (int i = A - 1; i < C - 1; i++) {
        if (str[i] == '#' && str[i + 1] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = B - 1; i < D - 1; i++) {
        if (str[i] == '#' && str[i + 1] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }
    if (C < D) {
        cout << "Yes" << endl;
        return 0;
    } else {
        if (str[D - 2] == '.' && str[D] == '.') {
            cout << "Yes" << endl;
            return 0;
        } else {
            for (int i = B - 1; i < D; i++) {
                if (str[i - 1] == '.' && str[i] == '.' && str[i + 1] == '.') {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
            cout << "No" << endl;
        }
    }
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	int p[n];
	for(int &i:p){
		cin >> i;
		i--;
	}
	int ans = 0;
	for(int i = 0; i < n - 1; i++) if(i == p[i]){
		swap(p[i], p[i + 1]);
		ans++;
	}
	if(p[n - 1] == n - 1) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

P dfs(string s, ll idx){
	vl res;
	ll ret = 0;
	ll num = 0;
	while(idx < s.size()){
		if(s[idx] == '['){
			num = 0;
			P p = dfs(s,idx+1);
			res.push_back(p.first);
			idx = p.second + 1;
		}else if(s[idx] == ']'){
			if(res.empty()) res.push_back(num);
			num = 0;
			sort(all(res));
			ll siz = res.size();
			if(siz==1) return P(res[0]/2+1,idx);
			rep(i,(siz+1)/2){
				ret += res[i];
			}
			return P(ret,idx);
			idx++;
		}else{
			num = num * 10 + s[idx] - '0';
			idx++;
		}
	}
	return P(res[0],idx);
}

int main(){
	ll n; cin >> n;
	while(n--){
		string s; cin >> s;
		cout << dfs(s,0).first << endl;
	}
}


Measured memory_bytes: 3304
/*
 * d.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 1000000;
const int MAX_M = 20;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

int as[MAX_N], gs[MAX_M];

/* subroutines */
int insertion_sort(int as[], int n, int g) {
  int cnt = 0;
  for (int i = g; i < n; i++) {
    int v = as[i];
    int j = i - g;
    while (j >= 0 && as[j] > v) {
      as[j + g] = as[j];
      j = j - g;
      cnt++;
    }
    as[j + g] = v;
  }
  return cnt;
}

int shell_sort(int as[], int n, int gs[], int m) {
  int cnt = 0;
  for (int i = 0; i < m; i++)
    cnt += insertion_sort(as, n, gs[i]);
  return cnt;
}

/* main */

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

  for (int i = 0; i < n; i++) cin >> as[i];

  int g;
  for (g = 1; g <= n; g <<= 1);

  int m = 0;
  for (g >>= 1; g > 0; g >>= 1, m++) gs[m] = g;

  int cnt = shell_sort(as, n, gs, m);

  printf("%d\n", m);
  for (int i = 0; i < m; i++) {
    if (i) putchar(' ');
    printf("%d", gs[i]);
  }
  putchar('\n');
  printf("%d\n", cnt);

  for (int i = 0; i < n; i++) printf("%d\n", as[i]);
  
  return 0;
}

Measured memory_bytes: 5048
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = line[0];
    let x: Vec<i64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();

    let sum = x.iter().fold(0, |acc, val| acc+val);
    let avg = sum / (n as i64);
    let diff1 = x.iter().fold(0, |acc, val| acc + (val - avg) * (val - avg));
    let diff2 = x.iter().fold(0, |acc, val| acc + (val - avg - 1) * (val - avg - 1));
    println!("{}", cmp::min(diff1, diff2));
}


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

typedef long long ll;
#define rep(i,n) for( ll (i)=0; (i)<(n); ++(i) )
#define rpi(i,n) for( int (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#if __cplusplus < 201703L
  std::ostream& co_(){ return std::cout << std::endl; }
  std::istream& cn_(){ return std::cin; }
  template<class Head, class... Args>
  std::ostream& co_( Head&& head, Args&&... args ){ std::cout << head; return co_(std::forward<Args>(args)...); }
  template<class Head, class... Args>
  std::istream& cn_( Head&& head, Args&&... args ){ std::cin >> head; return cn_(std::forward<Args>(args)...); }
#else
  template<class... Args>
  std::ostream& co_( Args... args ){ return std::cout << ... << args << std::endl; }
  template<class... Args>
  std::istream& cn_( Args... args ){ return std::cin >> ... >> args; }
#endif
#define co(...) co_(__VA_ARGS__);
#define cn(...) cn_(__VA_ARGS__);
#define all(x) (x).begin(), (x).end()
#define rgt(x,i) (x).begin(), (x).begin()+(i)

int main(){
  int n;cn(n)
  vector<int> a(n);
  rpv(a){cn(v)}
  rpv(a){
    if ((v%2==0)&& (v%3)&&(v%5)){
      co("DENIED")
      return 0;
    }
  }
  co("APPROVED")
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {
    public static void main(String[] args) {
	String s = "";
	String t = "";
	try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
	    s = br.readLine();
	    t = br.readLine();
	} catch(IOException e) {
	    e.printStackTrace();
	}
	String alphabet = "abcdefghijklmnopqrstuvwxyz";
	int len = s.length();
	for (int i=0;i<26;i++) {
	    String ab = alphabet.substring(i,i+1);
	    int idx = -1;
	    idx = s.indexOf(ab,idx+1);
	    if (idx >= 0) {
		String t1 = t.substring(idx,idx+1);
		while (idx < len) {
		    idx = s.indexOf(ab,idx+1);
		    if (idx < 0) break;
		    String t2 = t.substring(idx,idx+1);
		    if (!t1.equals(t2)) {
			System.out.println("No");
			System.exit(0);
		    }
		}
	    }
	    idx = -1;
	    idx = t.indexOf(ab,idx+1);
	    if (idx >= 0) {
		String s1 = s.substring(idx,idx+1);
		while (idx < len) {
		    idx = t.indexOf(ab,idx+1);
		    if (idx < 0) break;
		    String s2 = s.substring(idx,idx+1);
		    if (!s1.equals(s2)) {
			System.out.println("No");
			System.exit(0);
		    }
		}
	    }
	}
	System.out.println("Yes");
    }
}

Measured memory_bytes: 44096
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  int sum = 0;
  int mi = 200;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    sum += tmp;
    if (tmp%10 != 0) mi = min(mi, tmp);
  }
  if (mi == 200) mi = sum;
  sum%10 == 0 ? dump(sum-mi) : dump(sum);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll mcou[300];
ll n;
char s[100][100];
int main(){
	cin >> n;

	REP(i,n) {
		cin >> s[i];
	}

	REP(i,300) {
		mcou[i] = 1000000000;
	}

	REP(i,n) {
		ll cou[300];
		REP(j,300) {
			cou[j] = 0;
		}
		for(int j = 0;s[i][j] != '\0';j++) {
			cou[s[i][j]]++;
		}

		for(int j = 'a';j <= 'z';j++) {
			mcou[j] = min(mcou[j],cou[j]);
		}
	}

	for(int i = 'a';i <= 'z';i++) {
		REP(j,mcou[i]) {
			char c = i;
			cout << c;
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll comb[55][55];

ll getcomb(int a, int b){
  if(comb[a][b]>0) return comb[a][b];
  if(a==b || b==0) return comb[a][b] = 1;
  if(a<b) return 0;
  return comb[a][b] = getcomb(a-1, b-1) + getcomb(a-1, b);
}

int main() {
  for(int i=0;i<55;++i){
    for(int j=0;j<=i;++j){
      getcomb(i, j);
    }
  }
  double N, A, B;
  cin>>N>>A>>B;
  vector<double> v(N);
  for(int i=0;i<N;++i) cin>>v[i];
  sort(v.begin(), v.end(), greater<ll>() );
  double ans = 0;
  ll ans1 = 0;
  if(v[0]==v[A-1]){
    ll numA = 0;
    for(int i=0;i<N;++i){
      if(v[0]==v[i]) numA++;
    }
    ans = v[0];
    for(int i=A;i<=B;++i){
      if(i>numA) break;
      ans1 += comb[numA][i];
    }
  }
  else{
    for(int i=0;i<A;++i) ans += v[i];
    ans /= A;
    ll numA = 0;
    ll supA = 0;
    for(int i=0;i<N;++i){
      if(v[i]==v[A-1]) numA++;
      if(v[i]>v[A-1]) supA++;
    }
    ans1 = comb[numA][ll(A)-supA];
  }
  cout<<setprecision(20)<<ans<<endl;
  cout<<ans1<<endl;
}



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

using namespace std;

int main() {
	int n;
	ignore = scanf("%d", &n);
	
	vector<pair<int, int>> e;
	for (int v = 1; v <= n; v++)
		for (int u = v + 1; u <= n; u++)
			if (u + v != n + 1 - (n % 2))
				e.emplace_back(u, v);
	
	printf("%d\n", (int)e.size());
	for (auto& x : e) printf("%d %d\n", x.first, x.second);
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(string, s, t);
	int ans = 0;
	inc(i, SI(s)) {
		if(s[i] != t[i]) { ans++; }
	}
	OUT(ans);
}


Measured memory_bytes: 3912
#atcoder -take a rest-(easy)

def main():
    N,K = map(int,input().split())
    que = []
    que_x =  []
    que_y = []
    for i in range(N):
        x,y = map(int,input().split())
        que_x.append(x)
        que_y.append(y)
        que.append((x,y))
    que_x.sort()
    que_y.sort()
    ans = 10**100
    for i in range(N):
        for j in range(i,N):
            for _i in range(N):
                for _j in range(_i,N):
                    h,w = que_x[j]-que_x[i],que_y[_j] -que_y[_i]
                    cnt = 0
                    for x,y in que:
                        if que_x[i]<=x<=que_x[j] and que_y[_i]<=y<=que_y[_j]:
                            cnt += 1
                    if cnt >=K:
                        ans = min(ans,h*w)
    print(ans)
    return




if __name__ == "__main__":
    main()




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

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } 
template <typename A>
string to_string(A v) {
    bool first = true; 
    string res = "{";
    for (const auto &x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}"; 
    return res;
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    dbg_out(T...);
}
#ifdef LOCAL
    #define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", dbg_out(__VA_ARGS__)
#else
    #define dbg(...) 42
#endif

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define MP make_pair
#define sz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    int n;
    cin >> n;
    int a[n], mn = inf, ans = 0;
    fr(i, 0, n) {
        cin >> a[i];
        mn = min(mn, a[i]);
        if(mn == a[i]) ans++;
    }
    cout << ans;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
men, kazu = map(int,  input().split())

ans = 0

for i in range(men):
    ansKazu = i + 1
    kaisuu = 0
    while ansKazu < kazu:
        ansKazu = ansKazu * 2
        kaisuu = kaisuu + 1

    prob = 1/men * ((1/2) ** kaisuu)
    ans = ans + prob

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,k;
    cin>>n>>k;
    int p[n];
    rep(i,n){
        cin>>p[i];
    }
    sort(p,p+n);
    int sum=0;
    rep(i,k){
        sum+=p[i];
    }
    cout<<sum<<endl;

    return 0;
}


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

using namespace std;

int main()
{
    int X = 0;
    cin >> X;
    for(int a = 0; 100 * a <= X; a++){
        for(int b = 0; 101 * b + 100 * a <= X; b++){
            for(int c = 0; 102 * c + 101 * b + 100 * a <= X; c++){
                for(int d = 0; 103 * d + 102 * c + 101 * b + 100 * a <= X; d++){
                    for(int e = 0; 104 * e + 103 * d + 102 * c + 101 * b + 100 * a <= X; e++){
                        for(int f = 0; 105 * f + 104 *e + 103 * d + 102 * c + 101 * b + 100 * a <= X; f++){
                            if(105*f+104*e+103*d+102*c+101*b+100*a == X){
                                cout << 1 << endl;
                                return 0;
                            }
                        }
                        if(104*e+103*d+102*c+101*b+100*a == X){
                            cout << 1 << endl;
                            return 0;
                        }
                    }
                    if(103*d + 102*c + 101*b + 100*a == X){
                        cout << 1 << endl;
                        return 0;
                    }
                }
                if(102*c + 101*b + 100*a == X){
                    cout << 1 << endl;
                    return 0;
                }
            }
            if(101*b + 100*a == X){
                cout << 1 << endl;
                return 0;
            }
        }
        if(100*a == X){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a[5],i,k;
    for(i=0;i<5;i++)
        scanf("%d",&a[i]);
    scanf("%d",&k);
    if(a[4]-a[0]>k)
        printf(":(");
    else
        printf("Yay!");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int asc(const void* a, const void* b) {
	return *(int*)a- *(int*)b;
}

int main()
{
	int n, x, m[105];
	int sum = 0;
	cin >> n >> x;
	rep(i, n) {
		cin >> m[i];
		sum += m[i];
	}
	int ans = n;
	x -= sum;
	qsort(m, n, sizeof(int), asc);
	ans += x / m[0];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long a[200010];
long long b[200010];
long long d[200010];
int main()
{
	long long n;	cin>>n;
	for(int i=1;i<=n;i++){
		int x;	cin>>x;
		a[x]++ , b[i]=x;
	}
	for(int i=1;i<=n;i++)
		d[i]=a[i]*(a[i]-1)/2;
	long long ans=0;
	for(int i=1;i<=n;i++)
		ans+=d[i];
	for(int i=1;i<n;i++)
		cout<<ans-a[b[i]]+1<<" ";
	cout<<ans-a[b[n]]+1<<endl;
}

Measured memory_bytes: 6784