akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<vector>
#define ll long long
using namespace std;
const int wa=1e9+7;
int N, a[100];
struct Card { char suit, value; };
int cnt = 0;       
int main(void) {
	Card C1[100], C2[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C1[i].suit >> C1[i].value;
		C2[i] = C1[i];
	}
	for (int i = 0; i < N; i++) {
		for (int j = N - 1; j > i; j--) {
			if (C1[j].value < C1[j - 1].value)swap(C1[j], C1[j - 1]);
		}
	}
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (C2[j].value < C2[minj].value)minj = j;
	}
		if (minj != i)swap(C2[i], C2[minj]);
	}

	for (int i = 0; i < N; i++) {
		cout << C1[i].suit << C1[i].value;
		if (i != N - 1)cout << " ";
	}
	cout << endl<<"Stable"<<endl;
	for (int i = 0; i < N; i++) {
		cout << C2[i].suit <<C2[i].value;
		if (i != N - 1)cout << " ";
	}
	bool flag = true;
	for (int i = 0; i < N; i++) {
		if (C1[i].suit != C2[i].suit)flag = false;
	}
	cout << endl;
	(flag) ? cout<<"Stable": cout<<"Not stable";
	cout <<endl;
	return 0;
}




Measured memory_bytes: 3132
#include<stdio.h>

int main(void)
{
	double r, ans1, ans2;
	
	scanf("%lf", &r);
	
	ans1 = r * r * 3.141592653589;
	ans2 = 2 * r * 3.141592653589;
	
	printf("%lf %lf", ans1, ans2);
	
	return (0);
}

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

int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  if(A >= K){
    cout << K;
  }
  else if(A + B >= K){
    cout << A;
  }
  else{
    cout << A - (K - A - B);
  }
}

Measured memory_bytes: 3584
N, M = map(int, input().split())

aa = [list(map(int, input().split())) + [i] for i in range(M)]

aa.sort(key=lambda x:(x[0], x[1]))

num = None
i   = 0
for a in aa:
    if a[0] == num:
        i += 1
        a.append('{:0=6}{:0=6}'.format(a[0], i))
    else:
        i = 1
        num = a[0]
        a.append('{:0=6}{:0=6}'.format(a[0], i))

aa.sort(key=lambda x:x[2])

for a in aa: print(a[3]) 

Measured memory_bytes: 34724
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        long k = sc.nextLong();
        if (k % 2 == 0) {
            System.out.println(a - b);
        } else {
            System.out.println(b - a);
        }
    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  cin >> a >>b;
  int t,s,m;
  t=a+b;s=a-b;m=a*b;
  if(t>s && t>m)cout <<t;
  else if(s>m)cout <<s;
  else cout <<m;
}

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

using namespace std;
int a[105];
int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    int ans=1;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        a[i]+=a[i-1];
        if(a[i]<=x)
            ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;
using std::pair;
using std::make_pair;

using std::min;
using std::max;
using std::sort;
using std::abs;

using std::fixed;
using std::setprecision;
using std::setw;

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 314;

bool is_prime(ll n) {
    if (n <= 1) {
        return false;
    }

    if (n == 2) {
        return true;
    }

    if (n % 2 == 0) {
        return false;
    }

    for (ll i = 3; i * i <= n; i += 2) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    vector<bool> p(1e5 + 1);
    for (int i = 0; i <= 1e5; i++) {
        p[i] = is_prime(i);
    }

    vector<bool> s(1e5 + 1);
    for (int i = 0; i <= 1e5; i++) {
        if (i % 2 == 0) {
            continue;
        }
        s[i] = is_prime(i) && is_prime((i + 1) / 2);
    }

    vector<int> a(1e5 + 1);
    a[0] = 0;
    for (int i = 1; i <= 1e5; i++) {
        a[i] = a[i - 1];
        if (s[i]) {
            a[i]++;
        }
    }

    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        cout << a[r] - a[l-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 1656
#include<iostream>
#include<iomanip>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
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 long long INF = 1LL << 60;

/*
最短距離が2の辺がK本のN頂点連結グラフがあるかどうか
*/

int G[100][100];

int main() {
    int N,K;
    cin >> N >> K;
    //存在条件　できてなかった
    //連結グラフはN-1本最低でも辺があるため、
    //距離が2の辺は最高でもNC2 - (N-1)　本しか存在しえない
    if (K > N * (N-1) / 2 - (N - 1)) {
        cout << -1 << "\n";
        return 0;
    }

    //頂点1とそれ以外の任意の頂点とを結ぶN-1本の辺だけが存在する
    //グラフを考える　うに
    //ここまではできてた!!!!!!!!!!!
    //ここで1以外の頂点対に辺を追加すると、
    //他の頂点間の最短距離に影響を与えずに
    //最短距離を1にできる

    for (int i = 1; i < N; i++) {
        G[0][i] = 1; G[i][0] = 1;
    }
    int M = N - 1;
    int count = (N - 1) * (N - 2) / 2;
    while (true) {
        if (count == K) break;
        bool yet = true;

        for (int i = 1; i < N; i++) {
            if (!yet) break;
            for (int j = i+1; j < N; j++) {
                if (!G[i][j] && yet) {
                    G[i][j] = 1;
                    count--;
                    M++;
                    yet = false;
                    break;
                }
            }
        }
    }

    cout << M << "\n";
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            if (G[i][j]) {
                cout << i+1 << " " << j+1 << "\n";
            }
        }
    }
}

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

