akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};



int main(){
  int n;
  cin>>n;
  vector<double> v(n);
  rep(i,n)cin>>v[i];
  SORT(v);

  rep(i,n-1){
      v[i+1]=(v[i]+v[i+1])/2;
  }
  double ans=v[n-1];

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


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

using namespace std;

int bill;
int c[4], csum;

vector<int> calcChange(int p) {
	vector<int> ret(4, 0);
	ret[3] = p / 500; p %= 500;
	ret[2] = p / 100; p %= 100;
	ret[1] = p / 50;  p %= 50;
	ret[0] = p / 10;  p %= 10;
	return ret;
}

void solve() {
	int mincnt = 1000;
	vector<int> ans(4);
	
	for (int i = 0; i <= c[0]; i++) {
		for (int j = 0; j <= c[1]; j++) {
			for (int k = 0; k <= c[2]; k++) {
				for (int l = 0; l <= c[3]; l++) {
					int p = 10 * i + 50 * j + 100 * k + 500 * l;
					if (p < bill) continue;
					
					vector<int> change = calcChange(p - bill);
					if (i > 0 && change[0] > 0) continue;
					if (j > 0 && change[1] > 0) continue;
					if (k > 0 && change[2] > 0) continue;
					if (l > 0 && change[3] > 0) continue;
					
					int sum = change[0] + change[1] + change[2] + change[3];
					int aft = csum - (i + j + k + l) + sum;
					
					if (mincnt > aft) {
						mincnt = aft;
						ans[0] = i;
						ans[1] = j;
						ans[2] = k;
						ans[3] = l;
					}
				}
			}
		}
	}
	
	if (ans[0] > 0) cout << 10 << " " << ans[0] << endl;
	if (ans[1] > 0) cout << 50 << " " << ans[1] << endl;
	if (ans[2] > 0) cout << 100 << " " << ans[2] << endl;
	if (ans[3] > 0) cout << 500 << " " << ans[3] << endl;
}

int main() {
	int cnt = 0;
	while (1) {
		cin >> bill; if (bill == 0) break;
		if (cnt > 0) cout << endl;
		cin >> c[0] >> c[1] >> c[2] >> c[3];
		csum = c[0] + c[1] + c[2] + c[3];
		solve();
		cnt++;
	}
	
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

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

int main(){
    int N, K;
    cin >> N >> K;
    string s;
    cin >> s;
    s[K-1] += 32;
    cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll k, a, b;
	cin >> k >> a >> b;
	if(k < a || a >= b || (b - a) < 2) {
		cout << k + 1 << endl;
		return 0;
	}
	k -= (a - 1);
	if(k % 2) {
		cout << a + (k / 2) * (b - a) + 1 << endl;
	} else {
		cout << a + (k / 2) * (b - a) << endl;
	}
	return 0;
}

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


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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n;
  string s;
  cin >> n >> s;
  int cnt = 0;
  rep(i, n) if (s[i] == 'R') cnt++;
  if (cnt > n - cnt) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#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>;
const int MAX = 100100100;

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) {
    cin >> s[i];
  }

  int ans = 0;
  rep(i, h) {
    rep(j, w) {
      if (s[i][j] == '#') continue;
      queue<tuple<int, int, int>> q;
      vector<vector<int>> dist(h, vector<int>(w, 0));
      q.push(make_tuple(i,j, 0));
      dist[i][j] = 0;
      int num = 0;
      while(!q.empty()) {
        auto p = q.front();
        q.pop();
        int H = get<0>(p);
        int W = get<1>(p);
        int d = get<2>(p);
        if (H < 0 || h <= H) continue;
        if (W < 0 || w <= W) continue;
        if (s[H][W] == '#') continue;
        if(dist[H][W] != 0) continue;
        dist[H][W] = d+1;
        num = d+1;
        q.push(make_tuple(H+1, W, d+1));
        q.push(make_tuple(H, W+1, d+1));
        q.push(make_tuple(H-1, W, d+1));
        q.push(make_tuple(H, W-1, d+1));
      }
      ans = max(ans, num-1);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int h,w;
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout <<  endl;
    }
    return 0;
}


Measured memory_bytes: 3068
n = int(input())
a = list(map(int, input().split()))
alice, bob = 0, 0
while len(a) > 0:
    alice += max(a)
    a.remove(max(a))
    if len(a) > 0:
        bob += max(a)
        a.remove(max(a))
    else:
        break
ans = alice - bob
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,f,t) for(int i=f;i<t;i++)
#define P(r) do{cout<<#r": ";for(const auto &i:r){cout<<i<<" ";}cout<<endl;}while(0)
int main()
{
    int n, m; cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,k = [int(x) for x in input().split(' ')]


def verify_sum(a,b,c,k):
    if k == a:
        print(a)
        return

    num_cards = a + b
    if k <= a:
        print(k)
    elif k > num_cards:
        print(a - (k-num_cards))
    else:
        print(a)

verify_sum(a,b,c,k)

Measured memory_bytes: 9156
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  int n;
  cin >> a >> b;
  n = stoi(a + b);
  for(int i=1;i<500;i++){
    if(i * i == n){
      cout << "Yes" << endl;
      return 0;
    }else if(i * i > n){
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solveD(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int[] x = nextInts();
		boolean[] flg = new boolean[6];
		Arrays.fill(flg,true);
		for(int i=0;i<5;i++) {
			flg[x[i]]=false;
		}
		for(int i=1;i<6;i++) {
			if(flg[i]) {
				pw.println(i);
				return;
			}
		}
	}
	public static void solveB(String[] args) throws Exception{
		int X = nextInt();
		int Y = nextInt();

		for(int turu=0;turu<100;turu++) {
			for(int kame=0;kame<100;kame++) {
				if(turu+kame==X&&turu*2+kame*4==Y) {
					pw.println("Yes");
					return;
				}
			}
		}
		pw.println("No");
	}
	public static void solveC(String[] args) throws Exception{
		int X = nextInt();
		int N = nextInt();

		int[] p ;
		if(N!=0) {
			p=nextInts();
		}else {
			nextString();
			p=new int[0];
		}
		boolean[] g = new boolean[102];
		Arrays.fill(g,true);
		for(int i=0;i<N;i++) {
			g[p[i]]=false;
		}
		int ans = -1;
		for(int i=0;i<=101;i++) {
			if(g[i]&&Math.abs(X-i) < Math.abs(X-ans)) {
				ans=i;
			}
		}
		pw.println(ans);


	}
	public static void solveD(String[] args) throws Exception{
		int N = nextInt();

		HashMap<Integer,Integer> map = new HashMap<Integer, Integer>();
		for(int i=0;i<N;i++) {
			int x = nextInt();
			map.put(x,map.getOrDefault(x, 0)+1);
		}

		int[] x = new int[(int)1e6+1];

		for (int key:map.keySet()) {
			int val=map.get(key);
			for (int k = key; k < x.length; k += key) {
				x[k]+=val;
			}
		}

		int ans = 0;
		for(int key:map.keySet()) {
			if(x[key]==1) {
				ans++;
			}
		}



		pw.println(ans);
	}
	public static void solveE(String[] args) throws Exception{

	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 76396
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
const int INF = 1000000009;
typedef pair<int, int> pii;

int N, L, Q, x[100005], to[20][100005];

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    for(int i = 0; i < N + 1; i++){
        for(int j = 0; j < 20; j++){
            to[j][i] = INF;
        }
    }
    cin >> L >> Q;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        while(cnt < N && x[cnt] - x[i] <= L)cnt++;
        to[0][i] = cnt - 1;
    }

    for(int i = 1; i < 20; i++){
        for(int j = 0; j < N; j++){
            to[i][j] = to[i - 1][to[i - 1][j]];
        }
    }
    while(Q--){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if(a > b)swap(a, b);
        int ans = 1;
        for(int i = 19; i >= 0; i--){
            if(to[i][a] < b){
                a = to[i][a];
                ans += (1 << i);
            }
        }
        cout << ans << endl;
    }


    return 0;
}
/*


*/


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());

  int ans = a.at(n - 1) - a.at(0);
  
  cout << ans << endl;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut x: [usize; n],
    }

    let y = x.clone();

    x.sort();
    let mid = x[n / 2 - 1];
    let midPlus = x[n / 2];

    for e in &y {
        if *e <= mid {
            println!("{}", midPlus);
        } else {
            println!("{}", mid);
        }
    }
}


