akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  ll K; cin >> K;
  ll N; cin >> N;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];
  vector<ll> D(N);
  for (ll i = 0; i < N - 1; i++) {
    D[i] = A[i + 1] - A[i];
  }
  D[N - 1] = K + A[0] - A[N - 1];
  sort(D.rbegin(), D.rend());

  ll ans = K - D[0];
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,B[110],A[110],sum=0;cin>>N;
    cin>>B[0];
    A[0]=B[0];
    sum+=A[0];
    for(int i=1;i<N-1;i++){
        cin>>B[i];
        A[i]=min(B[i-1],B[i]);
        sum+=A[i];
    }
    A[N-1]=B[N-2];
    sum+=A[N-1];
    cout<<sum<<endl;

    return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
void dfs(int x, int y, VS& ans, vector<vector<bool>>& vis){
  vis[y][x] = true;
  REP(d,4){
	int tx = x+dx[d];
	int ty = y + dy[d];
	if(0 <= tx && tx < 100 && 0 <= ty && ty < 100 && ans[y][x] == ans[ty][tx] && !vis[ty][tx])
	  dfs(tx, ty, ans, vis);
  }
}

PII check(VS& ans){
  vector<vector<bool>> vis(100, vector<bool>(100));
  PII p;
  REP(y,100) REP(x,100)
	if(!vis[y][x]){
	  dfs(x, y, ans, vis);
	  if(ans[y][x] == '.')
		p.FF++;
	  else
		p.SS++;
	}
  return p;
}

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

  int W, B;
  cin >> W >> B;

  VS ans(100, string(100, '/'));
  REP(y,100) ans[y][0] = '.';
  REP(y,100) ans[y][99] = '#';

  FOR(x,1,99) REP(y,100) ans[y][x] = (y%2?'#':'.');

  --W;
  --B;
  int y = 0, x = 97;
  while(W){
	--W;
	if(x == 1){
	  x = 97;
	  y += 6;
	}
	ans[y][x] = '#';
	x -= 2;
  }

  y = 3, x = 2;
  while(B){
	--B;
	if(x == 98){
	  x = 2;
	  y += 6;
	}
	ans[y][x] = '.';
	x += 2;
  }

  //cout << check(ans) << endl;
  cout << "100 100" << endl;
  REP(y,100)
	cout << ans[y] << endl;

  
  return 0;
}


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


bool is_sharp(vector<string> &s, int h, int w, int H, int W) {
  return 0 <= h && h < H && 0 <= w && w < W && s.at(h).at(w) == '#';
}

int count_sharp(vector<string>& s, int h, int w, int H, int W) {

  vector<vector<int> > coordinates = {
    {h - 1, w - 1},
    {h - 1, w    },
    {h - 1, w + 1},
    {h    , w + 1},
    {h + 1, w + 1},
    {h + 1, w    },
    {h + 1, w - 1},
    {h    , w - 1}
  };

  int count = 0;
  for (int i = 0; i < coordinates.size(); i++) {
    int h_i = coordinates.at(i).at(0);
    int w_i = coordinates.at(i).at(1);
    if (is_sharp(s, h_i, w_i, H, W)) {
      count++;
    }
  }

  return count;
}

void answer1() {
  cin.tie(0);
	ios_base::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  vector<string> s(H);
  for (auto& s_i: s) {
    cin >> s_i;
  }
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      if (! is_sharp(s, h, w, H, W)) {
        int count = count_sharp(s, h, w, H, W);
        //char c_count = (char)('0' + count);
        //s.at(h).at(w) = c_count;
        cout << count;
      } else {
        cout << '#';
      }
    }
    cout << endl;
  }
}

void answer2() {
  cin.tie(0);
	ios_base::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;

  char s[52][52] = {};
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> s[i][j];
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (s[i][j] == '#') {
        cout << '#';
      } else {
        int count = 0;
        for (int h = i - 1; h <= i + 1; h++) {
          for (int w = j - 1; w <= j + 1; w++) {
            if (s[h][w] == '#') {
              // s[i][j] == '#'であることはないのでforループに含んでいる
              count++;
            }
          }
        }
        cout << (char)('0' + count);
      }
    }
    cout << endl;
  }

}

int main() {
  //answer1();
  answer2();
}


Measured memory_bytes: 256
n=int(input())
s=0
a=[int(x) for x in input().split(' ')]
b=[int(y) for y in input().split(' ')]
c=[int(z) for z in input().split(' ')]
s+=b[a[0]-1]
for i in range(1,n):
    s+=b[a[i]-1]
    if a[i]==a[i-1]+1:
        s+=c[a[i-1]-1]
print (s)


Measured memory_bytes: 3064
import sys

def drange(start, stop, step):
  r = start
  while r <= stop:
    yield r
    r += step

