akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
/*ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
*/


/*最小公倍数*/
/*
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
*/

/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    vector<vector<ll>>a(3,vector<ll>(3));
    vector<vector<bool>>x(5,vector<bool>(5,false));
    for(ll i=0;i<3;i++){
        for(ll j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    ll n;
    cin>>n;
    vector<ll>b(n);
    for(ll i=0;i<n;i++){
        cin>>b[i];
    }
    for(ll i=0;i<n;i++){
        for(ll j=0;j<3;j++){
            for(ll k=0;k<3;k++){
                if(b[i]==a[j][k]){
                    x[j+1][k+1]=true;
                }
            }
        }
    }
    for(ll j=1;j<4;j++){
        for(ll k=1;k<4;k++){
            if(x[j][k]==true&&x[j][k]==x[j-1][k-1]&&x[j][k]==x[j+1][k+1]){
                cout<<"Yes"<<endl;
                exit(0);
            }
            if(x[j][k]==true&&x[j][k]==x[j-1][k]&&x[j][k]==x[j+1][k]){
                cout<<"Yes"<<endl;
                exit(0);
            }
            if(x[j][k]==true&&x[j][k]==x[j][k-1]&&x[j][k]==x[j][k+1]){
                cout<<"Yes"<<endl;
                exit(0);
            }
            if(x[j][k]==true&&x[j][k]==x[j-1][k+1]&&x[j][k]==x[j+1][k-1]){
                cout<<"Yes"<<endl;
                exit(0);
            }
            
        }
    }
    cout<<"No"<<endl;
    


    

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <queue>
#include <map>
using namespace std;

string N;

int main() {
  while (cin >> N) {
	int s = N.size();
	string str = "";
	for (int i = 0; i < s; ++i) str += '9';
	int res = 0;
	for (char c = '0'; c <= '9'; ++c) {
	  str[0] = c;
	  if (str <= N) {
		int num = 0;
		for (int j = 0; j < str.size(); ++j) {
		  num += (int)(str[j] - '0');
		}
		if (res < num) res = num;
	  }
	}
	cout << res << endl;
  }
}





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

int main() {
    int h, n, t, sum = 0;
    cin >> h >> n;
    rep(i, n) {
        cin >> t;
        sum += t;
    }
    if(sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int res = 0;
	for (int i = 0;i <= 100;i++) {
		if (A < i && i <= B && C < i && i <= D) res++;
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
import sys
import math
N = int(input())
A = list(map(int, input().split()))

s = 0
d = 0
for j in range(1,N):
    d += A[j]

for i in range(N-1):
    s += d * A[i]
    if s > 10 ** 9 + 7:
        s = s % (10 ** 9 + 7)
    d -= A[i+1]

print(s)


Measured memory_bytes: 94056
intInp = int(input())
flag = True
maxValue = 1
tmp = 0
for i in range(1,intInp+1):
    # print("i is {}".format(i))
    tmpAns = i
    counter = 0
    while(True):
        if i % 2 == 0:
            # counter shows the number of division
            counter += 1
            # print("counter is {}".format(counter))
            i /= 2
        else:
            # if counter is lager than tmp, then the value i is more disivible than stored maxValue
            if(counter > tmp):
                # print("counter is {0}, tmp is {1}".format(counter,tmp))
                # print("i is {}".format(i))
                maxValue = tmpAns
                tmp = counter
            break
    # print("tmp is {}".format(tmp))
print(maxValue)

        


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N, X, sum, result;
    vector<int> m;
    result = sum = 0;
    cin >> N >> X;
    for (int i = 0; i < N; i++) {
        int mi;
        cin >> mi;
        m.push_back(mi);
        sum += mi;
    }
    X -= sum;
    result += N;
    sort(m.begin(), m.end());

    while(X >= m[0]) {
        X -= m[0];
        result++;
    }
	cout << result << endl;
	return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> p(N);
  for(int i(0);i<N;i++){
    cin>>p[i];
  }
  vector<int> group(N+1);
  vector<int> G[N+1];
  for(int i(0);i<M;i++){
    int x,y;
    cin>>x>>y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  bool pathed[100001] = {0};
  int cnt(1);
  for(int i(1);i<=N;i++){
    if(pathed[i]) continue;
    cnt++;
    queue<int> q;
    q.push(i);
    while (!q.empty()){
      int now = q.front();q.pop();
      pathed[now] = 1;
      group[now] = i;
      for(auto next:G[now]){
        if(!pathed[next]){
          q.push(next);
        }
      }
    }
  }
  for(int i(1);i<=N;i++){
    //cout << group[i] <<" ";
  }
  int ans(0);
  for(int i(1);i<=N;i++){
    //cout << group[p[i]] << " " << group[i] << endl;
    if (group[p[i-1]] == group[i]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6656
import math

N, H = map(int, input().split())
sword_list = [list(map(int, input().split())) for i in range(N)]

a_sorted_sword = sorted(sword_list, key=lambda x:x[0], reverse=True)
a_max = a_sorted_sword[0][0]
b_sorted_sword = sorted(sword_list, key=lambda x:x[1], reverse=True)

count = 0
for sword in b_sorted_sword:
    if sword[1] < a_max:
        break
    H -= sword[1]
    count += 1
    if H <= 0:
        break

if not H <= 0:
    count += math.ceil(H / a_max)

print(count)

Measured memory_bytes: 30420
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int n = fs.nextInt();
		
		int ans = 0;
		for(int i = 0; i < n; i++) {
			int l = fs.nextInt();
			int r = fs.nextInt();
			ans += r - l + 1;
		}
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

typedef struct node{
    lld x, y;
}node;

int cmpAsc(const void* a, const void* b){
    lld x = ((node*)a)->y, y = ((node*)b)->y;
    if(x > y){
        return 1;
    }
    if(x < y){
        return -1;
    }
    return 0;
}

lld max(lld a, lld b, lld c, lld d){
    if(a >= b && a >= c && a >= d){
        return a;
    }
    if(b >= a && b >= c && b >= d){
        return b;
    }
    if(c >= a && c >= b && c >= d){
        return c;
    }
    return d;
}
lld min(lld a, lld b, lld c, lld d){
    if(a <= b && a <= c && a <= d){
        return a;
    }
    if(b <= a && b <= c && b <= d){
        return b;
    }
    if(c <= a && c <= b && c <= d){
        return c;
    }
    return d;
}

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    node a[n];
    rep(i, 0, n){
        lld x, y;
        scanf("%lld %lld", &x, &y);
        a[i].x = x;
        a[i].y = y;
    }
    lld ans = LLONG_MAX;
    lld top, bottom, left, right;
    rep(i, 0, n){
        rep(j, 0, n){
            rep(p, 0, n){
                rep(q, 0, n){
                    top    = max(a[i].y, a[j].y, a[p].y, a[q].y);
                    bottom = min(a[i].y, a[j].y, a[p].y, a[q].y);
                    left   = min(a[i].x, a[j].x, a[p].x, a[q].x);
                    right  = max(a[i].x, a[j].x, a[p].x, a[q].x);
                    int cnt = 0;
                    rep(r, 0, n){
                        if(bottom <= a[r].y && a[r].y <= top
                        && left   <= a[r].x && a[r].x <= right){
                            cnt++;
                        }
                    }
                    if(cnt >= k){
                        lld buf = (top - bottom) * (right - left);
                        if(buf < ans){
                            ans = buf;
                        }
                    }
                }
            }
        }
    }
    printf("%lld", ans);

    return 0;
}

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

using namespace std;

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

    int min_z, max_z;
    int min_w, max_w;
    for (int i = 0; i < N; ++i)
    { 
        int x, y;
        cin >> x >> y;

        int z = x + y;
        int w = x - y;

        if (i == 0)
        {
            min_z = max_z = z;
            min_w = max_w = w;
        }
        else
        {
            min_z = min(z, min_z);
            min_w = min(w, min_w);
            max_z = max(z, max_z);
            max_w = max(w, max_w);
        }
    }

    cout << max((max_z - min_z), (max_w - min_w)) << endl;

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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() {
  string s;
  cin >> s;
  if (s.find("7") != string::npos) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3624
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		
		long limit = 1000000000000000000L;
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextLong();
			if (A[i] == 0L) {
				System.out.println(0);
				return;
			}
		}
		
		long Ans = 1;
		for (int i = 0; i < N; i++) {
			 if( ((limit/Ans)/A[i]) == 0L ) {
				System.out.println(-1);
				return;
			} else {
				Ans *= A[i];
			}
		}
		System.out.println(Ans);
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

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


Measured memory_bytes: 34296
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int A,B,C,X,Y;
    ll m = 0;
    cin >> A >> B >> C >> X >> Y;

    C *= 2;

    if(A + B > C){
        m += C * min(X, Y);
        int c = max(X, Y) - min(X, Y);
        if(X > Y){
            if(A > C){
                m += C * c;
            }else{
                m += A * c;
            }
        }else{
            if(B > C){
                m += C * c;
            }else{
                m += B * c;
            }
        }
    }else{
        m += A * X + B * Y;
    }
    
    cout << m << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define pi pair<ll,ll>
#define vpi vector<pair<ll,ll>>
using namespace std;

ll MOD=1e9+7;
ll g,h,l;
const ll N=100005;

ll add(ll a,ll b); ll mul(ll a,ll b); ll binpo(ll a,ll b);

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n;cin>>n;
    vi dp(3,0);
    repn(i,n){
        vi c(3);
        repn(j,3ll){
            cin>>c[j];
        }
        vi temp(3,0);
        repn(j,3){
            repn(k,3){
                if(k!=j){
                    temp[j]=max(temp[j],dp[k]+c[j]);
                }
            }
        }
        dp=temp;
    }
    cout<<*max_element(all(dp));
}

ll add(ll a,ll b)
{
    return (a%MOD+b%MOD)%MOD ;
}
ll mul(ll a,ll b)
{
    return (a* 1ll *b)%MOD ;
}
ll binpo(ll a,ll b)
{
    int ans = 1 ;
    while(b)
    {
        if( b % 2 != 0)
        {
            ans = mul(ans,a);
        }
        a = mul(a,a);
        b = b/2;
    }
    return ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int s[5];
int main()
{
    cin>>s[1]>>s[2]>>s[3];
    sort(s+1,s+3+1);
    cout<<s[1]+s[2]<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		br.readLine();
		String s = br.readLine();
		if (s.contains("Y")) {
			System.out.println("Four");
		} else {
			System.out.println("Three");
		}
	}
}


Measured memory_bytes: 21204
import java.util.Scanner;

/**
 * @author yoshida3203
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int r=sc.nextInt();
		int D=sc.nextInt();
		int X=sc.nextInt();

		sc.close();
		//char[]S=sc.next().toCharArray();

		for(int i=0;i<10;i++){
			int nextX=r*X-D;
			X=nextX;
			System.out.println(X);

		}

	}
}


Measured memory_bytes: 35560
A = list(input())
B = list(input())
C = list(input())
current_state = A.pop(0)

while True:
    if current_state == 'a':
        if len(A) == 0:
            print(current_state.upper())
            exit()
        
        current_state = A.pop(0)

    if current_state == 'b':
        if len(B) == 0:
            print(current_state.upper())
            exit()
        
        current_state = B.pop(0)
        
    if current_state == 'c':
        if len(C) == 0:
            print(current_state.upper())
            exit()
        
        current_state = C.pop(0)



Measured memory_bytes: 9112
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map read . words <$> getLine :: IO [Int]
cond t f c = if c then t else f
-- end of templete



main = do
    n <- readLn
    replicateM_ n $ do
        a <- readLn
        b <- readLn
        let s = a + b
        let t = show s
        putStrLn $ if length t > 80 then "overflow" else t

Measured memory_bytes: 4276
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

q,h,s,d=map(int,input().split())
n=int(input())
k=min(4*q,h*2,s)
if n % 2 == 1:
  ans += k
  n-=1
ans += n//2*min(2*k,d)
print(ans)

Measured memory_bytes: 38512
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,m,k=parseMap(split(readline()))
    a=parseMap(split(readline()))
    b=parseMap(split(readline()))
    bsum=[0 for i in 1:m]
    bsum[1]=b[1]
    for i in 2:m
        bsum[i]=bsum[i-1]+b[i]
    end
    s=0
    ans=0
    for i in 0:n
        if i>0
            s+=a[i]
        end
        if s>k
            break
        end
        tmp=i
        index=searchsortedlast(bsum,k-s)
        tmp+=index
        ans=max(ans,tmp)
    end
    println(ans)
end
main()

Measured memory_bytes: 208188
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var ans: Long=0
    for(i in 1..kotlin)
    {
        if(i%3==0 || i%5==0)
        {
            continue
        }
        ans+=i
    }
    println(ans)
}


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

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

Measured memory_bytes: 3788
l = 7368791
a = Array.new(l + 1, true)

queries = []
loop do
    m, n = gets.split.map(&:to_i)
    break if m == 0
    queries << [m, n]
end

ans = {}
m0 = l / 2 + 1
queries.sort.reverse.each do |m, n|
    while m0 > m
        m0 -= 1
        (2..l).each do |y|
            k = m0 * y
            break if k > l
            a[k] = false
        end
    end
    k = 0
    m.upto(Float::INFINITY) do |x|
        k += 1 if a[x]
        if k > n
            ans[[m, n]] = x
            break
        end
    end
end

queries.each do |a|
    p ans[a]
end



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

int main(void){
  	int N,K,X,Y;
  	cin>>N>>K>>X>>Y;
  	
 	if(N>K){
     	cout << (K*X)+((N-K)*Y) << endl;
    } else {
      	cout << N*X << endl;
    }
}	

Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
int a[3];
cin>>a[0]>>a[1]>>a[2];
sort (a,a+3);
if(a[0]==a[1])
cout<<a[2];
else
if(a[1]==a[2])
cout<<a[0];
return 0;
}

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

using namespace std;

int main(){

    int n;
    cin >> n;

    string v[n];

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

    sort(v, v+n);

    int cont = 1;

    for (int i=1; i<n; i++){
        if (v[i] != v[i-1]) {
            cont++;
        }
    }

    cout << cont << endl;
    return 0;
}


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

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];

	map<ll, ll> cnt;
	cnt[0]++;
	vector<ll> s(n + 1, 0);
	ll res = 0;
	REP(i, n) {
		s[i + 1] += s[i] + a[i];
		res += cnt[s[i + 1]]++;
	}
	cout << res << '\n';
    return 0;
}


Measured memory_bytes: 18604
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<vector>
#include<numeric>
#include<random>
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int cnt = 0;
	int n;
	cin >> n;
	int minj;
	vector<int> a;
	int x;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		a.push_back(x);
	}

	rep(i, n-1) 
	{
		minj = i;
		for (int j = i; j < n; j++)
		{
			if (a[minj] > a[j])minj = j;
		}
		if (minj != i)
		{
			swap(a[minj], a[i]);
			cnt++;
		}
	}
	rep(i, n)
	{
		if (!i)cout << a[i];
		else cout << " " << a[i];
	}
	cout << endl << cnt << endl;
	return 0;
}


Measured memory_bytes: 3136
def gets; ARGF.gets; end

def main
  total = gets.chomp.to_i

  0.upto(total / 7) do |n7|
    if (total - 7 * n7) % 4 == 0
      puts 'Yes'
      return
    end
  end
  puts 'No'
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
}; 

int main(){
    Stream io;
    
    int Q;
    io.read(Q);
    vector<int> l(Q);
    vector<int> r(Q);
    for(int i = 0; i < Q; i++){
        io.read(l[i], r[i]);
    }
    vector<int> v(100001, 1);
    v[0] = v[1] = 0;
    for(int i = 2; i < v.size(); i++){
        if(v[i] == 0) continue;
        for(int j = 2 * i; j < v.size(); j += i){
            v[j] = 0;
        }
    }
    for(int i = v.size() - 1; i >= 0; i--){
        if(v[(i + 1) / 2] == 0) v[i] = 0;
    }
    for(int i = 0; i < v.size() - 1; i++){
        v[i + 1] += v[i];
    }
    for(int i = 0; i < Q; i++){
        cout << v[r[i]] - v[l[i] - 1] << '\n';
    }
    return 0;
}

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

int main()
{
ll n,k;
cin>>n>>k;
ll a[n];
for(ll  i=0;i<n;i++)
cin>>a[i];
for(ll i=k;i<n;i++)
{
if(a[i]>a[i-k])
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max() / 2;
const ll mod = 1e9+7;

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
  if (a < b) return a = b, true; else return false;
}


void solve(){
  ll N, K;
  cin >> N >> K;

  ll min = 0, max = 0;
  ll ans = 0;
  const ll mod = 1000000000 + 7;
  REP(i, 1, N+2){
    min += i-1;
    max += N - i + 1;
    if(i >= K){
      //printf("%d,%lld,%lld\n", i, min, max);
      ans += max - min + 1;
      ans %= mod;
    }
  }

  cout << ans << endl;
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 3636
input_str = []
while True:
    input_value = input()
    if input_value =="0":
        break
    else:
        input_str.append(input_value)

result = []
for i in input_str:
    result_value = 0
    for j in i:
        result_value += int(j)
    result.append(result_value)

for i in result:
    print(i)


Measured memory_bytes: 5612
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;
//const ll inf = 1000;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

ll graph[201][201];

void printGraph(int n){
    FOR(i, 1, n+1){
        FOR(j, 1, n+1){
            cout << graph[i][j] << " ";
        }
        cout << endl;
    }
}

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

    // input
    int N, M, R;
    cin >> N >> M >> R;

    FOR(i, 0, 201){
        FOR(j, 0, 201){
            if(i==j){
                graph[i][j] = 0;
            }else{
                graph[i][j] = inf;
            }
        }
    }

    // city
    vector<ll> C;
    FOR(i, 0, R){
        ll r;
        cin >> r;
        C.push_back(r);
    }
    sort(ALL(C));

    // edges
    FOR(i, 0, M){
        ll a, b, c;
        cin >> a >> b >> c;

        graph[a][b] = c;
        graph[b][a] = c;
    }

    // warshall floyd
    FOR(i, 1, 201){
        FOR(j, 1, 201){
            FOR(k, 1, 201){
                // j -> i -> k
                graph[j][k] = min(graph[j][k], graph[j][i] + graph[i][k]);
            }
        }
    }

    //printGraph(N);

    // [1,2,3,4,5,6,7,8]の順列
    ll min_dist = inf;
    do {
        ll dist = 0;
        FOR(i, 0, R-1){
            int city0 = C[i];
            int city1 = C[i+1];
            dist += graph[city0][city1];
        }
        min_dist = min(min_dist, dist);
    } while (next_permutation(ALL(C)));

    p(min_dist);
    
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	ll x;
	cin>>x;
	ll cur=100;
	int i=1;
	for(i=1;i<=40000;i++){
		cur=(cur*double(1.01));
		//if(cur<0)break;
		if(cur>=x)break;
	}
	cout<<i;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3636
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;
int main() {
    string n;
    string ans;
    cin >> n;
    for(char i : n){
        if(i=='1'){
            cout << 9;
        }else{
            cout << 1;
        }
    }
    return 0;
}

Measured memory_bytes: 256
let rec prefix l =
    match l with
    | e1 :: e2 :: e3 :: e4 :: e5 :: _ ->
        e1 :: (e1 ^ e2) :: (e1 ^ e2 ^ e3) :: (e1 ^ e2 ^ e3 ^ e4) :: (e1 ^ e2 ^ e3 ^ e4 ^ e5) :: prefix (List.tl l)
    | e1 :: e2 :: e3 :: e4 :: [] ->
        e1 :: (e1 ^ e2) :: (e1 ^ e2 ^ e3) :: (e1 ^ e2 ^ e3 ^ e4) :: prefix (List.tl l)
    | e1 :: e2 :: e3 :: [] ->
        e1 :: (e1 ^ e2) :: (e1 ^ e2 ^ e3) :: prefix (List.tl l)
    | e1 :: e2 :: [] ->
        e1 :: (e1 ^ e2) :: prefix (List.tl l)
    | _ -> l

let () =
    let s = read_line () |> Str.split (Str.regexp "") in
    let k = read_int () in
    List.sort_uniq compare (prefix s)
    |> (fun l -> List.nth l (k - 1))
    |> print_endline


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

int main() 
{ 
	ll n,t=0,a=0,w=0,r=0 ;
	cin>>n;
	string ar[n];
	for (int i = 0; i < n; i++) 
	{
	   cin>>ar[i];
	   if (ar[i]=="AC")
	   {
	       a++;
	   }
	   else if (ar[i]=="TLE")
	   {
	       t++;
	   }
	  else  if (ar[i]=="WA")
	   {
	       w++;
	   }
       else if (ar[i]=="RE")
	   {
	       r++;
	   }
	}
	cout<<"AC"<<" "<<'x'<<" "<<a<<endl;
	cout<<"WA"<<" "<<'x'<<" "<<w<<endl;
	cout<<"TLE"<<" "<<'x'<<" "<<t<<endl;
    cout<<"RE"<<" "<<'x'<<" "<<r<<endl;
	
	return 0; 
} 


Measured memory_bytes: 6752
#include<bits/stdc++.h>
using namespace std;
vector<int> graph[100000];

int fin[100000];

void dfs(int id,int group){
    fin[id] = group;
    for(int i = 0;i < graph[id].size();i++){
        if(fin[graph[id][i]] == 0)
            dfs(graph[id][i],group);
    }
}

int main(){
    int n,m;

    scanf("%d%d",&n,&m);

    for(int i = 0;i < m;i++){
        int a,b;
        scanf("%d%d",&a,&b);

        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    for(int i = 0;i < n;i++){
        sort(&graph[i][0],&graph[i][graph[i].size()]);
    }

    int group = 1;
    while(true){
       int iii;
       for(iii = 0;iii < n;iii++){
           if(fin[iii] == 0){
               dfs(iii,group);
               break;
           }
       }
       if(iii == n)
          break;
       group++; 
    }

    int q;
    scanf("%d",&q);

    for(int i = 0;i < q;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        if(fin[a] == fin[b])
            printf("yes\n");
        else
            printf("no\n");
    }
}

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

int main()
{
    int H, W; cin >> H >> W;
    vector<vector<char>> grid(H, vector<char> (W));
    for(int i = 0 ; i < H ; i++)
    for(int j = 0 ; j < W ; j++)
        cin >> grid[i][j];
    
    vector<vector<int>> path(H, vector<int>(W,0));
    for(int i = 0 ; i < H ; i++){
        if(grid[i][0] != '#')
        path[i][0] = 1;
        else break;
    }
    for(int i = 0 ; i < W ; i++){
        if(grid[0][i] != '#')
        path[0][i] = 1;
        else break;
    }

    for(int i = 1 ; i < H ; i++)
    {
        for(int j = 1 ; j < W ; j++)
        {
            if(grid[i][j] != '#')
            path[i][j] = (path[i][j-1] + path[i-1][j]) % (1000000007);
            else
            path[i][j] = 0;
        }
    }

    cout << path[H-1][W-1] % 1000000007;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define POW(n) ((n)*(n))
#define ALL(a) (a).begin(),(a).end()
#define cerr if(false) cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;
typedef pair<int,int> pii;

void solve(long long H, long long W, long long N, vector<long long> a, vector<long long> b){
	ll ans[10] = {};
	ll all = 0;
	map<pii,int> mp;

	REP(i,N){
		FOR(y,a[i]-2,a[i]+1) FOR(x,b[i]-2,b[i]+1){
				if(y < 0 || y+2 >= H || x < 0 || x+2 >=W)continue;
				pii p (y,x);
				mp[p]++;
		}
	}
	
	for(auto &itr : mp){ ans[itr.second]++;	all++;}	
	ans[0] = (H-2)*(W-2) - all;	

	
	REP(i,10) cout << ans[i] << endl;
}



int main(){	
	ios::sync_with_stdio(false);
	long long H;
	long long N; 
	long long W; 
	cin >> H;
	cin >> W;
	cin >> N;
	vector<long long> b(N-1+1);
	vector<long long> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		cin >> a[i];a[i]--;
		cin >> b[i];b[i]--;
	}
	solve(H, W, N, a, b);
	return 0;
}


Measured memory_bytes: 59648
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  string s;cin>>s;

  int ans=0;
  for(unsigned int t=1;t<=s.size();t++){
    if((s.size()-t)%2!=0)continue;
    string temp=s.substr(0,s.size()-t);
    string ch=temp.substr(0,(s.size()-t)/2);
    if(ch+ch==temp){
      ans=s.size()-t;
      break;
    }
  }

  cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 10 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int in[M];
int main()
{
	for(int i = 0; i < 5; i++) {
		cin >> in[i];
	}
	int k;
	cin >> k;
	sort(in, in + 5);
	string s = "Yay!";
	if(in[4] - in[0] > k) s = ":(";
	cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
s = list(map(int, input().split()))
if s[0] == s[1]:
    print("Draw")
elif min(s) != 1:
    if s[0] > s[1]:
        print("Alice")
    else:
        print("Bob")
else:
    if s[0] < s[1]:
        print("Alice")
    else:
        print("Bob")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int N,K;
int calc(int *a){
    int out=0;
    for(int i=0;i<N-1;i++){
        if(a[i]==a[i+1])
            out++;
    }
    return out;
}
void scan(int* a,int K){
    int m=0,n=0;
    //从头开始遍历，因为根据目前的这种方式，必定所有的都与开始一个一样
    for(int i=1;i<N-1&&K>0;i++){
        if(a[i-1]^a[i]){
            for(int j=i;j<N-1;j++){
                if(a[j]^a[j+1]&&(a[j]==a[i])){
                    for(m=i,n=j;m<=n;m++,n--){
                        if(!(a[m]^a[n])){
                            a[m]=a[n]=!a[n];
                        }
                    }//change a[m] a[n]
                    K--;
                    break;
                }
            }
        }
    }
    for(int i=N-1;i>0&&K>0;i--){
        if((a[i]^a[i-1])&&(a[i]==a[N-1])){
            for(int m=i,n=N-1;m<=n;m++,n--){
                if(a[m]==a[n]){
                    a[m]=a[n]=!a[n];
                }
            }//change a[i] a[N-1]
            break;
        }
    }
    // for(int i=0;i<N; i++){
    //     cout<<a[i];
    // }
    // cout<<endl;
}
int main(){
    cin>>N>>K;
    int* a=new int[N];
    char S;
    for(int i=0; i<N; i++){
        cin>>S;
        if(S=='L')
            a[i]=0;
        else
            a[i]=1;
    }
    scan(a,K);
    cout<<calc(a)<<endl;
    return 0;
}

Measured memory_bytes: 4024
n = int(input())
a = list(map(int,input().split()))
q,w,e = [0]*3
for i in a:
    if i%4 == 0:
        q += 1
    elif i%4 == 2:
        w += 1
    else:
        e += 1
if w==0 and q>=e-1 or q>=e:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 14252
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

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

    int N, K; cin >> N >> K;

    ll ans;
    if (K%2==1) {
        ll p = N / K;
        ans = p * p * p;
    } else {
        ll p = N / K;
        ll q = N / (K/2) - p;

        ans = p*p*p + q*q*q;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

#define NMAX 10000

int main(){

	int N;
	int A,B;
	int C;
	int D[NMAX];
	int mon=0;
	int col=0;

	cin>>N;
	cin>>A>>B;
	cin>>C;
	for(int i=0;i<N;i++){
		cin>>D[i];
	}

	mon=A;
	col=C;
	int max=col/mon;

	for(int i=0;i<N;i++){
		int fmax=D[0];
		int fi=0;
		for(int j=1;j<N;j++){
			if(fmax<D[j]) fmax=D[j],fi=j;
		}
		mon+=B;
		col+=fmax;
		D[fi]=-1;

		if(max<col/mon) max=col/mon;
	}

	cout<<max<<endl;
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define MAXN 100000
#define MAXD 12

#define ll long long
using namespace std;

int N,M,Q;


int BFS[2][MAXN*MAXD+200];
bool done[(MAXN+100)*MAXD+200];
int colors[MAXN+200];

vector<int> edges[MAXN+2];

void doBFS(int u,int dist,int color) {
    BFS[0][0]=u*11+dist;
    int sz=1;
    
    for(int iters=1;sz>0;iters++) {
        int nsz=0;
        for(int j=0;j<sz;j++) {
            int curr = BFS[(iters-1)&1][j];
            

            int cu = curr/11;
            int cdist=curr%11;
            
            
            
            if (colors[cu]==-1)
                colors[cu]=color;


            if (done[cu*11+cdist])
                continue;
            
            for(int d=0;d<=cdist;d++)
                done[cu*11+cdist]=true;
            
            if (cdist==0)
                continue;


            for(int j=0;j<edges[cu].size();j++) {
                int v=edges[cu][j];

                if (done[v*11+cdist-1])
                    continue;

                BFS[iters&1][nsz++]=v*11+cdist-1;

            }
            
        }
        sz=nsz;
    }
    
}

int v[MAXN+2];
int dists[MAXN+2];
int splatter_colors[MAXN+2];

int main() {
    cin>>N>>M;
    
    
    for(int i=1;i<=M;i++) {
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    
    
    cin>>Q;
    
    v[0]=1;
    dists[0]=N+2;
    colors[0]=0;
    
    for(int i=1;i<=Q;i++) {
        cin>>v[i]>>dists[i]>>splatter_colors[i];
    }
    
    for(int i=1;i<=N;i++)
        colors[i]=-1;
    
    
    for(int i=0;i<=(N+2)*11+11;i++)
        done[i]=false;
    
    
    for(int q=Q;q>=0;q--) {
        doBFS(v[q],dists[q],splatter_colors[q]);
    }
    
    for(int i=1;i<=N;i++)
        if (colors[i]==-1)
            colors[i]=0;
    
    for(int i=1;i<=N;i++)
        printf("%d\n",colors[i]);
    

}

Measured memory_bytes: 12280
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i;
  cin>>n;
  i = n%10;
  if(i==2||i==4||i==5||i==7||i==9)
    cout<<"hon";
  else if(i==0||i==1||i==6||i==8)
    cout<<"pon";
  else
    cout<<"bon";
  return 0;
 
}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

			var N = inputArray[0];

			long fizzBuzSum = 0;
			for (int i = 1; i <= N; i++) {
				if (i % 3 == 0) {
					continue;
				}

				if (i % 5 == 0) {
					continue;
				}
				fizzBuzSum += i;

			}

			//答えの出力
			var ans = fizzBuzSum;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

Measured memory_bytes: 28236
// Problem : D - Knight
// Contest : AtCoder - AtCoder Beginner Contest 145
// URL : https://atcoder.jp/contests/abc145/tasks/abc145_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a) for (int i=0; i<(a); i++)
#define rep1(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define imax INT_MAX
#define imin INT_MIN
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 ll mod_pow(ll x,ll n) {
	if (n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n / 2);
	if (n & 1) res = res * x % MOD;
	return res;
}
 
ll comb(ll n, ll x) {
	ll ret = 1,k=1;
	loop(i,x)ret = (ret * (n - i))%MOD;
	loop(i,x)k = (k * (x-i))%MOD;
	k = mod_pow(k, MOD - 2);
	ret = (ret*k + MOD) % MOD;
	return ret;
}
int main() {
	int x,y;
	cin>>x>>y;
	if((x+y)%3!=0)
	{
		cout<<0;
		return 0;
	}
	int n=(x+y)/3;
	int i=0,j=0,u=-1,r=-1;
	while(i<=x&&j<=y)
	{
		if((x-i)==(y-j)*2)
		{
			u=y-j;
			r=i;
			break;
		}
		i++;
		j+=2;
	}
	if(u==-1)
	cout<<0<<nl;
	else
	cout<<comb(u+r,u);
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

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


using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define endl "\n"

const ll maxn=3e5+50;

const ll maxx=1e13;
const ll mod1=1000000007;
const ll mod=998244353;


ll p,q, r;
ll a[maxn];
ll b[maxn];
ll c[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
    //freopen("FRAC.INP", "r", stdin);
    // freopen("WALKING.OUT", "w", stdout);
    ll x, y;
    cin>>x>>y>>p>>q>>r;
    for (int i=1; i<=p; i++)
    {
        cin>>a[i];
    }
    for (int i=1; i<=q; i++)
    {
        cin>>b[i];
    }
    multiset<ll,greater<ll> > st;
    for (int i=1; i<=r; i++)
    {
        ll x;
        cin>>x;
        st.insert(x);
    }
    sort(a+1,a+p+1);
    sort(b+1,b+q+1);
    reverse(a+1,a+p+1);
    reverse(b+1,b+q+1);
    ll ans= 0;
    ll idnw=1;
    for (int i=1; i<=x; i++)
    {
       st.insert(a[i]);
    }
    idnw=1;
    for (int i=1; i<=y; i++)
    {
        st.insert(b[i]);
    }
    for (int i=1;i<=x+y;i++)
    {
        auto k=*st.begin();
        st.erase(st.find(k));
        ans+=k;
    }
    cout <<ans;
}


Measured memory_bytes: 17536