Measured memory_bytes: 7764
s = list(str(input()))
cnt = 0

if len(s)>1 and s[0]==s[1]:
    if s[0] == '1':
        s[1] = '0'
    else:
        s[1] = '1'
    cnt += 1

for i in range(1,len(s)-1):
    if s[i] == s[i+1]:
        s[i+1] = s[i-1]
        cnt += 1

print(cnt)


Measured memory_bytes: 9792
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef vector<int>		vi;
typedef vector<pii>		vpii;
typedef vector<vi>		vvi;
int n;

void solve() {
  ll ans = 0;
  int m = 0;
  cin >> n;
  int a[n];
  fo(i ,n) { cin >> a[i]; m = max(m,a[i]); if (a[i] < m) ans += (m - a[i]); }
  cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int l = 1;
    //cin >> t;
    while(l--) {
      solve();
    }

    return 0;
}

Measured memory_bytes: 4352
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

ll max(ll a, ll b) {
	if (a < b) {
		return b;
	}
	else
		return a;

}

ll min(ll a, ll b) {
	if (a < b)
		return a;

	return b;
}




pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

vector<pint> list;










void floyd(int N, ll** d) {

	rep(k, N+1){
		rep(i, N+1) {
			if (d[i+1][k+1] == inf) continue;
			rep(j, N+1) {
				if (d[j+1][k+1] == inf) continue;

				d[i+1][j+1] = min(d[i+1][j+1], d[i+1][k+1] + d[j+1][k+1]);

			}

		}
	}




}


