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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  cin >> n;
  
  vector<ull> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  bool pairwise = true;

  
  char flag[1000001] = {};
  ull g = a[0];
  for(int i=0;i<n;i++){
    g = gcd(g,a[i]);
    if(!pairwise&&1==g) break;
    if(!pairwise) continue;
    list<ull> factors;
    primeFactorization(a[i], factors);
    factors.unique();
    for(auto f:factors){
      if(1==flag[f]){
        pairwise = false;
      }
      flag[f] = 1;
    }
  }
  
  if(pairwise){
    cout << "pairwise coprime" << endl;
  }
  else if(g==1){
    cout << "setwise coprime" << endl;
  }
  else{
    cout << "not coprime" << endl;
  }
    
  return 0;
}



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

class AtCode {
  static void Main() {
    var S = Console.ReadLine().Trim();
    var odd = new string(S.Where((x, index) => index % 2 == 0).ToArray());
    var even = new string(S.Where((x, index) => index % 2 == 1).ToArray());
    string answer = "Yes";
    
    //Console.WriteLine(odd);
    //Console.WriteLine(even);
    
    if(odd.Contains("L") || even.Contains("R")) {
      answer = "No";
    }
    Console.WriteLine(answer);
  }
}

Measured memory_bytes: 13268
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion
#define MAX 2147483647

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

  int N;
  cin >> N;
  cout << (double)((N + 1) / 2) / N << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
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;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int n;
    cin>>n;
    vpii r(n);
    vpii b(n);
    rep(i,0,n){
        int a,b;
        cin>>a>>b;
        r[i].first=b;
        r[i].second=a;
    }
    rep(i,0,n){
        int x,y;
        cin>>y>>x;
        b[i].first=y;
        b[i].second=x;
    }
    sort(r.begin(),r.end());
    sort(b.begin(),b.end());
    vb rused(n,false);
    int ans=0;
    rep(bi,0,n){
        ll alt=-1;
        rep(ai,0,n){
            if(!rused[ai]&&b[bi].first>r[ai].second&&b[bi].second>r[ai].first){
                chmax(alt,ai);
            }
        }
        if(alt!=-1)rused[alt]=true,ans++;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second < secondElof.second;
}

ll a;
ll b;
string s;

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

    for(int i=0; i<s.length(); ++i) {
        if (s[i] == '.') continue;
        b *= 10;
        b += s[i] - '0';
    }
           
    a *= b;
    a /= 100;
    cout << a << endl;
    
}



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

int main(){
    
    int n,m; cin >> n >> m;
    
    int *fruit = new int [n];
    for(int i=0;i<n;i++){
      cin >> fruit[i];
      
    }
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        if(fruit[i]>fruit[j]){
          int temp = fruit[i];
          fruit[i] = fruit[j];
          fruit[j] = temp;
        }
      }
    }
    
    for(int i=1;i<n;i++)fruit[i] += fruit[i-1];
 
   printf("%d\n",fruit[m-1]);
    

  

  
  return 0;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
typedef pair<ll, int> ll_i;
const int MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
struct edge { int v, w; };

