akhauriyash/Code-Regression huggingface dataset:
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  string S;
  cin >> S;
  if(S == "SUN"){
  	cout << 7 << endl;
  }else if(S == "MON"){
  	cout << 6 << endl;
  }else if(S == "TUE"){
  	cout << 5 << endl;
  }else if(S == "WED"){
  	cout << 4 << endl;
  }else if(S == "THU"){
  	cout << 3 << endl;
  }else if(S == "FRI"){
  	cout << 2 << endl;
  }
  else{
  	cout << 1 << endl;
  }
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int dam = 0;
	int count = 0;
	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int H = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		for(int i = 0;  i < N; i++) {
			if(b[N-i-1] <= a[N-1]) break;
			dam += b[N-i-1];
			count++;
			if(dam >= H) {
				System.out.println(count);
				sc.close();
				return;
			}
		}
		while(dam < H) {
			count++;
			dam += a[N-1];
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 79428
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  scanf("%d\n",&N);
  std::vector<ll> A(N);
  for (size_t i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  sort(all(A),std::greater<int>());
  ll temp=A[0];
  ll first=0,second=0;
  for (size_t i = 1; i < N; i++) {
    if(temp==A[i]){
      if(first==0){
        first=temp;
      }else{
        second=temp;
        break;
      }
      i++;
      temp=A[i];
    }else{
      temp=A[i];
    }
  }
  printf("%lld\n",first*second);
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
    vector<int> dp(1000001, 1e9);
    vector<int> dp2(1000001, 1e9);
    dp[0] = dp2[0] = 0;
    for(int i=1; i*(i+1)*(i+2)/6 <= 1000000; ++i) {
        int l = i*(i+1)*(i+2)/6;
        for(int j=0; j+l<=1000000; ++j) {
            dp[j+l] = min(dp[j+l], dp[j] + 1);
        }
        if(l % 2 == 1) {
            for(int j=0; j+l<=1000000; ++j) {
                dp2[j+l] = min(dp2[j+l], dp2[j] + 1);
            }
        }
    }


    int n;
    while(cin >> n, n) {
        cout << dp[n] << " " << dp2[n] << endl;
    }
}


Measured memory_bytes: 10492
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

#define a first
#define b second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define debug
#define TRACE(x)

using namespace std;
using llint = long long;
using pii = pair<llint, llint>;

const int MAXN = 100010;
const int MAXP = 2200;

bool isprime(int n) {
  for (int x = 2; x < n; ++x)
    if (n % x == 0)
      return false;
  return true;
}

vector<int> p;
vector<int> pp[3];
map<llint, int> tot;

pii get_class(llint x) {
  llint ret1 = 1, ret2 = 1;
  REP(i, (int)p.size()) {
    int cnt = 0;
    while (x % p[i] == 0) {
      x /= p[i];
      ++cnt;
    }
    cnt %= 3;
    ret1 *= pp[cnt][i];
    ret2 *= pp[(3 - cnt) % 3][i];
  }

  if (x > 1) {
    llint root = sqrt(x);
    if (root * root == x) {
      ret1 *= root * root;
      ret2 *= root;
    } else {
      ret1 *= x;
      ret2 *= x * x;
    }
  }
  
  return {ret1, ret2};
}

int n, sol;
llint a[MAXN];
pii s[MAXN];

int main(void) {
  scanf("%d",&n);
  REP(i, n) scanf("%lld",&a[i]);

  FOR(pr, 2, MAXP)
    if (isprime(pr)) {
      p.push_back(pr);
      pp[0].push_back(1);
      pp[1].push_back(pr);
      pp[2].push_back(pr*pr);
    }

  TRACE((int)p.size());

  REP(i, n) {
    auto c = get_class(a[i]);
    s[i] = c;
    ++tot[c.a];
    TRACE(c.a _ c.b);
  }

  sort(s, s + n);

  REP(i, n) {
    if (s[i].b == -1) {
      ++sol;
      continue;
    }
    if (i > 0 && s[i-1] == s[i]) continue;
    if (s[i].a == 1)
      sol += 1;
    else {
      if (tot[s[i].a] > tot[s[i].b] ||
	  (tot[s[i].a] == tot[s[i].b] && s[i].a < s[i].b))
	sol += tot[s[i].a];
    }
  }

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


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


int main() {
    ll N, K; cin >> N >> K;
    PQ<pll> pq;
    minPQ<pll> mpq;
    map<ll, ll> has;
    rep(i, N) {
        ll t, d; cin >> t >> d;
        pq.push(mp(d, t));
    }

    ll Sum = 0;

    rep(i, K) {
        pll val = pq.top(); pq.pop();
        ll t, d; tie(d, t) = val;
        Sum += d;
        has[t]++;
        if (has[t] >= 2) mpq.push(mp(d, t)); //ダブるものをminPQに入れ交歓要因にする
    }

    ll x = has.size();
    ll ans = Sum + x * x;

    while (!pq.empty() && !mpq.empty()) {
        if (x == K) break;

        pll val = pq.top(); pq.pop(); //これから入れる候補
        ll t, d; tie(d, t) = val;
        if (has[t] >= 1) continue;
        has[t]++;

        pll mval = mpq.top(); mpq.pop(); //外れるもの
        ll mt, md; tie(md, mt) = mval;
        //has[mt]--;

        Sum += d - md;
        x++;
        /*cout << d << " " << md << endl;
        cout << Sum << " " << x << endl;*/
        chmax(ans, Sum + x * x);
    }

    cout << ans << endl;

}

Measured memory_bytes: 6640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, k;
    scanf("%d%d%d%d", &a, &b, &c, &k);
    int sum=0;
    sum += min(a , k);
    k -= min(a , k);
    //sum += min(a , k);
    k -= min(b , k);
    sum -= min(c , k);
    k -= min(c , k);
	printf("%d", sum);
	return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll X,t;
  cin >> X >> t;
  if(X>=t)
  {
    cout << X-t << endl;
  }
  else
  {
    cout << 0 << endl;
  }
  return 0;
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  map<char, long>cnt;
  for(char c: s){
    cnt[c]++;
  }
  long ret = cnt['R']*cnt['G']*cnt['B'];
  for(int i=1; i<=n/2; i++){
    for(int j=0; j<n-2*i; j++){
      if(s[j]!=s[j+i] && s[j+i]!=s[j+2*i] && s[j+2*i]!=s[j])ret--;
    }
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 3176
using namespace std;
#define MAX 100
#define INFTY (1<<24)

struct Card{ int top, bottom; };

Card C[MAX+1];
int N;

int getCost(){
    int cost[MAX+1][MAX+1];
    for ( int i = 1; i <= N; i++ ){
	for ( int j = 1; j <= N; j++ ) cost[i][j] = INFTY;
    }
    for ( int i = 1; i <= N; i++ ) cost[i][i] = 0;

    for ( int j = 1; j <= N-1; j++ ){
	for ( int i = 1; i <= N-j; i++ ){
	    for ( int k = i+1; k <= i+j; k++ ){
		int mul = C[i].top * C[k-1].bottom * C[k].top * C[i+j].bottom;
		cost[i][i+j] = min( cost[i][i+j], cost[i][k-1] + cost[k][i+j] + mul );
	    }
	}
    }

    return cost[1][N];
}

main(){
    cin >> N;
    for ( int i = 1; i <= N; i++ ) cin >> C[i].top >> C[i].bottom;
    cout << getCost() << endl;
}

Measured memory_bytes: 0
#include<iostream>

int main()
{
    int X,Y=0;
    std::cin >> X >> Y;
    int clane,turtle=0;

    clane = X*2;
    turtle = X*4;

    if((Y%2)!=0)
    {
        std::cout << "No";
        return 0;
    }   
    if(clane<=Y && Y<=turtle)
    {
        std::cout << "Yes";
        return 0;
    }
    std::cout << "No";
    return 0;
}

Measured memory_bytes: 3608
# 焼きなまし（2000から線形に落とす）

from time import time
from math import exp
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
# A = [0] * D
# A = [0, 16, 12, 13, 12]
# A = [0, 16, 12, 13, 19]
ans = calc()
# print("ans =", ans)
while time() - sTime < 1.8:
    T = 2000 * max(1 - (time() - sTime) / 1.6, 0)
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(max(min(t / T, 0), -10)) * (1 << 10)):
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())
            
            

print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)


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

