akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
using mat = vector<vector<int>>;
const int MOD = 1e9 + 7;

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

    int N, D, A;
    cin >> N >> D >> A;
    vector<pii> XH(N);
    for (int i = 0; i < N; ++i)
        cin >> XH[i].first >> XH[i].second;

    sort(XH.begin(), XH.end());

    queue<pll> que;
    ll sum = 0, ans = 0;
    for (int i = 0; i < N; ++i) {
        XH[i].second -= sum;
        if (XH[i].second > 0) {
            ll tmp = (XH[i].second + A - 1) / A;
            que.push(make_pair(tmp, (ll)XH[i].first + 2 * D + 1));
            sum += tmp * A;
            ans += tmp;
        }
        if (i < N - 1) {
            while (!que.empty() && XH[i + 1].first >= que.front().second) {
                sum -= que.front().first * A;
                que.pop();
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define reps(i, a, n) for (int i = (a); i < (n); ++i)
#define rep(i, n) reps(i, 0, n)
#define deps(i, a, n) for (int i = (a); i >= (n); --i)
#define dep(i, n) deps(i, n, 0)
#define inf 2147483647
#define int long long

signed main(void)
{
	int n; cin >> n;
	int max = -1, ans = 0;
	rep (i, n)
	{
		int a; cin >> a;
		if (a > max) max = a;
		else ans += max - a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(void) {
   double l, r, ar, br, cr, dr, al, bl, cl, dl;
   ar = br = cr = dr = al = bl = cl = dl = 0;
   while ( scanf("%lf %lf", &l, &r) != EOF ) {
      /*scanf("%lf %lf", &l, &r);*/
      if ( l >= 1.1 ) al++;
      else if ( l >= 0.6 ) bl++;
      else if ( l >= 0.2 ) cl++;
      else dl++;
      if ( r >= 1.1 ) ar++;
      else if ( r >= 0.6 ) br++;
      else if ( r >= 0.2 ) cr++;
      else dr++;
   }
   printf("%.lf %.lf\n", al, ar);
   printf("%.lf %.lf\n", bl, br);
   printf("%.lf %.lf\n", cl, cr);
   printf("%.lf %.lf\n", dl, dr);
   return 0;
}

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

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

    int a[20];
    int b[20];
    int c[20];
    for (int i = 0; i < n; ++i) 
        cin >> a[i];
    for (int i = 0; i < n; ++i) 
        cin >> b[i];
    for (int i = 0; i < n - 1; ++i) 
        cin >> c[i];

    int score = 0;
    for (int i = 0; i < n - 1; ++i) {
        score += b[a[i] - 1];
        if (a[i + 1] == a[i] + 1) {
            score += c[a[i] - 1];
        }
        // cout << score << endl;
    }
    score += b[a[n - 1] - 1];

    cout << score << endl;
}

#include <string>
void _141() {
    string s;
    cin >> s;
    bool judge = true;
    for (int i = 0; i < s.size(); ++i) {
        if ((i + 1) % 2 == 0 && s[i] == 'R') {
            judge = false;
            break;
        } else if ((i + 1) % 2 == 1 && s[i] == 'L') {
            judge = false;
            break;
        }
    }

    if (judge) 
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _142() {
    int n, k;
    cin >> n >> k;
    int count = 0;
    int h;
    for (int i = 0; i < n; ++i) {
        cin >> h;
        if (h >= k)
            count++;
    }
    cout << count << endl;
}

void _143() {
    int n;
    cin >> n;
    int d[50];
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }

    int value = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
            value += d[i] * d[j];
        }
    }
    cout << value << endl;
}

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

    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout << "No" << endl;
}

void _145() {
    int n;
    string s;
    cin >> n;
    cin >> s;

    if (s.size() %2 ==1) {
        cout << "No" << endl;
        return;
    }

    string first = s.substr(0, s.size() / 2);
    string second = s.substr(s.size() / 2, s.size());
    if (first == second)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _146() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        s[i] = s[i] + n;
        if (s[i] > 90) {
            s[i] = '@' + (s[i] - 90);
        }
    }
    cout << s << endl;
}

void _147() {
    string s;
    cin >> s;

    int middle = (s.size() + 2 - 1) / 2;
    int count = 0;
    for (int i = 0; i < middle; ++i) {
        if (s[i] != s[s.size() - 1 - i])
            count++;
    }
    cout << count << endl;
}

void _148() {
    int n;
    string s, t;
    cin >> n;
    cin >> s >> t;

    string result;
    for (int i = 0; i < n; ++i) {
        result += s[i];
        result += t[i];
    }
    cout << result << endl;
}

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



