akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, b;
  cin >> a >> b;
  char aa = a[0], bb = b[0];
  REP(i, (bb-'0')-1) a += aa;
  REP(i, (aa-'0')-1) b += bb;
  cout << min(a, b) << endl;

  return 0;
}


Measured memory_bytes: 256
t = 0
n = 0
s = 0
w = 0

while True:
    a = list(map(int, input().split()))
    a.sort()
    if a[0]+a[1] <= a[2]:
        print('{} {} {} {}'.format(t, n, s, w))
        break
    else:
        t += 1
        left = a[0]**2 + a[1]**2 
        right = a[2]**2
        if left == right:
            n += 1
        elif left > right:
            s += 1
        else:
            w += 1



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll v, e;
vector<vector<ll>> g;
vector<ll> used;

bool dfs(ll p, ll col, P &cnt) {
	used[p] = col;
	if(col == 0) cnt.first++;
	else cnt.second++;
	bool ret = true;
	REP(i,g[p].size()) {
		if(used[g[p][i]] != -1) {
			if(used[g[p][i]] == col) ret = false;
			continue;
		}
		ret = ret & dfs(g[p][i], !col, cnt);
	}
	return ret;
}

ll solve() {
	used.assign(v, -1);
	bitset<100010> dp(0);
	dp[0] = 1;
	REP(i,v) {
		if(used[i] != -1) continue;
		P cnt = P(0, 0);
		if(!dfs(i, 0, cnt)) return -1;
		dp = (dp << cnt.first) | (dp << cnt.second);
	}
	ll ans = 0;
	REP(i,100010) if(dp[i]) {
		ans = max(ans, i * (v - i) - e);
	}
	return ans;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> v >> e;
	g.resize(v);
	REP(i,e) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	cout << solve() << endl;
	return 0;
}



