akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const double EPS = 1.0e-10;

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

    vector<int> f(n), a(n), t(n), x(n), y(n);
    for(int i=0; i<n; ++i)
        cin >> f[i] >> a[i] >> t[i] >> x[i] >> y[i];

    vector<double> dist(2, -1.0);
    vector<double> df(2, -1.0);
    for(int i=1; i<n; ++i){
        if(!(t[i] == t[i-1] && a[i] != a[i-1]))
            continue;

        double dist2 = sqrt(pow(x[i] - x[i-1], 2.0) + pow(y[i] - y[i-1], 2.0));
        if(abs(dist2 - dist[t[i]]) < EPS){
            dist[t[i]] = dist2;
            df[t[i]] = min(df[t[i]], (f[i] - f[i-1]) / 60.0);
        }
        else if(dist2 > dist[t[i]]){
            dist[t[i]] = dist2;
            df[t[i]] = (f[i] - f[i-1]) / 60.0;
        }
    }

    cout.setf(ios_base::fixed, ios_base::floatfield);
    cout << setprecision(10);
    for(int i=0; i<2; ++i){
        if(dist[i] < -0.5){
            cout << -1 << ' ' << -1 << endl;
        }
        else{
            cout << dist[i] << ' ' << df[i] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1272
# -*- coding: utf-8 -*-
"""
B - 105
https://atcoder.jp/contests/abc106/tasks/abc106_b

"""
import sys


def divisor(N):
    divisors = set()
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            divisors.add(i)
            divisors.add(N // i)
    return divisors


def solve(N):
    ans = 0
    for i in range(1, N+1, 2):
        if len(divisor(i)) == 8:
            ans += 1
    return ans


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

using namespace std;

int n;

int main()
{
  cin >> n;
  int count = 0;
  int prev = 0;
  int a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (a == prev) {
      count++;
      prev = 10000;
    } else {
      prev = a;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 768
// =====================================================================================
// 
//       Filename:  C.cpp
//        Created:  2017년 08월 06일 21시 38분 19초
//       Compiler:  g++ -O2 -std=c++14
//         Author:  baactree ,  bsj0206@naver.com
//        Company:  Chonnam National University
// 
// =====================================================================================

#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[3];
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		int x;
		scanf("%d", &x);
		if(x%4==0)
			cnt[2]++;
		else if(x%2==0)
			cnt[1]++;
		else
			cnt[0]++;
	}
	if(cnt[1]!=0)
		printf("%s\n", cnt[2]<cnt[0]?"No":"Yes");
	else
		printf("%s\n", cnt[2]<(cnt[0]-1)?"No":"Yes");
	return 0;
}



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

using namespace std;

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

	string s;
	cin >> s;

	if (s[s.size() - 1] == 's')
		s.append("es");
	else
		s.append("s");
	cout << s<< "\n";

	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>                                                         
using namespace std;
int main()
{
  int N,L;
  cin >> N >> L;
  vector<string> s(N);
  for(int i=0; i<N; i++){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  for(int i=0; i<N; i++){
    cout << s.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

const int MAXN = 5e5+10;
vl fact(MAXN), inv(MAXN), finv(MAXN);

void precalc(){
    int n = MAXN;
    fact[0] = finv[0] = inv[1] = 1;
    fore(i, 2, n)
        inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
    fore(i, 1, n){
        fact[i] = fact[i-1] * i % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

ll C(int n, int r){
    if(n<r || r<0) return 0;
    return fact[n] * finv[r]%mod * finv[n-r]%mod;
}

// By PIE:
// 1. Ways to form A
// C(M,N) * N!
// 2. For a particular seq A derangements of B
// If at least j are equal
// (-1)^^i * ( C(n,j)*C(m-j, n-j)*(n-j)! )
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    precalc();
    ll n,m;
    while(cin>>n>>m){
        ll ans = 0;
        ll cur = 1;
        forn(i,n+1){
            // ans+= cur*C(n,i)*C(m-i, n-i)*fact[n-i];
            ans = (ans + cur* (C(n,i) * C(m-i, n-i)%mod * fact[n-i]%mod ) + mod)%mod;
            cur*=-1;
        }

        ll waysA = C(m,n)*fact[n]%mod;
        ans = (ans*waysA)%mod;
        
        cout<<ans%mod<<endl;
    }
    return 0;
}

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

int main() {
  int n,m,x;
  cin>>n>>m>>x;
  
  int a[12][12];
  int c[n];
  
  rep(i,n){
    cin>>c[i];
    rep(j,m){
      cin>>a[i][j];
    }
  }
  
  int ans=INF;
  
  for(int bit=0;bit<(1<<n);bit++){
    vector<int> sum(m);
    int cost=0;
  rep(i,n){
    if(bit & (1<<i)){
      cost+=c[i];
      rep(j,m){
    sum[j]+=a[i][j];
    }
  }
  }
    
  bool ok=true;
    rep(j,m){
     if(sum[j]<x)ok=false;
    }
    if(ok)ans=min(ans,cost);
  }
 
  
    
    
   if(ans==INF)cout<<-1<<endl;
    else cout<<ans<<endl;
   
    
    
    
    
    
  
  
}

Measured memory_bytes: 3600
// AtCoder ABC108: A - Pair
// 2019.9.11 bal4u

#include <stdio.h>

int main()
{
	int i, j, K, ans;
	
	scanf("%d", &K);
	ans = 0; for (i = 1; i <= K; i+=2) {
		for (j = 2; j <= K; j+=2) ans++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>

using ull = unsigned long long;

struct elem {
	ull index, area;
	elem(ull i, ull a) :index{ i }, area{a} {}
};

int main(){

	std::vector<ull> s1;
	std::vector<elem> s2;

	std::string s;
	std::cin >> s;
	ull i{}, sum{};
	for (const auto&e : s) {
		if (e == '\\')s1.emplace_back(i);
		else if (e == '/'&&s1.size() > 0) {// ’\\’が積まれていないなら’/’を考えなくていい。
			auto idx = s1.back(); s1.pop_back();
			auto area = i - idx;
			sum += area;
			while (s2.size() > 0 && s2.back().index > idx) {
				auto elm = s2.back(); s2.pop_back();
				area += elm.area;
//				elm.index=idx;
			}
			s2.emplace_back(idx, area);
		}
		++i;
	}
	std::cout << sum << "\n";
	
	std::cout << s2.size();
	for (const auto&e : s2) {
		std::cout << " "<<e.area;
	}std::cout << "\n";


	/*
	for (const auto &e:s2) {
		
		std::cout <<e.index<<" "<< e.area << "\n";
	}*/


/*
	char c{};
	for (ull i{}; std::cin >> c; ++i) {
		if (c == '\\')s1.emplace_back(i);
		else if (c == '/'&&s1.size() > 0) {
			auto idx = s1.back(); s1.pop_back();	//対になる’\\’の登場位置（index）
			auto area = i - idx;
			if (s2.size() > 0 && s2.back().index > idx) {
				auto e = s2.back(); s2.pop_back();
				e.area += area;
				e.index = idx;
				s2.emplace_back(e);
			}
			//s2.emplace_back(i-x,);
			s2.emplace_back(idx,area);
		}
	}
*/
	/*
	for (const auto &e : s2) {
		std::cout << e.area << "\n";
	}*/
	return 0;
}


Measured memory_bytes: 3304
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

constexpr lint mod=1e9+7;

int N;
string S;
lint dp[100010][13];

int main()
{
	cin >> S;
	N=(int)S.size();
	//S='_'+S;
	
	dp[0][0]=1;
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<13;j++)
		{
			if('0'<=S[i] && S[i]<='9')
			{
				dp[i+1][(j*10+(S[i]-'0'))%13]+=dp[i][j];
				dp[i+1][(j*10+(S[i]-'0'))%13]%=mod;
			}
			else
			{
				for(int k=0;k<=9;k++)
				{
					dp[i+1][(j*10+k)%13]+=dp[i][j];
					dp[i+1][(j*10+k)%13]%=mod;
				}
			}
		}
	}
	
	cout << dp[N][5] << endl;
	return 0;
}



Measured memory_bytes: 10624
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#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;

#define ECHO(v) cout << v << endl;

int main(void){
    ll a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    if(a==b && a==c){
        cout << 1 << endl;
    }else if(a!=b && a!=c && b!=c){
        cout << 3 << endl;
    }else{
        cout << 2 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <complex>
#include <iterator>
#include <iomanip>
#include <algorithm>

using namespace std;

int main() {
    int n;
    while (cin>>n && n != 0) {
        vector<complex<float>> vs;
        complex<float> next_point, last_vector;
        next_point = complex<float>(500, 0);
        float min = 10.0f;
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            vs.push_back(complex<float>(y, x));
            if (arg(complex<float>(y,x)) < min || (arg(complex<float>(y,x)) == min && abs(complex<float>(y,x)) < abs(next_point)))
                {next_point = complex<float>(y, x); min = arg(next_point);}
        }
        float length = abs(next_point);
        auto last_point = last_vector = next_point;
        vs.erase(find(begin(vs), end(vs), next_point));
        for (int i = 1; i < n; i++) {
            next_point = complex<float>(500,0);
            auto _it = begin(vs);
            min = 10.0f;
            for (auto it = begin(vs); it != end(vs); it++) {
                float temp = arg((*it - last_point) / last_vector);
                if (temp < min || (temp == min && abs(*it - last_point) < abs(*_it - last_point))) {min = temp; _it = it;}
            }
            next_point = *_it;
            vs.erase(_it);
            last_vector = next_point - last_point;
            length += abs(last_vector);
            last_point = next_point;
        }
        cout<<fixed<<setprecision(1)<<length<<endl;
    }
}

Measured memory_bytes: 3348
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var ret = false
    for (i in 1..9) {
        if (n % i == 0 && 0<= n / i && n / i <= 9) {
            ret = true
            break
        }
    }
    println(if (ret) "Yes" else "No")
}

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

int main(){
    string S,T;
    cin >> S >> T;

    string N;
    N = S + T[T.length()-1];
    if(N==T) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<iomanip>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

bool city(pair<P, int> a, pair<P, int> b){
    return a.second < b.second;
}

int main(){
    int n, m;
    cin >> n >> m;
    pair<P, int> c[m];
    rep(i, m) {
        cin >> c[i].first.first >> c[i].first.second;
        c[i].second = i;
    }
    sort(c, c + m);
    c[0].first.second = 1;

    rep(i, m - 1){
        if (c[i+1].first.first == c[i].first.first){
            c[i+1].first.second = c[i].first.second + 1;
        }else{
            c[i+1].first.second = 1;
        }
    }
    sort(c, c + m, city);
    for (int i = 0; i < m; i++){
        cout << setfill('0') << right << setw(6) << c[i].first.first;
        cout << setfill('0') << right << setw(6) << c[i].first.second << endl;
    }
    
    
}



Measured memory_bytes: 2688
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<int,int> P; //point cost
struct Edge {
	int to,cost;
	Edge(int _to,int _cost){to=_to,cost=_cost;}
};
int dist[3000];
vector<Edge> edges[3000];
void dijkstra(int s) {
	priority_queue<P,vector<P>,greater<P> > Q;
	dist[s]=0;
	Q.push(P(s,0));
	while(!Q.empty()) {
		P p=Q.top();Q.pop();
		if(dist[p.first]<p.second) continue;
		for(int i=0;i<edges[p.first].size();i++) {
			if(dist[edges[p.first][i].to]>(p.second+edges[p.first][i].cost)) {
				dist[edges[p.first][i].to]=(p.second+edges[p.first][i].cost);
				Q.push(P(edges[p.first][i].to,dist[edges[p.first][i].to]));
			}
		}
	}
}
int main() {
	int N,M,K;
	scanf("%d %d %d",&N,&M,&K);
	for(int i=0;i<M;i++) {
		int a,b,l;
		scanf("%d %d %d",&a,&b,&l);
		edges[a-1].push_back(Edge(b-1,l));
		edges[b-1].push_back(Edge(a-1,l));
	}
	fill(dist,dist+3000,1<<27);
	for(int i=0;i<K;i++) {
		int s;
		scanf("%d",&s);
		dijkstra(s-1);
	}
	int ans=0;
	for(int i=0;i<N;i++) {
		for(int j=0;j<edges[i].size();j++) {
			int A=dist[i],B=dist[edges[i][j].to],C=abs(A-B);
			if(A<B)ans=max(ans,A+C+(edges[i][j].cost-C+1)/2);
			else ans=max(ans,B+C+(edges[i][j].cost-C+1)/2);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 8176
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int num[110];
int n;
int ans=0x7FFFFFFF;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>num[i];
	for(int i=1;i<=100;i++){
		int sum=0;
		for(int j=1;j<=n;j++)
			sum+=abs(i-num[j])*abs(i-num[j]);
		ans=min(sum,ans);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
H=list(map(int,input().split()))
check=[0]*N
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    check[B-1]=check[B-1]+1
  elif H[A-1]<H[B-1]:
    check[A-1]=check[A-1]+1
  else:
      check[A-1]+=1
      check[B-1]+=1
    
    
ans=check.count(0)

print(ans)

Measured memory_bytes: 20144
N = int(input())

f  = int(N/3)
b  = int(N/5)
fb = int(N/15)

sum = int(N*(N+1)/2)

for i in range(1, f+1):
    sum -= i*3
for i in range(1, b+1):
    sum -= i*5
for i in range(1, fb+1):
    sum += i*15
print(sum)

Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <cmath>

int main(int argc, char const* argv[])
{
    std::string str;

    getline(std::cin, str, ' ');
    long n = std::stol(str);

    getline(std::cin, str);
    long k = std::stol(str);

    long res = 0;
    long val = 0;
    for (res = 0;; res++)
        if (pow(k, res) > n) break;

    std::cout << res << std::endl;

    return 0;
}



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

int main()
{
  int n;
  scanf("%d",&n);
  vector<int> a(n);
  for(int i=0;i<n;i++){
    scanf("%d",&(a[i]));
  }
  int ct=0;
  bool F=0;
  for(int i=1;i<n;i++){
    if(!F&&a[i-1]==a[i]){
      ct++;
      F=1;
    }
    else{
      F=0;
    }
  }
  printf("%d\n",ct);
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    string s;
    cin>>n>>s;
    string left=s.substr(0,n/2);
    string right=s.substr(n/2,n-n/2);
    if (left==right) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  double sum;
  vector<double> a(n);
  for(int i = 0; i < n; i++)
    cin >> a.at(i);
  sort(a.begin(),a.end());
  sum = (a.at(0) + a.at(1))/2.0;
  for(int i = 2; i < n; i++){
    sum = (sum + a.at(i)) / 2.0;
  }
  cout << sum;
}

Measured memory_bytes: 3748
fun main(args: Array<String>?): Unit {
    while(true){
        val (n, m, a, b, c, t) = readLine()!!.trim().split(' ').map(String::toInt)
        if (n == 0) return
        val s = readLine()!!.trim().split(' ').map{it.toInt() % m}
        val matrix = Array(n){i -> IntArray(n){j -> if (i - 1 == j) a else if (i == j) b else if (i + 1 == j) c else 0}}
        println(
                times(matrix.exp(t, m), s.toIntArray(), m).joinToString(" ")
        )
    }
}
operator fun List<Int>.component6(): Int = this[5]

fun times(a: Array<IntArray>, b: Array<IntArray>, m: Int): Array<IntArray> {
    val result = Array(a.size){IntArray(b.first().size){0}}
    for (i in result.indices) {
        for (j in result[i].indices) {
            for (k in a[i].indices) {
                result[i][j] += a[i][k] * b[k][j]
            }
            result[i][j] %= m
        }
    }
    return result
}
fun times(a: Array<IntArray>, b: IntArray, m: Int): IntArray {
    return times(a, b.map{ intArrayOf(it)}.toTypedArray(), m).map{it.first()}.toIntArray()
}
fun double(a: Array<IntArray>, m: Int): Array<IntArray> {
    return times(a, a, m)
}
fun Array<IntArray>.exp(p: Int, m: Int): Array<IntArray> {
    return when(p){
        0 -> Array(this.size){i -> IntArray(this.size){j -> if (i == j) 1 else 0}}
        1 -> this
        else -> if (p % 2 == 0) double(this.exp(p / 2, m), m) else times(this, double(this.exp(p / 2, m), m), m)
    }
}


Measured memory_bytes: 58920
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    long long n,m,l1,r1,l=0,r=100000;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>l1>>r1;

        if(l1>l){
            l=l1;
        }
        if(r>r1){
            r=r1;
        }
    }
    cout<<max(r-l+1,0LL)<<endl;
    return(0);
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    
    ll sum = 0LL;
    rep(i, N-1) sum += A[i];

    int ans = 1;
    for (int i=N-2; i>=0; i--) {
        if (A[i+1] <= 2*sum) ans++;
        else break;

        sum -= A[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        boolean che = true;
        boolean soi;
        while(che == true){
            soi = true;
            for(int i = 2 ; i < (int)Math.sqrt(n) && soi == true ; i++){
                if(n % i == 0){
                    soi = false;
                }
            }
            if(soi == true){
                System.out.println(n);
                che = false;
            }
            n++;
        }
        sc.close();
    }
}

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

#ifdef loc
    #include "loc_debug.h"
#else
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif

typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i, s, n)  for(int i = s; i <= n; ++i)
#define rev(i, n, s)  for(int i = n; i >= s; --i)
#define fore(x, a) for(auto &&x : a)
#define fill(a, x) memset((a), (x), sizeof(a))
#define tcase int __t; cin >> __t; rep(tc, 1, __t)
#define F first
#define S second
#define gc getchar

const int mod = 1000000007;
#define _ %mod
const int N = 100005;



int main() {
    fast_io;
    string s;
    cin >> s;
    map<char, int> a;
    fore(x, s) {
        a[x]++;
    }
    ll res = 0;
    fore(x, a) {
        res += (x.S * (ll)(x.S + 1)) / 2;
    }
    res = (sz(s) * (ll)(sz(s) + 1)) / 2 - res;
    cout << 1 + res << endl;
    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int K; cin >> K;

  int ans = 0;
  for(int i = 1; i <= K; i++){
    for(int j = 1; j <= K; j++){
      for(int k = 1; k <= K; k++){
        ans += __gcd(i, __gcd(j, k));
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;

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

  char s;
  for(int i = 0; i < N; i++){
    cin >> s;
    if(i == K-1){
      s -= ('A' - 'a');
    }
    cout << s;
  }
  
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
n, w = gets.split(" ").map(&:to_i)

class Value
    attr_reader :data, :key
    def initialize(x)
        @data = x
        @key = x[0].to_f / x[1].to_f
    end

    def <=>(t)
        if @key < t.key then
            return 1
        elsif @key > t.key then
            return -1
        end

        return 0
    end
end

a = []
n.times do |i|
    a[i] = Value.new(gets.split(" ").map(&:to_i))
end

a = a.sort

point = 0
# k, v, w
a.each do |x|
    f = x.data[1] < w ? x.data[1] : w
    point += f * x.key
    w -= f
end

print point, "\n"



Measured memory_bytes: 19332
#include <set>
#include <iostream>
using namespace std;
int memo[21][21][21][21];
int H, W;
string C[20];

int grundy(int b, int l, int t, int r){
  if(memo[b][l][t][r] >= 0) return memo[b][l][t][r];
  set<int> S;
  for(int i = b; i < t; ++i){
    for(int j = l; j < r; ++j){
      if(C[i][j] == 'X') continue;
      int x = grundy(b,l,i,j), y = grundy(b,j+1,i,r), z = grundy(i+1,l,t,j), w = grundy(i+1,j+1,t,r);
      S.insert(x^y^z^w);
    }
  }
  for(int i = 0; i <= H*W; ++i){
    if(not S.count(i)){
      memo[b][l][t][r] = i;
      return i;
    }
  }
  return -1;
}

int main(){
  cin >> H >> W;
  for(int i = 0; i <= H; ++i)
    for(int j = 0; j <= W; ++j)
      for(int k = 0; k <= H; ++k)
        fill(memo[i][j][k],memo[i][j][k]+21,-1);

  for(int i = 0; i < H; ++i) cin >> C[i];
  int ans = grundy(0,0,H,W);
  if(not ans) cout << "Second" << endl;
  else cout << "First" << endl;
  return 0;
}



Measured memory_bytes: 3932
import sys
input = lambda: sys.stdin.readline().rstrip()
from math import floor,ceil,sqrt,factorial,log, sin, cos, fabs, pi
from heapq import heapify, heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from decimal import Decimal
inf = float('inf')
mod = 1000000007

a, b, h, m = map(int, input().split())

longt = 6
mint = 1 / 2

time = h * 60 + m

longtt = longt * time % 360
mintt = mint * time % 360

w = fabs(longtt - mintt)

if w > 180:
    w = 360 - w

w = w / 180 * pi
l = sqrt(a**2 + b**2 - 2 * a * b * cos(w))
print(l)



Measured memory_bytes: 71412
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    
    int  N,X,T;
    long long ans;
//    string in_str,tmp_str;
    cin >> N >> X >> T;  

    ans = (N / X)*T;
    if(N%X!=0){
        ans = ans +T;
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
   map<string,int> mp;
   mp["01"]=1;
   mp["02"]=1;
   mp["03"]=1;
   mp["04"]=1;
   mp["05"]=1;
   mp["06"]=1;
   mp["07"]=1;
   mp["08"]=1;
   mp["09"]=1;
   mp["10"]=1;
   mp["11"]=1;
   mp["12"]=1;

   string str,s1,s2;
   cin>>str;
   s1 = str.substr(0,2);
   s2 = str.substr(2,4);

    if(mp.count(s1)!=1 && mp.count(s2)!=1) printf("NA\n");
    else if (mp.count(s1)==1 && mp.count(s2)==1) printf("AMBIGUOUS\n");
    else if (mp.count(s1)!=1 && mp.count(s2)==1) printf("YYMM\n");
    else  printf("MMYY\n");
 
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<40;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
struct edge{
	int dst, len;
	edge(int d, int l)
		: dst(d), len(l) {}
};
bool operator < (const edge& e, const edge& f){
	return e.len>f.len;
}
#define N 200010
int h, w, n;
vector<edge> e[N];
ll v[N];

bool dfs(int a, ll &ma, ll &mb){
	chmin(ma, v[a]);
	for(auto x: e[a]){
		int b = x.dst, c = x.len-v[a];
		if(v[b]==INF){
			v[b] = c;
			if(!dfs(b, mb, ma)) return false;
		} else if(v[b]!=c) return false;
	}
	return true;
}

int main(){
	fill(v, v+N, INF);
	cin>>h>>w>>n;
	rep(i, n){
		int a, b, c;
		cin>>a>>b>>c; a--; b--;
		b += h;
		e[a].push_back(edge(b, c));
		e[b].push_back(edge(a, c));
	}
	for(int i = 0; i < h; i++){
		if(v[i]!=INF || e[i].empty()) continue;
		v[i] = 0;
		ll ma = INF, mb = INF;
		if(!dfs(i, ma, mb) || ma+mb<0){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main() {
  int N, a, b;
  a=0;
  cin >>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  vec.push_back(0);
  for(int i=0;i<N;i++){
    if(vec.at(i)>vec.at(i+1)){
      a++;
    }
    else if(vec.at(i)=vec.at(i+1)){
      continue;
    }
    else {
      break;
    }
  }
  cout <<a <<endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int n,k;cin>>n>>k;
  vector<int> O[n+10];
  rep(i,0,k-1) {
    int d;cin>>d;
    rep(j,0,d-1) {
      int a;cin>>a;
      a--;
      O[a].push_back(d);
    }
  }

  ll ans=0;

  rep(i,0,n-1) {
    if(O[i].size()==0) {
      ans++;
    }
  }

  pr(ans);
  return 0;
}


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

int f(int n)
{
  if (n % 2 == 0)
    return n / 2;
  else
    return 3 * n + 1;
}

int main()
{
  int s;
  cin >> s;
  int a[1000001] = {};
  a[1] = s;
  int i = 2;
  map<int, int> m;
  m[a[1]] = 1; // 忘れない
  while (true)
  {
    a[i] = f(a[i - 1]);
    if (m.find(a[i]) == m.end())
      m[a[i]] = 1;
    else
    {
      cout << i << endl;
      return 0;
    }
    i++;
  }
  return 0;
}

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

int main(){
    int n;
    double w, h;
    while(scanf("%d,%lf,%lf", &n, &w, &h) != -1){
        if((w / (h * h)) >= 25.0) cout <<n <<endl;
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        
        long ans = B;
        ans += C - Math.max(C - (A+B+1), 0);
        
        System.out.println(ans);
    }

}	

Measured memory_bytes: 20560
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define inf 0x7fffffff
#define llinf 0x7fffffffffffffffll
using namespace std;
int main()
{
	int i,j,k,n,m;
	scanf("%d",&n);
	if(n<4)
	{
		printf("No\n");
		return 0;
	}
	for(i=0;i<=n;i++)
	{
		if(i*4>n)
		{
			break;
		}
		if((n-i*4)%7==0)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair <int,int> P;

int main(){
    string S;
    cin >> S;
    int MAX = 0;
    int cnt = 0;
    for(int i = 0;i<S.size();i++){
        if(S.at(i) == 'A' ||S.at(i) == 'G' ||S.at(i) == 'C' ||S.at(i) == 'T' ){
            cnt = cnt + 1;
            MAX = max(MAX,cnt);
        }else{
            cnt = 0;
        }
        

    }
    cout << MAX << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;	
string ss [3] = {"Sunny","Cloudy","Rainy"};
for ( int i = 0; i<3 ; i++){
	if (ss[i]==s){
		cout<<ss[(i+1)%3];
}
}
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    ll N,M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    vector<P> D;
    rep(i,M){
    ll B,C;
        cin >> B >> C;
        D.push_back(make_pair(C,B));
    }
  
    sort(A.begin(),A.end());
    sort(D.rbegin(),D.rend());
    vector<ll> E;
 
    rep(i,M){
        rep(j,D[i].second){
            E.push_back(D[i].first);
            if(E.size() == N) break;
        }
        if(E.size() == N) break;
    }

    ll ans = 0;
    rep(i,N){
        if(i < E.size()) ans += max(A[i],E[i]);
        else ans += A[i];
    }
    cout << ans << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 4464
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

ll n, m, a, b, c, d, e;
string s;

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

    ll mini = min({a,b,c,d,e});
    std::cout << (n + mini - 1) / mini + 4 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

typedef string::const_iterator Iter;

int express(Iter &p);
int term(Iter &p);
int factor(Iter &p);
int number(Iter &p);

int express(Iter &p) {
	int r = term(p);
	for(;;) {
		if(*p == '+') {
			p++;
			int rs = term(p);
			r += rs;
		}
		else if(*p == '-') {
			p++;
			int rs = term(p);
			r -= rs;
		}
		else
			break;
	}
	return r;
}


int term(Iter &p) {
	int r = factor(p);
	for(;;) {
		if(*p == '*') {
			p++;
			int rs = factor(p);
			r *= rs;
		}
		else if(*p == '/') {
			p++;
			int rs = factor(p);
			r /= rs;
		}
		else
			break;
	}
	return r;
}

int factor(Iter &p) {
	if(*p == '(') {
		p++;
		int r = express(p);
		p++; // skip )
		return r;
	}
	else
		return number(p);
}

int number(Iter &p) {
	int r = 0;
	while(isdigit(*p)) {
		r *= 10;
		r += (*p) - '0';
		p++;
	}
	return r;
}

int main() {
	int N; cin >> N;
	cin.ignore();
	while(N--) {
		string line;
		getline(cin, line);
		Iter begin = line.begin();
		int ans = express(begin);
		cout << ans << endl;
	}
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int x = 0;
  
  for(int i=A; i <= B; i++) {
    int a, b, c, d, e;
    a = i / 10000;
    b = i / 1000 - 10 * a;
    c = i / 100 - 100 * a - 10 * b;
    d = i / 10 - 1000 * a - 100 * b - 10 * c;
    e = i - 10000 * a - 1000 * b - 100 * c - 10 * d;
    
    if(a == e && b == d) {
      x++;
    }
  }
  
  cout << x << endl;
}

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

using namespace std;

typedef long long ll;

const int N=1e5+10;


int n,k,a[N],w[N];

int h[N];
ll solve(){
    k++;
    ll ans=0;
    for(int j=30;j>=0;j--){
        int type=(k>>j)&1;
        if (type==0){
            for(int i=1;i<=n;i++) if ((a[i]>>j)&1) h[i]=1;
            continue;
        }
        ll cans=0;
        for(int i=1;i<=n;i++) if (!h[i]&&!((a[i]>>j)&1)) cans+=w[i];
        ans=max(ans,cans);
    }
    return ans;
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i]>>w[i];
    cout<<solve();
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
    ll A, B, C;
    ll na, nb, nc;
    ll ans = 0;

    cin >> A >> B >> C;

    if (A == B && B == C && A % 2 == 0) {
        cout << -1 << endl; 
    } else {
        while (1) {
            if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
                break;
            }
            ans++;
            na = (B+C)/2;
            nb = (A+C)/2;
            nc = (A+B)/2;
            A = nb+nc;
            B = na+nc;
            C = na+nb;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
char a[101];
int b,i,j;
while(scanf("%s",a)!=EOF){
for(j=0;;j++){
if(a[j]=='\0'){
printf("\n");
break;
}
else if(a[j]=='@'){
j++;
b=a[j]-'0';
j++;
for(i=0;i<b;i++){
printf("%c",a[j]);
}
}
else{
printf("%c",a[j]);
}
}
scanf("\n");
}
return 0;
}



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

#define endl "\n"
typedef unsigned long long uLL;
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
typedef pair <long long,long long> pll;
typedef pair <long long,pll> plll;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;

int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( nullptr );
        int a , b;
        cin >> a >> b;
        cout << setprecision(10) << fixed << 1.0*a/b <<endl;
        return 0;
}













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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void Main()
{
	int n; cin>>n;

	FOR(i,1,10){
		FOR(j,1,10){
			if(n == i*j){
				cout << "Yes" << endl;
				return;
			}
		}
	}
	cout << "No" << endl;

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
 
double average(int n) {
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += i;
  }
  return (double) sum / (double) n;
}
 
int main() {
  int n, k;
  cin >> n >> k;
  double* array = new double[n];
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    array[i] = average(in);
    //cout << array[i] << endl;
  }
  vector<double> sum(n+1, 0.0);
  for (int i = 0; i < n; i++) {
    sum[i+1]=sum[i]+array[i];
  }
  vector<double> v(n-k+1);
  for (int j = 0; j < n-k+1; j++) {
    v[j] = sum[j+k]-sum[j];
  }
  double it = *max_element(v.begin(), v.end());
  cout << fixed << setprecision(10) << it << endl;
  delete[] array;
  return 0;
}

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

int main() {
  int n,a,b,ans=0;
  cin>>n>>a>>b;
  for(int i=1; i<=n; i++){
    string m;
    m=to_string(i);
    int nd=0;
    rep(i,m.size()){
      nd+=m[i]-48;
    }
    if(a<=nd&&nd<=b){
      ans+=i;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a<b) {
            if(b<c) {
                System.out.printf("%d %d %d\n", a, b, c);
            }
            else if(a<c) {
                System.out.printf("%d %d %d\n", a, c, b);
            }
            else {
                System.out.printf("%d %d %d\n", c, a, b);
            }
        }
        else {
            if(a<c) {
                System.out.printf("%d %d %d\n", b, a, c);
            }
            else if(b<c) {
                System.out.printf("%d %d %d\n", b, c, a);
            }
            else {
                System.out.printf("%d %d %d\n", c, b, a);
            }
        }
        sc.close();
    }
}


Measured memory_bytes: 26208
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int len;
	cin>>s;
	len=s.length();
	for(int i=0;i<len;i++)
	if(s[i]-'0'==9){cout<<"Yes"<<endl;return 0;}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll x;
	cin >> x;
	ll cur = 100;
	for (int i = 1 ; i <= 3760 ; i++)
	{
		cur += (cur / 100);
		if (cur >= x)
		{
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3648
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();

   

    LL t,n,i,j,k,x,y,c,m;
    cout << fixed << setprecision(6);
    cin >> n;
    vector<LD> a(n);
    gall(a, n);
    sort(all(a));
    LD ans = (a[0] + a[1]) / 2;
    rep(i, 2, n, 1){
        ans = (a[i] + ans) / 2;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}



int main(void) {
  ll N;
  cin >> N;
  ll h[MAX];
  ll i;
  
  for(i=0; i<N; i++) {
    cin >> h[i];
  }
  
  ll t=0;
  for(i=0; i<N; i++) {
    if(h[i]-t<-1) {
      pt("No");
      return 0;
    }
    
    chmax(t, h[i]);
  }
  
  pt("Yes");
}











Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

string s;

int main() {
    cin >> s;
    string ans = "";

    if (s == "Sunny") ans = "Cloudy";
    else if (s == "Cloudy") ans = "Rainy";
    else ans = "Sunny";
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <string>
#include<string.h>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",2*b-a);
	return 0;
}


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

int main()
{
	string s;
	cin >> s;
	int val = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') val += 100;
	}
	cout << val << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,time=0;
  cin>>n;
  int a[n],b[n];
  vector<pair<int,int>> work(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    work[i]=make_pair(b[i],a[i]);
  }
  sort(work.begin(),work.end());
  for (int i =0; i < n; i++) {
		time += work[i].second;
		if (time <= work[i].first);
		else { cout << "No"<<endl;
              exit(0);
	}
  }
	cout << "Yes"<<endl;
  }

Measured memory_bytes: 3328
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		String t = in.nextLine();
		
		for(int i=0;i<t.length();i++){
			System.out.print(t.charAt(i));
			if(i==3)
				System.out.print(" ");
		}
		System.out.println();
	}

}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
 
int main() {
vector<int> vec(9);
    for (int i = 0; i < 9; i++) {
    cin >> vec.at(i);
  }
  int a;
  cin >> a;
  vector<int> bin(a);
   for (int i = 0; i < a; i++) {
    cin >> bin.at(i);
  }
    for (int i = 0; i < a; i++)
    {
    for (int j = 0; j < 9; j++)
    {
      if(bin.at(i) == vec.at(j))
      {vec.at(j) *= 500;}
    }
    }
  if((vec.at(0)+vec.at(1)+vec.at(2)) % 500 == 0)
  {cout << "Yes" << endl;}
   else if  ((vec.at(3)+vec.at(4)+vec.at(5)) % 500 == 0)
  {cout << "Yes" << endl;}
   else if((vec.at(6)+vec.at(7)+vec.at(8)) % 500 == 0)
  {cout << "Yes" << endl;}
  else if((vec.at(0)+vec.at(3)+vec.at(6)) % 500 == 0)
  {cout << "Yes" << endl;}
  else if((vec.at(1)+vec.at(4)+vec.at(7)) % 500 == 0)
  {cout << "Yes" << endl;}
  else if((vec.at(2)+vec.at(5)+vec.at(8)) % 500 == 0)
  {cout << "Yes" << endl;}
  else if((vec.at(0)+vec.at(4)+vec.at(8)) % 500 == 0)
  {cout << "Yes" << endl;}
  else if((vec.at(2)+vec.at(4)+vec.at(6)) % 500 == 0)
  {cout << "Yes" << endl;}
  else{cout << "No" << 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 n;
  cin >> n;
  int L[n];
  rep(i, n) cin >> L[i];
  sort(L, L+n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i+1; j < n; ++j) {
      int l, r;
      l = distance(L, upper_bound(L, L+n, L[j]-L[i]) );
      l = max(l, j+1);
      r = distance(L, lower_bound(L, L+n, L[j]+L[i]) );
      if (r > l) ans += (r-l);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @h = gets.to_i
  end

  def solve
    ans = 0
    cnt = 0
    while h > 0
      ans += 2 ** cnt
      @h /= 2
      cnt += 1
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

Measured memory_bytes: 14292
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)

int main(){
  int s,w;
  cin >> s >> w;
  if(w >= s)cout << "unsafe";
  else cout << "safe";
  return 0;
}


Measured memory_bytes: 3592