using namespace std;

#define ll long long

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (int &x : a) cin >> x;
  ll ans = 0;
  sort(a.begin(), a.end());
  for (int k = 1; k < n; k++) {
    ans += a[n - k / 2 - 1];
  }
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 3976
#include <iostream>
using namespace std;
typedef long long ll;
int F[100][5][2];
ll P[100][11];
int main( void )
{
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for( int i=0; i<N; i++ )
    for( int j=0; j<5; j++ )
      for( int k=0; k<2; k++ )
        cin >> F[i][j][k];
  for( int i=0; i<N; i++ )
    for( int j=0; j<11; j++ )
      cin >> P[i][j];
  ll ret = -(1LL<<60);
  for( int i=1; i<(1<<10); i++ ){
    int c[100] = {0};
    for( int j=0; j<10; j++ ){
      int d = (i & (1<<j)) ? 1 : 0;
      if( d ){
        for( int k=0; k<N; k++ ){
          if( F[k][j/2][j%2] ) c[k]++;
        }
      }
    }
    ll r = 0;
    for( int j=0; j<N; j++ ){
      r += P[j][c[j]];
    }
    ret = max( ret, r );
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	int A,B,C,ans;
	cin>>A>>B>>C;
	if(A*C>B){
		cout<<B/A<<endl;
	}else{
		cout<<C<<endl;
	}
}


	

Measured memory_bytes: 256
#include<iostream>

// saw editorial

void correct(){
    int K;
    std::cin>>K;
    if (K%7==0){
        K=K/7;
    }
    if(K%5==0 || K%2==0){
        std::cout<<-1<<std::endl;
        return ;
    }
    int buf,cnt,L;
    buf=10;
    cnt=1;
    L=9*K;
    while(1){
        if(buf%L!=1){
            buf=buf%L;
            buf*=10;
            cnt++;
        }
        else{
            break;
        }
    }
    std::cout<<cnt<<std::endl;
}

int main(){
    correct();
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

bool comp(pair<ll,ll> p1, pair<ll,ll> p2){
	return p1.fi > p2.fi;
}

int main(){
	ll n;cin>>n;
	ll v1[n/2],v2[n/2];rep(i,0,n/2)cin>>v1[i]>>v2[i];

	//各数字の出現回数をカウント
	ll w1[100001],w2[100001];rep(i,0,100001)w1[i]=w2[i]=0;
	rep(i,0,n/2){w1[v1[i]]++;w2[v2[i]]++;}
	//出現回数とその数字をpairで保存
	vector<pair<ll,ll>> p1,p2;
	rep(i,0,100001)if(w1[i]!=0)p1.pb(mp(w1[i],i));
	rep(i,0,100001)if(w2[i]!=0)p2.pb(mp(w2[i],i));
	//出現回数が多いものからソート
	sort(all(p1),comp);
	sort(all(p2),comp);
	//出現する数字が一種類の場合
	if(p1.size() == 1 && p2.size() == 1 && p1[0].se == p2[0].se)
		cout << n/2 << ednl;
	//もっとも出現する数字が一緒の場合
	else if(p1[0].se == p2[0].se)
		cout << n - max(p1[0].fi+p2[1].fi, p1[1].fi+p2[0].fi) << ednl;
	//それいがい
	else
		cout << n - p1[0].fi - p2[0].fi << ednl;

}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;

using namespace std;
 
int main()
    {
        LL a,b,c,d,e;
        cin>>a>>b>>c>>d>>e;
        map<LL,LL> mp;
        mp[a]++;
        mp[b]++;
        mp[c]++;
        mp[d]++;
        mp[e]++;
        fr(i,1,6) {
          if(mp[i]==0){
              cout<<i<<endl;
              break;
          }
        }
    return 0;
}

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

int main()
{
    int student;
    bool judge[31] = {false};

    for (int i = 0; i < 28; i++){
        cin >> student;
        judge[student] = true;
    }

    for (int i = 1; i <= 30; i++){
        if (judge[i] == false){
            cout << i << endl;
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	int size = s.size();
	int a = -1, z;
	for (int i = 0; i < size; i++)
	{
		if (s[i] == 'A' && a == -1)
			a = i;
		else if (s[i] == 'Z')
			z = i;
	}
	cout << z - a + 1 << endl;

	return 0;
}


Measured memory_bytes: 640
/*
Author : Devil088
*/
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define sep cout<<"\n";
#define Yes cout<<"Yes\n";
#define No cout<<"No\n";
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";

inline string shift(string s){
	int n = s.length();
	string r = "";
	r+=s[n-1];
	for(int i=0;i<n-1;i++)r+=s[i];
	return r;
}

int main(){
	string s;
	cin>>s;
	int n = s.length();
	if(s[0]!='A')cout<<"WA\n";
	else{
		bool flag = true;
		bool c = false;
		if(s[1]=='C' || s[1]<97){
			flag = false;
		}
		for(int i=2;i<n-1;i++){
				if(s[i]<97 && s[i]!='C'){
					flag = false;
					break;
				}
				if(s[i] == 'C'){
					if(c == false)c = true;
					else {
						flag = false;
						break;
					}
				}
		}
		if(s[n-1]<97)flag = false;
		if(flag && c)cout<<"AC\n";
		else cout<<"WA\n";
	}
}
/*
uday
adyu
7 46
45 6
*/



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

int main(){
  int n;
  cin >> n;
  cout << (n%2?2*n:n);
  return 0;
}

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

using namespace std;

int main() {
    string s, p;

    cin >> s >> p;

    if ((s + s).find(p) == (size_t) -1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3188
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i = 0;; i++) {
			int x = sc.nextInt();
			if(x == 0) {
				break;
			} else {
				System.out.println("Case " + (i+1) + ": " + x);
			}
		}
	}

}

Measured memory_bytes: 42648
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
#define fir first
#define sec second
#define tct template<class type>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int maxn = 1e6, mod = 1e9 + 7;
int n;

inline void red(int &x) { x += x >> 31 & mod; }
tct inline void cmax(type &x, type y) { x < y ? x = y : 0; }
tct inline void cmin(type &x, type y) { x > y ? x = y : 0; }

int qpow(int a, int b) {
	int c = 1;
	for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) c = 1ll * a * c % mod;
	return c;
}

int main() {
	scanf("%d", &n);
	int y = 0;
	for (int i = 1, x = 1; i <= n; i++) {
		x = 1ll * (mod + 1) / 3 * x % mod;
		y = (y + 1ll * x * qpow(n - i + 1, mod - 2)) % mod;
	}
	y = 1ll * y * qpow(n, mod - 2) % mod;
	printf("%d\n", y);
	return 0;
}

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

typedef long long ll;

int main(){
  string s;
  cin>>s;
  ll a=0,b=0;
  for(ll i=0;i<s.length();i++){
  	if(s[i]=='S'){
  		b=max(a,b);
  		a=0;
	  }
    else a++;
  }
  b=max(a,b);
  cout<<b<<endl;
  return 0;
}

Measured memory_bytes: 3588
#include <cstdio>

int main() {
    int a, b, c;
    scanf(" %d %d %d", &a, &b, &c);

    int count = 0;
    for(int i = a; i < b+1; i++) {
        if( c%i == 0 ) count++;
    }

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


Measured memory_bytes: 2756
import java.util.*;


class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int alen = String.valueOf( a ).length();
        List<Integer> array = new ArrayList<Integer>();
        int i = 0;

        while(i<b){
          int c = scan.nextInt();
          array.add(c);
          i++; 
        }
        Collections.sort(array);
        i = 0;
        int ans = a;
        boolean dd = false;
        while(dd == false){
            String aa = String.valueOf( ans );
            int anslen = String.valueOf( ans ).length();
            int j = 0;
            int ddd = 0;
            while(j<anslen){
                int n = 0;
                int ansv = Integer.parseInt(aa.substring(j,j+1));
                while(n<b){
                    if(ansv == array.get(n)){
                        ddd++;
                        break;
                    }
                    n++;
                  }
                j++;
            }
            if(ddd == 0){
                dd = true;
                break;
            }else{
                ans++;
            }
        }
        System.out.println(ans);
        scan.close();
    }
}

Measured memory_bytes: 38548
/*Made by Shivam Solanki*/
#include<bits/stdc++.h> 
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef queue<int> qii;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define repllr(i,k,n) for (ll i = n; i >= k; --i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;

void solve(){
    int h,n;
    cin>>h>>n;
    vi a(n);
    rep(i,0,n) cin>>a[i];
    sort(all(a),greater<int>());
    bool flag=0;
    int sum=0;
    rep(i,0,n){
        sum+=a[i];
        if(sum>=h){
            flag=1;
            break;
        }
    }
    cout<<(flag?"Yes":"No");
}
    
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch SequenceSum | diff SequenceSum.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address SequenceSum.cpp && ./a.out

/*

 9/19/2020

 5:25-

 */

LL N;
int X,M;

int f(int a) {
  LL b=(LL)a*a%M;
  return (int)b;
}

void solve() {
  VI viz(M,-1);
  vector<LL> A;
  int i=0,cur=X; viz[X]=0;
  A.push_back(X);
  while(true) {
    ++i,cur=f(cur),A.push_back(cur);
    if(viz[cur]>=0) {
      break;
    } else {
      viz[cur]=i;
    }
  }

  int s=viz[cur],t=i;
  int first=s,cycle=t-s;

  //dump(s,t,first,cycle);
  //dumpc(A);

  vector<LL> cum(SZ(A)+1);
  REP(i,SZ(A)) cum[i+1]=cum[i]+A[i];
  LL res=0;
  int x=(int)min((LL)first,N);
  N-=x,res+=cum[x];
  LL times=N/cycle,rem=N%cycle;

  res+=(cum[t]-cum[s])*times;
  res+=cum[s+rem]-cum[s];
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>X>>M;
  solve();

  return 0;
}


Measured memory_bytes: 4608
#include<algorithm>
#include<stdio.h>
#include<string.h>
#define cmin(x,y) ((y)<x?x=(y):x)
#define cmax(x,y) ((y)>x?x=(y):x)
#define dmin(x,y) ((x)<(y)?(x):(y))
#define dmax(x,y) ((x)>(y)?(x):(y))
int F() {
	register int a,b,c;
	while(c=getchar(),c!='-'&&(c<'0'||c>'9'));
	b = (c=='-');
	for(a=b?0:c-'0';c=getchar(),c>='0'&&c<='9';a=a*10+c-'0');
	return b?-a:a;
}
const int N=2e5+1;
int n,m,head[N],pr[N],next[N],seg[1<<19],add[1<<19],qr;
void build(register int i,register int l,register int r) {
	seg[i]=r;
	if(l<r) {
		register int m=(l+r)>>1;
		build(i<<1,l,m);
		build(i<<1|1,m+1,r);
	}
}
#define addtag(x, v) (add[x]+=v, seg[x]+=v)
void modify(register int i,register int l,register int r) {
	if(l>qr) return;
	if(r<=qr) {addtag(i, 1); return;}
	if(add[i]) {
		addtag(i<<1  , add[i]);
		addtag(i<<1|1, add[i]);
		add[i]=0;
	}
	register int m=(l+r)>>1;
	modify(i<<1,l,m);
	modify(i<<1|1,m+1,r);
	seg[i]=dmax(seg[i<<1],seg[i<<1|1]);
}
int main() {
	register int i,j,ans=0;
	n=F(),m=F();
	for(i=1;i<=n;++i) {
		j=F(), pr[i]=F();
		next[i]=head[j];
		head[j]=i;
	}
	build(1,0,m+1);
	for(i=0;i<=m+1;++i) {
		for(j=head[i];j;j=next[j]) {
			qr=pr[j];
			modify(1,0,m+1);
		}
		cmax(ans,seg[1]-i);
	}
	ans=n+m+1-ans;
	//debug: maybe all the edges in the seats' set is cut.
	cmin(ans,m);
	printf("%d\n",dmax(n-ans,0));
	return 0;
}

Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const LL mod=1e9+7,N=2e5+7;
const LL inf=0x3f3f3f3f;
LL g[N],c[N],w[N],cnt[N];
LL jc[N],iv[N],n,u,v,ans=1;
LL qp(LL x,LL k){
	LL res=1;
	for(;k;x=x*x%mod,k>>=1)
		if(k&1)res=res*x%mod;
	return res;
}
int main(){
	scanf("%lld%lld%lld",&n,&u,&v);
	memset(g,0x3f,sizeof(g)),jc[0]=1;
	for(LL i=1;i<=n;i++)jc[i]=jc[i-1]*i%mod;
	iv[n]=qp(jc[n],mod-2);
	for(LL i=n-1;i>=0;i--)
		iv[i]=iv[i+1]*(i+1)%mod;
	for(LL i=1;i<=n;++i)
		scanf("%lld%lld",&c[i],&w[i]),
		g[c[i]]=min(g[c[i]],w[i]),++cnt[c[i]];
	LL mn=1,mi=inf;
	for(LL i=1;i<=n;++i)
		if(g[i]<g[mn])mn=i; 
	for(LL i=1;i<=n;++i)
		if(i!=mn)mi=min(g[i],mi); 
	for(LL i=1;i<=n;++i){
		if(w[i]!=g[c[i]]&&w[i]+g[c[i]]<=u)continue; 
		if(c[i]!=mn&&w[i]+g[mn]<=v)continue;
		if(c[i]==mn&&w[i]+mi<=v)continue; 
		--cnt[c[i]];
	}
	LL num=cnt[mn];
	for(LL i=1;i<=n;++i)
		if(i!=mn&&g[mn]+g[i]<=v) 
			num+=cnt[i];
	for(LL i=1;i<=n;++i)
		if(g[i]!=inf&&(i==mn||g[i]+g[mn]<=v))
			ans=ans*iv[cnt[i]]%mod;
	for(LL i=1;i<=num;++i)ans=ans*i%mod; 
	printf("%lld",ans),exit(0);
}

Measured memory_bytes: 9600
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans=100000;
  for(int i=0;i<50000;i++){
    int j=i*1.08;
    if(j==n)ans=i;
  }
  if(ans==100000)cout<<":("<<endl;
  else cout<<ans<<endl;
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll l, r;
  cin >> l >> r;
  ll diff = r - l;
  int ans;
  if (diff >= 2018) ans = 0;
  else{
    int il = l % 2019;
    int ir = r % 2019;

    ans = ((il % 2019) * ((il+1) % 2019)) % 2019;
    for(int i = l; i < r; ++i){
      for(int j = i+1; j <= r; ++j){
        ans = min(ans, ((((i) % 2019) * ((j) % 2019)) % 2019));
      }
    }
  }

  out(ans);
  return 0;
}


Measured memory_bytes: 256
import bisect


def sort_list():
    _ = input()
    K = [int(x) for x in input().split()]
    ans = 0

    len_k = len(K)
    n_lst = sorted(K)

    for idx in reversed(range(2, len_k)):
        for diff_idx in range(1, idx):
            diff = n_lst[idx] - n_lst[diff_idx]
            insert_index = bisect.bisect_right(n_lst, diff)
            if insert_index < diff_idx:
                # print(n_lst, diff, idx, diff_idx, insert_index)
                ans += diff_idx - insert_index
    print(ans)


if __name__ == "__main__":
    sort_list()


Measured memory_bytes: 41948
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur=nil->next;
  while(1){
    if(cur==nil || cur->key==key) break;
    cur=cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next=t->next;
  t->next->prev=t->prev;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ){
    return;
  }
  deleteNode(t);
}