Measured memory_bytes: 10120
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void q1(){
	int a;
	cin>>a;
	string s;
	cin>>s;
	if(a>=3200)
	cout<<s;
	else 
	cout<<"red";
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;//cin>>t;
	t=1;
	while(t--)//
	q1();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int N;cin>>N;
    long long int ans;ans=0;
    vector <long long int> l(N),r(N);
    for(int i=0;i<N;i++){
        cin>>l[i]>>r[i];
        ans=ans+(r[i]-l[i]+1);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
# ABC129C - Typical Stairs
import sys
input = sys.stdin.readline

def main():
    N, M = tuple(map(int, input().rstrip().split()))
    A = set(map(int, [input().rstrip() for _ in range(M)]))
    MOD = 10 ** 9 + 7
    dp = [0] * (N + 1)
    dp[0] = 1
    for i in range(1, N + 1):
        if i in A:
            continue
        else:
            for j in range(1, 3):
                if i - j >= 0:
                    dp[i] = (dp[i] + dp[i - j]) % MOD
    print(dp[-1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 18332
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){
    return a>b;
}
int main()
{
    int n,a[105];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1,cmp);
    int res=0;
    for(int i=1;i<=n;i++){
        if(i%2==1){
            res+=a[i];
        }
        else res-=a[i];
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
# AtCoder Beginner Contest 091
# C - 2D Plane 2N Points
# https://atcoder.jp/contests/abc091/tasks/arc092_a

N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
B = [tuple(map(int, input().split())) for _ in range(N)]

A.sort(key=lambda x: x[0])
B.sort(key=lambda x: x[0])

used = [False]*N

cnt = 0
for u, v in B:
    maxy = -1
    maxi = -1

    for i, (x, y) in enumerate(A):

        if x >= u:
            break
        if used[i] or y >= v:
            continue

        if maxy < y:
            maxy = y
            maxi = i

    if maxy > -1:
        used[maxi] = True
        cnt += 1

print(cnt)


Measured memory_bytes: 39024
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
    const int MAX =1002;
const int MOD =1000000007;

signed main(){
  int n,h;
  cin>>n>>h;
  int a[n],b[n];
  for(int i=0;i<n;i++){cin>>a[i];
 cin>>b[i];}
  sort(a,a+n);sort(b,b+n);
  int ans=0,s=0;
  for(int i=n-1;i>=0;i--){
    if(b[i]<=a[n-1])break;
    s+=b[i];
    ans++;
    if(s>=h){
      cout<<ans<<endl;
      return 0;
    }
  }

  cout<<ans+(h-s-1)/a[n-1]+1<<endl;
}

Measured memory_bytes: 5124
#pragma GCC optimize ("Ofast","unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define F first
#define S second
#define MEM(a,b) memset(a,b,sizeof a)
#define Tie ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int n,a,b,ans[3],tmp;

int main()
{
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
	{
		cin>>tmp;
		if(tmp<=a)
			ans[0]++;
		else if(tmp<=b)
			ans[1]++;
		else
			ans[2]++;
	}
	cout << min({ans[0],ans[1],ans[2]});
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

import collections
C=collections.Counter(A)
values,counts=zip(*C.most_common())
R=[]
for i in range(len(values)):
    R.append([values[i],counts[i]])
R.sort(reverse=True)

Long=0
Short=0

for i in range(len(values)):
    if R[i][1]>=4 and Long==Short==0:
        Long=R[i][0]
        Short=R[i][0]
        break
    elif R[i][1]>=2 and Long==0:
        Long=R[i][0]
    elif R[i][1]>=2 and Long!=0:
        Short=R[i][0]
        break

print(Long*Short)

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

int main() {
	int A ;
	cin >> A ;
	int B ;
	cin >> B ;
	int C ;
	cin >> C ;
	
	if (A==B && C!=B) {
		cout << "Yes" << endl;
	} else if (B==C && A!=C){
		cout << "Yes"<< endl;
	} else if (A==C && B!=C) {
		cout << "Yes" << endl;
	} else { 
		cout << "No" << endl;
	}		
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
    int a, b;

    std::cin >> a >> b;

    long ans = 1;
    int max = a;
    if(max < b){
        max = b;
    }

    if(a % b == 0 || b % a == 0){
        ans = (long)max;
    }else{
        for(int i = 2; i <= max; i++){
            if(a % i == 0 && b % i == 0 && a >= i && b >= i){
                ans *= i;
                a /= i;
                b /= i;
                i--;
            }
        }
        ans *= long(a);
        ans *= long(b);
    }

    std::cout << ans << std::endl;

    return 0;
}


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


int main() {
    int r, D, x2000; cin >> r >> D >> x2000;
    int ans = x2000;
    for (int i = 1; i <= 10; i++) {
        ans = r * ans - D;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
flag=True
for i in range(n-1):
    if h[n-i-1]+1==h[n-i-2]:
        h[n-i-2]-=1
    elif h[n-i-1]+1<h[n-i-2]:
        print('No')
        flag=False
        break
if flag:
    print('Yes')


Measured memory_bytes: 14396
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	ll x;
	cin>>x;
	vll v(n);
	vvll ans;
	initvv(ans,n,n,INFL);
	rep(i,n){
		cin>>v[i];
		ans[i][0] = v[i];
	}
	ll t = INFL;
	rep(i,n){
		reep(j,1,n){
			int pos = (2*n+i-j)%n;
			ans[i][j] = v[pos];
		}
	}
	rep(i,n){
		reep(j,1,n){
			mins(ans[i][j],ans[i][j-1]);
		}
	}
	ll res = INFL;
	rep(i,n){
		ll tmp = 0;
		rep(j,n){
			tmp += ans[j][i];
			// cout<<j<<" "<<i<<" "<<ans[j][i]<<endl;
		}
		tmp += x*i;
		mins(res,tmp);
	}
	cout<<res<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 31616
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    
    int X = scanner.nextInt();
    for (long i = 1; i <= 100_000; i++) {
      if (i * (i + 1) / 2 >= X) {
        System.out.println(i);
        return;
      }
    }
  }
}


Measured memory_bytes: 22740
#include<iostream>
#include<string>

using namespace std;

int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]!=t[i])
      count++;
  }
  cout<<count;
  return 0;
}


Measured memory_bytes: 3892
#include <stdio.h>
int main(void){
  int N;
  int A[100010];
  scanf("%d",&N);
  int i;
  int B[100010];
  for(i=1;i<=N;i++){
    scanf("%d",&A[i]);
    B[A[i]]=i;
  }
  for(A[i]=1;A[i]<=N;A[i]++){
    printf("%d ",B[A[i]]);
  }
  return 0;
}

Measured memory_bytes: 2916
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int a, b, c; cin>>a>>b>>c;
	cout<<a*b/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define rev_rep(i, n) for(int i = n - 1; i >= 0; --i)
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

ll p(ll N){
  if(N == 0){
    return 1;
  }else{
    return p(N - 1) * 2 + 1;
  }  
}

ll a(ll N){
  if(N == 0){
    return 1;
  }else{
    return a(N - 1) * 2 + 3;
  }
}

ll f(ll N, ll X){
  if(N == 0){
    if(X <= 0){
      return 0;
    }else{
      return 1;
    }
  }
  
  if(X < a(N - 1) + 2){
    return f(N - 1, X - 1);
  }
  if(X == a(N - 1) + 2){
    return p(N - 1) + 1;
  }else{
    return p(N - 1) + 1 + f(N - 1, X - 2 - a(N - 1));
  }
  
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  ll N, X;
  cin >> N >> X;

  cout << f(N, X);
}
#endif


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

int main(){
  string S,T;
  cin>>S>>T;
  int count=0;
  for(int i=0;i<3;i++){
    if(S[i]==T[i]){
      count++;
    }
  }
  cout<<count<<endl;
}
  


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# いっこ入力
n =int(input())
# n行の数をリストへ
a = [int(input()) for i in range(n)] 

max_val = 0
max_num = -1
max_next = 0

for i in range(n):
    if a[i] > max_val:
        max_next = max_val
        max_val = a[i]
        max_num = i
    elif a[i] == max_val:
        max_next = max_val
    elif a[i] > max_next:
        max_next = a[i]

for i in range(n):
    if i == max_num:
        print(max_next)
    else:
        print(max_val)


Measured memory_bytes: 22132
# 二文字以上連続する箇所があったら確定 eialfisxxnidkaofkufdだとxxnとかを示せばいい
# 連続して無くても、（取りぬく部分文字列）全体の長さの過半数だとおｋ xnxはおｋ xlbxはダメ

# いまみている文字と同じ文字が次に出てくる最も近い場所を探索してその距離を求める？1or2なら確定
s = input()
a, b = -1, -1
for i in range(len(s) - 1):
    if i == len(s) - 2:
        # 次の一手しかみれない
        if s[i] == s[i + 1]:
            a, b = i + 1, i + 2
            break
    else:
        if s[i] == s[i + 1]:
            a, b = i + 1, i + 2
            break
        elif s[i] == s[i + 2]:
            a, b = i + 1, i + 3
            break

print(a, b)


Measured memory_bytes: 39920
#include <stdio.h>
 
using namespace std;
 
 
int main(){
    int count[10001],tmp,num=3;
    for(int i=0;i<10001;i++)count[i]=0;
 
    for(int i=0;i<10;i++){
        scanf("%d",&tmp);
        count[tmp]++;
    }
 
    for(int i=10000;i>=0&&num>0;i--){
        if(count[i]>0){
            for(int k=0;k<count[i]&&num>0;k++){
                printf("%d\n",i);
                num--;
            }
        }
    }
 
    return 0;
}


Measured memory_bytes: 2624
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int main(){
  string s,t;
  int ans = 0;
  cin >> s >> t;
  rep(i,3){
    if(s[i] == t[i]) ans++;
  }
  cout << ans << endl;
  
}




Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $N,$X,$T);

