akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static long N;
    static long X;
    static long[] H;
    static Node[] Nodes;
    static void Main(string[] args)
    {

        //var NX = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var N = long.Parse(Console.ReadLine());

        var ans = false;
        long sum = (N + 1) * N / 2;
        
        if(N%2 == 0)
        {
            Console.WriteLine(N*(N-2)/2);
            for (int i = 1; i <= N; i++)
            {
                for (int j = i+1; j <= N; j++)
                {
                    if(i+j == N + 1)
                    {
                        continue;
                    }
                    else
                    {
                        Console.WriteLine(i + " " + j);
                    }
                }
            }
        }
        else
        {
            Console.WriteLine((N-1) * (N - 3) / 2 + (N - 1));
            for (int i = 1; i <= N - 1; i++)
            {
                for (int j = i + 1; j <= N -1; j++)
                {
                    if (i + j == N)
                    {
                        continue;
                    }
                    else
                    {
                        Console.WriteLine(i + " " + j);
                    }
                }

                
            }
            for (int i = 1; i <= N -1; i++)
            {
                Console.WriteLine(i + " " + N);
            }
        }

        
    }


    static void WFS()
    {
        var que = new Queue<long>();
        que.Enqueue(X);
        Nodes[X].parent = 0;

        while (que.Count > 0)
        {
            var top = que.Dequeue();
            foreach (var item in Nodes[top].adj)
            {
                if (Nodes[item].parent == -1)
                {
                    Nodes[item].parent = top;
                    que.Enqueue(item);
                }
            }
        }
    }
}

class Node {
    public List<long> adj;
    public long parent = -1;
    public Node()
    {
        adj = new List<long>();
    }
}


Measured memory_bytes: 27532
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main() {
    string s;
    string s1;

    cin >> s;
    long long sum=0;

    for(int i = 0; i < pow(2,s.size()-1); ++i) {
        for(int j = 0; j < s.size(); ++j) {
            s1 += s[j];
            if( ((i >> j) & 1) == 1) {
                sum += atoll(s1.c_str());
                s1.clear();
            }
        }
        sum += atoll(s1.c_str());
        s1.clear();       
    }

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


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

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

  return true;
}


