akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<pll, ll> > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define all(v)  (v).begin(), (v).end()
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
// #define MOD 1000000007
#define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) (ll)v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
// using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}

ll dp[3005][3005];

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
        ll a, b, c, d;
        cin>>a>>b>>c>>d;
        dp[a][b] = 1;
        foi(i, a, c+1){
            foi(j, b, d+1){
                if(i == a && j == b)    continue;
                dp[i][j] = (((i*dp[i][j-1] + j*dp[i-1][j] - (i-1)*(j-1)*dp[i-1][j-1])%MOD)+MOD)%MOD;
            }
        }
        cout<<dp[c][d];
    }
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  std::string s1, s2, s3;
  std::cin >> s1 >> s2 >> s3;
  std::cout << "A" << s2.front() << "C" << std::endl;
  return 0;
}


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

#include <iostream>
using namespace std;

int main() {
	int n,k;cin>>n>>k;
	int count=1;
	for(int i=0;i<n;i++){
		count=min(count*2,count+k);
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#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(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n;
  cin >> n;

  vector<int> x(n);
  REP(i,n) cin >> x[i];
  
  int min = INF;

  REP(i,100){
    int t = 0;
    REP(j,n){
      t += pow(x[j] - i, 2);
    }
    if(min >= t) min = t;
  }

  cout << min << endl;

  return 0;
}

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

using namespace std;

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

    int res = 0;
    for (int i = (s.size() - 1) / 2; i > 0; i--) {
        for (int j = 0; j < i; j++) {
            if (s[j] != s[i + j]) {
                break;
            } else if (j == i - 1) {
                res = 2 * i;
                goto out;
            }
        }
    }

out:
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int  solve(int n,int k){
    if(n==0 && k==0){
        return 1;
    }
    if(n!=0 && k==0){
        return 0;
    }
    if(n==0 && k!=0){
        return 0;
    }
    if(k%2!=0){
        return 0;
    }
    if(n==1){
        if(k>4){
            return 0;
        }
        else {
            return 1;
        }
    }
    if(n*2==k){
        return 1;
    }
    if(n*4==k){
        return 1;
    }
    while(n*2!=k && n>0){
        k-=4;
        n-=1;
    }
    if(n*2==k){
        return 1;
    }
    return 0;
}
signed main(){
    int n,x;
    cin>>n>>x;
    if(solve(n,x)){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}

Measured memory_bytes: 3560
#include <iostream>
#include <stack>
#include <string>

using namespace std;

int main ( void ){
	string left = "qwertasdfgzxcvb";
	string inputs;
	while(1){
		cin >> inputs;
		if(inputs.at(0)=='#') break;
		stack<char> seq;
		int cnt=0;
		for( int i=0;i<inputs.length();i++){
			char pos;
			//文字列が左手で打つなら posにr 左手なら l
			if(left.find(inputs.at(i))!=-1)	pos='r';
			else pos='l';
			//最後に打った手がposと違うならカウントアップ
			if(seq.size()!=0 && seq.top()!=pos)	cnt++;
			//スタックに今打った手を積む
			seq.push(pos);
		}
		//結果の出力
		cout << cnt << endl;
	}
}

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

int N;
int A[200000];
int B[200000];

int compare(const void* a, const void* b){
    return *(int*)b - *(int*)a;
}

int main(void){
    scanf("%d", &N);
    for(int i=0; i<N; i++){
        scanf("%d", &A[i]);
        B[i] = A[i];
    }

    qsort(A, N, sizeof(int), compare);

    int first = A[0];
    int second = A[1];

    for(int i=0; i<N; i++){
        if(B[i] == first){
            printf("%d\n", second);
        }else{
            printf("%d\n", first);
        }
    }

    return 0;
}

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

// mod の処理を忘れさせてくれるライブラリ
// https://github.com/atcoder-live/library/blob/master/mint.cpp
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0):x((x % mod + mod) % mod) {}
  mint operator-() const {return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

// n_C_kを求めるライブラリ
// mint.cppが必要
// https://github.com/atcoder-live/library/blob/master/combination.cpp
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
      fact[i] = fact[i-1] * i;
    }
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; i--) {
      ifact[i-1] = ifact[i] * i;
    }
  }
  mint operator()(int n, int k){
    if (k < 0 || k > n) {
      return 0; 
    } else {
      return fact[n] * ifact[k] * ifact[n-k];
    }
  }
};