Measured memory_bytes: 384
from math import log2

N, K = map(int, input().split())
a = list(map(int, input().split()))
sa = sum(a)

if sa == 0:
    print(K * N)
    exit()

b = [0 for _ in range(int(log2(max(sa, K))) + 1)]
# b[2進数の位] = そのbitが立っているAiの数

ls = int(log2(sa))
# print(ls)

for aa in a:
    for i in range(ls + 1):
        # print(aa, aa >> i, i)
        if (aa >> i) & 1 == 1:
            # print('if')
            b[i] += 1
# print(b)

x = []
if K > 0:
    for i in range(int(log2(K)) + 1):
        t = N - 2 * b[i]
        if t > 0:
            x.append((1 << i, t * (1 << i)))
            # (立てるフラグ値、答えの増加量)

    x = sorted(x, key=lambda xx: xx[1], reverse=True)
# print(x)

sx = 0
st = 0
for xx in x:
    if sx + xx[0] <= K:
        sx += xx[0]
        st += xx[1]

ans = sa + st
print(ans)


Measured memory_bytes: 14620
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    string ans="";
    rep(i,3){
        cin>>s;
        ans+=toupper(s[0]);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ss second
#define ff first
#define vi vector<int>
using namespace std;
int vis[1000][1000];
long long gn;
long long po(long long a,long long b){
    if(b==0)return 1;
    if(b==1)return a;
    if(b&1) return a*po(a*a,(b-1)/2);
    if(b&1^1)return po(a*a,b/2);
    return 1;
}
int vectoint(std::vector<int>v){
    reverse(v.begin(), v.end());
    long long p=0;
    for(int i=0;i<v.size();i++){
        p+=v[i]*po(2,i);
    }
return p;
}
int dp[100][100];
int print(int x,int y){
    if(x<=1){
            if(y>2 || y<=0)return 0;
            else return 1;
    }
  if(dp[x][y]!=0)return dp[x][y];
    else{

    return dp[x][y]=print(x-1,y)+print(x-1,y-1);
} }
void dele(stack<int>&s,int k){
    if(k==1){
        s.pop();
        return ;
    }
    int x=s.top();
    s.pop();
    dele(s,k-1);
    s.push(x);
    return;
}
void sort0(){

}
void finddup(){
    int arr[]={1,2,3,4,5,4};
    int tor=arr[0];
    int hare=arr[0];
    do{
        tor=arr[tor];
        hare=arr[arr[hare]];
    }
    while(hare!=tor);
    hare=arr[0];
    while(hare!=tor){
        hare=arr[hare];
        tor=arr[tor];
    }
    cout<<hare<<endl;
    return;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
    int t;
    // stack<int>s;
    // s.push(1);
    // s.push(111);
    // s.push(112);
    // s.push(112312);
    // s.push(12312);
    //  s.push(122);


    // cout<<s.size()<<endl;
    // stack<int>p=s;
    // while(!p.empty()){cout<<p.top()<<" ";p.pop();}
    // cout<<endl;
    // dele(s,(s.size()%2==0)?s.size()/2:(s.size()/2)+1);
    // cout<<s.size()<<endl;
    // while(!s.empty()){cout<<s.top()<<" ";s.pop();}
    //finddup();
    //sort0();
    int x,k;
    cin>>x>>k;
    int cnt=0;
    long long  i,j;
    while(x--){
       
        cin>>i>>j;
     unsigned   long long dis =(long long )i*i+(long long)j*j;
     
        if(dis<=(long long)k*k)cnt++;
    }
    cout<<cnt<<endl;
return 0;

}

Measured memory_bytes: 3632
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

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

ll mod = 1000000007;

void Main(){
    ll N;
    cin >> N;
    ll ans = 1;
    FOR(i, N+1, 2){
        ans *= i;
        ans %= mod;
    }
    cout << ans << el;
}



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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int S = 0;
  for(int i = 0; i < N; i++) {
    S += A.at(i);
  }
  if(H <= S) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int sum = a + b;
    int cnt = 0;
    int cntf = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'a' && cnt < sum){
            cout << "Yes" << "\n";
            cnt++;
        }   
        else if(s[i] == 'b' && cntf < b && cnt < sum){
            cout << "Yes" << "\n";
            cnt++;
            cntf++;
        }
        else
        {
            cout << "No" << "\n";
        }
        
    }
}

