akhauriyash/Code-Regression huggingface dataset:
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import Data.Ord

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

elemCountOrd :: (Ord a) => [a] -> [(a, Int)]
elemCountOrd = map (\l -> (head l, length l)) . group . sort

main = do
  [n, k] <- getIntList
  as <- getIntList
  let as' = elemCountOrd as
  let las = length as'
  if las <= k
    then print 0
    else print $ sum (map (\x -> snd x) (take (las - k) (sortBy (comparing snd) as')))


Measured memory_bytes: 61860
<?php
$D=[];
$D[0]=(int)trim(fgets(STDIN));

for($i=1;$i<10;$i++){
  $d=(int)trim(fgets(STDIN));
  if($D[0]<$d){$D[$i]=$D[0];$D[0]=$d;}
  else{$D[$i]=$d;}
}
for($j=1;$j<3;$j++){
  for($i=$j+1;$i<10;$i++){
    if($D[$j]<$D[$i]){$d=$D[$i];$D[$i]=$D[$j];$D[$j]=$d;}
  }
}

echo $D[0],PHP_EOL,$D[1],PHP_EOL,$D[2];
?>

Measured memory_bytes: 15440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;  
  int a[N];
  rep(i,N) cin >> a[i];
  vector<int > ans;
  ans.pb(a[0]);
  rep1(i,N-1){
    int n=ans.size();
    //    rep(i, n) cout << ans[i];
    //    cout << ""<<endl;
    if(ans[0]<a[i]){
      ans[0]=a[i];
    }
    else if(ans[n-1]>=a[i]){
      ans.pb(a[i]);
    }
    else{
      int lb=0;
      int ub=n-1;
      bool update=true;
      while(update){
	update=false;
	int mid=(lb+ub)/2;
	if(ans[mid]>=a[i]){
	  if(mid!=lb) update=true;
	  lb=mid;
	}
	else{
	  if(mid!= ub) update=true;
	  ub=mid;
	}
	//	cout << mid << endl;
      }
      ans[ub]=a[i];
    }    
  }
  cout << ans.size() << endl;
  
  return 0;
    

}


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

int main() {
  int n,t,a;
  cin>>n>>t>>a;
  vector<double>vec(n);
  vector<double>vek(n);
  for(int i=0;i<n;i++) {
    int h;
    cin>>h;
    double d=a;
    double b=t-h*0.006;
    vec.at(i)=abs(max(d,b)-min(d,b));
    vek.at(i)=abs(max(d,b)-min(d,b));
  }
  sort(vec.begin(),vec.end());
  double c=vec.at(0);
  for(int j=0;j<n;j++) {
    if(c==vek.at(j)) {
      cout<<j+1<<endl;
      break;
    }
  }
}

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

using namespace std;

struct Node {
  int i;
  vector<int> neighbors;
};
int k;
vector<Node> nodes;

long long dfs(int current, int before, int current_k, int depth) {
  long long result = current_k;
  long long child_k = depth == 1 ? k - 1 : k - 2;
  for (int i : nodes[current].neighbors) {
    if (i == before) {
      continue;
    }
    result = result * dfs(i, current, child_k--, depth+1) % 1000000007;
  }
  
  return result;
}

int main() {
  int n,a,b;
  cin >> n;
  cin >> k;
  
  for (int i = 0; i <= n; i++) {
    nodes.push_back({i, {}});
  }
  for (int i = 0; i < n - 1; i++) {
	cin >> a;
    cin >> b;
    nodes[a].neighbors.push_back(b);
    nodes[b].neighbors.push_back(a);
  }
  
  int start_node = 1;
  long long result = dfs(start_node, -1, k, 1);
  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 12396
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	Scanner scn=new Scanner(System.in);
	int []arr=new int [5];
	int ans=0;
	for(int i=0;i<5;i++) {
		arr[i]=scn.nextInt();
		if(arr[i]==0)
			ans=i+1;
	}
	System.out.println(ans);
}
}


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

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

    long double ans = 0.000000000;
    for (int i = 1; i <= N; i++) {
        int point = i;
        double coin = 1.00000000;
        while (point < K) {
            point *= 2;
            coin *= 0.5;
        }
        ans += coin;
    }
    cout << setprecision(10) << ans / N << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int m = scanner.nextInt();
            if (m == 0) {
                break;
            }
            int n = scanner.nextInt();
            int acc0 = 1;
            int counter = 0;
            for (int i = 0; ; i++) {
                int acc1 = acc0;
                for (int j = 0; ; j++) {
                    int acc2 = acc1;
                    for (int k = 0; ; k++) {
                        if (acc2 >= m && acc2 <= n) {
                            counter++;
                        } else if (acc2 > n) {
                            break;
                        }
                        acc2 *= 5;
                    }
                    if (acc1 > n) {
                        break;
                    }
                    acc1 *= 3;
                }
                if (acc0 > n) {
                    break;
                }
                acc0 *= 2;
            }
            System.out.println(counter);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  ll X,Y; cin>>X>>Y;
  ll r1 = 0;
  ll n = X;
  while(n<=Y){
    n *= 2;
    ++r1;
  }
  ll r2 = 0;
  if(Y%2==0){
    n = Y;
    while(n>=X && n%2==0){
      n /= 2;
      ++r2;
    }
  }
  cout << max(r1,r2);
}

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