ull modpow(ull a, ull b) {
	ll retval = 0;

	if (b == 0) { return 1; }

	else if (b % 2 == 0) {
		retval = modpow(a, b / 2) % mod;
		return (retval * retval) % mod;
	}

	else {
		
		return ((a % mod) * modpow(a, b - 1)) % mod;
	}
}

ull modkaijou(ull a) {

	if (a == 1 || a == 0) { return 1; }

	ll retval = 1;

	for (ull i = a; i >= 1; i--) {
		retval = (retval * (i % mod)) % mod;
	}

	return retval % mod;
}

ull modcomb(ull a, ull b) {

	if (a == 0 || b == 0) return 1;

	return (((modkaijou(a) * modpow(modkaijou(a-b), mod - 2)) % mod) * modpow(modkaijou(b), mod - 2)) % mod;
}


ll d[100005];
vector<ll> M[100005];
vector<ll> anslist;


stack<int> to_1;







string S;
int main() {
	unsigned long long H, W, A, B;

	
	cerr << modcomb(12, 6) << endl;

	cin >> H >> W >> A >> B;
	
	unsigned long long ans = 0;
	ull remain_W = W - B - 1, remain_H = H - A - 1;
	ull combB = 1, combA = modcomb(remain_W + H - 1, remain_W);
	

	
	ans += combB * combA;
	for (int i = 1; i <= H - A - 1; i++) {

		if (B != 1) {
			combB = ((((B - 1 + i) * modpow(i, mod - 2)) % mod) * combB) % mod;
		}

		
			combA = ((((H - i) * modpow((remain_W + H - i), mod - 2)) % mod) * combA) % mod;
		
		ans += combB * combA;
		ans %= mod;

		
		

	}


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

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

using namespace std;

using ll = long long;

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

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

vector<ll> Divs(ll N)
{
    map<ll,ll> ret_map;
    for(ll i=1;i*i<=N;i++)
    {
        if(N%i==0)
        {
            ret_map[i]++;
            ret_map[N/i]++;
        }
    }
    vector<ll> ret_vec;
    for(auto x : ret_map)
    {
        ret_vec.push_back(x.first);
    }
    return ret_vec;
}

ll Ans(ll N, ll M, vector<ll> div)
{
    sort(ALL(div),greater<ll>());
    for(auto x : div)
    {
        if(N * x <= M) return x;
    }
}

int main()
{
    ll N,M;
    cin >> N >> M;

    OUT0(Ans(N,M,Divs(M)));

    return 0;
}

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


int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> B.at(i);
  }
  for(int i=0;i<N-1;i++){
    cin >> C.at(i);
  }

  int prev = -1000;
  int manzoku = 0;
  for(int i=0;i<N;i++){
    int eat = A.at(i) - 1;
    manzoku += B.at(eat);
    if (eat == prev + 1){
      manzoku += C.at(prev);
    }
    prev = eat;
  }
  cout << manzoku << endl;
}


Measured memory_bytes: 256
from collections import deque
N = int(input())
v = list(map(int, input().split()))

d = deque(sorted(v))

ans = 0
while len(d) > 1:
    ans = 0
    ans += d.popleft()
    ans += d.popleft()
    d.appendleft(ans / 2)
print(d.pop())


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

#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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

