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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n,m;
	map<string, int> mp;
	cin >> n;
	REP(i, n)
	{
		string s;
		cin >> s;
		mp[s]++;
	}
	cin >> m;
	REP(i, m)
	{
		string s;
		cin >> s;
		mp[s]--;
	}
	int ans = 0;
	for (auto it = mp.begin(), end = mp.end(); it != end; ++it)
	{
		if (ans < it->second)
			ans = it->second;
	}
	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
X, K, D = map(int,input().split())

X = abs(X)

if X - K*D >= 0:
    ans = X - K*D
else:
    plus = X % D
    minus = plus - D
    rem = K - X//D
    if rem%2 == 0:
        ans = plus
    else:
        ans = abs(minus)
print(ans)

Measured memory_bytes: 9124
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	long double s=gi(),d=gi(),ans=0;
	for(int i=n;i;--i){
		ans+=s+(2*i-1)*d/2;
		s+=(5*d+2*s)/(2*i);
		d+=2*d/i;
	}
	printf("%.10Lf\n",ans);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace::std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define endl "\n"
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/any.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto j:v)output(j);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define SUM(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
inline lint mex(vector<lint> s){
    lint res=0;
    sort(all(s));
    while(binary_search(all(s),res))res++;
    return res;
}
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};

int main(){
    string s,t;
    cin>>s>>t;
    cout<<(s[0]==t[0])+(s[1]==t[1])+(s[2]==t[2]);
}

Measured memory_bytes: 256
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod 998244353
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 1000005


// Driver code to test above functions
int32_t main()
{
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    vector<pair<int, int>> x;
    x.push_back({0, 0});
    for(int i=1;i<=200;i++){
        int y = i*i*i*i*i;
        x.push_back({y, i});
        x.push_back({-1*y, -1*i});
    }



    sort(x.begin(), x.end());

    int n;
    cin >> n;

    for(int i=0;i<x.size();i++){
        for(int j=0;j<x.size();j++)
        {
            if(x[i].first - x[j].first == n)
            {
                cout << x[i].second << " " << x[j].second;
                return 0;
            }
        }
    }

    return 0;

} 


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

namespace arc084_c
{
	class Program
	{
		static List<int> Back(List<int> list, int max, int limitlen)
		{
			if (list.Last() == 1)
			{
				list.RemoveAt(list.Count - 1);
			}
			else
			{
				list[list.Count - 1]--;
				while (list.Count != limitlen) list.Add(max);
			}
			return list;
		}
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			if (x[0] % 2 == 0)
			{
				Console.Write(x[0] / 2);
				for (int i = 1; i < x[1]; i++) Console.Write(" " + x[0]);
				Console.WriteLine();
			}
			else
			{
				List<int> list = new List<int>();
				for (int i = 0; i < x[1]; i++) list.Add(x[0] / 2 + 1);
				for (int i = 0; i < x[1] / 2; i++)
				{
					list = Back(list, x[0], x[1]);
				}
				Console.WriteLine(string.Join(" ", list));
			}
		}
	}
}

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




using namespace std;



int main() {
	long long int N;
	cin >> N;
	vector<long long int>A( N );
	for( size_t i = 0; i < N; i++ ) {
		cin >> A[i];
	}
	long long int now = 1, ans = 0;
	for( size_t i = 0; i < N; i++ ) {
		long long int c = A[i] / now;
		if( c != 0 && A[i] % now == 0 ) {
			A[i] = now;
			c--;
			if( now == 1 || c == 0 ) {
				now++;
			}
		}
		ans += c;
	}
	cout << ans << endl;
}



Measured memory_bytes: 1024
from operator import itemgetter
import sys
input = sys.stdin.readline
N = int(input())
LR = []
for _ in range(N):
    l, r = map(int, input().split())
    LR.append([l, r+1])
ans = 0
for l, r in LR:
    ans = max(ans, r-l)

LR.sort(key=itemgetter(1))

# 区間スケジューリング
sch = 0
rr = 0
for l, r in LR:
    if l >= rr:
        rr = r
        sch += 1
if sch >= 3:
    print(ans)
    exit()

mid_range = 0
if sch == 1:
    mid_l = 0
    mid_r = float("inf")
    for l, r in LR:
        mid_l = max(l, mid_l)
        mid_r = min(r, mid_r)
    mid_range = mid_r - mid_l
    for i in range(N):
        LR[i][1] -= mid_range
    ans += mid_range

# 完全に被覆している区間は狭い方だけ残す
LR_ = []
pl = 0
for l, r in LR:
    if pl >= l:
        pass
    else:
        LR_.append([l, r])
        pl = l