int main() {

  int X, Y;
  cin >> X >> Y;

  // X + Y が 3 の倍数じゃ無いとダメ
  if ((X+Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  
  // X:Y が 2:1 または 1:2 じゃないとダメ
  int n = (X + Y) / 3;
  X -= n;
  Y -= n;
  if (X < 0 || Y < 0) {
    cout << 0 << endl;
    return 0;
  }

  // combinationの初期化
  // n を N よりちょっと多めに
  combination c(X+Y);

  // n_C_x mod p が全部で何通りあるかを計算する
  mint answer = c(X+Y, X);

  cout << answer.x << endl;

  return 0;

}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i = 0; i < N; ++i) {
    cin >> l[i];
  }
  sort(l.begin(), l.end(), greater<int>());
  int result = 0;
  for (int i = 0; i < K; ++i) {
    result += l[i];
  }
  cout << result << endl;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<vector<int>> plan(n,vector<int>(3));
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 3; j++){
      cin >> plan.at(i).at(j);
    }
  }
  
  bool ans=true;

  int nx=0;
  int ny=0;
  int nt=0;

  for (vector<int> v: plan){
    int t=v.at(0);
    int x=v.at(1);
    int y=v.at(2);

    if(t-nt<abs(x-nx)+abs(y-ny)||(t-nt)%2!=(abs(x-nx)+abs(y-ny))%2){
      cout << "No" << endl;
      ans=false;
      break;
    }

    nx=x;
    ny=y;
    nt=t;
  }

  if(ans){
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 8732
require 'prime'

P = []
M = 5*10**4
Prime.each(M).each{|prime|
  wk = 2 * prime - 1
  P << wk if wk.prime?
}
ans = Array.new(M+1)
wk = 0
(0..M).each{|i|
  if (not P.empty?) && (P[0] + 1)/2 == i then
    wk += 1
    P.shift
  end
  ans[i] = wk
}

gets.to_i.times{
  l, r = gets.chomp.split(" ").map(&:to_i)
  puts ans[(r+1)/2] - ans[(l+1)/2-1]
}


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

int main()
{
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    float max_density = 0.0;
    int max_water = 0, max_sugar = 0;

    for (int i = 0; i <= 30; i++) {  //A
        if (A * i * 100 > F) break;

        for (int j = 0; j <= 30; j++) {  //B
            int water = 100 * (A * i + B * j);
            if (water > F) break;
            int sugar_limit = (A * i + B * j) * E;

            for (int k = 0; k <= 3000; k++) {    //C
                if (water + k * C > F) break;
                if (k * C > sugar_limit) break;

                for (int l = 0; l <= 3000; l++) {    //D
                    int sugar = k * C + l * D;
                    if (water + sugar > F) break;
                    if (sugar > sugar_limit) break;

                    float density = float(sugar * 100) / (sugar + water);
                    if (density > max_density) 
                    {
                        max_density = density;
                        max_water = water;
                        max_sugar = sugar;
                    }

                }
            }
        }
    }
    if (max_water == 0) max_water += 100 * A;
    cout << max_water + max_sugar << " " << max_sugar << endl;

    return 0;
}

Measured memory_bytes: 256
(function(input) {
    var a = parse(input);
    a = a.map(function(e) { return e.map(Number); });
    var rooms = makeRooms();
    for (var i = 1; i < a.length; i++) {
        var args = a[i];
        var b = args[0];
        var f = args[1];
        var r = args[2];
        var v = args[3];
        rooms[b - 1][f - 1][r - 1] += v;
    }
    for (var i = 0; i < rooms.length; i++) {
        if (i !== 0) {
            console.log(Array(21).join('#'));
        }
        var b = rooms[i];
        for (var j = 0; j < b.length; j++) {
            var f = b[j];
            console.log(' ' + f.join(' '));
        }
    }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function parse(str, sep, ter) {
    sep = sep || ' ';
    ter = ter || '\n';
    str = str.replace(/\n$/, '');
    var a = str.split(ter);
    for (var i = 0; i < a.length; i++) {
        a[i] = a[i].split(sep);
    }
    return a;
}

function makeRooms() {
    a = [];
    for (var i = 0; i < 4; i++) {
        var b = [];
        for (var j = 0; j < 3; j++) {
            var f = [];
            for (var k = 0; k < 10; k++) {
                f.push(0);
            }
            b.push(f);
        }
        a.push(b);
    }
    return a;
}

Measured memory_bytes: 8504
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    cin>>n;
    if(n==1)
    {
        cout<<"Hello World"<<endl;
    }
    else
    {
        ll a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    
}
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
	int V,n;
	cin>>V>>n;
	int f[100005],w[10005],v[10005];
	for(int i=0;i<V;i++)
        f[i]=1e8;
	for(int i=0;i<n;i++)
		cin>>w[i]>>v[i]; 
	for(int i=0;i<n;i++)
		for(int j=0;j<V;j++)
			f[j] = min(f[j], f[j - w[i]] + v[i]);
	cout<<f[V-1];
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
#define rep(i,x,y) for(int i=x;i<y;i++)

using namespace std;
int main(){
  int n; cin>>n;
  vector<int>a(n); 
  rep(i,0,n){
    cin>>a[i];
  }
  a.erase(unique(a.begin(),a.end()),a.end());
  rep(i,0,a.size()-1){
    cout<<a[i]<<" ";
  }
  cout<<a[a.size()-1]<<endl;
  return 0;
}


Measured memory_bytes: 3100
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = [input() for _ in range(N)]

print(len(set(S)))


Measured memory_bytes: 36672
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int h[n+1];
  for(int i=1;i<=n;i++) cin>>h[i];
  bool good[n+1];
  memset(good,true,sizeof good);
  int a,b;
  for(int i=1;i<=m;i++){
    cin>>a>>b;
    if(h[a]>h[b]) good[b]=false;
    else if(h[a]<h[b]) good[a]=false;
    else if(h[a]==h[b]) {good[a]=false;good[b]=false;}
  }
  int cnt=0;
  for(int i=1;i<=n;i++) if(good[i]) cnt++;
  cout<<cnt;
}

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

#define read(num) scanf("%d", &num)
#define readll(num) scanf("%lld", &num)
#define read2(num1, num2) scanf("%d%d", &num1, &num2)
#define read3(num1, num2, num3) scanf("%d%d%d", &num1, &num2, &num3)
#define reads(str) scanf("%s", str)
#define readc(ch) scanf("%c", &ch)

#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define vi vector<int>
#define ll long long

int need[2001][10];
vector<vector<int>>dp;

int main()
{
       unordered_map<string ,int>c;
       int n;
       cin>>n;
       string s;
       int co=0;
       for(int i=0;i<n;i++){
           cin>>s;
           c[s]++;
           if(c[s]==1){
               co++;
           }
       }
       cout<<co;
}

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

int main(){
  while(1){
    int H, W;
    cin>>H>>W;
    if(H == 0 && W == 0) break;

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if(i == 0 || i == H - 1 || j == 0 ||j == W - 1) cout<<"#";
        else cout<<".";
      }
      cout<<endl;
    }

    cout<<endl;
  }

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const long long MOD = 1000000007;
const double EPS = 1e-9;

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

  string S;
  cin >> S;
  int n = S.length();

  static long long unsigned int dp[100005][13];
  dp[0][0] = 1;

  REP(i, n) {
    int c;
    if (S[i] == '?') c = -1;
    else c = S[i] - '0';

    REP(j, 10) {
      if (c != -1 && c != j) continue;
      REP(ki, 13) {
        (dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]) %= MOD;
      }
    }
  }

  cout << dp[n][5] << endl;
  return 0;
}