$i = 1;
$takoyaki = $X;
while (true) {
    $takoyaki = $X*$i;
    if ($N <= $takoyaki) {
        echo $T*$i;
        break;
    }
    $i++;
}



Measured memory_bytes: 16248
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int b[100];
vi v,ans;
int main() {
    int i;
    int N;
    scanf("%d",&N);
    for (i = 0; i < N; i++) scanf("%d",&b[i]);

    int j;
    v.resize(N);
    for (i = 0; i < N; i++) {
        if (b[i] > i+1) {
            printf("-1\n");
            return 0;
        }
        v[i] = b[i];
    }
    for (i = 0; i < N; i++) {
        for (j = v.size()-1; j >= 0; j--) {
            if (v[j] == j+1) {
                ans.pb(v[j]);
                v.erase(v.begin()+j);
                break;
            }
        }
    }
    for (i = ans.size()-1; i >= 0; i--) printf("%d\n",ans[i]);
    printf("\n");

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H,A; cin>>H>>A;
  cout<<(H+A-1)/A<<endl;
  }


Measured memory_bytes: 256
S=input()
N=len(S)
ans = 0
for b in range(2**(N-1)):
    prev = 0
    for i in range(N-1):
        if b & (1<<i) > 0:
            ans += int(S[prev:i+1])
            prev=i+1
    ans += int(S[prev:])
