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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> v(m);
    REP(i, m) cin >> v[i].first >> v[i].second;

    int ans = -1;
    int ma = (int)pow(10, n);
    int mi = ma / 10;
    if(mi == 1) mi = 0;

    FOR(i, mi, ma){
        int ok = true;
        REP(j, m){
            int s = v[j].first, c = v[j].second;
            int x = i;
            REP(k, n - s) x /= 10;
            ok &= (x % 10 == c);
        }
        if(ok){
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int N,Q; cin >> N >> Q;
  string S; cin >> S;
  
  //i番目までにACがいくつあるか
  int acsum[100010];
  acsum[0]=0;
  for(int i=1; i<N; i++){
    if(S.substr(i-1,2)=="AC") acsum[i]=acsum[i-1]+1;
    else acsum[i]=acsum[i-1];
  }
  
  for(int i=0; i<Q; i++){
    int l,r; cin >> l >> r;
    cout << acsum[r-1]-acsum[l-1] << endl;
  }
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a[110];
int main(){
	ll n;
	scanf("%lld",&n);
	ll s=0;
	rep(i,0,n){
		scanf("%lld",a+i);
		s+=a[i];
	}
	ll m;
	scanf("%lld",&m);
	while(m--){
		ll p,x;
		scanf("%lld%lld",&p,&x);
		printf("%lld\n",s-a[p-1]+x);
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define mod 998244353
using namespace std;

int n,k;
int l[15],r[15];
int sum[200005],dp[200005];


signed main()
{
	cin>>n>>k;
	for(int i=1;i<=k;i++)
		cin>>l[i]>>r[i];
	dp[1]=1,sum[1]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			(dp[i]+=sum[max(i-l[j],0ll)]-sum[max(i-r[j]-1,0ll)])%=mod;
		}
		sum[i]=sum[i-1]+dp[i];
		sum[i]%=mod;
	}
	cout<<(dp[n]%mod+mod)%mod<<endl;
}

Measured memory_bytes: 6696
import java.util.Scanner;

class Main {

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

        int m = scan.nextInt();
        int f = scan.nextInt();
        int b = scan.nextInt();
        
        
        
        
        
        if(b-m>=0 && b<=m+f){
            System.out.println(b-m);
        }else if (m>=b){
            System.out.println(0);
        }else if(b>=m+f){
              System.out.println("NA");
        
        
            
        
        
        
        }
        
        
       
    }
}



Measured memory_bytes: 26204
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>

using namespace std;

int main(){
    int n, tmp, b, e;
    long long int sum=0;
    vector<vector<int>> b_e(10, vector<int>(10, 0));
    cin >> n;
    for(int i=1; i<=n; i++){
        e = i%10;
        tmp = i;
        while(tmp >= 10){ tmp /= 10;}
        b = tmp;
        b_e.at(b).at(e)++;
    }
    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            sum += b_e.at(i).at(j) * b_e.at(j).at(i);
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new MyInputStream();
            var A = cin.ReadInt();
            var B = cin.ReadInt();
            var C = cin.ReadInt();
            var D = cin.ReadInt();
            WriteLine(Max(Min(B, D) - Max(A, C), 0));
        }

        private static void PrintYN(bool b)
        {
            //WriteLine(b ? "YES" : "NO");
            WriteLine(b ? "Yes" : "No");
        }

        private static string Reverse(string s)
        {
            return string.Join("", s.Reverse());
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return Console.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}


Measured memory_bytes: 11348
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

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

    vector<int> p(n);
    for(int i = 0; i < n; ++i) {
        cin >> p.at(i);
    }

    // sol
    int cnt = 0;
    for(int i = 1; i < p.size()-1; ++i) {
        if ((p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1)) 
        || (p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1))) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
    fast


        
    string s,t;
    cin>>s>>t;
    int count = 0;
    forn(i,0,s.sze)
    {
        if(s[i]==t[i]) count++;
    }    

    cout<<count;










    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int n, t, i, c[100], k[100], tle[100],check;
	cin >> n >> t; 
	check = 1;
	for (i = 1; i <= n; i++) {
		cin >> c[i];
		cin>> k[i];
		if (k[i] > t) tle[i] = 1;
		else tle[i] = 0;
		check = check * tle[i];
	}
  
	if (check == 1) cout<<"TLE";
	else {
		int min;
		min = 1000;
		for (i = 1; i <= n; i++) {


			if (tle[i] == 0 && c[i] < min) min = c[i];
          else;
		}
		cout << min << endl;
	}
		return 0;
	
}

