akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;
typedef pair<int,int> pii;

int main(){
    int n;
    while(cin >> n, n){
        vector<vector<int>> dp(n+1, vector<int>(4, 1<<30));
        dp[0][0] = 0;
        int befp = 0, beft = 0, ans = -1;
        for(int i = 0; i < n; i++){
            int p, t;
            cin >> p >> t;
            bool ok = false;
            for(int j = 0; j < 4; j++){
                if(dp[i][j] == 1<<30) continue;
                if(j != 0){
                    if(befp*(j+1) + p*(0+1) <= t-beft){
                        ok = true;
                        dp[i+1][1] = min(dp[i+1][1], dp[i][j]+befp+p);
                    }
                }
                if(j != 3){
                    if(abs(befp-p)*(j+1) <= t-beft){
                        ok = true;
                        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+abs(befp-p));
                    }
                }
            }
            if(!ok && ans == -1){
                ans = i+1;
            }
            befp = p, beft = t;
        }
        if(ans != -1){
            cout << "NG " << ans << endl;
            continue;
        }
        ans = 1<<30;
        for(int j = 1; j < 4; j++){
            ans = min(ans, dp[n][j]);
        }
        cout << "OK " << ans+befp << endl;
    }
    return 0;
}


Measured memory_bytes: 3000
#include <iostream>
int delta(int n) {
	int tens = 0;
	while (n > tens) {
		tens += 10;
	}
	return tens - n;
}

int main()
{
	int times[5];
	int time = 0;
	int deltas[5];
	int index_deltamax = 0;
	for (int i = 0; i < 5; i++) {
		std::cin >> times[i]; 
		deltas[i] = delta(times[i]);
	}
	for (int i = 0; i < 5; i++) {
		if (deltas[i] > deltas[index_deltamax])index_deltamax = i;
		time += times[i] + deltas[i];
	}
	time -= deltas[index_deltamax];

	std::cout<<time;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

struct Node {
	int k, d, f;
	vector<int> v;
};

#define MAX_N 100

Node node[MAX_N + 1];
int stamp = 1;

void dfs(int u) {
	if (node[u].d == 0) {
		node[u].d = stamp++;
		for (int i = 0; i < node[u].k; ++i)
			if (node[u].v[i] != u)
				dfs(node[u].v[i]);
		if (node[u].f == 0) node[u].f = stamp++;
	}
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int u;
		cin >> u;
		cin >> node[u].k;
		for (int j = 0; j < node[u].k; ++j) {
			int v;
			cin >> v;
			node[u].v.push_back(v);
		}
		node[u].d = node[u].f = 0;
	}
	for (int i = 1; i <= n; ++i)
		dfs(i);
	for (int i = 1; i <= n; ++i)
		cout << i << " " << node[i].d << " " << node[i].f << endl;
	return 0;
}

Measured memory_bytes: 1224
# -*- coding: utf-8 -*-
m = [1,-1]
def solve():
    a,b,c,d = list(map(int,list(input())))
    for i in m:
        for j in m:
            for k in m:
                if a + b * i + c * j + d * k == 7:
                    a,b,c,d = list(map(str,(a,b,c,d)))
                    i,j,k = list(map(lambda x:"+" if x==1 else "-",(i,j,k)))
                    print(a+i+b+j+c+k+d+"=7")
                    return
solve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
//int dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1 ,0};
 
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
 
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }
 
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
 
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }
 
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};



int main(){
double L;
cin >> L;
prints((L * L * L) / 27);

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int k,x,q;
    cin>>k>>x;
    q=x%100;
    x=x/100;
    k=k*5;
    if(x<k && q<100 || x==k && q==0)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}


Measured memory_bytes: 256
N = 0
N, A, B, C = [int(s) for s in input().split()]

bamboos = [int(input()) for _ in range(N)]


def divide(l):
    if len(l) == 0:
        return []
    if len(l) == 1:
        return [
            [[], [], []],  # 使わない
            [[l[0]], [], []],  # A で使う
            [[], [l[0]], []],  # B で使う
            [[], [], [l[0]]],  # C で使う
        ]

    res = []
    for a, b, c in divide(l[1:]):
        # 使わない
        res.append([a, b, c])
        # A で使う
        res.append([l[0:1] + a, b, c])
        # B で使う
        res.append([a, l[0:1] + b, c])
        # C で使う
        res.append([a, b, l[0:1] + c])

    return res


min_mp = -1
for a, b, c in divide(bamboos):
    al, ac = sum(a), len(a)
    bl, bc = sum(b), len(b)
    cl, cc = sum(c), len(c)
    if al == 0 or bl == 0 or cl == 0:
        continue

    # 合成に使った魔力
    composite = 10 * ((ac - 1) + (bc - 1) + (cc - 1))
    # 総合魔力
    mp = abs(al - A) + abs(bl - B) + abs(cl - C) + composite

    if mp < min_mp or min_mp == -1:
        min_mp = mp