for s in sys.stdin:
  d = int(s)
  sum = 0
  for x in drange(d, 600, d):
    sum += (x-d)**2*d
  print '%d'%sum

Measured memory_bytes: 4204
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>n;
    int arr[n];
    rep(i,0,n)cin>>arr[i];
    sort(arr,arr+n);
    double last=arr[0];

    rep(i,1,n)
    {
        last=(last+arr[i])/2;
    }
    cout<<fixed << setprecision(6)<<last;

    return 0;
}



Measured memory_bytes: 256
import sys
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
cnt=0
if x==sum(a):
    print(n)
    sys.exit()
for i in range(n):
    x-=a[i]
    if x<0:
        print(i)
        sys.exit()
else:
    print(n-1)

Measured memory_bytes: 3064
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 4e2 + 10;
int dp[N][N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	LL ans = 1;
	for (int i = 1; i <= n; i++) ans = ans * i % INF;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int h,w,k,fi,fj, e[305], c, d[305][305], cc;
bool ff;
char s[305][305];
int main(){
	scanf("%d%d%d", &h, &w, &k);
	rep(i,h){
		scanf("\n%s", s[c]);
		bool f = false;
		rep(j,w) if(s[c][j] == '#'){
			if(!f){
				s[c][j] = '.';
				s[c][0] = '#';
			}
			f = true;
		}
		e[c]++;
		if(f){
			rep(j,w) d[c][j] = s[c][j] == '#' ? ++cc : cc;
			c++;
		}
	}
	e[c-1] += e[c];
	rep(i,c) rep(k,e[i]) rep(j,w) printf("%d%c", d[i][j], j == w-1 ? '\n' : ' ');
}

Measured memory_bytes: 1152
#[allow(dead_code)]
fn main() {
    let (n, m) = i::u2();
    let xy = i::uv2(m);

    let mut num = vec![1; n + 1];
    num[0] = 0;
    let mut flag = vec![false; n + 1];
    flag[1] = true;

    for (x, y) in xy {
        if flag[x] == false {
            num[x] -= 1;
            num[y] += 1;
        } else {
            num[x] -= 1;
            num[y] += 1;
            if num[x] == 0 {
                flag[x] = false;
            }
            flag[y] = true;
        }
    }
    let mut ans = 0;
    for i in 0..n + 1 {
        if flag[i] {
            ans += 1;
        }
    }
    //dbg!(flag);
    println!("{}", ans);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


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

int main()
{
  string s,t;
  int N,i;
  int c;
  cin>>s;
  cin>>N;
  c=0;
  while(N-->0){
    cin>>t;
    t+=t;
    if(t.find(s)!=string::npos)c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<cmath>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}
int digits(int n) {
	int count = 0;
	while (n > 0) {
		n /= 10;
		count++;
	}
	return count;
}
ll combination(ll n, ll r) {
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int main() { 
	int n;
	cin >> n;
	int m = digits(n);
	vector<int>tmp(5);
	rep(i, 5) {
		if (i % 2 == 0){
			tmp[i] = pow(10, i) * 9;
		}
	}
	int ans = 0;
	rep(i, m-1) {
		ans += tmp[i];
	}
	int f = pow(10, m - 1);
	if (m % 2 == 1) {
		ans += n - f + 1;
	}
	cout << ans << endl;
}


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

using LL = long long;
using VL = vector<LL>;
using VVL = vector<vector<LL>>;
using STR = string;

#define REP(i, n) for (LL i = 0, i##_size = n; i < i##_size; ++i)
#define RREP(i, n) for (LL i = LL(n) - 1; i >= 0; --i)

template <class T> void chmin(T& a, T b) { if (b < a) { a = b; } }
template <class T> void chmax(T& a, T b) { if (b > a) { a = b; } }

#define SZ(var) (LL)(var.size())
#define pb push_back

#define IN_LL(var) LL var; cin >> var;
#define IN_LL2(var0, var1) LL var0, var1; cin >> var0 >> var1;
#define IN_LL3(var0, var1, var2) LL var0, var1, var2; cin >> var0 >> var1 >> var2;
#define IN_LL4(var0, var1, var2, var3) LL var0, var1, var2, var3; cin >> var0 >> var1 >> var2 >> var3;

#define IN_VL(var, n) VL var(n); REP(i, n) { cin >> var[i]; };
#define IN_STR(var) STR var; cin >> var;

#define OUT(var) cout << (var) << '\n';

void myMain();
int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(16);
	myMain();
	return 0;
}

void myMain() {
	IN_LL2(N, M);
	VVL R(N);
	REP(i, M) {
		IN_LL2(a, b);
		R[a - 1].pb(b - 1);
		R[b - 1].pb(a - 1);
	}

	VL froms(N, -1);

	VL points;
	points.pb(0);
	froms[0] = 0;

	for (LL d = 1;; ++d) {
		VL nexts;

		for(LL p : points) {
			for (LL n : R[p]) {
				if (froms[n] != -1) {
					continue;
				}

				froms[n] = p;
				nexts.pb(n);
			}
		}

		if (SZ(nexts) == 0) {
			break;
		}

		points = move(nexts);
	}

	OUT("Yes");
	for (LL i = 1; i < N; ++i) {
		OUT(froms[i] + 1);
	}
}

Measured memory_bytes: 13688
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r){return l + rng() % (r - l + 1);}
typedef long long ll;
typedef unsigned long long ull;
#define int long long
#define For(a, b, c) for(int a = b; a <= c; ++a)
#define Ford(a, b, c) for(int a = b; a >= c; --a)
#define Fv(a, b) for(auto &a : b)
#define pb push_back
#define ii pair<int, int>
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define sz(x) (int)(x.size())
#define two(x) (1ll << x)
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define task "stones"

const int N = 105;
int n, k, a[N];
int f[N * N * N];

int F(int x) {
    if(x < 0) return 1;
    if(f[x] != -1) return f[x];
    f[x] = 0;
    For(i, 1, n) f[x] = max(f[x], 1 - F(x - a[i]));
    return f[x];
}

main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    For(i, 1, n) {
        cin >> a[i];
    }
    reset(f, -1);
    cout << (F(k) ? "First" : "Second");
}


Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int K;
  
  
  cin >> N;
  cin >> K;
  
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  
  int goukei=0;
  
  for(int j=0;j<K;j++){
    goukei += vec.at(j);
    }
  cout << goukei <<endl;
  }

