akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
N_f = float(N)
A = li()

cnt = [0, 0, 0]
for a in A:
    cnt[a-1] += 1

dp = dp3(0.0, cnt[2]+1, cnt[1]+cnt[2]+1, N+1)
dp[0][0][0] = 0

for k in range(cnt[2]+1):
    for j in range(cnt[1]+cnt[2]+1-k):
        for i in range(N+1-j-k):
            if i+j+k == 0:
                continue
            num = i+j+k
            dp[i][j][k] = N_f
            if i > 0:
                dp[i][j][k] += dp[i-1][j][k] * i
            if j > 0:
                dp[i][j][k] += dp[i+1][j-1][k] * j
            if k > 0:
                dp[i][j][k] += dp[i][j+1][k-1] * k
            dp[i][j][k] /= num

print(dp[cnt[0]][cnt[1]][cnt[2]])

Measured memory_bytes: 254472
import heapq

n,m = map(int, input().split())
#a = list(map(int, input().split()))
a = [-int(n) for n in input().split()]

heapq.heapify(a)

for i in range(m):
    tmp = heapq.heappop(a)
    tmp = int(tmp/2)
    heapq.heappush(a,tmp)

print(-sum(a))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""
"""
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
"""


Measured memory_bytes: 72216
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(i,N){R(x)V.push_back(x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL0(line)
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  R(N)R(A)R(B)RV(h,N);
  std::sort(h.begin(),h.end());

  // nmin
  i8t total=0;F(i,N)total+=h[i];
  i8t nmin=std::ceil((double)total/(B*N+(A-B)));

  // nmax
  i8t thresh = 0;
  i8t nmax = 0;
  for(i8t i=N;i--;){
    //F(i,N)std::cout<<h[i]-thresh<<",";std::cout<<std::endl;5 2 1
    i8t m = h[i];
    if (m<=thresh)break;
    i8t n = (m-thresh +A-1)/ A;
    thresh += n * B;
    nmax+=n;
  }

  //assert(nmin<=n&&n<=nmax)
  while(nmin<nmax){
    i8t ntry = (nmin+nmax)/2;
    i8t nadd=0;
    F(i,N){
      i8t rest = h[i] - ntry * B;
      if(rest>=0)
        nadd += (rest+(A-B-1)) / (A -B);
    }
    if(nadd>ntry)nmin=ntry+1;
    else nmax=ntry;
  }
  P(nmin);

  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define LL long long
#define maxn 100009
using namespace std;
struct data{
  LL x,v;
}t[maxn];
LL a[maxn],b[maxn],c[maxn],d[maxn];
inline bool cmp(const data &A,const data &B){
  return A.x<B.x;
}
int main(){
  int n;LL C,ans=0;
  scanf("%d%lld",&n,&C);
  for(int i=1;i<=n;i++)
    scanf("%lld%lld",&t[i].x,&t[i].v);
  sort(t+1,t+n+1,cmp);
  LL sum=0;
  for(int i=1;i<=n;i++){
    sum=sum+t[i].v;
    a[i]=max(a[i-1],sum-t[i].x);
    b[i]=max(b[i-1],sum-t[i].x*2);
  }
  sum=0;
  for(int i=n;i>0;i--){
    sum=sum+t[i].v;
    c[i]=max(c[i+1],sum-(C-t[i].x));
    d[i]=max(d[i+1],sum-(C-t[i].x)*2);
  }
  for(int i=1;i<=n;i++){
    ans=max(ans,max(a[i],c[i]));
    ans=max(ans,a[i-1]+d[i]);
    ans=max(ans,b[i-1]+c[i]);
  }
  printf("%lld",ans);
  return 0;
}


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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;

using StrView = string_view;

auto solve(i64 const X) -> void {
  i64 C = 100;
  i64 year = 0;
  while (C < X) {
    C += C * 0.01;
    year += 1;
  }
  cout << year << "\n";
}

auto main() -> int {
  i64 X;
  scanf("%" SCNd64, &X);
  solve(X);
  return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define INF 2000000000
#define DESPACITO2 1000000000000000
#define DESPACITO 1000000000000000000
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define vii vector<ii>
#define si set<int>
#define msi map<string,int>
#define REP(i,a,b) for(int i=int(a);i<=int(b);i++)
#define TRvi(c,it) for(vi::iterator it=(c).begin();it!=(c).end();it++)
#define TRvii(c,it) for(vii::iterator it=(c).begin();it!=(c).end();it++)
#define TRmsi(c,it) for(msi::iterator it=(c).begin();it!=(c).end();it++)
 
 
using namespace std;


int main()
{
    IOS;
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
    ll sum=0;
    int n;
    cin >> n;
    REP(i,1,n)
    {
    	int x;
    	cin >> x;
    	sum+=x-1;
    }
    cout << sum << "\n";
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Input(Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray());

            Console.WriteLine((input.d <= input.t * input.s) ? "Yes" : "No");
        }

        static (int d,int t,int s) Input(int[] input)
        {
            return (input[0], input[1], input[2]);
        }
    }
}

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

using namespace std;

int main()
{
  uint64_t N;
  cin >> N;

  if (N % 2 == 0) {
    uint64_t K = N / 2;
    uint64_t S = 0;

    for (uint64_t M = 5; true; M *= 5) {
       uint64_t T = K / M;
       if (T == 0) { break; }
       S += T;
    }

    cout << S << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(ll a, ll b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n), b(n), dis(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	ll x = 0, y = 0; //x->a,y->b
	rep(i, n)
	{
		dis[i] = b[i] - a[i];

		if (dis[i] < 0)
		{
			y += -dis[i];//負ならばyを増やす
		}
		else
		{
			//正ならばxを増やすが差は偶数でなければならないので調整する
			if (dis[i] % 2 != 0)
			{
				dis[i]++;
				y++;
			}
			x += dis[i] / 2;
		}
	}
	//	cout << x << " " << y << endl;
	if (x - y >= 0)//x >= yならxとyを一致させることができる
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 512
//abc163_c.cpp
//Sun Apr 19 20:58:06 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int jyoushi[n];
	fill(jyoushi,jyoushi+n,0);

	for (int i=0;i<n-1;i++){
		int a;
		cin >> a;
		a--;
		jyoushi[a]++;
	}

	for (int i=0;i<n;i++){
		cout << jyoushi[i] << endl;
	}

}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<vector<int>> s(m);
    vector<int> p(m);
    rep(i, m) {
        int k; cin >> k;
        vector<int> tmp(k);
        rep(j, k) cin >> tmp[j];
        s[i] = tmp;
    }
    rep(i, m) cin >> p[i];
    int ok = 0;
    for (int bit=0; bit<(1<<n); ++bit) {
        // cout << bitset<10>(bit) << endl;
        int on = 0;
        rep(i, m) {
            int cnt = 0;
            rep(j, s[i].size()) {
                if (bit & 1<<(s[i][j]-1)) cnt++;
            }
            if (cnt % 2 == p[i]) on++;
        }
        if (on == m) ok++;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;
 
int main(void) {
    Int n;
    cin >> n;
    VI a(n + 1), b(n);
    for (Int i = 0; i < n + 1; ++i) {
        cin >> a[i];
    }
    for (Int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    Int result = 0;
    for (Int i = 0; i < n; ++i) {
        if (a[i] < b[i]) {
            result += a[i];
            b[i] -= a[i];
            a[i] = 0;
            if (a[i + 1] < b[i]) {
                result += a[i + 1];
                b[i] -= a[i + 1];
                a[i + 1] = 0;
            } else {
                result += b[i];
                a[i + 1] -= b[i];
                b[i] = 0;
            }
        } else {
            result += b[i];
            a[i] -= b[i];
            b[i] = 0;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 4740
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
 
using namespace std;
typedef long long int ll;

int N, M ,Q;
vector<int> a, b, c, d;
vector<int> A;

int maxp;
void findm(int, int);

int main()
{
  int i,j,k;
  int l;

  cin >> N >> M >> Q;

  a.resize(Q+1); b.resize(Q+1); c.resize(Q+1); d.resize(Q+1);
  A.resize(N+1);
  for (i=1; i<=Q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }

  maxp=0;

  findm(1, 1);
  printf("%d\n", maxp);

  return 0;
}
void findm(int dp, int si) {
  int i,j;
  int sum=0;
  if (dp>N) {
    for (j=1; j<=Q; j++) {
//printf("j=%d: a[j] = %d, b[j] = %d, c[j] = %d, d[j] = %d\n", j, a[j], b[j], c[j], d[j]);fflush(stdout);
      if (A[b[j]] - A[a[j]] == c[j]) sum += d[j];
    }
    if (sum > maxp) maxp = sum;
    return;
  }
  for (i=si; i<=M; i++) {
    A[dp] = i;
    findm(dp+1, i);
  }
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int a0,a1,a2,a3;
  int sa=1000;
  for (int i=0; i<n-2;i++){
    a1=s[i]-'0';
    a2=s[i+1]-'0';
    a3=s[i+2]-'0';
    a0 = a1*100+a2*10+a3;
    if (abs(a0-753) < sa) sa=abs(a0-753);
  }
  cout << sa << endl;
}

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

public class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var vals = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToList();
        foreach (var item in vals)
        {
            if (item % 2 == 0)
            {
                if (!(item % 3 == 0 || item % 5 == 0))
                {
                    Console.WriteLine("DENIED");
                    return;
                }
            }
        }
        Console.WriteLine("APPROVED");
    }
}


Measured memory_bytes: 13268
#include <iostream>
using namespace std;
void swap(int *,int *);
int main() {
    int s,m,l,cnt=0;
    cin>>s>>m>>l;
    while(s!=m||m!=l){
    if(l<m)swap(l,m);
    if(l<s)swap(l,s);
    if(m<s)swap(m,s);
    if(l-s>=2){
        s+=2;
    }else{
        s++;
        m++;
    }
    cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  string s; cin >> s;
  int o = 0;
  for(int i=0; i<(int)s.length(); ++i)
    if(s[i] == 'o')
      ++o;
  if(o + (15-(int)s.length()) >= 8)
    cout << "YES\n";
  else 
    cout << "NO\n";
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}
 
ll pow(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;
}

const ll N=1e6+5;

ll arr[N];
int main()
{ 
  IOS;

ll n;cin>>n;

//sieve();

//cout<<sp[10]<<endl;


vl a(n+1,1e8);

for(int i=0;i<n;i++){
cin>>a[i];
}
set<ll>s;

ll cnt=0;

//for(auto x:a)cout<<x<<endl;


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

ll mx=a[n-1];

for(int i=0;i<n;i++)
{
    if(!arr[a[i]]){
      for(int j=a[i];j<=mx;j+=a[i])arr[j]=1;
    if(a[i]!=a[i+1])cnt++;
    }
}


cout<<cnt<<endl;

 return 0;

 
 
}

Measured memory_bytes: 12600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if (((S[0] == '0' && S[1] != '0') || (S[0] == '1' && (S[1] == '0' || S[1] == '1' || S[1] == '2'))) && ((S[2] == '0' && S[3] != '0') || (S[2] == '1' && (S[3] == '0' || S[3] == '1' || S[3] == '2')))) {
    cout << "AMBIGUOUS";
  }
  else if (((S[0] == '0' && S[1] != '0') || (S[0] == '1' && (S[1] == '0' || S[1] == '1' || S[1] == '2')))) {
    cout << "MMYY";
  }
  else if ((S[2] == '0' && S[3] != '0') || (S[2] == '1' && (S[3] == '0' || S[3] == '1' || S[3] == '2'))) {
    cout << "YYMM";
  } else {
    cout << "NA";
  }
}

Measured memory_bytes: 256
f = lambda : raw_input().rstrip()
f1 = lambda : f().split()
f2 = lambda t : map(t, f1())

def main1():
    A, B, C = f2(int)
    print 0 if B + C <= A else (B + C) - A

def main2():
    n = int(f())
    p = 0
    ans = -1
    while 10**p<n:
        if 10**(p+1) > n:
            ans = ans + n - 10**p + 1
        else:
            ans = ans + 10**(p+1) - 10**p + 1
        p = p + 2
    print ans
    
def main3():
    n = int(f())
    a = f2(int)
    m = 0
    for i in xrange(1,n):
        if a[i] < a[i-1]:
            m = m + 1#(a[i-1] - a[i])
  
    print "Yes" if m < 2 else "No"

def main4():
    s = f()
    n = len(s)
    ans = [0]*n
    m = 1
    i = 1
    st = 0
    s = s + ("L" if s[-1]=="R" else "R")
    while i <= n:
        if s[i] != s[i-1]:
            #print i, st,
            j = st if s[i-1]=="L" else i
            #print j
            if m&1:
                ans[j-1] = ans[j-1] + m/2 + (1 if s[i-1] == "R" else 0) 
                ans[j] = ans[j] + m/2 + (1 if s[i-1] == "L" else 0)
            else:
                ans[j-1] =  ans[j-1] + m/2
                ans[j] = ans[j] + m/2
            m = 0
            st = i
        #print ans
        i = i + 1
        m = m + 1
    print " ".join(map(str,ans)) 
         
if __name__=="__main__":
    main1()

Measured memory_bytes: 2696
#include<iostream>

using namespace std;

int main(){
	long long x, y, n;
	while(cin >> x >> y){
		int count = 1;
		n = x;
		while(1){
			n *= 2;
			if(n > y) break;
			count++;
		}
		cout << count << endl;
	}
	return 0;
} 

Measured memory_bytes: 764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		while(true){

			int a = Integer.parseInt(scan.next());
			String op = scan.next();
			int b = Integer.parseInt(scan.next());

			int result = 0;

			if(op .equals("+")){
				result = a + b;
			}else if(op.equals("-")){
				result = a - b;
			}else if(op.equals("*")){
				result = a * b;
			}else if(op.equals("/")){
				result = a / b;
			}else if(op.equals("?")){
				break;
			}
			System.out.println(result);
		}
		scan.close();
	}
}

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

long long n, ans=0;

int main(){
	cin >> n;
	long long tmp=n;
	map<long long,int>mp; // prime, count
	while (tmp%2==0){
		mp[2]++;
		tmp>>=1;
	}
	for (long long i=3;i*i<=tmp;i+=2){
		while (tmp%i==0){
			mp[i]++;
			tmp/=i;
		}
	}
	if (tmp>2) mp[tmp]++;
	for (auto u : mp){
		long long prime=u.first;
		int cnt=u.second;
//		cout << prime << " " << cnt << "\n";
		int k=1;
		while (k<=cnt){
			ans++;
			cnt-=k;
			k++;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n,ans;
  cin >> n;
  rep(i,n){
    int l,r;
    cin >> l >> r;
    ans += r-l+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() { int N;
  cin >> N;
  vector<int> V(N), C(N);
  REP(i, N) cin >> V[i];
  REP(i, N) cin >> C[i];
  ll X = 0, Y = 0;
  REP(i,N){
    if(C[i]<V[i]){
      X += V[i], Y += C[i];
    }
  }
  cout << X - Y << endl;
}

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

typedef tuple<int, int, int> ti;
int main() {
  int h, w;
  cin>>h>>w;
  string s[h];
  for (int i=0; i<h; i++) cin>>s[i];
  int cost[h][w];
  bool used[h][w];
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      cost[i][j] = 1e9;
      used[i][j] = false;
    }
  }
  priority_queue<ti, vector<ti>, greater<ti> > pq;
  if (s[0][0] == '.') {
    pq.push(make_tuple(0, 0, 0));
  } else {
    int i = 0;
    while (i < w && s[0][i] == '#') {
      pq.push(make_tuple(1, 0, i));
      ++i;
    }
    i = 0;
    while (i < h && s[i][0] == '#') {
      pq.push(make_tuple(1, i, 0));
      ++i;
    }
  }
  while (!pq.empty()) {
    auto top = pq.top();
    pq.pop();
    int y = get<1>(top);
    int x = get<2>(top);
    if (used[y][x]) {
      continue;
    }
    int c = get<0>(top);
    used[y][x] = true;
    cost[y][x] = c;
    if (s[y][x] == '#') {
      int i = x+1;
      while (i < w && s[y][i] == '#') {
        pq.push(make_tuple(c, y, i));
        ++i;
      }
      if (i < w) {
        pq.push(make_tuple(c, y, i));
      }
      i = y+1;
      while (i < h && s[i][x] == '#') {
        pq.push(make_tuple(c, i, x));
        ++i;
      }
      if (i < h) {
        pq.push(make_tuple(c, i, x));
      }
    } else {
      if (y < h-1) {
        if (s[y+1][x] == '#') {
          pq.push(make_tuple(c+1, y+1, x));
        } else {
          pq.push(make_tuple(c, y+1, x));
        }
      }
      if (x < w-1) {
        if (s[y][x+1] == '#') {
          pq.push(make_tuple(c+1, y, x+1));
        } else {
          pq.push(make_tuple(c, y, x+1));
        }
      }
    }
  }
  cout<<cost[h-1][w-1]<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

void solve(int n, int m) {
	set<int> s;
	int l = 1;
	int r = n;
	vector<pair<int, int>> v;
	for (int i = 0; i < m; i++) {
		if (s.count(r - l) || s.count(n - (r - l)) || 2 * (r - l) == n) l++;
		// cerr << l << ' ' << r << ' ' << r - l <<  ' ' << n - (r - l) << '\n';
		v.push_back({l, r});
		s.insert(r - l);
		s.insert(n - (r - l));
		l++;
		r--;
		l = (l + n) % n;
		r = (r + n) % n;
		if (l > r) swap(l, r);
	}
	if ((int)s.size() != 2 * m) {
		assert(false);
		cerr << "WA " << n << ' ' << m << endl;
	}
	for (auto t : v) {
		cout << t.first << ' ' << t.second << endl;
	}
}

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

	int n, m;
	cin >> n >> m;
	solve(n, m);
	// for (int m = 1; m < 100; m++) {
	// 	for (int n = 2 * m + 1; n <= 100; n++) {
	// 		solve(n, m);
	// 	}
	// }
}


Measured memory_bytes: 12316
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  vector<int> num(26);
  for(int i = 0; i < 26; i++) {
    num.at(i) = i;
  }
  vector<char> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
                           'n','o','p','q','r','s','t','u','v','w','x','y','z'};
  for(int i = 0; i < N; i++) {
    int x = S.at(i) - 'a';
    num.at(x) = 26;
  }
  sort(num.begin(), num.end()); 
  if(num.at(0) == 26) {
    cout << "None" << endl;
  }
  else {
    int y = num.at(0);
    cout << alphabet.at(y) << endl;
  }
}

Measured memory_bytes: 3692
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n,a[114514];
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	if(a[0]==0||a[0]==1)
	{
		for(int i=1-a[0];i<n;i+=2)
		{
			if(a[i]!=i+1||a[i+1]!=i+1)
			{
				cout<<0<<endl;
				return 0;
			}
		}
	}
	else
	{
		cout<<0<<endl;
		return 0;
	}
	n/=2;
	long ans=1;
	for(int i=0;i<n;i++)ans=ans*2%1000000007;
	cout<<ans<<endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
 
		int r = scanner.nextInt();
		int D = scanner.nextInt();
		int x = scanner.nextInt();
 
		for(int i = 1; i <= 10; i++){
			x = r*x -D;
			System.out.println(x);
		}
		scanner.close();
	}
 
}

Measured memory_bytes: 35856
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i+1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]

def chk(L):
    NN = 5
    BIT=[0] * (2**NN+1)
    def addbit(i):
        while i <= 2**NN:
            BIT[i] += 1
            i += i & (-i)
 
    def getsum(i):
        ret = 0
        while i != 0:
            ret += BIT[i]
            i -= i&(-i)
        return ret
    s = 0
    for l in L[::-1]:
        s += getsum(l+1)
        addbit(l+1)
    return s
ans = 1 << 100
for m in range(1<<N):
    b = bin(m)
    if b[::2].count("1") != b[1::2].count("1"): continue
    C = [[], []]
    for i in range(N):
        p = m >> i & 1
        q = p + i & 1
        C[q].append(((A[i] if p == 0 else B[i]) << 5) + i)
    if len(C[1]) != N // 2: continue
    C[0].sort()
    C[1].sort()
    CC = [C[i&1][i//2] for i in range(N)]
    for i in range(1, N):
        if CC[i-1] >> 5 > CC[i] >> 5: break
    else:
        CCC = [c % 32 for c in CC]
        ans = min(ans, chk(CCC))
print(ans if ans < 1 << 100 else -1)

Measured memory_bytes: 50520
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int flag[10000];
int main(){
	int x,y;
	cin>>x>>y;
	int ans = 0;
	
	/*
	for(int a = 0;a < y+1;a++){
		ans++;
		flag[a]=1;
	}
	for(int a = 0;a < x+1;a++){
		if(flag[a*2] == 0){
			ans++;
		}
	}
	*/

	ans += y + 1;

	for(int i = 0; i < x + 1; ++i){
		double val = 1.0 * (i*2) * y / (x*2);
		double eps = 1e-9;
		if(!(abs(val - (int)val) <= eps || abs(val - (int)(val + 1)) <= eps))
			++ans;
	}

	cout << ans << endl;

}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int f[N],x,y,m,v[N],fa[N],sum[N];
char s[N];
int find(int x){
	if (x==fa[x])return x;
	return fa[x]=find(fa[x]);
}
void link(int x,int y){
	x=find(x);y=find(y);
	if (x!=y)fa[x]=y;
}
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	for (int i=1;i<=n;i++)f[i]=s[i]-'a',fa[i]=i;
	n++;fa[n]=n;
	for (int i=n;i>1;i--)(f[i]+=26-f[i-1])%=26;
	for (int i=1,j=n;i<j;i++,j--)link(i,j);
	scanf("%d",&m);
	while (m--){
		scanf("%d%d",&x,&y);
		link(x,y+1);
	}
	for (int i=1;i<=n+1;i++)(sum[find(i)]+=f[i])%=26;
	for (int i=1;i<=n+1;i++)
		if (sum[i]){
			puts("NO");
			return 0;
		}
	puts("YES");
}

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

int main() {
  long long N, M;
  cin >> N >> M;
  if (N == 1LL && M == 1LL) {
    printf("1");
  } else if (N == 1LL || M == 1LL) {
    printf("%lld", N * M - 2LL);
  } else {
    printf("%lld", (N - 2LL) * (M - 2LL));
  }
  return 0;
}


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

int a, b, c;

int main() {
  cin >> a >> b >> c;

  if (((a == b) & (a != c)) | ((a == c) & (a != b)) | ((b == c) & (a != b))) {
    printf("Yes");
  } else {
    printf("No");
  }

  return 0;
}

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

void trace(int arr[], int N)
{
    for(int i=0; i<N; i++){
        if(i>0) cout<<' '<<flush;
        cout<<arr[i]<<flush;
    }
    cout<<endl;
}

int main()
{
    int N;
    cin>>N;
    int* arr=new int[N];
    int comp;
    int j;
    for(int i=0; i<N; i++){
        cin>>arr[i];
    }
    trace(arr,N);



    for(int i=1; i<N; i++){
        comp=arr[i];
        j=i-1;
        while( arr[j] > comp && j>=0 ){
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=comp;
        trace(arr,N);

    }
    delete[] arr;

}

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

int main() {
  string S; cin >> S;
  vector<string> v;
  for (int i = 0; i < S.size();) {
    string str = "";
    if (i == 0) {
      str += S.at(0);
      v.push_back(str);
      i++;
      continue;
    }
    while (i < S.size()) {
      str += S.at(i);
      if (v.back() != str) {
        v.push_back(str);
        break;
      }
      i++;
    }
    i++;
  }
  cout << v.size() << endl;
}

Measured memory_bytes: 10996
from sys import stdin, stdout

input = stdin.readline()[:-1].split(' ')

takahashi = int(input[0])
aoki = int(input[1])
k = int(input[2])

if k > 0:
    if takahashi > k:
        prev_k = k
        takahashi = takahashi - prev_k
        k = prev_k - takahashi
    else:
        k = k - takahashi
        takahashi = 0

if k > 0:
    if aoki > k:
        aoki = aoki - k
    else:
        aoki = 0

print('{} {}'.format(takahashi, aoki))


Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;

    if(A >= 13)
    {
        cout << B << endl;
    }
    else if(A <= 5)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << B / 2 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long
#define pb push_back
#define bpc __builtin_popcount

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, m, dp[mxn], used[mxn];
vector <llong> v, g[mxn];

llong dfs(llong x){
    used[x] = 1;
    for (int i = 0; i < g[x].size(); i ++){
        llong to = g[x][i];
        if(!used[to]){
            dfs(to);
        }
    }v.pb(x);
}

int main(){
    cin >> n >> m;
    for (int i = 0; i < m; i ++){
        llong x, y;
        cin >> x >> y;
        x --, y --;
        g[x].pb(y);
    }for (int i = 0; i < n; i ++){
        if(!used[i]){
            dfs(i);
        }
    }llong ans = 0;
    reverse(v.begin(), v.end());
    for (int i = 0; i < n; i ++){
        for (int j = 0; j < g[v[i]].size(); j ++){
            llong to = g[v[i]][j];
            dp[to] = max(dp[to], dp[v[i]] + 1);
        }ans = max(ans, dp[v[i]]);
    }cout << ans;
    return 0;
}


Measured memory_bytes: 9588
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
minn = 10 ** 9
for i in range(n):
	for j in range(m):
		x = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
		if x < minn:
			minn = x
			ans = j + 1
	print (ans)
	minn = 10 ** 9


Measured memory_bytes: 3064
n, a, b = map(int, input().split())
red = 0 ; blue = 0
if n >= a + b :
    stack = n // (a+b)
    red += b * stack
    blue += a * stack
    n -= (a+b) * stack
if n > a :
    n -= a
    blue += a
else :
    blue += n
if n > b :
    n -= b
    red += b
else :
    red += n
print(blue)


Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string sa,sb;
	long int i,flag=0,flag1=0,flag2=0,j,k,n;
	cin>>sa>>sb;
	n=sa.size();
	for(i=0;i<n;i++){
		flag1=0;
		string s="";
		for(j=i;j<n;j++){
			s=s+sa[j];
		}
		for(k=0;k<i;k++){
			s=s+sa[k];
		}
//		cout<<s<<endl;
		for(j=0;j<n;j++){
			if(s[j]!=sb[j]){
				break;
			}
			if(j==n-1){
			    flag=1;
			    break;
			}
		}
		if(flag==1){
		    break;
		}
	}
	if(flag==1){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}

int main(){
    ll n,m;
    cin>>n>>m;
   
    cout<<(n*(n-1)/2 )+(m*(m-1)/2)<<endl;

    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <vector>
using namespace std;

#define REP(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) REP(i, 0, n)
#define ALL(x) begin(x), end(x)

int main(){
  int m, n;
  cin >> m >> n;

  vector<long long> p(m);
  for(auto &e : p) cin >> e;

  sort(ALL(p), greater<long long>());
  p.insert(p.begin(), 0);
  partial_sum(ALL(p), p.begin());

  vector<long long> dp(m + 1, 0);
  rep(j, n) {
	int c, e;
	cin >> c >> e;

	for(int i = m - 1; i >= 0; --i) {
	  const int next = min(m, i + c);
	  dp[next] = max(dp[next], dp[i] + p[next] - p[i] - e);
	  
	}
  }

  cout << *max_element(ALL(dp)) << endl;

  return 0;
}

Measured memory_bytes: 1320
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    s = input().rstrip()
    first = ord("A") - 1
    last = ord("Z")
    increment = lambda x: chr(ord(x)+n) if ord(x)+n <= last else chr(first + (ord(x)+n - last))
    new_s = "".join(map(increment, s))
    print(new_s, end="")
    


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n; cin >> n; vector<int> vec(n, 0); for(int i = 0; i < n; i++) cin >> vec[i];
    
    int ret = 0;
    for(int i = 1; i < n - 1; i++)
    {
        vector<int> v(3, 0);
        v[0] = vec[i], v[1] = vec[i-1], v[2] = vec[i+1];
        sort(v.begin(), v.end());
        if(v[1] == vec[i])
            ret += 1;
    }
    cout << ret << endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    int ans = 0;
    size_t c[10][10];
    for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
            c[i][j] = 0;
        }
    }
    
    for (int i=1; i<=N; i++) {
        int min = i%10;
        int v = static_cast<int>(log10(i));
        int max = i / static_cast<int>(pow(10, v));
        c[min][max] += 1;
    }
    for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
            ans += c[i][j] * c[j][i];
        }
    }
    
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main( void )
{
	int n;
	int i;
	int element;
	int element_first;
	int min;
	int max;
	
	scanf("%d", &n);
	
	for(i = 0;i < n; i++){
		scanf("%d", &element);
		
		if(i == 0){
			element_first = element;
		}

		if(i == 1){
			max = element - element_first;
		}
		else if(max < element - min){
			max = element - min;
		}

		if(i == 0){
			min = element;
		}
		else if(min > element){
			min = element;
		}
	}
	printf("%d\n", max);
	return 0;
}