int main(void){
  string s;
  cin>>s;
  int c1=0,c2=0;
  for (int i = 0; i < (int) s.size(); i++) {
    if(s[i]=='A') c1++;
    else if(s[i]=='B') c2++;
  }
  if(c2 && c1) cout<<"Yes\n";
  else cout<<"No\n";
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <queue>
#include <tuple>

#define MAX_W 1010
#define MAX_H 1010

using namespace std;

int w, h, n;
char sections[MAX_H][MAX_W];
bool visited[MAX_H][MAX_W];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};


int main() {
  scanf("%d %d %d", &h, &w, &n);
  for (int i = 0; i < h; ++i) {
    scanf("%s", sections[i]);
  }

  int sx, sy;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (sections[i][j] == 'S') {
        sx = j; sy = i;
      }
    }
  }

  int ans = 0;
  queue<tuple<int, int, int> > que;
  que.push(make_tuple(sx, sy, 0));
  for (int hp = 1; hp <= n; ++hp) {
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        visited[i][j] = false;
      }
    }

    tuple<int, int, int> res;
    while (!que.empty()) {
      int x, y, d;
      tie(x, y, d) = que.front(); que.pop();
      visited[y][x] = true;
      for (int i = 0; i < 4; ++i) {
        int nx = x + dx[i], ny = y + dy[i];
        if ((0 <= nx && nx < w && 0 <= ny && ny < h) &&
            (!visited[ny][nx] && sections[ny][nx] != 'X')) {
          if (sections[ny][nx] == ('0' + hp)) {
            visited[ny][nx] = true;
            res = make_tuple(nx, ny, d + 1);
          }
          else {
            visited[ny][nx] = true;
            que.push(make_tuple(nx, ny, d + 1));
          }
        }
      }
    }

    int x, y, d;
    tie(x, y, d) = res;
    ans += d;
    que = queue<tuple<int, int, int> >();
    que.push(make_tuple(x, y, 0));
  }
  printf("%d\n", ans);
  
  return 0;
}

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

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector< vector<int64_t> > a(n, vector<int64_t>(m, 0));
    vector< vector<int64_t> > b(m, vector<int64_t>(l, 0));
    vector< vector<int64_t> > c(n, vector<int64_t>(l, 0));
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a.at(i).at(j);
        }
    }
    
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++) {
            cin >> b.at(i).at(j);
        }
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            for (int k = 0; k < m; k++) {
                c.at(i).at(j) += a.at(i).at(k) * b.at(k).at(j);
            }
        }
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            cout << c.at(i).at(j);
            if (j == (l - 1)) {
                cout << endl;
            } else {
                cout << ' ';
            }
        }
    }
}