void deleteLast(){
  NodePointer t=nil->prev;
  if(t==nil){
    return;
  }
  deleteNode(t);
}

void delete(int key){
  NodePointer t=listSearch(key);
  if(t==nil){
    return;
  }
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 36092
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

a = list(map(int,input().split()))
li = []
for i in range(len(a)):
    for j in range(i+1,len(a)):
        cost = abs(a[i]-a[j])
        li.append(cost)
li.sort()
li[-1] = 0
print(sum(li))

Measured memory_bytes: 14428
#include<stdio.h>

int main()
{
    long long int N,i,a;
    scanf("%lld", &N);
    long long int arr[N];
    for(i=1;i<=N;i++){
        arr[i] = 0;
    }
    for(i=1;i<N;i++){
        scanf("%lld", &a);
        arr[a]++;
    }
    for(a=1;a<=N;a++){
        printf("%lld\n", arr[a]);
    }
    return 0;
}


Measured memory_bytes: 3244
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_V 100
#define min(a, b) ((a) < (b) ? (a) : (b))

const int INF = 100000000;
int cost[MAX_V][MAX_V];
int V;

int
prim()
{
	int mincost[MAX_V];
	bool used[MAX_V];
	int u;

	for (u = 0; u < V; ++u)
	{
		mincost[u] = INF;
		used[u] = false;
	}

	mincost[0] = 0;
	int res = 0;
	while (true)
	{
		int v = -1;
		for (u = 0; u < V; ++u)
		{
			if (!used[u] && (v == -1 || mincost[u] < mincost[v]))
				v = u;
		}

		if (v == -1)
			break;

		used[v] = true;
		res += mincost[v];
		for (u = 0; u < V; ++u)
			mincost[u] = min(mincost[u], cost[v][u]);
	}

	return res;
}

int
main(int argc, char **argv)
{
	int E;
	int a, b, d;
	int u, v;
	int i;

	while (true)
	{
		scanf("%d", &V);
		if (V == 0)
			break;

		for (v = 0; v < V; ++v)
		{
			for (u = 0; u < V; ++u)
				cost[v][u] = INF;
		}

		scanf("%d", &E);
		for (i = 0; i < E; ++i)
		{
			scanf("%d,%d,%d", &a, &b, &d);
			cost[a][b] = d / 100 - 1;
			cost[b][a] = d / 100 - 1;
		}

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

	return 0;
}

Measured memory_bytes: 636
N = int(input())
a = list()
count = 0
value = 0
for i in range(N):
  a.append(int(input()))

for i in range(N):
  if a[value] == 2:
    print(count + 1)
    break
  elif a[value] == 0:
    print(-1)
    break
  else:
    tmp = a[value] - 1
    a[value] = 0
    value = tmp
    count += 1

Measured memory_bytes: 13032
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	int a[n+5];
	memset(a,0,sizeof(a));
	int k;
	for(int i=1;i<=m;i++){
		cin>>k;
		a[k]++;
	}
	int c1=0,c2=0;
	for(int i=x-1;i>0;i--)  c1+=a[i];
	for(int i=x+1;i<n;i++)  c2+=a[i];
	cout<<min(c1,c2);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=(b);a<(c);a++)
#define PER(a,b,c) for(ll a=(b);a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
double id(){ double x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ll A=ii();
    ll B=ii();
    ll C=ii();
    ll D=ii();

    while(1){
        C-=B;
        if(C<=0){
            ose("Yes");
            return 0;
        }
        A-=D;
        if(A<=0){
            ose("No");
            return 0;
        }
    }
 
    return 0;
}

Measured memory_bytes: 3628
#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;
typedef long long ll;
typedef pair<int,int> pii;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,  //less_equal
             tree_order_statistics_node_update> oset; 
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int MAXK = 2e3 + 2;
#define sz(x) (int)(x).size()
#define f first




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

priority_queue<long double,vector<long double> , greater<long double > > pq;

int n;
cin >> n;
for(int i = 0 ;i < n ; i++)
{
	long double x;
	cin >> x;
	pq.push(x);
}

while(sz(pq) > 1)
{
	long double x = pq.top();
	pq.pop();
	long double y = pq.top();
	pq.pop();
	pq.push((x + y) / 2.0);
}

cout << pq.top();
 


}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    double x,a,b;
    long long cnt=0;
    cin>>x;
    a=100;
    b=0.01;
    while(a<x)
    {
        long long c=a*b;
        a+=c;
        cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3716
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

namespace AtCoderSolve
{
    class Solve
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            int N = int.Parse(Console.ReadLine());
            int A = int.Parse(Console.ReadLine());
            Console.WriteLine(N * N - A);

            Console.Out.Flush();
        }
    }



    public class Calculation
    {
        
    }
}