Measured memory_bytes: 596
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ll = int_fast64_t; using ld = long double;

// -----------------------------------------------------------------------------

void solve() {
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        if (a % 2 == 1) continue;
        if (a % 3 == 0) continue;
        if (a % 5 == 0) continue;
        cout << "DENIED\n";
        return;
    }
    cout << "APPROVED\n";
}


int main() {
    fast_io; cin_exception;
    int t = 1; // cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	string s;
	int ans = 0, k = 0;

	cin >> s;

	for (int i = 0; i < s.size(); ++i) {
		if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			k++;
		}
		else {
			k = 0;
		}

		ans = max(ans,k);
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int MOD=1000000007;

int N;
string S;
int n[30]={};
int main(){
    cin>>N;
    cin>>S;
    LL ans=1;
    for(int i=0;i<N;i++){
        n[S[i]-'a']++;
    }
    for(int i=0;i<='z'-'a';i++){
        ans*=n[i]+1;
        ans%=MOD;
    }
    ans--;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep2(i,a,n) for(int i = (a);i < (n);i++)
#define rep(i,n) rep2(i,0,n)
#define INF (1LL << 60)
#define itn int

int main(void){
    int n;
    cin >> n;
    itn a[n];
    rep(i,n)cin >> a[i];
    
    ll dp[n];
    rep(i,n)dp[i] = 0;
    dp[0] = 1000;
    
    for(int i = 1;i < n;i++){
        dp[i] = dp[i-1];
        for(int j = 0;j < i;j++){
            ll v = dp[j] / a[j];
            ll w = dp[j] + (a[i]-a[j]) * v;
            dp[i] = max(dp[i],w);
        }
    }
    cout << dp[n-1] << endl;
}


Measured memory_bytes: 3684
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	int N, A[101];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];

	int temp;
	int idx;
	for (int i = 0; i < N; i++) {
		temp = A[i];
		idx = 0;
		for (int j = 0; j < i; j++) {
			idx = j;
			if (A[j] > temp) {
				idx--;
				break;
			}
		}
		for (int l = idx+1; l <= i; l++) {
			int temp2 = A[l];
			A[l] = temp;
			temp = temp2;
		}
		for (int j = 0; j < N-1; j++) cout << A[j] << " ";
		cout << A[N-1]<< endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;
 
int main()
{
    int l,r,d;
    cin >> l >> r >> d;
    
    int cnt = 0;
    std::vector<int> v;
    for(int i=l; i<=r; i++){
        if(i%d == 0) cnt++;
    }

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 2e9+7;

int main() {
    vi in(3);
    rep(i, 3) cin >> in[i];
    sort(all(in));
    cout << in[0] * in[1] / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
nbits = 1 << (len(s) - 1)
ans = 0
for bit in range(nbits):
    tmp = []
    for i in range(len(s) - 1):
        if bit & (1 << i):
            tmp.append(i)

    curr = 0
    for x in tmp:
        ans += int(s[curr : x + 1])
        curr = x + 1
    ans += int(s[curr:])

print(ans)


Measured memory_bytes: 39664
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n)
        self.size = [1] * (n)

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

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

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


uni = UnionFind(N)
for ab in AB:
    a, b = ab
    uni.union(a - 1, b - 1)

sizemax = 0
for n in range(N):
    size = uni.get_size(n)
    sizemax = max(sizemax, size)
print(sizemax)


Measured memory_bytes: 120952
a,v=[int(x) for x in input().split()]
b,w=[int(x) for x in input().split()]
t=int(input())
delta_v=v-w
if delta_v <= 0:
  print("NO")
else:
  T=(abs(b-a))/delta_v
  if T <= t:
    print("YES")
  else:
    print("NO")

Measured memory_bytes: 9076
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int dp[2][2020];
int rem[100000];

// At each position find the count of numbers%2019

int main(){
    string s;
    while(cin>>s){
        memset(dp,0,sizeof(dp));

        int n = s.size();
        forn(i,100000)
            rem[i] = i%2019;
        
        ll ans = 0;
        dp[0][s[0]-'0'] = 1;
        fore(i,1,n){
            forn(j,2019){
                int nxt = rem[(10*j + s[i]-'0')%mod];
                dp[1][nxt] += dp[0][j];
            }

            ans+=dp[1][0];
            memcpy(dp[0], dp[1], sizeof(dp[1]));
            dp[0][s[i]-'0']++;
            memset(dp[1], 0, sizeof(dp[1]));
        }

        cout<<ans<<endl;

    }
    return 0;
}

Measured memory_bytes: 4164
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<iterator>
#include<vector>
using namespace std;
typedef vector<int> vii;
#define ll long long
#define tt ll t;cin>>t;while(t--)
#define nl endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define vec vector<ll>
#define cinv(v) for(auto it:v)cin >> it;
#define coutv(v) for(auto it:v)cout << it <<' ';cout<<endl;
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
        so;

        ll i,k,n,j,ctr=0,a[101],c;
        cin>>n;
        for(i=0;i<n;i++)cin>>a[i];
          sort(a,a+n);
        for(i=0;i<n-2;i++){
          if(a[i]==a[i-1]);
          for(j=i+1;j<n-1;j++){
                   if(a[i]==a[j])continue;
                    for(k=j+1;k<n;k++){
                              if(a[j]==a[k])continue;
                              if((a[i]<(a[j]+a[k])&&a[j]<(a[i]+a[k])&&a[k]<(a[i]+a[j]))){
                                        ctr++;
                              }
                    }
          }

        }
        cout<<ctr;


        return 0;
}



Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, x, l;
    cin >> n;
    vector<pair<ll, ll>> r(n);
    for(int i = 0; i < n; i++){
        cin >> x >> l;
        r[i] = make_pair(x + l, x - l);
    }
    sort(begin(r), end(r));
    int ans = 1;
    ll cl = r[0].first;
    for(int i = 1; i < n; i++){
        if(cl <= r[i].second){
            cl = r[i].first;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
char s[2000005];
int main()
{
    cin >> s;
    int cnt=1;
    int len=1;
    int n=strlen(s);
    for(int i=1;i<n;i++){
        if(len!=2&&s[i]==s[i-1]){
            cnt++;
            i++;
            if(i==n)
                cnt--;
            len=2;
        }
        else{
            cnt++;
            len=1;
        }
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a,b,c,d,e,k;
signed main()
{
	cin>>a>>b>>c>>d>>e>>k;
	if(e-a<=k){
		cout<<"Yay!";
	}else{
		cout<<":(";
	}
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
  int n,x;cin>>n>>x;
  vector<int> m(n);
  rep(i,n)cin>>m[i];
  int sum=0;
  rep(i,n){
    sum+=m[i];
  }
  sort(m.begin(),m.end());
  int rest=x-sum;
  int ans=n;
  ans+=rest/m[0];
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a.back() - a.front() << endl;
}

Measured memory_bytes: 256