Measured memory_bytes: 3268
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        // ビジネスロジックここから
        
        
        int n = scanner.nextInt();
        int s = 0;
        int i = n;
        
        while (i > 0) {
            s += i % 10;
            i /= 10;
        }
        System.out.println((n % s == 0 ? "Yes" : "No"));
        
        
        // ビジネスロジックここまで

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int n;
  int Max = 24*3600+59*60+59;
  while(cin >> n,n){
    vector<int> v(Max+1,0);
    string s1,s2;
    rep(i,n){
     cin >> s1 >> s2;
     int sum1=0,sum2=0;
     for(int j=0; j<s1.size(); j+=3){
      if(j==0){
        sum1 += atoi(s1.substr(j,2).c_str())*3600;
        sum2 += atoi(s2.substr(j,2).c_str())*3600;
      }
      if(j==3){
        sum1 += atoi(s1.substr(j,2).c_str())*60;
        sum2 += atoi(s2.substr(j,2).c_str())*60;
      }
      if(j==6){
        sum1 += atoi(s1.substr(j,2).c_str());
        sum2 += atoi(s2.substr(j,2).c_str());
      }
     }
     v[sum1]++; v[sum2]--;
    }
    int ans = 0;
    rep(i,Max){
      v[i+1] += v[i];
      ans = max(ans,v[i+1]);
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3480
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>

using namespace std;

int main() {
    
    
    int n;
    cin >> n;
    vector<int> d(n);
    
    int m = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> d[i];
        m = max(m, d[i]);
    }
    
    sort(d.begin(), d.end());
    
    int ret = 0;
    for (int i = 1; i <= m; ++i)
    {
        auto itr = lower_bound(d.begin(), d.end(), i);
        if (itr - d.begin() == n / 2)
        {
            ret++;
        }
    }
    
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int n, a;
    double total = 0;
    cin >> n;
    rep(i, n){
        cin >> a;
        total += 1 / (double)a;
    }
    double ans = 1 / total;
    cout << fixed << setprecision(7) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

int i;
int a[100];

void solve() {
	sort(a, a + i);
	cout << a[i - 1] - a[0]<< endl;
}

int main() {
	cin >> i;
	for (int n = 0; n < i; n++) {
		cin >> a[n];
	}
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//Blackjack
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			String str = sc.nextLine();
			if(str.equals("0"))break;
			String[] s = str.split(" ");
			boolean[] mark = new boolean[22];
			mark[0]=true;
			for(int i=0;i<s.length;i++){
				int x = Integer.parseInt(s[i]);
				if(x>10)x=10;
				boolean[] next = new boolean[22];
				for(int j=0;j<22;j++){
					if(mark[j]){
						if(x!=1){
							if(j+x<22){
								next[j+x]=true;
							}
						}
						else{
							if(j+1<22){
								next[j+1]=true;
							}
							if(j+11<22){
								next[j+11]=true;
							}
						}
					}
				}
				mark = next;
			}
			int max = 0;
			for(int j=21;j>=0;j--)
				if(mark[j]){
					max = j;
					break;
				}
			System.out.println(max);
		}
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i=0; i<N; i++) {
    cin >> D.at(i);
  }
  //頂点1は距離0でないとダメ
  bool bad = true;
  if (D.at(0) != 0) {
    cout << 0 << endl;
    bad = false;
  }

  vector<int> rank(N,0);
  for (int i=0; i<N; i++) {
    rank[D[i]]++;
  }
  
  sort(D.begin(), D.end());
  reverse(D.begin(), D.end());
  int L = D.at(0);
  
  if (rank.at(0) != 1 && bad) {
    cout << 0 << endl;
    bad = false;
  }
  
  else if (bad) {
    ll ans = 1;
    for (int i=0; i<L; i++) {
      //空の層は存在しない
      if (i > 0 && rank.at(i) == 0) {
        ans = 0;
        break;
      }
      else {
        for (int j=1; j<=rank.at(i+1); j++) {
          ans *= rank.at(i);
          ans %= 998244353;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1024
using System;

	class MainClass
	{
		public static void Main (string[] args)
		{
			string str = Console.ReadLine ();
			string[]spStr = str.Split(' ');

			int a = int.Parse (spStr[0]);
			int b = int.Parse (spStr[1]);
			int c = int.Parse (spStr[2]);

			if (a < b && b < c)
			{
				Console.WriteLine ("Yes");
			}
			else
			{
				Console.WriteLine ("No");
			}
		}
}

Measured memory_bytes: 8900
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll N;
        string S;
        cin>>N>>S;
        vl e(N,0);
        vl w(N,0);
        rep(i,N){
            if(i==0){
                if(S[0]=='E')e[0]=1;
                else w[0]=1;
                continue;
            }
            w[i]=w[i-1];
            e[i]=e[i-1];
            if(S[i]=='E')e[i]++;
            else w[i]++;
        }
        ll res=e[N-1]-e[0];
        rep2(i,1,N){
            chmin(res,e[N-1]-e[i]+w[i-1]);
        }
        cout<<res<<endl;
    }

Measured memory_bytes: 5396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string.h>
#include <cmath>

using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i))

int n;
int m;

int s;
int t;

struct edge
{
	int to;
	i64 cost;
};

vector<edge> edges[100010];

int main()
{
	cin >> n >> m;
	cin >> s >> t;
	for(int i = 0;i < m;i++)
	{
		int u,v;
		i64 d;
		cin >> u >> v >> d;
		edges[u].push_back({v,d});
		edges[v].push_back({u,d});
	}

	vector<i64> dist(n + 1,1e18);

	{
		priority_queue<P,vector<P>,greater<P>> que;
		dist[s] = 0;
		que.push({dist[s],s});

		while(!que.empty())
		{
			int v = que.top().second;
			i64 d = que.top().first;
			que.pop();

			if(dist[v] < d) continue;

			for(auto& e : edges[v])
			{
				if(dist[e.to] > d + e.cost)
				{
					dist[e.to] = d + e.cost;
					que.push({dist[e.to],e.to});
				}
			}
		}
	}

	vector<i64> dp_t(n + 1,0);
	vector<i64> dp_s(n + 1,0);
	dp_t[s] = 1;
	dp_s[t] = 1;


	vector<P> vec;
	for(int i = 1;i <= n;i++) vec.push_back({dist[i],i});
	sort(vec.begin(),vec.end());
	i64 MOD = 1e9 + 7;

	// --> t
	for(int i = 0;i < n;i++)
	{
		for(auto & e : edges[vec[i].second])
		{
			if(dist[e.to] == dist[vec[i].second] + e.cost)
				(dp_t[e.to] += dp_t[vec[i].second]) %= MOD;
		}
	}
	for(int i = n - 1;i >= 0;i--)
	{
		for(auto & e : edges[vec[i].second])
		{
			if(dist[vec[i].second] == dist[e.to] + e.cost)
				(dp_s[e.to] += dp_s[vec[i].second]) %= MOD;
		}
	}

	i64 result = dp_t[t] * dp_t[t];
	result %= MOD;

	auto mod = [MOD](i64 num){
		return num % MOD;
	};

	for(int i = 1;i <= n;i++)
	{
		if(dist[i] * 2 == dist[t])
		{
			 (result += MOD - mod(mod(dp_t[i] * dp_t[i]) * mod(dp_s[i] * dp_s[i]))) %= MOD;
		}
	}

	for(int i = 1;i <= n;i++)
	{
		for(auto & e : edges[i])
		{
			int u = i;
			int v = e.to;
			if(dist[u] > dist[v]) continue;
			if(2 * dist[u] < dist[t] && 2 * dist[v] > dist[t] && dist[u] + e.cost == dist[v])
			{
				(result += MOD - mod(mod(dp_t[u] * dp_t[u]) * mod(dp_s[v] * dp_s[v]))) %= MOD;
			}

		}
	}

	cout << result << endl;



}




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

int main() {
  int n;
  cin >> n;
  int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v, v + n);
  double ave = (v[0] + v[1]) * 0.5;
  for (int i = 2; i < n; i++) {
    ave = (ave + v[i]) * 0.5;
  }
  cout << ave << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <scoped_allocator>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector < pair<ll, ll > > vp1;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/


int main()
{
	string a, b;
	cin >> a >> b;
	if (a.size() < b.size()) {
		cout << "LESS" << endl;
	} else if (a.size() > b.size()) {
		cout << "GREATER" << endl;
	} else {
		REP(i, 100) {
			if (a[i] < b[i]) {
				cout << "LESS" << endl;
				break;
			} else if (a[i] > b[i]) {
				cout << "GREATER" << endl;
				break;
			} else if (i == a.size() - 1) {
				cout << "EQUAL" << endl;
				break;
			}
		}
	}
}

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

using namespace std;

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

string L[100];
double P[100];
int A[100];
int B[100];
int C[100];
int D[100];
int E[100];
int F[100];
double S[100];
int M[100];

int t[100];
double profit[100];
double eff[100];

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        REP(i, n){
            cin >> L[i] >> P[i] >> A[i];
            cin >> B[i] >> C[i] >> D[i];
            cin >> E[i] >> F[i] >> S[i] >> M[i];
            t[i] = A[i]+B[i]+C[i]+D[i]+E[i];
            profit[i] = F[i]*S[i]*M[i]-P[i];
            if(M[i]>=2){
                t[i] += (D[i]+E[i])*(M[i]-1);
            }
            eff[i] = profit[i] / t[i];
        }
        
        vector<pair<double, string> > output(n);
        REP(i, n){
            output[i] = make_pair(-eff[i], L[i]);
        }
        sort(output.begin(), output.end());

        REP(i, n){
            cout << output[i].second << endl;
        }
        cout << "#" << endl;
    }
}