Measured memory_bytes: 256
import math
from decimal import Decimal, getcontext

getcontext().prec = 100

def solve():
    N = int(input())
    
    for _ in range(N):
        xa, ya, ra, xb, yb, rb = map(Decimal, input().split())
        t = getcontext().power(xa - xb, Decimal('2')) + getcontext().power(ya - yb, Decimal('2'))
        D = t.sqrt()
        
        if ra > D + rb:
            print('2')
        elif rb > D + ra:
            print('-2')
        elif D <= ra + rb:
            print('1')
        else:
            print('0')

if __name__ == "__main__":
    solve()



Measured memory_bytes: 6472
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

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

    for(int i = 0; i <= 1250; i++) {
        double i8 = i * 0.08;
        double i10 = i * 0.1;
        if (floor(i8) == a && floor(i10) == b) {
            cout << i << '\n';
            return 0;
        }
    }
    
    cout << "-1" << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> N >> D;
  ans = N%(2*D+1)==0 ? N/(2*D+1):(N/(2*D+1))+1;
  cout <<  ans << endl;
 
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2!=0:
  if a[0]==0:
    count=1
    for i in range(1,n,2):
      if a[i]==i+1 and a[i+1]==i+1:
        count=count+2
      else:
        break
    if count==n:
      print((2**int((n-1)/2))%(10**9+7))
    else:
      print(0)
  else:
    print(0)
else:
  count=0
  for i in range(0,n,2):
    if a[i]==i+1 and a[i+1]==i+1:
      count=count+2
    else:
      break
  if count==n:
    print((2**int(n/2))%(10**9+7))
  else:
    print(0)
  

Measured memory_bytes: 14008
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
lis=[0]*(10**5+1)
for i in range(n):
    lis[a[i]]+=1
q=int(input())
for _ in range(q):
    b,c=map(int,input().split())
    s+=c*lis[b]-b*lis[b]
    lis[c]+=lis[b]
    lis[b]=0
    print(s)

Measured memory_bytes: 20884
N = int(input())
l = list(map(int,input().split()))

L = l.copy()

l.sort()

s = 0

for i, j in zip(L,l):
    if i != j : s+=1
def Y(a,t = 0):
    if a<t : print('YES')
    else : print('NO')
def y(a, t =0):
    if a==t : print('Yes')
    else : print('No')
Y(s,3)

Measured memory_bytes: 3060
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, T = map(int, input().split())
    
    res = INF
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            res = min(res, c)
    
    if res == INF:
        print("TLE")
    else:
        print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 63980