Measured memory_bytes: 11092
#include<stdio.h>

int max(int a, int b) {

  if (a>b)
    return a;
  else
    return b;
}

int lcs(char *x, char *y){

  int i, j, xlen=0, ylen=0, c[1001][1001],maxl=0;


  while (x[xlen])
    xlen++;

  while (y[ylen])
    ylen++;

  for (i=1; i<=xlen; i++)
    c[i][0]=0;

  for (i=1; i<=ylen; i++)
    c[0][i]=0;


  for(i=1; i<=xlen; i++)
    for(j=1; j<=ylen; j++){
      if (x[i-1] == y[j-1])
        c[i][j]=c[i-1][j-1]+1;
      else
        c[i][j]=max(c[i][j-1], c[i-1][j]);
      maxl=max(maxl, c[i][j]);
  }

return maxl;
}

int main() {

  char x[1001], y[1001];
  int i=0, p, ans[200];

  scanf("%d", &p);

  for (i=0; i<p; i++){
    scanf("%s", x);
    scanf("%s", y);

    ans[i]=lcs(x, y);

  }
  for (i=0; i<p; i++)
    printf("%d\n", ans[i]);


  return 0;
}

Measured memory_bytes: 4512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int n;
  cin >> n;
  vpii a(n);
  rep(i,n){
    int p,q;
    cin >> p >> q;
    a[i] = make_pair(p+q,p-q);
  }
  //rep(i,n) cout << a[i].first << endl;
  sort(ALL(a));
  int right = 0;
  int cnt = 0;
  rep2(i,1,n){
    //cout << i << " "  << a[i].second << " " << a[right].first << endl;
    if(a[i].second<a[right].first){
      cnt++;
    }
    else right = i;
  }
  cout << n-cnt << endl;
}






Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a,b,c;
    cin>>a>>b;
    if(b%a==0)
    c=a+b;
    else
    c=b-a;
        cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 3584
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"--------------------------"<<endl; 
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e18;
#define PI 3.14159265
 