Measured memory_bytes: 896
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("0");exit(0);}
inline void debug(int x){cerr<<"debug: "<<x<<"\n";}
inline void debug(int n,int x[]){cerr<<"debug "<<"\n";rep(i,n)cerr<<x[i]<<" ";cerr<<"\n";}
inline void debug(string x){cerr<<"debug: "<<x<<"\n";}

const int maxn=100005;
const int mod=1e9+7;
inline void add(int &a,int b){a=(a+b)%mod;}
inline int mult(int a,int b){return 1LL*a*b%mod;}
int n,m,s,t,ans,ans2;
vector<pii>edge[maxn];
int dp[2][maxn],u[maxn*2],v[maxn*2],c[maxn*2];
ll dist[2][maxn];
bool vis[2][maxn];
priority_queue<pair<ll,int> >q;

void Dij(int tp){
	while(!q.empty())q.pop();
	rep(i,n)dist[tp][i]=(1LL<<62)-1LL;
	int f=tp?t:s;
	dist[tp][f]=0;
	dp[tp][f]=1;
	q.push(mp(0,f));
	while(!q.empty()){
		pair<ll,int>x=q.top();q.pop();
		x.first=-x.first;
		if(x.first!=dist[tp][x.second])continue;
		rep(i,edge[x.second].size()){
			pii y=edge[x.second][i];
			if(dist[tp][y.first]>x.first+y.second){
				dist[tp][y.first]=x.first+y.second;
				dp[tp][y.first]=dp[tp][x.second];
				q.push(mp(-(x.first+y.second),y.first));
			}
			else if(dist[tp][y.first]==x.first+y.second){
				add(dp[tp][y.first],dp[tp][x.second]);
			}
		}
	}
}

int main(){
	scanf("%d%d%d%d",&n,&m,&s,&t);
	s--;t--;
	rep(i,m){
		scanf("%d%d%d",&u[i],&v[i],&c[i]);
		u[i]--;v[i]--;
		edge[u[i]].pb(mp(v[i],c[i]));
		edge[v[i]].pb(mp(u[i],c[i]));
	}
	rep(k,2)Dij(k);
	rep(k,2)rep(i,n)dp[k][i]=mult(dp[k][i],dp[k][i]);
	ans=dp[0][t];
	ll mn=dist[0][t];
	rep(i,n){
		if(dist[0][i]+dist[1][i]>mn||dist[0][i]!=dist[1][i])continue;
		add(ans2,mult(dp[0][i],dp[1][i]));
	}
	rep(i,m){
		if(dist[0][u[i]]+dist[1][v[i]]+c[i]==mn&&abs(dist[0][u[i]]-dist[1][v[i]])<c[i])
		add(ans2,mult(dp[0][u[i]],dp[1][v[i]]));
		if(dist[0][v[i]]+dist[1][u[i]]+c[i]==mn&&abs(dist[0][v[i]]-dist[1][u[i]])<c[i])
		add(ans2,mult(dp[1][u[i]],dp[0][v[i]]));
	}
	ans=(ans-ans2+mod)%mod;
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 14704
loop do
  s = gets
  if s
    s.chomp
  else
    break end
  
  break if s==""
  i,j=0,0
  (s.length-2).times do |k|
    t = s[k,3]
    i+=1 if t == "IOI"
    j+=1 if t == "JOI"
  end
  puts j,i
end

Measured memory_bytes: 6104
using System.Collections.Generic;
using System.Linq;
using System;

public class P
{
    public int id { get; set; }
    public int u { get; set; }
    public int ac { get; set; }
    public int p { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var ps = new List<P>();
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var id = int.Parse(line[0]);
                var u = int.Parse(line[1]);
                var ac = int.Parse(line[2]);
                var p = int.Parse(line[3]);
                ps.Add(new P { id = id, u = u, ac = ac, p = p });
            }
            printAns(ps);
        }
    }
    public static void printAns(List<P> ps)
    {
        var ok = 0;
        var d = new Dictionary<int, int>();
        foreach (var x in ps.OrderByDescending(y => y.ac).ThenBy(y => y.p).ThenBy(y => y.id))
        {
            int dc;
            if (d.ContainsKey(x.u)) dc = d[x.u];
            else dc = 0;
            if ((ok < 10 && dc < 3) | (ok < 20 && dc < 2) | (ok < 26 && dc == 0))
            {
                ok++;
                Console.WriteLine(x.id);
                if (dc == 0) d[x.u] = 1;
                else d[x.u]++;
            }
        }
    }
}


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

const int ran = 55;

int n;
long long m;
int a[ran][ran];

struct modular_arithmetic{
	int mod;

