akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
char n2c(int n){
  if(n == 0)return 'A';
  else if(n == 1 )return 'B';
  else if(n == 2 )return 'C';
  else if(n == 3 )return 'D';
  else if(n == 4 )return 'E';
  else if(n == 5 )return 'F';
  else if(n == 6 )return 'G';
  else if(n == 7 )return 'H';
  else if(n == 8 )return 'I';
  else if(n == 9 )return 'J';
  else if(n == 10)return 'K';
  else if(n == 11)return 'L';
  else if(n == 12)return 'M';
  else if(n == 13)return 'N';
  else if(n == 14)return 'O';
  else if(n == 15)return 'P';
  else if(n == 16)return 'Q';
  else if(n == 17)return 'R';
  else if(n == 18)return 'S';
  else if(n == 19)return 'T';
  else if(n == 20)return 'U';
  else if(n == 21)return 'V';
  else if(n == 22)return 'W';
  else if(n == 23)return 'X';
  else if(n == 24)return 'Y';
  else if(n == 25)return 'Z';
}
int c2n(char c){
  if(c == 'A')return 0;
  else if(c == 'B')return 1 ;
  else if(c == 'C')return 2 ;
  else if(c == 'D')return 3 ;
  else if(c == 'E')return 4 ;
  else if(c == 'F')return 5 ;
  else if(c == 'G')return 6 ;
  else if(c == 'H')return 7 ;
  else if(c == 'I')return 8 ;
  else if(c == 'J')return 9 ;
  else if(c == 'K')return 10;
  else if(c == 'L')return 11;
  else if(c == 'M')return 12;
  else if(c == 'N')return 13;
  else if(c == 'O')return 14;
  else if(c == 'P')return 15;
  else if(c == 'Q')return 16;
  else if(c == 'R')return 17;
  else if(c == 'S')return 18;
  else if(c == 'T')return 19;
  else if(c == 'U')return 20;
  else if(c == 'V')return 21;
  else if(c == 'W')return 22;
  else if(c == 'X')return 23;
  else if(c == 'Y')return 24;
  else if(c == 'Z')return 25;
}
int main()
{
  int n;
  string a;
  cin >>n>> a;
  REP(i, a.size()){
    char tmp = a[i];
    a[i] = n2c((c2n(tmp) + n)%26);
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long int
#define ii pair<int,int>
#define lli pair<ll,ll>
#define pii pair<int,int>
#include<limits>
#define deb(x) cout<<#x<<'='<<(x)<<endl
#define deb2(x,y) cout<<'['<<#x<<'='<<(x)<<','<<#y<<'='<<(y)<<']'<<endl
#define debarr(a,n) {cout<<#a<<'='; for(int i=0;i<n;i++) cout << a[i] << ' '; cout<<endl;}
#define debvec(v) {cout<<#v<<'=';for(auto itr=v.begin();itr!=v.end();itr++)cout<<*itr<<' ';cout<<endl;}
#define INF numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()
#define endl "\n"
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define MOD (pow(10,9)+7)
using namespace std;

// ll mod(ll n,ll a)
// {
//     string num = to_string(n);
//     ll res= 0;
//     for(auto i=0;i<num.length();i++)
//     {
//         res=(res*10+(ll)num[i]-'0')%a;
//     }
//     return res;
// }




int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr);
    cout.tie(nullptr);
  
    double n;
    cin>>n;
    cout<<2*M_PI*n;
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>
using namespace std;
int A[200000];
int B[200000];
int main(void){
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    
    int M = 0;
    for (int i = N-1; i >= 0; i--) {
        int count = 0;
        if (N / (i+1) == 1) {
            B[i] = A[i];
            if (A[i] == 1) M++;
        }
        else {
            for (int j = 2 * (i+1); j <= N; j+=i+1) {
                count += B[j-1];
            }
            if (count % 2 == A[i])
                B[i] = 0;
            else {
                B[i] = 1;
                M++;
            }
        }
    }
    
    cout << M << endl;
    int count = 0;
    if (M != 0) {
        for (int i = 0; i < N; i++) {
            if (B[i] == 1 && count+1 != M) {
                cout << i+1 << " ";
                count++;
            }
            else if(B[i] == 1 && count+1 == M) {
                cout << i+1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

vector<string> v(100010);

int main(void){
    int K;
    cin >> K;
    string t="0";
    for(int i=1; i<10; ++i){
        ++t[0];
        v[i]=t;
    }
    int now=10, lkg=1;
    while(now<=K){
        string s=v[lkg];
        for(int i=-1; i<2; ++i){
            if(s.back()+i>='0' && s.back()+i<='9'){
                s += (s.back()+i);
                v[now]=s;
                ++now;
                s.pop_back();
            }
        }
        ++lkg;
    }
    cout << v[K] << endl;
    return 0;
}


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

using namespace std;

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

string a, b;
int dp[3005][3005];
pii par[3005][3005];

void update(int x, int y, int fx, int fy, int v) {
  if(dp[fx][fy] + v > dp[x][y]) {
    dp[x][y] = dp[fx][fy] + v;
    par[x][y] = {fx, fy};
  }
}

void solve() {
  cin >> a >> b;
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for(int i = 1; i <= a.size(); i++) {
    dp[i][0] = 0;
    par[i][0] = {i-1, 0};
  }
  for(int j = 1; j <= b.size(); j++) {
    par[0][j] = {0, j-1};
    dp[0][j] = 0;
  }
  for(int i = 1; i <= a.size(); i++) {
    for(int j = 1; j <= b.size(); j++) {
      update(i, j, i-1, j, 0);
      update(i, j, i, j-1, 0);
      if(a[i-1] == b[j-1]) update(i, j, i-1, j-1, 1);
    }
  }
  vector<char> ret;
  pii curr = {a.size(), b.size()};
  while(curr.first && curr.second) {
    pii next = par[curr.first][curr.second];
    if(next.first != curr.first && next.second != curr.second) {
      ret.push_back(a[next.first]);
    }
    curr = next;
  }
  reverse(ret.begin(), ret.end());
  for(char out: ret) {
    cout << out;
  }
  cout << endl;
}

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


Measured memory_bytes: 106112
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,c=0,s=0,x;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i>=1&&i<=9)
        {
            c++;
        }
        else
        {
            x=i;
            s=0;
            while(x)
            {
                x=x/10;
                s++;
            }
            if(s%2==1)
            {
                c++;
            }
        }

    }
    cout<<c<<endl;
    return 0;
}


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

vector<int> dice1(7),dice2(7),tmp(7);

void change_dice(char c){
    for(int i=1; i<=6; i++){
        tmp[i]=dice1[i];
    }
    if(c=='E'){
        dice1[1]=tmp[4];
        dice1[3]=tmp[1];
        dice1[4]=tmp[6];
        dice1[6]=tmp[3];
    }
    else if(c=='N'){
        dice1[1]=tmp[2];
        dice1[2]=tmp[6];
        dice1[5]=tmp[1];
        dice1[6]=tmp[5];
    }
    else if(c=='S'){
        dice1[1]=tmp[5];
        dice1[2]=tmp[1];
        dice1[5]=tmp[6];
        dice1[6]=tmp[2];
    }
    else if(c=='W'){
        dice1[1]=tmp[3];
        dice1[3]=tmp[6];
        dice1[4]=tmp[1];
        dice1[6]=tmp[4];
    }
}

int main(){
    for(int i=1; i<=6; i++)
        cin >> dice1[i];
    for(int i=1; i<=6; i++)
        cin >> dice2[i];
    
    //frontを揃える
    int front=dice2[2],upper=dice2[1];
    //初期位置の探索
    int key;
    for(int i=1; i<=6; i++){
        if(dice1[i]==front)
            key=i;
    }
    //frontを揃える
    switch(key){
        case 1: 
            change_dice('S');
            break;
        case 2:
            break;
        case 3:
            change_dice('W');
            change_dice('S');
            break;
        case 4:
            change_dice('E');
            change_dice('S');
            break;
        case 5:
            change_dice('S');
            change_dice('S');
            break;
        case 6:
            change_dice('N');
            break;
    }
    //upperを揃える
    while(dice1[1]!=upper){
        change_dice('E');
    }
    int flg=1;
    for(int i=1; i<=6; i++){
        if(dice1[i]!=dice2[i]){
            flg=-1;
            break;
        }
    }
    if(flg==1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
} 


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

int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if(c-a-b>0&&4*a*b<(c-a-b)*(c-a-b))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3636
n = int(input())
array = list([x+1 for x in range(n)])
sum = 0
for i in range(len(array)):
    if array[i]%15==0:
        array[i] = 'fizzbuzz'
    elif array[i]%3==0:
        array[i] = 'fizz'
    elif array[i]%5==0:
        array[i] = 'buzz'
    else:
        sum += array[i]


print(sum)

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

namespace ITP2_1_A
{
	class Program
	{
		static void Main(string[] args)
		{
			List<int> a = new List<int>();
			List<string> queries = new List<string>();

			int q = int.Parse(Console.ReadLine());
			for(int i = 0; i < q; i++) {
				queries.Add(Console.ReadLine());
			}

			foreach(string query in queries) {
				string[] vs = query.Split(' ');
				int c = int.Parse(vs[0]);

				switch(c) {
				case 0:
					a.Add(int.Parse(vs[1]));
					break;

				case 1:
					Console.WriteLine(a[int.Parse(vs[1])]);
					break;

				case 2:
					a.RemoveAt(a.Count - 1);
					break;

				default:
					break;
				}
			}
		}
	}
}



Measured memory_bytes: 34412
#include<stdio.h>
long long MIN(long long a,long long b){return a<b?a:b;}
int lb(int l,int r,long long n,long long *d){
  int m=(l+r)/2;
  if(l==r)return m;
  return n<=d[m]?lb(l,m,n,d):lb(m+1,r,n,d);
}
int main(){
  long long n,m,q,i,j,x,ans,a[100010],b[100010],c[100010],d[100010];
  scanf("%lld %lld %lld",&n,&m,&q);
  for(i=0;i<n;i++)scanf("%lld",&a[i]);
  for(i=0;i<m;i++)scanf("%lld",&b[i]);
  a[n]=b[m]=c[n]=d[m]=1e18;
  
  for(i=0;i<n;i++){
    j=lb(0,m,a[i],b);
    c[i]=b[j]-a[i];
    if(j)c[i]=MIN(c[i],a[i]-b[j-1]);
  }
  for(i=0;i<m;i++){
    j=lb(0,n,b[i],a);
    d[i]=a[j]-b[i];
    if(j)d[i]=MIN(d[i],b[i]-a[j-1]);
  }
  //for(i=0;i<n;i++)printf("%lld ",c[i]);printf("\n");
  //for(i=0;i<m;i++)printf("%lld ",d[i]);printf("\n");
  while(q--){
    scanf("%lld",&x);
    i=lb(0,n,x,a);
    j=lb(0,m,x,b);
    ans=MIN(a[i]-x+c[i],b[j]-x+d[j]);//printf("%lld ",ans);
    if(i)ans=MIN(ans,x-a[i-1]+c[i-1]);
    if(j)ans=MIN(ans,x-b[j-1]+d[j-1]);
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 4352
while 1:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    else:
        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: 7012
fun main(args: Array<String>) = println(run {
    val (n, d) = readLine()!!.split(" ").map { it.toInt() }
    val x = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }

    val dist = Array(n) { DoubleArray(n) }
    for (i in 0..n - 1) {
        for (j in 0..n - 1) {
            dist[i][j] = Math.sqrt(x[i].mapIndexed { k, v -> (v-x[j][k])*(v-x[j][k]) }.sum().toDouble())
        }
    }

    (0..n-1).sumBy { i ->
        (i+1..n-1).count { j -> dist[i][j] == Math.floor(dist[i][j]) }
    }

})

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec A(N);
  rep(i, N)cin >> A[i];
  sort(ALL(A));
  cout << A[N-1] - A[0] << endl;
  return 0;
}


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

const int MAXN = 200010;

int A[MAXN];
int d[MAXN];
deque<int> dq;
int mx[MAXN], mn[MAXN];

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

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

	for(int i = 0; i < K; i++) {
		while(!dq.empty() && A[dq.back()] <= A[i]) dq.pop_back();
		dq.push_back(i);
	}
	for(int i = 0; i < N - K; i++) {
		if(dq.front() < i) dq.pop_front();
		while(!dq.empty() && A[dq.back()] <= A[i + K]) dq.pop_back();
		dq.push_back(i + K);
		mx[i] = A[dq.front()];
	}

	while(!dq.empty()) dq.pop_back();
	for(int i = 0; i < K; i++) {
		while(!dq.empty() && A[dq.back()] >= A[i]) dq.pop_back();
		dq.push_back(i);
	}
	for(int i = 0; i < N - K; i++) {
		if(dq.front() < i) dq.pop_front();
		while(!dq.empty() && A[dq.back()] >= A[i + K]) dq.pop_back();
		dq.push_back(i + K);
		mn[i] = A[dq.front()];
	}

	int cnt = 0, ans = 0;
	for(int i = 0; i < N - 1; i++) d[i] = A[i + 1] - A[i];
	while(!dq.empty()) dq.pop_back();
	for(int i = 0; i < K - 2; i++) {
		while(!dq.empty() && d[dq.back()] >= d[i]) dq.pop_back();
		dq.push_back(i);
	}
	for(int i = 0; i < N - K + 1; i++) {
		if(dq.front() < i) dq.pop_front();
		while(!dq.empty() && d[dq.back()] >= d[i + K - 2]) dq.pop_back();
		dq.push_back(i + K - 2);
		if(i == 0 || mn[i - 1] != A[i - 1] || mx[i - 1] != A[i + K - 1]) {
			ans++;
			if(d[dq.front()] > 0) cnt++;
		}
	}
	//printf("ans = %d, cnt = %d\n", ans, cnt);

	ans -= max(0, cnt - 1);
	cout << ans;
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> a(n);
	vector<vector<int>> x(n), y(n);
	rep(i, n) {
		cin >> a[i];
		rep(j, a[i]) {
			int X, Y;
			cin >> X >> Y;
			X--;
			x[i].emplace_back(X);
			y[i].emplace_back(Y);
		}
	}
	//bitで仮定
	int ans = 0;
	
	for (int bit = 0; bit < (1 << n); ++bit) {
		bool elf = true;
		for (int i = 0; i < n; ++i) {
			if (!(bit & (1 << i))) continue;
			for (int j = 0; j < a[i]; ++j) {
				if (bit & (1 << x[i][j])) {
					if (!y[i][j]) elf = false;
				}
				else {
					if (y[i][j]) elf = false;
				}
			}
		}
		if (!elf) continue;
		int res = 0;
		rep(i, n) if (bit & (1 << i)) res++;
		ans = max(ans, res);
	}

	dunk(ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[300003];
int main() {
	int n;
	scanf("%d",&n);
	scanf("%s",s);
	const int M=998244353;
	int f[1<<3]={n};
	int res=1;
	int rem=0;
	int id[128];
	id['R']=0;id['G']=1;id['B']=2;
	for(int i=0;i<3*n;++i){
		int x=id[s[i]];
		if(f[7-(1<<x)]){
			res=(res*(ll)f[7-(1<<x)])%M;
			--f[7-(1<<x)];
			++f[7];
		}else{
			for(int mask=6;mask>=0;--mask)
				if(!((mask>>x)&1) && f[mask]){
					res=(res*(ll)f[mask])%M;
					--f[mask];
					++f[mask|(1<<x)];
					break;
				}
		}
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 512
n,m = map(int,input().split())
mod = 10**9 + 7
a = [1] * (n+1)
for i in range(m):
    b = int(input())
    a[b] = 0

        
for i in range(2,n+1):
    if a[i] != 0:
        a[i] = a[i-1] + a[i-2]
#print(a)
print(a[n] % mod)


Measured memory_bytes: 460020
package main

import (
	"fmt"
	"math"
)

func twopow(x int) int {
	if x == 1 {
		return 0
	}
	sum := 1
	for i := 1 ; ; i++ {
		sum *= 2
		if x == sum {
			return i
		}
	}
}

func main(){
	var h int
	fmt.Scan(&h)
	monster_count := 1
	count := 0
	for ;; {
		if h&(h-1)==0 {
			c := twopow(h)
			//fmt.Println(h,c)
			cc := math.Pow(2,float64(c+1)) - 1
			//fmt.Println(cc)
			count += int(cc) * monster_count
			break
		}
		h /= 2
		count += monster_count
		monster_count *= 2
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
using namespace std;

const ll MAX =  1000 * 1000 ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int N = 301 ;
const int INF = INT_MAX ;
const int M = 200005;
int main ( ){


ll  h ,  a ; 
cin >> h >> a ; 
cout << ( (h + a - 1) / a  ) ; 


return 0 ;

}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>

int main() {

    std::bitset<8> colors;
    int N, masters = 0;
    std::cin >> N;

    while (N--) {
        int ai;
        std::cin >> ai;

        if (ai <= 399) {
            colors[0] = true;
        } else if (ai <= 799) {
            colors[1] = true;
        } else if (ai <= 1199) {
            colors[2] = true;
        } else if (ai <= 1599) {
            colors[3] = true;
        } else if (ai <= 1999) {
            colors[4] = true;
        } else if (ai <= 2399) {
            colors[5] = true;
        } else if (ai <= 2799) {
            colors[6] = true;
        } else if (ai <= 3199) {
            colors[7] = true;
        } else {
            masters++;
        }
    }
    int min_colors = colors.count();
    if(colors.count() == 0 && masters){
        min_colors = 1;
    }
    std::cout << min_colors << " " << colors.count() + masters << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    static long[][] comb = new long[51][51];
    public static void combTable() {
        for (int i = 0; i <= 50; ++i) {
            for (int j = 0; j <= i; ++j) {
                if (j == 0 || j == i) {
                    comb[i][j] = 1;
                } else {
                    comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
                }
            }
        }
    }

    public static void main(String[] args) {
        combTable();
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(), A = sc.nextInt(), B = sc.nextInt();
        Long[] V = new Long[N];
        for (int i = 0; i < N; ++i) {
            V[i] = sc.nextLong();
        }
        Arrays.sort(V, Collections.reverseOrder());
        int maxvLastIdx = 0;
        int aValNum = 0, aValPos = 0;
        for (int i = 0; i < N; ++i) {
            if (V[i].equals(V[A-1])) {
                ++aValNum;
                if (i < A) {
                    ++aValPos;
                }
            }
        }
        double avg = 0.0;
        for (int i = 0; i < A; ++i) {
            avg += V[i];
        }
        avg /= A;
        long cnt = 0;
        if (aValPos == A) {
            for (aValPos = A; aValPos <= B; ++aValPos) {
                
                cnt += comb[aValNum][aValPos];
            }
        } else {
            cnt += comb[aValNum][aValPos];
        }
        System.out.printf("%.6f\n", avg);
        System.out.println(cnt);
    }
}


Measured memory_bytes: 22868
from collections import deque

N,M=list(map(int,input().split()))

g = [[] for _ in range(N+1)] # 隣接リスト

for _ in range(M):
    a, b = [int(x) for x in input().split()]
    #print(a,b,g)
    g[a].append(b)
    g[b].append(a)

#road_list=[]
#for i in range(M):
#  road_list.append(list(map(int,input().split())))

queue = deque([1])
d = [None] * (N+1) # uからの距離の初期化
d[1] = 0 # 自分との距離は0
while queue:
  v = queue.popleft()
  for i in g[v]:
    if d[i] is None:
      d[i] = v
      queue.append(i)

#print(d)


#ans_dict=dict([])
#before_room=[1]
#while True:
#  temp_room=[]
#  for j in range(len(before_room)):
#    for i in road_list:
#      if i[0]==before_room[j]:
#        if i[1] not in ans_dict:
#          ans_dict[i[1]]=before_room[j]
#          temp_room.append(i[1])
#      if i[1]==before_room[j]:
#        if i[0] not in ans_dict:
#          ans_dict[i[0]]=before_room[j]
#          temp_room.append(i[0])
#  before_room=temp_room
#  if len(ans_dict)==N:
#    break
    
d[0]=0
if None in d:
  print("No")
else:
  print("Yes")
  for i in range(2,N+1):
    print(d[i])

    

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

const int N = 222222, M = 222222;
vector<int> graph[N];
int n, m;
bool ans;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<int> bfs;
    for(node : graph[1]) {
        bfs.push_back(node);
    }
    for(node : bfs) {
        for(nnode : graph[node]) {
            if(nnode == n) {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 13296
#include <stdio.h>

int main(void)
{
	int limit = 3000;
	int x[limit], y[limit];
	int count;
	for (count = 0; count < limit; count++) {
		scanf("%d %d", &x[count], &y[count]);
		if (x[count] == 0 && y[count] == 0) {
			break;
		}
	}
	for (int i = 0; i < count; i++) {
		if (x[i] <= y[i]) {
			printf("%d %d\n", x[i], y[i]);
		} else {
			printf("%d %d\n", y[i], x[i]);
		}
	}
	return 0;
}



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

int main() {
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int st = h1 * 60 + m1;
	int en = h2 * 60 + m2;
	cout << en - st - k << endl;
}

Measured memory_bytes: 3624
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int  n, k, ans = 0; 
    cin >> n >> k ;
    for (int b=1;b<=n;b++ ) {
        ans += n/b*max(0LL,b-k); 
        ans += max(0LL,(n%b)-k+1);
    } 
    if (k==0) ans = n*n;
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        final int N  = scanner.nextInt();
        final ArrayList<Integer> A = new ArrayList<>();
        int sum = 0;
        for(int i=0; i<N; i++){
            int a = scanner.nextInt();
            int count = 0;
            while(a%2==0){
                a=a/2;
                count++;
            }
            sum += count;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35420
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int m,d;
  m = 1000000000;
  vector<int> x(n);
  for(int i = 0;i < n;i++){
    cin >> x[i];
  }
  for(int i = 0;i <= n-k;i++){ 
    d = min(abs(x[i]), abs(x[i+k-1]));
    d += x[i+k-1]-x[i];
    if(m > d) m = d;
  }
  cout << m << endl;
}
  

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std;

struct LowestCommonAncestor {
    size_t n;
    size_t size() const { return n; }
    vector<int> color, parent, depth, topDepth, goUp, visited;
    vector<vector<int>> g;
    LowestCommonAncestor(size_t n_) : n(n_), g(n) {}
    void addEdge(int u, int v){
        g[u].push_back(v); g[v].push_back(u);
    }
    void decomp(int root = 0, int B = 500){
        parent.assign(n, -1); depth.assign(n, 0);
        topDepth.assign(n, 0); goUp.assign(n, -1); visited.assign(n, false);
        vector<int> tord;
        vector<int> q(n+1); int l = 0, r = 0;
        q[r++] = root;
        while(l != r){
            int v = q[l++]; visited[v] = true;
            tord.push_back(v);
            for(int c : g[v]){
                if(!visited[c]){ parent[c] = v; depth[c] = depth[v] + 1; q[r++] = c; }
            }
        }
        swap(color, visited); // ?????¢????????±??????
        color.assign(n, 0);
        int c = 0;
        for(int u : tord){
            if(color[u]) continue;
            c++;
            l = 0, r = 0;
            q[r++] = u;
            for(int i = 0; i < B && l != r; i++){
                int v = q[l++];
                color[v] = c; goUp[v] = parent[u]; topDepth[v] = depth[u];
                for(int c : g[v]) if(!color[c]) q[r++] = c;
            }
        }
    }
    int solve(int u, int v){
        while(color[u] != color[v]){
            if(topDepth[u] > topDepth[v]) u = goUp[u];
            else v = goUp[v];
        }
        while(u != v){
            if(depth[u] > depth[v]) u = parent[u];
            else v = parent[v];
        }
        return u;
    }
};

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

int main(){
    int n;
    cin >> n;
    LowestCommonAncestor g(n);
    rep(i,n){
        int k;
        cin >> k;
        rep(j,k){
            int c;
            cin >> c;
            g.addEdge(i,c);
        }
    }
    g.decomp(0);
    int q;
    cin >> q;
    rep(i,q){
        int u,v;
        cin >> u >> v;
        cout << g.solve(u,v) << endl;
    }
}

Measured memory_bytes: 10028
#!/usr/bin/env python3
# 全探索
n,k = map(int,input().split())
s = str(n)
d = list(map(int,input().split()))
for i in range(n,100000):
    # i の中にd に含めれるものがないか１つづつ見ていく
    str_i = str(i)
    ok = 1
    for j in str_i:
        if int(j) in d:
            ok = 0
            break
    if ok:
        print(i)
        exit()

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

using namespace std;

typedef long long int64;

int main()
{
  int beet[1000001];
  for(int i = 0; i < 1000001; i++) beet[i] = i;
  for(int i = 2; i < 1000001; i++) {
    if(beet[i] == i) {
      for(int j = i; j < 1000001; j += i) {
        beet[j] = beet[j] / i * (i - 1);
      }
    }
  }

  int64 sum[1000001];
  sum[1] = 2;
  for(int i = 2; i < 1000001; i++) {
    sum[i] = sum[i - 1] + beet[i];
  }

  int T;
  cin >> T;
  while(T--) {
    int N;
    cin >> N;
    cout << sum[N] << endl;
  }
}

Measured memory_bytes: 14752
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d=max(a,max(b,c));
  cout<<a+b+c-d+10*d;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 3000;



int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  
  ll n;
  int a, b;
  char c;
  cin >> n >> a >> c >> b;

  a = a*100+b;
  n = n*a;

  string ans = to_string(n);

    n = ans.size();
    if(n < 3)cout << "0" << endl;
    else{
        forn(i, 0, n-2){
            cout << ans[i];
        }cout << endl;
    }


	
}





Measured memory_bytes: 3720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	String strArr[] = br.readLine().split(" ");
            int a=Integer.parseInt(strArr[0]);
            int b=Integer.parseInt(strArr[1]);

            System.out.println(a/b +" "+a%b+" "+(String.format("%.5f",((double)a)/((double)b))));

    }
}

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

int main(){
  int l, r, d;
  cin>>l>>r>>d;
  
  vector<int> in;
  
  for(int i=l;i<=r;++i){
    in.push_back(i);
  }
  int cnt = 0;
  for(int x: in){
    if(x%d == 0){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  
  return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
struct RUQ //calculateはminimum
{
    int n;
    const T ex = 1ll << 60; //dat 初期値(minなので)
    const T em = 1ll << 60; //lazy 初期値(minなので)
    vector<T> dat, lazy; //tree本体
    RUQ(vector<T> v){
        int x = 1;
        int i;
        n = v.size();
        while(x < n) x <<= 1;
        n = x; 
        dat.resize(2*n-1, ex);
        lazy.resize(2*n-1, em);
        for(i = 0;i < v.size();++i){
            dat.at(i + n - 1) = v.at(i);
        }
        for(i = n-2;i >= 0;--i){
            dat.at(i) = calculate(dat.at(2*i+1), dat.at(2*i+2));
        }
    }
    
    T calculate(T a, T b){
        return min(a, b); //minで使う
    }
    
    void eval(int now){
        if(lazy.at(now) == em) return;
        if(now < n - 1){ //最小値なのでそのまま代入
            lazy.at(2*now + 1) = min(lazy.at(2*now + 1), lazy.at(now));
            lazy.at(2*now + 2) = min(lazy.at(2*now + 2), lazy.at(now));
        }
        dat.at(now) = min(dat.at(now), lazy.at(now));
        lazy.at(now) = em;
    }
    
    void update(int a, int b, T x, int now, int l, int r){
        eval(now);
        if(a <= l && r<= b){
            lazy.at(now) = min(lazy.at(now), x); //上から書き換える。最小値なので代入する
            eval(now);
        }else if(a < r && l < b){
            update(a, b, x, 2*now + 1, l, (l + r)/2);
            update(a, b, x, 2*now + 2, (l + r)/2, r);
            dat.at(now) = calculate(dat.at(2*now + 1), dat.at(2*now + 2));
        }
    }
    void update(int a, int b, T x){update(a, b, x, 0, 0, n);}
    
    T query(int a, int b){return query_sub(a, b, 0, 0, n);}
    T query_sub(int a, int b, int now, int l, int r){
        eval(now);
        if(r <= a || b <= l) return ex;
        else if(a <= l && r <= b) return dat.at(now);
        else{
            T vl = query_sub(a, b, 2*now + 1, l, (l + r)/2);
            T vr = query_sub(a, b, 2*now + 2, (l + r)/2, r);
            return calculate(vl, vr);
        }
    }
    
    inline T operator[](int a) { return query(a, a + 1); }
    void print() {
        for (int i = 0; i < 2 * n - 1; ++i) {
            cout << (*this)[i];
            if (i != n) cout << ",";
        }
        cout << endl;
    }
};

int main()
{
    ll i,j;
    ll n,q;
    cin >> n >> q;
    vector<ll> ini(n, n-1);
    RUQ<ll> tate(ini);
    RUQ<ll> yoko(ini);
    ll ans = (n-2)*(n-2);
    rep(i,q){
        ll c,x;
        cin >> c >> x;
        --x;
        if(c == 1){
            ll tmp = tate.query(x, x+1);
            ans -= tmp-1;
            yoko.update(0, tmp+1, x);
        }else if(c == 2){
            ll tmp = yoko.query(x, x+1);
            ans -= tmp-1;
            tate.update(0, tmp+1, x);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 22844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// 初期化
		Scanner sc = new Scanner(System.in);
		long[] list = new long[5];

		long   n = sc.nextLong();
		list[0] = sc.nextLong();
		list[1] = sc.nextLong();
		list[2] = sc.nextLong();
		list[3] = sc.nextLong();
		list[4] = sc.nextLong();

		long result=0;
		
		// 最小値の取得
		Arrays.sort(list);
		
		result = (long)Math.ceil((double)((double)n / (double)list[0])) + 4;
		
		System.out.println(result);
	}
	
}


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

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    
    if(a>=b)
    {
        printf("%d",(b*c)+(d*(a-b)));
    }
    else
    {
        printf("%d",a*c);
    }
    
    
}




Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define lint long long int
using namespace std;
lint comb(lint n)
{
	return n*(n-1)/2;
}
int main()
{
	lint n=0;
	lint ans=0;
	cin>>n;
	ans=comb(n);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import copy

N = int(input())
tests = list(map(int, input().split()))
M = int(input())

for i in range(M):
    tmp = copy.deepcopy(tests)
    p, x = map(int, input().split())
    tmp[p-1] = x
    print(sum(tmp))

Measured memory_bytes: 3444
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define int long long
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

ll mem_sec[2][3];
ll sum_n[2];
signed main(){
    string s;
    cin>>s;
    ll sz = s.size();
    vector<vector<ll>> mem_n(2); 
    ll ct = 0;
    string sec_s;
    while(sz>0){
        rep(i,min(3LL,sz)){
            sec_s = s.substr(sz-1-i,1);
            if(sec_s =="?"){
                sec_s = "0";
                mem_sec[ct%2][i]++;
            }
            sum_n[ct%2] += stoi(sec_s)*pow(10,i);
        }
        ct++;
        sz -=3;
        if(sz>0) s = s.substr(0,sz);
    }
    ll smod = (sum_n[0]-sum_n[1])%13;
    while(smod<0) smod +=13;
    // cout<<smod<<"\n";
    ll t_mem[2][13];
    rep(i,2) rep(j,13) t_mem[i][j]=0;
    ll bai[2][3] = {{1,10,100},{-1,-10,-100}};
    bool f=0;
    ll tmod;
    rep(g,2) rep(h,3){
        rep(i,mem_sec[g][h]){
            if(f==0){
                rep(j,10){
                    tmod = (j*bai[g][h]+1300)%13; 
                    t_mem[0][tmod]=1;
                }
                f=1;
            }else{
                rep(j,13){
                    t_mem[1][j]=t_mem[0][j];
                    t_mem[0][j]=0;
                }
                rep(j,13){
                    rep(k,10){
                        tmod = (j+k*bai[g][h]+1300)%13; 
                        t_mem[0][tmod] += t_mem[1][j];
                        t_mem[0][tmod] %= mod;
                    }
                }
            }
        }
    }
    ll ttt = 5-smod;
    if(ttt<0) ttt+=13;
    if(f==0) {
        cout<<(smod%13==5)<<"\n";
    }else cout<<t_mem[0][ttt]<<"\n";
    // rep(i,13) cout<<t_mem[0][i]<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll c=0,f=0;
  rep(i,n) {
    ll x,y;
    cin >> x >> y;
    if(x==y) c++;
    else c=0;
    if(c>=3) f=1; 
  }
  if(f) pr("Yes");
  else pr("No");
}

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


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int x,y;
while(scanf("%d%d",&x,&y)&&x||y){
	if(x>y)swap(x,y);
	printf("%d %d\n",x,y);
}

return 0;
}

Measured memory_bytes: 1188
import sys
msg = sys.stdin.readlines()
a = []
for x in msg:
  for y in x.replace('\n', '').split(' '):
    a.append(y)
ind1 = a[0]
ind2 = a[1]
val1 = int(a[2])
val2 = int(a[3])
if ind1 == a[4]:
  val1 -= 1
else:
  val2 -= 1

print(val1, val2)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int ans = 0, sum = 0, n, P, H;
    cin >> n >> P;
    for (int i = 2; i <= n; ++i) {
        cin >> H;
        if (H <= P) {
            ans = max(ans, ++sum);
        }
        else {
            sum = 0;
        }
        P = H;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
N = int(input())
sqrt_N = int(N**0.5)
ans = 10**18

for A in range(1, sqrt_N+1):
    if N % A == 0:
        B = str(N//A)
        A = str(A)
        ans = min(ans, max(len(A),len(B)))

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

vector<int> v[30];
int ans[30];
int main(void){
	int N;
	int cnt = 0;
	while (1){
		cin >> N;
		if (N == 0) break;
		for (int i = 0; i < N; i++){
			int x;
			cin >> x;
			v[cnt].push_back(x);
		}
		cnt++;
	}
	for (int i = 0; i < cnt; i++){
		sort(v[i].begin(), v[i].end());
		for (int j = 0; j < v[i].size(); j++){
			if (j == 0 || j == v[i].size()-1) continue;
			ans[i] += v[i][j];
		}
		ans[i] /= v[i].size() - 2;
	}

	for (int i = 0; i < cnt; i++){
		cout << ans[i] << endl;
	}
	return 0;
}




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

     #define int long long
    int32_t main(){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
	int ans = max(a*c,a*d);
	ans= max(ans,b*c);
	ans=max(ans,b*d);
	cout<<ans;
	return 0;
    }



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int D;
ll G;
 cin >> D >> G;
  vector<ll> p(D);
  vector<ll> c(D);
  for(int i = 0;i<D;i++){
    cin >> p[i];
    cin >> c[i];
  }
  ll res = 1000000000000;
  for(int bit = 0;bit<(1<<D);bit++){
    ll sum = 0;
    ll num = 0;
    for(int i = 0;i<D;i++){
      if(bit & (1<<i)){
        sum += c[i] + p[i]*100*(i+1);
        num += p[i];
      }
    }
      if(sum >= G) res = min(res,num);
      else{
        for(int i  = D-1;i>=0;i--){/*もしsumがGを超えなかったらボーナス取得のために
        解いていない問題のうち得点の高いものから順に解いていく*/
          if(bit &(1<<i)) continue;//全完問題はスルー
          for(int j = 0;j<p[i];j++){
            if(sum >= G) break;
            sum += 100*(i+1);
            num++;
          }
        }
        res = min(res,num);
      }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String weather = scan.next();
        if (weather.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (weather.equals("Cloudy")) {
            System.out.println("Rainy");
        } else {
            System.out.println("Sunny");
        }
    }
}


Measured memory_bytes: 23124
// Example program
#include <iostream>
using namespace std;

int main()
{
    int H, W;
    while(1){
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                if ((i+j)%2 == 1){  //i+jは奇数
                    cout << ".";
                } else {
                    cout << "#";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n;
	 
	bool prim[1000001];
	for(int i=0;i<1000001;i++) prim[i] = true;
	prim[1]=false;
	for(int i=3;i<1000001;i++){
		if(i%2==0) prim[i] = false;
		else if(prim[i]){
			for(int j=i*2;j<=1000001;j+=i) prim[j] = false;
		}
	}
	

	while(cin >> n){
		int ans=0;
		for(int i=1;i<=n;i++){
			if(prim[i]) ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2132
A = int(input())
B = int(input())

if A == 1 and B == 2:
       print(3) 

if A == 1 and B == 3:
       print(2) 

if A == 2 and B == 1:
       print(3) 

if A == 2 and B == 3:
       print(1)

if A == 3 and B == 1:
       print(2)

if A == 3 and B == 2:
       print(1) 


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String b = in.next();
		String out = "";
		switch (b) {
		case "A":
			out = "T";
			break;
		case "C":
			out = "G";
			break;
		case "G":
			out = "C";
			break;
		case "T":
			out = "A";
			break;
		default:
			break;
		}
		System.out.println(out);
	}
}


Measured memory_bytes: 22356
import java.util.*;
public class Main{
	public static void main(String args[]){
		ArrayList[] a;
		a=new ArrayList[10];
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				System.out.printf("%dx%d=%d\n",i,j,i*j);
			}
		}
		
	}
}

Measured memory_bytes: 17988
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 2929000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    ll r,d,x;
	cin>>r>>d>>x;
	for(i=1;i<=10;i++){
		x=x*r-d;
		cout<<x<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;cin>>N>>K;
  vector<long long>v(N);
  for(int X=0;X<N;X++){
    cin>>v[X];
    if(X>=K){
      if(v[X]>v[X-K]){
        cout<<"Yes"<<endl;
      }
      else{
        cout<<"No"<<endl;
      }
    }
  }
}

Measured memory_bytes: 4836
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{
    lli n, m;
    cin>>n>>m;
    for(int i = 0; i < m; i ++) {
        lli x;
        cin>>x;
        n -= x;
    }
    if(n < 0) {
        n = -1;
    }
    cout<<n;
    cout<<'\n';
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3632
main = 
  let
    func = do
      line <- getLine
      let
        ls  = words line
        a   = read $ head ls :: Int
        op  = head $ head $ tail ls :: Char
        b   = read $ head $ tail $ tail ls :: Int
        calc 
          | op == '+'  = a+b
          | op == '-'  = a-b
          | op == '*'  = a*b
          | op == '/'  = (div a b)
        in
          if op == '?'
            then putStr ""
            else do
              putStrLn $ show calc
              func
    in func



Measured memory_bytes: 4064
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=924844033;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;}
// head

int t,q,m,n,k,res;
int a[200010] = {};
int b[200010] = {};
vector<PII> g[500010];
queue<int> que2;
//string s;

signed main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
	std::cin >>n;
	if(n==3 | n==5|n==7){
		std::cout << "YES" << '\n';
	}
	else
	std::cout << "NO" << '\n';
}

Measured memory_bytes: 12544