int main(){
  char c;
  cin >> c;
  
  if(c == 'a' | c == 'e' | c == 'i' | c == 'o' | c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  
}

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

typedef vector<string> board;

struct Mino {
    int h, w;
    board s;
};

vector<Mino> minos(4);
set<board> st;
const int H = 4, W = 10;

void input() {
    for(auto &m : minos) {
        cin >> m.h >> m.w;
        m.s.resize(m.h);
        rep(i, m.h) cin >> m.s[i];
    }
}

bool fill(Mino &m, int n, board &base) {
    int y = n / W, x = n % W;
    if(y + m.h > H || x + m.w > W) return false;
    rep(i, m.h) rep(j, m.w) {
        if(m.s[i][j] == '#') {
            if(base[y + i][x + j] == '#') base[y + i][x + j] = '.';
            else return false;
        }
    }
    return true;
}

void solve() {
    vector<int> id = {0, 1, 2, 3};
    do {
        rep(i, 40) rep(j, 40) rep(k, 40) {
            board base(H, string(W, '#'));
            if(fill(minos[id[0]], i, base)
            && fill(minos[id[1]], j, base)
            && fill(minos[id[2]], k, base)) st.insert(base);
        }
    } while(next_permutation(id.begin(), id.end()));
}

bool check() {
    board B(H);
    rep(i, H) cin >> B[i];
    return st.count(B);
}

int main() {
    input();
    solve();
    int N; cin >> N;
    rep(i, N) cout << (check() ? "Yes" : "No") << '\n';
    return 0;
}



Measured memory_bytes: 9644
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  int f=abs(x-a);
  int g=abs(x-b);
  if(f<g){
    cout<<"A"<<endl;
  }else{
    cout<<"B"<<endl;
  }
}


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

int main() {
  int a, b, c, k;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  if(k <= a)
    printf("%d\n", k);
  else if(k <= a + b)
    printf("%d\n", a);
  else
    printf("%d\n", a - (k - a - b));
}

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

int main(){
  ll i,j;
  ll n;
  cin>>n;
  ll a[n],b[n];
  for(i=0;i<n;i++) cin>>a[i];
  ll ans=0;
  ll c;
  for(i=0;i<n;i++){
    cin>>c;
    if(a[i]-c>0) ans+=a[i]-c;
  }
  cout<<ans<<endl;
 
}

