akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

std::vector<int> adj[100005];
std::vector<bool> vis(100005,false);

void dfs(int i){
	if(!vis[i]){
		vis[i]=true;
		for(auto v:adj[i]){
			dfs(v);
		}
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n,m;
	cin >> n >> m;
	for(int i=0; i<m; i++){
		int x,y;
		cin >> x >> y;
		x--;
		y--;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int suma = 0;
	for(int i=0; i<n; i++){
		if(!vis[i]){
			suma++;
			dfs(i);
		}
	}
	cout << suma-1 << "\n";
    return 0;
}


Measured memory_bytes: 9564
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto B = readln.split.map!(to!long).array;

    auto AB = N.iota.map!(i => A[i] - B[i]).array;
    AB.sort();

    int ans = 0;
    long tmp = 0;

    foreach (i; 0..N) {
        if (AB[i] >= 0) break;
        ans += 1;
        tmp += AB[i];
    }

    foreach_reverse (i; 0..N) {
        if (AB[i] <= 0 || tmp >= 0) break;
        ans += 1;
        tmp += AB[i];
    }

    writeln(tmp >= 0 ? ans : -1);
}


Measured memory_bytes: 10756
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

constexpr int INFI = 1145141919;

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

    std::string a, b;
    std::cin >> a >> b;

    int xx = std::stoi(a+b);
    double x = std::sqrt(xx);

    for(int i=x-1; i<=x+1; i++){
        if(i*i==xx){
            std::cout << "Yes";
            return 0;
        }
    }

    std::cout << "No";
    return 0;
}


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


int partition(int *a, char *s, int p, int r){
        int x = a[r];
        int i = p-1;
        for(int j=p;j<r;j++){
                if(a[j]<=x){
                        i++;
                        swap(a[i],a[j]);
                        swap(s[i],s[j]);
                }
        }
        swap(a[i+1],a[r]);
        swap(s[i+1],s[r]);
        return i+1;
}

void quicksort(int *a, char *s, int p, int r){
        if(p>=r) return;
        int q = partition(a,s,p,r);
        quicksort(a,s,p,q-1);
        quicksort(a,s,q+1,r);
}

static int *tmp;
static char *tmp_s;

long long  merge(int *a, char *s, int low, int mid, int high){
        for(int i=low;i<high;i++) tmp[i]=a[i];
        for(int i=low;i<high;i++) tmp_s[i]=s[i];
        int i=low, j=mid, k=low;
        long long c=0;
        while(i<mid||j<high){
                if(i==mid) {
                        a[k] = tmp[j];
                        s[k] = tmp_s[j];
                        k++;
                        j++;
                }else if(j==high) {
                        a[k] = tmp[i];
                        s[k] = tmp_s[i];
                        k++;
                        i++;
                }else{
                        if(tmp[i]<=tmp[j]) {
                                a[k] = tmp[i];
                                s[k] = tmp_s[i];
                                k++;
                                i++;
                        }else {
                                c += mid-i;
                                a[k] = tmp[j];
                                s[k] = tmp_s[j];
                                k++;
                                j++;
                        }
                }
        }
        return c;
}

long long  mergesort(int *a, char* s, int low, int high){
        if(low>=high-1) return 0;
        int mid = low+(high-low)/2;
        long long c1 = mergesort(a, s, low, mid);
        long long c2 = mergesort(a, s, mid, high);
        long long c3 = merge(a, s, low, mid, high);
        return c1+c2+c3;
}

int main(){
        int n;
        cin>>n;
        int *a = new int[n];
        int *b = new int[n];
        char *s = new char[n];
        char *t = new char[n];
        tmp = new int[n];
        tmp_s = new char[n];

        for(int i=0;i<n;i++) cin>>s[i]>>a[i];
        for(int i=0;i<n;i++) {
                b[i] = a[i];
                t[i] = s[i];
        }

        quicksort(a, s, 0, n-1);
        mergesort(b, t, 0, n);

        bool stability = true;
        for(int i=0;i<n;i++)
                if(s[i]!=t[i]) stability = false;

        if(stability)  cout<<"Stable"<<endl;
        else  cout<<"Not stable"<<endl;
        for(int i=0;i<n;i++) cout<<s[i]<<" "<<a[i]<<endl;

        delete a, b, tmp, s, t, tmp_s;
        return 0;
}