Measured memory_bytes: 3120
#include <cstdio>
#include <vector>

int main() {
  int N, T;
  scanf("%d %d", &N, &T);

  int res = 0;
  int last = -T;
  for (int i = 0; i < N; ++i) {
    int t;
    scanf("%d", &t);

    if (last+T < t) {
      res += T;
    } else {
      res += t-last;
    }
    last = t;
  }
  printf("%d\n", res);
}


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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl


void solve(){
    int n;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    int res =0;
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if((arr[i]+arr[j])>arr[k]){
                    if(arr[i]==arr[j] || arr[j]==arr[k]){}
                    else{
                        res++;
                    }

                }
            }
        }
    }
    cout << res << endl;

}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    IOS;
    int T;
    T=1;
    //cin >> T;
    while(T--){
    solve();
    }

    

    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,D,i;
    scanf("%d %d",&D,&N);
    if(N%100==0) N++;
    printf("%d",N);
    for(i=0;i<D;i++)
        printf("00");
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
<?php
/**
 * ABC124
 * C - Coloring Colorfully
 */

$s = trim(fgets(STDIN));
$length = strlen($s);

$count0 = 0;
$count1 = 0;

// 0101010..
for ($i = 0; $i < $length; $i++) {
    if (($i % 2 === 0) and ($s[$i] !== '0')) {
        $count0++;
    } elseif (($i % 2 === 1) and ($s[$i] !== '1')) {
        $count0++;
    }
}