Measured memory_bytes: 384
def insertionSort(A,N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(" ".join(map(str,A)))

n = int(input())
numlist = [int(x) for x in input().split()]

insertionSort(numlist,n)


Measured memory_bytes: 5604
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int n; cin >> n;
	set<pair<int , int> > xb, yb;
	priority_queue<tuple<int, int, int> > q;
	int x, y;
	REP(i, n){
		cin >> x >> y;
		if(!i) q.push(make_tuple(0, x, y));
		xb.insert(make_pair(x, y));
		yb.insert(make_pair(y, x));
	}
	while(!q.empty()){
		int cost;
		tie(cost, x, y) = q.top();
		q.pop();
		if(xb.find(make_pair(x, y)) == xb.end()) continue;
		//cout << x << " " << y << " " << cost << endl;
		ans += -cost;
		xb.erase(make_pair(x, y));
		yb.erase(make_pair(y, x));
		pair<int, int> u, r, l, d;
		auto it = xb.upper_bound(make_pair(x, y));
		if(it != xb.end()){
			r = *it;
			q.push(make_tuple(-min(abs(x-r.first), abs(y-r.second)), r.first, r.second ));
			//cout << -min(abs(x-r.first), abs(y-r.second)) << " " << r.first << " " <<  r.second << endl;
		}
		if(it != xb.begin()){
			it--;
			l = *it;
			q.push(make_tuple(-min(abs(x-l.first), abs(y-l.second)), l.first, l.second ));
			//cout << -min(abs(x-l.first), abs(y-l.second)) << " " << l.first << " " <<  l.second << endl;
		}
		it = yb.upper_bound(make_pair(y, x));
		if(it != yb.end()){
			u = *it;
			q.push(make_tuple(-min(abs(x-u.second), abs(y-u.first)), u.second, u.first ));
			//cout << -min(abs(y-u.first), abs(x-u.second)) << " " << u.second << " " <<  u.first << endl;
		}
		if(it != yb.begin()){
			it--;
			d = *it;
			q.push(make_tuple(-min(abs(x-d.second), abs(y-d.first)), d.second, d.first ));
			//cout << -min(abs(y-d.first), abs(x-d.second)) << " " << d.second << " " <<  d.second << endl;
		}
	}

	cout << ans << endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

int color[512][512];

int main2() {
  int H = nextInt();
  int W = nextInt();
  int d = nextInt();
  memset(color, -1, sizeof(color));
  string s = "RYGB";
  
  if (d % 2 == 1) {
    REP(i, H) REP(j, W) color[i][j] = (i + j) % 2;  
    REP(i, H) {
      REP(j, W) cout << s[color[i][j]];
      cout << endl;
    }
    return 0;
  } else {
    REP(i, H) REP(j, W) {
      int x = (i + j) / d % 2;
      int y = (i - j + 1000*d) / d % 2;
      color[i][j] = (x << 1) + y;
    }
    REP(i, H) {
      REP(j, W) cout << s[color[i][j]];
      cout << endl;
    }
    return 0;
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 1536
K,N = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
mi = 0
for i in range(N-1):
  a = A[i+1]-A[i]
  ans += a
  mi = max(mi, a)
  
ans+=(K-A[-1]+A[0])
mi = max(mi,K-A[-1]+A[0])
ans -= mi
print(ans)

Measured memory_bytes: 25840
#include<iostream>
#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include<string>
#include<cstring>
#include<ctype.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
			tree_order_statistics_node_update>
	new_data_set;
//   <<implemented_sorted_vector>>  new_data_set p;
//   <<insert_like_set>>           insert(key):log(n)
//<<accessing_iterator_by_index>> find_by_order(idx):log(n)
//	    <<accessing_by_value>>   order_of_key(key):log(n)
// << replace less<int> by greater<int> for descending order>>
// find(key), erase(find(key)) works the same!
typedef long long ll;
typedef long l;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ERR(x) cout<<"#x:"<<x<<endl
#define ERR2(x,y) cout<<"#x:"<<x<<" "<<"#y:"<<y<<endl;
#define ERR3(x,y,z) cout<<"#x:"<<x<<" "<<"#y:"<<y<<" "<<"#z:"<<z<<endl;
#define show(v) for(auto e: v) cout<<e<<" ";
#define showArr(A,n) for(int i=0;i<n;i++) cout<<A[i]<<" ";
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define mp make_pair
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()

ll solve(string s, string t){
	ll n = s.size();
	ll m = t.size();
	ll best = 0;
	for(int i=0;i+m-1<n;i++){
		ll lc = 0;
		for(int j=0;j<m;j++){
			if(s[i+j] == t[j]){
				lc++;
			}
		}
		best = max(best,lc);
	}
	return m-best;
}

int main()
{
	string s,t;
	cin>>s>>t;
	cout<<solve(s,t);
	return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int N,x[301],y[301];

double get_r(double X, double Y){
    double ret = 0;
    
    for(int i = 0;i < N;++i)
        ret = max(ret,(X - x[i]) * (X - x[i]) + (Y - y[i]) * (Y - y[i]));
    
    return ret;
}

double searchY(double X){
    double lo = 0,hi = 1000;
    
    for(int it = 0;it < 100;++it){
        double a = (2 * lo + hi) / 3;
        double b = (lo + 2 * hi) / 3;
        
        double ra = get_r(X,a);
        double rb = get_r(X,b);
        
        if(ra < rb) hi = b;
        else lo = a;
    }
    
    return get_r(X,lo);
}

double searchX(){
    double lo = 0,hi = 1000;
    
    for(int it = 0;it < 100;++it){
        double a = (2 * lo + hi) / 3;
        double b = (lo + 2 * hi) / 3;
        
        double ra = searchY(a);
        double rb = searchY(b);
        
        if(ra < rb) hi = b;
        else lo = a;
    }
    
    return searchY(lo);
}

int main(){
    scanf("%d",&N);
    
    for(int i = 0;i < N;++i)
        scanf("%d %d",&x[i],&y[i]);
    
    printf("%.16lf\n",sqrt(searchX()));
    
    return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

type pair struct {
	i, j int
}

func solve() {
	N := nextInt()
	T := make([]int, N)
	for i := 0; i < N; i++ {
		T[i] = nextInt()
	}
	M := nextInt()
	P, X := make([]int, M), make([]int, M)
	for i := 0; i < M; i++ {
		P[i], X[i] = nextInt(), nextInt()
	}
	s := 0
	for i := 0; i < N; i++ {
		s += T[i]
	}
	for i := 0; i < M; i++ {
		out(s - T[P[i]-1] + X[i])
	}
}


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

int main() {
  int N;
  cin >> N;
  
  int thou = N/1000;
  int hand = N%1000/100;
  int ten = N%100/10;
  int one = N%10;
  
 
  if(thou == hand && hand == ten){
    cout << "Yes" << endl;
  }else if(hand == ten && ten == one){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  
}

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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

ll S;

void test(ll x)
{
	ll rem = x * x - S;
	for (int i = 1; i * i <= rem; i++)
	{
		if (rem % i || rem / i > 1000000000) continue;
		cout << ' ' << x << ' ' << i << ' ' << rem / i << ' ' << x << '\n';
		exit(0);
	}
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> S;
	cout << 0 << ' ' << 0;
	if (S == 1000000000000000000ll)
	{
		cout << ' ' << 1000000000 << ' ' << 0 << ' ' << 0 << ' ' << 1000000000 << '\n';
		return 0;
	}
	//ac-bd = S
	ll p = sqrt(S) - 10;
	if (p < 0) p = 0;
	while(p * p < S) p++;
	// cerr << p << endl;
	//want bd = ac - S
	//
	while(true)
	{
		test(p);
		p++;
	}
	return 0;
}


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

int main(){
    int n;
    long long int W;
    cin >> n >> W;

    vector<vector<long long int>> w(4);
    long long int w1, v1;
    cin >> w1 >> v1;
    w[0].push_back(v1);
    for(int i=0; i<n-1; i++){
        long long int w2, v2;
        cin >> w2 >> v2;
        w[w2-w1].push_back(v2);
    }
    
    vector<int> size(4);
    for(int i=0; i<4; i++){
        size[i] = w[i].size();
        sort(w[i].begin(),w[i].end());
        reverse(w[i].begin(),w[i].end());

        for(int j=1; j<size[i];j++){
            w[i][j] += w[i][j-1];
        }
        /*
        for(int j=0; j<w[i].size();j++){
            cout << w[i][j] << " ";
        }cout << endl;
        */
    }
    long long int ans = 0;
    for(int i=0; i<=min(n,size[0]); i++){
        for(int j=0; j<=min(n-i,size[1]); j++){
            for(int k=0; k<=min(n-i-j,size[2]); k++){
                for(int l=0; l<=min(n-i-j-k,size[3]); l++){
                    if(w1      * i 
                    + (w1 + 1) * j 
                    + (w1 + 2) * k 
                    + (w1 + 3) * l <= W){
                        long long int value = 0;
                        if(i >= 1) value += w[0][i-1];
                        if(j >= 1) value += w[1][j-1];
                        if(k >= 1) value += w[2][k-1];
                        if(l >= 1) value += w[3][l-1];
                        ans = max(ans, value);
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.LinkedList;
import java.lang.Math;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        char s1 = s.charAt(2),
        s2 = s.charAt(3),
        s3 = s.charAt(4),
        s4 = s.charAt(5);

        if(s1 == s2 && s3 == s4){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N, K, C[102];

int main() {
  while (-1 != scanf("%d%d", &N, &K)) {
    if (!(N)) break;
    rep(i,N) scanf("%d",C+i);
    int mx = -1, ckd = -1;
    rep(i,N-K+1) {
      int sm = 1;
      rep(j,K) sm *= C[i+j];
      ckd = max(ckd, sm);
    }
    rep(i,N) {
      for (int j = i+1; j < N; ++j) {
        swap(C[i], C[j]);
        rep(k,N-K+1) {
          int sm = 1;
          rep(l,K) sm *= C[k+l];
          mx = max(mx, sm);
        }
        swap(C[i], C[j]);
      }
    }
    if (ckd <= mx) printf("%d\n", mx - ckd); else puts("NO GAME");
  }
  return 0;
}

Measured memory_bytes: 876
# B
s = input()
leng = len(s)
if leng%2==0:
    mae = s[:leng//2]
    ushi = s[leng//2:][::-1]
else:
    mae = s[:leng//2]
    ushi = s[leng//2+1:][::-1]

hagu = 0
for m, u in zip(mae, ushi):
    if m != u:
        hagu += 1
print(hagu)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    string ans="Yes";
    int n,x,fusoku;cin>>n;
    lint suma=0,sumb=0;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>x;suma+=x;a[i]=x;
    }
    for(int i=0;i<n;i++){
        cin>>x;sumb+=x;b[i]=x;
    }
    lint allowed=sumb-suma,needed=0;
    if(suma>sumb)ans="No";
    else{
        for(int i=0;i<n;i++){
            fusoku=b[i]-a[i];
            if(fusoku<=0)continue;
            needed+=(fusoku+1)/2;
        }
        if(needed>allowed)ans="No";
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3720
#include <iostream>
 
using namespace std;
 
int main(){
	int n;
  	cin>>n;
  	if(n%10 ==2 ||n%10 ==4||n%10 ==5||n%10 ==7||n%10 ==9)
    {
      cout<<"hon";
    }
  else if(n%10 ==0||n%10 ==1||n%10 ==6||n%10 ==8)
  {
    cout<<"pon";
  }
  else if(n%10 ==3){
    cout<<"bon";
  }
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define EB emplace_back

typedef std::vector <int> vector;
const int N = 5054;

int n;
char s[N], t[N];
vector S, T;

inline void down(int &x, const int y) {x > y ? x = y : 0;}
inline int get(const vector &vec, int idx) {return (size_t)idx < vec.size() ? vec[idx] : (idx >> 31 ? 0 : n);}

void analysis(const char *_str, vector &ret) {
	for (int i = 0; i < n; ++i) if (i ? _str[i - 1] != _str[i] : *_str == 49) ret.EB(i);
}

int compute(int offset) {
	int i, j, nS = S.size(), nT = T.size(), ret = 0;
	for (offset >> 31 ? (i = 0, j = offset) : (i = -offset, j = 0); i < nS || j < nT; ++i, ++j) ret += abs(get(S, i) - get(T, j));
	return ret;
}

int main() {
	int d, inf, sup, ans = INT_MAX;
	scanf("%d%s%s", &n, s, t);
	analysis(s, S), analysis(t, T);
	inf = ~S.size() & -2, sup = (T.size() | 1) + 1;
	for (d = inf; d <= sup; d += 2) down(ans, compute(d));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program
{
    static void Main()
    {
        int l = int.Parse(Console.ReadLine());
        int[] heap = Console.ReadLine().Split(' ')
                                    .Select(val => int.Parse(val))
                                    .ToArray();
        for (int i = 1; i < l + 1; i++)
        {
            Console.Write("node {0}: key = {1}, ", i, heap[i - 1]);
            if((i / 2) > 0) Console.Write("parent key = {0}, ", heap[i / 2 - 1]);
            if((2 * i) < l + 1) Console.Write("left key = {0}, ", heap[2 * i - 1]);
            if(((2 * i + 1) < l + 1)) Console.Write("right key = {0}, ", heap[2 * i]);
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9564
using System;

namespace Atc_0023
{
    class Program
    {
        static void Main(string[] args)
        {
            string rStr = Console.ReadLine();
            long N = long.Parse(rStr.Split(' ')[0]);
            long K = long.Parse(rStr.Split(' ')[1]);

            long m = N % K;

            if (K - m < m)
            {
                Console.WriteLine(Math.Abs(K - m));
            }
            else
            {
                Console.WriteLine(Math.Abs(m));
            }

        }
    }
}


Measured memory_bytes: 27512
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	REP(i, t) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[t]=power(fact[t], MOD-2);
	FORR(i, 0, t) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
  int i,j;
  int N,L; cin >> N >> L;
  string S[N];
  FOR(i,0,N){cin >> S[i];}
  sort(S,S+N);
  string ans = "";
  FOR(i,0,N){ans = ans + S[i];}

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int n,f[1000007],P=1000000007;
int main()
{
    scanf("%d",&n),f[n]=n,f[n-1]=1ll*n*n%P;
    for(int i=n-2,s=0;i>0;--i) (s+=f[i+3])%=P,f[i]=(f[i+1]+1ll*(n-1)*(n-1)+s+i+1)%P;
    printf("%d",f[1]);
}


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

int main(){
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    int dist = e - a;
    if(dist <= k){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a[100];
int b[100];

int main(){
	int n;
	cin>>n;
	for(int i = 1;i <= n;i++){
		cin>>a[i];
	}
	int sum = 1;
	for(int i = 1;i <= n;i++){
		sum = sum * 3;
	}
//	cout<<sum<<endl;
	int num;
	for(int i = 1;i <= n;i++){
		num = 0;
		if((a[i] - 1) % 2 == 1) num++;
		if((a[i]) % 2 == 1) num++;
		if((a[i] + 1) % 2 == 1) num++;
		if(num == 0) b[i] = 1;
		else b[i] = num;
//		cout<<b[i]<<endl;
	}
	int ans = 1;
	for(int i = 1;i <= n;i++){
		ans = ans * b[i];
	}
	cout<<sum - ans<<endl;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;



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

    return 0;
}


Measured memory_bytes: 3624
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto s = RD!(char[]);

	long ans;
	long streak;
	foreach (i; 0..s.length-1)
	{
		if (s[i] == 'A')
		{
			++streak;
		}
		else if (s[i] == 'B')
		{
			if (s[i+1] == 'C')
			{
				ans += streak;
				s[i+1] = 'A';
				--streak;
			}
			else
			{
				streak = 0;
			}
		}
		else
		{
			streak = 0;
		}
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;

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

  string arr[] = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};

  string s = arr[n % 10];

  printf("%s\n", s.c_str());
  return 0;
}


Measured memory_bytes: 3696
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,Ma,Mb = inpl()
dp = [[INF for mb in range(410)] for ma in range(410)]

#dp[ma][mb] = i番目までの薬品でma,mbを作る最小コスト

dp[0][0] = 0

for i in range(N):
	a,b,c = inpl()
	for mb in reversed(range(410)):
		for ma in reversed(range(410)):
			if dp[ma][mb] != INF:
				dp[ma+a][mb+b] = min(dp[ma][mb]+c,dp[ma+a][mb+b])

ma = Ma
mb = Mb
k = 1
ans = INF
while ma < 410 and mb < 410:
	ans = min(dp[ma][mb],ans)
	k += 1
	ma += Ma
	mb += Mb

if ans == INF:
	print(-1)
else:
	print(ans)


Measured memory_bytes: 6244
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
#include <numeric>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l

unsigned gcd(unsigned a, unsigned b) {
	if (a < b) gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
char tolower(char c) {
	return (c + 0x20);
}
ld num(ld a,ld b) {
	ld c = 1;
	while (b > a) {
		a *= 2;
		c*=2;
	}
	return c;
}

int main() {
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

int main(int argc, char* argv[])
{
    long n,a,b;
    scanf("%ld%ld%ld", &n, &a, &b);

    vector<long> x(n);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &x[i]);
    }
    ll sum=0;
    for(i=0; i<n-1; i++) {
        long tmp=x[i+1]-x[i];
        sum += MIN((ll)tmp*a,b);
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 1152
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)


int main()
{
	int n, m;
	int A[50] = {}, B[50] = {}, C[50] = {}, D[50] = {};
	cin >> n >> m;
	FOR(i, 0, n) {
		cin >> A[i] >> B[i];
	}
	FOR(i, 0, m) {
		cin >> C[i] >> D[i];
	}
	int min;
	int checkpoint;
	int tmp;
	FOR(i, 0, n) {
		checkpoint = 1;
		min = abs(A[i] - C[0]) + abs(B[i] - D[0]);
		FOR(j, 1, m) {
			tmp = abs(A[i] - C[j]) + abs(B[i] - D[j]);
			if (tmp < min){
				min = tmp;
				checkpoint = j+1;
			}
		}
		cout << checkpoint << endl;
	}
}


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

int main(int argc, char *argv[]) {
  int n, m;
  std::cin >> n;
  long a[200001], b[200001];
  for (int i = 0; i < n; ++i)
    std::cin >> a[i];

  std::cin >> m;
  for (int i = 0; i < m; ++i)
    std::cin >> b[i];

  std::cout << std::includes(a, a + n, b, b + m) << std::endl;
}



Measured memory_bytes: 6228
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
const int N = 110000;
int fa[N];
int fd(int x)
{
    if ( fa[x] == -1 ) return x;
    return fa[x] = fd(fa[x]);
}
ll w[N];
bool ss[N];
int a[N], b[N], od[N];
vector<pair<int, ll> >bj[N];
void dfs(int st, ll wt)
{
    w[st] = wt;
    ss[st] = true;
    vector<pair<int, ll> >::iterator pa;
    for ( pa = bj[st].begin(); pa != bj[st].end(); pa ++ )
    {
        int tt = pa->first;
        ll ad = pa->second;
        if ( !ss[tt] ) dfs(tt, ad + wt);
    }
}
int main()
{
    int n, m;
    while ( cin >> n >> m )
    {
        if ( !n ) break;
        for ( int i = 1; i <= n; i ++ )
        {
            fa[i] = -1;
            bj[i].clear();
            ss[i] = false;
        }
        for ( int i = 0; i < m; i ++ )
        {
            char s[5];
            scanf("%s%d%d", s, &a[i], &b[i]);
            if ( s[0] == '!' )
            {
                ll c;
                od[i] = 0;
                scanf("%lld", &c);
                //cd[b[i]] ++;
                bj[a[i]].push_back(mp(b[i], c));
                bj[b[i]].push_back(mp(a[i], -c));
            }
            else od[i] = 1;
        }
        //memset(w, -1, sizeof w);
        for ( int i = 1; i <= n; i ++ )
        {
            if ( !ss[i] )
            {
                dfs(i, 0);
            }
        }
        //for ( int i = 1; i <= n; i ++ ) printf("%d\n", w[i]);
        for ( int i = 0; i < m; i ++ )
        {
            if ( od[i] == 0 )
            {
                int sa = fd(a[i]), sb = fd(b[i]);
                if ( sa != sb ) fa[sa] = sb;
            } else {
                int sa = fd(a[i]), sb = fd(b[i]);
                if ( sa == sb ) printf("%lld\n", w[b[i]] - w[a[i]]);
                else puts("UNKNOWN");
            }
        }
    }
    return 0;
}
/*
3 4
! 1 3 5
! 1 2 2
? 1 2
? 1 3
*/

Measured memory_bytes: 14644
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<int> map(H*W);
    vector<tuple<int, int, int, int>> ops;
    for (int y = 0; y < H; y++)
        for (int x = 0; x < W; x++)
            cin >> map[y*W+x];
    for (int y = 0; y < H; y++)
        for (int x = 0; x < W - 1; x++)
            if (map[y*W+x]%2) {
                ops.push_back(make_tuple(y, x, y, x+1));
                map[y*W+x]--;
                map[y*W+x+1]++;
            }
    for (int y = 0; y < H - 1; y++) {
        int x = W - 1;
        if (map[y*W+x]%2) {
            ops.push_back(make_tuple(y, x, y+1, x));
            map[y*W+x]--;
            map[(y+1)*W+x]++;
        }
    }
    cout << ops.size() << endl;
    for (auto tup : ops) {
        int y, x, yn, xn;
        tie(y, x, yn, xn) = tup;
        cout << y+1 << " " << x+1 << " " << yn+1 << " " << xn+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 5232
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] foo ={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K = sc.nextInt();
    System.out.println(foo[K-1]);
  }
  

  
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    string s;
    cin >> s;
    vector<int> a(4);
    rep(i, 4) a[i] = s[i] - '0';
    rep(S, 1 << 3) {
        int ans = a[0];
        rep(i, 3) {
            if(S>>i & 1) ans += a[i + 1];
            else ans -= a[i + 1];
        }
        if(ans == 7) {
            string s = "0-0-0-0=7";
            rep(i, 4) s[i*2] = '0' + a[i];
            rep(i, 3) if(S>>i & 1) s[i*2+1] = '+';
            cout << s << endl;
            return 0;
        }
    }

    return 0;
}

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

const int INF = INT_MAX / 2;

int main() {
    int N, X; cin >> N >> X;
    int a = INF;
    for (int i = 0; i < N; i++)
    {
        int m; cin >> m;
        X -= m;
        a = min(a, m);
    }

    cout << N + (int)(X/a) << endl;    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;

void solve(long long N, long long X, std::vector<long long> m){
    sort(m.begin(), m.end());
    rep(i, N){
        X -= m[i];
    }
    cout << N + X/m[0]<< endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> m(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&m[i]);
    }
    solve(N, X, std::move(m));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    vector<int> T(5);
    int x, k = INF;
    rep(i, 5) {
        cin >> T[i];
        if(T[i] % 10 < k && T[i] % 10 != 0) {
            k = T[i] % 10;
            x = i;
        }
    }
    rep(i, 5) {
        if (i == x) continue;
        else {
            int y = 0;
            while(10 * y < T[i]) y++;
            T[i] = 10 * y;
        } 
    }
    int sum = 0;
    rep(i, 5) sum += T[i];
    cout << sum << endl;
    
    return 0;
}

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

int main() {
 
    string s1, s2;
    cin >> s1 >> s2;
  
    int i;

    for(i = 0; i < s1.size(); ++i)
        if(s1[i] != s2[i])
            break;

    if(i == s1.size())
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;

    return 0;
  
}

Measured memory_bytes: 3572
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

#define errp(...) fprintf(stderr, __VA_ARGS__)



int main () { 
	char str [25];
	scanf("%s",str);
	for(int i = 0; i < 19; i++) {
		if(str[i]==',')
			str[i]=' ';
	}
	printf("%s",str);
}

Measured memory_bytes: 128
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<cmath>
using namespace std;
int main()
{
    double a, b, k;

    cin >> a >> b >> k;

    double vol = a * a * b;
    double pi = acos(-1);


    double d = atan(b / a);

    if (vol / 2 < k) {
        int amari = vol - k;
        double ans = atan(amari*2.0 / (a * a * a));
        printf("%.10f", ans*180/pi);

    }
    else if (vol / 2 == k) {
        printf("%.10f", d*180/pi);
    }
    else {
        double ans = pi/2- atan(2.0 * k / (a * b * b));
        printf("%.10f", ans*180/pi);

    }
    return 0;
}



Measured memory_bytes: 4064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=1e9+7;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
using namespace std;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;};
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}

int main()
{
//	freopen("input.txt","r",stdin);
	ll n;
	cin>>n;
	string s="";
	ll e=26;
	int len=1;
	n--;
	for(int i=0;;i++)
	{
		if(n<e) break;
		len++;
		n-=e;
		e*=26;
	}
	while(len)
	{
		s+=((char)((ll)n%26LL+'a'));
		n/=26LL;
		len--;
	}
	reverse(all(s));
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

int main()
{
   ll n;
   cin >> n;
   vector<int> ans;
   ll pow=-2;
   ll aa=0;
   if(n==0)
   {
      cout<<0<<endl;
      return 0;
   }
   while(n!=0)
   {
      if(n%pow!=0)
      {
         n-=pow/(-2);
         ans.push_back(1);
      }
      else
      {
         ans.push_back(0);
      }
      pow*=-2;

   }
   
   rep(i,ans.size())cout<<ans[ans.size()-i-1];cout<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int c, t;
  int minc = 2000;

  for (int i = 0; i < N; ++i) {
    cin >> c >> t;
    if (t <= T) {
      minc = min(minc, c);
    }
  }
  if (minc == 2000) {
    cout << "TLE" << endl;
  } else {
    cout << minc << endl;
  }

  return 0;
}


Measured memory_bytes: 3176
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        String s=fsc.next();
        fsc.close();
        System.out.println(""+s.charAt(0)+(s.length()-2)+s.charAt(s.length()-1));
    }
    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;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; 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() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 21076