akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
const int N = 1e5 + 5, M = 1005;
int n, a[M][M], prime[N], vis[N], tot;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
void init(int n)
{
	for(int i = 2; i <= n; i ++)
	{
		if(!vis[i]) prime[++ tot] = i;
		for(int j = 1; j <= tot && i * prime[j] <= n; j ++)
		{
			vis[i * prime[j]] = 1;
			if(i % prime[j] == 0) break;
		}
	}
}
int gcd(int a, int b) {return !b ? a : gcd(b, a % b);}
int lcm(int a, int b)
{
	if(!a || !b) return a + b;
	return a / gcd(a, b) * b;
}
signed main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	init(10000); n = read();
	if(n == 2) {puts("4 7\n23 10\n"); return 0;}
	for(int i = 1; i <= n; i ++)
		for(int j = ((i + 1) & 1) + 1; j <= n; j += 2)
			a[i][j] = prime[(i + j) / 2] * prime[n + (i - j) / 2 + (n + 1) / 2];
	for(int i = 1; i <= n; i ++)
		for(int j = (i & 1) + 1; j <= n; j += 2)
			a[i][j] = lcm(lcm(a[i - 1][j], a[i][j - 1]), lcm(a[i + 1][j], a[i][j + 1])) + 1;
	for(int i = 1; i <= n; i ++, printf("\n"))
		for(int j = 1; j <= n; j ++, printf(" "))
			printf("%lld", a[i][j]);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define li long int