LR = LR_
if len(LR) == 1:
    print(ans)
    exit()

Ll, Lr = LR[0]
Rl, Rr = LR[-1][0], LR[1][1]
ans2 = max(Rr-Rl, 0) + Lr-Ll
for i, (l, r) in enumerate(LR[1:-1], 1):
    Ll = l
    Rr = LR[i+1][1]
    ans2 = max(ans2, max(Rr-Rl, 0) + max(Lr-Ll, 0))
ans2 += mid_range * 2
print(max(ans, ans2))


Measured memory_bytes: 74204
#include <iostream>

using namespace std;

//Aoj 0033

int ball[15], l[15],r[15];

bool res= false;

void dfs(int i,int j,int k){//i 为当年需要落下的球,j 表示左边最上面球的上一位置，k 表示最右边球的上一位置
    if(i>=10){
        res=true;
        return;
    }
//    if(res){
//        return;
//    }
    if(ball[i]>l[j-1]){
        l[j]=ball[i];
        dfs(i+1,j+1,k);
    }
    if(ball[i]>r[k-1]){
        r[k]=ball[i];
        dfs(i+1,j,k+1);
    }

}

int main(){
    int n;
    cin>>n;
    while(n--){
        res= false;
        for(int i=0;i<10;i++){
            cin>>ball[i];
        }
        dfs(0,1,1);
        if(res){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }

    }
    return 0;
}


Measured memory_bytes: 3000
#include <stdio.h>

int main()
{
    int x;
    int ans;
    scanf("%d",&x);
    if(x==1){
        ans=0;
        printf("%d\n",ans);
    }
    if(x==0){
        ans=1;
        printf("%d\n",ans);
    }
    
    if((x!=0) && (x!=1)){
        printf("ERROR");
    }

    return 0;
}


Measured memory_bytes: 1732
n, m = map(int, input().split())
def zs(num):
    k = 6 - len(str(num))
    return '0' * k + str(num)
lst = []
for i in range(m):
  lst.append(tuple(map(int, input().split())))
slst = sorted(lst)
dic = {}
temp = 0
for i in range(m):
  if slst[i][0] == slst[i - 1][0]:
    temp += 1
  else:
    temp = 1
  dic[slst[i]] = zs(slst[i][0]) + zs(temp)
for i in lst:
  print(dic[i])

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

using ll=long long;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
  int n=in(),k=in();
  string s;
  cin >> s;
  s.at(k-1)=tolower(s.at(k-1));
  cout << s << endl;
}

Measured memory_bytes: 384
import collections

N = int(input())
A = [int(i) for i in input().split()]

dic = collections.Counter(A).most_common()

tmp = []
check = 0

dic.sort(reverse=True)

for a, b in dic:
    if b >= 2:
        check += 1
        tmp.append(a)
        if b>= 4:
            break
        if check == 2:
            break

if len(tmp) == 0:
    print(0)
elif len(tmp) == 1:
    print(tmp[0]*tmp[0])
else:
    print(tmp[0] * tmp[1])

Measured memory_bytes: 21540
import sys


n, k = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]

if k == 2:
    print(n-1)
    sys.exit()

if (n % (k-1)) <= 1:
    ans = n // (k-1)
else:
    ans = (n // (k-1)) + 1
print(ans)


Measured memory_bytes: 13880
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  vi dp(31);
  dp[0] = dp[1] = 1;
  dp[2] = 2;
  loop(i, 3, dp.size()) dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
  int n;
  while (cin >> n, n) cout << (dp[n] + 3659) / 3650 << endl;
}

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

int main(){
    int a,b,c,ob;
    cin>>a>>b>>c;
    if(a>b){
        ob=b;
        b=a;
        a=ob;
    }
    if(b>c){
        ob=b;
        b=c;
        c=ob;        
    }
    if(a>b){
        ob=b;
        b=a;
        a=ob;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
}


Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

int N;
int res = 0;
vector<int> h;
void dst(int l, int r) {
    int m = h[l];
    FOR(i, l, r, 1) {
        amin(m, h[i]);
    }
    FOR(i, l, r, 1) {
        h[i] -= m;
    }
    res += m;
    while (l < r) {
        while (l < N && h[l] == 0) {
            l++;
        }
        r = l;
        while (r < N && h[r] > 0) {
            r++;
        }
        if (l < r) {
            dst(l, r);
        }
    }
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    h = vector<int>(N);
    REP(i, N) {
        cin >> h[i];
    }
    dst(0, N);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	string s;
	cin>>s;
	int i;
	for(i=0;i<s.length();i+=2){
		cout<<s[i];
	}
	cout<<endl;
	
	
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	while (n != 0) {
		int a[10][10] = {}, sum_h[11] = {}, sum_v[11] = {};
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> a[i][j];
				printf("%5d",a[i][j]);
				sum_h[i] += a[i][j];
				sum_v[j] += a[i][j];
			}
			sum_v[n] += sum_h[i];
			printf("%5d\n", sum_h[i]);
		}
		for (int i = 0; i < n; i++)
			printf("%5d", sum_v[i]);
		printf("%5d\n", sum_v[n]);
		cin >> n;
	}
	return 0;
}