//Author: Heltion
//Date: 2019-05-04 
#include<bits/stdc++.h>
using namespace std;
constexpr int maxn = 240000;
vector<int> G[maxn];
int d[maxn];
void DFS(int u, int pa){
	d[u] = d[pa] + 1;
	for(int v : G[u]) if(v != pa) DFS(v, u);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int N;
	cin >> N;
	for(int i = 1, a, b; i < N; i += 1){
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	DFS(1, 0);
	int maxd = 0, maxi = 0;
	for(int i = 1; i <= N; i += 1)
		if(d[i] > maxd){
			maxd = d[i];
			maxi = i;
		}
	DFS(maxi, 0);
	for(int i = 1; i <= N; i += 1)
		if(d[i] > maxd){
			maxd = d[i];
			maxi = i;
		}
	cout << (maxd % 3 == 2 ? "Second" : "First");
	return 0;
} 

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

int main(){
  int n, a[110][110];
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)cin >> a[i][j];
  }

  long long sum[110][110];
  for(int i=0;i<n;i++){
    sum[i+1][0] = 0;
    for(int j=0;j<n;j++)sum[i+1][j+1] = sum[i+1][j] + a[i][j];
  }

  for(int i=0;i<=n;i++){
    sum[0][i] = 0;
    for(int j=0;j<n;j++)sum[j+1][i] += sum[j][i];
  }

  long long res = -1e15;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int ii=0;ii<=i;ii++){
	for(int jj=0;jj<=j;jj++){
	  res = max(res, sum[i+1][j+1] - sum[i+1][jj] - sum[ii][j+1] + sum[ii][jj]);
	}
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 1292
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
typedef pair<ll,pii> ipii;
#define MOD 1000000007
#define mod(a) ((a)%MOD)
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define dbg(x) cerr<<#x<<" = "<<x<<"\n"
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<"\n"
#define dbg3(x,y,z) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<" , "<<#z<<" = "<<z<<"\n"
#define INF (1LL<<60)
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define endl '\n'
ll gcd(ll a,ll b){if(a==0) return b; return gcd(b%a,a);}
ll powm(ll base,ll exp,ll mod=MOD) {base%=mod;ll ans=1;while(exp){if(exp&1LL) ans=(ans*base)%mod;exp>>=1LL,base=(base*base)%mod;}return ans;}
 
 
ll n,m;
vector<int> ed[100005];
vector<ll> pp[100005];
vector<ll> sp[100005];

ll ans[100005];
ll dp[100005];

int v[100005];

void dfs(ll x,ll p){
    if(v[x]) return;
    v[x]=1;
    dp[x]=1;
    for(auto it:ed[x]){
        if(it==p) continue;
        dfs(it,x);
        dp[x]=(dp[x]*(dp[it]+1))%m;        
    }

    ll prod=1;
    for(int i=0;i<ed[x].size();i++){
         if(ed[x][i]!=p) prod = (prod*(dp[ed[x][i]]+1))%m;
         pp[x].pb(prod);
    }
    prod=1;
    for(int i=ed[x].size()-1;i>=0;i--){
         if(ed[x][i]!=p) prod = (prod*(dp[ed[x][i]]+1))%m;
         sp[x].pb(prod);
    }

    reverse(all(sp[x]));
}


void dfs1(ll x,ll p,ll prod){
     if(v[x]) return;
     v[x]=1;
     ans[x]=((prod+1)*dp[x])%m;
     for(int i=0;i<ed[x].size();i++){
          if(ed[x][i]==p) continue;
          ll tp = ((i>0?pp[x][i-1]:1)*(i<ed[x].size()-1?sp[x][i+1]:1))%m;
          dfs1(ed[x][i],x,((prod+1)*tp)%m);
     }
}

int main(){
      sync;
      cin>>n>>m;
      for(ll i=1; i<n; i++){
            ll u,v;
            cin>>u>>v;
            ed[u].pb(v);
            ed[v].pb(u);
      }

      dfs(1,-1);
      memset(v,0,sizeof(v));
      dfs1(1,-1,0);

     for(int i=1;i<=n;i++)
     	  cout<<ans[i]<<endl;
             
}

Measured memory_bytes: 27648
BIG_NUM = 2000000000

N = int(input())

table = list(map(int,input().split()))

maximum = -BIG_NUM
minimum = BIG_NUM
total = 0

for x in table:
    if maximum < x:
        maximum = x
    if minimum > x:
        minimum = x
    total += x

print("%d %d %d"%(minimum,maximum,total))



Measured memory_bytes: 6588
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class ADividingAString {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        int res = 0;
        string last = "", cur = "";
        trav(c, str) {
            cur += c;
            if (cur != last) {
                res++;
                last = cur;
                cur.clear();
            }
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    ADividingAString solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
	int n;
	cin >>n;
	int l,max=0,sum=0;
	for(int i=0;i<n;i++){
		cin>>l;
		if(max<l)
			max=l;
		sum+=l;
	}
	cout<<sum-max/2;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,k;cin>>n>>k;
  vl a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=0;
  rep(i,k)ans+=a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int judge=0;
  char s[3];
  
  scanf("%s",s);
 
  if(s[0]=='a'){
    if(s[1]=='b'){
      if(s[2]=='c')
        judge=1;
    }else if(s[1]=='c'){
      if(s[2]=='b')
        judge=1;
    }
  }else if(s[0]=='b'){
    if(s[1]=='a'){
      if(s[2]=='c')
        judge=1;
    }else if(s[1]=='c'){
      if(s[2]=='a')
        judge=1;
    }
  }else if(s[0]=='c'){
    if(s[1]=='b'){
      if(s[2]=='a')
        judge=1;
    }else if(s[1]=='a'){
      if(s[2]=='b')
        judge=1;
    }
  }
  if(judge==0)
    puts("No");
  else if(judge==1)
    puts("Yes");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    ll ans = linf;
    
    ll w[n] = {},b[n] = {};
    
    if(s[0] == '#')b[0] = 1;
    else w[0] = 1;
    rep(i,1,n){
	w[i] = w[i-1];
	b[i]  = b[i-1]; 
	if(s[i] == '#'){
	    b[i]++;
	}else{
	    w[i]++;
	}
    }

    ans = n - b[n-1];
    ans = min(ans,n - w[n-1]);
    
    rep(i,0,n){
	ll t = 0;
	t += b[i] + (w[n-1] - w[i]);
	ans = min(ans,t);
    }

    P(ans);
    
    return  0;
}


Measured memory_bytes: 3716
//隣接行列でグラフを管理して、DEFで連結判定する
#include<bits/stdc++.h>
using namespace std;
const int limit = 50;
int n, m;//ノードの数、エッジの数
int a[limit] , b[limit];//連結するノードのペア
 
bool graph[limit][limit];//隣接行列
bool visited[limit];//訪問済みかどうか
//DFS
void dfs(int v){//あるノードに対して
  visited[v] = true;//訪問済みにする
  for (int v2 = 0; v2 < n ; ++v2){//全ノードに対して
    if (graph[v][v2] == false) continue;//非連結なら次のノードを調べる
    if (visited[v2] == true) continue;//訪問済みなら次のノードを調べる
    dfs(v2);//未探索のノードならそこからさらに調べる
  }
}
 
int main(){
  cin >> n >> m;
  for(int i = 0; i < m; ++i){
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }//ノードのペアに値を代入すると同時に、隣接行列も作成
  
  int ans = 0;
  
  for( int i = 0; i < m; ++i){
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false; //i番目のペアのエッジを削除
    
    for( int j = 0; j < n; ++j) visited[j] = false; //全ノードを見探索にする
    
    dfs(0);//グラフが連結か調べる
    
    bool bridge = false;
    for ( int j = 0; j < n ; ++j) if (visited[j] == false ) bridge = true;//探索で全ノードを訪問できたら、消去したエッジはブリッジ
    if(bridge) ans += 1;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;//消去したエッジを元に戻す
  }
  cout << ans << endl;
  return 0;
}
     

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(){
	int x,y;
	while(1){
		scanf("%d %d",&x,&y);
		if(x == 0 && y == 0) break;
		for(int i = 0; i < x; i++){   //横のループ
			for(int j = 0; j < y; j++){  //縦のループ
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
#define ll long long
#define INF 1e9
#define N 200010
#define maxn 200000
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
int h,w,n,f[N],x,y,ansn=INF;
int main(){
	read(h);read(w);read(n);
	ansn=h;
	for (int i=0;i<=maxn;i++) f[i]=INF;
	for (int i=1;i<=n;i++){
		read(x);read(y);
		if (x>=y)f[x-y]=min(f[x-y],x);
	}
	for (int i=1;i<h;i++){
		if (f[i-1]==INF||f[i-1]>=f[i]){
			ansn=min(ansn,f[i]-1);
		}else{
			if (i==h-1){
				
			}
		}
	}
	cout<<ansn<<endl;
	return 0;
}
/*
3 4 2
2 2
3 2
*/

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int n, m, a[1000], b[1000];
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
	}
	int pos = 1, cnt = 0;
	while (pos <= n) {
		int maxn = 0;
		for (int i = 0; i < m; i++) {
			if (a[i] <= pos) {
				if (maxn < b[i])maxn = b[i];
			}
		}
		pos = maxn + 1;
		cnt++;
		if (cnt >= 100000) { cout << "Impossible" << endl; return 0; }
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int a; cin >> a;
    if (a % 2 == 0) out(a);
    else out(a * 2);
}


Measured memory_bytes: 256
///BigMod , efficinet bitwise OR in a range [L,R] in O(1) 
#include<bits/stdc++.h>
#define ll long long int
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1)
#define MAX 100005 
#define bitscount 32
 
using namespace std;


int main()
{
__

string s;

cin >> s;

if(s=="Sunny") cout << "Cloudy";

else if (s == "Cloudy") cout << "Rainy";

else cout << "Sunny";

return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,m=MI()
a,b=n,m//2
if a>b:
    ans=b
else:
    ans=(a+b)//2
print(ans)
    
        


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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const int MAX_N = 10;
const int MAX_D = 10;
int n,d;
int x[MAX_N][MAX_D];
int ans = 0;
int main() {
    cin>>n>>d;

    REP(i,n)
        REP(j,d){
            cin>>x[i][j];
        }

    REP(i,n){
        FOR(j,i+1,n){
            double dist;
            dist = 0;
            REP(k,d){
                dist += pow(x[i][k]-x[j][k],2);
            }
            
            if(fmod(sqrt(dist),1) == 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int i,j,k,n,m,l;
    long a[101][101],b[101][101],c[101][101] = {};
    scanf("%d %d %d",&n,&m,&l);
    for( i = 1 ; i <= n + m ; i += 1 ){
        if( i <= n ){
            for( j = 1 ; j <= m ; j += 1 ){
                scanf("%ld",&a[i][j]);
            }
        }
        else{
            for( j = 1 ; j <= l ; j += 1 ){
                scanf("%ld",&b[ i - n ][j]);
            }
        }
    }
    for( i = 1 ; i <= n ; i += 1 ){
        for( j = 1 ; j <= l ; j += 1 ){
            for( k = 1 ; k <= m ; k += 1 ){
                c[i][j] = c[i][j] + a[i][k] * b[k][j];
            }
        }
    }
    for( i = 1 ; i <= n ; i += 1 ){
        for( j = 1 ; j <= l ; j+= 1 ){
            if( j == l ){
                printf("%ld\n",c[i][j]);
                continue;
            }
            else{
                printf("%ld ",c[i][j]);
            }
        }
    }
    return 0;
}

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

#define ff first
#define ss second
using namespace std;
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<=n;i++)
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

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



int main() {
	fastio();

	string s; cin >> s;
	string ans;
	if (s == "Sunny") ans = "Cloudy";
	else if (s == "Cloudy") ans = "Rainy";
	else ans = "Sunny";

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        List<String> a = new ArrayList<>();
        for (int i = 0; i < H; i++) {
            String str = sc.next();
            if (!str.matches("\\.+")) {
                a.add(str);
            }
        }
        int h = a.size();
        List<String> res = new ArrayList<>();
        for (int i = 0; i < W; i++) {
            String str = "";
            for (int j = 0; j < h; j++) {
                str += String.valueOf(a.get(j).charAt(i));
            }
            if (!str.matches("\\.+")) {
                res.add(str);
            }
        }
        int w = res.size();
        List<String> restrue = new ArrayList<>();
        for (int i = 0; i < h; i++) {
            String str = "";
            for (int j = 0; j < w; j++) {
                str += String.valueOf(res.get(j).charAt(i));
            }
            restrue.add(str);
        }
        for (String string : restrue) {
            System.out.println(string);
        }
        sc.close();
    }
}

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

long long l[100];

int main() {
        int n;
        scanf("%d", &n);
        l[0] = 2, l[1] = 1;
        for (int i = 2; i < 87; i ++) {
                l[i] = l[i - 1] + l[i - 2];
        }
        printf("%lld\n", l[n]);
        return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> p(N);
	REP(i, N) cin >> p[i];

	sort(p.begin(), p.end());
	int ans = 0;
	REP(i, K) ans += p[i];

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

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

int main(){
  int N;
  cin >> N;
  int ans =0;
  for(int i=1;i<=N;i++){
    int keta=0;
    for(int j=1;j<=i;j++){
      if((i%2)==1 & (i%j)==0){
        ++keta;
      }
    }
    if(keta == 8){
      ++ans;
    }
  }

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


Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn=3000;
double p[maxn];
double dp[maxn][maxn];
bool vis[maxn][maxn];
double solve(ll pos, ll h)
{
    if (h<0) return 0.0;
    else if (pos==0) return h==0;
    else if (vis[pos][h]) return dp[pos][h];
    vis[pos][h]=true;
    return dp[pos][h]=p[pos]*solve(pos-1,h-1)+(1.0-p[pos])*solve(pos-1,h);
}
int main()
{
    //freopen("ABC.inp","r",stdin);
    //freopen("ABC.out","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(vis,false,sizeof(vis));
    ll i,n,h,t;
    double ans=0.0;
    cin>>n;
    for (i=1;i<=n;i++) cin>>p[i];
    for (h=0;h<=n;h++)
    {
        t=n-h;
        if (h>t) ans+=solve(n,h);
    }
    cout<<setprecision(20)<<fixed<<ans<<endl;
}


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

int main() {
  int A,B,C,D,L,R;
  cin>>A>>B>>C>>D;
  L=A+B;
  R=C+D;
  if(L>R){
    cout<<"Left"<<endl;
 }else if(L<R){
    cout<<"Right"<<endl;
}else{
    cout<<"Balanced"<<endl;
}
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x,a,b = iim()

if b - a <= 0:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ce continue
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define rep1(i,n) Rep(i,1,n)
#define rep(i,n) Rep(i,0,n-1)
int n,a[2222],sum;
int main(){
	cin>>n;
	rep(i,n)
		cin>>a[i];
	sort(a,a+n);
	rep(i,n){
		Rep(j,i+1,n-1){
			int f=lower_bound(a,a+n,a[i]+a[j])-a;
			sum=sum+f-j-1;
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	ll n=gi(),A=gi(),B=gi();
	if((n==1&&A!=B)||A>B)return puts("0"),0;
	ll MX=(n-1)*B+A,MN=(n-1)*A+B;
	printf("%lld\n",MX-MN+1);
	return 0;
}


Measured memory_bytes: 256
#33 B - バイナリハックイージー
from collections import deque
S = input()

ans = deque([])
for s in S:
    if s == 'B' and len(ans) >= 1:
        ans.pop()
    elif s == '0' or s == '1':
        ans.append(s)
print(''.join(ans))  

Measured memory_bytes: 9392
#include <iostream>
#include <array>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <numeric>
using namespace std;
const int INF = (int)1000000007;


int gcd(int a, int b) {
	while (true) {
		if (a < b) {
			swap(a, b);
		}
		if (b == 0) {
			break;
		}
		a %= b;
	}
	return a;
}
int main(void){
  int Num1;
  cin >> Num1;
  vector<int> aryi(Num1,0);
  for (int i = 0; i < Num1; i++) {
    std::cin >> aryi[i];
  }
  int ans=1;
  std::vector<int> l(Num1+1);
  std::vector<int> r(Num1+1);
  for (int i = 0; i < Num1; i++) {
    l[i+1]=gcd(l[i],aryi[i]);
  }
  for (int i = Num1-2; i >= 0; i--) {
    r[i]=gcd(r[i+1],aryi[i+1]);
  }
  for (int i = 0; i < Num1; i++) {
    ans=max(ans,gcd(l[i],r[i]));
  }
  std::cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    int n;
    cin >> n;

    vector<lint> a(n);
    rep(i, n){
        cin >> a[i];
    }

    lint ans = 0LL;
    lint maxi = 0LL;
    rep(i, n){
        lint c = (a[i] - 1LL) / (maxi + 1LL);
        ans += c;
        if(a[i] > maxi + 1LL){
            a[i] = 1LL;
        }else{
            a[i] -= c * (maxi + 1LL);
        }
        chmax(maxi, a[i]);
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
  int H, W;
  char a[100][100];
  bool row[100] = {}, col[100] = {};
  
  cin >> H >> W;
  
  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      cin >> a[i][j];
      if(a[i][j] == '#') row[i] = col[j] = true;
    }  
  }
  
  for(int i = 0;i < H;i++){
    if(!row[i]) continue;
    for(int j = 0;j < W;j++){
      if(!col[j]) continue;
      cout << a[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int key;
  struct Node *next,*prev;
};

struct Node *nil;

struct Node* listS(int key){
  struct Node *cur=nil->next;
  while(cur!=nil && cur->key!=key){
    cur=cur->next;
  }
return cur;
}

void init(){
  nil=(struct Node*)malloc(sizeof(struct Node));
  nil->next=nil;
  nil->prev=nil;
}

void pL(){
  struct Node *cur=nil->next;
  int isf=0;
  while(1){
    if(cur==nil)break;
    if(isf++>0)printf(" ");
    printf("%d",cur->key);
    cur=cur->next;
  }
printf("\n");
}

void dNode(struct Node *t){
  if(t==nil)return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void dFirst(){
  dNode(nil->next);
}

void dLast(){
  dNode(nil->prev);
}

void dKey(int key){
  dNode(listS(key));
}

void insert(int key){
  struct Node *x=(struct Node*)malloc(sizeof(struct Node));
  x->key=key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key,n,i;
  int size=0;
  char com[20];
  int np=0,nd=0;
  scanf("%d",&n);
  init();
  for(i=0;i<n;i++){
    scanf("%s%d",com,&key);
    if(com[0]=='i'){
      insert(key);
      np++;
      size++;
    }
else if(com[0]=='d'){
  if(strlen(com)>6){
    if(com[6]=='F')dFirst();
    else if(com[6]=='L')dLast();
  }
else{
  dKey(key);
  nd++;
}
size--;
}
  }
pL();
return 0;
}


Measured memory_bytes: 32932
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  LINT N;
  cin>>N;
  LINT digit=0;
  bool allnine=true;

  LINT x=1;
  if(N<10){
    cout << N<<endl;
    return 0;
  }
  while(N>9){
    if(N%10!=9)allnine = false;
    N/=10;
    ++digit;
  }
  if(allnine){
    cout << 9*digit+N<<endl;
  }
  else cout << 9*digit+N-1<<endl;


  return 0;
}


Measured memory_bytes: 256
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

s = input()
K = int(input())

l = len(s)

alph = [0]*26
for i in range(26):
    alph[i] = []

for i in range(l):
    alph[ord(s[i]) - 97].append(i)

ans = "hoge"
for i in range(26):
    hoge = set()
    for ind in alph[i]:

        for k in range(5):
            tmp = s[ind:ind+k+1]
            if tmp != '':
                hoge.add(tmp)
    flag = False
    for e in sorted(list(hoge)):
        K -= 1
        if K == 0:
            ans = e
            flag = True
            break
    if flag:
        break
print(ans)


Measured memory_bytes: 40432
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
#define Seg_Max_N (1<<18) 

using Value =int;
const Value ini = 1e9;
vector<vector<int>>vs;
struct segtree {
	segtree* a;
	segtree* b;
	int minnum= 2147483647;

	segtree() {}
	segtree(vector<vector<int>>&vs, const int l, const int r, const int u, const int d)  {
		if (l + 21>=r&&u +21>= d) {
			for (int x = l; x <r; ++x) {
				for (int y = u; y <d; ++y) {
					minnum = min(minnum, vs[y][x]);
				}
			}
		}
		else {
			if (r - l < d - u) {
				//tatenibunnkatu
				a = new segtree(vs, l, r, u, (u + d) / 2);
				b = new segtree(vs, l, r, (u + d) / 2, d);
			}
			else {
				a = new segtree(vs, l, (l + r) / 2 , u, d);
				b = new segtree(vs, (l+r)/2, r, u, d);
			}
			minnum = min(a->minnum, b->minnum);
		}
	}
	
	// min [a, b)
	int  query(const int& ql,const int& qr,const int& qu,const int& qd,const int& nl,const int& nr,const int& nu,const int& nd) {
		if (nr <= ql || qr <= nl)return 2147483647;
		else if (nd<= qu|| qd <= nu)return 2147483647;
		if (nl + 21 >= nr&&nu +21 >= nd) {
			int ans = 2147483647;
			for (int x = max(ql,nl); x < min(qr,nr); ++x) {
				for (int y = max(qu,nu); y < min(qd,nd); ++y) {
					ans = min(ans, vs[y][x]);
				}
			}
			return ans;
		}
		if (ql <= nl&&nr <= qr&&qu <= nu&&nd <= qd) {
			
			return minnum;
			
			
		}
		int aa, ab;
		if (nr - nl < nd - nu) {

			aa = a->query(ql, qr, qu, qd,nl,nr,nu,(nu+nd)/2);
			ab = b->query(ql, qr, qu, qd,nl,nr,(nu+nd)/2,nd);
		}
		else {

			aa = a->query(ql, qr, qu, qd, nl, (nl+nr)/2, nu,nd);
			ab = b->query(ql, qr, qu, qd, (nl + nr) / 2, nr, nu, nd);
		}
		int ans = min(aa, ab);
		return ans;
	}
};
int main() {
	while (1) {
		int ar, ac, q; cin >> ar >> ac >> q;
		if (!ar)break;
		vs.clear();
		vs = vector<vector<int>>(ar, vector<int>(ac));
		for (int i = 0; i < ar; ++i) {
			for (int j = 0; j < ac; ++j) {
				cin >> vs[i][j];
			}
		}
		segtree seg(vs, 0, ac, 0, ar);
		for (int i = 0; i < q; ++i) {
			int u, l, d, r; cin >> u >> l >> d >> r; d++; r++;
			int ans = seg.query(l, r, u, d,0,ac,0,ar);
			cout << ans << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 61556
n,a,b=map(int,input().split())
v=[int(i) for i in input().split()]
v.sort(reverse=True)
m=v[a-1]
mm=v.count(m)
cnt=0
for i in range(n):
    if v[i]>m:
        cnt+=1
    else:
        break

def fact(n):
    if n==0 or n==-1:
        return 1
    return fact(n-1)*n
def comb(n,k):
    return fact(n)//fact(n-k)//fact(k)

    
ans=0
#print('mm,cnt',mm,cnt)
for i in range(min(mm+cnt-a,b-a+cnt)+1):
    ans+=comb(mm,a-cnt+i)
    #print(i,ans)
if m!=v[0]:
    ans=comb(mm,a-cnt)
print(sum(v[0:a])/a)
print(ans)


Measured memory_bytes: 42864