#define p pair<long int,long int>
using namespace std;
bool comparator(p A,p B){
	if(A.second==B.second){
		return A.first<B.first;
	}
	return A.second<B.second;
}
int main(){
	int n;
	cin>>n;
	vector<p>arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i].first>>arr[i].second;
	}
	sort(arr.begin(),arr.end(),comparator);
	li time=0;
	for(int i=0;i<n;i++){
		time+=arr[i].first;
		if(time>arr[i].second){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    string ans;
    for (int i = 0; i < s.size(); i++)
    {
        if (i % 2 == 0)
        {
            ans += s[i];
        }
    }
    
    cout << ans << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

vector<int> prime;
vector<bool> used;

int main() {
	used.resize(1000001, false);
	used[0] = used[1] = true;
	prime.push_back(-INF);
	for (int i = 2; i * i <= 1000001; i++) {
		if (!used[i]) {
			prime.push_back(i);
			for (int j = i; j <= 1000001; j += i) used[j] = true;
		}
	}
	REP(i, 1000001) if (!used[i]) prime.push_back(i);
	
	int n;
	while (cin >> n, n) {
		long long ans = 0;
		REP(i, n) {
			int p, m;
			scanf("%d %d", &p, &m);
			vector<int>::iterator it1 = upper_bound(prime.begin(), prime.end(), p + m) - 1;
			vector<int>::iterator it2 = upper_bound(prime.begin(), prime.end(), p - m) - 1;
			int cnt;
			
			if (*it1 < p - m) {
				if (*(it1 + 1) > p + m) it1 = prime.end();
				else it1++;
			}
			if (*it2 < p - m) {
				if (*(it2 + 1) > p + m) it2 = prime.end();
				else it2++;
			}
			
			if (it1 == prime.end() || it2 == prime.end())
				cnt = 2 - (it1 == prime.end()) - (it2 == prime.end()); 
			else
				cnt = it1 - it2 + 1;
			
			if (cnt == 0) ans--;
			else ans += cnt - 1;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1712
#include<stdio.h>

int main(){
  char a[8][8];
  int i,j;
  char c;

  //input
  for(i=0;i<8;i++){
    for(j=0;j<8;j++)
      a[i][j]=getchar();
    c=getchar();
  }
  
  //90
  puts("90");
  for(j=0;j<8;j++){
    for(i=7;i>=0;i--)
      printf("%c",a[i][j]);
    puts("");
  }
  
  //180
  puts("180");
  for(i=7;i>=0;i--){
    for(j=7;j>=0;j--)
      printf("%c",a[i][j]);
    puts("");
  }
  
  //270
  puts("270");
  for(j=7;j>=0;j--){
    for(i=0;i<8;i++)
      printf("%c",a[i][j]);
    puts("");
  }
  
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   #define PP pair<int,pair<int,int>>
const int MAX = 1000001;
const int MOD =1000000007;
const int INV2 = (MOD+1)/2;



     signed main(){
  string s;
  cin>>s;
  int dp[s.size()+1][3][3],ans[s.size()+1]={};
  for(int j=0;j<3;j++)for(int k=0;k<3;k++)dp[0][j][k]=0;
  dp[0][2][0]=1;
  for(int i=1;i<=s.size();i++){
      for(int j=0;j<3;j++)for(int k=0;k<3;k++)dp[i][j][k]=0;
      if(s[i-1]=='0'||s[i-1]=='?'){
        for(int j=0;j<3;j++){
          dp[i][j][1]=(dp[i-1][j][0]+dp[i-1][j][2])%MOD;
          dp[i][j][2]=dp[i-1][j][1];
          
        }
        ans[i]=ans[i-1];
      }
      if(s[i-1]=='1'||s[i-1]=='?'){
        for(int j=0;j<3;j++){
          dp[i][j][0]=(dp[i][j][0]+dp[i-1][j][1])%MOD;
          dp[i][j][1]=(dp[i][j][1]+dp[i-1][j][2])%MOD;
        }
        dp[i][1][0]=(dp[i][1][0]+dp[i-1][2][0])%MOD;
        dp[i][0][0]=(dp[i][0][0]+dp[i-1][1][0])%MOD;
        ans[i]=(ans[i]+ans[i-1]+dp[i-1][0][0])%MOD;
      }
  }
  for(int j=0;j<3;j++)for(int k=0;k+j<2;k++)ans[s.size()]=(ans[s.size()]+dp[s.size()][j][k])%MOD;
  cout<<ans[s.size()]<<endl;



}


        


Measured memory_bytes: 24068
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
lenL = len(L)
ans = 0
for i in range(lenL-2):
    for j in range(i+1, lenL-1):
        a = L[i]
        b = L[j]
        ind = bisect.bisect_left(L[j+1:], a+b)
        ans += ind
print(ans)



Measured memory_bytes: 51592
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

class TOPO{//out is tsort's return.
	public:
	vvi G;
	vi out;
	vector<bool>V;
	vi indeg;
	int n;
	TOPO(int size){
		n=size;
		G=vvi(n);
		out=vi(0);
		V=vector<bool>(n);
		indeg=vi(n);
	}
	void add_edge(int s,int t){
		G[s].pb(t);
	}
	void bfs(int s){
		queue<int>q;
		q.push(s);
		V[s]=true;
		while(!q.empty()){
			int u=q.front();q.pop();
			out.pb(u);
			rep(i,G[u].size()){
				int v=G[u][i];
				indeg[v]--;
				if(indeg[v]==0&&!V[v]){
					V[v]=true;
					q.push(v);
				}
			}
		}
	}
	void tsort(){
		rep(i,n)indeg[i]=0;
		rep(i,n)rep(j,G[i].size()){
			int v=G[i][j];
			indeg[v]++;
		}
		rep(i,n)if(indeg[i]==0&&!V[i])bfs(i);
//		rep(i,n)cout<<out[i]<<endl;
	}
};
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,m;
	cin>>n>>m;
	vvi G(n);
	TOPO tp(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
		tp.add_edge(a,b);
	}
	tp.tsort();
	int out=0;
	vi co(n);
	rep(i,n){
		int t=tp.out[i];
		rep(j,G[t].size())cmax(co[G[t][j]],co[t]+1);
		cmax(out,co[t]);
	}
	cout<<out<<endl;
}






Measured memory_bytes: 13688
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, vector<vector<T>> &v)
{
	for (vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, vector<T> &v)
{
	for (T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int n;
	cin >> n;
	string s;
	cin >> s;
	map<int, int> m{{'R',0}, {'G', 1}, {'B', 2}};
	vl cnt(3);
	for(auto x : s)
		cnt[m[x]]++;
	ll ans = cnt[0] * cnt[1] * cnt[2];
	rep(i,0,n)
		rep(j,i+1, n)
		{
			if(s[i] != s[j] and j + j - i < n and s[j + j - i] != s[i] and s[j + j - i] != s[j])
				ans --;
		}
	cout << ans;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include <math.h>
#include <cmath>

using namespace std;

int main(){
    int n;
    double x[100]={0},y[100]={0},p1=0,p2=0,p3=0,p4=-1;
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        scanf("%lf",&x[i]);
    }
    for(int i=0; i<n; i++){
        scanf("%lf",&y[i]);
    }
    for(int i=0; i<n; i++){
        p1+=abs(x[i]-y[i]);
        p2+=(x[i]-y[i])*(x[i]-y[i]);
        p3+=abs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
        p4=(p4 >= abs(x[i] - y[i]))? p4:abs(x[i] - y[i]);
    }
    printf("%.6lf\n",p1);
    printf("%.6lf\n",sqrt(p2));
    printf("%.6lf\n",cbrt(p3));
    printf("%.6lf\n",p4);
    
}





Measured memory_bytes: 2920
#include <iostream>
#include <algorithm>
#include <cassert>
#include <string>
#include <sstream>
using namespace std;

int S;

inline string toString(int n) {
	stringstream ss;
	ss << n;
	return ss.str();
}

void solve(int k, int m, string d) {
	if(k == 0) {
		cout << d << endl;
		return;
	}
	for(int i = min(k, m); i > 0; i--) {
		if(d == "") {
			solve(k - i, i, toString(i));
		} else {
			solve(k - i, i, d + " " + toString(i));
		}
	}
}

int main() {
	for(int N; cin >> N, N;) {
		solve(N, N, "");
	}
	return 0;
}

Measured memory_bytes: 948
N,M=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(M)]
ab.sort(key=lambda x:x[1])
now=0
ans=0
for i in range(M):
    if now<=ab[i][0]:
        now=ab[i][1]
        ans+=1
print(ans)

Measured memory_bytes: 29084
def main(argv)
  (n, l) = gets.chomp.split(' ').map(&:to_i)
  
  s = 0
  m = 1e+10.to_i
  k = -1
  (1..n).each do |i|
    d = l + i - 1
    if d.abs < m then
      m = d.abs
      k = i
    end
    s += d
  end
  
  puts (s - (l + k - 1)).to_i
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
import std.stdio, std.conv, std.string, std.array, std.algorithm;

void main()
{
    auto ab = readln.chomp.split(" ").map!(to!int);
    auto a = ab[0];
    auto b = ab[1];
    auto ret = a + b;

    while (ret > 23) ret -= 24;

    writeln(ret);
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	map<int, int> mp;
	REP(i, n){
		int t;
		cin >> t;
		mp[t]++;
	}
	int ans = 0;
	for(const auto &i : mp){
		ans++;
	}
	cout << ans << "\n";
	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;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<vector<int>> x(n),y(n);
    rep(i,n) {
        cin >> a[i];
        x[i] = vector<int>(a[i]);
        y[i] = vector<int>(a[i]);
        rep(j, a[i]) {
            cin >> x[i][j];
            cin >> y[i][j];
            x[i][j]--;
        }
    }
    int max_honest=0;
    rep(bits,1<<n){
        bool ok_flag = true;
        rep(i, n) {
            if((bits & (1<<i)) == false) continue;
            rep(j, a[i]) {
                if((bool)y[i][j] != (bool)(bits&(1<<x[i][j]))) {
                    ok_flag = false;
                    //cout << i << y[i][j] << x[i][j] << " " << bitset<8>(bits)<<endl;
                }
            }
        }
        if(ok_flag) {chmax(max_honest, __builtin_popcount(bits));}
    }
    cout << max_honest << endl;
}

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

int main() {
    int N;
    scanf("%d", &N);
    int *H = malloc((1+N) * sizeof(int));
    for (int i = 1; i <= N; i++) {
        scanf("%d", &H[i]);
    }

    int max = 0;
    int prev_height = H[1];
    int move_num = 0;
    for (int i = 2; i <= N; i++) {
        if (prev_height >= H[i]) {
            move_num += 1;
        } else  {
            if (move_num > max)
                max = move_num;
            move_num = 0;
        }
        prev_height = H[i];
    }
    if (move_num > max)
        max = move_num;
    printf("%d\n", max);

    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a < b){
		printf("a < b\n");
	}else if(a > b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}

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

int main(){
	int N;
	cin >> N;
	
	map<string, set< pair<int, int>, greater<pair<int,int>>>> U;

	for (int i = 1; i <= N; i++)
	{
		string s;
		int p;
		cin >> s >> p;
		U[s].insert(make_pair(p, i));
	}

	for (auto it = U.begin(); it != U.end(); it++)
	{
		string s = (*it).first;
		auto ps = (*it).second;
		for (auto psit = ps.begin(); psit != ps.end(); psit++)
		{
			int p = (*psit).first;
			int i = (*psit).second;
			cout << i << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[1001];
  fgets(s,1000,stdin);
  int i;
  for(i=0;s[i]!='\0';i++){
    if(s[i]=='p'){
      if(s[i+1]=='e'&&s[i+2]=='a'&&s[i+3]=='c'&&s[i+4]=='h'){
	s[i++]='a';
	s[i++]='p';
	s[i++]='p';
	s[i++]='l';
	s[i++]='e';
      }
    }
    else if(s[i]=='a'){
      if(s[i+1]=='p'&&s[i+2]=='p'&&s[i+3]=='l'&&s[i+4]=='e'){
	s[i++]='p';
	s[i++]='e';
	s[i++]='a';
	s[i++]='c';
	s[i++]='h';
      }
    }
  }
  printf("%s",s);
  return 0;
}	

Measured memory_bytes: 524
// template version 1.11
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,x;cin>>n>>x;
  vector<int> b(n, 0);
  vector<int> l(n, 0);
  vector<int> r(n, 0);

  int minimum = 0;
  rep(i, n){
    cin>>b[i]>>l[i]>>r[i];
    minimum += b[i]*l[i];
  }

  vi scores(n,0);
  rep(i, n){
    int score=0;
    score += x*r[i];
    score -= b[i]*(r[i]-l[i]);
    scores[i] = score;
  }
  vi ord(n);
  iota(all(ord), 0);
  sort(all(ord), [&](auto &left, auto &right){
      return scores[left]>scores[right];
      }
      );

  int left = -1;
  int right =  x*n;
  auto isright = [&](int k) {
    int vk = k;
    int myscore = 0;
    int now = 0;
    while(vk>=x and now<n){
      myscore += scores[ord[now]];
      vk -= x;
      now++;
    }

    int remMax = 0;
    rep(i, n){
      int score=0;
      if (i>=now){
        chmax(remMax, vk*l[ord[i]]);
        score += vk*r[ord[i]];
        score -= b[ord[i]]*(r[ord[i]]-l[ord[i]]);
        chmax(remMax, score);
      }
      else{
        score -= scores[ord[i]];
        score += max(vk*l[ord[i]], vk*r[ord[i]]-(b[ord[i]]*(r[ord[i]]-l[ord[i]])));
        chmax(remMax, scores[ord[now]]+score);
      }
    }
    myscore += remMax;

    if (myscore>=minimum) return true;
    else return false;
  };
  while (right-left>1){
    int mid = (right+left)/2;
    if (isright(mid)) { right = mid;}
    else{ left = mid; }
  }

  cout << right << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int n;
  cin >> n;
  vector<ll> a(3*n);
  for(int i=0; i<3*n; ++i) cin >> a[i];
  sort(a.rbegin(), a.rend());

  ll ans = 0;
  for(int i=1; i<n*2; i+=2){
    ans += a[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 5608
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main() {
    int n;
    string s;
    set<string> gifts;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> s;
        gifts.insert(s);
    }
    
    cout << gifts.size() << endl;
    
    return 0;
}


Measured memory_bytes: 19080
#include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;

TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
int insertionSort(TList& A, int g)
{
    int cnt = 0;
    for(int i = g; i < A.size(); ++i){
        TInt v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
    return cnt;
}
void Reverse(TList& List)
{
    TList R;
    for(TList::reverse_iterator It = List.rbegin();
        It != List.rend();
        ++It)
    {
        R.push_back(*It);
    }
    std::swap(R, List);
}
TList GetG(int Max)
{
    TList G;
    int h = 1;
    while(h <= Max){
        G.push_back(h);
        h = 3 * h + 1;
    }
    // Reverse(G);
    std::reverse(G.begin(), G.end());
    return G;
}
int shellSort(TList& A, const TList& G)
{
    int cnt = 0;
    for(TList::const_iterator It = G.begin();
        It != G.end();
        ++It){
        cnt += insertionSort(A, *It);
    }
    return cnt;
}
void OutputLine(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << " " << *It;
    }
    std::cout << std::endl;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    // std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << *It << std::endl;
    }
}
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    TList A = Input();
    TList G = GetG(A.size());
    int cnt = shellSort(A, G);
    std::cout << G.size() << std::endl;
    OutputLine(G);
    std::cout << cnt << std::endl;
    Output(A);
    return 0;   
}

Measured memory_bytes: 6752
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
void deb(){
    cout<<"a";
    exit(0);
}
int main(){
    ll n,d;
    cin>>n>>d;
    d*=d;
    ll ans=0,x,y;
    rep(i,0,n){
        cin>>x>>y;
        if(x*x+y*y<=d)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3620
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String args[]) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		
		for (int i=0; i<n; i++) {

			for (int j=0; j<i; j++) {
				if (list.get(i) <= list.get(j)) {
					Collections.swap(list, i, j);
				}
			}

			for (int j=0; j<n; j++) {
				System.out.print((j==0?"":" ")+list.get(j));
			}
			System.out.println();
			
		}
		
	}
}


Measured memory_bytes: 31780
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner date = new Scanner(System.in);

		String str = date.next();
		
		StringBuffer result = new StringBuffer(str);
		
		System.out.println(result.reverse());
		
	
	}

}

Measured memory_bytes: 17112
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    int ng=0;
    rep(i,n){
        if(a[i]%2==0){
            if(a[i]%3==0||a[i]%5==0){

            }
            else{
                ng++;
            }
        }
    }

    if(ng==0){
        cout<<"APPROVED"<<endl;
    }
    else{
        cout<<"DENIED"<<endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "random"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))

const int N=1000010,
          M=1000000007,
          T=1000000;

int n,m,ret;
int h[N],g[N];

int pw(int a,int i){
    int b=1;
    for(;i;i>>=1,a=a*a%M) if(i&1) b=b*a%M;
    return b;
}

int C(int n,int k){
    if(n<k) return 0;
    return g[n]*h[k]%M*h[n-k]%M;
}

main(){
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);

    g[0]=1;
    forinc(i,1,T) g[i]=g[i-1]*i%M;
    h[T]=pw(g[T],M-2);
    fordec(i,T-1,0) h[i]=h[i+1]*(i+1)%M;

    m=in,n=in;
    forinc(i,0,m) if((m-i)%2==0){
        int j=n-i*2;
        if(j*2+i!=m) continue;
        int t=i+j;
        ret=(ret+C(t,i))%M;
    }
    cout<<ret;
}



Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
long long dp[62][2][2], mod = 1e9 + 7;
long long n;
long long solve(int idx, int carry, int flag){
    long long &ans = dp[idx][carry][flag];
    if(ans != -1){
        return ans;
    }
    if(idx == 60){
        return ans = (carry == 0 && flag == 0);
    }
    int bit = (n >> idx) & 1;
    ans = 0;
    for(int a = 0; a <= 1; a++){
        for(int b = 0; b <= a; b++){
            int curbit = (a + b + carry) % 2;
            int curcarry = (a + b + carry) / 2;
            int curflag = flag;
            if(curbit > bit){
                curflag = 1;
            }
            if(curbit < bit){
                curflag = 0;
            }
            ans = (ans + solve(idx + 1, curcarry ,curflag)) % mod;
        }
    }
    return ans;
}
int main(){
    cin >> n;
    memset(dp, -1, sizeof(dp));
    cout << solve(0, 0, 0);
    return 0;
}

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

int main() {
    int n, m, s=0;
    cin >> n;
    m=n;
    while(m>0){
        s+=m%10;
        m/=10;
    }
    cout << (n%s?"No":"Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll a,b,x;
    cin>>a>>b>>x;
    if(a*a*b/2<=x){
        printf("%.6lf",atan((double)2*(a*a*b-x)/(a*a*a))*180/M_PI);
    }else{
        printf("%.6lf",atan((double)a*b*b/(2*x))*180/M_PI);
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#define eps 1e-9
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int n,m,X[110],Y[110],C[110];
inline double pf(double x){return x*x;}
inline bool pd(double x,double y,double limit)
{
	int ans=n;
	for(int i=1;i<=n;i++)if(sqrt(pf(X[i]-x)+pf(Y[i]-y))*C[i]-limit>eps)ans--;
	if(ans>=m)return true;
	else return false;
}
inline bool check(double limit)
{
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			double r1=limit/C[i],r2=limit/C[j],dis=sqrt(pf(X[i]-X[j])+pf(Y[i]-Y[j]));
			int p1=i,p2=j;
			if(r1<r2)swap(r1,r2),swap(p1,p2);
			if(r1-dis-r2>eps)
			{
				if(pd(X[p2],Y[p2],limit)==true)return true;
			}
			else if(r1+r2-dis>eps)
			{
				double uf=(pf(r1)-pf(r2)+pf(dis))/(2.0*dis),x0=X[p1]+uf/dis*(X[p2]-X[p1]),y0=Y[p1]+uf/dis*(Y[p2]-Y[p1]);
				double ul=sqrt(pf(r1)-pf(uf));
				if(pd(x0-ul/dis*(Y[p2]-Y[p1]),y0+ul/dis*(X[p2]-X[p1]),limit)==true)return true;
				if(pd(x0+ul/dis*(Y[p2]-Y[p1]),y0-ul/dis*(X[p2]-X[p1]),limit)==true)return true;
			}
		}
	}return false;
}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    n=read(),m=read();
    for(int i=1;i<=n;i++)X[i]=read(),Y[i]=read(),C[i]=read();
    if(m==1){puts("0");return 0;}
    double l=0,r=300000,ans;
	while(r-l>eps)
	{
		double mid=(l+r)/2.0;
		if(check(mid)==true)ans=mid,r=mid;
		else l=mid;
	}printf("%.7lf\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int N = 9;

vector<unsigned int> num;

int main(void){
    int S; cin >> S;
    while(S--){
        num = vector<unsigned int>(N);
        rep(i, N) cin >> hex >> num[i];

        unsigned int k = 0;


        rep(i, 32){
            unsigned int sum = 0;
            rep(j, N - 1){
                sum += num[j] ^ k;
            }

            if((sum & (1 << i)) != (num[N - 1] & (1 << i))){
                k |= (1 << i);
            }
        }

        cout << hex << k << endl;
    }

	return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N, D, X;
  cin >> N >> D >> X;
  vll A(N);
  REP(i, 0, N) {
    ll a;
    cin >> a;
    A[i] = a;
  }

  ll ans = X;
  REP(i, 0, N) {
    ll days = (D-1) / A[i];
    ans += days + 1;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx
print("{} {} {} {}".format(x3, y3, x4, y4))

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

int main() {
  // ここにプログラムを追記
  int n, a, x;
  cin >> n >> a;
  x = n % 500;
  if(x <= a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long memo[100];

long long getRyuka(int N){
  if(N >= 2){
    if(memo[N] != -1) return memo[N];
    memo[N] = getRyuka(N-1) + getRyuka(N-2);
    return memo[N];
  } else if(N == 1){
    return 1;
  }
  return 2;
}

int main() {
    int N;

    scanf("%d", &N);

    for(int i=0; i<=N; i++){
      memo[i] = -1;
    }

    printf("%llu\n", getRyuka(N));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int w,h;
    cin>>h>>w;
    vector<vector<char> > V(h+1,vector<char> (w+1)), a(2*h+1,vector<char> (w+1));

    for(int i = 1; i <= h; i++)  for(int j = 1; j <= w; j++)  cin>>V[i][j];

    for(int i = 1; i <= 2*h; i++) for(int j = 1; j <= w; j++) a[i][j] = V[(i+1)/2][j];

    for(int i = 1; i <= 2*h; i++)
    {
        for(int j = 1; j <= w; j++)
            cout<<a[i][j];
        cout<<"\n";
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int T[11], num, state = 0;
    while(scanf("%d", &num) != EOF){
        if(num){
            T[state] = num;
            state++;
        }else{
            state--;
            printf("%d\n", T[state]);
        }
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	int h, w, a, b;
	h = 1;
	w = 1;

	cin >> h >> w >> a >> b;

	for (int i = 0; i < b; i++) {
		for (int j = 0; j < a; j++) {
			cout << 1;
		}
		for (int j = 0; j < w - a; j++) {
			cout << 0;
		}
		cout << endl;
	}
	for (int i = 0; i < h - b; i++) {
		for (int j = 0; j < a; j++) {
			cout << 0;
		}
		for (int j = 0; j < w - a; j++) {
			cout << 1;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define d long double
#define pii pair<int,int>
#define pb push_back
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 2003
#define inf 1e18
#define Arena ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//int mod=1e9+7;
//int mod=998244353;

signed main()
{
    Arena
        
    int n;
    cin>>n;
    int i,j,x;
    multiset<int> s;
    for(i=1;i<=n;++i)
        cin>>x,s.insert(x);
    
    auto it2=s.end();
    auto it=s.begin();
    
    vector<pii> ans;
    while(s.size()>1)
    {
        it=s.begin(), it2=s.end();
        --it2;
        if(s.size()==2)
        {
            ans.pb({*it2,*it});
            cout<<*it2-*it<<'\n';
            break;
        }
        
        auto it1=it2;
        auto it3=it;
        if(*it >= 0)
        {
            --it1;
            ans.pb({*it,*it1});
            s.insert(*it - *it1);
            s.erase(it);
            s.erase(it1);
        }   
        
        else
        {
            --it1;
            if(*it1<0)
            {
                ans.pb({*it2,*it1});
                s.insert(*it2 - *it1);
                s.erase(it2), s.erase(it1);
            }   
            else
            {
                ans.pb({*it,*it1});
                s.insert(*it - *it1);
                s.erase(it), s.erase(it1); 
            }       
        }    
    }   
    
    for(auto it:ans)
        cout<<it.first<<' '<<it.second<<'\n';
    
    
    
    
    return 0;
}


Measured memory_bytes: 8184
n, x, m = map(int, input().split())
li = [x]
seen = [False]*m
seen[x] = True
for i in range(n-1):
    x = x*x%m
    if seen[x]:
        idx = li.index(x)
        break
    seen[x] = True
    li.append(x)
else:
    print(sum(li))
    exit(0)
ans = sum(li) + sum(li[idx:])*((n-len(li)) // (len(li)-idx)) + sum(li[idx:idx+(n-len(li)) % (len(li)-idx)])
print(ans)

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll h;
    cin>>h;
    if(h==1)
        cout<<1<<'\n';
    else{
        ll ans = 0,i=0;
        while(ans<h)
        {
            ans+=pow(2,i++);
        }
        cout<<ans<<'\n';
    }
    
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
char s[10];
scanf("%s",&s);
if(strcmp(s,"Sunny")==0){ printf("Cloudy\n");}
else if(strcmp(s,"Cloudy")==0){ printf("Rainy\n");}
else if(strcmp(s,"Rainy")==0){ printf("Sunny\n");}
return 0;
}

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

string str1, str2;
int cnt;

void solve() {
    cin >> str1 >> str2;
    cnt = 0;
    for (int i=0; i<str1.length(); ++i) {
        if (str1[i] != str2[i]) {
            ++cnt;
        }
    }
    cout << cnt << endl;
}

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

Measured memory_bytes: 3892
// abc149_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../1_02.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll idx=N;
    REP(i, N) if (A[i] > 0) { idx = i; break;}
    A.insert(A.begin()+idx, 0);

    ll ans = INF;
    REP(n, K+1){
        if (idx+n < 0 || idx+n >= N+1 || idx-(K-n) < 0 || idx-(K-n) >= N+1) continue;
        ans = min(ans, A[idx+n] - 2 * A[idx-(K-n)]);
        ans = min(ans, 2 * A[idx+n] - A[idx-(K-n)]);
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
    #include<string.h>
    int main(void) {
      int a,b,c,d,i,j;
      scanf("%d %d",&a,&b);
      if(a>b){
          c+=a;
          a--;
      }else{
          c+=b;
          b--;
      }

      if(a>b){
          c+=a;
          a--;
      }else{
          c+=b;
          b--;
      }
      printf("%d",c);
      
      return 0;
    }

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int main(void){
	int alp[50][26] = {{0}}, common[26] = {0};
	int n;
	cin>>n;

	/*for(int i=0;i<26;i++) {
		for(int j=0;j<n;j++) {
			cout<< alp[i][j];
		} cout<<endl;
	}*/
	string alphabet = "zyxwvutsrqponmlkjihgfedcba";
	for(int i=0;i<n;i++) {
		string S;
		cin>>S;

		for(int j=0;j<S.size();j++) {
			alp[i]['z' - S[j]]++;
		}
	}

	/*for(int i=0;i<n;i++) {
		for(int j=0;j<26;j++) {
			cout<<alp[i][j];
		} cout<<endl;
	}*/

	for(int i=0;i<26;i++) {
		int tmp = INF;
		for(int j=0;j<n;j++) {
			tmp = min(tmp, alp[j][i]);
		}
		common[i] = tmp;
	}

	//for(int i=0;i<26;i++) cout<<common[i]<<endl;

	string ans;
	for(int i=25;i>=0;i--) {
		for(int j=0;j<common[i];j++) {
			ans += alphabet[i];
		}
	}
	//cout<<endl;

	cout<< ans <<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    int res=0;
    rep(i,n){
        while(a[i]%2==0){
            a[i]/=2;
            res++;
        }
    }
    cout<<res<<endl;

    
}

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

int main(void){
    int N,A[110];
    int imin = 1000000001,imax = 0;

    cin >> N;

    rep(i,N)
        cin >> A[i];

    rep(i,N){
        imax = max(imax,A[i]);
        imin = min(imin,A[i]);
    }

    cout << imax-imin << endl;

    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = a;i <= b; i++) {
        if (i - a + 1 <= k || b - i + 1 <= k) cout << i << " ";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
int a[N], cnt1[N], cnt2[N];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", a + i);
    for (int i = 0; i < n; i += 2)
        cnt1[a[i]]++;
    for (int i = 1; i < n; i += 2)
        cnt2[a[i]]++;
    vector<pair<int, int>> v1(n), v2(n);
    v1.push_back({0, 0}), v2.push_back({0, 0});
    for (int i = 0; i < N; i++)
        if (cnt1[i])
            v1.push_back({cnt1[i], i});
    for (int i = 0; i < N; i++)
        if (cnt2[i])
            v2.push_back({cnt2[i], i});
    sort(v1.begin(), v1.end(), greater<pair<int, int>>());
    sort(v2.begin(), v2.end(), greater<pair<int, int>>());
    if (v1[0].second != v2[0].second)
        printf("%d", n - v1[0].first - v2[0].first);
    else
        printf("%d", min(n - v1[0].first - v2[1].first, n - v1[1].first - v2[0].first));
    return 0;
}


Measured memory_bytes: 3824
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int P[100001];
long long A[100001],B[100001],C[100001];
int D[100001];

int main() {
	int N,M;
	long long R=0;
	cin>>N>>M;
	for(int i=1;i<M+1;i++)cin>>P[i];

	for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];

	for(int i=1;i<M;i++){
		if(P[i]<P[i+1]){
			for(int j=P[i];j<P[i+1];j++)D[j]+=1;
		}else{
			for(int j=P[i+1];j<P[i];j++)D[j]+=1;
		}
	}

	for(int j=1;j<N;j++)R+=min(D[j]*B[j]+C[j],D[j]*A[j]);
	cout<<R<<endl;
	return 0;
}

Measured memory_bytes: 6212
#include<stdio.h>
int main(){
  int x,y,ans,i;
  x=0;

  while (1) {
    y=0;
    if (ans==81) {
      break;
    }
    x=x+1;
    for (i = 0; i <9; i++) {
      y=y+1;
      ans=x*y;
      printf("%dx%d=%d\n",x,y,ans);
    }
  }


  return 0;
}

Measured memory_bytes: 520
#include <iostream>
#include <stdio.h>
#include <utility>
using namespace std;
int main(){
    double px,py;
    double tx[3],ty[3];
    bool flag;
    bool v[3];
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tx[0],&ty[0],&tx[1],&ty[1],&tx[2],&ty[2],&px,&py) == 8){
        for(int i=0;i<3;i++){
            tx[i]=tx[i]-px;
            ty[i]=ty[i]-py;
        }
        for(int i=0;i<3;i++){
            if((tx[i%3]*ty[(i+1)%3])-(ty[i%3]*tx[(i+1)%3])<0){
                v[i]=true;
            }else{
                v[i]=false;
            }
        }
         
        if(v[0]!=v[1]){
            cout<<"NO"<<endl;
        }else if(v[1]!=v[2]){
            cout<<"NO"<<endl;
        }else {
            cout<<"YES"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1232