print(min_mp)


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

int main(void)
{
	int a, b;
	cin >> a >> 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: 3076
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    int ss = s.size();
    s.push_back(0);
    vector<int> ans(ss,0);
    int rcount = 0, lcount = 0;
    int i=0;
    while(i<=ss - 1){
        if(s.at(i) = 'R'){
            while(s.at(i) == 'R'){
                rcount++; i++;
            }
            if(rcount % 2 == 0){
                ans.at(i) += rcount/2;
                ans.at(i-1) += rcount/2;
            }else{
                ans.at(i) += (rcount-1)/2;
                ans.at(i-1) += (rcount+1)/2;
            }
            rcount = 0;
        }
        if(s.at(i) = 'L'){
            while(s.at(i) == 'L'){
                lcount++; i++;
            }
            if(lcount % 2 == 0){
                ans.at(i-lcount) += lcount/2;
                ans.at(i-lcount-1) += lcount/2;
            }else{
                ans.at(i-lcount) += (lcount+1)/2;
                ans.at(i-lcount-1) += (lcount-1)/2;
            }
            lcount = 0;
        }
    }
    for(int i=0;i<ss;i++){
        cout << ans.at(i) << " ";
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string.h>
#include<climits>
using namespace std;

int findNum(string a, string b){
    int ans = 0;
    for(int i = 0; i < a.length(); i++)
        if(a[i] != b[i])
            ans++;
    return ans;
}

int main(){
	string s, t;
    cin >> s;
    cin >> t;
    const int n = s.length();
    const int m = t.length();  
    int ans = INT_MAX;
    for(int i = 0; i < n-m+1; i++){
        string str = s.substr(i, m);
        int x = findNum(str, t);
        ans = min(ans, x);
    }
    if(ans == INT_MAX) cout << 0 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3136
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define i_inf int(1e9)
#define i_half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int mod = 1000000007;

ll x, y;

void solve() {
    ll ans = ll_inf;
    if (-y >= -x)ans = min(ans, 1 - y + x + 1);
    if (y >= -x) ans = min(ans, 1 + y + x);
    if (-y >= x) ans = min(ans, 1 - y - x);
    if (y >= x) ans = min(ans, y - x);
    cout << ans << endl;
}

int main() {
    cin >> x >> y;
    solve();
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())

ARR = []
for i in range(N):
    ARR.append(int(input()))


def calculate(n,arr):
    arr = sorted(arr)
    arr = np.array(arr)


    total = np.sum(arr)

    indexes = np.where(arr % 10 != 0)

    if total % 10 != 0:
        print(total)
        return

    if indexes[0].__len__() == 0:
        print(0)
        return


    print(total - arr[indexes[0][0]])
    return


calculate(N,ARR)

Measured memory_bytes: 12500
import java.util.Scanner;

public class Main {
	public static void main(String[]args){

		//????????£????????????
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		//?????¶??? a??????b???????????§??????
		if(a < b){
			System.out.println("a < b");
		}else if(a > b){
			System.out.println("a > b");
		}else if(a == b){
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26188
#include <bits/stdc++.h>
    using namespace std;
             
    int main() {
      int N, K, sum = 0;
      cin >> N >> K;
      for (int i = 0; i < N; i++){
        int x;
        cin >> x;
        if(x <= K - x)
          sum += 2 * x;
        else
          sum += 2 * (K - x);
      }
      cout << sum << endl;
    }

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

#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
 
        string T;
 
        cin>>T;
 
        rep(i,T.length()){
                if(T[i]=='?'){
                        T[i]='D';
                }
        }
        cout<<T<<endl;
          return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <string>
#define llint long long

using namespace std;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	int n;
	
	cin >> n >> s;
	for(int i = 0; i < s.size(); i++){
		int c = s[i]-'A';
		c = (c + n) % 26;
		cout << (char)(c+'A');
	}
	cout << endl;
	
	return 0;
}

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

int main(){
  int A,B,M;
  cin >> A>>B>>M;
   int Amin = 100000;
   int Bmin = 100000;
vector<int>a(A);
vector<int>b(B);
   for(int i = 0;i < A;i++){
    cin>>a[i];
    if(a[i] < Amin){
Amin = a[i];
    }
   }
   for(int i = 0;i < B;i++){
    cin >> b[i];
    if(b[i] < Bmin){
Bmin = b[i];
    }
   }

int ans = Amin+Bmin;
   int x[100000],y[100000],c[100000];

for(int i = 0;i < M;i++){
  cin >> x[i] >> y[i] >> c[i];
  if((a[x[i]-1]+b[y[i]-1]-c[i]) < ans){
    ans = a[x[i]-1]+b[y[i]-1]-c[i];
  }
}

cout << ans <<endl;
}

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

int main(){
  int N, l, r, x;
  cin >> N;
  x = 0;
  for (int i = 0; i < N; i++){
    cin >> l >> r;
    x = x + (r - l) + 1;
  }
  cout << x ;
}

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

using namespace std;

int main() {            
	int n, m, X, Y;
	cin >> n >> m >> X >> Y;
	vector<int> x(n);
	for (int &i : x) cin >> i;
	vector<int> y(m);
	for (int &i : y) cin >> i;
	sort(begin(x), end(x));
	sort(begin(y), end(y));
	int c = x[n - 1] + 1;
	if (y[0] >= x[n - 1] + 1 && x[n - 1] + 1 > X && x[n - 1] + 1  <= Y) {
		cout << "No War";
	} else {
		cout << "War";
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int a[400000],b[400000];
int main(void){
    int n,i;
    char s[300000];
   int n1=scanf("%d\n",&n);
   char s1=scanf("%s",s);
   //printf("%d\n",n);
   for( i=0;i<n;i++){
       if(s[i]=='E'){
           a[i+1]=a[i]+1;
           b[i+1]=b[i];
       }else{
           a[i+1]=a[i];
           b[i+1]=b[i]+1;
       }

   }
   int ans =a[i]+b[n]-b[i+1];
   for( i=0;i<n;i++){
       int e=a[n]-a[i+1];
       if(ans>e+b[i]){
           ans=e+b[i];
       }
       
   }
   printf("%d\n",ans);
    
return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string a,b,c,s;
    cin >> a >> b >> c;
    s+=toupper(a[0]);
    s+=toupper(b[0]);
    s+=toupper(c[0]);
    cout << s << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,t,result;
	for(i=1;i<10;i++){
		for(t=1;t<10;t++){
		result=i*t;
		printf("%dx%d=%d\n",i,t,result);
		}
	}
	
	return 0;
}

Measured memory_bytes: 520
#include <iostream>
#include<math.h>

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);//高速化、endlは使わない

  int N, K;
  long int ans=1;

  cin >> N >> K;

  ans *= K;

  for(int i=1;i<N;i++){
    ans = ans*(K-1);
  }
  cout << ans << "\n";
}


Measured memory_bytes: 256
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();

      if(a<b){
         System.out.println("a"+" "+"<"+" "+"b");
      }else if(a>b){
         System.out.println("a"+" "+">"+" "+"b");
      }else{
         System.out.println("a"+" "+"=="+" "+"b");
      }
   }
}

Measured memory_bytes: 26104
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,c,d;
int i[200010];
int u[100000];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  lol ans=0;
  cin >>a>>b;
  for(int n=0;n<b;n++) cin >>c,ans+=c;
  if(a<=ans) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, K;
ll V[100];

signed main(){
    cin >> N >> K;
    REP(i, N) cin >> V[i];
    ll ans = 0;
    priority_queue<ll, vector<ll>, greater<ll>> que;
    REP(i, N + 1){
        REP(j, N + 1){
            ll n = i + j;
            if(n > min(N, K)) continue;
            REP(k, i) que.push(V[k]);
            REP(k, j) que.push(V[N - 1 - k]);
            while(n < K && !que.empty()){
                if(que.top() < 0) que.pop();
                n++;
            }
            ll sum = 0;
            while(!que.empty()){
                sum += que.top();
                que.pop();
            }
            ans = max(ans, sum);
        }
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3640
import numpy as np
import time
import random

start_time = time.time()

def calc(d, q):
    select_rand = select.copy()
    select_rand[d] = q
    last = [0] * 26
    satisfied_rand = 0
    for i in range(1, D+1):
        t = select_rand[i-1]
        satisfied_rand += s[i-1][t-1]
        last[t-1] = i
        for j in range(26):
            satisfied_rand -= c[j] * (i-last[j])
    return (satisfied_rand, select_rand)

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

c = np.array(c)

last = [0] * 26
select = []
satisfied = 0
for i in range(1, D+1):
    last_d = [c[j]*(i-last[j]) for j in range(26)]
    last_d_sum = sum(last_d)
    #選択肢A 満足度の高いものから選ぶ
    s_d = np.array(s[i-1])
    maxindexA = np.argmax(s_d)
    satis_optA = s_d[maxindexA] - last_d_sum + last_d[maxindexA]
    
    #選択肢B コストが大きいものから選ぶ
    last_d = np.array([c[j]*(i-last[j]) for j in range(26)])
    maxindexB = np.argmax(last_d)
    satis_optB = s_d[maxindexB] -last_d_sum + last_d[maxindexB]

    if satis_optA >= satis_optB:
        #Aを選択
        select.append(maxindexA+1)
        satisfied += satis_optA
        last[maxindexA] = i
    else:
        #Bを選択
        select.append(maxindexB+1)
        satisfied += satis_optB
        last[maxindexB] = i

while time.time() - start_time < 1.5:
    d = random.randint(0, D-1)
    q = random.randint(1, 26)
    result = calc(d, q)
    if satisfied < result[0]:
        select = result[1]

for i in range(D):
    print(select[i])


Measured memory_bytes: 27416
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var PairingHeapNode = function PairingHeapNode(val) {
  _classCallCheck(this, PairingHeapNode);

  this.value = val;
  this.head = null;
  this.next = null;
};

function merge(a, b, comp) {
  if (!(a && b)) return a || b;
  if (comp(a.value, b.value)) {
    ;
    var _ref = [b, a];
    a = _ref[0];
    b = _ref[1];
  }b.next = a.head;
  a.head = b;
  return a;
}

function mergeList(s, comp) {
  var n = new PairingHeapNode(null);
  while (s) {
    var a = s,
        b = null;
    s = s.next;a.next = null;
    if (s) {
      b = s;s = s.next;b.next = null;
    }
    a = merge(a, b, comp);a.next = n.next;
    n.next = a;
  }
  while (n.next) {
    var j = n.next;
    n.next = n.next.next;
    s = merge(j, s, comp);
  }
  return s;
}

var PairingHeap = (function () {
  function PairingHeap(comp) {
    _classCallCheck(this, PairingHeap);

    this.comp = comp || function (a, b) {
      return a < b;
    };
    this.root = null;
  }

  _createClass(PairingHeap, [{
    key: "push",
    value: function push(val) {
      this.root = merge(this.root, new PairingHeapNode(val), this.comp);
      return this;
    }
  }, {
    key: "top",
    value: function top() {
      return this.root ? this.root.value : null;
    }
  }, {
    key: "pop",
    value: function pop() {
      if (!this.root) return null;
      var ret = this.root.value;
      this.root = mergeList(this.root.head, this.comp);
      return ret;
    }
  }, {
    key: "empty",
    value: function empty() {
      return !!this.root;
    }
  }]);

  return PairingHeap;
})();


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

(function solve(lines){
  var pq = new PairingHeap();
  lines.forEach(function(line){
    words = line.split(" ");
    if(words[0] === "insert"){
      pq.push(parseInt(words[1]));
    }else if(words[0] === "extract"){
      console.log(pq.pop());
    }
  });
})(lines);

Measured memory_bytes: 224628
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int N, K;
        static long[] V;

        public static void Input()
        {
            var cin = new Scanner();
            var input = cin.SplitReader();
            N = input[0];
            K = input[1];
            V = cin.SplitReaderL();
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            long ans = -1 * INF;
            for(var a = 0; a <= Min(N,K); a++)
            {
                for(var b = 0; b <= Min(N - a, K - a); b++)
                {
                    long sum = 0;
                    List<long> use = new List<long>();

                    if (a > 0)
                    {
                        for (var i = 0; i < a; i++)
                        {
                            sum += V[i];
                            use.Add(V[i]);
                        }
                    }

                    if (b > 0)
                    {
                        for (var i = 0; i < b; i++)
                        {
                            sum += V[N - 1 - i];
                            use.Add(V[N - 1 - i]);
                        }
                    }
                    //ここまでで取り出し

                    use.Sort();
                    int res = Min(a + b, K - a - b);

                    int neg = use.Count(x => x < 0);
                    if (neg > 0 && res > 0)
                    {
                        int c = res >= neg ? neg : res;
                        for (var i = 0; i < c; i++)
                        {
                            sum -= use[i];
                        }
                    }
                   
                    ans = Max(ans, sum);
                }

            }

            Console.WriteLine(ans);

            //Console.Out.Flush();
        }
    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

    }

    public class Graph
    {
        
    }
}

    



Measured memory_bytes: 13524
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = input.nextInt();
        ArrayList<Integer> divs = new ArrayList<>();
        int count = 0;
       for(int i = a; i <= b; i++) {
           if(c % i == 0) {
               if( i >= a && i <= b){
                   count++;
               }
           }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <deque>
#include <math.h>
#include <map>
#include <stack>
#include <list>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <cstring>
#include <climits>
#include <iterator>
#include <cassert>
#include <string>
using namespace std;

#define REP(i, n) for(int i=0;i<n;i++)
#define REPE(i, n) for(int i=0;i<=n;i++)
#define REP2(i, j, n) for(int i=j;i<n;i++)
#define REP2E(i, j, n) for(int i=j;i<=n;i++)
#define REP3(i, j, n, s) for(int i=j;i<n;i+=s)
#define REP3E(i, j, n, s) for(int i=j;i<=n;i+=s)
#define RREP(i, n) for(int i=n;i>=0;i--)
#define RREP2(i, n, j) for(int i=n;i>=j;i--)
#define MSI unordered_map<string, int>
#define MII unordered_map<int, int>
#define VI vector<int>
#define VL vector<long>
#define VPI vector<pair<int, int>>
#define VVI vector<VI>
#define VC vector<char>
#define VVL vector<VL>
#define VVPI vector<VPI>
#define MSVI unordered_map<string, VI>
#define MII unordered_map<int, int>
#define TCASES int t; cin>>t; while(t-- > 0)
#define MOD 1000000007


int main(){
	int n,a,b;
	cin>>n>>a>>b;
	int diff = abs(a-b);

	if(diff%2==0) cout<<"Alice"<<endl;
	else cout<<"Borys"<<endl;
}

Measured memory_bytes: 256
t = Array.new
x = Array.new
y = Array.new

t[0] = x[0] = y[0] = 0

STDIN.gets
STDIN.each_line do |line|
    n = line.chomp.split(' ')
    t.push(n[0].to_i)
    x.push(n[1].to_i)
    y.push(n[2].to_i)
end

for i in 0..t.size-2

    dist = (x[i+1] - x[i]).abs + (y[i+1] - y[i]).abs
    if dist > (t[i+1] - t[i]) || (t[i+1] - t[i] - dist) % 2 == 1 then
        puts "No"
        exit
    end
end

puts "Yes"

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <iomanip>
using namespace std;

vector<bool> used(10, false);
long long int diff = 0;
long long int ans = 0;
long long int pot;
void search(long long int n, int l, long long int num){
    if(l==0){
        long long int d = min(llabs(n-num), pot-llabs(n-num));
        if(d > diff){
            diff = d;
            ans = num;
        }
        return;
    }
    for(int i=0; i<=9; i++){
        if(!used[i]){
            used[i] = true;
            search(n, l-1, num*10+i);
            used[i] = false;
        }
    }
}

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

    int l = str.length();
    long long int n = stoll(str);
    pot = 1;
    for(int i=0; i<l; i++) pot*=10;
    search(n,l,0);

    cout << setfill('0') << setw(l) << right <<  ans << endl;
    return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const ll mod =1000000007;
#define rep(i,n) for(ll i=0; i<n; i++)
int main(){
    int a,b,k;
    cin>>k>>a>>b;
    bool ok = false;
    for(int i=a; i<=b; i++){
        if(i%k==0) ok=true;
    }
    cout<<(ok?"OK":"NG")<<endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define REP(i,a,b) for (auto i = a; i != b; i++)
#define ll long long int
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define pb push_back
#define SQ(a) (a)*(a)
 
using namespace std;


int main()
{
    std::ios::sync_with_stdio(false);
    int T = 1;
    //cin>>T;
    for(int t = 1;t<=T;t++)
    {
       	int n;
       	cin>>n;
       	vector<ll> a(n);
       	for(int  i = 0;i<n;i++)
       	{
       		cin>>a[i];
       	}
       	sort(a.begin(),a.end());
       	int count = 0;
       	for(int i = 0;i<n;i++)
       	{
       		for(int j = i+1;j<n;j++)
       		{
       			for(int k = j+1;k<n;k++)
       			{
       				if(a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k])
       					count++;
       			}
       		}
       	}
       	cout<<count<<endl;
    }

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint x, y, z;
llint dp[45][1<<18][2];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> x >> y >> z;
	
	llint B = 1<<18;
	dp[0][1][0] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < B; j++){
			for(int k = 0; k < 2; k++){
				for(int l = 1; l <= 10; l++){
					llint nj = j, nk = k;
					nj <<= l;
					nj %= B;
					nj |= 1;
					
					if((nj & (1<<(x+y+z))) && (nj & (1<<(y+z))) && (nj & (1<<z))) nk = 1;
					dp[i+1][nj][nk] += dp[i][j][k];
					dp[i+1][nj][nk] %= mod;
				}
			}
		}
	}
	llint ans = 0;
	for(int i = 0; i < B; i++){
		ans += dp[n][i][1];
		ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 166144
n,k=map(int,input().split())
li=list(map(int,input().split()))
q=[]
if k==n:
  q.append(li[n-1]-li[0]+min(abs(li[n-1]),abs(li[0])))
else:
  for i in range(k,n+1):
    if li[i-1]<0:
      q.append(-li[i-k])
    elif li[i-k]>0:
      q.append(li[i-1])
    else:
      q.append(li[i-1]-li[i-k]+min(li[i-1],abs(li[i-k])))
print(min(q))


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

int main(){
  int n, x;
  int count;
  while(true){
    cin >> n >> x;
    count = 0;
    if(n==0&x==0)break;
    for(int i=1; i<=n; i++){
      for(int j=i+1; j<=n; j++) {
        for(int k=j+1; k<=n; k++) {
          if(i+j+k==x) count++;
        }
      }
    }
    cout << count << endl;
  }
}



Measured memory_bytes: 3076
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.nextInt();
        boolean[][] field = new boolean[100][100];
        for (int i = 0; i < 50; i++) {
            for (int j = 0; j < 100; j++) {
                field[i][j] = true;
            }
        }
        for (int i = 0; i < a - 1; i++) {
            int x = i / 50 * 2;
            int y = i % 50 * 2;
            field[x][y] = false;
        }
        for (int i = 0; i < b - 1; i++) {
            int x = i / 50 * 2 + 51;
            int y = i % 50 * 2;
            field[x][y] = true;
        }
        System.out.println("100 100");
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 100; j++) {
                System.out.print(field[i][j] ? '#' : '.');
            }
            System.out.println();
        }
    }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;


int N,M;
int dp[2][3333][2];

inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}