	modular_arithmetic(){
		mod = 1000000007;
	}
	//No specific settings.
	int add(int x,int y){return (x+=y)<mod?x:x-mod;}
	int sub(int x,int y){return (x-=y)>=0?x:x+mod;}
	int mul(int x,int y){return (int)((long long int)x*y%mod);}
	int pw(int base, int p) {
		int res = 1, mu = base%mod;
		for(;p>0;p/=2) {
			if (p&1) res = mul(res, mu);
			mu = mul(mu, mu);
		}
		return res;
	}
	int rev(int x) {return pw(x, mod-2);}
};
modular_arithmetic ma;

struct Matrix {
	int a[ran][ran];
	void clear() { memset(a, 0, sizeof(a)); }
	void init() {
		clear();for (int i = 0; i < n; i++)a[i][i] = 1;
	}
	void initP() {
		clear();//....
	}
};

void mul(Matrix a, Matrix b, Matrix&c) {
	c.clear();
	for (int k = 0; k < n; k++)for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)
		c.a[i][j] = ma.add(c.a[i][j], ma.mul(a.a[i][k], b.a[k][j]));
}

int main() {
	cin>>n>>m;
	
	Matrix cur, ans;
	cur.clear();
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++) {
			cin>>cur.a[i][j];
		}
	
	ans.init();
	while(m) {
		if (m%2) mul(ans, cur, ans);
		m/=2;
		mul(cur, cur, cur);
	}
	
	int s = 0;
	for(int i=0;i<n;i++) 
		for(int j=0;j<n;j++)
			s=ma.add(s, ans.a[i][j]);
	cout<<s<<endl;
	
	return 0;
}

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

if N % 2 ==0:
  NA = int(N/2)
else:
  NA = int(N/2)
  
sum_n = 9*5*2 

for a in range(1,int(N/2+1)):
  summ = 0
  b = N-a
  list_a = list(str(a))
  list_b = list(str(b))
  
  while len(list_a) != len(list_b):
    list_a.insert(0,"0")
  for i in range(len(list_b)):
    summ += int(list_a[i])+ int(list_b[i])
  
  if summ < sum_n:
    sum_n = summ

print(sum_n)

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

int main() {
  string s;
 
  cin >> s;
  if (s == "Sunny") cout << "Cloudy" << "\n";
  else if (s == "Cloudy") cout << "Rainy" << "\n";
  else cout << "Sunny" << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, k, q;
    cin >> n >> k >> q;
    int nq = q;
    vector<int> cnt(n, 0);
    while (q--) {
    	int x;
    	cin >> x;
    	x--;
    	cnt[x]++;
    }
    for (int i = 0; i < n; i++) {
    	if (k - (nq - cnt[i]) > 0) {
    		cout << "Yes" << '\n';
    	} else {
    		cout << "No" << '\n';
    	}
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  char s[n],t[n];
  cin>>s>>t;
  for(int i=0;i<n;i++){
    if(s[i]==t[0]){
      int a=0;
      for(int j=1;j+i<n;j++){
	if(s[i+j]!=t[j]){
	  a=1;
	  break;
	}
      }
      if(a==0){
	cout<<n+(n-(n-i))<<endl;
	return(0);
      }
    }
  }
  cout<<2*n<<endl;
  return(0);
}


Measured memory_bytes: 256
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

Int N;
Int K;

void solve(){
	if(K==1){
		cout<<0<<endl;
	}else{
		cout<<N - (K-1) - 1<<endl;
	}
}

//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N;
    cin >> K;
	solve();
	return 0;
}

//}}}



Measured memory_bytes: 256
a,b = input().split()
cnt = 0

for i in range(int(a)+1):
  for j in range(int(a)-i+1):
    k = int(a)-i-j
    s = 10000*i + 5000*j + 1000*k
    if int(b) == s:
      if int(a) == i+j+k:
        print("{} {} {}".format(i,j,k))
        cnt = 1
        break
  else:
    continue
  break