const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin >> n;
    n = n % 1000;
    if(n == 0){
        cout << 0 << endl;
    }
    else{
        cout << 1000 - n << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long a, b, c, ans;
	cin >> a >> b >> c;
	ans = min(a * b, min(b * c, c * a));
	if ((a % 2 == 0) || (b % 2 == 0) || (c % 2 == 0)) ans = 0;
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
#include<deque>
#include<iostream>

int main()
{
	unsigned long long a = 0;
	unsigned long long b = 0;
	std::cin >> a >> b;
	if (a < b)
	{
		a = a ^ b;
		b = a ^ b;
		a = a ^ b;
	}
	auto check_prime = [](const unsigned long long target)
	{
		if (1 == target)
		{
			return false;
		}
		for (unsigned long long integer = 2; target >= integer * integer; ++integer)
		{
			if (0 == target % integer)
			{
				return false;
			}
		}
		return true;
	};
	unsigned long long number = 1;
	for (unsigned long long integer = 2
		; a >= integer && b >= integer
		&& (a >= integer * integer || b >= integer * integer)
		; ++integer)
	{
		if (0 == a % integer)
		{
			if (0 == b % integer)
			{
				if (check_prime(integer))
				{
					number += 1;
				}
			}
			const unsigned long long pair = a / integer;
			if (pair > integer && 0 == b % pair)
			{
				if (check_prime(pair))
				{
					number += 1;
				}
			}
		}
	}
	if (a == b && check_prime(a) && check_prime(b))
	{
		number += 1;
	}
	std::cout << number;
    return 0;
}

Measured memory_bytes: 256
R, G, B, n = map(int, input().split())
cnt = 0
for r in range(n//R+1):
    for g in range((n-r*R)//G+1):
        b = (n-r*R-g*G)//B
        if r * R + g * G + b * B == n:
            cnt += 1

print(cnt)

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

int main(){
	int n,x,y;
	cin>>n;
	for(int i=1;i<=n;i++){
		x=i;
		if(x%3==0){
				cout<<" "<<i;
				continue;
			}
			if(x%10==3){
				cout<<" "<<i;
				continue;
			}
		for(x;x>1;x/=10){
			if(x%10==3){
				cout<<" "<<i;
				break;
			}
		}
	}
	cout<<endl;
	return 0;
}

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

int main(void){
    int i,j,n,w;
    char h;
    int cards[4][13];
    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
            cards[i][j] = j+1;
        }
    }
    
    cin >> n ;
    for (i=0; i<n; i++) {
        cin >> h >> w;
        if (h=='S') cards[0][w-1]= NULL;
        if (h=='H') cards[1][w-1]= NULL;
        if (h=='C') cards[2][w-1]= NULL;
        if (h=='D') cards[3][w-1]= NULL;
    }
    
    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
            if(cards[i][j]!=NULL)
                switch (i) {
                    case 0:cout << "S " << cards[0][j]<< "\n";break;
                    case 1:cout << "H " << cards[1][j]<< "\n";break;
                    case 2:cout << "C " << cards[2][j]<< "\n";break;
                    case 3:cout << "D " << cards[3][j]<< "\n";break;
                }
        }
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    string S; cin >> S;
    map<char, int> M;
    rep(i,N) M[S[i]]++;
    int anum = M.size();
    int MOD = 1000000007;

    ll res = 1;
    for (auto [k,v] : M) {
        res *= v + 1;
        res %= MOD;
    }
    res = (res - 1) % MOD;
    cout << res << endl;
}