signed main(){
    cin>>N>>M;
    dp[0][0][1]=1;
    for(int i=1;i<=N;i++)dp[0][i][0]=1;

    rep(i,M){
        rep(j,N+1){
            rep(k,2){
                if(j)add(dp[(i+1)&1][j-1][k|(j==1)],dp[i&1][j][k]);
                if(j)add(dp[(i+1)&1][j][k|(j==1)],dp[i&1][j][k]);
                if(j!=N)add(dp[(i+1)&1][j+1][k],dp[i&1][j][k]);
                if(j!=N)add(dp[(i+1)&1][j][k],dp[i&1][j][k]);
                dp[i&1][j][k]=0;
            }
        }
    }

    int ans=0;
    rep(i,N+1)add(ans,dp[M&1][i][1]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int N, K;
   cin >> N >> K;
   vector<ll> V(N);
   for (int i = 0; i < N; i++) cin >> V[i];

   ll ans = 0;
   
   for (int l = 0; l <= K; l++) {
      vector<ll> vl(l);
      copy(V.begin(), V.begin() + l, vl.begin());
      /*
      cout << "vl" << endl;
      for (int i = 0; i < vl.size(); i++) {
         cout << vl[i] << " ";
      }
      cout << endl;
      */
      for (int r = 0; r <= K - l; r++) {
         if (l + r > N) continue;
         vector<ll> vr(l + r);
         copy(V.rbegin(), V.rbegin() + r, vr.begin());
         /*
         cout << "vr" << endl;
         for (int i = 0; i < r; i++) {
            cout << vr[i] << " ";
         }
         cout << endl;
         */
         copy(vl.begin(), vl.end(), vr.begin() + r);
         sort(vr.rbegin(), vr.rend());
         for (int m = 0; m <= K - l - r; m++) {
            if (l + r < m) continue;
            // cout << l << " " << r << " " << m << endl;
            ll tmp = 0;
            for (int i = 0; i < l + r - m; i++) {
               tmp += vr[i];
            }
            ans = llmax(ans, tmp);
         }
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, n, M, K;

vector<ll> v;

int main(){
    string s,t;
    string add;
    cin >> N >> s >> t;
    for(int i = 0; i < N; ++i) {add.push_back(s[i]);add.push_back(t[i]);}
    cout << add;
    return 0;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{

			int n = int.Parse(Console.ReadLine());
			long[] arr = Console.ReadLine().Trim().Split(' ').Select(hogehoge => long.Parse(hogehoge)).ToArray<long>();

			long sum = 0;

			for (int i = 0; i < arr.Length; i ++)
			{
				for (int j = 0; j < arr.Length; j++)
				{
					if (i != j) sum += arr[i] * arr[j];
				}
			}

			Console.WriteLine(sum / 2);

		}

	}

}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "Y") {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
inline int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,m;
int main(){
	n=read(),m=read();
	if (abs(n-m)>1){
		puts("0");
		return 0;
	}
	ll ans=1;
	for (ll i=1;i<=n;++i) ans=(ans*i)%mod;
	for (ll i=1;i<=m;++i) ans=(ans*i)%mod;
	if (n==m) ans=(ans<<1)%mod;
	printf ("%lld\n",ans);
	return 0;
}


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

#define rep(i,j,n) for(int i=(j);i<(n);++i)
#define erep(i,j,n) for(int i=(j);i<=(n);++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n, m;
	cin >> n >> m;
	vi a(n), b(n);
	rep(i, 0, n) {
		cin >> a[i] >> b[i];
	}
	vi c(m), d(m);
	rep(i, 0, m) {
		cin >> c[i] >> d[i];
	}
	rep(i, 0, n) {
		int num = 1;
		int dist = abs(a[i] - c[0]) + abs(b[i] - d[0]);
		rep(j, 1, m) {
			int x = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (dist > x) {
				num = j + 1;
				dist = x;
			}
		}
		cout << num << endl;
	}
}

Measured memory_bytes: 256
# -*- Coding: utf-8 -*-

N,M = map(int,raw_input().split())

L = 0
R = N

for i in xrange(M):
	li,ri = map(int,raw_input().split())
	L = max(L,li)
	R = min(R,ri)

print max(0,R-L+1)

Measured memory_bytes: 2568
#include"bits/stdc++.h"
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	a+=b;
	c+=d;
	if(a>c)
	{
		printf("Left");
	}
	else if(a==c)
	{
		printf("Balanced");
	}
	else
	{
		printf("Right");
	}
} 

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, a, b, c;
	cin >> n >> a >> b >> c;
	for (int h = 1; h <= c - a; h++) {
		cout << 'U';
	}
	for (int h = 1; h <= b - n; h++) {
		cout << 'R';
	}
	cout << 'D';
	for (int h = 1; h <= b - n - 1; h++) {
		cout << 'L';
	}
	for (int h = 1; h <= c - a - 1; h++) {
		cout << 'D';
	}
	cout << 'L';
	cout << 'L';
	for (int h = 1; h <= c - a + 1; h++) {
		cout << 'U';
	}
	for (int h = 1; h <= b - n + 1; h++) {
		cout << 'R';
	}
	cout << 'D';
	cout << 'R';
	cout << 'D';
	cout << 'D';
	for (int h = 1; h <= b - n - 1; h++) {
		cout << 'L';
	}
	for (int h = 1; h <= c - a - 1; h++) {
		cout << 'D';
	}
	cout << 'L';
	cout << 'L';
	cout << 'U';
	cin >> n;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[200005];
	int n, T; scanf("%d %d",&n,&T);
	for(int i = 1; i <= n; i++)
		scanf("%d",&a[i]);
	long long int ans = 0;
	for(int i = 2; i <= n; i++)
	{
		ans += min(T,a[i]-a[i-1]);
	}
	ans += T;
	printf("%lld\n",ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string s;
int main(void){
    cin>>s;
    if(s[0]=='9'||s[1]=='9'){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,temp,r,sum=0;
  cin>>n;
  temp=n;
  while(temp!=0)
  {
    r=temp%10;
    sum=sum+r;
    temp=temp/10;
  }
  if(n%sum==0)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int N,M,ans=0;
vector<int> V[9];
int a,b;

void dfs(int i,int v,int n,vector<bool> visited){
    //cout <<i<<" "<<v<<endl;
    if(i==n)ans++;
    for(int x:V[v]){
        if(visited[x])continue;
        visited[x]=true;
        dfs(i+1,x,n,visited);
        visited[x]=false;
    }
}

int main(){
    cin >>N >>M;
    for(int i=0;i<M;i++){
        cin >>a >>b;
        V[a].push_back(b);
        V[b].push_back(a);
    }  

    //cout <<endl;
    vector<bool> visited(N+1,false);
    visited[1]=true;
   dfs(1,1,N,visited);
cout <<ans<<endl;

}


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


int main(){
  
  long long N, K, H, S;
  S = 0;
  cin >> N >> K;
  vector<long long> h(N);
  
  if(K >= N){
    cout <<  "0" << endl;
  }
  else{  
  for(int i = 0; i < N; i++){
    cin >> h.at(i); 
  }
    sort(h.begin(), h.end());
  for(int i = 0; i < N - K; i++){
    S += h.at(i);
  }
    cout << S << endl;
  }
  
  
}

Measured memory_bytes: 1792
//Program.cpp
//Problem Statement - 

#include <bits/stdc++.h>
#include <map>
#include <unordered_map>
#include <algorithm>
using namespace std;

//Author: Varun Goyal (@govarun)

#define f(i, n) for(int i=0;i<(n);++i)
#define fa(i, a, n) for(int i=(a);i<=(n);++i)
#define fd(i, a, n) for(int i=(a);i>=(n);--i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define popb pop_back
#define ull unsigned long long
#define debug if(GOVARUN) cerr
#define d0(x) debug <<#x<<" = "<<x<<' '
#define d1(x) debug <<"> "<<#x<<" = "<<x<<'\n'
#define d2(x, y) debug <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<'\n'
#define d3(x, y, z) debug <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<' '<<#z<<" = "<<z<<'\n'
#define endl '\n'
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector< pair<int, int> > vpii;
inline bool EQ(double a, double b) { 
return fabs(a-b) < 1e-9; }
inline int two(int n) { return 1 << n; }

const ll mod = 1e9 + 7;
const int maxn = 1e5 + 5;

void pre(){

    
}


void solve();

int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    #ifdef GOVARUN
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else 
    #define GOVARUN 0
    #endif
    int TC = 1;
    // cin >> TC;
    while(TC--){    
        solve();
    }

    return 0;
}

void solve(){
    char a;
    cin >> a;
    if(a == 'A') cout << 'T';
    if(a == 'T') cout << 'A';
    if(a == 'G') cout << 'C';
    if(a == 'C') cout << 'G';   
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f(i,a,b) for(long long i=a;i<b;i++)
#define pb(i) push_back(i)
#define mk(x,y) make_pair(x,y)
#define F first
#define S second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
using namespace std;

int main(){
	FIO;
	string s;cin>>s;
	ll p=0;
	f(i,0,s.size()){
		if(s[i]=='+') p++;
		else p--;
	}
	cout<<p<<"\n";
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
cnt = 0
for i in range(1,n):
    if a[i] == a[i - 1] + 1:
        cnt += c[a[i - 1] - 1]
cnt += sum(b)
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
//bitset<365> a;const double PI = acos(-1);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
const int INF = 1e9 + 5;
int main() {
    ll N;
    cin >> N;
    vi dp(N, INF);
    vi height(N);
    for(auto &it:height) cin >> it;
    dp[0] = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = i + 1; j <= i + 2; ++j) {
            if(j < N) {
                dp[j] = min(dp[j], dp[i] + abs(height[j] - height[i]));
            }
        }
    }
    cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define st first
#define nd second

const int N = 1e5+5;

int n, m, a, b;

vector <int> v[N];
bool vis[N];
int p[N];

int dp(int wai){
    if(p[wai] != -1) return p[wai];
    vis[wai] = 1;
    int maks=0;
    if(v[wai].size() == 0) return 0;
    for (int i = 0; i < v[wai].size(); i++){
        maks = max(maks, dp(v[wai][i]));
    }
    p[wai] = maks+1;
    return p[wai];
}

int32_t main() {
	ios_base::sync_with_stdio(0);
    cin >> n >> m;
    memset(p, -1, sizeof(p));
    for (int i = 0; i < m; i++){
        cin >> a >> b;
        v[a].pb(b);
    }
    for (int i = 1; i <= n; i++){
        if(vis[i] == 0)
            dp(i);
    }
    int maks = 0;
    for (int i = 1; i <= n; i++){
        maks = max(maks, p[i]);
    }
    cout << maks << endl;
}


Measured memory_bytes: 12036
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>
#include <string>
#include <queue>
using namespace std;
#pragma warning (disable: 4996)

string S;

int main() {
	cin >> S; int cnt = 0;
	for (int i = 0; i < S.size() / 2; i++) {
		if (S[i] != S[S.size() - 1 - i]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

ll lcm(ll x,ll y){
  ll i=1;
  while(true){
    if(i*x%y==0){
      return i*x;
    }
    i ++;
  }
}

int main(){
  int N;
  cin >> N;
  vector<ll> T(N);
  for(int i=0;i<N;i++){
    cin >> T.at(i);
  }
  if(N==1){
    cout << T.at(0) << endl;
    return 0;
  }
  sort(T.begin(),T.end());
  reverse(T.begin(),T.end());
  ll ans = lcm(T.at(0),T.at(1));
  for(int i=1;i<N-1;i++){
    ans = lcm(ans,T.at(i+1));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#define MAX_N 100
#define MAX_T 200
#define INF 4000000000000000000
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;

int main(){
  int w1,w2,s1,s2,res,cap;
  bool ws[3001]={},ss[3001]={};
  int aw,as;
  cin>>w1>>w2>>s1>>s2>>res>>cap;
  
  aw=w1*100;as=0;
  ws[0]=true;ss[0]=true;
  for(int i=0;i<=cap;i+=100){
    if(!ws[i])continue;
    if(i+w1*100<=cap)ws[i+w1*100]=true;
    if(i+w2*100<=cap)ws[i+w2*100]=true;
  }
  for(int i=0;i<=cap;i++){
    if(!ss[i])continue;
    if(i+s1<=cap)ss[i+s1]=true;
    if(i+s2<=cap)ss[i+s2]=true;
  }
  for(int w=0;w<=cap;w+=100){
    if(!ws[w])continue;
    for(int s=0;s<=cap;s++){
      if(!ss[s])continue;
      if(w+s<=cap && w*res>=s*100){
        if(s*(as+aw)>as*(s+w)){
          aw=w;as=s;
        }
      }
    }
  }
  cout<<as+aw<<" "<<as<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();

        System.out.println( (A*B%2 == 1) ? "Yes" : "No" );
    }
}


Measured memory_bytes: 22728
#include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	 cin>>n;
	 n=n%10;
	 if(n==2||n==4||n==5||n==7||n==9) cout<<"hon";
	 else if(n==3) cout<<"bon";
	 else cout<<"pon";
	return 0;
}



Measured memory_bytes: 3060