Measured memory_bytes: 3600
using namespace std;
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define debug(x) cout << #x <<" = " << x << endl
#define MOD 1000000007
void solve()
{
ll n;
cin>>n;
ll arr[n+1];
arr[0]=arr[1]=arr[2]=0;
for (int i = 3; i <=n; i++)
{
    arr[i]=1;
}
for (int i = 4; i <=n; i++)
{
  for (int j = 3; j <=i-3; j++)
  {
      arr[i]=(arr[i]+arr[j])%MOD;
  }
}
cout<<arr[n]%MOD<<endl;
}
int main()
{
 
FASTIO
 long long int t=1;
 //cin>>t;
 while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <vector>
#include <cstdio>
#include <queue>
using namespace std;

const int Maxn = 10005;
int n, c[Maxn], du[Maxn];
vector <int> g[Maxn];
int vis[Maxn], res[Maxn];
int e[Maxn][3];
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; ++ i) {
		int u, v;
		scanf("%d %d", &u, &v);
		e[i][1] = u, e[i][2] = v;
		g[u].push_back(v);
		g[v].push_back(u);
		du[u] ++, du[v] ++;
	}
	for (int i = 1; i <= n; ++ i)
		scanf("%d", c + i);
	int now = 1;
	sort(c + 1, c + n + 1);
	queue <int> que;
	for (int i = 1; i <= n; ++ i)
		if (du[i] == 1) que.push(i), vis[i] = 1;
	while (!que.empty()) {
		int u = que.front();
		que.pop();
		res[u] = c[now ++];
		for (auto &v: g[u]) {
			if (-- du[v] <= 1 && !vis[v])
				que.push(v), vis[v] = 1;
		}
	}
	long long ans = 0;
	for (int i = 1; i < n; ++ i)
		ans += min(res[e[i][1]], res[e[i][2]]);
	printf("%lld\n", ans);
	for (int i = 1; i <= n; ++ i)
		printf("%d%c", res[i], " \n"[i == n]);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    REP1(i, 5) {
        int x;
        cin >> x;
        if (x == 0) {
            cout << i << endl;
            return;
        }
    }
}


Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String keyword = sc.next();
        PriorityQueue<Integer> pque = new PriorityQueue<Integer>(11, Collections.reverseOrder());
        while (!keyword.equals("end")) {
            //System.out.println(pque);
            switch (keyword) {
            case "insert":
                int n = sc.nextInt();
                pque.add(n);
                break;
            case "extract":
                System.out.println(pque.poll());
                break;
            default:
                break;
            }

            keyword = sc.next();
        }
    }
}



Measured memory_bytes: 475340
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
        int[] C = new int[N];
        int[] S = new int[N];
        int[] F = new int[N];

        for(int i=0; i<N-1; i++){
            C[i] = sc.nextInt();
            S[i] = sc.nextInt();
            F[i] = sc.nextInt();
        }
        
        for(int i=0; i<N-1; i++){
            int t = 0;
            for(int j=i; j<N-1; j++){
                if(S[j]>=t){
                    t = S[j] + C[j];
                }
                else if(S[j]<t && t%F[j]==0){
                    t += C[j];
                }
                else{
                    t += F[j] - t % F[j] + C[j];
                }
            }
            System.out.println(t);
        }
        System.out.println(0);
    }
}