print(ans)


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

int main() {
  int n;
  cin >> n;
  int a = 0;
  
  for (int i = 0; i < n; i++) {
	string color;
    cin >> color;
    if (color == "Y")
      a ++;
  }
  
  if (a == 0)
    cout << "Three" << endl;
  else
    cout << "Four" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
bool ok(vector<string> &v, int k)
{
    map<string, bool> used;
    map<char, bool> b;
    b['a'] = true;
    b['i'] = true;
    b['u'] = true;
    b['e'] = true;
    b['o'] = true;

    rep(i, v.size())
    {
        string code = "";
        code += v[i][0];
        rep(j, v[i].size() - 1)
        {
            if (b[v[i][j]] == true && code.size() < k)
            {
                code += v[i][j + 1];
            }
        }
        if (used[code] == true)
        {
            return false;
        }
        used[code] = true;
    }
    return true;
}
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    while (n != 0)
    {
        vector<string> v(n, "");
        rep(i, n)
        {
            cin >> v[i];
        }
        bool f = false;
        rep(i, 1, 51)
        {
            if (ok(v, i))
            {
                cout << i << endl;
                f = true;
                break;
            }
        }
        if (f == false)
        {
            cout << -1 << endl;
        }
        cin >> n;
    }

    return 0;
}



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

int count753(long long int num753);
int is753(long long int num);
long long int n;


int main(void){

   	int i,j,k,ans=0;	
  
  	scanf("%lld",&n);
  
  	if(n < 357){
      	printf("0\n");
      	return 0;
    }
  
   	ans += count753(0);	    
   
  
    
  	printf("%d",ans);
  
  
	return 0;
}


int count753(long long int num753){
	
  	int ret=0;
  
	if(num753 <= n){
     	if(is753(num753)){
    		ret++;
        }
    	ret += count753(num753*10+3);
    	ret += count753(num753*10+5);
      	ret += count753(num753*10+7);
    }
	
  	return ret;
  
}

int is753(long long int num){

	int flag3=0,flag5=0,flag7=0,mod;
	
	while(num !=0){
      	mod = num%10;
      	num /=10;
    	if(mod == 3) flag3 = 1;
      	if(mod == 5) flag5 = 1;
      	if(mod == 7) flag7 = 1; 
    }
  	
  	if(flag3 && flag5 && flag7){
    	return 1;
    }
  
  	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  if(A < 10 && B < 10) cout << A * B << "\n";
  else cout << -1 << "\n";
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;

  vector<int> needtime(100);
  vector<int> cost(100);

  for ( int i = 0; i < N; i++ ){
    cin >> cost[i];
    cin >> needtime[i];
  }

  int mincost = 1001;

  for ( int i = 0; i < N; i++ ){
    if ( needtime[i] <= T ){
      if ( cost[i] < mincost ){
        mincost = cost[i];
      }
    }
  }

  if ( mincost == 1001 ){
    cout << "TLE" << endl;
  }
  else{
    cout << mincost << endl;
  }

}

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

using pii = pair<int, int>;

using ll = long long;
constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr double eps = 1e-10;

constexpr ll MOD = 1e9 + 7;

struct edge {
    int from, to;
};

using edges = std::vector<edge>;
using graph = std::vector<edges>;

void add_edge(graph& g, int from, int to) {
    g[from].push_back((edge){from, to});
}

int scc(graph& G, std::vector<int>& cmp) {
    int V = G.size();
    std::vector<std::vector<int>> g(V), rg(V);
    std::vector<bool> used(V, false);
    std::vector<int> vs;
    cmp.resize(V);
    for(int i=0; i<V; ++i) {
        for(auto e : G[i]) {
            g[i].push_back(e.to);
            rg[e.to].push_back(i);
        }
    }
    std::function<void(int)> dfs = [&g, &vs, &used, &dfs](int v) {
        used[v] = true;
        for(auto i : g[v]) {
            if(!used[i]) {
                dfs(i);
            }
        }
        vs.push_back(v);
    };
    std::function<void(int, int)> rdfs = [&rg, &cmp, &used, &rdfs](int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for(int i : rg[v]) {
            if(!used[i]) {
                rdfs(i, k);
            }
        }
    };
    for(int v=0; v<V; ++v) {
        if(!used[v]) {
            dfs(v);
        }
    }
    std::fill(used.begin(), used.end(), false);
    int k = 0;
    for(int i=vs.size()-1; i>=0; --i) {
        if(!used[vs[i]]) {
            rdfs(vs[i], k++);
        }
    }
    return k;
}

