akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){

  int n,a[1000000]={0};

  for(int i=2;i*i<=1000000;i++){
    if(a[i]==0){
      for(int j=i+i;j<=1000000;j+=i) a[j]=1; 
    }
  }

  while(cin >> n){

    for(int i=n-1;i>=2;i--){
      if(a[i]==0){
	cout << i << ' ';
	break;
      }
    }

    for(int i=n+1;i<=1000000;i++){
      if(a[i]==0){
	cout << i << endl;
	break;
      }
    }

  }
}

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

fn main() {
    let stdin = stdin();
    let mut lock = stdin.lock();
    let mut str1 = String::new();
    lock.read_line(&mut str1).unwrap();
    let mut vec:Vec<_> = str1.trim().split_whitespace().map(|x| u32::from_str(x).unwrap()).collect();
    vec.sort();
    println!("{}", vec[0] + vec[1]);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main()
{
    int n,i,l;
    char a[10000];
    scanf("%d",&n);
    scanf("%s",a);
    l=strlen(a);
    for(i=0;i<l;i++)
    {
        if(a[i]<='Z'-n)
            a[i]=a[i]+n;
        else
            a[i]=a[i]-26+n;
    }
    puts(a);



    return 0;
}



Measured memory_bytes: 128
#define rep(i, n) for(ll i = 0; i < n; i++)
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;

//n桁(n>=3)の七五三数の数をカウント
int f(int n) {
	if (n<=2) return 0;
	return pow(3,n) - 3 * pow(2,n) + 3;
}

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main() {
	ll n;
	cin >> n;
	int number[3] = {3,5,7};
	int digit = GetDigit(n);
	int ans = 0;
	rep(i,digit) ans += f(i);
	int num_lp = pow(3,digit);
	rep(i,num_lp) {
		int tmp = i;
		int x = 0;
		vector<int> keta(digit);
		bool used[3] = {false, false, false};
		rep(j,digit) {
			int r = tmp % 3;
			keta[digit-1-j] = number[r];
			tmp /= 3;
			used[r] = true;
		}
		rep(j,digit) {
			x += keta[j];
			if (j!=digit-1) x *= 10;
		}
		bool fl = true;
		rep(i,3) if (!used[i]) fl = false;
		if (fl) {
			//printf("%d\n", x);
			if (x<=n) ans++;
			else break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat gcd(cat x, cat y) {
	if(x > y) swap(x, y);
	return (x == 0) ? y : gcd(y%x, x);
}

cat lcm(cat x, cat y) {
	return x / gcd(x, y) * y;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< vector<cat> > A(N, vector<cat>(N, 1));
	vector<int> P;
	for(int p = 4; ; p++) {
		bool is_prime = true;
		for(int i = 2; i*i <= p; i++) is_prime &= (p%i != 0);
		if(!is_prime) continue;
		P.push_back(p);
		if((int)P.size() == N+10) break;
	}
	for(int i = 0; i < N; i += 2) for(int j = 0; j < N; j += 2) A[i][j] = P[i/2] * P[N/2+1+j/2];
	for(int i = 1; i < N; i += 2) for(int j = 1; j < N; j += 2) A[i][j] = 3 * A[i-1][j-1];
	for(int i = 0; i < N; i++) for(int j = 1-(i&1); j < N; j += 2) {
		if(i > 0) A[i][j] = lcm(A[i][j], A[i-1][j]);
		if(j > 0) A[i][j] = lcm(A[i][j], A[i][j-1]);
		if(i+1 < N) A[i][j] = lcm(A[i][j], A[i+1][j]);
		if(j+1 < N) A[i][j] = lcm(A[i][j], A[i][j+1]);
		if(j&1) A[i][j] *= 2;
		A[i][j]++;
	}
	for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) cout << A[i][j] << ((j == N-1) ? "\n" : " ");
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 4992
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

x,t=get_i
if x-t<=0
  puts 0
else
  puts x-t
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


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

    vector<vector<int>> a(n, vector<int>());
    vector<int> c(n);
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            int y;
            cin >> y;
            a[i].push_back(y);
        } 
    }

    int ans = INF;
    for(int bit=0; bit<(1<<n); bit++){
        vector<int> v(m);
        int sum = 0;
        rep(i, n){
            if((bit>>i)&1){
                sum += c[i];
                rep(j, m) v[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(i, m){
            if(v[i] < x) ok = false;
        }
        if(ok) chmin(ans, sum);
    }

    if(ans == INF) cout << "-1" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3636
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
a = list(map(int,readline().split()))

if sum(a) == 0:
    print('Yes')
    exit()

if N%3 != 0:
    print('No')
    exit()

from collections import Counter

ac = Counter(a).most_common()

if len(ac) == 3 and ac[0][1] == ac[1][1] == ac[2][1] and ac[0][0] ^ ac[1][0] == ac[2][0]:
    print('Yes')

elif len(ac) == 2 and ac[0][1] == ac[1][1]*2 and ac[0][0] ^ ac[0][0] == ac[1][0]:
    print('Yes')
else:
    print('No')


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

#ifdef _LOCAL_DEBUG
#include "templates/debug.h"
#else
#define debug(...) 
#endif

constexpr int mxn = 5e5 + 5;
int n, q, color[mxn], answer[mxn];
struct BIT {
    int t[mxn];
    void add(int i, int d) {
        for (; i < n + 2; i += i & -i)
            t[i] += d;
    }
    int get(int i) {
        int res = 0;
        for (; i > 0; i -= i & -i)
            res += t[i];
        return res;
    }
} ft;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> q;
    for (int i = 0; i < n; i++)
        cin >> color[i], color[i]--;
    vector<int> last_seen(n, n + 1);
    vector<vector<pair<int, int>>> query_at(n);
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        query_at[l - 1].emplace_back(r, i);
    }
    for (int l = n - 1; l >= 0; l--) {
        ft.add(last_seen[color[l]], -1);
        ft.add(l + 1, 1);
        last_seen[color[l]] = l + 1;
        for (auto [r, i] : query_at[l])
            answer[i] = ft.get(r);
    }
    for (int i = 0; i < q; i++)
        cout << answer[i] << '\n';
    return 0;
}   

Measured memory_bytes: 33192
#n=int(input())
a,b,c=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

if 4*a*b<(c-a-b)**2 and (c-a-b)>0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <stdio.h>
int main(void)
{
	int H, W, height, bottom;
	scanf("%d %d", &H, &W);
	while (H != 0 && W != 0)
	{
		for (height = 1; height <= H; height++)
		{
			for (bottom = 1; bottom <=W ; bottom++)
			{
				if (height % 2 == 1 && bottom % 2 == 1)
				{
					printf("#");
				}
				else if (height % 2 == 0 && bottom % 2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &H, &W);
	}
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	int N; cin >> N;
	string S, T; cin >> S >> T;
	for (int i = 0; i < N; i++) {
		cout << S[i];
		cout << T[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                print('#', end = '')
            else:
                print('.', end = '')
        print()
    print()


Measured memory_bytes: 7004
#include<iostream>
#include<vector>
using namespace std;
int main(){
	
	int N;
	cin >>N;
	
	vector<int> A(N);
	for(int i=0;i<N;i++){
		
		cin >>A.at(i);
		
	}
	
	cout <<A.at(0);
		for(int i=1;i<N;i++){
			
			cout <<" " <<A.at(i);
			
		}
		cout <<endl;
	
	for(int i=1;i<N;i++){
		
		int v=A.at(i);
		int j=i-1;
		while(j>=0&&A.at(j)>v){
			
			A.at(j+1)=A.at(j);
			j--;
			
		}
		A.at(j+1)=v;
		
		cout <<A.at(0);
		for(int i=1;i<N;i++){
			
			cout <<" " <<A.at(i);
			
		}
		cout <<endl;
		
	}
	
}


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


using namespace std;

void set_digit(int* d, int i, char* p)
{
	if (*p == 'X') d[i] = -1;
	else d[i] = *p - '0';
}

const int MaxDigits = 128;
bool canuse_zero(int* d)
{
	for (int i = MaxDigits-1; d[i] <= 0 && i >= 1; --i)
		if (d[i] == -1)
			return false;
	return true;
}
int main()
{
	while (true)
	{
		char buf[1024];
		cin.getline(buf, sizeof(buf));
		if (strlen(buf) == 0)
			break;

		int a[MaxDigits], b[MaxDigits], c[MaxDigits];
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(c, 0, sizeof(c));
		char* p = strchr(buf, '+') - 1;
		for (int i = 0; p != buf-1; ++i, --p)
			set_digit(a, i, p);
		p = strchr(buf, '=') - 1;
		for (int i = 0; *p != '+'; ++i, --p)
			set_digit(b, i, p);
		p = buf + strlen(buf) - 1;
		for (int i = 0; *p != '='; ++i, --p)
			set_digit(c, i, p);

		int start;
		if (canuse_zero(a) && canuse_zero(b) && canuse_zero(c))
			start = 0;
		else
			start = 1;

		int ans = -1;
		for (int x = start; ans == -1 && x < 10; ++x)
		{
			int sum[MaxDigits];
			int cc[MaxDigits];
			memset(sum, 0, sizeof(sum));
			memset(cc, 0, sizeof(cc));
			for (int i = 0; i < MaxDigits-1; ++i)
			{
				int ta = a[i] == -1 ? x : a[i];
				int tb = b[i] == -1 ? x : b[i];
				cc[i] = c[i] == -1 ? x : c[i];
				sum[i] += ta + tb;
				sum[i+1] = sum[i] / 10;
				sum[i] %= 10;
			}
			bool ok = true;
			for (int i = 0; ok && i < MaxDigits; ++i)
				ok = sum[i] == cc[i];
			if (ok)
				ans = x;
		}
		if (ans != -1)
			printf("%d\n", ans);
		else
			printf("NA\n");
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int len = S.length();
    String ans = "NO";
    if(len >= 5) {
      // dp[i]はインデックスi～末尾までの部分文字列に対する判定結果を返す（出来るなら1、出来ないなら-1）
      int[] dp = new int[len + 1];
      dp[len] = 1;
      dp[len - 1] = -1;
      dp[len - 2] = -1;
      dp[len - 3] = -1;
      dp[len - 4] = -1;
      dp[len - 5] = -1;
      String str = S.substring(len - 5);
      if(str.equals("dream") || str.equals("erase")) dp[len - 5] = 1;
      for(int i = len - 6; i >= 0; i--) {
        dp[i] = -1;
        String str5 = S.substring(i, i + 5);
        String str6 = S.substring(i, i + 6);
        if((str5.equals("dream") || str5.equals("erase")) && dp[i + 5] == 1) dp[i] = 1;
        if(str6.equals("eraser") && dp[i + 6] == 1) dp[i] = 1;
        if(i + 7 <= len) {
          String str7 = S.substring(i, i + 7);
          if(str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
        }
      }
      if(dp[0] == 1) ans = "YES";
    }
    System.out.println(ans);
  }
}

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

int main() {

    int n;
    cin >> n;
    vector<long> a(3*n);

    for(int i = 0; i < 3*n; i++){
          cin >> a.at(i);
    }

    sort(a.begin(), a.end(), greater<long>());
    
    long sum = 0;
    for( int i = 0; i < n ; i++ ){
        sum += a.at(2*i+1);
    }
    

    cout << sum << endl;


}



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

using namespace std;

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

	int num[101] = {0};
	for(int i=0; i<n; i++) num[d[i]]++;

	int count = 0;
	for(int i=1; i<=101; i++) if(num[i]) count++;
	
	cout << count << endl;
}

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

int main(){
    int D, G;
    cin >> D >> G;
    int p[D], c[D];
    for(int i=0; i<D; i++){
        cin >> p[i] >> c[i];
    }

    int min_count = 1e9;
    for(int bit=0; bit<(1<<D); bit++){
        long long temp = 0;
        int high = 0;
        int count = 0;
        for(int i=0; i<D; i++){
            if(bit >> i & 1){
                temp += 100*(i+1) * p[i] + c[i];
                count += p[i];
            }else{
                high = i;
            }
        }

        int j = 0;
        while(temp<G && j<(p[high]-1)){
            temp += 100*(high+1);
            count++;
            j++;
        }

        if(temp>=G && min_count > count) min_count = count;
    }

    cout << min_count << endl;
}


Measured memory_bytes: 256
S = input()
ahead = S[0:2]
post = S[2:]

if (ahead == '00' or int(ahead) > 12):
    a_judge = True
else:
    a_judge = False

if (post == '00' or int(post) > 12):
    p_judge = True
else:
    p_judge = False

if (a_judge and p_judge):
    ans = 'NA'
elif (a_judge):
    ans = 'YYMM'
elif (p_judge):
    ans = 'MMYY'
else:
    ans = 'AMBIGUOUS'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
#define pb push_back
#define en "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=e; i>=s; i--)
#define asort(arr,n) sort(arr,arr+n)
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(),greater<int>())
#define ff first
#define ss second
#define aout(a) for (auto u:a) {cout<<u<<" ";}cout<<en;
 
 
#define out(x1) cout << x1 << en
#define out2(x1,x2) cout << x1 << " " << x2 << en
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << en
 
 
#define in(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
 
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << en;
 
 
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
ll n;
  in(n);
  if (n==0){out(0);}
  else if (n%1000==0){out(0);}
  else{
  out(1000-(n%1000));
 }
 
 
    return 0;
}

Measured memory_bytes: 3640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric> // next_parmutation

using namespace std;

int main() {
    string A;
    cin >> A;
    if(A == "ABC") cout << "ARC" << endl;
    if(A == "ARC") cout << "ABC" << endl; 
    



}

Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int x; cin>>x;
	if(400 <= x && x < 600)cout<<8<<endl;
	if(600 <= x && x < 800)cout<<7<<endl;
	if(800 <= x && x < 1000)cout<<6<<endl;
	if(1000 <= x && x < 1200)cout<<5<<endl;
	if(1200 <= x && x < 1400)cout<<4<<endl;
	if(1400 <= x && x < 1600)cout<<3<<endl;
	if(1600 <= x && x < 1800)cout<<2<<endl;
	if(1800 <= x && x < 2000)cout<<1<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(void){
    int a, b, tmp;
    while(1){
        scanf("%d%d", &a, &b);
        if(a || b){
            if(a > b) {tmp=a; a=b, b=tmp;}
            printf("%d %d\n", a, b);
        }
        else break;
    }
    return 0;
}


Measured memory_bytes: 2032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_D
{
    class D060
    {
        static void Main(string[] args)
        {
            int[] h = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            int N = h[0], W = h[1];

            int[,] sumValue = new int[N * 3 + 1, N+1];
            for(int i = 0; i <= 3 * N; i++)
            {
                for(int j = 0; j <= N; j++)
                {
                    sumValue[i, j] = int.MinValue;
                }
            }
            sumValue[0, 0] = 0;

            int w1 = 0;
            for(int i = 0; i < N; i++)
            {
                int[] p = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
                if (i == 0) w1 = p[0];
                int w = p[0] - w1, v = p[1];

                for (int k = N; k > 0; k--)
                {
                    for (int j = N * 3; j >= w; j--)
                    {
                        if (sumValue[j - w, k - 1] >= 0 && sumValue[j - w, k - 1] + v > sumValue[j, k])
                            sumValue[j, k] = sumValue[j - w, k - 1] + v;
                    }
                }

            }


            long maxVal = 0;
            for(int i = 0; i <= 3 * N; i++)
            {
                for(int j = 0; j <= N; j++)
                {
                    long sumWgt = i + j * (long)w1;
                    if (sumWgt <= W && sumValue[i, j] > maxVal) maxVal = sumValue[i, j]; 
                }
            }
            Console.WriteLine(maxVal);
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
int main()
{
    int x,y,W,H,r;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    if((x>=r&&x<=W-r)&&(y>=r&&y<=H-r))
        printf("Yes\n");
    else
        printf("No\n");
}



Measured memory_bytes: 2704
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	vector<int> a;
	for (int i = 0; i < 3; i++)
	{
		int n;
		scanf("%d", &n);
		a.push_back(n);
	}
	sort(a.begin(),a.end());
	printf("%d %d %d\n", a[0], a[1], a[2]);
	return 0;
}

Measured memory_bytes: 2792
#include<bits/stdc++.h>
using namespace std;
int n,m,dx[4]={0,0,1,-1},dy[4]={1,-1,0,0},cnt,mp[444][444];
long long ans,cnt1[444*444],cnt2[444*444];
char b[444][444];
bool vis[444][444];
bool ch(int x,int y)
{
	return (x<n && x>=0 && y<m && y>=0);
}
void dfs(int x,int y,int ct,char step)
{
	if(vis[x][y])
	{
		return;
	}
	mp[x][y]=ct;
	vis[x][y]=true;
	if(b[x][y]=='.')
	{
		cnt1[ct]++;
	}
	else
	{
		cnt2[ct]++;
	}
	if(step=='#')
	{
		step='.';
	}
	else
	{
		step='#';
	}
	for(int i=0;i<4;i++)
	{
		int nx=x+dx[i],ny=y+dy[i];
		if(!ch(nx,ny) || b[nx][ny]!=step)
		{
			continue;
		}
		dfs(nx,ny,ct,step);
	}
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>b[i][j];
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(!vis[i][j])
			{
				dfs(i,j,cnt,b[i][j]);
				cnt++;
			}
		}
	}
	for(int k=0;k<cnt;k++)
	{
		ans+=cnt1[k]*cnt2[k];
	}
	cout<<ans<<endl;
	return 0;
}

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

typedef long long int LLI;
typedef pair<LLI, LLI> Pair;

int N;
LLI W, H;
LLI ansx, ansy;
LLI ans = 0x7fffffffffffff;
Pair ps[114514];
vector<LLI> xs;
vector<LLI> ys;

int main() {
  scanf("%lld%lld", &W, &H);
  scanf("%d", &N);
  for (int i=0; i<N; i++) {
    LLI x, y;
    scanf("%lld%lld", &x, &y);
    ps[i] = Pair(x, y);
    xs.emplace_back(x);
    ys.emplace_back(y);
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  int k = 1 + (N%2 == 0);
  for (int p=0; p<k; p++) {
    for (int q=0; q<k; q++) {
      LLI cand = 0;
      LLI x = xs[N/2-p];
      LLI y = ys[N/2-q];
      LLI maxt = 0;
      for (int i=0; i<N; i++) {
        LLI t = llabs(ps[i].first-x) + llabs(ps[i].second-y);
        cand += t*2;
        maxt = max(maxt, t);
      }
      cand -= maxt;
      if (ans > cand) {
        ans = cand;
        ansx = x;
        ansy = y; 
      } else if (ans == cand) {
        if (ansx > x) {
          ansx = x;
          ansy = y;
        } else if (ansx == x && ansy > y) {
          ansx = x;
          ansy = y;
        }
      }
    }
  }
  printf("%lld\n", ans);
  printf("%lld %lld\n", ansx, ansy);
}
  

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

using namespace std;

int main(){	
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	vector <int> v(n);
	for (auto &x : v){
		cin >> x;
	}	
	int ans = 0;
	for (int i = 0; i < n; i++){
		if ((i+1)%2 != 0 && v[i]%2 != 0){
			++ans;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define inc(i,j,l) for(int i=j;i<=l;i++)
#define dec(i,j,l) for(int i=j;i>=l;i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,r;
    cin>>n>>r;
    if(n>=10)
        cout<<r;
        else
    cout<<(r+(100*(10-n)));
    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=str(input())
ans=0
for i in range(0,1000):
    i=str(i).zfill(3)
    #print(i)
    x=s.find(i[0])
    y=s.find(i[1],x+1)
    z=s.find(i[2],y+1)
    if x!=-1 and y!=-1 and z!=-1:
        ans+=1
        #print(i,x,y,z)
print(ans)


    

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll A, B, C;
    cin >> A >> B >> C;
    
    if(A == B && B == C && C == A && A % 2 == 0 && B % 2 == 0 && C % 2 == 0) PR(-1);
    else {
        ll cnt = 0;
        ll _A = A, _B = B, _C = C;
        while(_A%2==0 && _B%2==0 && _C%2==0) {
            A = (_B + _C) / 2;
            B = (_C + _A) / 2;
            C = (_A + _B) / 2;
            _A = A;
            _B = B;
            _C = C;
            ++cnt;
        }
        PR(cnt);
    }

    return 0;
}

/*

2 2 2
1 1 1
1 1 1

*/

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){
  
  int k;
  cin >> k;
  queue<ll> que;
  for(int i = 1;i < 10;i++)que.push(i);
  for(int i = 0;i < k-1;i++){
    int n = que.front();que.pop();
    if(n%10 == 9)que.push(10*n+8),que.push(10*n+9);
    else if(n%10 == 0)que.push(10*n),que.push(10*n+1);
    else for(int j = -1;j < 2;j++)que.push(10ll*n+n%10ll+j);
  }
  cout << que.front() << endl;







  return 0;
}

Measured memory_bytes: 1792
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int A, B, C;
	cin >> A >> B >> C;

	cout << (A ^ B ^ C) << "\n";

	return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = [0] * 100001
for i in range(6):
    ans[i] = i
s = 6
n = 9
for i in range(6,N+1):
    p = i%3
    if p != 0:
        ans[i] =  ans[i-p] + p
    else:
        if i == s*6:
            s *= 6
        if i == n*9:
            n *= 9
        ans[i] = min(ans[i-s]+1,ans[i-n]+1)
print(ans[N])

Measured memory_bytes: 9568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    while(1){
    int n,x;
    cin >> n >> x;
    if(n==0) return 0;
    int count=0;
    for(int i=1;i<=n-2;i++){
        for(int j=i+1;j<=n-1;j++){
            for(int k=j+1;k<=n;k++){
                if(i+j+k==x) count++;
            }
        }
    }
    cout << count << endl;
    }
}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        Array.Sort(A);

        int maxA = A.Max();
        bool[] ng = new bool[maxA+1];
        int ans = 0;
        for (int i = 0; i < N-1; i++)
        {
            if (ng[A[i]]) continue;
            if (A[i] != A[i + 1]) ans++;
            for (int j = A[i]; j <=maxA; j+=A[i])
            {
                ng[j] = true;
            }
        }
        if (!ng[A[N - 1]]) ans++;
        WriteLine(ans);
    }
}


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

using ll = long long;

template <int Mod, bool IsPrime = false>
class mod_int {
    using ll = long long;

public:
    constexpr mod_int() : n(0) {}
    constexpr mod_int(int n_) : n(n_) {
        if(n >= Mod)     n %= Mod;
        else if(n < 0) n = (n % Mod + Mod) % Mod;
    }
    constexpr mod_int(ll n_) : n(n_) { n = (n + Mod) % Mod; }

    constexpr operator int() const { return n; }
    constexpr operator ll() const  { return n; }

    constexpr bool operator==(mod_int const& other) const { return n == other.n; }
    constexpr mod_int& operator+=(mod_int const& other) {
        if((n += other.n) >= Mod) n -= Mod;
        return *this;
    }
    constexpr mod_int& operator-=(mod_int const& other) {
        if((n += Mod - other.n) >= Mod) n -= Mod;
        return *this;
    }
    constexpr mod_int& operator*=(mod_int const& other) {
        n = (unsigned long long)n * other.n % Mod;
        return *this;
    }
    constexpr typename std::enable_if<IsPrime, mod_int>::type& operator/=(mod_int const& other) {
        return *this *= other.inverse();
    }
    constexpr mod_int operator+(mod_int other) const { return mod_int(*this) += other; }
    constexpr mod_int operator-(mod_int other) const { return mod_int(*this) -= other; }
    constexpr mod_int operator*(mod_int other) const { return mod_int(*this) *= other; }
    constexpr mod_int operator/(mod_int other) const { return mod_int(*this) /= other; }

    constexpr typename std::enable_if<IsPrime, mod_int>::type inverse() const {
        ll a = n, b = Mod, u = 1, v = 0;
        while(b) {
            ll t = a / b;
            a -= t * b; std::swap(a, b);
            u -= t * v; std::swap(u, v);
        }
        return mod_int(u);
    }

private:
    ll n;
};

template <int Mod, bool IsPrime>
std::ostream& operator<<(std::ostream& os, mod_int<Mod, IsPrime> const& n) {
    os << (int)n;
    return os;
}

constexpr int default_mod = 1000000007;

using mint = mod_int<default_mod, true>; // default

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(auto& x : a) cin >> x;

    vector<map<int, int>> cnt(n);
    vector<int> maxi(1 << 20);
    for(int i = 0; i < n; ++i) {
        int tmp = a[i];
        for(int x = 2; x * x <= tmp; ++x) {
            int c = 0;
            while(tmp % x == 0) {
                tmp /= x;
                c += 1;
            }
            if(c) cnt[i][x] = c;
            maxi[x] = max(maxi[x], c);
        }
        if(tmp > 1) {
            cnt[i][tmp] = 1;
            maxi[tmp] = max(maxi[tmp], 1);
        }
    }

    mint ab = 1;
    for(int i = 2; i < 1 << 20; ++i) {
        for(int lp = 0; lp < maxi[i]; ++lp) {
            ab *= i;
        }
    }

    mint ans = 0;
    for(auto const& mp : cnt) {
        mint cur = ab;
        for(auto const& p : mp) {
            const int val = p.first, cnt = p.second;
            for(int lp = 0; lp < cnt; ++lp) {
                cur /= val;
            }
        }
        ans += cur;
    }

    cout << ans << endl;
}


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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int now = 0;
    vector<int> ans;
    while(now != n){
        bool ng = true;
        for(int i=min(m,n-now);i>=1;i--){
            if(s[now+i]=='0'){
                ng = false;
                now += i;
                ans.push_back(i);
                break;
            }
        }
        if(ng){
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(ans.begin(),ans.end());
    for(auto i:ans){
        cout << i << " ";
    }
    cout << endl;

}

Measured memory_bytes: 1096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    scanf("%d",&n);
    int q;
    scanf("%d",&q);
    vector<int> c(n);
    rep(i,n) scanf("%d",&c[i]),--c[i];
    vector<int> l(q),r(q);
    rep(i,q){
        scanf("%d %d",&l[i],&r[i]);
        --l[i];
    }

    int sq = sqrt(n);
    vector<int> qi(q,0);
    for(int i=0;i<q;i++) qi[i] = i;
    sort(qi.begin(),qi.end(),[&](const int &i,const int &j){
        if(l[i] / sq != l[j] / sq) return l[i] < l[j];
        if((l[i] / sq)%2 == 1) return r[i] > r[j];
        return r[i] < r[j];
    });

    vector<int> cnt(n,0);
    int ans = 0;

    auto add = [&](int id){
        //if(id<0 ||id>=n) return;
        if(cnt[c[id]]==0) ++ans;
        ++cnt[c[id]];
    };

    auto del = [&](int id){
        //if(id<0 ||id>=n) return;
        if(cnt[c[id]]==1) --ans;
        --cnt[c[id]];
    };

    
    vector<int> queryans(q);
    int nl = 0,nr = 0;
    for(int i:qi){
        //cout << nl << " " << nr  << endl;
        while(nl > l[i]) --nl,add(nl);
        while(nr < r[i]) add(nr),++nr;
        while(nl < l[i]) del(nl),++nl;
        while(nr > r[i]) --nr,del(nr);

        queryans[i] = ans;
    }

    rep(i,q) printf("%d\n",queryans[i]);
    return 0;
}

Measured memory_bytes: 15460
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np


def main():
	a,b=map(int,input().split())
	print(max(a-2*b,0))
	
	
	
	
	
	
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main() {
    int Student[50][3] ;
    int i = 0;
    while(1) {
        int m, f, r;
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1) break;
        Student[i][0] = m;
        Student[i][1] = f;
        Student[i][2] = r;
        i++;
    }
    for(int j = 0; j < i; j++) {
        if (Student[j][0] == -1 || Student[j][1] == -1) cout << 'F' << endl;
        else if (Student[j][0] + Student[j][1] >= 80) cout << 'A' << endl;
        else if (Student[j][0] + Student[j][1] >= 65) cout << 'B' << endl;
        else if (Student[j][0] + Student[j][1] >= 50 || Student[j][2] >= 50) cout << 'C' << endl;
        else if (Student[j][0] + Student[j][1] >= 30) cout << 'D' << endl;
        else cout << 'F' << endl;
    }

    return 0;
}


Measured memory_bytes: 3088
def lscan;gets.split.map(&:to_i);end

a,b,c,d = lscan
cd = c.lcm(d)

b += 1
total = b - a
a -= 1
b -= 1
total -= b/c - a/c
total -= b/d - a/d
total += b/cd - a/cd
p total

Measured memory_bytes: 1788
import sys
input = sys.stdin.readline


def main():
    K, T = map(int, input().split())
    A = list(map(int, input().split()))
    cakes = []
    for i, a in enumerate(A):
        cakes.append([i, a])

    pre = -1
    ans = 0
    for j in range(K):
        cakes.sort(key=lambda x: x[1], reverse=True)
        found = False
        for i in range(T):
            if cakes[i][0] != pre and cakes[i][1] > 0:
                pre = cakes[i][0]
                cakes[i][1] -= 1
                found = True
                break
        if not found:
            pre = cakes[0][0]
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import fractions
N=int(input())
l1=list(map(int,input().split()))
l2=[0]*(N+1)
l3=[0]*(N+1)
for i in range(N):
  l2[i+1]=fractions.gcd(l2[i],l1[i])
for j in range(N-1,0,-1):
  l3[j-1]=fractions.gcd(l3[j],l1[j])
ans=1
for k in range(N):
  ans=max(ans,fractions.gcd(l2[k],l3[k]))
print(ans)

Measured memory_bytes: 16148
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int H,N,A[1111],B[1111],dp[1111][11111]={};

int main() {
	cin>>H>>N;
	for(int i=1;i<=N;i++)cin>>A[i]>>B[i];
	for(int i=0;i<=H;i++)dp[0][i]=1e9;
	dp[0][0]=0;
	for(int i=1;i<=N;i++)for(int j=1;j<=H;j++)
		dp[i][j]=min(dp[i-1][j],dp[i][max(j-A[i],0)]+B[i]);
	cout<<dp[N][H]<<endl;
	return 0;
}



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

using namespace std;

#define MAX 100001
typedef vector<int> Vec;
typedef vector<Vec> Vecs;

int main(){
    int N,D,X;
    cin >> N >> D >> X;
    Vecs p(D,vector<int>(N));
    for(int i = 0 ; i < D ; i++){
        for(int j = 0 ; j < N ; j++){
            cin >> p[i][j];
        }
    }
    Vecs dp(N+1,vector<int>(MAX));
    for(int i = 0 ; i < D-1 ; i++){
        for(int j = 0 ; j < N ; j++){
            for(int k = 0 ; k <= X ; k++){
                dp[j][k] = k;
            }
        }
        for(int j = 0 ; j < N ; j++){
            for(int k = 0 ; k <= X ; k++){
                if(k < p[i][j]){
                    dp[j+1][k] = dp[j][k];
                }else{
                    dp[j+1][k] = max(dp[j][k],
                                     dp[j+1][k-p[i][j]]+p[i+1][j]);
                }
            }
        }
        int maxi = 0;
        for(int j = 0 ; j <= X ; j++){
            maxi = max(maxi,dp[N][j]);
        }
        X = max(X,maxi);
    }
    cout << X << endl;
    return 0;
}

Measured memory_bytes: 5756
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}
inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}
inline void write(long long x){
    static const int maxlen=100;
    static char s[maxlen];
        if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    int len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(int i=len-1;i>=0;--i) putchar(s[i]);
}
inline void write(int x){
    static const int maxlen=100;
    static char s[maxlen];
        if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    int len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(int i=len-1;i>=0;--i) putchar(s[i]);
}

const int maxn=120000;

int n;
long long a[maxn];


int main(){
    read(n);
    for  (int i=1;i<=n;i++)
        read(a[i]);
    sort(a+1,a+n+1);
    long long a1=0;
    long long a2=0;
    for (int i=n;i>=2;i--)
        if (a[i]==a[i-1])
        {
            if (a1==0)
            {
                a1=a[i];
                i=i-1;
            }
            else
            if (a2==0)
            {
                a2=a[i];
                break;
            }
        }
    cout<<a1*a2<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string x; cin >> x;
    int stack = 0, cnt = 0;

    for (int i = 0; i < x.size(); i++){
        if (x[i] == 'S') stack++;
        else if (stack > 0) --stack, ++cnt;
    }

   cout << x.size() - cnt*2 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


ll combination(ll n, ll r){
  // nCr を そのまま求める
  map<int,int> S;
  for (int i=n-r+1; i<=n; i++){
    int x = i;
    for (int j=2; j<=50; j++){
      while (x % j == 0){
        S[j]++; x /= j;
      }
    }
  }
  for (int i=1; i<=r; i++){
    int x = i;
    for (int j=2; j<=50; j++){
      while (x % j == 0){
        S[j]--; x /= j;
      }
    }
  }
  ll res = 1;
  for (auto p : S){
    ll k = p.first;
    int v = p.second;
    // k^v;
    for (int i=0; i<v; i++) res *= k;
  }
  return res;
}

int main() {
  int N,A,B; cin >>N >>A >>B;
  vector<ll> V(N); rep(i, N) cin >>V[i];
  sort(allR(V));
  // 降順ソート
  // 上からA個見た時の平均が最大値となる
  double avg = 0;
  rep(i, A) avg += V[i];
  avg /= A;
  cout <<fixed <<setprecision(12) <<avg <<endl;

  // で、何通りあるかは上からA個のうち最小のV[i]がいくつあるかによって決定する
  int vin = 0, vout = 0;
  for (int i=0; i<N; i++){
    if (V[i] == V[A-1]){
      if (i < A) vin++;
      else vout++;
    }
  }
  // A個取るとすると答えは, n = vin + vout, r = vin として nCr
  ll n = vin + vout;
  ll r = min(vin, vout);
  ll res = combination(n, r);
  
  // 新しくとるやつが平均に一致するなら次の作業を行う
  if (V[A-1] != (ll)avg){
    cout <<res <<endl; return 0;
  }

  // A+1個以上取るとする。新しく取るやつが平均
  for (int i=A+1; i<=B; i++){
    vin++; vout--;
    n = vin + vout;
    r = min(vin, vout);
    if (vout < 0) break;
    res += combination(n,r);
  }
  cout <<res <<endl;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions

alias point = Point!int;

void main()
{
  auto rd1 = readln.split.to!(size_t[]), n = rd1[0], m = rd1[1];
  auto a = new point[](n), c = new point[](m);
  foreach (i; 0..n) {
    auto rd2 = readln.split.to!(int[]), x = rd2[0], y = rd2[1];
    a[i] = point(x, y);
  }
  foreach (i; 0..m) {
    auto rd2 = readln.split.to!(int[]), x = rd2[0], y = rd2[1];
    c[i] = point(x, y);
  }

  foreach (ai; a) {
    auto minD = int.max, minI = size_t(0);
    foreach (j, ci; c) {
      auto p = ci - ai, d = p.x.abs + p.y.abs;
      if (d < minD) {
        minD = d;
        minI = j;
      }
    }
    writeln(minI+1);
  }
}

struct Point(T)
{
  T x, y;
  pure auto opBinary(string op: "+")(Point!T rhs) const { return Point!T(x + rhs.x, y + rhs.y); }
  pure auto opBinary(string op: "-")(Point!T rhs) const { return Point!T(x - rhs.x, y - rhs.y); }
  pure auto opBinary(string op: "*")(Point!T rhs) const { return x * rhs.x + y * rhs.y; }
  pure auto opBinary(string op: "*")(T a) const { return Point!T(x * a, y * a); }
  pure auto opBinary(string op: "/")(T a) const { return Point!T(x / a, y / a); }
  pure auto hypot2() const { return x ^^ 2 + y ^^ 2; }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll dp[100010][13];

int main(void){
    string S;
    cin>>S;
    dp[0][0]=1;
    rep(i,S.size()){
        rep(j,10){
            int c=S[i]-'0';
            if(S[i]=='?'||c==j){
                rep(k,13){
                    dp[i+1][(k*10+j)%13]+=dp[i][k];
                    dp[i+1][(k*10+j)%13]%=MOD;
                }
            }
        }
    }
    cout<<dp[S.size()][5]<<endl;
    return 0;
}




Measured memory_bytes: 10624
#include <iostream>
#include <string>
using namespace std;
void sortf(int arr[], int size ){
    for (int i = 0; i < size; ++i)
    {
        for (int j= i+1; j < size; ++j)
        {
          if (arr[j]<arr[i]){int temp=arr[j];
              arr[j]=arr[i];
              arr[i]=temp;
               }  
        }
    }
    
}
int main() {

    int a; cin>>a; int n=2*a; int arr[n];
    for (int i = 0; i < n; ++i)
    {
    cin>>arr[i];
    }
    sortf(arr,n);
    int sum=0;
    for (int i = 0; i < n; i+=2)
    {
     sum+=arr[i];     
    }
    cout<<sum;
     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++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main(){
  vector<string> s(3);
  for(int i = 0; i < 3; i++){
    cin >> s[i];
    cout << s[i][0];
  }
  
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int left = a + b;
  int right = c + d;
 
  if (left > right) {
    cout << "Left" << endl;
  }
  else if (right > left) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define ull unsigned long long
#define ld long double

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
using VVV = V<V<V<T>>>;

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define rep1(i, n) rep1(i, 1, n + 1)

// #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
// #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()  //

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    //    cout << std::setfill('0') << std::setw(2);

    long long R;
    std::cin >> R;
    long long G;
    std::cin >> G;

    cout << 2 * G - R << endl;

    return 0;
}


Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;
#define Pi atan(1)*4

float get(int x,int y,int z){
	int volume = x*x*y;
	float ans = 0.0;
	if(z < volume/2){
		float d = (x*y*y)/(2.0 *z);
		ans = atan(d);
	}else{
		z = volume - z;
		float d = (2*z)/(float)(x*x*x);
		ans = atan(d);
	}
	//cout<<Pi<<endl;
	ans = ((ans*180)/(Pi));
	//ans = ((ans*180)/Pi);
	return ans;
}

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

	cout<<setprecision(20)<<get(a,b,n)<<endl;

	return 0;
}

Measured memory_bytes: 3840
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

y = a[0]
c = 1
ans = 0
for i in range(1, n):
   if (a[i] == y):
      c += 1
   else:
      if (c % 2 == 1):
         ans += 1
      y = a[i]
      c = 1

if (c % 2 == 1):
   ans += 1

print(ans)


Measured memory_bytes: 7448
#include<stdio.h>
#include<string.h>
int judge(char str[]){
	int h,i,j;
	h=strlen(str);
	for(i=0,j=h-1;i<=j;i++,j--){
		if(str[i]!=str[j])return 0;
	}
	return 1;
}
int main(){
	char str[124];
	int i,h,c=0;
	for(;scanf("%s",str)!=EOF;){
		if(judge(str))c++;
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 0