Measured memory_bytes: 26636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

const int mod=1e9+7;
const int mx=1e6+777;
ll pw[11][mx];

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	for (int i=0; i<11; i++) {
		pw[i][0]=1;
		for (int j=1; j<mx; j++)
			pw[i][j]=(pw[i][j-1]*i)%mod;
	}
	int N; cin>>N;
	cout<<(pw[10][N]+2*(mod-pw[9][N])+pw[8][N])%mod<<"\n";
	return 0;
}

Measured memory_bytes: 89616
def main():
    a, b, k = map(int, input().split())

    ans = set()

    for i in range(k):
        x = a + i
        if x <= b:
            ans.add(x)

        y = b - i
        if a <= y:
            ans.add(y)

    for i in sorted(list(ans)):
        print(i)


def main2():
    a, b, k = map(int, input().split())
    ans = []
    if 2 * k >= b - a + 1:
        for i in range(a, b + 1):
            ans.append(i)
    else:
        for i in range(k):
            ans.append(a + i)
            ans.append(b - i)

    for i in sorted(ans):
        print(i)


if __name__ == '__main__':
    main2()


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

#define ENORMOUS (1<<21)

struct Ver{
	int weight;
	int key;
	struct Ver *next;
};

void Input(int);
void Create_Vertex(int,int,int);
void SSSP(void);
int Test_Set(int*);
int Heap(int*);

int n;
int *d;
struct Ver *ver;

int main(void){
	int i;
	int id;

	scanf("%d",&n);

	d=(int*)malloc(sizeof(int)*n);
	ver=(struct Ver*)malloc(sizeof(struct Ver)*n);
	for(i=0;i<n;i++){
		ver[i].weight=-1;
		ver[i].key=-1;
		ver[i].next=NULL;
	}

	for(i=0;i<n;i++){
		scanf("%d",&id);
		Input(id);	
	}

	SSSP();

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

	free(d);

	return 0;
}

void Input(int id){
	int k,u,c;
	int i;

	scanf("%d",&k);

	for(i=0;i<k;i++){
		scanf("%d",&u);
		scanf("%d",&c);
		Create_Vertex(id,u,c);
	}
}

void Create_Vertex(int id,int u,int c){
	struct Ver *new,*work;

	new=(struct Ver*)malloc(sizeof(struct Ver));
	new->next=NULL;
	new->weight=c;
	new->key=u;

	work=&ver[id];
	while(work->next!=NULL) work=work->next;
	work->next=new;

}

void SSSP(void){
	int S[n];
	int i;
	int s,u;
	struct Ver *work;

	for(i=0;i<n;i++){
		S[i]=0;
		d[i]=ENORMOUS;
	}
	s=0;
	d[s]=0;

	while(Test_Set(S)==0){
		u=Heap(S);
		S[u]=1;

		work=ver[u].next;
		while(work != NULL){
			if(S[work->key]==1){}
			else if(d[u]+work->weight < d[work->key]){
				d[work->key]=d[u]+work->weight;
			}
			work=work->next;
		}
	}
}

int Heap(int *S){
    int i;
    int min=ENORMOUS;
    int u;
 
    for(i=0;i<n;i++){
        if(S[i]==1) continue;
         
        if(d[i]<min){
            min=d[i];
            u=i;
        }
    }
 
    return u;
}

int Test_Set(int *S){
	int i;

	for(i=0;i<n;i++){
		if(S[i]==0) return 0;
	}
	return 1;
}

Measured memory_bytes: 16220
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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




//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}
/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return (x / tmp) * y;
}


struct Combination {

	vector<ll> fact, rfact;

	Combination(ll sz) : fact(sz + 1), rfact(sz + 1) {

		fact[0] = 1;
		for (ll i = 1; i < fact.size(); i++) {
			fact[i] = fact[i - 1] * i % MOD;
		}
		//逆元
		rfact[sz] = inv(fact[sz]);
		for (ll i = sz - 1; i >= 0; i--) {
			rfact[i] = rfact[i + 1] * (i + 1) % MOD;
		}
	}

	ll inv(ll x) {
		return pow(x, MOD - 2);
	}
	ll pow(ll x, ll n) {
		ll ret = 1;
		while (n > 0) {
			if (n & 1) (ret *= x) %= MOD;
			(x *= x) %= MOD;
			n >>= 1;
		}
		return (ret);
	}
	ll P(ll n, ll r) {
		if (r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % MOD);
	}