int main() {
    int V, E;
    cin >> V >> E;
    graph g(V);
    for(int i = 0; i < E; ++i) {
        int s, t;
        cin >> s >> t;
        add_edge(g, s, t);
    }
    vector<int> cmp;
    int K = scc(g, cmp);
    int Q;
    cin >> Q;
    while(Q--) {
        int u, v;
        cin >> u >> v;
        cout << (cmp[u] == cmp[v]) << endl;
    }
}

Measured memory_bytes: 5404
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;
	auto M = RD;
	auto S = RD;
	auto edges = new long[][][](N);
	foreach (i; 0..M)
	{
		auto u = RD-1;
		auto v = RD-1;
		auto a = RD;
		auto b = RD;
		edges[u] ~= [v, a, b];
		edges[v] ~= [u, a, b];
	}
	auto CD = new long[][](N);
	foreach (i; 0..N)
	{
		CD[i] = [RD, RD];
	}

	auto cost = new long[][](N, 2501);
	foreach (i; 0..N)
		cost[i][] = long.max;
	foreach (i; 0..min(S+1, 2501))
		cost[0][i] = 0;

	long[] open = [0];
	while (!open.empty)
	{
		auto from = open.front; open.popFront;
		auto c = CD[from][0];
		auto d = CD[from][1];
		foreach (i; 0..2501)
		{
			auto j = max(0, i - c);
			cost[from][i].chmin(cost[from][j] + d);
		}
		foreach (e; edges[from])
		{
			auto to = e[0];
			auto a = e[1];
			auto b = e[2];
			bool update;
			foreach (i; a..2501)
			{
				auto t = cost[from][i] + b;
				if (t < cost[to][i-a])
				{
					cost[to][i-a] = t;
					update = true;
				}
			}
			if (update)
				open ~= to;
		}
	}

	foreach (i; 1..N)
	{
		auto p = cost[i].MIN_POS;
		writeln(cost[i][p]);
	}

	stdout.flush;
	debug readln;
}

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

int main() {
  int N, M;
  scanf("%d%d", &N, &M);

  vector<vector<int>> s(M);
  for (int i = 0; i < M; ++i) {
    int k = 0;
    scanf("%d", &k);
    s[i].resize(k);
    for (int j = 0; j < k; ++j) {
      scanf("%d", &s.at(i).at(j));
      --s.at(i).at(j);
    }
  }

  vector<int> p(M, 0);
  for (int i = 0; i < M; ++i) {
    scanf("%d", &p.at(i));
  }

  int ans = 0;
  // 全てのスイッチの状態をビット列とみなしてシミュレートする
  for (int bit = 0; bit < (1 << N); ++bit) {
    bool is_all_on = true;

    for (int j = 0; j < M; ++j) {
      int connect_count = 0;

      for (int BIT_FLAG_CONNECT : s[j]) {
        // 電球繋がっているスイッチが何個ONになっているか
        if ((bit >> BIT_FLAG_CONNECT) & 1) {
          ++connect_count;
        }
      }
      // 2の剰余をとり、1つでも点灯する条件が満たされていなければ、
      // そのビット列(スイッチの状態)では全ての電球を点灯できない
      if (connect_count % 2 != p[j]) {
        is_all_on = false;
      }
    }

    if (is_all_on) {
      // 全ての電球の点灯条件をシミュレートし、点灯可能であれば解である
      ++ans;
    }
  }

  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n, k, h[100010], cnt = 0;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> h[i];
  for (int i = 0; i < n; ++i) if (h[i] >= k) ++cnt;
  cout << cnt;
}


Measured memory_bytes: 3948
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"
#define int ll

using namespace std;
typedef string::const_iterator State;
#define eps 1e-8L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
    static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x^(x << 11));
    x = y; y = z; z = w;
    return (w = (w^(w >> 19))^(t^(t >> 8)));
}

void init() {
    iostream::sync_with_stdio(false);
    cin.tie(0);
}

void solve() {
    int n;
    cin >> n;
    vector<int> inputs;
    REP(i, n) {
        int a;
        cin >> a;
        inputs.push_back(a);
    }
    sort(ALL(inputs));
    int ans = 0;
    if (n % 2 == 0) {
        REP(q, n / 2 - 1) {
            ans += inputs[n - q - 1];
            ans += inputs[n - q - 2];
        }
        ans += inputs[n / 2];
    }
    else {
        REP(q, n / 2) {
            ans += inputs[n - q - 1];
            ans += inputs[n - q - 2];
        }
    }
    cout << ans << endl;
}


