akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
  static int m,f,r;
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      int m= sc.nextInt();
      int f = sc.nextInt();
      int r = sc.nextInt();
      if (m == -1 && f == -1 && r == -1) {
        break;
      }
      int total = m + f;
      if (total >= 80) {
        System.out.println("A");
      } else if (total < 80 && total >= 65) { 
        System.out.println("B");
      } else if (m == -1 || f == -1) {
        System.out.println("F");
      } else if (total < 65 && total >= 50) {
        System.out.println("C");
      } else if (total < 50 && total >= 30 && r < 50) {
        System.out.println("D");
      } else if (total < 50 && total >= 30 && r >= 50) {
        System.out.println("C");
      } else {
        System.out.println("F");
      }
    }
  }
}


Measured memory_bytes: 26328
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <queue>
#include <cstdint>
using namespace std;

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


long long int combination( int n,  int r) {
  if(n==0 || n==1) {return 0;}

  if ( r * 2 > n ) r = n - r;
  long long int dividend = 1;
  long long int divisor  = 1;
  for ( int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int main()
{
  long long int a, b; cin >> a >> b;
  cout << combination(a,2) + combination(b,2) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string S, T;
    cin >> S >> T;
    T.pop_back();
    if(S == T)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
a, b, x = gets.chomp.split.map(&:to_f)

if x > a*a*b/2
  min, max = 0, Math.atan(b/a)
  while (max - min) * 180 / Math::PI > 10**-7
    mean = (max + min) / 2
    if x < a*a*b - a*a*a*Math.tan(mean)/2
      min = mean
    else
      max = mean
    end
  end
else
  min, max = Math.atan(b/a), Math::PI/2
  while (max - min) * 180 / Math::PI > 10**-7
    mean = (max + min) / 2
    if x < a*b*b/(2*Math.tan(mean))
      min = mean
    else
      max = mean
    end
  end
end


puts((max + min) * 90 / Math::PI)

Measured memory_bytes: 2044
#include <iostream>
#include <vector>

int main(){
  int N;
  std::cin >> N;
  std::vector<int> H(N);
  for(int i=0;i<N;i++) std::cin >> H.at(i);
  int count = 0;
  int max=0;
  for(int i=0;i<N;i++){
    if(H.at(i)>=max){
      count++;
      max=H.at(i);
    }
  }

  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 200005;
int n, a[MAXN], cnt[MAXN];
LL val[MAXN], m;
int main () {
	scanf("%d%lld", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]), ++cnt[a[i]], val[a[i]] += a[i];
	sort(a + 1, a + n + 1);
	for(int i = 100000; i >= 1; --i) cnt[i] += cnt[i+1], val[i] += val[i+1];
	int l = 0, r = 200000, mid;
	LL tot;
	while(l < r) {
		mid = (l + r + 1) >> 1;
		tot = 0;
		for(int i = 1; i <= n; ++i) tot += cnt[max(1,mid-a[i])];
		if(tot >= m) l = mid;
		else r = mid - 1;
	}
	LL ans = 0; tot = 0;
	for(int i = 1; i <= n; ++i) ans += val[max(1, l+1-a[i])]+1ll*a[i]*cnt[max(1, l+1-a[i])], tot += cnt[max(1, l+1-a[i])];
	m -= tot;
	ans += m*l;
	printf("%lld\n", ans);
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
 
int main() {
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
 
    char next = sa[0];
    int ia = 1, ib = 0, ic = 0;
    int na = sa.size() + 1, nb = sb.size() + 1, nc = sc.size() + 1;
    string ans;
    while (1) {
        if (next == 'a') { next = sa[ia]; ia++; }
        else if (next == 'b') { next = sb[ib]; ib++; }
        else { next = sc[ic]; ic++; }
 
        if (ia == na) { ans = 'A'; break; }
        else if (ib == nb) { ans = 'B'; break; }
        else if (ic == nc) { ans = 'C'; break; }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;




int main(){
	ll x; cin>>x;

	ll money=100;
	ll time=0;

	while(money<x){
		money+=money/100;
		time++;
	}

	cout<<time<<endl;
}


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

int main(){
	int n,m;
	cin>>n>>m;
	int a[n][m],b[m],c;
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>a[i][j];
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++){
		c=0;
		for(int j=0;j<m;j++) c+=a[i][j]*b[j];
		cout<<c<<endl;
	}
	return 0;
}



Measured memory_bytes: 3112
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int count = 0;
        
        for(int i = 0; i < n; i++){
            int num = sc.nextInt();
            while(num % 2 == 0){
                num = num / 2;
                count++;
            }
        }

        System.out.println(count);
        
    }
}

Measured memory_bytes: 33612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m,ans=0;
	cin >> n >> m;
	vector<pair<int,int>> v(n);
	set<int> free;
	for(int i=1;i<=m;i++){
		free.insert(i);
	}
	for(int i=0;i<n;i++){
		cin >> v[i].second >> v[i].first;
		v[i].first *= -1;
	}
	sort(v.begin(),v.end());
	for(auto&p:v){
		auto it = free.lower_bound(p.second);
		if(it != free.end()){
			//cout<<"p=("<<p.first<<","<<p.second<<")\n";
			//cout<<"*it="<<*it<<"\n";
			free.erase(it);
			ans += -p.first;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string a[1000];
bool cmp(string x,string y)
{
	return x<y;
}
int main()
{
	ll n,m;
	scanf("%lld%lld",&n,&m);
	for (ll i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for (ll i=1;i<=n;i++)
	{
		cout<<a[i];
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	bool res = true;

	string t = s;
	reverse(all(s));
	if (s != t)
	{
		res = false;
	}

	string p = s.substr(0, s.length() / 2);
	string p0 = p;
	reverse(all(p0));
	if (p != p0)
	{
		res = false;
	}

	ll x = (s.length() + 3) / 2 - 1;
	string q = s.substr(x, s.length() - x);
	string q0 = q;
	reverse(all(q0));
	if (q != q0)
	{
		res = false;
	}

	println((res ? "Yes" : "No"));
}

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

using ll = long long;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n, h[25];
int main() {
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> h[i];

	int ans = 0;
	int m = 0;
	for (int i = 0; i < n; ++i) {
		if (m <= h[i])
			++ans;
		m = std::max(h[i], m);
	}

	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

alias Point = Tuple!(int, "x", int, "y");

int maxBipartiteMatching(bool[][] g) {

    bool mbm(int p, int[] left, int[] right, bool[][] g, bool[] used) {
        for (int i = 0; i < right.length; i++) {
            if (g[p][i] && right[i] == -1) {
                left[p] = i;
                right[i] = p;
                return true;
            }
        }

        for (int i = 0; i < right.length; i++) {
            if (g[p][i] && !used[i]) {
                used[i] = true;
                if (mbm(right[i], left, right, g, used)) {
                    left[p] = i;
                    right[i] = p;
                    return true;
                }
            }
        }
        return false;
    }

    auto left = new int[g.length];
    auto right = new int[g[0].length];
    left[] = -1;
    right[] = -1;
    int cnt = 0;
    for (int i = 0; i < left.length; i++) {
        auto used = new bool[left.length];
        if (mbm(i, left, right, g, used)) {
            cnt++;
        }
    }
    return cnt;
}

int calc(Point[] ab, Point[] cd) {
    assert(ab.length == cd.length);

    auto n = ab.length;
    auto g = new bool[][](n, n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (ab[i].x < cd[j].x && ab[i].y < cd[j].y) {
                g[i][j] = true;
            }
        }
    }
    return maxBipartiteMatching(g);
}

void main() {
    int n = readint;

    Point[] ab, cd;
    for (int i = 0; i < n; i++) {
        auto xy = readints;
        ab ~= Point(xy[0], xy[1]);
    }
    for (int i = 0; i < n; i++) {
        auto xy = readints;
        cd ~= Point(xy[0], xy[1]);
    }

    writeln(calc(ab, cd));
}


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


int H, W, K;
ll zentai = 1;
ll yoko[10] = {};

void kazoeru(int A) {
	for (int i = A; i < W; i++) {
		int kari = zentai;
		zentai++;
		kazoeru(i + 2);
		yoko[i] += zentai - kari;
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	cin >> H >> W >> K;
	kazoeru(1);

	ll mod = 1e9 + 7;
	ll dp[101][10] = {};
	dp[0][1] = 1;
	rep(i, H) {
		rep1(ii, W) {
			dp[i + 1][ii] += (dp[i][ii - 1] * yoko[ii - 1]) % mod;
			dp[i + 1][ii] += (dp[i][ii + 1] * yoko[ii]) % mod;
			dp[i + 1][ii] += (dp[i][ii] * (zentai - yoko[ii - 1] - yoko[ii])) % mod;
			dp[i + 1][ii] %= mod;
		}
	}
	co(dp[H][K]);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  vector<int> v(n);
  rep (i, k) {
    int d;
    cin >> d;
    rep (j, d) {
      int tmp;
      cin >> tmp;
      v[tmp - 1]++;
    }
  }

  rep (i, n) {
    if (v[i] == 0) ans++;
  }

  P(ans);

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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 T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


int H,W;
vector<string> field;
vector<int> x2 = {0, 1}, y2 = {1, 0};

int main() {
  cin >>H >>W;
  field.assign(H, ""); rep(i, H) cin >>field.at(i);
  vector<vector<int>> dist(H, vector<int>(W, MOD));

  queue<pair<int,int>> que;
  dist[0][0] = field[0][0] == '#' ? 1 : 0;
  que.push({0,0});

  while (!que.empty()){
    auto v = que.front(); que.pop();
    for (int k=0; k<x2.size(); k++){
      int i = v.first;
      int j = v.second;
      int ni = i + y2[k];
      int nj = j + x2[k];
      if (ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
      if (dist[ni][nj] == MOD) que.push({ni,nj});
      int wall = field[i][j] == field[ni][nj] ? 0 : 1;
      chmin(dist[ni][nj], dist[i][j] + wall);
    }
  }
  int buf1 = field[0][0] == '#' ? 1 : 0;
  int buf2 = field[H-1][W-1] == '#' ? 1 : 0;
  int res = (dist[H-1][W-1] + 1) / 2;
  cout <<res <<endl;
}


Measured memory_bytes: 256
import numpy as np
n,m = map(int,input().split())
lr = []
for i in range(m):
    lr.append(list(map(int,input().split())))
card = [0] * (n+1)
for i in range(m):
    card[lr[i][0]-1] += 1
    card[lr[i][1]] -= 1
cum = np.cumsum(np.array(card))
ans = 0
for i in range(n+1):
    if cum[i] == m:
        ans += 1
print(ans)





Measured memory_bytes: 38792
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    for(int i=10;i<12501;i++){
        if(i*8/100==a){
            if(i/10==b){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}

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

#define F(i, a, b) for (int i = a; i <= b; i ++)
#define G(i, a, b) for (int i = a; i >= b; i --)
#define out4(x, y, z, w) { if (debug) printf(#x" = "),W(x),printf(" "#y" = "),W(y),printf(" "#z" = "),W(z),printf(" "#w" = "),W(w),putc('\n'); }
#define out3(x, y, z) { if (debug) printf(#x" = "), W(x), printf(" "#y" = "), W(y), printf(" "#z" = "), W(z), putc('\n'); }
#define out2(x, y) { if (debug) printf(#x" = "), W(x), printf(" "#y" = "), W(y), putc('\n'); }
#define out1(x) { if (debug) printf(#x" = "), W(x), putc('\n'); }
#define outline(x) { if (debug) puts("-------------------------------------------"#x"----------------------------------------"); }
#define outarr(a, L, R) { if (debug) { printf(#a"[%d..%d] = ", L, R); F(i, L, R) W(a[i]), putc(' '); putc('\n'); } }
#define Assert(x) { if ((debug) && (!(x))) { puts("Wrong Answer"); exit(0); } }
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define mem(a, b) memset(a, b, sizeof a)
#define mec(a, b) memcpy(a, b, sizeof a)
#define mx(a, b) ((a) = max(a, b))
#define mn(a, b) ((a) = min(a, b))
#define lowbit(x) ((x) & (-(x)))
#define abs(x) ((max(x, - (x))))
#define get getchar()
#define pb push_back
#define putc putchar

template <typename Int>
void R(Int &x) {
	char c = get; x = 0; Int t = 1;
	for (; !isdigit(c); c = get) t = (c == '-' ? - 1 : t);
	for (; isdigit(c); x = (x << 3) + (x << 1) + c - '0', c = get); x *= t;
}
template <typename Int>
void W(Int x) {
	if (x < 0) { putc('-'); x = - x ; }
	if (x > 9) W(x / 10); putc(x % 10 + '0');
}

#define debug (0)

using namespace std;

const int N = 3e5 + 10;
int n, a[N], f[N], S[N];
int A, B, Ans;

bool ok(int md) {
	f[0] = 1; int Min = 0;
	F(i, 1, n + 1) {
		f[i] = 0;
		if (i % 2 == 0 && S[i - 1] - Min >= md)
			f[i] = 1;
		if (f[i] && S[i] < Min)
			Min = S[i];
	}
	out1(md);
	outarr(f, 1, n);
	return f[n + 1];
}

int main() {
//	freopen("data.in","r",stdin);

	R(n);
	F(i, 1, n) R(a[i]), A += a[i] * (i & 1), B += a[i], S[i] = a[i] * (i & 1 ? 1 : (-1));
	F(i, 1, n) S[i] += S[i - 1];
	B -= A;
	if (n & 1) {
		Ans = A;
		out2(A, B);
		int l = 0, r = B + A;
		while (l <= r) {
			int md = (l + r >> 1);
			if (ok(md))
				mx(Ans, B + md), l = md + 1;
			else
				r = md - 1;
		}
	}
	else
		Ans = max(A, B);
	W(Ans), putc(' '), W(A + B - Ans);
}

Measured memory_bytes: 7156
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
		static void Main(string[] args) {
			char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		string res = "Yes";
		//int res = 0;

		int[] vals = parseAry(Console.ReadLine().Split(cs));
		int n = vals[0];
		int m = vals[1];
		vals = parseAry(Console.ReadLine().Split(cs));

		int cnt =0;
		int s = vals.Sum();
		for(int i =0; i < n; i++) {
			if(1.0*vals[i] >= ((1.0*s) / (4.0 * m))) {
				cnt++;
			}
		}
		if(cnt >= m) { } else { res = "No"; }

		Console.WriteLine(res);
		return;


	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 13268
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N;
    cin >> N;
    vector<int> b(N);
    REP(i, N) cin >> b[i];

    int bn = b.size();
    vector<int> ans;
    REV(i, N - 1, 0) {
        bool found = false;
        int target = -1;
        REV(j, bn - 1, 0) {
            if (!found && j + 1 == b[j]) {
                found = true;
                ans.push_back(b[j]);
                target = j;
                break;
            }
        }

        if (!found) {
            cout << -1 << endl;
            return 0;
        }

        bn--;
        REP(j, bn) {
            if (j < target) continue;
            b[j] = b[j + 1];
        }
    }

    reverse(ans.begin(), ans.end());

    REP(i, ans.size()) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

int main() {
  string S;
  cin>>S;
  char A=S.at(2);
  char B=S.at(3);
  char C=S.at(4);
  char D=S.at(5);
  if(A==B&&C==D){
    cout<<"Yes"<< endl;
  }
  else{
    cout<<"No"<< endl;
  }
}


Measured memory_bytes: 256
import math

X = int(input())

ans = 1
for i in range(X+1):
  for j in range(2,max(math.floor(math.sqrt(X-i))+1,3)):
    beki = False
    tmp = X-i
    while True:
      if tmp%j != 0:
        if tmp == 1:
          beki = True
        break
      else:
        tmp //= j
    if beki:
      ans = X-i
      break
  if beki:
    break

print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

map<Pi, ll> dp;

ll calc(ll s, ll x) {
	if (dp.find(mp(s, x)) != dp.end())return dp[mp(s, x)];
	if (s == 0) {
		return 1;
	}
	else if (s == 1) {
		if (x == 0)return 1;
		else return 2;
	}
	return dp[mp(s, x)] = (calc(s / 2, x / 2) + calc((s - 2) / 2, x / 2) + calc((s - 1) / 2, (x - 1) / 2)) % MOD;
}

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

	ll N;
	cin >> N;

	cout << calc(N, N) << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
            int x = sc.nextInt();
            int y = sc.nextInt();
            
            System.out.print(x * y );
            System.out.println(" " + (2 * x + 2 * y));
        }
    }
}


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

typedef long long ll;
#define ll long long
#define all(v) (v).begin(), (v).end()
#define _for(i,a,b) for(int i = (a); i < (b); i++) 
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)

const int kMod = 1e9 + 7;
const int kMaxN = 1e6 + 5;

void taskA(){
    string s; cin >> s;
    int n = s.size();
    cout << (s[2]==s[3] && s[4]==s[5] ? "Yes\n" : "No\n");
    return;
}

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    taskA();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 1000000;

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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int main(){
    int N,M; cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    int ac=0,wa=0;
    vector<int> cc(N,-1);
    vector<int> aa(N,0);
    for(int i=0;i<M;i++){
        cin >> p[i] >> S[i];
        if(S[i]=="AC"){
            if(cc[p[i]-1]==-1){
                cc[p[i]-1] = i;
                ac++;
            }
        }
    }
    for(int i=0;i<M;i++){
        if(S[i]=="WA"){
            if(cc[p[i]-1]==-1){
                continue;
            }else{
                if(i<cc[p[i]-1]) wa++;
            }
        }
    }
    cout << ac << " " << wa << endl;
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  string s;
  cin>>s;
  stack<char> a,b;
  rep(i,s.size() ){
    if(s[i]=='B'){
      if(a.empty()) continue;
      else a.pop();
    }else{
      a.push(s[i]);
    }
  }
  while(!a.empty()){
    b.push(a.top());
    a.pop();
  }
   while(!b.empty()){
     cout<<b.top();
     b.pop();
  }
  cout<<endl;

  return 0;
}






Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>
#define MAX_N 200200
int par[MAX_N], rank[MAX_N];
void init(int n){for(int i=0; i<n; i++){par[i] = i;rank[i] = 0;}}
int root(int x){return par[x]==x?x:(par[x]=root(par[x]));}
bool same(int x, int y){return root(x) == root(y);}
void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x == y) return;
    if(rank[x] < rank[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rank[x] == rank[y])rank[x]++;
    }
}
int sz[1<<18];
int N, M, ans = 0;
int main(){
	scanf("%d%d", &N, &M);
	init(N);
	while(M--){
		int A, B;
		scanf("%d%d", &A, &B);
		A--; B--;
		unite(A, B);
	}
	for(int i=0; i<N; i++){
		sz[root(i)]++;
		if(ans < sz[root(i)])ans = sz[root(i)];
	}
	printf("%d\n", ans);
	return 0;
}

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

const int N = 250010;
const int mod[] = {1000000007, 1000000009};
const int P[] = {131, 233};

typedef long long LL;

int Pow[2][N * 2]; char s[N];

inline int FUCK(int x, int y, int mod) {
    int res = 1;
    for (; y; y >>= 1, x = (LL)x * x % mod) if (y & 1) res = (LL)res * x % mod;
    return res;
}

struct Data {
    int val[2];

    Data(int a = 0, int b = 0) {val[0] = a, val[1] = b;} 

    Data operator + (const Data &b) {
        Data res;
        res.val[0] = (val[0] + b.val[0]) % mod[0];
        res.val[1] = (val[1] + b.val[1]) % mod[1];
        return res;
    }

    Data operator - (const Data &b) {
        Data res;
        res.val[0] = (val[0] - b.val[0] + mod[0]) % mod[0];
        res.val[1] = (val[1] - b.val[1] + mod[1]) % mod[1]; 
        return res;
    }

    Data operator * (const int b) {
        Data res = *this;
        int a = b >= 0 ? Pow[0][b] : FUCK(P[0], (LL)(mod[0] - 2) * (-b) % (mod[0] - 1), mod[0]);
        int c = b >= 0 ? Pow[1][b] : FUCK(P[1], (LL)(mod[1] - 2) * (-b) % (mod[1] - 1), mod[1]);
        res.val[0] = (LL)res.val[0] * a % mod[0];
        res.val[1] = (LL)res.val[1] * c % mod[1];
        return res;
    }

    bool operator < (const Data &b) const {
        if (val[0] != b.val[0]) return val[0] < b.val[0];
        return val[1] < b.val[1];
    }
};

map<Data, int> mp;

inline void increase(Data &a, int b) {
    a = a + (Data){Pow[0][b], Pow[1][b]};
}

inline void decrease(Data &a, int b) {
    a = a - (Data){Pow[0][b], Pow[1][b]};
}

int main() {
    int n; scanf("%d%s", &n, s + 1); Data all;
    Pow[0][0] = Pow[1][0] = 1;
    for (int i = 0; i <= 1; i++)
        for (int j = 1; j <= n * 2; j++)
            Pow[i][j] = (LL)Pow[i][j - 1] * P[i] % mod[i];
    for (int i = 1, ls = 0; i <= n; i++) {
        if (s[i] == '<') ls--;
        else if (s[i] == '>') ls++;
        else if (s[i] == '+') increase(all, ls + n);
        else decrease(all, ls + n);
    }
    Data fuck; mp[all] = 1; LL res = 0;
    for (int i = 1, ls = 0; i <= n; i++) {
        if (s[i] == '<') ls--;
        else if (s[i] == '>') ls++;
        else if (s[i] == '+') increase(fuck, ls + n);
        else decrease(fuck, ls + n);
        res += mp[fuck], mp[fuck + all * ls]++;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 35584
n = int(input())
for _ in range(n):
    a, b = input(), input()
    indices = []
    for cb in b:
        bgn_idx = 0
        for i in range(len(indices) + 1):
            chr_idx = a.find(cb, bgn_idx) + 1
            if chr_idx:
                if i < len(indices):
                    bgn_idx = indices[i]
                    if chr_idx < bgn_idx:
                        indices[i] = chr_idx
                else:
                    indices.append(chr_idx)
            else:
                break
    print(len(indices))

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M;
    cin >> N >> M;
    vector<vector<int>> adj(N+1);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    queue<int> q({1});
    vector<int> visited(N+1, 0);
    visited[1] = 1;
    int cnt = 0;
    while (!q.empty()) {
        ++cnt;
        auto front = q.front(); q.pop();
        for (int next : adj[front]) {
            if (!visited[next]) {
                visited[next] = front;
                q.push(next);
            }
        }
    }
    if (cnt < N-1) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
        for (int i = 2; i <= N; ++i) {
            cout << visited[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 10132
////////////////////////////////////
//          ,.                    //
//         (_|,.                  //
//        ,' /, )_______   _      //
//     __j o``-'        `.'-)'    //
//    (")                 \'      //
//     `-j                |       //
//        `-._(           /       //
//           |_\  |--^.  /        //
//          /_]'|_| /_)_/         //
//             /_]'  /_]'         //
//                                //
//           PIGMEISTER™          //
//                                //
////////////////////////////////////

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

#define ll long long
#define ull unsigned long long
#define mod (ll)1000000007
#define sidha(i, x, n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i, x, n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mii map<ll, ll>
#define vi vector<ll>
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define modInv(x) powah(x, mod-2)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
ll powah(ll, ll);

int main()
{
    jaldi;
    
    ll n, k;
    cin >> n >> k;
    ll h[n];
    sidha (i, 0, n)
        cin >> h[i];
    ll ans = 0;
    sort (h, h+n);
    sidha (i, 0, n-k)
        ans += h[i];
    cout << ans << endl;
    
    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % mod; 
        y = y>>1;
        x = (x*x) % mod; 
    } 
    return res; 
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#define ll long long

int main(){
	
	char str[3][255];
	int flag = 1;
	
	for(int i = 0; i < 3; i++){
		scanf("%s", str[i]);
	}
	for(int i = 0; i < 3; i++){
		int len = strlen(str[i]);
		if(str[i][len - 1] != str[i + 1][0] && i < 2){
			flag = 0;
		}
	}
	if(flag == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}

	return 0;
}



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

int main() {
  string str1;
  string str2;
  cin >> str1;
  cin >> str2;
  
  for  (int i = 0; i < str2.size(); i++) {
    if (i == str1.size()) {
      cout << "Yes" << endl;
      break;
    }
    else if (str1.at(i) == str2.at(i)) {
    }
    else {
      cout << "No" << endl;
      break;
    }
  }

}

Measured memory_bytes: 3628
S = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'

s_l = S.split(', ')

K = int(input())

print(s_l[K-1])


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
   ll n;cin >>n;
   vector<vector<ll>>g(n);
    for (int i = 0; i < n - 1; ++i) {
        ll a,b;cin >>a>>b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<ll>que;
    que.push(0);
    vector<ll>d0(n,INF);
    vector<ll>pre(n,INF);
    d0[0]=0;
    while(!que.empty()) {
        ll f = que.front();
        que.pop();
        if(f!=0) {
            d0[f] =d0[pre[f]]+1;
        }
        for (auto u:g[f]) {
            if (d0[u] == INF) {
                que.push(u);
                pre[u]=f;
            }
        }
    }
    vector<ll>dn(n,INF);
    dn[n-1]=0;
    que.push(n-1);
    pre.assign(n,INF);
    while(!que.empty()) {
        ll f = que.front();
        que.pop();
        if(f!=n-1) {
            dn[f] =dn[pre[f]]+1;
        }
        for (auto u:g[f]) {
            if (dn[u] == INF) {
                que.push(u);
                pre[u]=f;
            }
        }
    }
    ll sunu=0;
    ll fen=0;
    for (int i = 0; i < n; ++i) {
//        cout <<d0[i]<<" "<<dn[i]<<endl;
        if(d0[i]<=dn[i]){
            fen++;
        }
        if(d0[i]>dn[i]){
            sunu++;
        }
    }
    if(sunu>=fen){
        puts("Snuke");
    }
    else {
        puts("Fennec");
    }
   return 0;
}



Measured memory_bytes: 8576
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1

"""

import collections
import itertools
import operator


class UnionFind:
    def __init__(self, x):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)
        self.size = collections.defaultdict(lambda: 1)
        if x is not None:
            for elem in range(x+1):
                _, _, _ = self.parent[elem], self.rank[elem],self.size[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.are_same(x,y):
            xx = self.size[x]
            yy = self.size[y]
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += xx
            else:
                self.parent[y] = x
                self.size[x] += yy
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def Size(self,x):
        return self.size[self.find(x)]

    def are_same(self, x, y):
        '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]

n,k = m()

h = l()

po = [1 for i in range(n)]

for i in range(k):
    a,b = m()
    if h[a-1] > h[b-1]:
        po[b-1] = 0
    elif h[a-1] < h[b-1]:
        po[a-1] = 0
    else:
        po[a-1] = 0
        po[b-1] = 0

co = 0

for i in range(n):
    if po[i] == 1:
        co += 1



print(co)



Measured memory_bytes: 85536
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
    if p[i - 1] <= p[i] <= p[i + 1] or p[i + 1] <= p[i] <= p[i - 1]:
        ans += 1
print(ans)

Measured memory_bytes: 3316
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from heapq import heapify, heappop, heappush

def main():
    N, M = input_nums()
    jobs = {}
    for i in range(1, 10**5+1):
        jobs[i] = [0]
    for i in range(N):
        A, B = input_nums()
        jobs[A].append(B)
    res = 0
    hq = [0]
    heapify(hq)
    for i in range(1, M+1):
        for c in jobs[i]:
            heappush(hq, -c)
        if not hq:
            continue
        res -= heappop(hq)
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 33392
from collections import deque
h,w=map(int,input().split())
h += 2
w += 2
s="#"*w
for _ in range(h-2):
    s += "#" + input() + "#"
s += "#"*w
def bfs(start):
    que=deque([start])
    INF=10**9
    dis=[INF]*(w*h)
    dis[start]=0
    move=(1,-1,w,-w)
    while que:
        v=que.popleft()
        for i in move:
            n=v+i
            if s[n]=="#":
                continue
            dv=dis[v]
            dn=dv+1
            if dis[n] <= dv+1:
                continue
            dis[n]=dn
            que.append(n)
    return max(i for i in dis if i<INF)
ans=max(bfs(v) for v in range(h*w) if s[v] != "#")
print(ans)

Measured memory_bytes: 3316
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n-2):
    if p[i] < p[i+1] and p[i+1] < p[i+2]:
        cnt += 1
    elif p[i] > p[i+1] and p[i+1] > p[i+2]:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)

# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

def main():
	A, P = map(int, input().split(" "))
	#N = int(input())
	#S = input()

	tmp = A*3 + P
	print(tmp // 2)

	


if __name__ == "__main__":
	main()

Measured memory_bytes: 3700
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string S, T; cin >> S >> T;
    ll ans = 0;
    rep(i, 3){
        if(S[i] == T[i]) ans++;
    }
    cout << ans << endstr;
    return 0;
}


Measured memory_bytes: 256
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

n,m = inm()
uf = UnionFind(n)
for i in range(m):
    a,b = inm()
    a -= 1
    b -= 1
    uf.union(a,b)

ans = 0
for i in range(n):
    ans = max(ans,uf.size(i))

print(ans)

Measured memory_bytes: 14576
#include <stdio.h>
int main(void) //accepted
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if (r <= W / 2 && r <= H / 2)
    {
        if (r <= x && x <= W - r && r <= y && y <= H - r)
        {
            puts("Yes");
        }
        else
        {
            puts("No");
        }
    }
    else
    {
        puts("No");
    }
    return 0;
}


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

int f(const int *it, const int *ilast, const int *jt, const int *jlast)
{
  int c = 0;
  for (; it != ilast && jt != jlast; ++it) {
    if (*it == *jt) {
      ++c;
      ++jt;
    }
  }
  return c;
}

int main()
{
  int A, B;
  scanf("%d %d", &A, &B);
  static int as[5000], bs[5000];
  for (int i = 0; i < A; i++) {
    scanf("%d", &as[i]);
  }
  for (int j = 0; j < B; j++) {
    scanf("%d", &bs[j]);
  }

  int ans = 0;
  for (int j = 0; j < B; j++) {
    ans = max(ans, f(as, as+A, bs+j, bs+B));
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
const ll mod = 998244353ll;
int k, n;
vector<string> a;
bool cc;
bool check(string& s) {
	int c;
	for(auto &i : a) {
		c = 0;
		for(int j = 0; j < n; j++)
			c += s[j] != i[j];
		if(c&&c!=2)
			return false;
//		if(cc==false&&c==0)
//			return false;
	}
	return true;
}

int main() {
	ios::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	int n, k, t, a = 0;
	cin >> n >> k;
	while(n--) {
		cin >> t;
		a += t>=k;
	}
	cout << a;
}


Measured memory_bytes: 256