// 1010101..
for ($i = 0; $i < $length; $i++) {
    if (($i % 2 === 0) and ($s[$i] === '0')) {
        $count1++;
    } elseif (($i % 2 === 1) and ($s[$i] === '1')) {
        $count1++;
    }
}
 
echo min($count0, $count1), PHP_EOL;


Measured memory_bytes: 4856
#include <iostream>
#include <string.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    int p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}//gcd

int main()
{
    int a,p;
  	cin >> a >> p;
  	cout << (a*3+p)/2;
}

Measured memory_bytes: 256
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = n * h * N
        b = 4 * h * n - N * n - N * h
        if b > 0 and a % b == 0:
            print(h, n, a // b)
            quit()
assert(False)


Measured memory_bytes: 40796
let m = 1000000007
let n, a, b, dp = Scanf.scanf "%d %d %d" @@ fun n a b -> n, a, b, Array.make (max a b + 1) 0
let ( * ) a b = a * b mod m
let (-) a b = a - b + if a < b then m else 0
let rec f b n = if n <= 0 then 1 else let p = f b (n / 2) in p * p * if n mod 2 = 0 then 1 else b
let _ = dp.(0) <- 1; for i = 1 to max a b do dp.(i) <- dp.(i - 1) * (n - i + 1) * f i (m - 2) done; f 2 n - 1 - dp.(a) - dp.(b) |> Printf.printf "%d\n"

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

int main(void){
  int n; cin >> n;
  int INF = 1001001;
  vector<int> dp(n+1,INF);
  dp[0]=0;
  dp[1]=1;
  
  for(int i=0;i<=n;i++){
    int power = 1;
    rep(j,10){
      if(i-power>=0) dp[i] = min(dp[i],dp[i-power]+1);
      power *= 6;
    }
  }
  for(int i=0;i<=n;i++){
    int power = 1;
    rep(j,10){
      if(i-power>=0) dp[i] = min(dp[i],dp[i-power]+1);
      power *= 9;
    }
  }

  cout << dp[n] << endl;
  
  return 0;
}


Measured memory_bytes: 640
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] a = new int[2][n];
        int[][] c = new int[2][m];
        for(int i = 0 ; i < n ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[j][i] = sc.nextInt();
            }
        }
        for(int i = 0 ; i < m ; i++){
            for(int j = 0 ; j < 2 ; j++){
                c[j][i] = sc.nextInt();
            }
        }
        for(int i = 0 ; i < n ; i++){
            int yono = 0;
            for(int j = 0 ; j < m ; j++){
                if(Math.abs(c[0][yono] - a[0][i]) + Math.abs(c[1][yono] - a[1][i]) > Math.abs(c[0][j] - a[0][i]) + Math.abs(c[1][j] - a[1][i])){
                    yono = j;
                }
            }
            System.out.println(yono + 1);
        }
    }
}
//鶏になれ


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

  //２で割り切れる回数を戻り値とする関数
  int func(int x){
    
    if (x % 2 == 1) {
      return 0;
    }
    
    int s = func(x / 2) + 1;
    return s;
  }
  