	ll C(ll p, ll q) {
		if (q < 0 || p < q) return (0);
		return (fact[p] * rfact[q] % MOD * rfact[p - q] % MOD);
	}

	ll H(ll n, ll r) {
		if (n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};


/******************************************************************************************/



int main() {

	int a, b, c;
	cin >> a >> b >> c;
	cout << min(a*b, c) << endl;






	return 0;
}


Measured memory_bytes: 764
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    if(b - a <= k){
      for(int i = a;i <= b;i++){
        System.out.println(i);
      }
    }else{
      for(int i = 0;i < k;i++){
        System.out.println(a + i);
      }
      for(int i = k-1;i >= 0;i--){
        if(a + i != b - i){
          System.out.println(b - i);
        }
      }
    }
  }
}

Measured memory_bytes: 21844
N = int(input())
A_list = list(map(int,input().split()))

x = 0
y = 0
for k in range(1000000000):
    for i,j in enumerate(A_list):
        if j%2 ==1:
            y += 1
        A_list[i] = j/2
    if y ==0:
        x +=1
    else:
        break
print(x)

Measured memory_bytes: 3060
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=[0]*(n+1)
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        a=x*x+y*y+z*z+x*y+y*z+z*x
        if a<=n:
          ans[a]+=1

  for x in ans[1:]:
    print(x)

main()
# print(main())


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a + b == c || b + c == a || a + c == b){
    cout << "Yes" << endl;
  }
    else{
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define pi acos(-1)
#define int long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<int> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const int ths = 1LL << 40;
const int NN = 5e3 + 6;

const int maxN = 500007;

///abc 157_e
///

int fen[26][maxN];
void add(int dimension, int idx, int val) {
    idx ++;
    while(idx < maxN) {
        fen[dimension][idx] += val;
        idx += idx & (-idx);
    }
}

int query(int dimension, int idx) {

    idx ++;
    int ans = 0;
    while(idx > 0) {
        ans += fen[dimension][idx];
        idx -= idx & (-idx);
    }
    return ans ;
}

void solve()
{

    int n;
    cin>>n;
    string s;
    cin>>s;

    for(int i = 0; i < n; i ++) {
        int dimension = s[i] - 'a';
        add(dimension, i, 1);
    }

    int q;
    cin>>q;
    for(int i = 0; i < q; i ++) {
        int type;
        cin>>type;
        if(type == 1) {
            int idx;
            char c;
            cin>>idx>>c;
            idx --;
            int dimension = s[idx] - 'a';
            add(dimension, idx, -1);
            s[idx] = c;
            dimension = c - 'a';
            add(dimension, idx, 1);
        }
        else {
            int l, r;
            cin>>l>>r;
            int ans = 0;
            l --;
            r --;
            for(int  dimension = 0; dimension < 26; dimension ++) {
//                cout<<dimension<<endl;
                ans += ((query(dimension, r ) - query(dimension, l - 1) ) > 0);
            }
            cout<<ans<<'\n';
        }
    }
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 102556
n,m=map(int,input().split())
p=list(map(int,input().split()))
par=[i for i in range(n)]
 
def find(x):
  if par[x]==x:
    return par[x]
  else:
    par[x]=find(par[x])
    return par[x]
 
def union(x,y):
  fx=find(x)
  fy=find(y)
  if fx!=fy:
    par[fx]=fy
 
f=lambda x:int(x)-1
for mm in range(m):
  x,y=map(f,input().split())
  union(x,y)
 
ans=0
for i in range(n):
  if find(p[i]-1)==find(i):
    ans+=1
print(ans)

Measured memory_bytes: 20608
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
if A[0] != 1:
  ans += 1
C = [[] for _ in range(n+1)]
P = [-1]*(n+1)
for i, a in enumerate(A[1:], 2):
  C[a].append(i)
  P[i] = a
def dfs(v):
  global ans
  temp = 0
  for nv in C[v]:
    temp = max(temp, dfs(nv)+1)
  if v == 1:
    return
  if P[v] != 1 and temp == k-1:
    temp = -1
    ans += 1
  return temp
dfs(1)
print(ans)

Measured memory_bytes: 111848
#include <bits/stdc++.h>
using namespace std;
const int Maxn=55;
int n,k,a[Maxn],tmp[Maxn],cnt,maxi,ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<=n;i++)
		for(int j=i+1;j<=n+1;j++)
			if(i+(n-j+1)<=k)
			{
				memset(tmp,0,sizeof(tmp));
				cnt=0;
				ans=0;
				for(int q=1;q<=i;q++)
					tmp[++cnt]=a[q];
				for(int q=j;q<=n;q++)
					tmp[++cnt]=a[q];
				sort(tmp+1,tmp+1+cnt);
				for(int i=1;i<=cnt;i++)
					ans+=tmp[i];
				for(int i=1;i<=min(cnt,k-cnt);i++)
					if(tmp[i]<0) ans-=tmp[i];
				maxi=max(maxi,ans);
			}
	printf("%d",maxi);
	return 0;
}
		