#undef int
int main() {
    init();
    solve();
}

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

using namespace std;

void solve() {
    long long n, a, b; cin >> n >> a >> b;
    long long cnt = 0;
    cnt = n / (a + b);
    cnt = a * cnt;
    n = n % (a + b);
    cout << cnt + min(n % (a + b), a);
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 256
S=input()
a=int(S[:2:1])
b=int(S[2:4:1])
if a<=12 and a>=1 and (b<=12 and b>=1):
    print("AMBIGUOUS")
elif a<=12 and a>=1 and (b>12 or b<1):
    print("MMYY")
elif (a>12 or a<1) and (b<=12 and b>=1):
    print("YYMM")
elif (a>12 or a<1) and  (b>12 or b<1):
    print("NA")

Measured memory_bytes: 3064
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    a = input()
    if a.islower():
        print("a")
    else:
        print("A")

if __name__ == '__main__':
    main()


Measured memory_bytes: 10508
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int s;
	std::vector<int> v(203);
	cin >> v.at(1);
	for (int i = 2; i <= 200; ++i){
		v.at(i) = ((v.at(i - 1) % 2) ? (3 * v.at(i - 1) + 1) : (v.at(i - 1) / 2));
		if(i >= 4 && v.at(i - 3) == v.at(i)){
			OUT(i) BR;
			RET;
		}	
	}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        int cnt = 0;
        for (int i=0;i<N;i++) {
            int X = sc.nextInt();
            int Y = sc.nextInt();

            if ((long)D*D >= (long)X*X+(long)Y*Y) cnt++;
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 59076
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	int n;
	cin>>n;
	map<ll, ll> mp;
	ll sum = 0;
	ll x;
	REP(i,n)
	{
		cin>>x;
		mp[x]++;
		sum+=x;
	}
	ll q, b,c;
	cin>>q;
	REP(i,q)
	{
		cin>>b>>c;
		sum-=mp[b]*b;
		sum+=mp[b]*c;
		mp[c]+=mp[b];
		mp.erase(b);
		cout<<sum<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 7568
#include <iostream>
using namespace std;
int main () {
	int n,m,a=0,sum=0;
	char c1,c2;
	cin>>n>>m;
	cin>>c2;
	for (int i=0;i<n-1;i++) {
		c1=c2;
		cin>>c2;
		if (c1==c2)
			sum++;
		else
			a++;
	}
	if (a>2*m)
		cout<<sum+2*m;
	else
		cout<<sum+a;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
static const int N = 100;
int main(){
    int M[N][N];
    int n,u,k,v;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)M[i][j]=0;
}
  for(int i=0;i<n;i++){
    cin>>u>>k;
    u--;
    for(int j=0;j<k;j++){
        cin>>v;
        v--;
        M[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(j)cout <<" ";
        cout<<M[i][j];
    }
    cout <<endl;
  }
  return 0;
}

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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

int n, m, s[200000];
bool c[200000];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n >> m;
  int x, y;
  for (int i = 0; i < n; i++)
    s[i] = 1;
  c[0] = true;
  for (int i = 0; i < m; i++) {
    cin >> x >> y, x--, y--;
    c[y] |= c[x];
    s[y]++;
    s[x]--;
    if (s[x] == 0)
      c[x] = false;
  }
  int r = 0;
  for (int i = 0; i < n; i++)
    r += c[i];
  cout << r << "\n";
}


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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

const int mod = 1e9+7;

int d;
vector<int> c;
vector<vector<int>> s;
vector<int> last(26, 0);

vector<int> argsort(vector<int> v) {
    vector<int> indices(v.size());
    iota(indices.begin(), indices.end(), 0);
    // ソートする。
    sort(indices.begin(), indices.end(), [&v](int i1, int i2) {
        return v[i1] < v[i2];
    });
    return indices;
}

int greedy(int date) {
    vector<int> score(26, 0);
    rep (i, 26) {
        score[i] = s[date][i] + last[i] * c[i];
        last[i]++;
    }
    vector<int> indices = argsort(score);
    last[indices[25]] = 0;
    return indices[25];
}

int main() {
    cin >> d;
    c.resize(26);
    rep (i, c.size()) {
        scanf("%d", &c[i]);
    }
    s.resize(d, vector<int>(26));
    rep (i, d) {
        rep (j, c.size()) {
            cin >> s[i][j];
        }
    }
    rep (i, d) {
        cout << greedy(i) + 1 << endl;
    }
}




Measured memory_bytes: 3748
//----------------------Shanu Garg here---------------------
//-------------Search on youtube : Shanu Garg---------------
//-Studying at National Institute of Technology Delhi(NITD)-
//---------------------From Delhi, India--------------------

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

#define f(i,n) for(auto i=0;i<n;i++)
#define fr(i,n) for(auto i=n-1;i>=0;i--)
#define fs(i,a,b,c) for(auto i=a;i!=b;i+=c)
#define fl(i,x) for(auto i : x)
#define memset(a,first,last,val) fs(i,first,last,1) a[i]=val
#define nl cout<<"\n";
#define chk(x) cout<<#x<<x<<" ", nl
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vvi vector<vi>
#define pr pair<ll, ll>
#define vii vector<pair<int, int>>
#define vll vector<pr>
#define vl vector<ll>
#define m(a,b) map<a, b>
#define mid(a,b) ((a+b)/2)
#define pb push_back
#define LCM(a,b) ((a*b)/__gcd(x,y))
const int INF = 0x3f3f3f3f, mod = 1e9 + 7;

class triplet{
    public:
    ll f, s, t;};

vl in(ll n){vl v;ll x;
    f(i,n)
    cin>>x, v.pb(x);
    return v;}

vll in_pr(ll n){
    vll ar;
    ll x,y;
    f(i,n)
    {cin>>x>>y;
    ar[i]={x,y};
    }return ar;
}
void out(vl v, char ch='\0'){
    fl(i,v)
    cout<<i<<ch;
}

void solve(){
       ll A,B;
       cin>>A>>B;
       A-(2*B) > 0 ? cout<<(A-(2*B)) : cout<<0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
   return 0;
}




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

using namespace std;

const int HUGEI = 2147483647;  // (1 << 31) - 1
const long long HUGEL = 9223372036854775807;  // (1 << 63) - 1
const string ABC = "abcdefghijklmnopqrstuvwxyz";
const int MAX = 100000;

int main(void) {
    int x, i;
    cin >> x;
    long long su = 0;
    for (i = 0; i < MAX; i++) {
        su += i;
        if (su >= x) {
            break;
        }
    }
    cout << i << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

const int mod = 1000000007;
#define PI 3.14159265359;

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

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


int main() {
  int a, b, h;
  cin >> a >> b >> h;
  P((a + b) * h / 2);

  return 0;
}

Measured memory_bytes: 256
const lines=readlines()
const k,q=map(x->parse(Int,x),split(shift!(lines)))
const d=map(x->parse(Int,x),split(shift!(lines)))
function f(n,x,m)
  s=Int[0]
  pre=0
  for i=1:k
    pre+=mod1(d[i],m)
    push!(s,pre)
  end
  n-1-div(x%m+div(n-1,k)*pre+s[mod1(n,k)],m)
end
for t=lines
  const n,x,m=map(x->parse(Int,x),split(t))
  println(f(n,x,m))
end

Measured memory_bytes: 176352
N = int(input())
S = input()

W = [0 for _ in range(N + 1)]
E = [0 for _ in range(N + 1)]

for i, s in enumerate(S):
    if s == 'W':
        W[i + 1] = W[i] + 1
        E[i + 1] = E[i]
    else:
        W[i + 1] = W[i]
        E[i + 1] = E[i] + 1

ret = 10 ** 6
for i in range(1, N+1):
    w = W[i - 1]
    e = E[N] - E[i]
    ret = min(ret, w + e)

print(ret)


Measured memory_bytes: 17860
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    size_t N;
    char S[301];

    scanf("%zu\n%s", &N, &(S[100]));

    int32_t cnt = 0;
    size_t bPos = 100;

    for (size_t i = 0; i < N; i++) {
        if (S[100 + i] == '(') {
            cnt++;
        }
        else {
            cnt--;
        }

        if (cnt < 0) {
            S[bPos - 1] = '(';
            bPos--;
            cnt++;
        }
    }

    printf("%s", &(S[bPos]));

    if (0 < cnt) {
        for (size_t i = 0; i < (size_t)cnt; i++) {
            putchar(')');
        }
    }

    return 0;
}


Measured memory_bytes: 128
import std.stdio;
import std.algorithm;

void main(){
 int [] a;
 a.length = 10;
 for(int i=0;i<10;i++){
	readf("%d\n",&a[i]);
 }
 static bool greater(int x,int y){
   return x > y;
 }
 sort!(greater)(a);
 for(int i=0;i<3;i++){
	writeln(a[i]);
 }
}

Measured memory_bytes: 992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
		int A2 = sc.nextInt();
		int A3 = sc.nextInt();
		sc.close();
		System.out.println(A1+A2+A3<22 ? "win":"bust");
	}

}