int main() {
	ll q, h, s, d;
	cin >> q >> h >> s >> d;
	h = min(h, q * 2);
	s = min(s, h * 2);
	d = min(d, s * 2);
	ll x; cin >> x;
	cout << (x / 2) * d + (x % 2) * s << endl;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <float.h>
#include <iostream>
#include <map>
using namespace std;
int main()
{
	int N;
	cin >> N;

	int nA[20];
	int nB[20];
	int nC[20];
	memset(nA, 0, sizeof(nA));
	memset(nB, 0, sizeof(nB));
	memset(nC, 0, sizeof(nC));
	for (int i = 0; i < N; i++)
		cin >> nA[i];
	for (int i = 0; i < N; i++)
		cin >> nB[i];
	for (int i = 0; i < N-1; i++)
		cin >> nC[i];

	int nPrevIdx = -999;
	int nMan = 0;
	int nOmake = 0;
	for (int i = 0; i < N; i++)
	{
		int nNowIdx = nA[i]-1;
		if(nPrevIdx+1 == nNowIdx)
			nMan += nB[nNowIdx] + nOmake;
		else
			nMan += nB[nNowIdx];
		nOmake = nC[nNowIdx];
		nPrevIdx = nNowIdx;
	}

	cout << nMan;
	return 0;
}


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

// author : Petr

// taken from screencast

using namespace std;

int main() {


	int n, cap, wait;

	cin >> n >> cap >> wait;

	int arr[n];

	for(int i=0; i<n; i++) {
		cin >> arr[i];
	}

	sort(arr, arr+n);

	// for(int i=0; i<n; i++) {
	// 	cout << arr[i] << " \n";
	// }

	int ans = 0; // buses
	int cur = 0; // how many people
	int start = 0;

	for(int i=0; i<n; i++) {
		if(cur == 0) {
			start = arr[i]; // starts at time 
			cur = 1;
		}
		else if(cur >= cap) {
			ans++; /// departs
			cur = 1; // everybody leaves
			start = arr[i]; // starts
		}
		else if(arr[i] > start + wait) {
			ans++;
			cur = 1;
			start = arr[i];
		}
		else {
			cur++;
		}
	}

	if(cur > 0) {
		ans++;
	}

	cout << ans;




}

Measured memory_bytes: 640
n=int(input())
a=list(map(int, input().split()))
mod=10**9+7

from collections import Counter
c=Counter(a)

cnt_lst=[0]*n
for key in c:
    cnt_lst[key]+=c[key]

flag=True
if n%2==1:
    if cnt_lst[0]==1:
        cnt_lst.pop(0)
    else:
        flag=False
    for i in range(n-1):
        if (i%2==1 and cnt_lst[i]!=2) or (i%2==0 and cnt_lst[i]!=0):
            flag=False
else:
    for i in range(n):
        if (i%2==1 and cnt_lst[i]!=2) or (i%2==0 and cnt_lst[i]!=0):
            flag=False

print(pow(2,(n//2),mod) if flag else 0)


Measured memory_bytes: 14692
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 1000000
#define MAX_M 10
#define INF 1000000

int s[MAX_M];
int c[MAX_M];

int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;

  for (int i = 0; i < M; i++) {
    cin >> s[i] >> c[i];
  }

  // ---------------------
  // 
  
  int num[N];

  for (int i = 0; i < N; i++) {
    num[i] = -1;
  }
  

  for (int i = 0; i < M; i++) {
    int ind = s[i] - 1;

    if(num[ind] == -1) {
      num[ind] = c[i];
    }

    else if (num[ind] != c[i]) {
      cout << -1 << endl;
      return 0;
    }
    
  }

  if(num[0] == 0 && N > 1) {
    cout << -1 << endl;
    return 0;
  }


  if(M == 0) {

    if(N==1) {
      cout << 0 << endl;
      return 0;
    }
    else if(N==2) {
      cout << 10 << endl;
      return 0;
    }
    else if(N==3) {
      cout << 100 << endl;
      return 0;
    }
    
  }
  
  for (int i = 0; i < N; i++) {

    if(num[i] == -1) {
      if(i == 0){
	cout << 1;
      }
      else cout << 0;
    }
    else cout << num[i];
  }

  cout << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
num, weight = gets.chomp.split(" ").map(&:to_i)
things = Array.new
num.times do
  things << gets.chomp.split(" ").map(&:to_i)
end

# 許容重量ごとの価値の最大値を格納するdp（順次更新）
dp = Array.new(weight + 1, 0)

# 1個目からnum個目までの品物を、ナップサックに入れるべきか順番に確認する
1.upto(num) do |n|
  # n個目の重量をtmp_weight、価値をtmp_valueとする
  tmp_weight = things[n - 1][0]
  tmp_value = things[n - 1][1]
  # 許容重量がweightからtmp_weightまでの場合を、順番に確認する
  # （許容重量がtmp_weight未満の場合、ナップサックに入れることはできないため確認の必要なし）
  # なお、uptoを用いて逆向きに確認すると、ループ中に既に更新した数値を参照してしまうため、正常に動作しない
  weight.downto(tmp_weight) do |w_accepted|
    # 「許容重量がtmp_weight分少ない時の価値 + tmp_value」が「現在格納されている値」よりも大きければ格納する
    if dp[w_accepted] < dp[w_accepted - tmp_weight] + tmp_value
      dp[w_accepted] = dp[w_accepted - tmp_weight] + tmp_value
    end
  end
end

# 最後の品物、最後の許容重量における価値を出力する
puts dp[weight]

## 備忘録として他の方のコードを提出させていただきます。

Measured memory_bytes: 4604
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var S = Str;
		var x = S.Count(c => c == '0');
		var y = S.Length - x;
		WriteLine(S.Length - Abs(x - y));
	}
}


Measured memory_bytes: 13240
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function f(s::String)
	if s=="Vacant"
		0
	elseif s=="Male"
		1
	else
		2
	end
end

function main()
	n = readline() |> parseInt
	list = -ones(Int,n)
	l = 0
	r = n-1
	println(0)
	list[1] = readline() |> chomp |> f
	if list[1]!=0
		println(n-1)
		list[n] = readline() |> chomp |> f
		if list[n]!=0
			ff = 0
			while r-l>1
				m = (l+r)>>1
				println(m)
				list[m+1] = readline() |> chomp |> f
				if list[m+1] == 0
					ff = 1
					break
				else
					if mod(list[m+1]-list[l+1],2)!=(m-l)%2
						r = m
					else
						l = m
					end
				end
			end
			if ff==0
				println(r)
				ans = readline() |> chomp |> f
				if ans!=0
					println(l)
				end
			end
		end
	end	
end

main()

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

int main() {
  int n, f=0;
  cin >> n;
  
  int tmp = n;
  while(tmp > 0)
  {
    f += (tmp % 10);
    tmp /= 10;
  }

  if(n % f == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

}


Measured memory_bytes: 3556
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<cstdlib>
#include<time.h>
using namespace std;
int main()
{
	char s[10];
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int> p(N);
  for(int i=0;i<N;i++) cin >> p.at(i);
  int ans = 0;
  for(int i=0;i<N-2;i++){
    if(p.at(i) < p.at(i+1) && p.at(i+1) < p.at(i+2)) ans++;
    if(p.at(i) > p.at(i+1) && p.at(i+1) > p.at(i+2)) ans++;
    if(p.at(i+2) == p.at(i+1) && p.at(i+1) < p.at(i)) ans++;
    if(p.at(i) == p.at(i+1) && p.at(i+1) < p.at(i+2)) ans++;
  }
  cout << ans << endl;
}

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

int main(){
  int m, d, d10, d1, cnt;
  cnt = 0;
  cin >> m >> d;
  for(int i = 22; i <= d; i++){
    d10 = i / 10;
    d1 = i % 10;
    if(d10 >= 2 && d1 >= 2) {
      if(d10 * d1 <= m && d10 * d1 >= 1) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
cat<<EOF>Source.cpp
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

extern "C"{
int printf (const char *__restrict __format, ...);
int scanf (const char *__restrict __format, ...) ;
}
int max(int a,int b){
	return a>b?a:b;
}
int x[100000],y[100000],x_mod_k[100000],x_div_k[100000];
char s[100000][2];
int n,k;

void add(int*cnt,int x,int t){
	if((x_div_k[x]&1)==0){
		if(t==0){
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
		else{
			cnt[k-x_mod_k[x]]++;
		}
	}
	else{
		if(t==0){
			cnt[k-x_mod_k[x]]++;
		}
		else{
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
	}
}
int ans[2000];
int main(){
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d%s",&x[i],&y[i],s[i]);
		x_mod_k[i]=y[i]%k;
		x_div_k[i]=y[i]/k;
	}
	int Max=0;
	#pragma omp parallel for num_threads(2)
	rep(i,k){
		int cnt[max(n,k)];
		rep(j,max(n,k))cnt[j]=0;
		rep(j,n){
			if(s[j][0]=='B'){
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,0);
				}
				else{
					add(cnt,j,1);
				}
			}
			else{
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,1);
				}
				else{
					add(cnt,j,0);
				}
			}
		}
		rep(j,k){
			if(j)cnt[j]+=cnt[j-1];
			ans[i]=max(ans[i],max(cnt[j],n-cnt[j]));
		}
	}
	rep(i,k)Max=max(Max,ans[i]);
	printf("%d\n",Max);
}
EOF
g++ -Ofast Source.cpp -o Source -fopenmp -std=c++11
./Source

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

template<class T> inline bool chmin(T& a, const T b) { if (a>b) { a=b; return true; } return false; }
template<class T> inline bool chmax(T& a, const T b) { if (a<b) { a=b; return true; } return false; }



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m;
    cin>>n>>m;
    ll ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop

N = int(input())
A = list(map(int, input().split()))

C = [int(1e18) for _ in range(N)]
C[0] = 0
pq = []
for i in range(N):
  heappush(pq, [C[i], i])
while pq != []:
  b = heappop(pq)[:]
  r = b[1]
  for i in range(2):
    if r + i + 1 <= N - 1:
      if C[r+i+1] > abs(A[r+i+1] - A[r]) + C[r]:
        C[r+i+1] = abs(A[r+i+1] - A[r]) + C[r]
        heappush(pq, [C[r+i+1], r+i+1])
print(C[N-1])

Measured memory_bytes: 31088
s = input()
YY = "00 to 99"
MM = [str(i).zfill(2) for i in range(1, 13)]

if s[:2] in MM:
    if s[2:] in MM: print("AMBIGUOUS")
    else: print("MMYY")
else:
    if s[2:] in MM: print("YYMM")
    else: print("NA")

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

// for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

// abbreviati
#define PB(v) push_back(v)
#define MP() make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

// constant
const int INF = 1<<30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet***************************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin,chmax
**************************************************************/

// adjacency list
vector<int> to[100005];

// Graph
using Graph = vector<vector<int>>;

// Grid
int H,W;
vector<vector<int>> field;

// 4方向への移動ベクトル
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    string s; cin >> n >> k >> s;
    s[k-1]+=32;

    cout << s ENDL;
    
    return 0;
}

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

constexpr int INF = (1 << 30) - 1;
int n;
int dist[105][105];
int d[105];
bool used[105] = {};

void Dijkstra()
{

        fill_n(d, 105, INF);

        d[0] = 0;
        while ( true ) {
                int u = -1;
                for ( int i = 0; i < n; i++ ) {
                        if ( !used[i] && (u == -1 || d[u] > d[i]) ) {
                                u = i;
                        }
                }
                if ( u == -1 ) break;
                used[u] = true;
                for ( int i = 0; i < n; i++ ) {
                        d[i] = min(d[i], d[u] + dist[u][i]);
                }
        }
}

int main()
{
        fill_n(*dist, 105 * 105, INF);
        cin >> n;
        for ( int i = 0; i < n; i++ ) {
                int u, k;
                cin >> u >> k;
                for ( int j = 0; j < k; j++ ) {
                        int v, c;
                        cin >> v >> c;
                        dist[u][v] = min(dist[u][v], c);
                }
        }
        Dijkstra();
        for ( int i = 0; i < n; i++ ) {
                cout << i << " " << d[i] << endl;
        }

        return (0);
}



Measured memory_bytes: 3168
read n a b
ans=0
for (( k = 1; k <= n; k++ )); do
    s="${k}0000"
    dsum=$(( ${s:0:1} + ${s:1:1} + ${s:2:1} + ${s:3:1} + ${s:4:1} ))
    (( dsum >= a && dsum <= b )) && (( ans += k ))
done
echo ${ans}


Measured memory_bytes: 376
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  rep(i, N){
    cin >> A.at(i);
  }
  
  int answer = 0;
  rep(i, 40){
    rep(j, N){
      if(A.at(j)%2 == 1){
        break;
      }else{
        A.at(j) = A.at(j)/2;
      }
      if(j==N-1){
        answer++;
      }
    }
  }
  
  
  cout << answer;
}

Measured memory_bytes: 256
using System;
    class Program
    {
      static void Main(string[] args)
      {
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        var a = int.Parse(input[0]);
        var b = int.Parse(input[1]);
        var c = int.Parse(input[2]);
        var ans = a - b == 0? c : a - c == 0? b : a;
        //出力
        Console.WriteLine(ans.ToString());
      }
    }

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

int main() {
    int x,y,z; cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x  << " " << y << " " << z << endl;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 4e6 + 5;

bitset<MAXN> b;

void solve(){
	int n;
	cin >> n;
	b.set(0);
	REP(i, 0, n){
		int a;
		cin >> a;
		b |= (b << a);
	}
	int cnt = 0;
	REP(i, 1, MAXN){
		if (b[i]){
			cnt++;
			//cout << "# " << i << endl;
		}
	}
	int cnt2 = 0;
	REP(i, 1, MAXN){
		if (b[i]){
			cnt2++;
			if (cnt2 * 2 >= cnt){
				printf("%d\n", i);
				return;
			}
		}
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 1664
import math

a,b = (int(x) for x in input().split())

a_low = math.ceil(a/0.08)
b_low = math.ceil(b/0.1)

a_high = math.floor(a/0.08+int(1/0.08)-1e-8)
b_high = math.floor(b/0.1+int(1/0.1)-1e-8)

if b_low > a_high or a_low > b_high:
  print(-1)
else:
  print(max(a_low,b_low))
  

Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H,W;cin>>H>>W;
  vector<string> vs(H);
  FOR(i,0,H)cin>>vs[i];
  bool ok[H][W];
  CLR(ok);
  // tate
  FOR(y,0,H-1){
    FOR(x,0,W){
      if(vs[y][x]=='#'&&vs[y+1][x]=='#'){
        ok[y][x]=ok[y+1][x]=true;
      }
    }
  }
  // yoko
  FOR(y,0,H){
    FOR(x,0,W-1){
      if(vs[y][x]=='#'&&vs[y][x+1]=='#'){
        ok[y][x]=ok[y][x+1]=true;
      }
    }
  }
  FOR(y,0,H){
    FOR(x,0,W){
      if(vs[y][x]=='#'){
        if(!ok[y][x]){
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
  }
  cout<<"Yes"<<endl;
}

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

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int H, A;
    cin >> H >> A;
    int cnt = 0;
    while(H > 0) {
        H -= A;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

def dfs(datas, b, c, count):
    if len(datas) == count: return 1
    if int(datas[count]) > b:
        return dfs(datas, int(datas[count]), c, count+1)
    if int(datas[count]) > c:
        return dfs(datas, b, int(datas[count]), count+1)
    return 0

def solve():
    b=0
    c=0
    count = 1
    q = dfs(datas, b, c, count)
    if q==1:
        print("YES")
    elif q==0:
        print("NO")

counter = 0
line = input()
if not " " in line:
    nums = line
while True:
    line = input()
    datas = line.split(" ")
    q = solve()
    counter += 1
    if int(nums) == counter:
        break

Measured memory_bytes: 7660
#include<bits/stdc++.h>
using namespace std;
#define LL long long

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int h[n];
	for(int i=0;i<n;i++){
		cin >> h[i];
	}
	// keisan
	int ans = 1;
	int highest = h[0];
	for(int i=1;i<n;i++){
		if(h[i] >= highest){
			ans++;
			highest = max(highest,h[i]);
		}
	}
	// syutsuryoku
	cout << ans << endl;
}

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

int main() {
    //input
    int a,b,c;
    cin >> a >> b >> c;

    if(a == b){
        cout << c;
    }else{
        if(a == c){
            cout << b;
        }else{
            cout << a;
        }
    }

    return 0;
}

Measured memory_bytes: 256
N=int(input())
ans=1e5
for i in range(N+1):
    j=N-i
    cnt=0
    while j>0:
        cnt+=j%9
        j=j//9
    while i>0:
        cnt+=i%6
        i=i//6
    ans=min(ans,cnt)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], x;
long long ans;
int main() {
    scanf("%d %d", &n, &x);
    for (int i=0;i<n;i++) scanf("%d", &a[i]);
    for (int i=0;i<n-1;i++) {
        if (a[i]+a[i+1]>x) {
            ans+=(a[i]+a[i+1])-x;
            a[i+1]=x-a[i];
            if (a[i+1]<0) {
                a[i]-=(-a[i+1]);
                a[i+1]=0;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 

typedef long long int ll;
typedef long double ld;
const ll N = 2e5 + 9;
const ll mod = 1e9 + 7;
const ll inf= 1e14;

const double PI = acos(-1);
#define x first
#define y second
#define pb push_back
#define mp make_pair    
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b,ll mod) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    ll T = 1;
    // cin>>t;
    while(T--){
        string s,t;cin>>s>>t;
        ll ans = t.size();

        for(int i = 0;i<=(s.size()-t.size());i++){
            ll th = t.size();
            for(int j = 0;j<t.size();j++){
                if(s[i+j]==t[j]){
                    th--;
                }
            }
            ans = min(ans,th);
        }
        cout<<ans<<'\n';

    }
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
const int mxn  = 3e3+1;
// const int len = 1e7;
ll dp[mxn][mxn][4];
ll vals[mxn][mxn]; 
int r,c;

ll find(int x, int y, int xl){
	if(x<0 || x >= r ) return 0ll;
	if(y<0 || y>=c) return 0ll;
	ll &ans = dp[x][y][xl];
	if(ans!=-1){
		return ans;
	}
	ans = 0;
	if(xl && vals[x][y]!=0){
		ans = max(ans, vals[x][y] + find(x+1,y,3));
	}
	if(xl && vals[x][y]!=0){
		ans = max(ans,vals[x][y] + find(x,y+1,xl-1));
	}
	ans = max(ans, max(find(x+1,y,3), find(x,y+1,xl)));
	// cout << x << ' ' << y << " " << xl << " " << " " << ans << endl;
	return ans;

}

void solve(){
	int k;
	cin >> r >> c >> k;
	memset(dp,-1,sizeof(dp));
	for(int i =0;i<k;i++){
		int x,y,val;
		cin >> x >> y;
		--x,--y;
		cin >> vals[x][y]; 
	}

	ll ans = find(0,0,3);

	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 356084
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,m,a[200005],b[200005],ans,k,suma[200005],sumb[200005];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(n);printf("%d\n",(n/1000+(n%1000!=0))*1000-n);
	return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    ll l = 0, r = 1e+10;
    while (l + 1 < r)
    {
        ll m = (l + r) / 2;
        vector<ll> w;
        for (size_t i = 0; i < n; i++)
        {
            if (h[i] - m * b > 0)
            {
                w.push_back(h[i] - m * b);
            }
        }
        ll c = 0;
        for (int i = 0; i < w.size(); i++)
        {
            c += (w[i] + (a - b) - 1) / (a - b);
        }
        if (c <= m)
        {
            r = m;
        }
        else
        {
            l = m;
        }
    }
    cout << r << endl;
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  int D = max(A,max(B,C));
  int E = 3 * D - A - B - C;
  cout << (E % 2 == 0 ? E : (E + 3)) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<long,long>
#define vi          vector<long long>
#define vii         vector<pii>
#define mi          map<long long,long long>
#define mii         map<pii,long long>
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(long long i=a;i<b;i++)
#define repr(i,a,b) for(long long i=a;i>=b;i--)
#define int long long
#define sz(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define io ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;

signed main()
{
	io;
	string s;
	cin >> s;
	int sum=0;
	int n = s.length();
	rep(i,0,n)
	{
		int x = s[i]-'0';
		sum+=x;
	}

	if(sum%9==0) cout << "Yes"<<endl;
	else cout << "No" <<endl;
}
 
	
		



Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int main()
{
    int n,d;
    cin>>n>>d;
    int lldff=n/(d*2+1);
    if(n%(2*d+1))
        lldff++;
    cout<<lldff<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    string s ;
    cin>> s;
    int l =s.size() , c=0;
for(int i =0 , j=(l-1); i<l/2 , j>=l/2; j--,i++)
{
    if(s[i]==s[j])
        {
            continue;}
    else
        c++;
}
cout << c;


    return 0;
}


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

using namespace std;

int main() {
  queue<pair<string, int> > process;
  int n, q, total = 0;
  cin >> n >> q;
  string name;
  int time;
  for(int i = 0; i < n; i++) {
    cin >> name >> time;
    process.push(make_pair(name, time));
  }
  while(!process.empty()) {
    pair<string, int> task;
    task = process.front();
    process.pop();
    if(task.second <= q){
      total += task.second;
      cout << task.first << " " << total << endl;
    }
    else {
      task.second -= q;
      total += q;
      process.push(task);
    }
  }
  return 0;
}

Measured memory_bytes: 6172
n=input()
#print(n[-1])
l1 = ["2","4","5","7","9"]
l2 = ["0","1","6","8"]
l3 = ["3"]
if n[-1] in l1:
  print("hon")
elif n[-1] in l2:
  print("pon")
elif n[-1] in l3:
  print("bon")

Measured memory_bytes: 9116
import  java.util.*;


import static java.util.Arrays.*;

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

            sort(ar);
        
            long  sum = 0;
            for (i = 0; i <a-b; i++) {
                sum = sum + ar[i];
            }

            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 65612
program abc32
 implicit none
 integer::H,W,N,ans
 read(*,*)H
 read(*,*)W
 read(*,*)N
 if(H>W)then
  ans=(N-mod(N,H))/H
  if(mod(N,H)/=0)then
   ans=ans+1
  end if
 else
  ans=((N-mod(N,W))/W)
  if(mod(N,W)/=0)then
   ans=ans+1
  end if
 end if
 print'(i0)',ans
end program abc32

Measured memory_bytes: 2912
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
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 modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	int n;
	cin>>n;
	
	int x=0,i=0;
	int ans=0;
	while(1){
		 x=pow(2,i);
		if(x>n)break;
		ans=x;
		i++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import heapq as hq

N,M=map(int, input().split())
A=list(map(int, input().split()))

#ヒープキューのために符号逆転
A=list(map(lambda x: x * (-1), A))
hq.heapify(A)

for i in range(M):
    a = hq.heappop(A) * (-1)
    hq.heappush(A, a // 2 * (-1))

print(sum(A) * (-1))

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

int main() {
	int n, ans=0;
	cin>>n;
	for (int i=1; i<=n; i+=2) {
		int count=0;
		for (int k=1; k<=i; k++)
			if (i%k == 0)
				count++;

		if (count == 8)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
#define NIL NULL
#define TREE_VALUE INT_MAX

typedef struct Node* NodePointer;
typedef NodePointer Tree;

typedef struct Node{
    int key;
    NodePointer p, left, right;
} Node;

NodePointer makeNode(int key){
    NodePointer node = (NodePointer)malloc(sizeof(Node));
    node->key = key;
    node->p = node->left = node->right = NIL;
    return node;
}

void treeInsert(Tree tree, NodePointer z){
    NodePointer y = NIL;
    NodePointer x = tree->left;
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->p = y;
    if(y == NIL){
        tree->left = z;
    } else if(z->key < y->key){
        y->left = z;
    } else {
        y->right = z;
    }
}

void printInorder(NodePointer node){
    if(node->left != NIL) printInorder(node->left);
    if(node->key != TREE_VALUE) printf(" %d", node->key);
    if(node->right != NIL) printInorder(node->right);
}

void printPreorder(NodePointer node){
    if(node->key != TREE_VALUE) printf(" %d", node->key);
    if(node->left != NIL) printPreorder(node->left);
    if(node->right != NIL) printPreorder(node->right);
}

NodePointer find(NodePointer node, int key){
    if(node == NIL) return NIL;
    if(node->key == key) return node;
    else if(key < node->key)
        return find(node->left, key);
    else
        return find(node->right, key);
}

NodePointer treeMinimum(NodePointer x){
    while(x->left != NIL){
        x = x->left;
    }
    return x;
}

NodePointer treeSuccessor(NodePointer x){
    NodePointer y;
    if(x->right != NIL)
        return treeMinimum(x->right);
    y = x->p;
    while(y != NIL && x == y->right){
        x = y;
        y = y->p;
    }
    return y;
}

void treeDelete(Tree T, NodePointer z){
    NodePointer x, y;

    if(z->left == NIL || z->right == NIL)
        y = z;
    else
        y = treeSuccessor(z);

    if(y->left != NIL)
        x = y->left;
    else
        x = y->right;

    if(x != NIL)
        x->p = y->p;

    if(y->p == NIL)
        T->left = x;
    else if(y == y->p->left)
        y->p->left = x;
    else
        y->p->right = x;
    
    if(y != z)
        z->key = y->key;

}

int main(){
    int N,key;
    char str[10];
    Tree tree;


    tree = makeNode(TREE_VALUE);

    scanf("%d", &N);
    while(N--){
        scanf("%s", str);
        if(str[0] == 'i'){
            scanf("%d", &key);
            treeInsert(tree, makeNode(key));
        } else if(str[0] == 'p'){
            printInorder(tree);
            printf("\n");
            printPreorder(tree);
            printf("\n");
        } else if(str[0] == 'f'){
            scanf("%d", &key);
            printf(find(tree,key)?"yes\n":"no\n");
        } else {
            scanf("%d", &key);
            treeDelete(tree, find(tree,key));
        }
    }
    return 0;
}


Measured memory_bytes: 20424
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main()
{
    int a[5], k;
    REP(i, 5) cin >> a[i];
    cin >> k;
    REP(i, 5){
        REP(j, 5-i){
            if(a[i] - a[j] > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}


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

#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s, t;
	cin >> s >> t;
	int cnt = 0;
	for(int i = 0; i < 3; i++) {
		if(s[i] == t[i]) {
			cnt++;
		}
	}
	cout << cnt;
}


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

using namespace std;

int main(void)
{
    int N, K;
    cin >> N >> K;

    int count = 0;

    for (int i = 0; i < N; i++)
    {
        int height;
        cin >> height;
        if (height >= K)
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
    int n,k;
    cin >> n >> k;
    vector<int> v;
    for (int i = 0;i < n;i++){
        int a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    if (k >= n){
        cout << 0 << endl;
        return 0;
    }
    int sum = 0;
    for (int i = 0;i < n - k;i++) sum += v[i];
    cout << sum << endl;

}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a!=c)
    {
        cout<<"Yes"<<endl;
    }
    else if(b==c&&b!=a)
    {
        cout<<"Yes"<<endl;
    }
    else if(c==a&&b!=c)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main() {
  string s,t,ans="";
  cin >> s >> t;
  if(s.size()>=t.size()) {
    for(long i=0;i<=s.size()-t.size();i++) {
      for(long j=0;j<t.size();j++) {
        if(s[i+j]!=t[j]&&s[i+j]!='?') break;
        if(j+1==t.size()) {
          string a="";
          for(long k=0;k<s.size();k++) {
            if(i<=k&&i+t.size()>k) {
              a+=t[k-i];
            } else {
              if(s[k]=='?') a+='a';
              else a+=s[k];
            }
          }
          if(ans=="") ans=a;
          else ans=min(ans,a);
        }
      }
    }
  }
  if(ans=="") ans="UNRESTORABLE";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 1000000009;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

int dp[20][20];
int main()
{
	int a, b, n;
	while (cin >> a >> b && a)
	{
		memset(dp, 0, sizeof(dp));
		cin >> n;
		rep(i, n){ int x, y; cin >> x >> y; dp[x][y] = -INF; }
		dp[1][1] = 1;
		for (int x = 1; x <= a; x++)
		{
			for (int y = 1; y <= b; y++) if (dp[x][y] >= 0)
			{
				dp[x + 1][y] += dp[x][y];
				dp[x][y + 1] += dp[x][y];
			}
		}

		cout << dp[a][b] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160