Measured memory_bytes: 256
N = list(input().split())
A = []
for i in range(len(N)):
    if N[i] == '+':
        num1 = A.pop()
        num2 = A.pop()
        A.append(num2 + num1)
        continue
    elif N[i] == '-':
        num1 = A.pop()
        num2 = A.pop()
        A.append(num2 - num1)
        continue
    elif N[i] == '*':
        num1 = A.pop()
        num2 = A.pop()
        A.append(num2 * num1)
        continue
    A.append(int(N[i]))  
    
print(A[0])


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


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

    long long n,m;
    cin>>n>>m;
    long long l,r;
    long long sum[n+1]={};
    for(int i=0;i<m;i++){
        cin>>l>>r;
        l--;
        sum[l]++;
        sum[r]--;
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        sum[i]+=sum[i-1];
        
    }
    for(int i=0;i<n;i++){
        if(sum[i]==m) ans++;
    }
    cout<<ans<<endl;

    

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex <double> point;

point cal(point a){
  point b=(a*conj(a))/abs(a);
  b.y+=1;
  b=(b*a)/abs(a);
  return b;
}

int main(){
  while(1){
    int n;
    cin>>n;
    if(n==-1)break;
    point ans=point(1,0);
    for(int i=1;i<n;i++) ans=cal(ans);
    printf("%lf\n",ans.x);
    printf("%lf\n",ans.y);
  }
  return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<cstdio>
#include<cstring>
#include<climits>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
#define MAXN 100000
#define MAXM 100000
int b[MAXN+5],vis[MAXN+5],flag=1;
long long dist[2][MAXN+5];
int x,y;
long long z1,z2;
int cnt,m,n,k,s,t;
queue<int>Q;
struct node
{
    int next,to;
    long long w[2];
}e[MAXM*2+5];
struct ps
{
    long long w;
    int num;
}Ans[MAXN+5];
bool cmp(ps s1,ps s2)
{
    return s1.w<s2.w;
}
void fpush(int u,int v,long long w1,long long w2)
{
    e[++cnt].next=b[u];
    e[cnt].w[0]=w1;
    e[cnt].w[1]=w2;
    e[cnt].to=v;
    b[u]=cnt;
}
void SPFA(int st,int qv)
{
    while(!Q.empty())Q.pop();
    memset(vis,0,sizeof(vis));
    Q.push(st);
    dist[qv][st]=0;
    while(!Q.empty())
    {
        int now=Q.front();
        Q.pop();
        vis[now]=0;
        for(int i=b[now];i;i=e[i].next)
        {
            int xnext=e[i].to;
			if(dist[qv][now]+e[i].w[qv]<dist[qv][xnext])
			{
				dist[qv][xnext]=dist[qv][now]+e[i].w[qv];
				if(!vis[xnext])
				{
					Q.push(xnext);
					vis[xnext]=true;
				}
			}
        }
    }
}
int main()
{
    scanf("%d%d%d%d",&n,&m,&s,&t);
	for(int i=1;i<=n;i++)dist[0][i]=1000000000000000;
	for(int i=1;i<=n;i++)dist[1][i]=1000000000000000;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d%lld%lld",&x,&y,&z1,&z2);
        fpush(x,y,z1,z2);
        fpush(y,x,z1,z2);
    }
    SPFA(s,0);
    SPFA(t,1);
    for(int i=1;i<=n;i++)
    {
        Ans[i].w=dist[0][i]+dist[1][i];
        Ans[i].num=i;
    }
    sort(Ans+1,Ans+n+1,cmp);
    int Cs=1;
    for(int i=0;i<n;i++)
    {
        while(Ans[Cs].num<=i)Cs++;
        printf("%lld\n",1000000000000000-Ans[Cs].w);
    }
    return 0;
}


Measured memory_bytes: 10496
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	int n, q; //????????°??????????????°

	while(1){
		cin >> n >> q;
		if(n == 0) break;
		int date[100000] = {0};
		rep(i, n){
			int m; cin >> m;
			rep(j, m){
				int tmp;
				cin >> tmp;
				date[tmp]++;
			}
		}

		int max = 0;
		rep(i, 100000){
			if(date[max] < date[i]) max = i;
		}
		if(date[max] >= q) printf("%d\n", max);
		else printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
int main(){
 int a,b,c;
 scanf("%d %d %d",&a,&b,&c);

if(a<b){
 if(b<c){
  printf("Yes\n");
 } else { 
  printf("No\n");
 }
} else {
 printf("No\n");
}

return 0;

}

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

using namespace std;

typedef long long int li;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}
    