Measured memory_bytes: 21844
import Data.List

bsearch f (a,b)
    | a+1 == b = a
    | f m  = bsearch f (m,b)
    | otherwise = bsearch f (a,m)
    where m = a + (b-a)`div`2

main=do
    n<-readLn::IO Int
    let m = bsearch (\x->x^2+x < n*2) (0,n+1)
    putStr$unlines$map show$s ((m+1)*(m+2)`div`2 -n) [m+1,m..1]
    
s 0 r = r
s a (x:r)|a-x>=0 = s (a-x) r|a-x<0 = x : s a r

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 3e3;

int n, x, y;
int ans[MAX];

void solve() {
	memset(ans, 0, sizeof ans);
	cin >> n >> x >> y;
	if(x > y) swap(x, y);	
	for(int i=1; i<=n; i++) {
		for(int j=i+1; j<=n; j++) {
			int d = min(j-i, abs(i-x) + 1 + abs(j-y));
			ans[d]++;
		}
	}
	for(int i=1; i<n; i++) cout << ans[i] << "\n";
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 3640
n = int(input())
letters_mapping = {num: {num2:[] for num2 in range(10)} for num in range(10)}

for num in range(1, n + 1):
    first_letter = str(num)[0]
    last_letter = str(num)[-1]
    letters_mapping[int(first_letter)][int(last_letter)].append(num)

count = 0
for i, v in letters_mapping.items():
    for j, x in letters_mapping[i].items():
        for num in letters_mapping[i][j]:
            count += len(letters_mapping[j][i])
            
print(count) 


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

long long floor_sum(long long n, long long m, long long a, long long b) {
    long long sum = 0;
    if (a >= m) {
        sum += (a / m) * n * (n - 1) / 2;
        a %= m;
    }
    if (b >= m) {
        sum += (b / m) * n;
        b %= m;
    }
    long long y = (a * n + b) / m;
    long long x = y * m - b;
    if (y == 0) return sum;
    sum += (n - (x + a - 1) / a) * y;
    sum += floor_sum(y, a, m, (x + a - 1) / a * a - m * y + b);
    // sum += floor_sum(y, a, m, a - 1 - (x + a - 1) % a);
    return sum;
}

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

    int T;
    cin >> T;
    while (T--) {
        int N, M, A, B;
        cin >> N >> M >> A >> B;
        cout << floor_sum(N, M, A, B) << "\n";
    }
}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    L=LI()
    cnt=0
    for i in range(N):
        for j in range(i+1,N):
            for k in range(j+1,N):
                a=L[i]
                b=L[j]
                c=L[k]
                if a!=b and b!=c and c!=a:
                    S=a+b+c
                    M=max(a,b,c)
                    if M<S-M:
                        cnt+=1
                    
                    
    print(cnt)

main()


Measured memory_bytes: 68180
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll H, W, C[10][10], A[200][200];

int main(void) {
  cin >> H >> W;
  REP(i, 0, 10) REP(j, 0, 10) cin >> C[i][j];
  REP(i, 0, H) REP(j, 0, W) cin >> A[i][j];

  REP(k, 0, 10) REP(i, 0, 10) REP(j, 0, 10) C[i][j] = min(C[i][j], C[i][k] + C[k][j]);

  ll ans = 0;
  REP(i, 0, H) REP(j, 0, W) if(A[i][j] >= 0) ans += C[A[i][j]][1];
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
 
int main() {
	int n;
	cin >> n;
 
	if (n % 10 == 7) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		n = n / 10;
	}
	if (n % 10 == 7) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		n = n / 10;
	}if (n % 10 == 7) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		n = n / 10;
		cout << "No" << endl;
		return 0;
	}
 
 
}

Measured memory_bytes: 3636