int power2(int m){
    int res = 1;
    REP(i, m) res *= 2;
    return res;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    cout << 100 * (18 * m + n) * power2(m) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define     siii(a,b,c)       scanf("%d%d%d",&a,&b,&c)
#define     si(a)             scanf("%d",&a)
#define     sii(a,b)          scanf("%d%d",&a,&b)
#define     sl(a)             scanf("%lld",&a);
#define     sll(a,b)          scanf("%lld%lld",&a,&b);
#define     slll(a,b,c)       scanf("%lld%lld%lld",&a,&b,&c);
#define     sd(a)             scanf("%lf",&a);
#define     sdd(a,b)          scanf("%lf%lf",&a,&b);
#define     pb(a)             push_back(a)
#define     deb(a)            printf("### %d ###\n",a)
#define     mp                make_pair
#define     pf                printf
#define     fl(a, b, c)       for(int a= b ;a<c;a++)
#define     mx                100000 //10^5
#define     fread             freopen("input.txt","r",stdin)
#define     fwrite            freopen("output.txt","w",stdout)
#define     CLR(a,b)          memset(a,b,sizeof(a))
#define     ll                long long
#define     D(x)              cout<<#x" = "<<x<<endl;
#define     sz                10000
#define     bl                printf("\n")
#define     spc               printf(" ")
#define     pCase(a)          printf("Case %d: ",a)

ll mod =1e9 + 7;

int arr[mx+10];
int main()
{
    int n;
    si(n);

    //bool flag = false;
    for(int i = 1; i<= n ; i++)
    {
        arr[abs(n-i-(i-1))]++;
    }
    for(int i = 1 ;i<= n ; i++)
    {
        int dif;
        si(dif);
        arr[dif]--;
        if(arr[dif]<0)
        {
            printf("0\n");
            return 0;
        }
    }
    ll ans = 1;
    for(int i = 1 ; i<= n/2 ;i++)
    {
        ans= ans*2%mod;
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = "";
        int[] cnt = new int[26];

        while(sc.hasNext()) {
            str = sc.nextLine();
            str = str.toLowerCase();
            char[] c = str.toCharArray();
            for(int i = 0; i < c.length; i++) {
                if('a' <= c[i] && c[i] <= 'z') {
                    cnt[c[i] - 'a']++;
                }
            }
        }
        for(int i = 0; i < 26; i++) {
            System.out.println(((char)(i + 'a')) + " : " + cnt[i]);
        }
    }
}

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

int N;
vector<int> G[200100];
int child_num[200100];
int st[200100];
int rt[200100];

const int MAX = 200100;
const int MOD = 1000000007;
int fact[MAX], finv[MAX], inv[MAX];

void Cinit() {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i=2; i<MAX; i++) {
        fact[i] = fact[i-1]*i%MOD;
        inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}

int mod_pow(int x, int n) {
    int res = 1;
    while (n>0) {
        if (n&1) res = res*x%MOD;
        x = x*x%MOD;
        n >>= 1;
    }
    return res;
}

int dfs1(int v, int pv) {
    int res = 1;
    rep(i, G[v].size()) {
        int nv = G[v][i];
        if (nv==pv) continue;
        res += dfs1(nv, v);
    }
    return child_num[v] = res;
}

int dfs2(int v, int pv) {
    int res = 1;
    int child_sum = 0;
    rep(i, G[v].size()) {
        int nv = G[v][i];
        if (nv==pv) continue;
        int res_ = dfs2(nv, v);
        res *= res_;
        res %= MOD;
        res *= finv[child_num[nv]];
        res %= MOD;
        child_sum += child_num[nv];
    }
    res *= fact[child_sum];
    res %= MOD;
    return st[v] = res;
}

void dfs3(int v, int pv) {
    int pv_res = rt[pv];
    pv_res *= finv[N-1];
    pv_res %= MOD;
    pv_res *= fact[N-child_num[v]-1];
    pv_res %= MOD;
    pv_res *= fact[child_num[v]];
    pv_res %= MOD;
    pv_res *= mod_pow(st[v], MOD-2);
    pv_res %= MOD;
    rt[v] = fact[N-1];
    rt[v] *= finv[N-child_num[v]];
    rt[v] %= MOD;
    rt[v] *= pv_res;
    rt[v] %= MOD;
    
    rep(i, G[v].size()) {
        int nv = G[v][i];
        if (nv==pv) continue;
        rt[v] *= finv[child_num[nv]];
        rt[v] %= MOD;
        rt[v] *= st[nv];
        rt[v] %= MOD;
    }
    
    rep(i, G[v].size()) {
        int nv = G[v][i];
        if (nv==pv) continue;
        dfs3(nv, v);
    }
}

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N-1) {
        int a, b; cin >> a >> b;
        G[a-1].pb(b-1);
        G[b-1].pb(a-1);
    }
    Cinit();
    dfs1(0, -1);
    dfs2(0, -1);
    rt[0] = st[0];
    rep(i, G[0].size()) dfs3(G[0][i], 0);
    rep(i, N) cout << rt[i] << endl;
}

Measured memory_bytes: 24048
#include <bits/stdc++.h>
using namespace std;
 
int solve(int N, int A, int B){
    int trainFare = A * N;
    
    if(trainFare < B){
        return trainFare;
    }
    else{
        return B;
    }
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  cout << solve(N,A,B) << endl;
}


Measured memory_bytes: 256
import sys