Measured memory_bytes: 4296
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

typedef long long ll;

int main(){
  ll N;
  cin >> N;
  vector<int> digits;
  while (N > 0){
    int tmp = N % 26;
    if (tmp == 0) {
      tmp = 26;
      N--;
    }
    digits.push_back(tmp);
    N /= 26;
    if (N < 26){
      if (N > 0) digits.push_back(N);
      break;
    }
  }
  reverse(digits.begin(), digits.end());
  for (int d : digits){
    cout << alphabet[d-1];
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
	"os"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	sort.Sort(sort.IntSlice(a))

	for i := 0; i < n-1; i++ {
		if a[i] == a[i+1] {
			fmt.Println("NO")
			os.Exit(0)
		}
	}

	fmt.Println("YES")

}


Measured memory_bytes: 6144
#include<iostream>
#include<vector>
using namespace std;
 
int main(void){
  vector<int> a(5);
  int k,d=0;
  for(int i=0;i<a.size();i++) cin >> a[i];
  cin >> k;
  for(int i=0;i<a.size()-1;i++){
    for(int j =i+1;j<a.size();j++){
    d = max(d,(a[j]-a[i]));
    }
  }
  if(d<=k) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
import sys
n,m = map(int,input().split())
s_c = [list(map(int,input().split())) for s in range(m)] #0 is s, 1 is c
l = 0
if n == 1:
	n,l = 0,9
elif n == 2:
	n,l =10,99
else:
	n,l = 100,999
for i in range(n,l+1):
	bol = True
	tmp = list(str(i))
	for j in range(m):
		k = s_c[j][0]
		if tmp[k-1] != str(s_c[j][1]):
			bol = False
	if bol:
		print(i)
		sys.exit()
print(-1)

Measured memory_bytes: 9208
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1007;
const ll mod=1000*1000*1000+7;
const ll inf=1e18;

int n, k;

ll tab[nax];
ll dp[nax][nax];

int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		scanf("%lld", &tab[i]);
	for (int i=1; i<=n; i++)
	{
		for (int j=i-1; j; j--)
		{
			dp[j][i]=inf;
			for (int l=j; l<i; l++)
				dp[j][i]=min(dp[j][i], dp[j][l]+dp[l+1][i]);
			for (int l=j; l<=i; l++)
				dp[j][i]+=tab[l];
		}
	}
	printf("%lld\n", dp[1][n]);
	return 0;
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
    lli h, w, n;
    cin3(h, w, n);
    lli a[n+1];
    REPE(i, 1, n) {
        cin >> a[i];
    }
    lli cur = 1;
    REP(i, 0, h) {
        lli ary[w];
        REP(j, 0, w) {
            if (a[cur] == 0) {
                cur++;
            }
            if (i % 2 == 0) {
                ary[j] = cur;
            }
            else {
                ary[w-j-1] = cur;
            }
            a[cur]--;
        }
        REP(j, 0, w) {
            cout << ary[j] << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring> 
using namespace std;
int main()
{
	char a[4];
	int f=1;
	for(int i=0;i<4;i++)
	{
		cin>>a[i];
	if(a[0]==a[1]&&a[1]==a[2]||a[1]==a[2]&&a[2]==a[3])f=1;
	else f=0;
	}
	if(f==1)
	cout<<"Yes"<<endl;
	else 
	cout<<"No"<<endl;
	return 0;
}

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

int main()
{
   int a,b,k;
   cin>>k;
   cin>>a>>b;
   for(int i=a;i<=b;i++)
   {
       if(i%k==0)
      {  cout<<"OK";
        return 0;
      }
    
   }
   cout<<"NG";
   return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define int long long

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

	for (int i = 0; i < 1 << (s.size()-1); i++) {
		string sa;
		for (int j = 0; j < s.size() - 1; j++) {
			sa.push_back(s[j]);
			if (i & 1 << j) {
				int a = stoll(sa);
				ans += a;
				sa.clear();
			}
		}
		sa.push_back(s[s.size() - 1]);
		int a = stoll(sa);
		ans += a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

string N;
int dp[20][2][10];
int rec(int i, bool less, int state) {
    auto& DP = dp[i][less][state];
    if (DP != INF) return DP;

    if (i == SZ(N)) {
        return DP = (state == 4);
    }

    int ret = 0;
    REP(j, less ? 10 : N[i]-'0'+1) {
        int next_state = state;
        if (state == 0 && j == 5) next_state++;
        else if (state == 1 && j == 1) next_state++;
        else if (state == 2 && j == 5) next_state = 5;
        else if (state == 2 && j != 5) next_state = 6;
        else if ((state == 5 || state == 6) && j == 3) next_state = 4;
        else if (state == 4);
        else {
            if (state == 5 && j == 1) {
                next_state = 2;
            } else if (j == 5) {
                next_state = 1;
            } else {
                next_state = 0;
            }
        }
        ret += rec(i+1, less || j!=(N[i]-'0'), next_state);
    }
    return DP = ret;
}
signed main() {
    REP(i, 20) REP(j, 2) REP(k, 10) dp[i][j][k] = INF;
    cin >> N;
    cout << rec(0, 0, 0) << endl;
    return 0;
}




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

using static Input;
using static Util;
class Program
{
    static int N;
    static long[] A;
    static void INPUT()
    {
        N = NextInt();
        A = LineLong();
    }

    static void OUT()
    {
        var ans = 1L;
        var max = (long)Math.Pow(10, 18);
        foreach (var a in A.OrderBy(__ => __).ToArray())
        {
            if (a == 0)
            {
                ans = 0;
                break;
            }
            if (a > max / ans)
            {
                ans = -1;
                break;
            }
            ans *= a;
        }

        Console.WriteLine(ans);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}

Measured memory_bytes: 42856
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
    if(N%10==3){
        cout<<"bon";return 0;
    }
    string s="0168";
    for(auto c:s){
        if(c-'0'==N%10){
            cout<<"pon";
            return 0;
        }
    }
    cout<<"hon";

    return 0;
}

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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#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(i) (i).begin(), (i).end() å
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N, M;

signed main()
{
    cin >> N >> M;

    vector<int> s(N);

    rep(i, M)
    {
        int k;
        cin >> k;
        rep(j, k)
        {
            int temp;
            cin >> temp;
            temp--;
            s[temp] |= (1 << i);
        }
    }

    int p = 0;

    rep(i, M)
    {
        int temp;
        cin >> temp;
        p |= (temp << i);
    }

    int ans = 0;

    for (int i = 0; i < (1 << N); i++)
    {
        int t = 0;
        for (int j = 0; j < N; j++)
        {
            if (i >> j & 1)
            {
                t ^= s[j];
            }
        }

        if (p == t)
        {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 3e2 + 17;

int n, m;
int cnt[maxn], pt[maxn];
int a[maxn][maxn];
bool g[maxn];

bool read()
{
	if (scanf("%d %d", &n, &m) != 2)
		return false;

	forn (i, n)
		forn (j, m)
			scanf("%d", &a[i][j]), --a[i][j];

	return true;
}

bool check(int k)
{
	fill(cnt, cnt + m, 0);
	fill(pt, pt + n, 0);
	fill(g, g + m, 1);

	forn (i, n)
		++cnt[a[i][0]];

	forn (jt, m)
	{
		if (*max_element(cnt, cnt + m) <= k)
			return true;

		int ii = -1;

		forn (i, m)
			if (cnt[i] > k)
				ii = i;

		cnt[ii] = 0;
		g[ii] = false;
		fill(cnt, cnt + m, 0);

		forn (i, n)
		{
			pt[i] = m;

			forn (j, m)
				if (g[a[i][j]])
				{
					pt[i] = j;
					++cnt[a[i][j]];
					break;
				}
		}
	}

	return false;
}

void solve()
{
	int l = 1, r = n;

	for (; l < r; )
	{
		int mid = (l + r) / 2;

		if (check(mid))
			r = mid;
		else
			l = mid + 1;
	}

	printf("%d\n", l);
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll INF=(1ll<<60);
constexpr ll mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll X,Y,Z,K;cin>>X>>Y>>Z>>K;
    vector<ll> A(X),B(Y),C(Z),ans;

    rep(i,X){
        cin>>A[i];
    }
    rep(i,Y){
        cin>>B[i];
    }
    rep(i,Z){
        cin>>C[i];
    }

    sort(A.begin(),A.end(),greater<ll>());
    sort(B.begin(),B.end(),greater<ll>());
    sort(C.begin(),C.end(),greater<ll>());

    vector<ll> vecab;
    rep(i,X){
        rep(j,Y){
            vecab.push_back(A[i]+B[j]);
        }
    }
    sort(vecab.begin(),vecab.end(),greater<ll>());

    rep(i,min(K,X*Y)){
        rep(j,Z){
            ans.push_back(vecab[i]+C[j]);
        }
    }

    sort(ans.begin(),ans.end(),greater<ll>());

    rep(i,K){
        cout<<ans[i]<<endl;
    }
    return 0;
}

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

double x[8], y[8];

int main() {
    int n; cin >> n;
    rep(i,n) {
        cin >> x[i] >> y[i];
    }
    
    vector<int> v(n);
    iota(v.begin(), v.end(), 0);
    double res = 0;
    do{
        for(int i=0; i<n-1; ++i){
            double dx = x[v[i]] - x[v[i+1]];
            double dy = y[v[i]] - y[v[i+1]];
            res += sqrt(dx*dx + dy*dy);
        }
    }while(next_permutation(v.begin(),v.end()));

    for (int i=1; i<=n; ++i) res /= i;

    printf("%.10f\n", res);
    return 0;
}

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

using namespace std;

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define RS resize

int main()
{
	int a, A, b, B, N;
	cin >> N >> a >> A >> b >> B;
	int x, y;
	x = ((a + N - 1) / a) * A;
	y = ((b + N - 1) / b) * B;
	cout << min(x, y) << endl;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int a,b;
    cin>>n;
    vi a(n);
    rep(i,0,n) cin>>a[i];
    sortA(a);
    int ans=INF;
    rep(i,1,101)
    {
        sum=0;
        rep(j,0,n)
        {
            sum+=(a[j]-i)*(a[j]-i);
        }
        ans=min(ans,sum);
    }
    cout<<ans;
}
 

signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

const Vi dx = {0,1,0,-1};
const Vi dy = {1,0,-1,0};

signed main(){start();
    int h,w,ans=0;
    cin>>h>>w;
    Vs s(h);
    REP(i,0,h) cin>>s[i];
    VVi used(h,Vi(w,0));
    
    REP(i,0,h){
        REP(j,0,w){
            if(used[i][j]==0 && s[i][j]=='#'){
                int white=0,black=0;
                queue<tuple<int,int,int>> q;
                q.push(mt(i,j,0));
                while(!q.empty()){
                    int nowx,nowy,dnow;
                    tie(nowy,nowx,dnow)=q.front();
                    q.pop();
                    if(used[nowy][nowx]) continue;
                    if(s[nowy][nowx]=='.') white++;
                    else black++;
                    used[nowy][nowx]=1;
                    REP(d,0,4){
                        int newx=nowx+dx[d],newy=nowy+dy[d];
                        if(0<=newx && newx<w && 0<=newy && newy<h){
                            if((s[newy][newx]=='#' && dnow%2==1) || (s[newy][newx]=='.' && dnow%2==0)) q.push(mt(newy,newx,dnow+1));
                        }
                    }
                }
                ans+=black*white;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
s = gets.chomp
prev = s[0]
count = 0
(s.length - 1).times do |i|
    if prev == s[i + 1]
        count += 1
        case s[i + 1]
        when "0"
            prev = "1"
        when "1"
            prev = "0"
        end
    else
        prev = s[i + 1]
    end
end
puts count

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <typename T> // T : type of cost
struct BellmanFord {
    T inf = numeric_limits<T>::max(); // initial value, reused when clear() is called
    int n;                            // number of nodes
    vector<bool> negative;
    vector<T> dist; // distance from start node
    struct edge {
        int from, to;
        T cost;
        edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    };
    vector<edge> edges;

    BellmanFord(int n) : n(n), negative(n, false), dist(n, inf){};

    // 0-indexed!
    void addEdge(int from, int to, T cost) { edges.emplace_back(from, to, cost); }

    // calculate dist[i] as a shortest distance from start to each node
    void build(int start) {
        dist[start] = 0;
        for (int i = 0; i < n; ++i) {
            for (auto &e : edges) {
                if (dist[e.from] != inf && dist[e.to] > dist[e.from] + e.cost) {
                    dist[e.to] = dist[e.from] + e.cost;
                }
            }
        }
    }

    // check whether there are negative cycles along the path of interest
    bool hasNegativeCycle(int end = -1) {
        for (int i = 0; i < n; ++i) {
            for (auto &e : edges) {
                if (dist[e.from] != inf && dist[e.to] > dist[e.from] + e.cost) {
                    dist[e.to]     = dist[e.from] + e.cost;
                    negative[e.to] = true;
                }
                negative[e.to] = negative[e.to] | negative[e.from];
            }
        }
        if (end != -1)
            return negative[end];
        else {
            bool neg = false;
            for (int i = 0; i < n; ++i) {
                neg = neg | negative[i];
            }
            return neg;
        }
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m, p;
    cin >> n >> m >> p;
    BellmanFord<lint> bf(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        lint w;
        cin >> u >> v >> w;
        u--, v--;
        bf.addEdge(u, v, -w + p);
    }
    bf.build(0);
    if (bf.hasNegativeCycle(n - 1)) {
        cout << -1 << "\n";
    } else {
        cout << max(0LL, -bf.dist[n - 1]) << "\n";
    }
    return 0;
}

Measured memory_bytes: 512
fun main(args: Array<String>){
    val (l, r) = readLine()!!.split(" ").map { it.toInt() }

    if(l / 2019 != r / 2019){
        println(0)
    }else{
        var min = Long.MAX_VALUE / 10
        for(i in l..r - 1){
            for(j in i + 1..r){
                min = Math.min(min, (i % 2019L) * (j % 2019L) % 2019L)
            }
        }
        println(min)
    }
}

Measured memory_bytes: 38004
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
  double r,pi,s,l;
  pi = 3.141592653589;

  cin >> r;
  s = pi*r*r;
  l = 2*pi*r;

  printf("%f %f\n",s,l);
  return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, long long M, long long V, long long P, vector<long long> A){
	SORT(A);
	ll sum = 0, res = P;
	for (int i = N-P-1; i >= 0; i--) {
		ll nmp = A[N-P]+(max(0LL, M*max(0LL, V-(i+P))-sum)+(N-P-i)-1)/(N-P-i);
		// cout << i << ": " << nmp << " " << sum << endl;
		if (A[i] == A[i+1] || nmp <= A[i]+M) res++; else break;
		sum += A[N-P]-A[i];
	}
	cout << res << endl;
}

int main(){	
	long long M;
	long long P;
	long long V;
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	scanf("%lld",&M);
	scanf("%lld",&V);
	scanf("%lld",&P);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, M, V, P, A);
	return 0;
}



Measured memory_bytes: 1792
from collections import deque
x,y,r, g, n  = map(int,input().split())

R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort(reverse = True)
G.sort(reverse = True)
N.sort()
R_dq = deque(R[:x])
G_dq = deque(G[:y])
N_dq = deque(N)

flag =True
while flag:
    r_tail = R_dq[-1]
    g_tail = G_dq[-1]
    if len(N_dq) ==0:
        break
    else:
        n_tail = N_dq[-1]

    if r_tail < g_tail:#r_tail がg_tailより小さい
        if r_tail < n_tail:
            R_dq.pop()
            R_dq.appendleft(n_tail)
            N_dq.pop()
        else:
            break
    else:#g_tailがr_tailより小さい
        if g_tail < n_tail:
            G_dq.pop()
            G_dq.appendleft(n_tail)
            N_dq.pop()
        else:
            break
print(sum(R_dq) + sum(G_dq))

Measured memory_bytes: 110248
N = int(input())
B =  [int(i) for i in input().split()]

A = [0] * N
sub= [0] * N
ans = 0

A[0] = B[0]
A[-1] = B[-1] 

# A[N-3]まで
for i in range(1, N-2):
    A[i] = min(B[i], B[i-1])

A[0] = B[0]
A[-1] = B[-1] 
A[N-2] = min(B[N-2], B[N-3])

for i in range(N):
    ans = ans + A[i]

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n;
	vector<double> v(n);
	rep(i, n) {
		cin >> v[i];
	}
	sort(v.begin(), v.end(),greater<double>());
	while (v.size() > 1) {
		double aa = v[v.size() - 1];
		double bb = v[v.size() - 2];
		v.pop_back();
		v.pop_back();
		double kk = (aa + bb) / 2;
		v.push_back(kk);
		sort(v.begin(), v.end(), greater<double>());
	}
	cout << v[0] << endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
  int N = 100;
  int a[N+1];
  int cnt = 0;
  cin >> N;
  for(int i=1; i<N+1; i++){
    cin >> a[i];
  }
  for(int i=1; i<N+1; i++){
    if(i%2 == 1){
      if(a[i]%2 == 1){
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}

Measured memory_bytes: 3184
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        l: u64,
        r: u64
    }

    let result = xor(l, r);
    // for l in (0..100001) {
    //     let r = l + 2;
    //     // for r in (l..10001) {
    //         let result = (l..r).fold(r, |s, v| s ^ v);
    //         let result2 = xor(l, r);
    //         if result != result2 {
    //             println!("{:#064b}", result);
    //             println!("{}", result);
    //             println!("l: {}, r: {}", l, r);
    //             println!("{:#064b}", result2);
    //             println!("{}", result2);
    //             println!("{}", result == result2);
    //         }
    //     // }
    // }
    // let result = (l..r).fold(r, |s, v| s ^ v);
    // let result2 = xor(l, r);
    // println!("{:#064b}", result);
    println!("{}", result);
    // println!("{:#064b}", result2);
    // println!("{}", result2);
    // println!("{}", result == result2);
}

fn xor(l: u64, r: u64) -> u64 {
    if l > r {
        xor(r, l)
    } else if l == 0 {
        match r % 4 {
            0 => r,
            1 => 1,
            2 => r + 1,
            3 => 0,
            _ => 9999
        }
    } else {
        xor(0, l - 1) ^ xor(0, r)
    }
}


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

int main(void)
{
  string S; cin>>S;
  if((S[0]==S[1]&&S[1]==S[2])||(S[1]==S[2]&&S[2]==S[3]))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int N, M;
    std::cin >> N >> M;
    std::vector<std::pair<long long, long long>> P(N);
    for(int i = 0; i < N; i++){
        long long A, B;
        std::cin >> A >> B;
        P[i] = std::make_pair(A, B);
    }
    std::sort(P.begin(), P.end());

    long long total_price = 0;
    long long residual_num = M;
    for(int i = 0; i < N; i++){
        if(residual_num <= 0){
            break;
        }
        long long price = P[i].first;
        long long num = P[i].second;

        if(residual_num >= num){
            total_price += price * num;
            residual_num -= num;
        }else{
            total_price += price * residual_num;
            residual_num -= residual_num;
        }
    }
    std::cout << total_price << std::endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int x; cin >> x;
        mp[x]++;
    }
    vector<int> freq;
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        pii pa = *iter;
        freq.push_back(pa.second);
    }

    sort(ALL(freq));
    int cnt = 0;
    int len = freq.size() - K;

    for (int i = 0; i < freq.size() && len > 0; i++) {
        cnt += freq[i];
        len--;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 13616
/**
 * Author : RDP
 * There are no two words in the English language more harmful than "good job".
 * 1729 ;)
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
using ll = long long;
#define endl '\n'
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) 
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define all(x) (x).begin(), (x).end()
/* **************************************************************************************** */

void test_case()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d});
	return ;
}
int main()
{
	FAST_IO
    test_case();
	return 0;
}



Measured memory_bytes: 3648
/**
 *   author: malviyanshiv
 *   created: 13 April 2019  17:32:32
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

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


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

int main(){
	optimizeIO();

	int n;
	cin >> n;
	vector<int> arr(n);
	REP(i, 0, n)
		cin >> arr[i];
	int mx = arr[0];
	int cnt = 1;
	REP(i, 1, n)
		if( arr[i] >= mx )
			mx = arr[i], cnt++;
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18




int main(){
  int D;
  long long G;
  cin >> D >> G;
  vector<long long> p(D),c(D);
  rep(i,D)cin >> p[i] >> c[i];
  long long ans = LINF;
  rep(bit,1<<D){
    long long now = 0;
    long long sum = 0;
    rep(i,D){
      if(bit & (1<<i)){
        sum += p[i] * 100 * (i+1) + c[i];
        now += p[i];
      }
    }
    if(sum >= G){
      ans = min(ans,now);
    }
    else{
      for(int i = D-1; i >= 0; i--){
        if(bit & (1 << i)) continue;
        rep(j,p[i]){
          if(sum >= G) break;
          sum += 100 * (i+1);
          now++;
        }
      }
      ans = min(ans,now);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long ll;
const ll mod = 1e9+7;
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

signed main() {
    int n, m; cin >> n >> m;
    vector<int> broken(n);
    rep(i, m) {
        int a; cin >> a;
        broken[a] = 1;      // 1 ~= true
    }

    vector<int> dp(n+2);
    dp[n] = 1;
    for(int i = n-1; i >= 0; --i) {
        if(broken[i]) {
            dp[i] = 0;
            continue;
        } else {
            dp[i] = (dp[i+1] + dp[i+2])%mod;
        }
    }
    cout << dp[0] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
    long long int n,max,count;

    scanf("%lld",&n);
    max = count = 0;

    long long int num[n];

    for(long long int i = 0;i < n;i++)
        scanf("%lld",&num[i]);

    max = num[0];

    for(long long int i = 1;i < n;i++)
    {
        if(num[i] > max)
            max = num[i];
        else count += (max - num[i]);
    }

    printf("%lld\n",count);

    return 0;
}

Measured memory_bytes: 3708
def main():
    N, K = map(int, input().split())
    P = list(map(lambda x: int(x)-1, input().split()))
    C = list(map(int, input().split()))
    loop = [0] * N
    loopsum = [0] * N
    for i in range(N):
        if loop[i] > 0:
            continue
        cnt = 0
        cur = i
        visited = set()
        score = 0
        while cur not in visited:
            visited.add(cur)
            cnt += 1
            cur = P[cur]
            score += C[cur]
        for v in visited:
            loop[v] = cnt
            loopsum[v] = score
    ans = max(C)
    for i in range(N):
        if loopsum[i] >= 0 and loop[i] <= K:
            score = loopsum[i] * (K // loop[i] - 1)
            limit = K % loop[i] + loop[i]
        else:
            score = 0
            limit = min(loop[i], K)
        cur = i
        for _ in range(limit):
            cur = P[cur]
            score += C[cur]
            ans = max(ans, score)
    print(ans)


if __name__ == "__main__":
    main()


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

namespace ABC105_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NK[0];
            var K = NK[1];

            Console.WriteLine(N % K == 0 ? 0 : 1);
        }
    }
}


Measured memory_bytes: 11348
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	ll dp1=1, dp2=1;
	for(int i=0; i<n; i++){
		ll t, a; cin>>t>>a;
		ll m=max((dp1+t-1)/t, (dp2+a-1)/a);
		dp1=m*t, dp2=m*a;
	}
	cout<<dp1+dp2<<endl;
	return 0;
}

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

#define pb(s) push_back(s)
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))

typedef long long ll;

ll f(ll a, ll b){
    ll ans=a/b;
    if(a%b) ans++;
    return ans;
}
int main()
{
std:
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin>>n;
    ll t1,a1;
    cin>>t1>>a1;
    n--;
    while(n--){
        ll x,y;
        cin>>x>>y;
        ll num=max(f(t1,x),f(a1,y));
        t1=num*x;
        a1=y*num;
    }
    cout<<t1+a1;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
using namespace std;
#define pb push_back
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int d,t,s;
	cin >> d >> t >> s;
	if(t*s>=d){
		cout << "Yes";
	}
	else{
		cout << "No";
	}


	return 0;
}


Measured memory_bytes: 3596