if cnt != 1:
  print("{} {} {}".format(-1,-1,-1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> a;
  b=a;
  int x=2;
  if(a==2) co(2);
  else{
  while(1){
    rep(i,2,b-1){
      if(b%i!=0) x++;
    }
    if(x==b-1){
      c=b;
      break;
    }
    else{
      b++;
      x=2;
    }
  }
  co(c);
  }
  
  return 0;
}


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

int n, a, b;

int main()
{
    cin >> n;
    if(n == 1)
        cout << "Hello World" << '\n';
    else
    {
        cin >> a >> b;
        cout << a + b << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,h,m;
double ans;
int main()
{
	cin>>a>>b>>h>>m;
	double degree;
	degree=fabs((0.5*m+h*30)-6*m);
	ans=sqrt(a*a+b*b-2*a*b*cos(degree*acos(-1)/180));
	printf("%.20f\n",ans);
	return 0;
 } 

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

public class Main {

	static class Node {		
		int id, parentId, depth;
		int[] children;
		public Node(int id) {
			this.id = id;
			this.parentId = -1;
			this.depth = 0;
			this.children = null;
		}
		private String getType() {
			if (depth == 0) {
				return "root";
			}
			if (children == null || children.length == 0) {
				return "leaf";
			}
			return "internal node";
		}
		public String toString() {
			StringBuilder sb = new StringBuilder();
			sb.append("node " + id + ": ");
			sb.append("parent = " + parentId + ", ");
			sb.append("depth = " + depth + ", ");
			sb.append(getType() + ", ");
			sb.append(Arrays.toString(children));
			return sb.toString();
		}
	}

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		Node[] nodes = new Node[n];

		for (int i = 0; i < n; i++) {		
			StringTokenizer st = new StringTokenizer(reader.readLine());			
			int id = Integer.parseInt(st.nextToken());
			if (nodes[id] == null) {
				nodes[id] = new Node(id);
			}
			if (nodes[id].parentId != -1) {
				nodes[id].depth = nodes[nodes[id].parentId].depth + 1;
			}

			int m = Integer.parseInt(st.nextToken());
			int[] children = new int[m];
			for (int j = 0; j < m; j++) {
				int childId = Integer.parseInt(st.nextToken());
				children[j] = childId;
				if (nodes[childId] == null) {
					nodes[childId] = new Node(childId);
				}
				nodes[childId].parentId = id;
				nodes[childId].depth = nodes[id].depth + 1;
			}
			nodes[id].children = children;
		}

		for (Node node : nodes) {
			System.out.println(node);
		}
	}
}


Measured memory_bytes: 126928
fun main(args: Array<String>){
    val S = readLine()!! + "R"

    val ans = IntArray(S.length - 1)
    var now = 'R'
    var start = -1
    var rIndex = 0
    var lIndex = 0
    for(i in 1 until S.length){
        if(now == 'R' && S[i] == 'L'){
            rIndex = i - 1
            lIndex = i
        }
        if(now == 'L' && S[i] == 'R'){
            if((i - 1 - start) % 2 == 0){
                ans[rIndex] = (i - 1 - start) / 2
                ans[lIndex] = (i - 1 - start) / 2
            }else{
                if((rIndex - start) % 2 == 1){
                    ans[rIndex] = (i - 1 - start) / 2 + 1
                    ans[lIndex] = (i - 1 - start) / 2
                }else{
                    ans[rIndex] = (i - 1 - start) / 2
                    ans[lIndex] = (i - 1 - start) / 2 + 1
                }
            }
            rIndex = 0
            lIndex = 0
            start = i - 1
        }
        now = S[i]
    }

    println(ans.joinToString(separator = " "))
}

Measured memory_bytes: 38136
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<ii> adj[2][611][611];
int n;
int d[2];

bool isvalid(int x, int y)
{
	return (x>=0&&x<2*n&&y>=0&&y<2*n);
}

set<ii> delta[2];
int color[2][611][611];

void construct_adj(int id, int x, int y)
{
	for(ii d:delta[id])
	{
		if(isvalid(x+d.fi,y+d.se)) adj[id][x][y].pb(mp(x+d.fi,y+d.se));
	}
}

bool visited[2][666][666];
void dfs(int id, int x, int y, int col=0)
{
	visited[id][x][y]=1;
	color[id][x][y]=col;
	for(ii v:adj[id][x][y])
	{
		if(!visited[id][v.fi][v.se])
		{
			dfs(id,v.fi,v.se,col^1);
		}
	}
}
vector<ii> S[2][2];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n>>d[0]>>d[1];
	for(int z=0;z<2;z++)
	{
		for(int i=0;i<=2*n;i++)
		{
			for(int j=0;j<=2*n;j++)
			{
				if(ll(i)*ll(i)+ll(j)*ll(j)==d[z])
				{
					delta[z].insert({i,j});
					delta[z].insert({-i,j});
					delta[z].insert({i,-j});
					delta[z].insert({-i,-j});
				}
			}
		}
	}
	for(int z=0;z<2;z++)
	{
		for(int i=0;i<2*n;i++)
		{
			for(int j=0;j<2*n;j++)
			{
				construct_adj(z,i,j);
			}
		}
	}
	for(int z=0;z<2;z++)
	{
		for(int i=0;i<2*n;i++)
		{
			for(int j=0;j<2*n;j++)
			{
				if(!visited[z][i][j]) dfs(z,i,j);
			}
		}
	}
	for(int i=0;i<2*n;i++)
	{
		for(int j=0;j<2*n;j++)
		{
			S[color[0][i][j]][color[1][i][j]].pb(mp(i,j));
		}
	}
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<2;j++)
		{
			if(S[i][j].size()>=n*n)
			{
				for(int z=0;z<n*n;z++)
				{
					cout<<S[i][j][z].fi<<' '<<S[i][j][z].se<<'\n';
				}
				return 0;
			}
		}
	}
}