input_list = sys.stdin.readlines() 
N, s = map(str.strip, input_list)

red_hat_counter = 0
blue_hat_counter = 0

for s_char in s:
  if s_char == "R":
    red_hat_counter += 1
  else:
    blue_hat_counter += 1

if red_hat_counter > blue_hat_counter :
  print("Yes")
else:
  print("No")

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

double dp_arr[305][305][305];

double moves(int i, int j, int k, int n)
{
	// cout << "Dsd " << endl;
	if(dp_arr[i][j][k] != (double)-1)
		return dp_arr[i][j][k];
	// cout << "hello" << endl;
	if(i == 0 && j == 0 && k == 0)
		return 0;
		// cout << i << " " << j << " " << k << endl;
	if(i + j + k == n)
	{
		// cout <<" dsds" << endl;
		auto temp = 1 + 1.0/n*( i*(i ? moves(i-1, j, k, n) : 0) + j*(j ? moves(i+1, j-1, k, n) : 0) 
						+ k*( k ? moves(i, j+1, k-1, n) : 0));
		dp_arr[i][j][k] = temp;
		// cout << "temp: " << temp << endl;
		return temp;
	}
	else
	{
		double a = 0;
		a  = i + j + k;
		a = a*1.00/n;
		double r = 1 - a;
		auto temp_moves = a/pow((1-r),2);
		double res = temp_moves;
		// cout << "temp moves: " << temp_moves << endl;
		if(i)
		{
			res += (i/(a*n))*moves(i-1,j,k, n);
		}
		if(j)
		{
			res += (j/(a*n))*moves(i+1,j-1,k, n);
		}
		if(k)
		{
			res += (k/(a*n))*moves(i,j+1,k-1, n);
		}
		dp_arr[i][j][k] = res;
		// cout << "res: " << res << endl;
		return res;
	}
}

int main()
{
	int n;
	cin >> n;
	vector<int> arr(n);
	vector<int> counts(4,0);
	for(int i = 0;i < 305;i++)
		for(int j = 0;j < 305;j++)
		for(int k = 0;k < 305;k++)
			dp_arr[i][j][k] = -1;
	// memset(dp_arr, -1, sizeof(dp_arr));
	for(int i = 0; i < n; i++)
	{
		cin >> arr[i];
		counts[arr[i]]++;
	}
	// cout << counts[3] << " " << n << endl;
	double res = moves(counts[1], counts[2], counts[3], n);
    std::cout << std::fixed;
    std::cout << std::setprecision(10);
	cout << res << endl;
	return 0;

}


Measured memory_bytes: 221952
#include <iostream>

using namespace std;

int main()
{
    int a,b,v;
    cin>>a>>b;
    if (a>b){
            for(v=0;v<a;v++){
                cout<<b;
 }           }
    else {
        for(v=0;v<b;v++){
            cout<<a;
        }
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;



int main() {
    int n;
    cin>>n;
    vector<tuple<string,int,int>>score(n);
    rep(i,n){
        string s;
        int p;
        cin>>s>>p;
        p = -p;
        score[i] = make_tuple(s,p,i+1);
    }
    sort(score.begin(),score.end());
    rep(i,n)cout<<get<2>(score[i])<<endl;

    return 0;
}

Measured memory_bytes: 3464
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		long n=sc.nextLong();
		long a=sc.nextLong();
	    long b=sc.nextLong();
		long c=0;

		c=n/(a+b)*a;
		if(a!=0)c+=Math.min(a, n%(a+b));
		System.out.println(c);



	}

}

Measured memory_bytes: 23892
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll f(ll x, ll m) {
	return x % m;
}
ll dp[100005];
int main() {
	ll N, X, M;
	cin >> N >> X >> M;
	bool ch = true;
	ll A = X;
	ll an = 0;
	map<ll, ll> AP;
	AP[A] = 1;
	dp[1] = A;
	ll k = 1;
	ll j;
	while (k<=N) {
		k++;
		an += A;
		
		A = f(A * A, M);
		if (ch) {
			dp[k] = dp[k - 1] + A;
		}
		if (AP.count(A)&&ch) {
			
			j = k - AP[A];
			an += ((N - k) / j) * (dp[k] - dp[k - j]);
			k += ((N - k) / j) * j;
			ch = false;
		}
		AP[A] = k;
		
	}

	cout << an << endl;
}

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