int main()
{    
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        string s;


        cin>>s;

        if(s=="SAT")
            cout<<1;
        else if(s=="MON")
            cout<<6;
        else if(s=="TUE")
            cout<<5;
        else if(s=="WED")
            cout<<4;
        else if(s=="THU")
            cout<<3;
        else if(s=="FRI")
            cout<<2;
        else
            cout<<7;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N; cin >> N;
  ll ac=0, wa=0, tle=0, re=0;
  rep(i, N){
    string S; cin >> S;
    if (S=="AC")
      ac++;
    if (S=="WA")
      wa++;
    if (S=="TLE")
      tle++;
    if (S=="RE")
      re++;
  }

  cout << "AC x "<< ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <unordered_map> 
#define io ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define int long long
#define sp " "
#define fi freopen("bruh.txt","r",stdin);
#define fo freopen("input.txt", "w", stdout);
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),c.end();
#define allr(x) x.rbegin(), x.rend()
#define pii pair< int , int >
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,n,a)for(int i=n;i>=a;i--)
#define mem(ara,a) memset(ara,a,sizeof (ara))
long long inf=2e18;
long long minf=-inf;
using namespace std;

signed main(){
int r;
cin >> r;
double ans=(double)r * 2.0 *acos(-1);
printf("%.5lf\n",ans );

}

Measured memory_bytes: 3760
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100000;
long long p = 1000000007;
int main()
{
  int n,i;
  long long res=1;
  long long t[N_MAX],a[N_MAX],ma[N_MAX],mi[N_MAX];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> t[i];
    if(i==0 || i>0&&t[i]>t[i-1]){
      ma[i]=t[i];
      mi[i]=t[i];
    }else{
      ma[i]=t[i];
      mi[i]=1;
    }
  }
  for(i=0;i<n;i++)
    cin >> a[i];
  for(i=n-1;i>=0;i--){
    if(i==n-1 || i<n-1&&a[i]>a[i+1]){
      if(ma[i]<a[i]||mi[i]>a[i]){
        cout << "0" << endl;
        return 0;
      }
      ma[i]=a[i];
      mi[i]=a[i];
    }else{
      if(mi[i]>a[i]){
        cout << "0" << endl;
        return 0;
      }
      ma[i]=min(a[i],ma[i]);
    }
  }
  for(i=0;i<n;i++){
    res*=ma[i]-mi[i]+1;
    res%=p;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3328
function Main(input) {
  var N = parseInt(input[0], 10);
  var S = input[1];

  var len = S.length;
  var result = "";
  for (var i = 0; i < len; i++) {
    var num = S.charCodeAt(i);
    // console.log("%s", num);
    var new_num = num + N;
    if (new_num > 90) {
      new_num = new_num - 90 + 64;
    }
    result += String.fromCharCode(new_num);
  }
  console.log("%s", result);
}

Main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .split("\n")
);


Measured memory_bytes: 21064
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    int c = a - 2 * b;
    
    if (c < 0) {
      System.out.println(0);
    } else {
      System.out.println(c);
      }
  }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using i64 = long long;

i64 gcd(i64 a, i64 b) { return b ? gcd(b, a % b) : a; }

int main() {
    i64 a, b;
    std::cin >> a >> b;
    std::cout << a / gcd(a, b) * b << std::endl;

    return 0;
}


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

int main ()
{
	int x,a,b;
	cin>>x>>a>>b;
	if (a>=b)
	 {
	 	cout<<"delicious\n";
	 	return 0;
	 }
	else
	 {
	 	if (b-a<=x)
	 	 {
	 	 	cout<<"safe\n";
	 	 	return 0;
		  }
		else
		 {
		 	cout<<"dangerous\n";
		 	return 0;
		 }
	 }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int w,h,i,j;
	do{
		scanf("%d %d",&h,&w);
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				if(i==1 || i==h || j==1 || j==w)
					putchar('#');
				else
					putchar('.');
			}
			putchar('\n');
		}
		if(w!=0 || h!=0)
			putchar('\n');
	}while(w!=0 && h!=0);
		
		
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int (i) = (a); (i) < (b); ++(i))
#define per(i, a, b) for (int (i) = (a); (i) >= (b); --(i))
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define ff first
#define ss second
#define sz(x) ((int) x.size())
#define rd(type, ...) type __VA_ARGS__; sc(__VA_ARGS__)
#define rda(a, n) rep(i, 0, n) cin >> a[i];
#define rdaa(a, n, m) rep(i, 0, n) rep(j, 0, m) cin >> a[i][j];
#define rdv(type, v, n) vector<type> v(n); rep(__ii, 0, n) cin >> v[__ii]
#define rdm(type, v, h, w) vector<vector<type>> v(h, vector<type>(w)); rep(__ii, 0, h) rep(__jj, 0, w) cin >> v[__ii][__jj]
#define rdv2(type, n, ...)std::vector<type> __VA_ARGS__;MACRO_rdv2_Init(n, __VA_ARGS__); for(int w_=0; w_<n; ++w_){MACRO_rdv2_Scan(w_, __VA_ARGS__);}
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "] : ", debug_out(__VA_ARGS__)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void solve();
signed main() {ios::sync_with_stdio(false); cin.tie(0);
  cout << fixed; cout.precision(20); solve(); return 0;}