Measured memory_bytes: 181496
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n,m,k;cin>>n>>m>>k;

    vector<int> nums;
    nums.push_back(0);
    for (int i=1;i<=n;i++){
        int start = i * m;
        nums.push_back(start);
        for (int j=1;j<=m;j++){
            nums.push_back(start + (n - i) * j - i * j);
        }
    }
    for (int i=1;i<=m;i++){
        int start = i * n;
        nums.push_back(start);
        for (int j=1;j<=n;j++){
            nums.push_back(start + (m - i) * j - i * j);
        }
    }
    if (find(nums.begin(), nums.end(), k) != nums.end()){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;


}

Measured memory_bytes: 10604
// Contest: AtCoder Beginner Contest 165 (https://atcoder.jp/contests/abc165)
// Problem: B: 1% (https://atcoder.jp/contests/abc165/tasks/abc165_b)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    ll x, y = 100; cin >> x;
    int i = 0;
    while (y < x)
        y += y / 100, ++i;
    cout << i << '\n';

    return 0;
}

Measured memory_bytes: 3616
S = list(input())

for i in range(len(S)):
    del S[-1]
    if len(S) % 2 ==0:
        for j in range(len(S)//2):
            if S[j] == S[j+len(S)//2]:
                if j == len(S)//2-1:
                    print(len(S))
                    exit()
            else:
                break



Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        long n=cin.nextLong();
        long ans=1;
        if(n<7)Console.WriteLine(ans);
        else {ans=(n/11)*2;if(n%11>0&&n%11<7)ans++;else if(n%11>0)ans+=2;Console.WriteLine(ans);}
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << 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 if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0523 : Card Game **/
int main()
{
	int N;
	while (cin>>N, N) {
		vector< vector<int> > C(2);
		rep(i, N) {
			int a; cin>>a;
			C[0].push_back(a);
		}
		
		REP(i, 1, 2*N+1) {
			if (find(C[0].begin(), C[0].end(), i) == C[0].end())
				C[1].push_back(i);
		}
		
		sort(C[0].begin(), C[0].end());
		sort(C[1].begin(), C[1].end());
		
		int m=0, t=0;
		while (1) {
			if (m == 0) {
				m = C[t][0];
				C[t].erase(C[t].begin());
			} else {
				bool ok=false;
				rep(i, C[t].size()) {
					if (C[t][i]>m) {
						m = C[t][i];
						C[t].erase(C[t].begin()+i);
						ok = true;
						break;
					}
				}
				if (!ok) {
					m = 0;
				}
			}
			
			t = 1-t;
			if (C[0].size() == 0 || C[1].size() == 0) {
				cout << C[1].size() << "\n" << C[0].size() << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

const int INF = 1001001001;
ll co = 0;

void merge(vector<int> &a, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	vector<int> l(n1+1), r(n2+1);
	rep(i, n1) l.at(i) = a.at(left+i);
	rep(i, n2) r.at(i) = a.at(mid+i);
	l.at(n1) = r.at(n2) = INF;
	int i = 0, j = 0;
	for(int k = left; k < right; k++){
		if(l.at(i) <= r.at(j)){
			a.at(k) = l.at(i);
			i++;
		}else{
			co += n1 - i;
			a.at(k) = r.at(j);
			j++;
		}
	}
}

void mergeSort(vector<int> &a, int left, int right){
	if(left + 1 < right){
		int mid = (left+right)/2;
		mergeSort(a, left, mid);
		mergeSort(a, mid, right);
		merge(a, left, mid, right);
	}
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(snip_i, n) cin >> a.at(snip_i);
	mergeSort(a, 0, n);
	cout << co << endl;
	return 0;
}


Measured memory_bytes: 4388
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll x;
    cin >> x;

    ll ans = 0;
    exrep(b, 1, 31) {
        exrep(p, 2, 9) {
            ll u = 1;
            rep(j, p) {
                u *= b;
            }
            if(u <= x) {
                chmax(ans, u);
            }
        }
    }
    
    out(ans);
    re0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i];
    cout << data[i];
    if(i == n-1) cout << "" << endl;
    else cout << " ";
  }
  for(int i = 0;i < n;i++){
    for(int j = i-1;j >= 0;j--){
      if(data[j] > data[j+1]){
        int a  = data[j],b = data[j+1];
        data[j] = b;
        data[j+1] = a;
      }
      if(j == 0){
        for(int k = 0;k < n;k++){
          cout << data[k];
          if(k == n-1) cout << "" << endl;
          else cout << " ";
        }
      }
    }
  }
  
}



Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

typedef struct Edge {
    ll to, cost;
} Edge;

typedef struct Info {
    ll dist, from;
} Info;

vector<vector<Edge>> g;

void dijkstra(vector<Info> &dp, int s) {
    priority_queue<P> pq;
    dp[s].dist = 0;
    // P(dist, v)
    pq.push({0,s});

    while (!pq.empty()) {
        P p = pq.top(); pq.pop();
        int v = p.second;
        for (auto &&e: g[v]) {
            if (dp[e.to].dist > dp[v].dist+e.cost) {
                dp[e.to].dist = dp[v].dist+e.cost;
                dp[e.to].from = v;
                pq.push({dp[e.to].dist, e.to});
            }
        }
    }
}


int main(int argc, char const *argv[]) {
    int n, q, k;
    cin >> n;
    g.resize(n);
    REP(i,n-1) {
        ll a, b, c;
        cin >> a >> b >> c;
        --a,--b;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }
    cin >> q >> k;
    --k;
    vector<Info> dp(n, {LINF,0});
    dijkstra(dp,k);

    REP(i,q) {
        int x,y;
        cin >> x >> y;
        --x, --y;
        cout << dp[x].dist+dp[y].dist << endl;
    }

    return 0;
}

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

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

}


Measured memory_bytes: 19256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }



void solve(long long N, std::vector<std::string> s){
	ll res = 0;
	map<string, ll> M;
	REP(i, N) {
		ASC(s[i]);
		if (M.count(s[i])==0) {
			M[s[i]] = 1;
		} else {
			res += M[s[i]];
			M[s[i]]++;
		}
	}
	cout << res << "\n";
}

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


Measured memory_bytes: 18176
import java.util.*;

public class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long m = 100L;
		long y = 0L;
		while (m < x) {
			y++;
			m = m + m / 100;
		}
		System.out.println(y);
	}
}