int N;
map<int, int> M;
void f(){
  cout << "Yes\n";
  exit(0);
}
void g(){
  cout << "No\n";
  exit(0);
}
int main(void){
  cin >> N;
  for(int x, i = 0 ; i < N ; i++) cin >> x, M[x]++;
  if(M.size() == 1){
    if(M.count(0)) f();
    else g();
  }
  else if(M.size() == 2){
    if(M.count(0) && M[0] * 3 == N) f();
    else g();
  }
  else if(M.size() == 3){
    auto it = M.begin();
    int x = it->first;  it++;
    int y = it->first;  it++;
    int z = it->first;

    if(x != 0 && (x ^ y) == z && M[x] * 3 == N && M[y] * 3 == N && M[z] * 3 == N) f();
    else g();
  }
  else g();
}

Measured memory_bytes: 3840
// Problem : C - Welcome to AtCoder
// Contest : AtCoder - AtCoder Beginner Contest 151
// URL : https://atcoder.jp/contests/abc151/tasks/abc151_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n,m;
    cin>>n>>m;
    vi pen(n+1),correct(n+1);
    while(m--){
        string s; int p;
        cin>>p>>s;
        if(!correct[p] && s == "WA") pen[p]++;
        else if(s == "AC") correct[p] = 1;
    }
    int ac = 0, penalty = 0;
    for(int i=1;i<=n;i++){
        if(correct[i]){
            ac++;
            penalty += pen[i];
        }
    }
    cout<<ac<<' '<<penalty<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 4776
bool DBG = true;
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using ld = long double;
//using i128 = __int128_t;
//using bint = boost::multiprecision::cpp_int
//using d1024 = boost::multiprecision::number<mp::cpp_dec_float<1024>>;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define dcouts(x) if(DBG) couts(x)
#define dcoutn(x) if(DBG) coutn(x);
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;