Measured memory_bytes: 10704
/**
*    created: 02.08.2020 21:00:55
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#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(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(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;}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dx2[8] = {0, 1, 0, -1, 1, 1,-1, -1};
const int dy2[8] = {1, 0,-1, 0, 1, -1, 1, -1};
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, d; cin >> n >> d;
    int cnt = 0;
    rep(i,n) {
        int a, b; cin >> a >> b;
        if (a * a + b * b <= d * d) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
	long a[10000], n;
	long min=0, max=0, sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		if(i==0){
			sum=min=max=a[i];
		}else{
			if(min>a[i])min=a[i];
			if(max<a[i])max=a[i];
		}
	}
	cout << min << ' ' << max << ' ' << sum << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n, k; cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    for (int i = 0; i < k; ++i) {
        // いもす法
        vector<int> b(n + 1); // 半開区間で考える

        for (int j = 0; j < n; ++j) {
            b[max(j - a[j], 0)]++;
            b[min(j + a[j] + 1, n)]--;
        }

        for (int j = 0; j < n; ++j) {
            b[j + 1] += b[j];
        }

        b.pop_back();

        a = b;
        bool brk = true;
        for (int j = 0; j < n; ++j) {
            if (b[j] != n) {
                brk = false;
                break;
            }
        }

        if (brk) break;
    }

    for (int i = 0; i < n; ++i) {
        cout << a[i] << ' ';
    }

    cout << endl;
}

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

vector<int> v(1000005, 0);

bool enum_divisors(long long N) {
    bool res = true;

    if (N != 1 && v[1] > 0) res = false;
    if (v[N] > 1) res = false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) {
            if (v[i] > 0 || v[N / i] > 0) {
                res = false;
                break;
            }
        }
    }

    return res;
}

int main() {
    long long N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
        ++v[A[i]];
    }

    ll ans = 0;
    rep(i, N) if (enum_divisors(A[i]))++ ans;

    cout << ans << endl;
}


Measured memory_bytes: 8636
from collections import deque
H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]

s = (0,0)
g = (H-1,W-1)

ans = 0
task = deque([(s,0)])
visited = [[0 for _ in range(W)] for _ in range(H)]
visited[s[0]][s[1]] = 1
flag = False
while task:
  p, c = task.popleft()
  x = p[0]
  y = p[1]
  if p == g:
    ans = c
    flag = True
    break 
  if x >= 1 and visited[x-1][y] == 0 and M[x-1][y] == ".":
    visited[x-1][y] = 1
    task.append(((x-1,y),c+1))
  if y >= 1 and visited[x][y-1] == 0 and M[x][y-1] == ".":
    visited[x][y-1] = 1
    task.append(((x,y-1),c+1))
  if x <= H-2 and visited[x+1][y] == 0 and M[x+1][y] == ".":
    visited[x+1][y] = 1
    task.append(((x+1,y),c+1))
  if y <= W-2 and visited[x][y+1] == 0 and M[x][y+1] == ".":
    visited[x][y+1] = 1
    task.append(((x,y+1),c+1))     

point = H*W -sum([M[i].count("#") for i in range(H)]) - ans -1
print(point if flag else -1)

Measured memory_bytes: 68376
#include <iostream>
#include <cstring>
using namespace std;
int board[1000],dice[1000];
int main(){
	int n,m,now;
	while(cin >> n >> m,n){
		now = 1;
		memset(board,0,sizeof(board));
		memset(dice,0,sizeof(dice));
		for(int i = 0;i < n;++i){
			cin >> board[i];
		}
		for(int i = 0;i < m;++i){
			cin >> dice[i];
		}
		for(int i = 0;i < m;++i){
			now += dice[i];
			if(n <= now) {
				cout << i + 1 << endl;
				break;
			}
			now += board[now - 1];
			if(n <= now) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1168
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])


print("Even" if (a*b)%2==0 else "Odd")




Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N, kazu, K;
int A[18], B[18], onaji[18];
unsigned char dp[36][1 << 18];
int keisan(int b, bool n, int k) {
	if (dp[k][b] != 255) return dp[k][b];
	if (b == (1 << N) - 1) return 0;

	int saishou = 254;
	int num2 = 0;
	int used = 0;
	auto a = n ? B : A;

	rep(i, N) {
		if (!(b >> i & 1)) {
			if (A[i] < k && B[i] < k) return dp[k][b] = 254;
			if (a[i] >= k && !(used >> onaji[i] & 1)) {
				chmin(saishou, keisan(b ^ (1 << i), !n, a[i]) + num2);
				used ^= 1 << onaji[i];
			}
			num2++;
		}
	}
	return dp[k][b] = saishou;
}

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


	scanf("%d", &N);
	rep(i, N) {
		if (i & 1) scanf("%d", B + i);
		else scanf("%d", A + i);
	}
	rep(i, N) {
		if (i & 1) scanf("%d", A + i);
		else scanf("%d", B + i);
	}

	rep(i, N) {
		int atta = -1;
		rep(j, i) {
			if (A[i] == A[j] && B[i] == B[j]) {
				atta = j;
				break;
			}
		}
		if (atta != -1) onaji[i] = onaji[atta];
		else onaji[i] = kazu++;
	}

	pair<int, int> kari[36];
	rep(i, N) kari[i] = mp(A[i], i);
	rep(i, N) kari[i + N] = mp(B[i], i + N);
	sort(kari, kari + N * 2);
	int mae = kari[0].first;
	rep(i, N * 2) {
		if (mae != kari[i].first) K++;
		mae = kari[i].first;
		if (kari[i].second < N) A[kari[i].second] = K;
		else B[kari[i].second - N] = K;
	}
	memset(dp[0], 255, (K + 1) * (1 << 18));

	int kotae = keisan(0, 0, 0);
	if (kotae == 254) printf("-1\n");
	else printf("%d\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 8320
import sys
input=sys.stdin.readline
from collections import deque
n=int(input())
Edges=[[] for _ in range(n)]
Cnt=[0]*n
for _ in range(n-1):
    a,b=map(int,input().split())
    Edges[a-1].append(b-1)
    Edges[b-1].append(a-1)
C=list(map(int,input().split()))
C.sort()
print(sum(C)-C[-1])
Used=[False]*n
for i,e in enumerate(Edges):
    if len(e)==1:
        start=i
        break
Ans=[0]*n
q=deque()
q.append(start)
Used[start]=True
while q:
    v=q.popleft()
    Ans[v]=C.pop()
    for u in Edges[v]:
        if not Used[u]:
            Used[u]=True
            q.append(u)
print(*Ans)

Measured memory_bytes: 46704
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int MN=2e5+5;
int n,d,m,N;
int id[MN],x[MN],a[MN],rt[MN];
#define lowbit(x) (x&-x)
ll t[MN*2],b[MN*2];
inline void update(int x,ll v){while(x<=N)t[x]+=v,x+=lowbit(x);}
inline void update(int l,int r,ll v){update(l,v);update(r+1,-v);}
inline ll query(int x){reg ll res=0;while(x)res+=t[x],x-=lowbit(x);return res;}
int main(){
	scanf("%d%d%d",&n,&d,&m);
	for(reg int i=1;i<=n;i++){
		scanf("%d%d",x+i,a+i);
		b[++N]=x[i];
		b[++N]=1ll*x[i]+d+d;
		a[i]=a[i]/m+(a[i]%m!=0);
	}
	sort(b+1,b+1+N);N=unique(b+1,b+1+N)-b-1;
	for(reg int i=1;i<=n;i++){
		rt[i]=lower_bound(b+1,b+1+N,1ll*x[i]+d+d)-b;
		x[i]=lower_bound(b+1,b+1+N,x[i])-b;
	}
	for(reg int i=1;i<=n;i++)id[i]=i;
	sort(id+1,id+1+n,[](int a,int b){
		return x[a]<x[b];
	});
	reg ll Ans=0;
	for(reg int t=1,i;t<=n;t++){
		i=id[t];
		reg ll res=a[i]-query(x[i]);
		if(res<=0)continue;
		Ans+=res;update(x[i],rt[i],res);
	}
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
int main(void){
    int r,c,i,j,sum;
    int data[101][101];
    
    scanf("%d %d",&r,&c);
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            scanf("%d",&data[i][j]);
        }
    }
    
    for(i=0;i<r;i++){
        sum=0;
        for(j=0;j<c;j++){
            sum+=data[i][j];
        }
        data[i][c]=sum;
    }
    for(i=0;i<=c;i++){
        sum=0;
        for(j=0;j<r;j++){
            sum+=data[j][i];
        }
        data[r][i]=sum;
    }
    
    for(i=0;i<=r;i++){
        for(j=0;j<=c;j++){
            if(j) printf(" ");
            printf("%d",data[i][j]);
        }
        printf("\n");
    }
    return(0);
}



Measured memory_bytes: 2044
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String num = br.readLine();
		int num1 = Integer.parseInt(num);
		num = br.readLine();
		int num2 = Integer.parseInt(num);
		num1=num1*num1;
		num1=num1-num2;
		System.out.println(num1);
	}

}

Measured memory_bytes: 22740
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
	  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
	   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
		   # #  # # #                   # #      ###### #    # #    # #      #####
	  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
	   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LL i = 0; i < (n); i++)
#define FOR(in) for(LL i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 
 
LL concate(LL a, LL b)
{
	ostringstream os;
	os <<a <<b;
	istringstream is(os.str());
	LL c;
	is>> c;
	return c;
}
 
 
LL check(char c)
{
	return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
LL mod = 1e9+7;
 
 
int main()
{
	//LL q,t;
	//cin>>t;
	//while(t--)
	//{
	   LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
		LL aa[1000];
		LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
		LL ma=0, mi=100000000;
		LL mid=0, temp=0, stop=0, start=0;
		double pi= 3.141592653589793;
		double d1=0.0, d2, d3, d4;
		VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
		VS vs, vs1, vs2, vs3, vs4;
		VP vp, vp1,vp2;
		char ch, ch1, ch2[1001];
		string str, str1, str2, str3, str4, str5;
		pair<LL, LL> pa;
		list<LL> li, li1;
		map<LL, LL> mp, mp1;
		set<LL> st;
		map<LL ,LL> :: iterator imll;
		VLL :: iterator ivll;
		set<LL> :: iterator isll;
		VP :: iterator ivp;
 
		
		cin>>a>>b>>c;
		if(c>=a && c<=b)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		
		
	exit()
 
 
}


Measured memory_bytes: 3628
import math
N = int(input())

#Nの桁数
a = int(math.log10(N))
count = 0

for x in range(1, N+1):
    # yはxの桁数
    y = int(math.log10(x) + 1)
    if y % 2 == 1:
        count += 1

print(count)

Measured memory_bytes: 3060
char buf[1100000];
sz;
T;
main()
{
	read(0,buf,1100000);
	while(buf[sz++]&16);
	while(buf[sz]&16)
	{
		while(buf[sz]&16)sz++;
		T^=buf[sz++-1]&1;
	}
	write(1,T?"NO\n":"YES",3);
}


Measured memory_bytes: 1152
//K = |S|, |S| - 1…のときの「必ず反転する区間」に注目すると、ここは全て同じ数である必要がある。
//実験すると、ここが同じ数であれば、他の部分は何でもOKっぽい。（未証明）
//たぶんO(N)で解けるけど、面倒くさいのでKを2分探索して解く。O(NlogN)
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string s;

bool check(int k) {
	int l = s.length() - k;
	int r = k;
	
	//区間[l, r)が同じ値かを調べる
	for (int i = l + 1; i < r; i++) {
		if (s[i - 1] != s[i]) {
			return false;
		}
	}
	return true;
}

int main() {
	cin >> s;
	
	int st = 1, ed = s.length() + 1, mid; //oooxxx, [st, ed)
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		if (check(mid)) { st = mid; }
		else { ed = mid; }
	}
	cout << st << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define cy cout<<"Yes"
#define cn cout<<"No"
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7
#define LINF 1e18+10  
using ll = long long; 

using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
using Ps=pair<int,string>;

using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

//const ll mod=998244353;
const ll mod=1e9+7;
const ll MAX=300000;

//////////////////////////////////////

int main(){

    int n;
    cin>>n;
    if(n>=30)cy;
    else cn;
    return 0;

}

Measured memory_bytes: 3596
function Main(input){
	input = input.split("\n");
    nums = input.map(input=>parseInt(input,10))
    var A = nums[1];
    var B = nums[2];
  
	if(nums[0] === 1){
		console.log("Hello World");	
	}else{
        console.log(A+B);        
	}
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  if (S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" || S == "hihihihihi"){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

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

using namespace std;

typedef long long ll;

const int MAX_N = 55;
const ll INF = 1e10;

int N, X, D, V[MAX_N], P[MAX_N];
ll M[MAX_N];

struct Item {
    int v, n;
    ll c;
    Item() {}
    Item(int v, ll c, int n) : v(v), c(c), n(n) {}

    bool operator<(const Item &rhs) const {
        return c * rhs.v < rhs.c * v;
    }
} items[MAX_N];

ll F[MAX_N][MAX_N * MAX_N * MAX_N];

int main() {
    scanf("%d%d%d", &N, &X, &D);
    for (int i = 1; i <= N; i++) {
        scanf("%lld", &M[i]);
        if (i > 1) scanf("%d", &P[i]);
        V[i] = 1;
    }
    for (int i = N; i > 1; i--) {
        V[P[i]] += V[i];
        M[P[i]] += M[i];
    }
    for (int i = 1; i <= N; i++) items[i] = Item(V[i], M[i], i == 1 ? X / M[i] : min(int(X / M[i]), D));
    sort(items + 1, items + N + 1);
    fill_n(&F[0][0], sizeof(F) / sizeof(ll), INF);
    F[0][0] = 0;
    int tot = 0;
    for (int i = 1; i <= N; i++) {
        int cnt = min(N, items[i].n);
        items[i].n -= cnt;
        tot += N * items[i].v;
        for (int j = 0; j < items[i].v; j++) {
            list<pair<int, ll>> que;
            for (int k = j; k <= tot; k += items[i].v) {
                pair<int, ll> t = make_pair(k / items[i].v, F[i - 1][k] - (k / items[i].v) * items[i].c);
                while (!que.empty() && t.second <= que.back().second) que.pop_back();
                que.push_back(t);
                while (t.first - que.front().first > cnt) que.pop_front();
                F[i][k] = min(F[i][k], que.front().second + k / items[i].v * items[i].c);
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i <= tot; i++) {
        ll cap = X - F[N][i], cnt = i;
        if (cap < 0) continue;
        for (int j = 1; j <= N; j++) {
            int t = min(items[j].n, int(cap / items[j].c));
            cap -= t * items[j].c; cnt += t * items[j].v;
        }
        ans = max(ans, cnt);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 71680
from collections import deque
from itertools import product

H, W = map(int, input().split())
maze = [input() for _ in range(H)]
V = []
E = {}
for i, j in product(range(H), range(W)):
    if maze[i][j] == '#': continue
    V += [(i, j)]
    check = [(i+dx, j+dy) for dx, dy in [(1, 0), (0, 1)] if i+dx <= H-1 and j+dy <= W-1]
    for x, y in check:
        if maze[x][y] == '.':
            E.setdefault((i, j), [])
            E.setdefault((x, y), [])
            E[(i, j)].append((x, y))
            E[(x, y)].append((i, j))

def bfs(s):
    q = deque([(s, 0)])
    dist = {v: -1 for v in V}
    while q:
        v, d = q.popleft()
        if dist[v] >= 0: continue
        dist[v] = d
        for u in E[v]:
            if dist[u] < 0:
                q.append((u, d+1))
    return dist

ans = 0
for v in V:
    dist = bfs(v)
    ans = max(ans, max(dist.values()))
print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n,a[100010],ans;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(i==0){
			ans+=a[i]-1;
			a[i]=1;
		}
		else{
			if(a[i]==a[i-1]+1){
				a[i]=a[i-1]+1;
			}
			else{
				if(a[i]%(a[i-1]+1)==0){
					ans+=a[i]/(a[i-1]+1)-1;
				}
				else{
					ans+=a[i]/(a[i-1]+1);
				}
				a[i]=a[i-1];
			}
			
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	
// 左の子、自分、右の子で値が最大のノードを選ぶ
	if ( l <= H && A[l] > A[i] ) largest = l;
	else largest = i;
	if ( l <= H && A[r] > A[largest] ) largest = r;
	
	if ( largest != i ){
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

	
	int extract(){
		int maxv;
		if(H < 1)return -INFTY;
		maxv = A[1];
		A[1] = A[H--];
		maxHeapify(1);
		return maxv;
	}
	
	void increaseKey(int i, int key){
		if(key < A[i])return;
		A[i] = key;
		while (i>1 && A[i/2] < A[i]){
			swap(A[i], A[i/2]);
			i = i/2;
		}
	}
	
	void insert(int key){
		H++;
		A[H] = -INFTY;
		increaseKey(H, key);
	}
	
	int main(){
		int key;
		char com[10];
		
		while(1){
			scanf("%s",com);
			if(com[0]=='e' && com[1] == 'n' )break;
			if(com[0]=='i'){
				scanf("%d", &key);
				insert(key);
			}else{
				printf("%d\n",extract());
			}
		}
		return 0;
	}
	








Measured memory_bytes: 6496
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

const int MOD = 1000 * 1000 * 1000 + 7;
int mod(int n) {
    n %= MOD;
    if (n < 0) return n + MOD;
    else return n;
}   
int fp(int a, int p) {
    int ans = 1, c = a;
    for (int i = 0; (1ll << i) <= p; ++i) {
        if ((p >> i) & 1) ans = mod(ans * c);
        c = mod(c * c);
    }   
    return ans;
}   
int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); }

const int N = 1e5 + 7;
int a[N];
int inv[N];

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    for (int i = 0; i < N; ++i)
        inv[i] = fp(i, MOD - 2);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int ans = 0, cur = 0;
    for (int i = 1; i < n; ++i) {
        cur += inv[i];
        cur %= MOD;
        int len = a[i] - a[i - 1];
        ans += len * cur;
        ans %= MOD;
    }   
    for (int i = 1; i <= n - 1; ++i)
        ans = ans * i % MOD;
    cout << ans << '\n';
}   

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

bool chmax(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	char S[4];
	scanf("%s", S);
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == 'R') {
			cnt++;
		} else {
			cnt = 0;
		}
		chmax(ans, cnt);
	}
	printf("%d\n", ans);
}


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


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

    cout<<"ABC"+s<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>

 using namespace std;
 typedef long long ll;

int main(void){
ll H,W;
cin >> H >> W;
if(H == 1 || W == 1){
cout << 1 << endl;
} else {
cout << (H * W + 1) / 2 << endl;
}
return 0;
 }

Measured memory_bytes: 256
import heapq


UNVISITED = -1

def construct_incidence_list(tail, head):
    n=2500*N
    m=len(head)

    edge_first = [0] * n
    edge_next = [0] * m

    for i in range(m, 0, -1):
        v = tail[i-1]
        edge_next[i-1] = edge_first[v-1]
        edge_first[v-1] = i

    return edge_first, edge_next


def main():
    tail=[]
    head=[]
    length=[]
    for i in range(M):
      u,v,a,b=map(int,input().split())
      for j in range(2499,a-1,-1):
        tail.append(2500*(u-1)+j)
        head.append(2500*(v-1)+j-a)
        length.append(b)
        head.append(2500*(u-1)+j-a)
        tail.append(2500*(v-1)+j)
        length.append(b)
    for i in range(N):
      c,d=map(int,input().split())
      for j in range(2499):
        tail.append(2500*(i)+j)
        head.append(2500*(i)+min(j+c,2499))
        length.append(d)

    start = min(S,2499)

    edge_first, edge_next = construct_incidence_list(tail, head)
    
    n = 2500*N
    distance = [0] * (n+1)
    path = [0] + [UNVISITED for v in range(1, n+1)]
    distance[start] = 0
    path[start] = 0
    hq = [(0, start)]
    heapq.heapify(hq)

    while len(hq) > 0:
        _, v1 = heapq.heappop(hq)

        edge_to_v2 = edge_first[v1-1]
        while edge_to_v2 != 0:
            v2 = head[edge_to_v2-1]
            dist_candidate = distance[v1] + length[edge_to_v2-1]
            if path[v2] == UNVISITED or distance[v2] > dist_candidate:
                distance[v2] = dist_candidate
                path[v2] = edge_to_v2
                heapq.heappush(hq, (distance[v2], v2))

            edge_to_v2 = edge_next[edge_to_v2-1]

    for i in range(1,N):
      ans=10**18
      for j in range(2500):
        if distance[i*2500+j]==0:
          continue
        if distance[i*2500+j]<ans:
          ans=distance[i*2500+j]
      print(ans)
    


if __name__ == '__main__':
    N,M,S=map(int,input().split())
    main()

Measured memory_bytes: 182644
import sys

for s in sys.stdin:
    row = [1,2,1,2,1,4,1,4]
    d = map(int,s.split())
    mini = 10000000
    n = len(row)
    m_row = [4]*n
    for i in xrange(n):
        su = [d[j]-row[(i+j)%n] if d[j] > row[(i+j)%n] else 0 for j in xrange(n)  ]
        su = sum(su)
        if mini == su:
            m_row = min(m_row,[ row[(i+j)%n] for j in xrange(n) ])
        elif mini > su:
            mini = su
            m_row =[ row[(i+j)%n] for j in xrange(n) ]
    for m in m_row:
        print m,
    print 

Measured memory_bytes: 4244
n, a, b, c = list(map(int, input().split()))
s = [list(input()) for _ in range(n)]
s.append(["A", "B"])
d = {"A": a, "B": b, "C": c}
ans = []

def calc(add, sub):
    d[add] += 1
    d[sub] -= 1
    ans.append(add)

for i, [j, k] in enumerate(s):
    if i == n:
        print('Yes')
        print('\n'.join(ans))
        break
    if d[j] == 0 and d[k] == 0:
        print("No")
        break
    elif j == "A" and k == "B":
        
        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "A" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "B" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A" and s[i + 1][1] == "C":
                calc(k, j)
            else:
                calc(j, k)
    


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

#define int long long

const int mod = 1e9+7;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string k;
    cin >> k;
    int d;
    cin >> d;
    int l = k.size();
    vector< vector<int> > dp(d, vector<int>(2));
    dp[0][0] = 1;
    for(int i = 0; i < l; i++){
        vector< vector<int> > t(d, vector<int>(2));
        for(int j = 0; j < 2; j++){
            for(int digit = 0; digit <= 9; digit++){
                if(!j && k[i]-'0' < digit) break;
                for(int m = 0; m < d; m++){
                    if(digit < k[i]-'0'||j)t[(m+digit)%d][1]+=dp[m][j];
                    else t[(m+digit)%d][0]+=dp[m][j];
                    t[(m+digit)%d][0]%=mod;
                    t[(m+digit)%d][1]%=mod;
                }
            }
        }
        dp = t;
    }

    int ans = (dp[0][0] + dp[0][1])%mod;
    ans += mod-1;
    ans%=mod;
    cout << ans << endl;
}


Measured memory_bytes: 256
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()

count = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            count += 1
print(count)

Measured memory_bytes: 6864
def main():
    n = int(input())
    a_list = map(lambda x: int(x), input().split(' '))
    b_list = [x - i for i, x in zip(range(1, n+1), a_list)]
    b_list.sort()
    median = 0
    if n % 2 == 0:
        median = (b_list[n//2-1] + b_list[n//2]) / 2
    else:
        median = b_list[n//2]
    result = int(sum([abs(x - median) for x in b_list]))
    print(result)

if __name__ == "__main__":
    main()


Measured memory_bytes: 31472
#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);i>=(b);--i)
#define PB push_back
#define MP make_pair
#define PII pair<int, int>
typedef long long LL;
const LL P = 998244353;
const int INF = 0x3fffffff;
const int N = 100010;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a,b;

int main(){
	cin>>a>>b;
	cout<<max(a*b,max(a+b,a-b))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    string S;
    cin >> S;
    regex M ("A?KIHA?BA?RA?");
    cout << ((regex_match(S , M)) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3740