Measured memory_bytes: 3164
#include <stdio.h>
#include <string.h>

int main(void)
{
    int topn=1,bottomn=6,northn=5,southn=2,eastn=3,westn=4,tempn;
    int sum[10000];
    int repeat=1;
    int inpn,inpm,inpcount=0,outp=0;
    char input[6];
    while(repeat==1){
        scanf("%d",&inpn);
        
        sum[inpcount]=1;
        topn=1,bottomn=6,northn=5,southn=2,eastn=3,westn=4;
        
        if(inpn!=0){
            for(inpm=inpn;inpm>=1;inpm--){
                scanf("%s",input);
                
                if(!strcmp(input,"North")){
                    tempn=topn;
                    topn=southn;
                    southn=bottomn;
                    bottomn=northn;
                    northn=tempn;
                }
                if(!strcmp(input,"East")){
                    tempn=topn;
                    topn=westn;
                    westn=bottomn;
                    bottomn=eastn;
                    eastn=tempn;
                }
                if(!strcmp(input,"West")){
                    tempn=topn;
                    topn=eastn;
                    eastn=bottomn;
                    bottomn=westn;
                    westn=tempn;
                }
                if(!strcmp(input,"South")){
                    tempn=topn;
                    topn=northn;
                    northn=bottomn;
                    bottomn=southn;
                    southn=tempn;
                }
                if(!strcmp(input,"Right")){
                    tempn=northn;
                    northn=westn;
                    westn=southn;
                    southn=eastn;
                    eastn=tempn;
                }
                if(!strcmp(input,"Left")){
                    tempn=northn;
                    northn=eastn;
                    eastn=southn;
                    southn=westn;
                    westn=tempn;
                }
                
                sum[inpcount]+=topn;
            }
        }
        
        if(inpn==0)repeat=0;
        inpcount++;
    }
    while(sum[outp+1]!=0){
        printf("%d\n",sum[outp]);
        outp++;
    }
    return 0;
}

Measured memory_bytes: 608
#include <stdio.h>