void solve(){
  int n, d; cin >> n >> d; d = 2*d+1;
  coutn( (n+d-1)/d );
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
m = int(input())
ans = 0
sum_num = 0
c_sum = 0
for i in range(m):
    d,c = map(int, input().split())
    sum_num += d*c
    c_sum += c
#合計に対して、9減らす行為が何回出来るか
print(c_sum-1 + ((sum_num-1)//9))

Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long a,b,c;
    cin>>a>>b>>c;
    if(a*b*c%2==0){
        cout<<0<<endl;
    }
    else {
        cout<<min({a*b,b*c,c*a})<<endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main() {
	char s[100001];
	cin >> s;
	int x;
	if (s[0] == 'W') {
		x = 0;
	}
	else {
		x = 1;
	}
	int ans = 0;
	for (int i = 0;s[i] != '\0';i++) {
		if (x == 0 && s[i] == 'B') {
			x = 1;
			ans++;
		}
		else if (x == 1 && s[i] == 'W') {
			x = 0;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((ll)(x).size())

const ll inf = 1 << 25;
const ll mod = 1e9 + 7;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int digit(ll num) {
    return to_string(num).length();
}

int main() {
    ll N;
    cin >> N;
    
    int ans = inf;
    for(i, 1, sqrt(N)+1) {
        if (N % i == 0) {
            ll j = N / i;
            ans = min(ans, max(digit(i), digit(j)));
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
using namespace std;
typedef long long ll;

int main(){
  int n;
  int a;
  
  cin >> n;
  
  double b = 0;
  for (int i = 0; i < n; i++){
    cin >> a;
    b +=  (double)1 / a;
  }
  
  printf("%.10f\n",1/b);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
  
int main() {
    float a,b;
    cin>>a>>b;
    float y=(b-2*a)/2;
  float x=a-y;
  
  if(x==(int)x){
      if(x>=0 && y>=0){
          cout<<"Yes"<<endl;
      }
      else
      cout<<"No"<<endl;
      
  }
  else{
  cout<<"No"<<endl;
  }
    
    return 0;
}

Measured memory_bytes: 3716
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  int k;
  cin >> k;
  string S;
  cin >> S;


  int ans = 0;
  for(int i = 1; i < n; i++){
    if(S[i-1] == 'R' && S[i] == 'R') ans++;
  }
  for(int i = n-2; i >= 0; i--){
    if(S[i+1] == 'L' && S[i] == 'L') ans++;
  }

  int cnt = 0;
  for(int i = 0; i < n-1; i++){
    if(S[i] != S[i+1]) cnt++;
  }

  if(cnt%2 == 0){
    if(k >= cnt/2){
      ans += cnt;
    }else{
      ans += 2*k;
    }
  }else if(cnt != 1 && cnt != 0){
    if(k >= cnt/2 + 1){
      ans += cnt;
    }else{
      ans += 2*k;
    }
  }else{
    ans = n-1;
  }


  printf("%d\n", ans);
  return 0;





  // int start = -10;
  // int end = -10;
  // for(int i = 0; i < n; i++){
  //   if(S[i]=='L' && S[i+1]=='R'){
  //     start = i+1;
  //     break;
  //   }
  // }
  // for(int i = n-1; i >= 1; i--){
  //   if(S[i]=='L' && S[i-1]=='R'){
  //     end = i-1;
  //     break;
  //   }
  // }
  //
  // int pans = ans;
  //
  // int pstart = -10;
  // int pend = -10;
  // for(int i = 0; i < n; i++){
  //   if(S[i]=='R' && S[i+1]=='L'){
  //     pstart = i+1;
  //     break;
  //   }
  // }
  // for(int i = n-1; i >= 1; i--){
  //   if(S[i]=='R' && S[i-1]=='L'){
  //     pend = i-1;
  //     break;
  //   }
  // }
  //
  //
  //
  // if(start != -10 && end != -10){
  //   ans += 2;
  //   int cnt = 0;
  //   for(int i = start; i < end; i++){
  //     if(S[i] != S[i+1]) cnt++;
  //   }
  //
  //   int pcnt = 0;
  //   for(int i = pstart; i < pend; i++){
  //     if(S[i] != S[i+1]) pcnt++;
  //   }
  //
  //   cnt = std::max(cnt,pcnt);
  //
  //   if(k-1 >= cnt/2){
  //     ans += cnt;
  //   }else{
  //     ans += 2*(k-1);
  //   }
  // }else{
  //   ans = n-1;
  // }


}


Measured memory_bytes: 512
package main

import (
  "bufio"
  "container/list"
  "fmt"
  "os"
  "strconv"
  "strings"
)

var g Graph

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n,m := input.Next2Ints()
  g = NewGraph(n)
  for i:=0;i<m;i++ {
    u,v,s := input.Next3Ints()
    u,v = u-1,v-1
    g.Add(u,v,s)
    g.Add(v,u,s)
  }
  nodes := make([]Node,n)
  nodes[0] = Node{0,1}
  queue := list.New()
  queue.PushBack(0)
  fix := int64(-1)
  for queue.Len() > 0 {
    stat,_ := queue.Remove(queue.Front()).(int)
    node := nodes[stat]
    for _,e := range g[stat] {
      other := node.Other(e.s)
      old := nodes[e.to]
      if old.sig == 0 {
        nodes[e.to] = other
        queue.PushBack(e.to)
        continue
      }
      if node.sig == old.sig {
        tmp := node.sig*(e.s-node.x-old.x)
        if tmp <= 0 || tmp%2 != 0 { tmp = -2 }
        tmp /= 2
        if tmp == -1 { fmt.Println(0);return }
        if fix == -1 { fix = tmp;continue }
        if tmp != fix { fmt.Println(0);return }
      } else {
        if other != old { fmt.Println(0);return }
      }
    }
  }
  if fix != -1 {
    for _,node := range nodes {
      if !node.IsOk(fix) { fmt.Println(0);return }
    }
    fmt.Println(1)
  } else {
    min := int64(1)
    max := int64(10000000000000000)
    for _,node := range nodes {
      if node.sig > 0 {
        if min < -node.x+1 { min = -node.x+1 }
      } else {
        if max > node.x-1 { max = node.x-1 }
      }
    }
    if max-min+1 > 0 {
      fmt.Println(max-min+1)
    } else {
      fmt.Println(0)
    }
  }
}

type Node struct { x,sig int64 }
func(n Node) IsOk(y int64) bool { return n.x+n.sig*y > 0 }
func(n Node) Other(s int64) Node { return Node{s-n.x,-n.sig} }

type Edge struct { to int;s int64 }
type Graph [][]Edge
func NewGraph(n int) Graph { return make([][]Edge,n) }
func(g Graph) AddEdge(from int,e Edge) { g[from] = append(g[from],e) }
func(g Graph) Add(from,to int,s int64) { g.AddEdge(from,Edge{to,s}) }

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) Next2Ints() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) Next3Ints() (int,int,int64) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  z,_ := strconv.ParseInt(s[2],10,64)
  return x,y,z
}

Measured memory_bytes: 15616
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	ll k, l = 1, r = 1; cin >> k;
	vector<ll> a(n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		r = max(r, a[i]);
	}
	ll ans = r;
	while(l <= r)
	{
		ll m = (l + r)/2, c = 0;
		for(int i = 0; i < n; i++) c += a[i]/m - (!(a[i] % m));
		if(c > k) l = m + 1;
		else
		{
			ans = m;
			r = m - 1;
		}
	}
	cout << ans;

	return 0;
}

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

int main(){
	int i;
	string s;
	cin >> s;
	for(i = 0; i < 4; i++){
		printf("%c", s[i]);
	}
	printf(" ");
	for(i = 4; i < 12; i++){
		printf("%c", s[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
n = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

cnt = 0
for i in range(1,n+1,2):
    if len(make_divisors(i)) == 8:
        cnt += 1

print(cnt)

Measured memory_bytes: 38736
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.

open System

[<EntryPoint>]
let main argv = 

    let inputs = stdin.ReadLine().Split(' ') |> Array.map int

    let r = inputs.[0]
    let D = inputs.[1]
    let x = inputs.[2]

    //for i = 1 to 10 do
        //x <- r * x - D
        //printfn "%d" x
    let rec calcAndShow x n =
        if n <= 0 then
            0
        else
            let tmp = r * x - D
            printfn "%d" tmp
            calcAndShow tmp (n - 1)

    calcAndShow x 10


Measured memory_bytes: 11984
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
vector<int>V(N);
  vector<int>C(N);

for (int i = 0; i < N; i++) {
  cin >> V.at(i);
}
  for(int i=0; i<N; i++){
    cin>>C.at(i);
  }
  

 
  
  int sum=0;
  
  
  for(int i=0;i<N;i++){
    
    if(V.at(i)-C.at(i)>0){
      sum+=(V.at(i)-C.at(i));
    }
  }
  cout<<sum<<endl;
}

    
    

Measured memory_bytes: 256
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor



def combination(n, r):
    r = min(n-r, r)
    result = 1
    for i in range(n, n-r, -1):
        result *= i
    for i in range(1, r+1):
        result //= i
    return result


n, m = map(int, input().split())
r = 1

prime_fac = prime_factorize(m)
for v in prime_fac.values():
    r *= combination(v + n - 1, v)
mod = 1000000000 + 7
print(r % mod)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h /2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	ll n;
	cin >> n;
	vector<ll> a(n+1);
	for(ll x=1; x*x+2*x<= n; x++){
		for(ll y=1; y*y+2*y<=n; y++){
			for(ll z=1; z*z+2*z<=n; z++){
				ll cnt = x*x+y*y+z*z+x*y+y*z+z*x;
				if(cnt > n) continue;
				a[cnt]++;
			}
		}
	}
	loop(i, 1, n+1){
		cout << a[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3652
def calc_dynamic(n, x, m):
    # 結果を保持する辞書
    cal_result = {}

    # 初期値の設定
    cal_result[1] = x

    if n == 1:
        return x

    for i in range(1, n):
        cal_result[i+1] = cal_result[i] ** 2 % m

    #return cal_result[n]
    return sum(cal_result.values())

def calc_dynamic2(n, x, m):
    cal_result_0 = 0
    cal_result_1 = 0

    # 初期値の設定
    cal_result_0 = x
    total = x

    if n == 1:
        return x

    for i in range(1, n):
        cal_result_1 = cal_result_0 * cal_result_0 % m
        cal_result_0 = cal_result_1
        total += cal_result_1

    return total

def calc_dynamic3(n, x, m):
    # 結果を保持する辞書
    cal_result = {}
    cal_result_0 = 0
    cal_result_1 = 0
    loop_range = (0,0)

    # 初期値の設定
    cal_result_0 = x
    total = x

    if n == 1:
        return x

    for i in range(1, n):
        cal_result_1 = cal_result_0 * cal_result_0 % m
        cal_result_0 = cal_result_1
        total += cal_result_1
        if cal_result_1 in cal_result:
            loop_range = (cal_result[cal_result_1], i, cal_result_0, cal_result_1)
            break
        else:
            cal_result[cal_result_1] = (i, total)

    if i == n-1:
        return total

    hoge = i
    r = i - loop_range[0][0]
    v = total - loop_range[0][1]
    hoge += r
    total += v * ((n - hoge) // r)
    hoge += r * ((n - hoge) // r)
    #while hoge < n:
    #    total += v
    #    hoge += r

    cal_result_0 = loop_range[2]
    cal_result_1 = loop_range[3]
    for i in range(hoge-r+1, n):
        cal_result_1 = cal_result_0 * cal_result_0 % m
        cal_result_0 = cal_result_1
        total += cal_result_1

    return total

[n, x, m] = map(lambda x: int(x), input().split(" "))
print(calc_dynamic3(n, x, m))

Measured memory_bytes: 20124
import sys
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().split()]

color = set()
over = 0
for a in A :
    if a < 3200 :
        color.add(a//400)
    else :
        over += 1

print(max(1,len(color)), len(color)+over)


Measured memory_bytes: 3060
n,x = map(int,input().split())
l = sorted(list(map(int,input().split())))
pe = 0
for i in l:
  if x-i>=0:
    x -= i
    pe += 1
  else:
    break
if x!=0 and n==pe:
  print(pe-1)
else:
  print(pe)

Measured memory_bytes: 3060