template<typename T> void chmin(T &a, T b) {if (a > b) a = b;}
template<typename T> void chmax(T &a, T b) {if (a < b) a = b;}
template<typename T> void MACRO_rdv2_Init(int n, T& t) { t.resize(n); }
template<typename First, typename... Rest> void MACRO_rdv2_Init(int n, First& first, Rest& ...rest) { first.resize(n); MACRO_rdv2_Init(n, rest...); }
template<typename T> void MACRO_rdv2_Scan(int p, T& t) { std::cin >> t[p]; }
template<typename First, typename... Rest> void MACRO_rdv2_Scan(int p, First& first, Rest& ...rest) { std::cin >> first[p]; MACRO_rdv2_Scan(p, rest...); }
template<typename T> void wrv(const vector<T> &v) {rep(__ii, 0, sz(v)) {if (__ii) cout << ' '; cout << v[__ii];} cout << '\n';} 
template<typename T> void wrm(const vector<vector<T>> &v) {rep(__ii, 0, sz(v)) {rep(__jj, 0, v[__ii].size()) {if (__jj) cout << ' '; cout << v[__ii][__jj];} cout << '\n';}}
template<typename T> void sc(T& x) {cin >> x;}
template<typename Head, typename... Tail> void sc(Head& head, Tail&... tail) {cin >> head; sc(tail...);}
template<typename T> void wr(const T& x) {cout << x << '\n';}
template<typename Head, typename... Tail> void wr(const Head& head, const Tail&... tail) {cout << head << ' '; wr(tail...);}
template<typename T> void wrf(const T& x) {cout << x << endl;}
template<typename Head, typename... Tail> void wrf(const Head& head, const Tail&... tail) {cout << head << ' '; wrf(tail...);}
template<typename T> void debug_out(const T& x) {cerr << x << '\n';}
template<typename Head, typename... Tail> void debug_out(const Head& head, const Tail&... tail) {cerr << head << ' '; debug_out(tail...);}
template<typename... T> void err(const T&... cod) {wr(cod...); exit(0);}

void solve() {
  rd(int, h, n);
  rdv(int, a, n);
  sort(a.rbegin(), a.rend());
  wr(h > accumulate(a.begin(), a.end(), 0) ? "No" : "Yes");
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long X[] = new long[3];
            for (int i = 0; i < 3; i++) X[i] = in.nextInt();
            long ans = Long.MAX_VALUE;
            for (int i = 0; i < 3; i++) {
                int j = (i + 1) % 3;
                int k = (i + 2) % 3;
                long x1 = X[i] / 2;
                long x2 = X[i] - x1;
                ans = Math.min(ans, Math.abs(X[j] * X[k] * (x2 - x1)));
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 8276
using System;

namespace Volume0_0001
{
    class Program
    {
        static void Main(string[] args)
        {
            int noOfInput = 10;
            var numbers = new int[noOfInput];
            int[] threeBigNumbers = new int[] {Int32.MinValue,Int32.MinValue,Int32.MinValue};
            var input = "";

            for (int i = 0; i < noOfInput; i++)
            {
                input = Console.ReadLine();
                if (input == "") { return; }
                numbers[i] = Int32.Parse(input);
            }

            Array.Sort<int>(numbers);
            for(int i=0; i<threeBigNumbers.Length;i++)
            {
                Console.WriteLine(numbers[noOfInput - 1 - i]);
            }
        }
    }
}

Measured memory_bytes: 9268
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	s := next()

	b, c := 0, 0
	for i := 0; i < len(s); i++ {
		if s[i] == 'B' {
			b++
		} else {
			c += b
		}
	}

	fmt.Println(c)
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a;
    cin >> b;
    if (a > b) {
        cout << "a > b" << endl;
    } else if (a < b) {
        cout << "a < b" << endl;
    } else {
        cout << "a == b" << endl;
    }
    return 0;
}

Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//String line = br.readLine();
		Scanner scan = new Scanner(System.in);

	    String a = scan.next();
	    String[] b = a.split("");
	    b[3]="8";
	    
	    for(int i=0;i<b.length;i++)
	        System.out.print(b[i]);
	    System.out.println("");


	}
}


Measured memory_bytes: 23764