int main(void)
{
	int i,j,repeat,dataset[10];
	
	scanf("%d",&repeat);
	for(j=0;j<repeat;j++)
	{
		scanf("%d",&dataset[j]);
	}
	
	for(j=0;j<repeat;j++)
	{
		printf("Case %d:\n",j+1);
		
		for(i=0;i<10;i++)
		{
			dataset[j]=(int)((dataset[j]*dataset[j])%1000000)/100;
			
			printf("%d\n",dataset[j]);
		}
	}
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cstring>

int main(){
    char str[1001];

    while (1){
        scanf("%s", str);
        if (str[0] == '0') break;
        int sum = 0;
        for (int i = 0; i < strlen(str); i++){
            sum += (str[i] - '0');
        }
        printf("%d\n", sum);
    }
}



Measured memory_bytes: 2672
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main() {
    ll h;
    cin>>h;
    ll c=0;
    while(h!=1){
        c++;
        h/=2;
    }
    ll sum=0;
    for(int i=1;i<=c;i++){
        sum+=pow(2,i);
    }
    cout<<sum+1<<endl;
	// your code goes here
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

void max_self(ll& a, ll b) {
    a = max(a, b);
}

// O(n * W)

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<ll> dp(W + 1); // 0 ... W
    // dp[i] - the maximum total value of items with total weight exactly i
    for(int item = 0; item < n; ++item) {
        int weight, value;
        scanf("%d%d", &weight, &value);
        // dp[0] -> dp[3] -> dp[6]
        for(int weight_already = W - weight; weight_already >= 0; --weight_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            max_self(dp[weight_already+weight], dp[weight_already] + value);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= W; ++i) {
        max_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}

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

int N;
int ans = 1;
int niwa_max = 0;

int sub(int n){
    int count = 0;
    while(1){
        if (n%2!=0) break;
        n = n/2;
        ++count;
    }
    return count;
}

int main(){
    cin >> N;
    for (N;N>=1;--N){
        int subN = sub(N);
        if (niwa_max < subN){
            niwa_max = subN;
            ans = N;
        } 
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, q, k = (int(x) for x in input().split())

answer = [0 for i in range(n)]

for i in range(k):
    correct = int(input())
    answer[correct-1] += 1

for i in range(n):
    if q-k+answer[i] > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 4684
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int>p(n+1);
    for(int i=1;i<=n;i++){
        cin >> p.at(i);
    }
    int count=0;
    for(int i=1;i<n;i++){
        if(p.at(i)==i){
            count++;
            swap(p.at(i),p.at(i+1));
        }
    }
    if(p.at(n)==n){
        count++;
        swap(p.at(n-1),p.at(n));
    }
    cout << count << endl;
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  
  if(n % 2 == 1){
    cout << 0 << "\n";
    return 0;
  }
  
  ll count2 = 0, count5 = 0, sub2 = 0, sub5 = 0, k = n;
  while(k / 2 != 0){
    k /= 2;
    sub2++;
  }
  k = n;
  while(k / 5 != 0){
    k /= 5;
    sub5++;
  }
  
  for(ll i = 1; i <= sub2; i++){
    count2 += n / (ll) pow(2, i);
  }
  for(ll i = 1; i <= sub5; i++){
    count5 += n / (ll) (2 * pow(5, i));
  }
  cout << min(count2, count5) << "\n";
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

static class CodeJam
{
    static long Solve(string S)
    {
        int N = S.Length;
        var dp1 = new long[13];
        dp1[0] = 1;
        int d = 1;
        foreach (char c in S.Reverse())
        {
            var dp2 = new long[13];
            if (c == '?')
            {
                for (int i = 0; i < 13; ++i)
                {
                    for (int j = 0; j < 10; ++j)
                    {
                        int n = (i + d * j) % 13;
                        dp2[n] += dp1[i];
                        dp2[n] %= 1000000007;
                    }
                }
            }
            else
            {
                int j = c - '0';
                for (int i = 0; i < 13; ++i)
                {
                    int n = (i + d * j) % 13;
                    dp2[n] += dp1[i];
                    dp2[n] %= 1000000007;
                }
            }
            d = (d * 10) % 13;
            dp1 = dp2;
        }
        return dp1[5];
    }

    static void Main(string[] args)
    {
        Console.WriteLine(Solve(Console.ReadLine()));
    }
}


Measured memory_bytes: 15968
n , k = map(int, input().split())
H = list(map(int, input().split()))

DP = [0 for i in range(n)]
DP[0] = 0
for i in range(1, n):
    DP[i] = DP[i - 1] + abs(H[i - 1] - H[i])
    for j in range(2, k+1):
        if i - j >= 0:
            tmp = DP[i - j] + abs(H[i - j] - H[i])
            DP[i] = min(DP[i], tmp)
        else:
            pass

print(DP[n - 1])

Measured memory_bytes: 83640
// D - Triangles
// 累積和による方法
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

ll solve(int N, vi &L){
	vi csum(2000+1); //[length]<count>: 累積和: cumulative sum
	rp(i, 0, N) csum[L[i]]++;
	rp(i, 1, csum.size()) csum[i] += csum[i-1]; // その長さまでの棒の個数
	ll ans = 0;
	rp(ia, 0, N-1){
		rp(ib, ia+1, N){
			int a = L[ia], b = L[ib];
			int minL = abs(a - b), maxL = a + b; // |a-b| < c < a+b : cの範囲
			ans += csum[maxL-1] - csum[minL]; // maxL-1 に注意！cの範囲に(等号はない)
			if(minL<a && a<maxL) ans--; // cの範囲にaがあれば一本不要
			if(minL<b && b<maxL) ans--; // cの範囲にbがあれば一本不要
		}
	}
	return ans/3; //3本で△1つ
}

int main(){
	int N; cin>>N;
	vi L(N); rp(i, 0, N) cin>>L[i];
	cout<< solve(N, L) <<endl;
}

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

int main(){

	string a, b, c;

	cin >> a >> b >> c;

	if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
takahashi_hp, takahashi_power, aoki_hp, aoki_power = map(int, input().split(' '))
takahashi_attack_count = int(aoki_hp / takahashi_power)
if aoki_hp % takahashi_power != 0:
    takahashi_attack_count += 1
aoki_attack_count = int(takahashi_hp / aoki_power)
if takahashi_hp % aoki_power != 0:
    aoki_attack_count += 1

if takahashi_attack_count <= aoki_attack_count:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    vector<ll> a(n+1);
    rep(i,n) cin >> a[i+1];
    a.push_back(0);
    bool ok = false;
    ll ans = 0;
    ll sum = 0;
    for(int i = 1; i <= n+1; i++){
        if (a[i] != 0 && !ok){
            ok = true;
        }else if (a[i] == 0 && ok){
            ok = false;
            ans += sum / 2;
            sum = 0;
        }
        if (ok) sum += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4844
N,M = map(int,input().split())
a = []
ans = 0
for i in range(N):
    a.append([int(i) for i in input().split()])
for i in range(len(a)):
    a[i].append(sum(a[i]))
    a[i].append(a[i][0] + a[i][1] - a[i][2])
    a[i].append(a[i][0] - a[i][1] - a[i][2])
    a[i].append( - a[i][0] - a[i][1] + a[i][2])
    a[i].append( - a[i][0] - a[i][1] + a[i][2])
    a[i].append( - a[i][0] + a[i][1] + a[i][2])
    a[i].append( - a[i][0] + a[i][1] - a[i][2])
a = sorted(a, key=lambda x:x[3])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
 
a = sorted(a, key=lambda x:x[4])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

a = sorted(a, key=lambda x:x[5])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

a = sorted(a, key=lambda x:x[6])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

a = sorted(a, key=lambda x:x[7])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

a = sorted(a, key=lambda x:x[8])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

a = sorted(a, key=lambda x:x[9])
hi = 0
naka = 0
migi = 0
for i in range(M):
  hi += a[i][0]
  naka += a[i][1]
  migi += a[i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)
hi = 0
naka = 0
migi = 0
for i in range(1,M+1):
  hi += a[-i][0]
  naka += a[-i][1]
  migi += a[-i][2]
tori = abs(hi) + abs(naka) + abs(migi)
ans = max(ans,tori)

print(ans)

Measured memory_bytes: 3664
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

sys.setrecursionlimit(10**7)

class SCC():
	def __init__(self, n):
		self.n = n
		self.adj = [[] for _ in range(self.n)]
		self.inv = [[] for _ in range(self.n)]
		self.post_order = []
		self.visited = [False for _ in range(self.n)]
		self.dag_v_to_num = [-1 for _ in range(self.n)]
		self.dag_num_to_v = []
		return

	def add_edge(self, u, v):
		self.adj[u].append(v)
		self.inv[v].append(u)
		return

	def dfs1(self, i):
		for j in self.adj[i]:
			if not self.visited[j]:
				self.visited[j] = True
				self.dfs1(j)
		self.post_order.append(i)
		return

	def dfs2(self, i, num):
		self.dag_num_to_v[-1].append(i)
		self.dag_v_to_num[i] = num
		for j in self.inv[i]:
			if not self.visited[j]:
				self.visited[j] = True
				self.dfs2(j, num)
		return

	def make_scc(self):
		for i in range(self.n):
			if not self.visited[i]:
				self.visited[i] = True
				self.dfs1(i)

		self.visited = [False for _ in range(self.n)]
		num = 0
		for i in range(self.n-1, -1, -1):
			if not self.visited[self.post_order[i]]:
				self.visited[self.post_order[i]] = True
				self.dag_num_to_v.append(list())
				self.dfs2(self.post_order[i], num)
				num += 1

		return self.dag_v_to_num, self.dag_num_to_v


class TwoSAT(SCC):
	"""
	node 2*i  : x_i
	node 2*i+1: not x_i
	"""
	def __init__(self, n):
		super().__init__(2*n)
		return

	def add_clause(self, i, f, j, g):
		super().add_edge(2*i + (1^f), 2*j + g)
		super().add_edge(2*j + (1^g), 2*i + f)
		return

	def satisfy(self):
		topol, _ = super().make_scc()
		res = []
		for i in range(0, self.n, 2):
			x, y = topol[i], topol[i+1]
			if x == y:
				return False, None
			elif x > y:
				res.append(False)
			else:
				res.append(True)
		return True, res

n, d = map(int, input().split())
ts = TwoSAT(n)
flags = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	for j in range(i+1, n):
		for k in range(4):
			f, g = k//2, k%2
			if abs(flags[i][f] - flags[j][g]) < d:
				ts.add_clause(i, f, j, g)

ok, ans = ts.satisfy()
if not ok:
	print("No")
else:
	print("Yes")
	print(*[f[1^b] for f, b in zip(flags, ans)], sep="\n")

Measured memory_bytes: 69988
N = int(input())
left = []
right = []
for _ in range(N):
    A, B = list(map(int, input().split()))
    left.append(A)
    right.append(B)
left.sort()
right.sort(reverse=True)
if N%2 == 0:
    n = (N+1)//2-1
    A_med2 = (left[n]+left[n+1])
    B_med2 = (right[n]+right[n+1])
    print(B_med2-A_med2+1)
else:
    n = (N+1)//2-1
    print(right[n]-left[n]+1)

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

int main()
{
    int M, D;
    cin >> M >> D;

    int count = 0;
    for(int m = 4; m <= M; m++)
    {
        for(int d = 22; d <= D; d++)
        {
            int d_1 = d % 10;
            int d_10 = d / 10;
            if(d_1 < 2)
                continue;
            if(d_1 * d_10 == m)
                count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    int q;
    cin>>q;
    while (q --) {
    	ll a,b;
    	cin>>a>>b;
    	ll n = a * b;
    	if (a > b)
    		swap(a,b);
    	ll sq = 0;
    	for (ll k = 1ll << 30;k;k /= 2)
    		if ((n - 1) / (sq + k) / (sq + k) >= 1)
    			sq += k;
    	ll ans;
    	if (a >= b - 1)
    		ans = 2 * (a - 1);
    	else
    	if (sq * (sq + 1) >= n)
    		ans = 2 * sq - 2;
    	else
    		ans = 2 * sq - 1;
    	cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
from collections import deque
N = int(input())
ab = [list(map(int,input().split())) for _ in range(N-1)]
mod = 10**9+7
fact = [1]*(N+1)
fact_inv = [1]*(N+1)
for i in range(1,N+1):
  fact[i] = (fact[i-1]*i)%mod
  
fact_inv[-1] = pow(fact[-1], mod-2, mod)
for i in range(N,0,-1):
  fact_inv[i-1] = fact_inv[i] * i % mod

g = [deque([]) for _ in range(N+1)]
for a,b in ab:
  g[a].append(b)
  g[b].append(a)
  
parents = [0]*(N+1)
q = deque([])
s = deque([1])
while s:
  x = s.pop()
  q.append(x)
  for y in g[x]:
    if y==parents[x]:
      continue
    else:
      parents[y] = x
      s.append(y)
      
q = list(q)
size_forward = [0]*(N+1)
dp_forward = [1]*(N+1)
for i in q[::-1]:
  p = parents[i]
  s = size_forward[i] + 1
  size_forward[p] += s
  dp_forward[i] *= fact[size_forward[i]]
  dp_forward[p] *= dp_forward[i] * fact_inv[s]
  dp_forward[p] %= mod
  
size_back = [N-1-i for i in size_forward]
dp_back = [1]*(N+1)
for i in q[1:]:
  p = parents[i]
  x = dp_back[p]
  x *= fact_inv[size_back[p]]
  x *= dp_forward[p]
  x *= fact_inv[size_forward[p]]
  x *= fact[size_forward[i]+1]
  x *= pow(dp_forward[i],mod-2,mod)
  x *= fact[size_back[i]-1]
  dp_back[i] = x % mod
  
for a,b,c,d in zip(size_forward[1:], dp_forward[1:], size_back[1:], dp_back[1:]):
  ans = b * d * fact[a+c] * fact_inv[a] * fact_inv[c]
  ans %= mod
  print(ans)

Measured memory_bytes: 229268
#include<iostream>
#include<cmath>

using namespace std;

typedef long long ll;
const int N=2e5+10;
int a[N];
int n,x, t;
int main()
{
	cin>>n;
	int maxx=0;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(maxx>a[i]){
			ans+=maxx-a[i]; 
		}
		else maxx=a[i];
	}
	cout<<ans<<endl;
	return 0;
 } 

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

int reverse (int i) {
    int sum, temp;
    
    sum = 0;
    temp = i;
    for (int j = 0; j < 5 ; j++){
        sum += temp%10 * (int)round(pow(10.0, 4-j));
        temp = temp/10;
    }
    
    return sum;
}

int main() {
    int A, B, res;
    res = 0;
    cin >> A >> B;

    for (int i = A; i <= B; i++){
        if (i == reverse(i)){
            ++res;
        }
    }
    cout << res << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k, d, a;
    cin >> n >> k;
    map<int, bool> cache;
    while (k--) {
        cin >> d;
        for (int i = 0; i < d; i++) {
            cin >> a;
            cache[a] = true;
        }
    }
    cout << n - sz(cache) << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

class Node
{
public:
	vector<int> to,tm,my;
};

int T;
Node node[301];


class State
{
public:
	int p, tm, my;
	State(int p, int tm, int my)
	:p(p),tm(tm),my(my)
	{}
	
	bool operator<(const State& s) const
	{
		if(T==0) return my>s.my;
		return tm>s.tm;
	}
};

int Dijkstra(int s, int d)
{
	priority_queue<State> q;
	q.push(State(s,0,0));
	
	bool v[301]={0};
	while(!q.empty())
	{
		State t=q.top(); q.pop();
		if(v[t.p]) continue;
		v[t.p]=1;
		if(t.p==d)
		{
			if(T==0) return t.my;
			else return t.tm;
		}
		
		for(int i=0; i<node[t.p].to.size(); i++)
		{
			int next=node[t.p].to[i];
			if(v[next]) continue;
			q.push(State(next, t.tm+node[t.p].tm[i], t.my+node[t.p].my[i]));
		}
	}
	
	return 0;
}

int main()
{
	int M,N;
	while(cin >> M >> N, (M||N))
	{
		for(int i=0; i<301; i++)
		{
			 node[i].to.clear();
			 node[i].tm.clear();
			 node[i].my.clear();
		}
		while(M--)
		{
			int s,d,t,m;
			cin >> s >> d >> m >> t;
			node[s].to.push_back(d);
			node[d].to.push_back(s);
			node[s].tm.push_back(t);
			node[d].tm.push_back(t);
			node[s].my.push_back(m);
			node[d].my.push_back(m);
		}
		
		int Q;
		cin >> Q;
		while(Q--)
		{
			int s,d;
			cin >> s >> d >> T;
			cout << Dijkstra(s,d) << endl;
		}
	}
}

Measured memory_bytes: 1088
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <string>
#include <queue>

using namespace std;

int main(void){
	priority_queue<int> Q;
	string S;

	cin >> S;
	while(S != "end"){
		if(S == "insert"){
			int num;
			cin >> num;
			Q.push(num);
		}else{
			int num = Q.top();
			Q.pop();
			cout << num << endl;
		}

		cin >> S;
	}

    return 0;
}

Measured memory_bytes: 7300
#include<stdio.h>
int main(){
    int n;
    int h[21];
    int i;
    int highest;
    int seesea=1;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    highest=h[0];
    for(i=1;i<n;i++){
        if(h[i]>highest){
            highest=h[i];
        }
        if(h[i]>=highest){
            seesea++;
        }
    }
    printf("%d\n",seesea);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int M = 4000100;
const int MOD = 1e9 + 7;
int n, k;
int fac[M], inv[M], f[N][N];
int powi(int a, int b)
{
    int c = 1; for (; b; b >>= 1, a = 1ll * a * a % MOD)
        if (b & 1) c = 1ll * c * a % MOD; return c;
}
void ADD(int &t, int d) {t += d; if (t >= MOD) t -= MOD;}
int C(int a, int b)
{
    return 1ll * fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
int main()
{
    cin >> n >> k;
    if (k == 1) {cout << 1 << endl; return 0;}
    fac[0] = 1; for (int i = 1; i < M; ++ i) fac[i] = 1ll * fac[i - 1] * i % MOD;
    inv[M - 1] = powi(fac[M - 1], MOD - 2);
    for (int i = M - 2; ~i; -- i) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;
    f[0][0] = 1;
    for (int i = 0; i <= n; ++ i)
        for (int j = 0; j <= i; ++ j)
        {
            if (j) ADD(f[i][j], f[i][j - 1]);
            if (i) ADD(f[i][j], 1ll * f[i - 1][j] * C(i * (k - 1) + j - 1, k - 2) % MOD * (n - i + 1) % MOD);
        }
    cout << f[n][n] << endl;
}


Measured memory_bytes: 46464
# ABC133C - Remainder Minimization 2019
def main():
    L, R = list(map(int, input().rstrip().split()))
    MOD = 2019
    if R - L + 1 >= MOD:  # L <= 2019n <= R
        print(0)
    else:  # max: 2018 * 2017 patterns
        ans = float("inf")
        L, R = L % MOD, R % MOD
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                ans = min(ans, (i * j) % MOD)
        print(ans)


if __name__ == "__main__":
    main()

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

using namespace std;

int n, ans, w[1000000], b[1000000];
char s[1000000];

int main(){
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> s[i];
    for (int i = 1; i <= n; i++){
        if (s[i] == '.') w[i] = w[i - 1] + 1, b[i] = b[i - 1];
        else w[i] = w[i - 1], b[i] = b[i - 1] + 1;
    }
    ans = 1e9;
    for (int i = 0; i <= n; i++){
        ans = min(ans, b[i] + w[n] - w[i]);
    }
    cout << ans;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main(void)
{
	int x, n, i, j, k, c;
	
	while(1){
		c = 0;
		scanf("%d %d", &n, &x);
		if(n==0&&x==0)break;
		
		for(i=1;i<=n;i++){
			for(j=i+1;j<=n;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k==x)
					c++;
				}
			}
		}
		printf("%d\n",c);
	}
	
	return 0;
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  scanf("%d",&n);
  int A = 0 , B = 0 , All = 0 , AB = 0;
  for(int i = 0 ; i < n ; i++)
  {
    string te; cin>>te;
    if(te[0] == 'B' && te[te.size()-1] == 'A') AB++;
    else if(te[0] == 'B') B++;
    else if(te[te.size()-1] == 'A') A++;
    for(int j = 1 ; j < te.size() ; j++)
    {
      if(te[j-1] == 'A' && te[j] == 'B') All++;
    }
  }
  if(AB)
  {
    All += AB-1;
    if(A) All++, A--;
    if(B) All++, B--; 
  }
  //cout<<All <<"  " << A << B<<endl;
  cout<<min(A,B) + All<<endl;
}

Measured memory_bytes: 768
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define REP(i,a) for(int i=0;i<(a);i++)
#define REPR(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
// using ll = long long;
// using vi = vector<int>;
// using vvi = vector<vi>;
// using vl = vector<long long>;
// using vvl = vector<vl>;
// using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int main () {
  int k,x;
  cin >> k >> x;
  for (int i = -k+1; i <= k-1; i++) {
    cout << x + i << ' ';
  }
  // cout << "\b" << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next();
        int res=Integer.MAX_VALUE;
        for(int i=0;i<=S.length()-3;i++){
            res=Math.min(Math.abs(753-Integer.parseInt(S.substring(i,i+3))),res);
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 35648
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
using namespace std;

int gcd(int a, int b)
{
	if (a%b == 0){
		return b;
	}
	else {
		return gcd(b, a%b);
	}
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

int main() {
	int n;
	cin >> n;
	
	if (n > 2) {
		cout <<  lcm(n, 2) << endl;
	}
	else {
		cout << lcm(2, n) << endl;
	}
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int ans = 1;
  
  for(int i=0; i<N; i++){
   if(ans*2 < ans + K){
    ans = ans*2;
   }
   else{
    ans = ans + K;
   }
  }
    
   cout << ans << endl;
}

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

typedef long long ll;
using namespace std;

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    ll rest_a = max(0LL, a - k);
    ll rest_b = max(0LL, b - (k + rest_a - a));
    cout << rest_a << ' ' << rest_b;
    return 0;
} 


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

using namespace std;

int main(void){

  int w[10];
  for( int i = 0 ; i < 10 ; i++ ){
    w[i] = pow( (double)2 , i );
  }

  int thing;
 b:
  while( cin >> thing ){

    int h[10];
    int j = 0;
    int cnt = 0;

    for( int i = 9 ; i >= 0 ; i-- ){
      thing -= w[i];
      if( thing < 0 ){
	thing += w[i];
      }
      else {
	h[j++] = i;
	cnt++;
      }
      if( thing == 0 ){
	for( int i = cnt - 1 ; i >= 0 ; i-- ){
	  if(i) {
	    cout << w[h[i]] << " ";
	  }
	  else{
	    cout << w[h[i]] << endl;
	    goto b;
	  }
	}
      }
      }
  end:;
  }
  return 0;
}

Measured memory_bytes: 1164
import math
a,b = map(int, input().split())
price = int(max(math.ceil(a/0.08), math.ceil(b/0.1)))
ans = -1
while int(price*0.08) >= a and int(price*0.1) >= b:
  if int(price*0.08) == a and int(price*0.1) == b:
    ans = price
  price -= 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

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

    ll h[n+1];
    h[n] = 100000000000;
    rep(i, n)cin >> h[i];
    h[0]--;
    for(int i = 1; i <= n; i++){
        if(h[i] < h[i-1]){
            cout << "No";
            return 0;
        }
        if(h[i] > h[i-1])h[i]--;
    }
    cout << "Yes";
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int n,m,c;
    cin >> n>>m>>c;
    int b[m];
    for(int i = 0;i < m;i++) cin >> b[i];
    int a[n][m];
    for(int i = 0;i < n;i++) for(int j = 0;j < m;j++) cin >> a[i][j];
    int ans = 0;
    for(int i = 0;i < n;i++){
        long long tmp = c;
        for(int j = 0;j < m;j++){
            tmp += a[i][j]*b[j];
        }
        if(tmp > 0)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256