Measured memory_bytes: 35740
#A
s = input()
count_dict = dict()

for word in s:
    count_dict.setdefault(word,0)
    count_dict[word] += 1
    
if len(count_dict) == 2:
    for row in count_dict:
        if count_dict[row] != 2:
            print("No")
            break
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

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

  int n;
  cin >> n;
  vector<int> h(n);
  REP(i,n) cin >> h[i];
  int ans = 1, piv = h[0];

  FOR(i,1,n){
    if(h[i] >= piv){
      ans++;
      piv = h[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func sumValue(jewels []int) int {
	ret := 0
	for _, j := range jewels {
		ret += j
	}
	return ret
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()

	deque := make([]int, n)
	for i := range deque {
		deque[i] = nextInt()
	}

	ans := 0
	// i : 操作回数
	// j : 宝石を取り出す回数
	// m : 左から宝石を取り出す回数
	// l, r : 左右から宝石を取り出す処理を回す変数
	for i := 0; i <= minInt(k, n*2); i++ {
		for j := (i + 1) / 2; j <= minInt(i, n); j++ {
			for m := 0; m <= j; m++ {
				var jewels []int
				for l := 0; l < m; l++ {
					jewels = append(jewels, deque[l])
				}
				for r := 0; r < j-m; r++ {
					jewels = append(jewels, deque[n-1-r])
				}
				sort.Sort(sort.Reverse(sort.IntSlice(jewels)))
				jewels = jewels[0 : j-(i-j)]
				ans = maxInt(ans, sumValue(jewels))
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define fixed(x) fixed<<setprecision(x)
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS)

class Point{
  public:
  double x,y;

  Point(double x=0, double y=0):x(x),y(y){}

  Point operator + (Point p) {return Point(x+p.x, y+p.y);}
  Point operator - (Point p) {return Point(x-p.x,y-p.y);}
  Point operator * (double a) {return Point(a*x,a*y);}
  Point operator / (double a) {return Point(x/a,y/a);}

  double abs(){return sqrt(norm());}
  double norm(){return x*x+y*y;}

  bool operator < (const Point &p) const{
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const{
    return (fabs(x-p.x) < EPS && fabs(y-p.y) < EPS);
  }
};
// ベクトルを表す
typedef Point Vector;
// 線分を表す
struct Segment{
  Point p1,p2;
};
// 直線を表す
typedef Segment Line;
// 円を表す
class Circle{
  public:
  Point c;
  double r;
  Circle(Point c=Point(), double r=0.0): c(c),r(r){}
};
// 多角形を表す
typedef vector<Point> Polygon;



// ベクトルaとbの内積
double dot(Vector a, Vector b);
// ベクトルaとbの外積
double cross(Vector a, Vector b);
// ベクトルaとbのなす角
double VecAngle(Vector a, Vector b);
// ベクトルaとbの直交判定
bool isOrthogonal(Vector a, Vector b);
// ベクトルaとbの平行判定
bool isParallel(Vector a, Vector b);
// 線分sに対する点pの射影
Point projection(Segment s, Point p);


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x[3],y[3];
  cin >>x[0]>>y[0]>>x[1]>>y[1];
  Segment s={Point(x[0],y[0]),Point(x[1],y[1])};
  int q;
  cin >>q;
  for(int i=0;i<q;i++){
    int x,y;
    cin >>x>>y;
    Point ans=projection(s,Point(x,y));
    cout <<fixed(9)<<ans.x<<' '<<fixed(9)<<ans.y<<'\n';
  }

  return (0);
}

// ベクトルaとbの内積
double dot(Vector a, Vector b){
  return (a.x*b.x + a.y*b.y);
}
// ベクトルaとbの外積
double cross(Vector a, Vector b){
  return (a.x*b.y - a.y*b.x);
}
// ベクトルaとbのなす角
double VecAngle(Vector a, Vector b){
  return acos((dot(a,b)/(a.abs()*b.abs())));
}
// ベクトルaとbの直交判定
bool isOrthogonal(Vector a, Vector b){
  return equals(dot(a,b),0.0);
}
// ベクトルaとbの平行判定
bool isParallel(Vector a, Vector b){
  return equals(cross(a,b),0.0);
}
// 線分sに対する点pの射影
Point projection(Segment s, Point p){
  Vector base = s.p2 - s.p1;
  double r = dot(p - s.p1, base)/(base.norm());
  return (s.p1 + base*r);
}


Measured memory_bytes: 3312
using System;
using System.Linq;

class A61 {
		public static void Main(string[] args) {
				int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
				if(input[0]<=input[2] && input[1] >= input[2]) {
						Console.WriteLine("Yes");
				}else{
						Console.WriteLine("No");
				}
		}
}


Measured memory_bytes: 13268
import java.util.*;
import java.math.*;

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();
        int D = sc.nextInt();

        while (true) {
            C -= B;
            if (C <= 0) {
                System.out.println("Yes");
                return;
            }
            A -= D;
            if (A <= 0) {
                System.out.println("No");
                return;
            }
        }

    }
}

Measured memory_bytes: 35732
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    sq = math.sqrt(n)
    r = 1
    for i in range(int(sq)-2, int(sq)+2):
        if i**2 <= n and r < i**2:
            r = i**2

    return r



print(main())




Measured memory_bytes: 5460
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

#define PI 3.141592

struct mine {
	D x, y, d;
};

void solve(vector< mine >& path) {
	mine s;
	s.x = 1.0; s.y = 0.0; s.d = atan2(s.y, s.x)*180/PI;
	path[0] = s;
	
	for_(i, 0, 1000) {
		mine p = path[i];
		D deg = (p.d + 90.0)*PI/180.0;
		mine np;
		np.x = p.x + cos(deg);
		np.y = p.y + sin(deg);
		np.d = atan2(np.y, np.x)*180.0/PI;
		path[i+1] = np;
	}
}

int main() {
	vector< mine > path(1010);
	solve(path);
	
	int n;
	while (1) {
		cin >> n; if (n==-1) break;
		cout << path[n-1].x << endl;
		cout << path[n-1].y << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1368
#include <iostream>
using namespace std;
int main(void){
    int b1, b2, b3;
    cin >> b1 >> b2 >> b3;
    
    if(b1 == 1 && b2 == 1 && b3 == 0){
        cout << "Open" << endl;
    }else if(b1 == 0 && b2 == 0 && b3 == 1){
        cout << "Open" << endl;
    }else{
        cout << "Close" << endl;
    }
}


Measured memory_bytes: 3112