int main(void){
  int N;
  cin >> N;
  
  int ans = 1;
  
  //find the one that can be divisible by two.for the most number of times
  for (int i = 1; i <= N; i++) {
    if (func(i) >= func(ans)) {
      ans = i;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


using Graph = vector<vector<int> >;
int N;
Graph G;

int solve(int v = 0, int p = -1) {
    int res = 0;
    for (auto e : G[v]) {
        if (e == p) continue;
        res ^= solve(e, v);
    }

    //cout << v << ": " << res + 1 << endl;
    return res+1;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N) {
        G.assign(N, vector<int>());
        for (int i = 0; i < N-1; ++i) {
            int x, y; cin >> x >> y; --x, --y;
            G[x].push_back(y);
            G[y].push_back(x);
        }
        int grundy = solve() - 1;
        if (grundy) cout << "Alice" << endl;
        else cout << "Bob" << endl;
    }
}


















Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e9
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
vector<pair<int,int>>v;
 ll n,w;
 ll dp[109][100009];
ll solve(int i,int ww)
{
    if(ww>w)
    return -oo;
    if(i==n)
        return 0;
    if(dp[i][ww]!=-1)
        return dp[i][ww];
    return dp[i][ww]=max(solve(i+1,ww),v[i].second+solve(i+1,ww+v[i].first));
}
int main()
{
    _IOS();
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)
    {
        int w,val;
        cin>>w>>val;
        v.push_back({w,val});
    }
    cout<<solve(0,0);
}

//


Measured memory_bytes: 88812
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		sc.close();
		String s = "No";
		if(a==b && b!=c) s="Yes";
		if(a==c && b!=c) s="Yes";
		if(c==b && a!=c) s="Yes";
		System.out.println(s);
	}

}

Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int ans=1;
    for(int i=2;i<=a&&i<=b;i++)
        if(a%i==0 && b%i==0){
            ans*=i;
            a/=i;
            b/=i;
            i-=1;
        }    
    cout<<(long long)ans*a*b<<endl;
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b, c;std::cin >> a >> b >> c;
  std::cout << (a+b+c>=22?"bust":"win") << '\n';
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

  vector<int> x(5);
  for (int i = 0; i < 5; i++) cin >> x[i];

  for (int i = 0; i < 5; i++) {
    if (x[i] == 0) {
      cout << i+1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
 
int main(){
  int x, y;
  string op;
    while(1) {
      cin >> x >> op >> y;
      if (op == "?") {
        break;
      } else if (op == "+") {
        printf("%d\n", x + y);
      } else if (op == "-") {
        printf("%d\n", x - y);
      } else if (op == "*") {
        printf("%d\n", x * y);
      } else if (op == "/") {
        printf("%d\n", x / y);
      }
    }
}

Measured memory_bytes: 3196
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

# MOD = 998244353


N = int(sys.stdin.buffer.readline())

s = {0}
ans = 0
while True:
    ns = set()
    for n in s:
        d = 0
        while n + 6 ** d <= N:
            ns.add(n + 6 ** d)
            d += 1
        d = 0
        while n + 9 ** d <= N:
            ns.add(n + 9 ** d)
            d += 1
    ans += 1
    if N in ns:
        break
    s = ns
print(ans)


Measured memory_bytes: 69576
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

int s,n,t,p,m;
string w,ti;
int can[11000];
const int halfday = 720;
const int week = 10080;

int main(){
  while(cin >> s >> n >> t >> w >> ti >> p >> m,w!="None"){
    for(int i=0;i<week;i++)can[i] = false;

    int loop = (w == "All")?7:1;
    
    if(ti == "All"){
      for(int i=0;i<loop;i++){
	for(int j=0;j<2*halfday;j++)can[i*2*halfday+j] = true;
      }
    }else if(ti == "Day"){
      for(int i=0;i<loop;i++){
	for(int j=0;j<halfday;j++){
	  can[i*2*halfday + j + halfday/2] = true;
	}
      }
    }else{
      for(int i=0;i<loop;i++){
	for(int j=0;j<halfday/2;j++){
	  can[i*2*halfday + j] = true;
	  can[i*2*halfday + j + 3*halfday/2] = true;
	}
      }
    }

    int res = 0;
    //int lim = (w=="All")?2*halfday:week;
    for(int start = 0;start < 2*halfday; start++){
      int now = start;
      int cnt = 0;
      for(int i=0;i<m;i++){
	if(can[now%week] && can[(now+s)%week])cnt++;
	now += t;
      }
      res = max(res,cnt);
    }
    printf("%.10lf\n",1-pow(1-1.0/p,n*res));
  }
}

Measured memory_bytes: 1308
N,M,K = map(int,input().split())
m = 998244353
ans = (M*pow(M-1,N-1,m))%m
alpha = 1
for k in range(1,K+1):
    alpha = (alpha*(N-k)*pow(k,m-2,m))%m
    ans = (ans + M*alpha*pow(M-1,N-k-1,m))%m
print(ans)


Measured memory_bytes: 9168
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC093.A
{
    class Program
    {
        static void Main ()
        {
            var sc = new Scanner ();
            int a = sc.NextInt ();
            int b = sc.NextInt ();
            int k = sc.NextInt ();
            var nums = Enumerable.Range (a, k);
            var nums2 = Enumerable.Range (b - k + 1, k);
            Console.WriteLine (string.Join (" ", Enumerable.Concat (nums, nums2).Where (val => val >= a && val <= b).Distinct ()));
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner ()
        {
            s = new string[0];
            i = 0;
        }

        public string Next ()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine ();
            while (st == "") st = Console.ReadLine ();
            s = st.Split (cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next ();
            i = 0;
            return s[i++];
        }

        public int NextInt ()
        {
            return int.Parse (Next ());
        }
        public int[] ArrayInt (int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt () + add;
            }
            return Array;
        }

        public long NextLong ()
        {
            return long.Parse (Next ());
        }

        public long[] ArrayLong (int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong () + add;
            }
            return Array;
        }

        public double NextDouble ()
        {
            return double.Parse (Next ());
        }

        public double[] ArrayDouble (int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble () + add;
            }
            return Array;
        }

        public decimal NextDecimal ()
        {
            return decimal.Parse (Next ());
        }

        public decimal[] ArrayDecimal (int N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDecimal ();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13396
#include <cstdint>
#include <iostream>

using namespace std;

#define IMAGE_SIZE 50

int32_t main()
{
  uint32_t N, M;
  cin >> N >> M;

  char A[IMAGE_SIZE][IMAGE_SIZE], B[IMAGE_SIZE][IMAGE_SIZE];
  for (uint32_t i = 0; i < N; i++) {
    for (uint32_t j = 0; j < N; j++) {
      cin >> A[i][j];
    }
  }

  for (uint32_t i = 0; i < M; i++) {
    for (uint32_t j = 0; j < M; j++) {
      cin >> B[i][j];
    }
  }

  for (uint32_t i = 0; i < N; i++) {
    for (uint32_t j = 0; j < N; j++) {
      bool is_same = true;
      for (uint32_t k = 0; k < M; k++) {
        for (uint32_t l = 0; l < M; l++) {
          if (((i + k) < N) && ((j + l) < N)) {
            if (A[i + k][j + l] != B[k][l]) {
              is_same = false;
            }
          } else {
            is_same = false;
          }
        }
      }

      if (is_same) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int k;
	cin>> k;
	string s;
	cin>> s;

	if(s.size()<=k) cout<< s << endl;
	else{
		rep(i, k) cout<< s[i];
		cout<< "..." <<endl;
	}
 
	return 0;
}

Measured memory_bytes: 3628
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

bool comp(const string& f, const string& s){
    return f.size() < s.size();
}
int main(void){
    int w, a, b;
    cin >> w >> a >> b;

    if(a + w < b){
        cout << b - (a + w) << endl;
    } else if(b + w < a) {
        cout << a - (b + w) << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <queue>

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

int main()
{
  string s, s1, s2;
  cin >> s;
  s1 = s.substr(0, 2);
  s2 = s.substr(2, 4);
  int temp1, temp2;
  temp1 = stoi(s1);
  temp2 = stoi(s2);
  int flag1, flag2;
  flag1 = flag2 = -1;
  if(temp1 > 0 && temp1 <= 12) {
    flag1 = 0;
  }else{
    flag1 = 1;
  }
  if(temp2 > 0 && temp2 <= 12) {
    flag2 = 0;
  }else{
    flag2 = 1;
  }
  if(flag1 == 0 && flag2 == 0) cout << "AMBIGUOUS" << endl;
  if(flag1 == 1 && flag2 == 0) cout << "YYMM" << endl;
  if(flag1 == 0 && flag2 == 1) cout << "MMYY" << endl;
  if(flag1 == 1 && flag2 == 1) cout << "NA" << endl; 
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan  = new Scanner(System.in);
        int member = scan.nextInt();
        Integer[] friend = new Integer[member];
      
      	for(int i=0;i<member;i++){
          friend[i] = scan.nextInt();
        }
      
        Arrays.sort(friend, Comparator.reverseOrder());
      
      	long point = friend[0];
      	for(int k=2;k<member;k++){
            point = point + friend[(int)k/2];
        }
      System.out.println(String.valueOf(point));
    }
}

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

int main() {
    int N;
    cin >> N;
    vector<double> v(N);
    rep(i, N) cin >> v[i];
    sort(v.begin(), v.end());
    double ans = 0;
    double tmp = (v[0] + v[1]) / 2.0;
    for (int i=2; i<N; ++i) {
        tmp = (tmp + v[i]) / 2.0;
    }
    printf("%.10f\n", tmp);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector< vector<int> > VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef multiset<int> MS;
typedef queue<int> Q;

bool isSquare(int x){
    for(int i=1; i<200; i++){
        if(x == i*i)
            return true;
    }
    return false;
}

int main(){
    int n,d; cin>>n>>d;
    int x[n][d];
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++)
            cin >> x[i][j];
    }
    int ans = 0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            int tmp = 0;
            for(int k=0; k<d; k++)
                tmp += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
            if(isSquare(tmp))
                ans++;
        }
    }
    OUT(ans);
}

Measured memory_bytes: 256
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin  = open("input.txt","r")
    sys.stdout = open("output.txt","w")
    sys.stderr = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
print((min(n, k) * x) + (max(0, n-k) * y))

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int A,B,C;

int main(){
	set<vector<int> > st;
	cin>>A>>B>>C;
	int ct = 0;
	while(1){
		vector<int> v = {A,B,C};
		if(st.find(v)!=st.end()){
			cout<<-1<<endl;
			return 0;
		}
		st.insert(v);
		if(A%2==1 or B%2==1 or C%2==1){
			cout<<ct<<endl;
			return 0;
		}
		int A2 = B/2+C/2, B2 = C/2+A/2, C2 = A/2+B/2;
		A = A2, B = B2, C = C2;
		ct++;
	}
	return 0;
}



Measured memory_bytes: 764
import Control.Monad
import qualified Data.ByteString.Char8 as C
import Data.Function
import Data.List
import Data.Ord
import qualified Data.Sequence as Sq
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main = do
    n <- readLn :: IO Int
    as <- r' :: IO [Int]

    let s = sum as
    let asMapImm = U.accum (+) (U.replicate (10^5+10) 0) (zip as [1,1..]) :: U.Vector Int
    asMap <- U.thaw asMapImm

    q <- readLn :: IO Int

    (_ Sq.:<| res) <- fix (\rec n sq@(ac Sq.:|> s) -> if n == 0 then return sq else do
            [b,c] <- r'
            d <- UM.read asMap b
            v <- UM.read asMap c
            UM.write asMap b 0
            UM.write asMap c (d+v)
            let s' = s - b*d + c*d
            rec (n-1) (sq Sq.|> s')
        ) q (Sq.singleton s)
    mapM_ print res



Measured memory_bytes: 26340