akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        RGBTriplets solver = new RGBTriplets();
        solver.solve(1, in, out);
        out.close();
    }

    static class RGBTriplets {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            char[] strings = in.next().toCharArray();

            long r = 0;
            long g = 0;
            long b = 0;
            for (int i = 0; i < n; i++) {
                if (strings[i] == 'R') {
                    r++;
                }
                if (strings[i] == 'G') {
                    g++;
                }
                if (strings[i] == 'B') {
                    b++;
                }
            }
            long result = r * g * b;
            for (int i = 0; i < n; i++) {
                char ci = strings[i];

                for (int j = i + 1; j < n; j++) {
                    char cj = strings[j];
                    if (ci == cj) {
                        continue;
                    }
                    int k = 2 * j - i;
                    if (n <= k) {
                        continue;
                    }

                    char ck = strings[k];
                    if (ci == ck || cj == ck) {
                        continue;
                    }
                    result--;
                }
            }

            out.append(String.valueOf(result));
        }

    }
}



Measured memory_bytes: 36572
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const ll inf = 1e15;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vi as(n);
	trav(x, as) cin >> x;
	ll ans = inf;
	for(int s = -1; s <= 1; s += 2){
		ll cur = 0, cnd = 0;
		rep(i,0,n){
			cur += as[i];
			int sgn = s * (i&1 ? 1 : -1);
			if(sgn > 0 && cur <= 0){
				cnd += 1 - cur;
				cur = 1;
			} else if(sgn < 0 && cur >= 0){
				cnd += cur + 1;
				cur = -1;
			}
		}
		ans = min(ans, cnd);
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
"use strict";

const main = arg => {
    const input = arg.trim().split('\n');
    let first = input[0].trim().split(' ');
    let second = input[1].trim().split(' ');
    
    function compareFunc(a, b) {
          return a - b;
        }
         
    let numArr = second.map(Number).sort(compareFunc);
    
    let result = 0;
    
    for (let i = 0; i<first[1]; i++) {
        result = result + numArr[i];
    }
    console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 30720
#include "bits/stdc++.h"
using namespace std;
 
#define nl '\n'
#define ll long long 
#define ull unsigned long long
#define debug(x)       { cerr << #x << " = " << x << endl; } 
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
const int Max = (int)2e5+5;
 
//functions
ll lcm(ll a,ll b) {if(a==0 || b==0){return 0;}else{return (a*b)/__gcd(a,b);}}
 
//direction arry
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
//____________________________________________________________________________________________________
void solve()
{
    int k;cin>>k;
    string s;cin>>s;
    if(s.size()<=k)
        cout<<s<<endl;
    else
    {
        for(int i=0;i<k;i++)
            cout<<s[i];
        cout<<"..."<<endl;
    }
}
int main()
{
    fastread;
    int tc=1;
    // cin>>tc;
    while(tc--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define pi 3.1415926536
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int> s
#define lpair pair<LL, LL>
#define MP make_pair
#define INF 2147483647
#define _INF -2147483647
#define MM multimap
#define PB push_back
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
    int N, X;
    cin >> N >> X;
    vi L(100);
    rep(i, 0, N) {
        cin >> L[i];
    }
    int tmp = 0;
    int ans = 1;
    int D = 0;
    rep(i, 1, N + 1) {
        D = tmp + L[i - 1];
        if (D <= X) {
            ans++;
        }
        tmp = D;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

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

int main() {
	int a, b, c, d, n;
	cin >> n;
	a = n / 1000;
	b = (n - a * 1000) / 100;
	c = (n - a * 1000 - b * 100) / 10;
	d = n - 1000 * a - b * 100 - c * 10;
	for (int i = 0; i < 1000000; i++) {
		int op1 = rand();
		int op2 = rand();
		int op3 = rand();
		if (a + b * pow(-1, op1) + c * pow(-1, op2) + d * pow(-1, op3) == 7) {
			cout << a;
			if (op1 % 2 == 0) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << b;
			if (op2 % 2 == 0) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << c;
			if (op3 % 2 == 0) {
				cout << "+";
			}
			else {
				cout << "-";
			}
			cout << d;
			cout << "=7";
			return 0;
		}
	}
}

Measured memory_bytes: 256
m['= r'][5],W,z,k,i,*p;f(i){k[p=m[i]]=p[4]+47?0:p[k]?:1+f(i+~(k%2*W)*~-(k&2));}main(t){for(scanf("%*d%d",&W);m[++i-~W][4]=~getchar(););for(;k--?:(t=k=3,--i);z=z<-t?-t:z)t-=f(i-~W);printf("%d",z);}

Measured memory_bytes: 78464
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
#define int long long
const int N=1e6+5;
char a[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
signed main()
{
	scanf("%s",a+1);
	if(a[1]=='S')puts("Cloudy");
	if(a[1]=='C')puts("Rainy");
	if(a[1]=='R')puts("Sunny");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

  	ll n ,m;
  	cin >> n >> m;
  	vl a(n);
  	double total = 0;
  	ll ninki=0;
  	rep(i,n){ 
      	cin >> a[i];
  		total += a[i];
    }
  	total/=m;
  	total/=4;
  	rep(i,n){
    	if(a[i]>=total){ninki++;}
    }
  	if(ninki>=m)Yes
    No
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    
    int total = accumulate(a.begin(), a.end(), 0);
    int min =  total / (4 * m);
    if (total % (4*m) == 0)
        min--;
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > min)
            count++;
    }
    
    cout << (count >= m ? "Yes" : "No") << endl;
    
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	int hon = n % 10;
	switch (hon)
	{
	case 0: case 1: case 6: case 8:
		cout << "pon\n";
		break;
	case 3:
		cout << "bon\n";
		break;
	default:
		cout << "hon\n";
		break;
	}
	return 0;
}

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

using ll=long long;

int main() {
  vector<int> vec(3);
  rep(i,0,3) cin >>vec[i];
  int count_5=0,count_7=0;
  rep(i,0,3) {
    if (5==vec[i]) count_5++;
    else if (7==vec[i]) count_7++;
  }
  cout << ((count_5==2 && count_7==1) ? "YES" : "NO" ) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.NoSuchElementException;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;
    static Node[] V;

    public static void main(String[] args) {
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	V = new Node[N];
    	for(int i=0; i<N; i++) {
    		V[i] = new Node();
    	}
    	for(int i=0; i<M; i++) {
    		int X = sc.nextInt() - 1;
    		int Y = sc.nextInt() - 1;
    		int Z = sc.nextInt();
    		V[X].nbr.add(Y);
    		V[Y].nbr.add(X);
    	}
    	int ans = 0;
    	for(int i=0; i<N; i++) {
    		if(!V[i].vst) {
    			V[i].dfs();
        		ans ++;
    		}
    	}
    	System.out.println(ans);
    }

    static class Node {
        HashSet<Integer> nbr = new HashSet<>();
        boolean vst = false;
        void dfs() {
        	vst = true;
        	for(int x : nbr) {
        		if(!V[x].vst) {
        			V[x].dfs();
        		}
        	}
        }
    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


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

int shin4[10];
int main() {
    int N, M[3], l[10]; cin >> N;
    for(int i=0; i<3; ++i) cin >> M[i];
    for(int i=0; i<N; ++i) cin >> l[i];
    int ans=1e8, t[3], now;
    while(shin4[N]==0){
        for(int i=0; i<3; ++i) t[i]=0;
        now=0;
        for(int i=0; i<N; ++i){
            if(shin4[i]<3){
                if(t[shin4[i]]>0) now += 10;
                t[shin4[i]] += l[i];
            }
        }
        bool f=true;
        for(int i=0; i<3; ++i){
            if(t[i]<1){
                f=false;
                break;
            }
            else now += abs(M[i]-t[i]);
        }
        if(f) ans=min(ans, now);
        ++shin4[0];
        for(int i=0; shin4[i]==4; ++i){
            shin4[i]=0;
            ++shin4[i+1];
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

ll dp[100010][2];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string L;
    cin>>L;
    dp[0][0]=1;
    rep(i,L.size()){
        if(L[i]=='0'){
            dp[i+1][0]=dp[i][0] %MOD;
            dp[i+1][1]=dp[i][1]*3 %MOD;
        } else{
            dp[i+1][0]=dp[i][0]*2%MOD;
            dp[i+1][1]=(dp[i][1]*3+dp[i][0])%MOD;
        }
    }
    ll ans=(dp[L.size()][0]+dp[L.size()][1])%MOD;
    cout<<ans<<endl;
    return 0;
}

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


using namespace std;  
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const double eps = 1e-14;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl  
#define DIV 1000000007

int main(){
	int road[50][50];
	fill_n(road[0],50*50,0);
	int N,M; cin >> N >> M;
	for(int i = 0; i < M; i++){
		int a,b;
		cin >> a >> b;
		a -= 1; b -= 1;
		road[a][b]++;
		road[b][a]++;
	}
	for(int i = 0; i < N; i++){
		int ans = 0;
		for(int j = 0; j < 50; j++)
			if(road[i][j])
				ans += road[i][j];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	count := 0
	min := math.MaxInt32
	sum := 0
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		if tmp < 0 {
			count++
		}
		y := abs(tmp)
		if y < min {
			min = y
		}
		sum += y
	}
	if count % 2 == 0 {
		fmt.Println(sum)
	} else {
		fmt.Println(sum - min - min)
	}
}

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

Measured memory_bytes: 5504
// Try AtCoder
    // author: Leonardone @ NEETSDKASU
    package main
     
    import "fmt"
     
    func main() {
        var n, a, b int
        fmt.Scan(&n, &a, &b)
        min := (n - 1) * a + b
        max := a + (n - 1) * b
        ans := max - min + 1
        if ans < 0  || (n == 1 && a != b) {
            ans = 0
        }
        fmt.Println(ans)
    }

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

 
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using vi =vc<int>;
long gcd(long a,long b){
    if( b==0) return a; 
    else return gcd(b,a%b);
} 

int fact(int n){
  if(n == 0) return 1;
  return fact(n -1);

}
int main(){
    int t;
    cin >> t;
    long a,b,c,d;
    long g;
    rep(i,t){
        cin >> a >> b >> c >> d;
        g = gcd(b,d);
            if(b>a){
                puts("No");
            }else if(b>d){
               puts("No"); 
            }else if(c>=b){
                puts("Yes");

            }else if((b-g+(a%g))>c){
                puts("No");
               }else{
                   puts("Yes");
               }

    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;

int isPrime(LL p){
	if(p<=1) return 0;
	if(p==2 || p==3 || p==5 || p==7) return 1;
	if(p==4 || p==6 || p==8 || p==9) return 0;

	LL i;
	int ret = 1;
	for(i=2; i*i<=p; i++){
		if(p%i==0 && i!=p){
			ret = 0;
			break;
		}
	}
	return ret;
}

void factorize(long long N, map<long long, int> &mp){
	if(N == 1){
		return;
	}
	if(isPrime(N)){
		mp[N] += 1;
		return;
	}

	long long i = 2, n = N;
	for(i = 2; n != 1 && i < (N/2) + 1; i++){
		if((n % i)==0){
			if(isPrime(i)){
				int e = 0;
				long long u = n;
				while((u % i)==0){
					e++;
					u = u / i;
					n = u;
				}
				mp[i] = e;
				if(isPrime(n)){
					mp[n] = 1;
					break;
				}
			}
		}
	}
	return;
}


int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N;
	cin >> N;

	vector<map<long long, int>> V;
	map<long long, int> M;

	for(int i=1; i<=N; i++){
		map<long long, int> m;
		factorize((long long)i, m);
		V.push_back(m);
	}
	for(int i=0; i<V.size(); i++){
		auto m = V[i];
		for(auto itr = m.begin(); itr != m.end(); itr++){
			long long k = itr->first;
			int v = itr->second;
			if(M.count(k) == 0){
				M[k] = v;
			}
			else{
				M[k] += v;
			}
		}
	}

	int c3 = 0, c5 = 0, c15 = 0, c25 = 0,c75 = 0;
	for(auto itr = M.begin(); itr!= M.end(); itr++){
		long long k = itr->first;
		int v = itr->second;
		if(v >= 2){ c3++; }
		if(v >= 4){ c5++; }
		if(v >= 14){ c15++; }
		if(v >= 24){ c25++; }
		if(v >= 74){ c75++; }

	}

	if(c5 <= 1){
		printf("0\n");
		return 0;
	}

	long long ans = 0;
	if(c5 >= 2){
		ans += (c5*(c5-1)*(c5-2)/6)*3;
		ans += ((c3-c5) * (c5*(c5-1)/2));
	}
	if(c15 >= 1){
		ans += (c15*(c15-1));
		ans += ((c5-c15)*c15);
	}
	if(c25 >= 1){
		ans += (c25*(c25-1));
		ans += ((c3-c25)*c25);
	}
	if(c75 >= 1){
		ans += c75;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3748
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

struct A{
	int a[7];
	bool operator < (A y) const {
		rep(i,7){
			if(this->a[i] < y.a[i])return true;
			if(this->a[i] > y.a[i])return false;
		}
		return false;
	}
	bool operator == (A y) const {
		rep(i,7){
			if(this->a[i] != y.a[i])return false;
		}
		return true;
	}
};

map<A,int> M;
A q[5050];
void init(){
	A a;
	rep(i,7)a.a[i] = i+1;
	int k = 0;
	do {
		M[a] = k;
		rep(i,7)q[k] = a;
		k ++;
	}while(next_permutation(a.a,a.a+7));
}

int main(){
	init();
	
	int n;
	int d[102],a[102];
	scanf("%d",&n);
	rep1(i,n)scanf("%d",&d[i]);
	rep1(i,n)scanf("%d",&a[i]);
	
	if(n <= 7){
		int per[10]; rep(i,n)per[i] = i+1;
		int ret = 0;
		do {
			int sum = 0;
			int D[10] = {};
			rep(i,n){
				sum += D[per[i]];
				for(int j = max(1,per[i]-d[per[i]]) ; j <= min(n,per[i]+d[per[i]]) ; j ++){
					D[j] += a[per[i]];
				}
			}
			ret = max ( ret , sum );
		}while(next_permutation(per,per+n));
		printf("%d\n",ret);
		return 0;
	}
	
	static int dp[102][5050] = {};
	for(int i = 0 ; i < 5040 ; i ++){
		dp[7][i] = 0;
		rep1(j,7)for(int k = j+1 ; k <= 7 ; k ++){
			if(q[i].a[j-1] < q[i].a[k-1]){
				if(d[j] >= abs(j-k))dp[7][i] += a[j];
			}
			else {
				if(d[k] >= abs(j-k))dp[7][i] += a[k];
			}
		}
	}
	for(int x = 7 ; x <= n-1 ; x ++){
		for(int y = 0 ; y < 5040 ; y ++){
			for(int i = 0 ; i <= 7 ; i ++){
				A q_ = q[y];
				int ret = dp[x][y];
				for(int j = 0 ; j < 7 ; j ++){
					if(q_.a[j] <= i){
						if(d[x-6+j] >= 7-j)ret += a[x-6+j];
					}
					else {
						if(d[x+1] >= 7-j)ret += a[x+1];
					}
				}
				int nex;
				rep1(j,6)if(q_.a[j] > i)q_.a[j] ++;
				int memo = q_.a[0];
				rep(j,6)q_.a[j] = q_.a[j+1];
				q_.a[6] = i+1;
				rep(j,7)if(q_.a[j] > memo)q_.a[j] --;
				nex = M[q_];
				dp[x+1][nex] = max ( dp[x+1][nex] , ret );
			}
		}
	}
	
	int ret = 0;
	rep(i,5040)ret = max ( ret , dp[n][i] );
	cout << ret << endl;
}

Measured memory_bytes: 3592
program pr1
  implicit none
  integer :: a,b,c, i, j, k
  read(*,*) a, b, c
  j = 0
  do i = a, b
     if ( mod(i,c) == 0 ) then
        j = j + 1
     end if
  end do
  write(*,'(i0)') j

  stop
end program pr1


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

int main(){
  string s;
  cin>>s;
  int tmp=1;
  vector<P> p;
  int right = 0, left = 0; 
  rep(i,s.size()-1){
    if(s[i] == 'R') right++;
    if(s[i] == 'L') left++;
    if(s[i]=='L' && s[i+1]=='R'){
      p.push_back(make_pair(right,left));
      right = 0; left = 0;
    }
  }
  p.push_back(make_pair(right,left+1));
  vector<int> ans;
  for(auto x : p){
    rep(i,x.first+x.second){
      if(i == x.first-1) ans.push_back((x.first + 1) / 2 + x.second /2);
      else if(i == x.first) ans.push_back((x.second + 1) / 2 + x.first /2);
      else ans.push_back(0);
    }
  }
  for(auto a : ans){
    cout<<a<<" ";
  }
  cout<<endl;
}

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

void shake(int D[], char c) {
		int tmp;
		switch (c) {
				case 'S':
						tmp = D[0];
						D[0] = D[4];
						D[4] = D[5];
						D[5] = D[1];
						D[1] = tmp;
						break;
				case 'E':
						tmp = D[0];
						D[0] = D[3];
						D[3] = D[5];
						D[5] = D[2];
						D[2] = tmp;
						break;
				case 'W':
						tmp = D[0];
						D[0] = D[2];
						D[2] = D[5];
						D[5] = D[3];
						D[3] = tmp;
						break;
				case 'N':
						tmp = D[0];
						D[0] = D[1];
						D[1] = D[5];
						D[5] = D[4];
						D[4] = tmp;
						break;
				case 'R':
						tmp = D[1];
						D[1] = D[3];
						D[3] = D[4];
						D[4] = D[2];
						D[2] = tmp;
						break;
				case 'L':
						tmp = D[1];
						D[1] = D[2];
						D[2] = D[4];
						D[4] = D[3];
						D[3] = tmp;
						break;
		}
}

void print(int D[], int n)
{
		int i;
		cout << "\n---" << n << "---\n";
		for (i=0; i<6; i++) cout << "D[" << i << "]:" << D[i] << "\n";
}

int main()
{
		int n;
		cin >> n;
		int D[n][6], i, j, x, y;
		bool is=false;
		string op;
		for (i=0; i<n; i++) for (j=0; j<6; j++) cin >> D[i][j];

		for (x=0; x<n; x++) {
				for (y=0; y<n; y++) {
						if (x==y) break;

						op = "NNNNRNNNN";
						for (i=0; i<op.size(); i++) {
								if (D[x][0]==D[y][0]&&D[x][5]==D[y][5]) break;
								else shake(D[y], op[i]);
						}

						op = "RRRR";
						for (i=0; i<op.size(); i++) {
								if (D[x][0]==D[y][0]&&D[x][1]==D[y][1]) {
										if (D[x][2]==D[y][2]&&D[x][3]==D[y][3]) {
										if (D[x][4]==D[y][4]&&D[x][5]==D[y][5]) {
										is=true;
										break;
										}
										}
								}
								shake(D[y], op[i]);
						}
						if (is) break;
				}
				if (is) break;
		}

		if (is) cout << "No\n";
		else cout << "Yes\n";
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

int main() {
  int N; cin >> N;
  vi h(N); rep(i,N) cin >> h.at(i);
  
  int V = 0;
  int E = 0;
  rep(i,N) {
    V += h[i];
  }
  for(int i = 1; i < N; i++) {
    E += min(h[i-1],h[i]);
  }
  
  cout << V-E << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int x,tmp;
    cin >> x;
    tmp = x;
    bool flag=true;
    while(1){
        flag=true;
        for(int i=2;i<tmp;i++){
            if (tmp%i==0){
                flag = false;
                break;
            }
        }
        if(flag==false){
        tmp+=1;
        }
        else{break;}
    }
    cout << tmp << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
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; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A,B,C,D,p;
    cin >> A >> B >> C >> D >> p;
    cout << min(A*p , B+max(0,p-C)*D) << enld;
    
    return 0;
}


Measured memory_bytes: 3132
def f():
  while True:
    r,c = map(int,input().split())
    if not r:
      break
    lst = [list(map(int,input().split())) for i in range(r)]
    dic = [0 for i in range(2 ** r)]
    for i in range(c):
      num = 0
      for j in range(r):
        num *= 2
        num += lst[j][i]
      dic[num] += 1
    ans = 0
    for i in range(2 ** r):
      ret = 0
      for j in range(2 ** r):
        num = (i ^ j)
        cnt = 0
        for k in range(r):
          cnt += num % 2
          num //= 2
        ret += max(cnt, r - cnt) * dic[j]
      ans = max(ans, ret)
    print(ans)
f()


Measured memory_bytes: 6972
#include <iostream>
using namespace std;
int a, b;
int d[5];

int main(){ 
    cin >> a >> b;
    int count =0;
    for (int i=a;i<=b;++i){
        int x = i;
        for (int j=0;j<5;++j) {
            d[4-j] = x%10;
            x /= 10;
        }
        if (d[0]==d[4]&&d[1]==d[3]) {
            ++count;
        }
    }
    cout << count << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar(),rev=0;
	while(ch>'9'||ch<'0') rev=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	x=rev?-x:x;
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,a[N],b[N],c[N];
char s[N];

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++) a[i]=s[i]-'a';
	bool isok=1;
	for(int i=2;i<=n;i++) 
		if(a[i]!=a[i-1]) isok=0;
	if(isok){puts("0");return 0;}
	int ans=inf;
	for(int cc=0;cc<26;cc++){
		cpy(b,a);
		for(int i=1;i<=n;i++){
			bool isok=1;
			cpy(c,b);
			for(int j=1;j<=n-i;j++)
				if(c[j]==cc||c[j+1]==cc) b[j]=cc; else b[j]=c[j];
			for(int j=1;j<=n-i;j++)
				if(b[j]!=cc) isok=0;
			if(isok) gmin(ans,i);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}

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

int main(){
    ll n, t, ans = 1;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    shojikin = 1000
    mochikabu = 0

    result = []
    for idx, a in enumerate(A):
        if idx == N-1:
            break
        if A[idx] <= A[idx+1]:
            # mochikabuをmaxにし、shojikinをminに
            available = shojikin // A[idx]
            mochikabu += available
            shojikin -= available * A[idx]

        elif A[idx] > A[idx+1]:
            # shojikinをminにし、shojikinをmaxに
            shojikin += mochikabu * A[idx]
            mochikabu = 0

    shojikin += mochikabu * A[-1]
    print(shojikin)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9084
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [](auto& i, auto& j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n;
  int ans = 0;

  cin >> n;
  vi v(n);
  REP(i, n) {
    cin >> v[i];
  }
  for(int i = 1; ;i++) {
    int b = 1 << i;
    if(!all_of(ALL(v), lambda(x){return x % b == 0;})) {
      cout << i - 1 << endl;
      return;
    }
  }

  cout << ans << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define LINE_BUF_SIZE 256

/*abc050さんのコードを参考にしました*/

void merge_sort(int *A, int left, int right, int *tmp){

    if(right - left > 1){   /*最小のサブリストであるかどうか*/
        
        int i,j,k,half = (right+left)/2;

        merge_sort(A,left,half,tmp);    /*右のブロック*/
        merge_sort(A,half,right,tmp);   /*左のブロック*/

        for(i=left;i<right;i++){
            tmp[i]=A[i];
        }
        
        for(i = left,j = left,k = half;i<right;i++){
            if(k == right){
                A[i] = tmp[j];
                j++;
            }
            else if(tmp[j] <= tmp[k] && j < half){
                A[i] = tmp[j];
                j++;
            }
            else{
                A[i] = tmp[k];
                k++;
            }
        }

    }

}

void pre_merge_sort(int *A, int N){
    int *tmp = (int *)malloc(sizeof(int)*N);
    merge_sort(A,0,N,tmp);
    free(tmp);
}

int main(){

    int i,j,k;
    int N;
    char line[LINE_BUF_SIZE];

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d", &N);

    int *X = (int *)malloc((sizeof(int)*(N+1)));
    int *X_copy = (int *)malloc((sizeof(int)*(N+1)));

    for(i=0;i<N;i++){
        scanf("%d",&X[i]);
        X_copy[i] = X[i];
    }

    pre_merge_sort(X,N);

    for(i=0;i<N;i++){
        if(X_copy[i] <= X[N/2-1])printf("%d\n",X[N/2]);
        else printf("%d\n",X[N/2-1]);
    }

    return 0;

}

Measured memory_bytes: 3696
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, M = map(int, readline().split())
A = list(map(int, readline().split()))

A.sort(reverse=True)
if A[M-1] >= sum(A)/(4*M): 
    print('Yes')
else: 
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

  while (true) {
	int n, k;
	scanf( "%d %d\n", &n, &k );
	if ( n == 0 && k == 0 ) break;

	vector<int> v( k );
	for ( int i = 0; i < k; i++ ) {
	  int val;
	  scanf( "%d\n", &val );
	  v[ i ] = val;
	}
	
	sort( v.begin(), v.end() );
	bool hasWhite = ( v[ 0 ] == 0 );
	if ( hasWhite ) {
	  
	}
	
	vector<pair<int, int>> ps;
	int start = v[ 0 ];
	int before = v[ 0 ];
	for ( int i = 1; i < k; i++ ) {
	  if ( v[ i ] - before == 1 ) {
		before = v[ i ];
	  } else {
		ps.push_back( make_pair( start, before ) );
		start = before = v[ i ];
	  }
	}
	ps.push_back( make_pair( start, before ) );

	int maxSize = 0;
	for ( auto p : ps ) {
	  maxSize = max( maxSize, p.second - p.first + 1 );
	}

	if ( hasWhite ) {
	  for ( int i = 0; i < ps.size() - 1; i++ ) {
		if ( ps[ i + 1 ].first - ps[ i ].second == 2 ) {
		  maxSize = max( maxSize, ps[ i + 1 ].second - ps[ i ].first + 1 );
		}
	  }
	}
	cout << maxSize << endl;
  }
  return 0;
}

Measured memory_bytes: 1656
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
    private BufferedReader in;
    private StringTokenizer tok;
    private PrintWriter out;

    //------------------------------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    private void solve() throws IOException {
        String s = readString();
        int k = readInt();
        TreeSet<String> set = new TreeSet<>();
        for (int len = 1; len <= k; len++) {
            for (int l = 0, r = len - 1; r < s.length(); l++, r++) {
                set.add(s.substring(l, r + 1));
            }
        }
//        System.err.println(set);
        for (int i = 0; i < k - 1; i++) {
            set.pollFirst();
        }
        out.println(set.first());
    }

    private void run() {
        try {
            initIO();
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    private void initIO() throws IOException {
        try {
            in = new BufferedReader(new FileReader(new File("input.txt")));
            out = new PrintWriter(new File("output.txt"));
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    private String readString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}


Measured memory_bytes: 24796
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n=int(input())
    xx=list(map(int, input().split()))
    cxx=sorted(xx)
    m0=cxx[n//2-1]
    m1=cxx[n//2]
    for x in xx:
        if x<=m0:print(m1)
        else:print(m0)

main()

Measured memory_bytes: 25572
import collections
S = input()

if(S == "zyxwvutsrqponmlkjihgfedcba"):
    print(-1)
    exit()
    
alp = "abcdefghijklmnopqrstuvwxyz"
r = S[::-1]

c = collections.Counter(S)
c_s = sorted(c.items(), key=lambda x:x[0])
tmp = ""

for i in range(len(c_s)):
    tmp += c_s[i][0]

if(len(S) < 26):
    for i in range(len(alp)):
        if(alp[i] not in tmp):
            print(S+alp[i])
            break
else:
    for i in range(len(S)-1):
        if(r[i] > r[i+1]):
            cha = sorted(r[:(i+1)])
            for j in range(len(cha)):
                if(cha[j] > r[i+1]):
                    print(S[:(len(S)-i-2)]+cha[j])
                    exit()

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

using namespace std;


int main(){
    int num_mask,num_query;
    int command,mask_idx;
    int k,bit_idx;

    scanf("%d",&num_mask);
    bitset<64> status_bit(0);
    vector<bitset<64> > mask_array(num_mask,bitset<64>(0));

    for(int i = 0;i < num_mask;i++){
        scanf("%d",&k);
        for(int j = 0;j < k;j++){
            scanf("%d",&bit_idx);
            mask_array[i].set(bit_idx);
        }
    }
    scanf("%d",&num_query);
    for(int i = 0;i < num_query;i++){
        scanf("%d",&command);
        switch(command){
            case 0: // test
                scanf("%d",&mask_idx);
                if(status_bit.test(mask_idx)) printf("1\n");
                else printf("0\n");
                break;
            case 1: // set
                scanf("%d",&mask_idx);
                status_bit |= mask_array[mask_idx];
                break;
            case 2: // clear
                scanf("%d",&mask_idx);
                status_bit &= ~mask_array[mask_idx];
                break;
            case 3: // flip
                scanf("%d",&mask_idx);
                status_bit ^= mask_array[mask_idx];
                break;
            case 4: //all
                scanf("%d",&mask_idx);
                if((status_bit&mask_array[mask_idx]).count() == mask_array[mask_idx].count()) printf("1\n");
                else printf("0\n");
                break;
            case 5: //any
                scanf("%d",&mask_idx);
                if((status_bit&mask_array[mask_idx]).count() != 0) printf("1\n");
                else printf("0\n");
                break;
            case 6: //none
                scanf("%d",&mask_idx);
                if((status_bit&mask_array[mask_idx]).count() == 0) printf("1\n");
                else printf("0\n");
                break;
            case 7: //count
                scanf("%d",&mask_idx);
                printf("%d\n",(unsigned int)(status_bit&mask_array[mask_idx]).count());
                break;
            case 8: // val
                scanf("%d",&mask_idx);
                printf("%lu\n",(status_bit&mask_array[mask_idx]).to_ulong());
                break;
        }
    }
    return 0;   
}



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

int main(){
  int N,K;
  cin >> N >> K;

  double p = 0;
  for(int i=1; i<=N; i++){
    int cnt_K = 0;
    int score = i;
    while(score < K){
      cnt_K++;
      score *= 2;
    }
    p += (1.0/N) * pow(0.5,cnt_K);
  }  
  cout << fixed << setprecision(12) << p << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include "math.h"


using namespace std;

int main()
{
	int a[4] = {};
	int x[6];
	for (int i = 0; i < 6; i++) {
		cin >> x[i];
	}
	
	for (int i = 0; i < 6; i++) {
		a[x[i] - 1]++;
		if (a[x[i] - 1] == 3) {
			cout << "NO" << endl;
			return 0;
		}
	}
	
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, w;
  cin >> n >> w;
  vl c(n), v(n);
  rep(i, n) cin >> c[i] >> v[i];
  ll dp[n + 1][500][101] = {};
  rep(i, n + 1) rep(j, 500) rep(k, 101) dp[i][j][k] = -1;
  dp[0][0][0] = 0;
  rep(i, n) rep(j, 410) rep(k, 100) {
    if(dp[i][j][k] == -1) continue;
    dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
    ll nj = j + c[i] - c[0];
    dp[i + 1][nj][k + 1] = max(dp[i + 1][nj][k + 1], dp[i][j][k] + v[i]);
  }
  ll ans = 0;
  rep(j, 410) rep(k, 101) if(j + k * c[0] <= w) ans = max(ans, dp[n][j][k]);
  cout << ans << endl;
}

Measured memory_bytes: 40064
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
#include <math.h>
#include <tgmath.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}

ll comb2(ll a) {
    ll b = a / 2;
    if (a % 2) {
        b = (a - 1) / 2;
        return (b * a);
    }
    return (b * (a - 1));
}

int dfs(int x, int y, int z) {
    if (x == a && y == b && z == c) return 1;
    
    int ans = 0;
    if (x != a) ans += dfs(x + 1, y, z);
    if (x >= y + 1/* && y != b*/) ans += dfs(x, y + 1, z);
    if (y >= z + 1/* && z != c*/) ans += dfs(x, y, z + 1); 

    return ans;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;

    m = n / 100;
    l = (n - m * 100) / 10;

    if (m == 7 || l == 7 || n - m * 100 - l * 10 == 7)
    cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 3616