Measured memory_bytes: 3688
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(int i = 0; i < N; ++i)
#define REEP(i, N) for(int i = N - 1; i >= 0; --i)
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,m,n) for(int i = m; i < n; ++i)
#define RFOR(i,m,n) for(int i = n - 1; i >= m; --i)
#define CIN(a) cin >> a
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, b, c) cin >> a >> b >> c
#define COUT(a) cout << a << endl
#define COUT2(a, b) cout << a << " " << b << endl
#define COUT3(a, b, c) cout << a << " " << b << " " << c << endl
#define pb push_back
#define PB push_back
#define VINT(v, n) vector<int> v(n); REP(i, n) { v[i] = 0 }
#define VINT2(v, n, m) vector<vector<int> > v(n, vector<int>(m)); REP(i, n) { REP(j, m) { v[i][j] = 0 } }
#define VCHAR(v, n) vector<char>v(n)
#define KIRIAGE(a, b) a += (b - a % b) % b
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;}
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef long long ll;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
	int H, W;
	CIN2(H, W);
	vector<vector<char> > v(H, vector<char>(W));
	REP(i,H) {
		REP(j, W) {
			CIN(v[i][j]);
		}
	}
	REP(i, H * 2) {
		REP(j, W) {
			cout << v[i / 2][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256