int main(){
  int n;

  while(cin >> n, n){
    for(int i = n; i >= 5; i--){
      if(isPrime(i) && isPrime(i - 2)){
        cout << i - 2 << " " << i << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
  using namespace std;
  typedef long long ll;
  int main()
  {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    int x,ans;
    for(int i=1;i<=5;i++)
    {
        cin>>x;
        if(x==0)
            ans=i;
    }
    cout<<ans<<endl;



    return 0;
  }


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

int main(){
  int N;
  cin >> N;
  string S;
  bool four = false;

  for (int i = 0; i < N; i++){
    cin >> S;
    if (S == "Y") {
      four = true;
      break;
    }
  }

  if (four == true){
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }

}

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

int main() {
 int A,B,C,D,L,R;
 cin >> A >> B >> C >> D ;
 L=A+B;
 R=C+D;
 
 if(L>R){
  cout << "Left" << endl;
 }
  
  if(L==R){
  cout << "Balanced" << endl;
 }
   
  if(L<R){
  cout << "Right" << endl;
 }
}


Measured memory_bytes: 256
# include <cstdio>
# include <algorithm>

int main()
{
    int n;
    scanf("%d", &n);
    int arr[n];
    for (int i=0; i<n; i++) { scanf("%d", &arr[i]);}
    std::sort(arr, arr+n);
    printf("%d\n", arr[n-1] - arr[0]);
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class arc095_d {
public:
    void solve(istream& in, ostream& out) {
        int n;
        in >> n;
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            in >> a[i];
        }
        auto it = max_element(begin(a), end(a));
        int x = *it, y = -1;
        for (int i = 0; i < n; ++i) {
            if (it != a.begin() + i) {
                if (y == -1) {
                    y = a[i];
                } else if (abs(x / 2. - a[i]) < abs(x / 2. - y)) {
                    y = a[i];
                }
            }
        }
        out << x << " " << y << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc095_d solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 640
// AtCoder
    // Beginner Contest 137
    // C - Green Bin
    #include <bits/stdc++.h>
    #include <iostream>
    #include <map>
    #include <queue>
    #include <set>
    #include <string> 
    #include <vector>
    #include <numeric>
    using namespace std;
    typedef long long int ll;
    typedef long double ld;
    typedef pair<ll, int> PLI;
    typedef pair<int, int> PII;
    const ll mxsize = 1e5 + 15;
    const ll linf = 1e9;
    const long double inf = 10000000000.0;
    #define fastIO                                                                 \
      ios_base::sync_with_stdio(false);                                            \
      cin.tie(NULL);                                                               \
      cout.tie(NULL);
    const ll mod = 1e9 + 7;
    /******************************************* IMPORTANT CODE SNIPPETS ************************************************/ 
    
    ll pow(ll x, ll n) {
      if (n == 0)
        return 1ll;
      ll temp;
      temp = pow(x, n / 2);
      if (n % 2 == 0)
        return temp * temp;
      else
        return x * temp * temp;
    }

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

    int sum_digit(int val) {
      if (val < 0)
        return -1;
      if (val == 0)
        return 0;
      int ans = 0;
      while (val > 0) {
        ans = ans + val % 10;
        val = val / 10;
      }
      return ans;
    }

    ll count_div(ll l, ll r, ll val) {
      if (l % val == 0)
        return (((r / val) - (l / val)) + 1);
      else
        return ((r / val) - (l / val));
    }

    int powmod(int x, int y, int m) {
      int res = 1;
      // x = x % mod;
      while (y > 0) {
        if (y & 1)
          res = (res * x) % m;
        cout << res << endl;
        y = y / 2;
        cout << x << endl;
        x = (x * x) % m;
      }
      // cout << res << endl;
      return res;
    }
    /******************************************** CODE STARTS FROM HERE *************************************************/ 
    
    int main()
    {
      int n;
      cin >> n;
      unordered_map < string , ll > mp;
      for(ll i = 0 ; i < n ; i++)
      {
        string s;
        cin >> s;
        sort(s.begin() , s.end());
        mp[s]++;
      }
      ll ans = 0;
      for(auto x : mp)
      {
        if(x.second >= 2)
        {
          ans = ans + ((x.second) * (x.second - 1)) / 2;
        }
      }
      cout << ans << endl;
    }

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  int N, K; cin >> N >> K;
  vi32 x(N), y(N);
  rep(i, N) cin >> x[i] >> y[i];

  vi32 ox, oy;
  rep(i, N) ox.push_back(x[i]);
  rep(i, N) oy.push_back(y[i]);
  sort(all(ox)), sort(all(oy));

  vector<vi32> sums(N + 1, vi32(N + 1));
  {
    set<pair<int, int>> s;
    rep(i, N) s.emplace(x[i], y[i]);
    rep(i, N) rep(j, N) {
      if (s.count(make_pair(ox[i], oy[j]))) sums[i + 1][j + 1] = 1;
    }
    rep(i, N + 1) rep(j, N) sums[i][j + 1] += sums[i][j];
    rep(i, N) rep(j, N + 1) sums[i + 1][j] += sums[i][j];
  }

  i64 ans = 5e18;

  rep(xl, N) rep(xr, N) rep(yl, N) rep(yr, N) {
    if (xl >= xr || yl >= yr) continue;
    int c = sums[xr + 1][yr + 1] - sums[xr + 1][yl] - sums[xl][yr + 1] + sums[xl][yl];
    if (c < K) continue;
    amin(ans, (i64) (ox[xr] - ox[xl]) * (oy[yr] - oy[yl]));
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  string s,t;
  cin >> s >> t;
  vector<int> p[26];
  rep(i,s.size()){
    p[s[i]-'a'].push_back(i);
  }
  ll ind = 0;
  int ss = s.size();
  rep(i,t.size()){
    vector<int> c = p[t[i]-'a'];
    if(c.empty()){
      cout << -1 << endl;
      return 0;
    }
    auto it = lower_bound(c.begin(),c.end(),ind%ss);
    if(it==c.end()){
      ind = (ind + ss - 1)/ss * ss + c[0] + 1;
    }
    else ind = ind/ss*ss + *it + 1;
  }
  cout << ind << endl;
}

Measured memory_bytes: 3860
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;

typedef long long ll;

#define pb push_back
#define mp make_pair
#define x first
#define y second

const int inf=2147483647;

ll read()
{
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}

void print(ll x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]={},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}

//arc_086 E
const int mod=1e9+7;

struct tri{
	int a,b,c;	//分别代表使得当前节点上珠子数为0,1,2+的种数 
	tri(int x,int y,int z){
		a=x;
		b=y;
		c=z;
	}
};

int n;
vector<int> adj[222222];
int nums[222222];	//记录某一层中的节点数目
int dep[222222];	//记录顶点的深度
deque<tri> dp[222222];

void dfs(int nw){
	nums[dep[nw]]++;
	for(int i=0;i<adj[nw].size();i++){
		int v=adj[nw][i];
		dep[v]=dep[nw]+1;
		dfs(v);
	}
}

void solve(int nw){
	for(int i=0;i<adj[nw].size();i++){
		int v=adj[nw][i];
		solve(v);
		if(dp[v].size()>dp[nw].size()) swap(dp[v],dp[nw]);
	}
	
	int mx=0;
	int ansa=0,ansb=0,ansc=0;
	for(int i=0;i<adj[nw].size();i++){
		int v=adj[nw][i];
		mx=max(mx,(int)dp[v].size());
		for(int j=0;j<dp[v].size();j++){
			ansa=(dp[nw][j].a*1ll*dp[v][j].a)%mod;
			ansb=(dp[nw][j].a*1ll*dp[v][j].b+dp[nw][j].b*1ll*dp[v][j].a)%mod;
			ansc=(dp[nw][j].b*1ll*dp[v][j].b+dp[nw][j].c*1ll*(dp[v][j].a+dp[v][j].b))%mod;
			tri t(ansa,ansb,ansc);
			dp[nw][j]=t;
		}
	}
	
	for(int i=0;i<mx;i++){
		dp[nw][i].a+=dp[nw][i].c;
		dp[nw][i].a%=mod;
		dp[nw][i].c=0;
	}
	
	dp[nw].push_front(tri(1,1,0));
}

int pw[222222];
void calc(){
	pw[0]=1;
	for(int i=1;i<=200000;i++){
		pw[i]=pw[i-1]*2;
		if(pw[i]>mod) pw[i]-=mod;
	}
}

int main(){
	calc();
	n=read();
	for(int i=1;i<=n;i++){
		int x=read();
		adj[x].pb(i);
	}
	
	dfs(0);
	solve(0);
	
	int ans=0;
	for(int i=0;i<dp[0].size();i++){
	//	cout<<dp[0][i].b<<' '<<pw[n+1-nums[i]]<<endl;
		ans+=dp[0][i].b*1ll*pw[n+1-nums[i]]%mod;
		ans%=mod;
	}
	
	cout<<ans<<endl;
	return 0;
}

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


int n;
int l[100];

int main(){
  cin >> n;
  rep(i,n) cin>>l[i];

  int sum = l[0];
  int ma = l[0];
  rep(i,n-1){
    ma = max(ma, l[i+1]);
    sum += l[i+1];
  }
  if(sum - ma > ma) cout << "Yes" ;
  else cout << "No";
  cout << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>
#include <numeric>

#define LOP(N) for(int i=0; i<N; i++)
#define LOOP(i, N) for(int i=0; i<N; i++)
#define LOOP_s(i, start, end) for(int i=start; i<end; i++)

typedef long long ll;

using namespace std;


int main() {
    int N; cin >> N;
    string S; cin >> S;
    
    int count = 0;
    LOOP_s(i, 1, N) {
        if (S[i] == 'E') ++count;
    }
    
    int min = count;
    LOOP_s(i, 1, N) {
        if (S[i-1] == 'W') ++count;
        if (S[i] == 'E') --count;
        
        if (min > count) min = count;
    }
    cout << min;
}


Measured memory_bytes: 900
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, m;
    cin >> N >> m;
    vector<ll> restricts(N, -1);
    for (int i = 0; i < m; i++) {
        ll c, d;
        cin >> c >> d;
        c--; d--;
        restricts[c] = max(restricts[c], d);
    }

    ll ans = 0;
    ll left = INT_MAX;
    ll right = -1;
    for (ll curr_pos = 0; curr_pos < N; curr_pos++) {
        if (restricts[curr_pos] != -1) {
            right = max(right, restricts[curr_pos]);
            left = min(left, curr_pos);
        } else {
            if (curr_pos == right) {
                ans += 2 * (right - left);
                left = INT_MAX;
            }
        }
        ans++;
    }
    
    cout << ans + 1 << endl;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

// namespace
using namespace std;
namespace mp = boost::multiprecision;

// types
using pii = pair<int, int>;
using ll = long long int;
using ld = long double;
using mpi = mp::cpp_int;
using mpf = mp::number<mp::cpp_dec_float<1024>>;

int main() {
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    for (auto c: s) {
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
            ++cnt;
        } else {
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    ans = max(cnt, ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,X;
  cin>>A>>B>>C>>X;
  int Ans=0;
  int limA,limB,limC;
  limA=min(X/500,A);
  if(X%50==0){
    for(int i=0;i<limA+1;i++){
        limB=min((X-500*i)/100,B);
        for(int j=0;j<limB+1;j++){
            if((X-500*i-100*j)/50<=C){
                Ans++;
            }
        }
    }
  }
    cout<<Ans<<endl;
    

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    char a,b;
    cin >>  a >> b;
    if(a=='H'){
        if(b=='H')
            cout << 'H' << endl;
        else
            cout << 'D' << endl;
    }
    else{
        if(b=='H')
            cout << 'D' << endl;
        else
            cout << 'H' << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
time = [0]
axi_x = [0]
axi_y = [0]
for i in range(N):
    t , x , y =map(int,input().split())
    time.append(t)
    axi_x.append(x)
    axi_y.append(y)

for i in range(N):
    ans=(time[i+1]-time[i])-abs(axi_x[i+1]-axi_x[i])-abs(axi_y[i+1]-axi_y[i])
    if ans%2==1 or ans<0:
        print("No")
        break
    if i == N-1:
        print("Yes")


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;
stringstream ss;

void print_lists(const std::list<ll> &list) {
    bool isNotFirst = false;
    for (const auto &l : list) {
        if (isNotFirst) std::cout << ' ';
        std::cout << l;
        isNotFirst = true;
    }
    std::cout << std::endl;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;

    vector<list<ll>> lists(n);

    rep(i, q) {
        int query, t;
        cin >> query >> t;
        if (query == 0) {
            ll x;
            cin >> x;
            lists[t].push_back(x);
        } else if (query == 1) {
            print_lists(lists[t]);
        } else if (query == 2) {
            int s;
            cin >> s;
            lists[s].splice(lists[s].end(), move(lists[t]));
            lists[t] = list<ll>();
        }
    }


    printf("%s", ss.str().c_str());

}


Measured memory_bytes: 18956
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mx2 102
#define mx3 1003
#define mx4 10004
#define mx5 100005
#define mx6 1000006
#define mod 1000000007
#define PI 3.14159265
#define fo(i,n) for(int i=0 ; i<n ; i++)
#define f1(i,n) for(int i=1 ; i<=n ; i++)
#define Fo(i,k,n) for(int i=k ; i<n ; i++)

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;

int n , a , b,ans;

int main() {
    ios::sync_with_stdio(false);
    int t;
    //cin>>t;while(t--)
    {
        cin>>n;
        cout<<n*n*n;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int d,c[26],s[400][26],t[400];
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>d;
    rep(i,26)cin>>c[i];
    rep(i,d){
        rep(j,26){
            cin>>s[i][j];
        }
    }
    int score=0;
    vector<pair<int,pair<vector<int>,vector<int>>>>last;
    rep(i,26)last.pb({0,{vector<int>(26,-1),{}}});
    rep(i,d){
        vector<pair<P,int>>ma;
        rep(l,26)ma.pb({{-INF,-1},-1});
        rep(j,26){
            rep(l,26){
            int score=s[i][j];
            int memo=last[l].se.fi[j];
            last[l].se.fi[j]=i;
            rep(k,26)score-=c[k]*(i-last[l].se.fi[k]);
            last[l].se.fi[j]=memo;
            ma.pb({{score,j},l});
            sort(all(ma),greater<>());
            ma.resize(26);
            }
        }
        vector<pair<int,pair<vector<int>,vector<int>>>>next;
        for(auto p:ma){
            vector<int>v=last[p.se].se.fi;
            vector<int>u=last[p.se].se.se;
            v[p.fi.se]=i;
            u.pb(p.fi.se);
            next.pb({last[p.se].fi+p.fi.fi,{v,u}});
        }
        sort(all(next));
        last=next;
    }
    for(auto i:last[0].se.se)cout<<i+1<<endl;
    return 0;
}

Measured memory_bytes: 4208
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll dp[1010][10010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, N;
    cin >> H >> N;
    ll A[N], B[N];
    REP(i, 0, N) {
        cin >> A[i] >> B[i];
    }
    REP(i, 0, N + 10) {
        fill(dp[i], dp[i] + H + 10, inf);
    }
    dp[0][0] = 0;
    REP(i, 0, N) {
        REP(j, 0, H + 1) {
            if (j < A[i] && j != H) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            } else if (j != H) {
                dp[i + 1][j] = min(dp[i + 1][j], min(dp[i][j], dp[i + 1][j - A[i]] + B[i]));
            } else {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
                REP(k, 1, A[i] + 1) {
                    dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][j - k] + B[i]);
                }
            }
        }
    }
    // REP(i, 0, N + 1) {
    //     REP(j, 0, H + 1) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    ll ans = dp[N][H];
    cout << ans << endl;
}


Measured memory_bytes: 79232
n = int(input())
dat = []
for i in range(n):
    t = []
    an = int(input())
    for i in range(an):
        x, y = map(int, input().split())
        x -= 1
        t.append([x,y])
    dat.append(t)

res = 0

bin_a = ["{:015b}".format(a) for a in range(0, 2**n)]
bin_a = list(map(lambda x: [int(y) for y in list(x)], bin_a))
#print(dat)

for x in bin_a:
    x.reverse()
    #print("pattttttttttttttttt", x)
    r = 0
    f = True
    tmp = [-1] * n
    for i in range(n):
        if x[i] == 1:
            #print("i", i)
            for y in dat[i]:
                #print("y", y)
                if y[1] == 0 and x[y[0]] == 0:
                    if tmp[y[0]] != 1:
                        tmp[y[0]] = 0
                        continue
                    f = False
                if y[1] == 1 and x[y[0]] == 1:
                    if tmp[y[0]] != 0:
                        tmp[y[0]] = 1
                        continue
                    f = False
                f = False
    if f:
        res = max(res, sum(x))
print(res)


Measured memory_bytes: 12328
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    if(N >= 1000)cout << "ABD" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 256
s = input()
o = "No"
if s == s[::-1]:
  o = "Yes"
n = len(s)
if s[:int((n-1)/2)] != str(s[:int((n-1)/2)])[::-1]:
  o = "No"
if s[int((n+3)/2)-1:] != (s[int((n+3)/2)-1:])[::-1]:
  o = "No"
print(o)
    

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  ll a,b,c;
  cin >> a >> b >> c;

  if(((a+b)<c) && ((4*a*b)<((c-a-b)*(c-a-b)))) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
int n;

struct Point
{
    double x, y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator -(Point a)
    {
        return Point(x-a.x,y-a.y);
    }
};
double cross(Point a,Point b)
{
    return a.x*b.y-b.x*a.y;
}
double dot(Point a,Point b)
{
    return a.x*b.x+a.y*b.y;
}
Point p0,p1,p2,p3;
void solve()
{
    if(dot(p1-p0,p3-p2)==0) printf("1\n");
    else if(cross(p1-p0,p3-p2)==0) printf("2\n");
    else printf("0\n");
}

int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    while(n--)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&p0.x,&p0.y,&p1.x,&p1.y,&p2.x,&p2.y,&p3.x,&p3.y);
        solve();
    }

    return 0;
}

Measured memory_bytes: 3228
#include <iostream>
#include <vector>
using namespace std;
int n;
vector<int> h(100000);
vector<int> cost(100000);

int ans(int n)
{
    if (cost.at(n) != -1)
        return cost.at(n);
    cost.at(n) = min(ans(n - 1) + abs(h.at(n) - h.at(n - 1)),
                     ans(n - 2) + abs(h.at(n) - h.at(n - 2)));
    return cost.at(n);
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> h.at(i);
        cost.at(i) = -1;
    }
    cost.at(0) = 0;
    cost.at(1) = abs(h.at(1) - h.at(0));
    cout << ans(n - 1) << endl;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s,t;
  cin>>s;
  cin>>t;
  for (int l=n;l>=0;l--){
    if(s.substr(n-l)==t.substr(0,l)){
      cout<<2*n-l<<endl;
return 0;}
  }}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
 /* #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll n;
  cin>>n;
  ll f=n/15;
  f*=200;
  cerr<<f<<endl;
  cout<<(800*n-f)<<endl;
  

}
return 0;
}


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

int main() {

  int n, m, l;
  cin >> n >> m >> l;
  
  vector<vector<long int>> A(n, vector<long int>(m));
  vector<vector<long int>> B(m, vector<long int>(l));
  
  for (int i=0; i<n; i++) {
	for (int j=0; j<m; j++) {
	  cin >> A.at(i).at(j);
    }
  }
  for (int j=0; j<m; j++) {
	for (int k=0; k<l; k++) {
	  cin >> B.at(j).at(k);
    }
  }
  
  vector<vector<long int>> X(n, vector<long int>(l));
  for (int i=0; i<n; i++) {
	for (int k=0; k<l; k++) {
	  for (int j=0; j<m; j++) {
		X.at(i).at(k) += A.at(i).at(j) * B.at(j).at(k);
      }
      cout << X.at(i).at(k) ;
      if (k != l-1) {
		cout << ' ';
      }
    }
    cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3200
s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
    if operation[0] == '1':
        n = not n
    if operation[0] == '2':
        t , f, c = operation
        f = int(f)
        if n:
            f = 1 if f != 1 else 2
        if f == 1:
            left=c+left
        elif f == 2:
            right+=c
s = left+s+right
print(s[::-1] if n else s)

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

#define LL long long
int cnt[100005];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, x, mx = 0, mn = 1e9, m, y; cin >> n; m = n;
    while(n--) {
        cin >> x;
        ++cnt[x];
        mx = max(x, mx);
        mn = min(x, mn);
    }    
    n = m;

    if(mx != mn && mx != mn + 1) {
        cout << "No"; return 0;
    }

    if(mn == mx && ((mn == n - 1 && mx == n-1) || (mx * 2 <= n))) {
        cout << "Yes"; return 0;
    }

    x = cnt[mn], y = cnt[mx];
    if(x + 1 > mx  || x + y / 2 < mx) {
        cout << "No"; return 0;
    }
    cout << "Yes";
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h> 
int main()
{
	
	int x,a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		if(a<b)
		printf("0\n");
		else
		printf("%d\n",a-b); 
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

const int MAX = 100;

int BubbleSort(int *A, int n)
{
    int cnt = 0;
    for (int i = 0; i < n; ++i)
        for (int j = n-1; j > 0; --j)
            if (A[j] < A[j-1]) {
                int save = A[j];
                A[j] = A[j-1];
                A[j-1] = save;
                ++cnt;
            }
    return cnt;
}

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

    int A[MAX];
    int N, cnt;
    std::cin >> N;
    for (int i = 0; i < N; ++i)
        std::cin >> A[i];
    cnt = BubbleSort(A, N);
    for (int i = 0; i < N; ++i) {
        std::cout << A[i];
        if (i < N-1) std::cout << " ";
        else std::cout << std::endl;
    }
    std::cout << cnt << std::endl;

    return 0;
}



Measured memory_bytes: 3168
#!/usr/bin/env python3
import sys
import bisect
import itertools


def solve(N: int, L: "List[int]"):
    L.sort()
    L = tuple(L)
    ans = 0
    ans = sum([bisect.bisect_left(L, a+L[j]) - j - 1
               for i, a in enumerate(L[:-1], 1) for j in range(i, N)])
    print(ans)
    return


def main():
    def iterate_tokens():
        for sent in sys.stdin:
            for token in sent.split():
                yield token
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, L)


if __name__ == '__main__':
    main()


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

int main(){
  int n,m,x,y;
  cin >> n >> m >> x >> y;
  int a=(n/x)*(m/y);
  int b=n*m-a;
  if(n%x==0&&m%y==0){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
    int c=1e9/b;
    b*=c;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=m;j++){
        if(i%x==0&&j%y==0){
          cout << -b;
        }
        else{
          cout << (b-1)/(x*y-1);
        }
        cout << " ";
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
 using namespace std;
 #define ll long long
 int last_ind[1000001];
void update(ll BIT[],ll val,int ind,int n){
    while(ind<=n){
        BIT[ind]+=val;
        ind+=(ind&(-ind));
    }
}
ll sum(ll BIT[],int ind){
    ll ans=0;
    while(ind>0){
        ans+=BIT[ind];
        ind-=(ind&(-ind));
    }
    return ans;
}
void rangeUpdate(ll BIT[],int n,int s,int e,ll val){
   update(BIT,val,s,n);
   update(BIT,-val,e+1,n);
}
class queries{
   public:
     int l;
     int r;
     int pos;
     int ans;
    queries(int l,int r,int pos){
     this->l=l;
     this->r=r;
     this->pos=pos;
   }  
   void setAns(int ans){
     this->ans=ans;
   }
};
  bool cmp(queries q1,queries q2){
    return q1.r<q2.r;
  }
  bool PosCmp(queries q1,queries q2){
    return q1.pos<q2.pos;
  }
  
        int main()
        {
          ios::sync_with_stdio(false);
          cin.tie(0);
          cout.tie(0);
          int n,q;
          cin>>n>>q;
          vector<int>v(n);
          for(int i=0;i<n;i++) cin>>v[i];
          // int q;
          // cin>>q;
          vector<queries>query;
          for(int i=0;i<q;i++){
            int x,y;
            cin>>x>>y;
            queries qry(x,y,i);
            query.push_back(qry);
          }
          sort(query.begin(),query.end(),cmp);
          vector<bool>a(n,0);
          ll BIT[n+1]={0};
          int j=0;
          memset(last_ind,-1,sizeof(last_ind));
          for(int i=0;i<n;i++){
              if(last_ind[v[i]]!=-1){
                a[last_ind[v[i]]]=0;
                update(BIT,-1,last_ind[v[i]]+1,n);
              }
              a[i]=1;
              update(BIT,1,i+1,n);
              last_ind[v[i]]=i;
              while(j<q && query[j].r==i+1){
                 int ans=sum(BIT,query[j].r)-sum(BIT,query[j].l-1);
                 query[j].setAns(ans);
                 j++;
              }
          }
          sort(query.begin(),query.end(),PosCmp);
          for(auto x:query){
            cout<<x.ans<<'\n';
          }
            return 0;
        }

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

int main(){
	string s; cin>>s;
  	if(s[2]==s[3] && s[4]==s[5]){
    cout<<"Yes";
    }
  	else{
    cout<<"No";
    }
  cout<<"\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{
    string s;
    int n, m, k;

    public void AtCoder()
    {
        string[] input;
        input = Console.ReadLine().Split(' ');
        s = input[0];
        n = 0;
        for(int i=0; i<s.Length; i++)
        {
            if (s[i] == 'x') n++;
        }
        if (n >= 8) s = "NO";
        else s = "YES";
        Console.WriteLine(s);
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11092
//#define _USE_MATH_DEFINES
//#include <math.h>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    
    string s,p;
    cin >> s >> p;
    s += s;
    string out = "No";
    for(int i = 0; i < s.length()-p.length(); i++){
        int count = 0;
        for(int j = 0; j < p.length(); j++){
            if(s[i+j] == p[j]) count++;
        }
        if(count == p.length()){
            out = "Yes";
            break;
        }
    }
    cout << out << endl;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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 (a>b) { a=b; return 1; } return 0; }



int main() {
    //string S; cin>>S;
    //int A,B; cin>>A>>B;
    int m1,m2,d1,d2; cin>>m1>>d1>>m2>>d2;



    cout<<((m1==m2)?0:1)<<endl;
    //cout<<A<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
int k;
string s;
int main(){
	IOS
	cin >> k >> s;
	int a=s.length();
	if(a>k){
		for(int i=0;i<k;i++){
			cout << s[i];
		}
		cout << "...";
	}
	else{
		cout << s << '\n';
	}
}

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

namespace paizaTest
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var count = int.Parse(Console.ReadLine());
            var oneLine = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            Console.WriteLine(string.Join(" ", oneLine.Select(x => x.ToString()).ToArray()).Trim());

            for (int i = 1; i < count; i++)
            {
                var v = oneLine[i];
                var j = i - 1;
                while (j >= 0 && oneLine[j] > v)
                {
                    oneLine[j + 1] = oneLine[j];
                    j--;
                    oneLine[j + 1] = v;
                }
                Console.WriteLine(string.Join(" ", oneLine.Select(x => x.ToString()).ToArray()).Trim());
            }
        }
    }
}

Measured memory_bytes: 9624
url = "https://atcoder.jp//contests/abc072/tasks/arc082_b"

def main():
    n = input()
    p = list(map(int, input().split()))
    count = 0
    for i, v in enumerate(p):
        if i == len(p)-1 and i+1 == v:
            count += 1
            break
        if i+1 == v:
            p[i] = p[i+1]
            p[i+1] = v
            count += 1
    print(count)


if __name__ == '__main__':
    main()



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

#define REP(i,num) for(int i=0;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;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(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)...);}

class Combination{
	constexpr static int atcoder_mod = 1000000007;
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r]);
	}
	ll GetFInv(ll i){
		return finv[i];
	}
};

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

	int N=in(),A=in(),B=in();
	map<ll,ll,greater<ll>> M;
	REP(i,N){
		M[in<ll>()]++;
	}
	double ansA=0;
	ll ansN=0;

	vector<vector<ll>> comb(N+1,vector<ll>(N+1,0));
	comb[0][0]=1;
	for(int i=1;i<=N;i++){
		for(int j=0;j<=N;j++){
			if(j==0) comb[i][j]=1;
			else if(j==i){
				comb[i][j]=1;
				break;
			}
			else{
				comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
			}
		}
	}
	auto comb_calc = [&](int n,int r){
		if(r==0 || r==n) return 1LL;
		return comb[n][r];
	};

	ll v=1,rest=A,sum=0,restV;
	for(auto& x:M){
		if(rest-x.second<0){
			sum += rest*x.first;
			v = comb_calc(x.second,rest);
			restV = x.second;
			break;
		}
		sum += x.second*x.first;
		rest -= x.second;
	}
	ansA = sum/(double)(A);

	if(rest==A){
		for(int i=A;i<=B;i++){
			ansN += comb_calc(restV,i);
		}
	}
	else{
		ansN = comb_calc(restV,rest);
	}
	
	out(ansA);
	out(ansN);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{char a[100];
 cin>>a;
 for(int i=0;i<strlen(a);i++)
    {if(a[i]=='C')
       {for(int j=i+1;j<strlen(a);j++)
           if(a[j]=='F')
             {cout<<"Yes"<<endl;
              return 0;
			 }
	   }
	}
 cout<<"No"<<endl;
}

Measured memory_bytes: 256
N = int(input())
H = [int(v) for v in input().split()]

for i, h in enumerate(H):
    if i > 0 and H[i - 1] < h:
        H[i] -= 1

tmp = -1
for h in H:
    if h < tmp:
        print('No')
        exit()
    tmp = h
print('Yes')


Measured memory_bytes: 14396
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

struct Node
{
    public int Num, N;
    public Node(int num, int n)
    {
        Num = num;
        N = n;
    }
}

struct W
{
    public int X, Y, D;
    public W(int x, int y, int d)
    {
        X = x;
        Y = y;
        D = d;
    }
}

public class UnionFind
{
    private int[] Par;
    private int[] Rank;

    public UnionFind(int n)
    {
        Par = (new int[n]).Select((i, index) => index).ToArray();
        Rank = new int[n];
    }

    public int Root(int a)
    {
        if (Par[a] == a) return a;
        else return Root(Par[a]);
    }

    public bool Same(int a, int b)
    {
        return Root(a) == Root(b);
    }

    public bool Union(int a, int b)
    {
        a = Root(a);
        b = Root(b);
        if (a != b)
        {
            if (Rank[a] < Rank[b])
            {
                Par[a] = b;
            }
            else
            {
                Par[b] = a;
                if (Rank[a] == Rank[b])
                {
                    Rank[a]++;
                }
            }
            return true;
        }
        else
        {
            return false;
        }
    }
}

class Magatro
{
    private int N;
    private Node[] x, y;

    public void Solve()
    {
        N = int.Parse(Console.ReadLine());
        x = new Node[N];
        y = new Node[N];
        for (int i = 0; i < N; i++)
        {
            var line = Console.ReadLine().Split(' ');
            x[i] = new Node(i, int.Parse(line[0]));
            y[i] = new Node(i, int.Parse(line[1]));
        }

        Array.Sort(x, (a, b) => a.N.CompareTo(b.N));
        Array.Sort(y, (a, b) => a.N.CompareTo(b.N));
        var l = new List<W>();
        for (int i = 1; i < N; i++)
        {
            l.Add(new W(x[i].Num, x[i - 1].Num, x[i].N - x[i - 1].N));
            l.Add(new W(y[i].Num, y[i - 1].Num, y[i].N - y[i - 1].N));
        }
        l.Sort((a, b) => a.D.CompareTo(b.D));
        var uf = new UnionFind(N);
        long ans = 0;
        foreach (var w in l)
        {
            if (uf.Union(w.X, w.Y))
            {
                ans += w.D;
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 26820
#include<bits/stdc++.h>
using namespace std;
const int mx=123456;
#define ll long long
#define p push_back
#define ff first
#define ss second
ll n,s[mx],sum;
int main(){
    for(int i=0;i<3;i++){
        cin>>s[i];
    }
    sort(s,s+3);
    sum+=s[2]-s[0];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256