akhauriyash/Code-Regression huggingface dataset:
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

int main()
{
    fastio;

    ll n;
    cin>>n;

    ll a[n], b[n], c[n-1];

    forn(i, n)
    {
        cin >> a[i];
    }
    forn(i, n)
    {
        cin >> b[i];
    }
    forn(i, n-1)
    {
        cin >> c[i];
    }

    ll cnt=0;
    forn(i, n)
    {
        cnt += b[a[i]-1];

//        see(cnt);
        if(i>0)
        {
            if(a[i]-1==a[i-1]-1+1)
                {
////                    cout << "yes\n";
////                    see(a[i]-1);
////                    see(c[a[i]-1]);
                    cnt+=c[a[i-1]-1];
                }

        }
    }
    cout<< cnt << "\n";

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define all(c) (c).begin(),(c).end()
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >
#define Inp(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define Out(a,n,ch) for(int i=0;i<n;i++)cout<<a[i]<<ch;cout<<endl;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	int n,a[200005],mx,ans=0;
	cin>>n;
	Inp(a,n);
	mx = a[0];
	for(int i=1;i<n;i++)
	{
		mx = max(mx,a[i]);
		ans += (mx-a[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5184
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/07/20 20:52:21
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int t; cin>>t;
  while (t--) {
    int n; cin>>n;
    vector<unsigned long long> A(n); for (auto& a:A) cin>>a;
    string s; cin>>s;
    vector<unsigned long long> B(64, -1ull);
    auto set_base = [&B](unsigned long long x) -> bool {
      for (int i = 0; i < 64; i++) {
        if ((x & (1ull<<i)) == 0) continue;
        if (B[i] == -1ull) {
          B[i] = x;
          return true;
        }
        x ^= B[i];
      }
      return false;
    };
    auto solve = [&]() {
      for (int i = n-1; i >= 0; i--) {
        if (set_base(A[i]) and s[i] == '1') {
          return false;
        }
      }
      return true;
    };
    cout << (solve() ? 0 : 1) << endl;
  }

  return 0;
}


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

int main(){
	int a,b,c,n,x,y,z;
	cin>>n
	;for(int i=0;i<n;i++){
		cin>>a>>b>>c;
		if(a>b&&a>c){
			x=a;y=b;z=c;
		}else if(a<b&&b>c){
			x=b;y=a;z=c;
		}else{
			x=c;y=a;z=b;
		}
		if(x*x==y*y+z*z){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <queue>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define umap unordered_map
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}

void solve() {

}

int main() {
  string o, e;
  cin >> o >> e;
  for (int i = 0; i < e.size(); ++i) {
    cout << o[i] << e[i];
  }
  if (o.size() - e.size() == 1)
    cout << o[o.size() - 1];
  cout << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#define REP(i, n) for (int i = 0; i < n; ++i)
using namespace std;

int N, m[26][50];
int main(){
    cin >> N;
    REP(i,N) {
        string s;
        cin >> s;
        for (char c: s) {
            m[c - 'a'][i]++;
        }
    }
    REP(i,26) {
       int me = *min_element(m[i], m[i] + N);
       while (me--) cout << (char)('a' + i);
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

int main() {
  //
  int n, m;
  cin >> n >> m;
  vl a(n), s(n);
  rep(i, n) cin >> a[i];
  s[0] = a[0] % m;
  map<ll, ll> mp;
  mp[s[0]] = 1;
  REP(i, 1, n) {
    s[i] = (s[i - 1] + a[i]) % m;
    if (mp.find(s[i]) == mp.end()) {
      mp[s[i]] = 1;
    } else {
      mp[s[i]]++;
    }
  }
  ll ans = 0;
  ans += mp[0];
  for (auto& kv : mp) {
    ans += (kv.second) * (kv.second - 1) / 2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5760
s = input()
t = input()
used_str = []
for i in range(len(s)):
  if s[i] != t[i] and not s[i] in used_str and not t[i] in used_str:
    s = s.translate(str.maketrans(s[i]+t[i],t[i]+s[i]))
    used_str.append(s[i])
    used_str.append(t[i])

if s == t:
  print("Yes")
else:
  print("No")

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

int main() {
  int N; cin >> N;
  vector<int> a(N);
  a.push_back(0);
  
  for(int i=0;i < N;i++)
    cin >> a.at(i);
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int A=0,B=0;
  
  for(int i=0;i < (N+1)/2;i++) {
     A += a.at(2*i);
     B += a.at(2*i+1);
  }
  
  cout << A-B << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

n = int(input())

a_lis = list(map(int,input().split()))
A_dict = defaultdict(int)

for i in a_lis:
  A_dict[i] += 1
  
max_cnt = 0

for j in range(1, 10**5):
  tmp = A_dict[j-1]+A_dict[j]+A_dict[j+1]
  max_cnt = max(max_cnt, tmp)
print(max_cnt)

Measured memory_bytes: 20036
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }


// 最大公約数を求める(ユークリッドの互除法).
ll gcd (ll x, ll y) {
  if (y > x) swap(x,y);
  if (y == 0) return x;
  return gcd(x%y,y);
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) {
    cin >> a[i];
  }
  vector<ll> l(n), r(n);
  l[0] = a[0], r[n - 1] = a[n - 1];
  
  for (int i = 1; i < n; ++i) {
    l[i] = gcd(a[i], l[i - 1]);
  }

  for (int i = n - 2; i >= 0; --i) {
    r[i] = gcd(a[i], r[i + 1]);
  }
  // roll(l);
  // roll(r);
  ll mmax = 1, tmp;
  for (int i = 0; i < n; ++i) {
    tmp = 0;
    if (i == 0) tmp = r[i + 1];
    else if (i == n - 1) tmp = l[i - 1];
    else {
      tmp = gcd(l[i - 1], r[i + 1]);
    }
    // debug(tmp);
    mmax = max(tmp, mmax);
  }

  cout << mmax << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	ll q,h,s,d,n;
	cin >> q >> h >> s >> d >> n;
	h = min(h, 2*q);
	s = min(s, 2*h);
	d = min(d, 2*s);
	ll ans = 0;
	ans += n/2 * d;
	n %= 2;
	ans += n*s;
	cout << ans << endl;
}

Measured memory_bytes: 256
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
a = inp.shift().split(' ').map(x => x - 0)
i = 1
c = 0
for (j=0;j<N;j++) {
    if (a[j] == i) {
        i++
    } else {
        c++
    }
}
console.log(c == N ? -1 : c) 

Measured memory_bytes: 22244
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(){
    long long a,b,c,d;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    
    long long ans;
    
    ans = a * c;
    if(a*d > ans) ans = a*d;
    if(b*c > ans) ans = b*c;
    if(b*d > ans) ans = b*d;
    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1732
using System;

namespace  Main
{
    class A_Right_Triangle
    {
        static void Main(string[] arg)
        {
            var input = Console.ReadLine().Split(' ');

            var h = int.Parse(input[0]);
            var w = int.Parse(input[1]);
            Console.WriteLine(h * w / 2.0);
        }

    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

ll h;

main()
{
        cin>>h;
        int r=floor(log2(h))+1;
        ll ans=pow(2,r)-1;
        cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<a.length;i++){
            a[i]=sc.nextInt();
        }
        for(int i = n-1;i>=0;i--){
            if(i == 0){
                System.out.println(a[i]);
            }else{
            System.out.print(a[i]+" ");
            }
        }
        sc.close();
        }
}
     


Measured memory_bytes: 26272
NQ = input().split(' ')
N = int(NQ[0])
Q = int(NQ[1])
out_put_list = [0] * N
tree_list = {}
for i in range(N):
    tree_list[i] = []

for i in range(N-1):
    ab = input().split(' ')
    a = int(ab[0]) -1
    b = int(ab[1]) -1
    tree_list[a].append(b)

for _ in range(Q):
    px = input().split(' ')
    p = int(px[0])
    x = int(px[1])
    out_put_list[p-1] += x

for i in range(len(tree_list)):
    for num in tree_list[i]:
        out_put_list[num] += out_put_list[i]

print(*out_put_list)

Measured memory_bytes: 64996
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

const uint64_t MOD = 1000 * 1000 * 1000 + 7;

template <uint8_t max_value, uint8_t mod_value>
struct index_mod {
  uint8_t mod[max_value];
  constexpr index_mod() : mod() {
    for (size_t i = 0; i < max_value; ++i) {
      mod[i] = i % mod_value;
    }
  }
};

template <uint8_t mod_value>
struct sub_index {
  uint8_t index[mod_value][mod_value - 10];
  constexpr sub_index() : index() {
    auto value = 0;
    uint8_t in[mod_value] = {0};
    for (size_t i = 0; i < mod_value; ++i) {
      value += 10;
      for (size_t j = 0; j < mod_value - 10; ++j) {
        // index[i][j] = (value + j) % mod_value;
        auto v = (value + j) % mod_value;
        index[v][in[v]] = i;
        ++in[v];
      }
    }
  }
};

int main() {
  std::ios::sync_with_stdio(false);

  std::string s;
  std::cin >> s;

  // i番目の文字を見た時に13との剰余がnになる個数を数え上げる
  std::vector<uint64_t> dp(2 * 13);

  constexpr index_mod<13 * 10, 13> imod;
  constexpr sub_index<13> sindex;

  // for (size_t i = 0; i < 13; ++i) {
  // for (size_t j = 0; j < 3; ++j) {
  //   std::cout << (int)sindex.index[i][j] << ",";
  // }
  // std::cout << std::endl;
  // }

  uint64_t row_sum = 0;

  {  // テーブル初期化
    int val = -1;
    if (s[0] != '?') val = s[0] - '0';
    if (val == -1) {
      for (size_t i = 0; i < 10; ++i) {
        dp[i % 13] = 1;
      }
      row_sum = 10;
    } else {
      dp[val % 13] = 1;
      row_sum = 1;
    }
    // % 13は不要だけど定義に帰るため
  }

  for (size_t i = 1, e = s.length(); i < e; ++i) {
    int val = -1;
    if (s[i] != '?') val = s[i] - '0';
    if (val == -1) {
      for (size_t here = 0; here < 13; ++here) {
        auto temp_sum = row_sum + 3 * MOD;
        for (size_t j = 0; j < 3; ++j) {
          temp_sum -= dp[sindex.index[here][j]];
        }
        dp[13 + here] = temp_sum;
      }
    } else {
      for (size_t pre = 0; pre < 13; ++pre) {
        auto &here_dp = dp[13 + imod.mod[pre * 10 + val]];
        const auto &pre_dp = dp[pre];
        here_dp = pre_dp;
      }
    }

    //     for (int i = 0; i < 2; ++i) {
    //     for (int j = 0; j < 13; ++j) {
    //       std::cout << dp[i * 13 + j] << ",";
    //     }
    //     std::cout << std::endl;
    //   }
    //
    row_sum = 0;
    for (size_t i = 0; i < 13; ++i) {
      dp[i] = dp[13 + i] % MOD;
      row_sum += dp[i];
      // dp[i] = dp[13 + i];
      dp[13 + i] = 0;
    }
    row_sum %= MOD;
  }

  std::cout << dp[5] % MOD << "\n";
  return 0;
}

Measured memory_bytes: 512
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int n, a, b;

int main() {
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
}

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

namespace AtCoder {
	class Program {
		public static void Main() {
			long[] input = new long[2];
			input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
			long n = input[0];
			long k = input[1];
			long[] a = new long[n];
			long[] b = new long[n];
			for (long i = 0; i < n; i++) {
				input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
				a[i] = input[0];
				b[i] = input[1];
			}
			Array.Sort(a, b);
			long j = 0;
			long c = 0;
			while (c + b[j] < k) {
				c += b[j];
				j++;
			}
			Console.WriteLine(a[j]);
		}
	}
}


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


bool vector_finder(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


int main() {
    ll A, B, C, K;

    cin >> A >> B >> C >> K;

    ll ans = 0;

    
    if (K > A) {
      ans = A;
      K = K - A;
    } else {
      ans = K;
      cout << ans << endl;
      return 0;
    }

    if (K > B) {
      K = K - B;
    } else {
      cout << ans << endl;
      return 0;
    }

    if (K > C) {
      ans = ans - C;
      K = K - C;
    } else {
      ans = ans - K;
    }

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

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

int main() {
  
  string a, b;
  cin >> a >> b;
  
  if(a=="H" && b=="H") {
    
    cout << "H" << endl;
    
  } else if(a=="H" && b=="D") {
    
    cout << "D" << endl;
    
  }
  
  if(a=="D" && b=="H") {
    
    cout << "D" << endl;
    
  } else if(a=="D" && b=="D") {
    
    cout << "H" << endl;
    
  }
  
  return 0;
  
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

const int MAX_N = 1005;

//??????A[a,b]??¨??????B[c,d]?????¢???
int intervalState(int a, int b, int c, int d){
    if(a < c && b < c) return 0;            //A < B
    else if(a > d && b > d) return 1;       //A > B
    else if(a <= c && d <= b) return 2;     //A -> B
    else if(c < a && b < d) return 3;       //B -> A
    else if(a <= c && b < d) return 4;      //A <= B
    else if(c < a && d <= b) return 5;      //A >= B
    return -1;
}

//Give input directly to vector<pair<int, int>> in
vector<pair<int, int>> JoinInterval(vector<pair<int,int>> in){
    vector<pair<int, int>> v;
    rep(i,in.size()) in[i].second *= -1;
    sort(all(in));
    rep(i,in.size()) in[i].second *= -1;

    rep(i,in.size()){
        if(v.empty()) v.emplace_back(in[i]);
        else{
            pair<int, int> &u = v.back();
            int tmp = intervalState(in[i].first,in[i].second,u.first,u.second);
            switch (tmp){
                case 0:
                case 1:
                    v.emplace_back(in[i]);
                    break;
                case 2:
                    u.first = in[i].first;
                    u.second = in[i].second;
                    break;
                case 3:
                    break;
                case 4:
                case 5:
                    u.first = min(u.first, in[i].first);
                    u.second = max(u.second, in[i].second);
                    break;
                case -1:
                    assert(0);
            }
        }
    }
    sort(all(v));
    return v;
}

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

    vector<pair<int,int>> in;
    rep(i,m){
        int a, b;
        cin >> a >> b;
        in.emplace_back(make_pair(a,b));
    }
    vector<pair<int, int>> v = JoinInterval(in);

    int cur = 0, ans = 0;
    rep(i,v.size()){
        //cout << v[i].first << ' ' << v[i].second << endl;
        ans += v[i].first - cur;
        ans += (v[i].second - v[i].first) * 3;
        cur = v[i].second;
    }
    ans += n + 1 - cur;
    cout << ans << endl;
}

Measured memory_bytes: 3128
#include <cstdio>

using namespace std;

int parent( int i ){

    return i/2;

}

int left( int i ){

    return 2*i;

}

int right( int i ){

    return 2*i + 1 ;

}



int main(){

    int n, i;

    scanf("%d", &n);

    int A[n+1];

    for( i = 1; i <= n; i++) scanf("%d", &A[i]);

    for( i = 1; i <= n; i++){

        printf("node %d: key = %d, ", i, A[i]);

        if( parent(i) > 0 ){

            printf("parent key = %d, ", A[ parent(i) ] );

        }

        if( left(i) <= n ){

            printf("left key = %d, ", A[ left(i) ] );

        }

        if( right(i) <= n ){

            printf("right key = %d, ", A[ right(i) ] );

        }

        printf("\n");

    }

    return 0;

}


Measured memory_bytes: 2740
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
const int maxn = 5e5 + 5;
char a[maxn];
int pre[maxn] , suf[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin >> a; int n = strlen(a);
    bool ok = true;
    for (int i = 0 ; i < n ; i++)
        if (a[i] != a[0]) ok = false;
    if (ok){
        cout << n << endl << 1 << endl;
        return 0;
    }
    for (int i = 0 , j = pre[0] = -1 ; i < n ;  pre[++i] = ++j)
        while (~j && a[i] != a[j]) j = pre[j];
    reverse(a , a + n);
    for (int i = 0 , j = suf[0] = -1 ; i < n ; suf[++i] = ++j)
        while (~j && a[i] != a[j]) j = suf[j];
    // 没有循环节
    if (pre[n] == 0 || n % (n - pre[n])){
        cout << 1 << endl << 1 << endl;
        return 0;
    }
    cout << 2 << endl;
    int ans = 0;
    for (int i = 1 ; i <= n ; i++){
        if (pre[i] != 0 && i % (i - pre[i]) == 0) continue;
        if (suf[n - i] != 0 && (n - i) % ((n - i) - suf[n - i]) == 0) continue;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8036
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int N;
int A[20];
int B;
int C[19];
int ret;

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


    cin >> N;

    rep(i, N) cin >> A[i];
    rep(i, N) { cin >> B; ret += B; }
    rep(i, N - 1) cin >> C[i];

    rep(i, N - 1)
    {
        if (A[i] + 1 == A[i + 1])
        {
            ret += C[A[i] - 1];
        }
    }

    cout << ret << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>

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

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

    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin>>v[i];
    sort(v.begin(),v.end());
    cout<<v[n/2]-v[n/2-1];

    return 0;
}


Measured memory_bytes: 640
///Atcoder
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000

#define ll long long
#define sc scanf
#define pf printf
//#define pi 2*acos(0.0)

#define ft first
#define se second
#define Max 10001000
#define st(s) s.size();
#define r(input) freopen("input.txt","r",stdin)
#define w(output) freopen("output.txt","w",stdout)
#define maxall(v) *max_element(v.begin(),v.end())
#define minall(v) *min_element(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define un(v) Sort(v), v.erase(unique(v.begin(),v.end()),v.end())
#define cover(a,d) memset(a,d,sizeof(a))

using namespace std;


int main()
{
    ll a,b=0,n;
    cin>>a>>b;
    ll k;
    n=a+b;
    k=n/2;
    if(k*2==n)
        cout<<k<<endl;
    else
        cout<<"IMPOSSIBLE"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
ll gcd(ll a2,ll b2){
	int t;
	while(b2!=0){
		t=a2%b2;
		a2=b2;
		b2=t;
	}
	return a2;
}
ll lcm(ll a1,ll b1){
	if(a1*b1==0){return 0;}
	return (a1*b1/gcd(a1,b1));
}


int main() {

	int n;
	cin>>n;

	ll t=100000;
	rep(i,n){
		t+=t*0.05;
		if(t%1000>0)t=t+1000-t%1000;
	}
	cout<<t<<endl;

	return 0;
}



Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int even  = s.nextInt(),odd= s.nextInt();
        long cnt =0;
        for(int i=1;i<even;i++){
            cnt+=(even-i);
        }
        for(int i=1;i<odd;i++){
            cnt+=(odd-i);
        }
        System.out.println(cnt);


    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25232
#17D8104026C 宮地拓海 Air_conditioner123 Python

def check(mid):
	global k, T, n

	i = 0
	for j in range(k):
		s = 0
		while s + T[i] <= mid:
			s += T[i]
			i += 1
			if (i == n):
				return n	
	return i

n, k = map(int, input().split())
T = [int(input()) for i in range(n)]
left = 0
right = 100000 * 10000

while right - left > 1:
	mid = (left + right) // 2
	v = check(mid)
	if (v >= n):
		right = mid
	else:
		left = mid

print(right)


Measured memory_bytes: 9556
//============================================================================
// Name        : Hello.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {

	int ab,bc,ca;
	cin>>ab>>bc>>ca;

	cout<<ab*bc/2<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;


int main()
{
	string S;
	int K;
	cin >> S >> K;
	set<string> st; 
	for (int i = 0; i < S.size(); i++) {
		for (int j = 1; j <= K; j++) {
			if (i + j > S.size()) continue;
			st.insert(S.substr(i, j));
		}
	}
	auto itr = st.begin();
	for (int i = 0; i < K - 1; i++) itr++;
	cout << *itr << endl;
}


Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

struct UnionFind{
  vi d;
  UnionFind(ll n=0):d(n,-1){}
  ll find(ll x){
    if(d[x]<0) return x;
    return d[x]=find(d[x]);
  }
  bool unite(ll x,ll y){
    x=find(x); y=find(y);
    if(x==y) return false;
    if(d[x]>d[y]) swap(x,y);
    d[x]+=d[y];
    d[y]=x;
    return true;
  }
  bool same(ll x,ll y){return find(x)==find(y);}
  ll size(ll x){return -d[find(x)];}
};

void solve(){
  int n,m;
  cin>>n>>m;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    uf.unite(a-1,b-1);
  }
  set<int> s;
  rep(i,n){
    s.insert(uf.find(i));
  }
  out(s.size()-1);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 7896
#include <bits/stdc++.h>
#include <queue>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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; }

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

    int N; cin >> N;
    int T; cin >> T;
    int A; cin >> A;
    int H[N]; for (int i=0; i<N; ++i) cin >> H[i];
    double min = double(INF32);
    int ans = 0;
    for (int i=0; i<N; ++i) {
        double tmp = abs(double(T) - double(H[i]) * 0.006 - double(A));
        if (min > tmp) {
            min = tmp;
            ans = i;
        }
    }
    cout << ans + 1 << '\n';
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef double dd;
const int MOD = 998244353;
#define ff first
#define ss second

template<typename T>
string to_string(vector<T> v) {
  string res;
  for(auto &i : v)
    res += char('0'+i), res += ' ';
  return res;
}
 
template<class A> void vbug(A x) {
  cout << to_string(x) << endl;
}

void solve(){
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>>v(k);
  for(int i = 0; i < k; i++){
    cin >> v[i].ff >> v[i].ss;
  }
  vector<int>dp(n+1, 0), pre(n+1, 0);
  dp[0] = 0;
  dp[1] = pre[1] = 1;
  for(int i = 2; i <= n; i++) {
    int tmp = 0;
    for(auto j : v) {
      int l = i-j.ff;
      int r = i-j.ss-1;
      l = max(0, l);
      r = max(0, r);
      tmp = ((tmp + pre[l]) % MOD - pre[r])%MOD;
    }
    tmp = (tmp+MOD)%MOD;
    dp[i] = tmp;
    pre[i] = (pre[i-1] + dp[i]) % MOD;
  }
  //vbug(dp);
  cout << dp[n] << endl;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t = 1, tt = 0;
  //cin >> t;
  while(t--){
    //tt++;
    //cout << "Case #" << t << ": ";
    solve();
  }
  return 0;
}


Measured memory_bytes: 4780
/*
    Don't practice until you get it right. Practice until you can't get it wrong.
*/

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

#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second

const int MAX = 1000055;
const int mod = 1000000007;
// const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const ll INF = LLONG_MAX;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}

	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=INT_MIN,mn=INT_MAX;
string s;

int main()
{
	vivek_ghosh;

		ll h1,m1,h2,m2,k;
		cin>>h1>>m1>>h2>>m2>>k;
		h1*=60;
		h1 += m1;
		h2 *= 60;
		h2 += m2;

		ans = max(0ll,h2-h1);
		cout<<ans-k<<endl;

	return 0;
}



















Measured memory_bytes: 3740
#include <stdio.h>

int main(void)
{

    int a, b, i;
    char op;

    while(1) {
    scanf("%d %c %d", &a, &op, &b);
    if (op == '+')
        printf("%d\n", a + b);
    if(op == '-')
        printf("%d\n", a - b);
    if(op == '/')
        printf("%d\n", a / b);
    if(op == '*')
        printf("%d\n", a * b);
    if(op == '?')
        break;
    }

    return 0;
}

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

#define ll long long
const int maxN=202000;
const ll INF=1e18;

int n;
ll Sum[maxN],F[maxN],G[maxN],Even[maxN],Cost[maxN];

int main(){
    scanf("%d",&n);
    for (int i=1;i<=n;i++){
        ll x;scanf("%lld",&x);Sum[i]=Sum[i-1]+x;
        Even[i]=Even[i-1]+(~x&1);Cost[i]=Cost[i-1]+(x<=2?2-x:(x&1));
    }
    //for (int i=1;i<=n;i++) cout<<Sum[i]<<" ";cout<<endl;
    //for (int i=1;i<=n;i++) cout<<Even[i]<<" ";cout<<endl;
    //for (int i=1;i<=n;i++) cout<<Cost[i]<<" ";cout<<endl;
    ll mn=0;
    for (int i=1;i<=n;i++) mn=min(mn,-Cost[i]+Sum[i]),F[i]=mn+Cost[i];
    mn=Cost[n];
    for (int i=n-1;i>=0;i--) mn=min(mn,Sum[n]+Cost[i]-Sum[i]),G[i]=mn-Cost[i];

    //for (int i=0;i<=n;i++) cout<<F[i]<<" ";cout<<endl;
    //for (int i=0;i<=n;i++) cout<<G[i]<<" ";cout<<endl;

    ll Ans=INF;mn=INF;
    for (int i=0;i<=n;i++) mn=min(mn,F[i]-Even[i]),Ans=min(Ans,mn+Even[i]+G[i]);
    printf("%lld\n",Ans);return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin >> s;
  long long int a=0,b=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0')a++;
    else b++;
  }
  cout << min(a,b)*2 <<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
//const ll p = 1e9 + 7;
//const ll p = 998244353;
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);

	string s;
	ll k;
	cin >> s >> k;
	ll n = s.size();

	vll cnt(n, 0);
	for (ll i = 0; i < n; i++) {
		if (s[i] != 'a') {
			cnt[i] = 26 - (s[i] - 'a');
		}
	}

	for (ll i = 0; i < n; i++) {
		if (cnt[i] <= k) {
			s[i] = 'a';
			k -= cnt[i];
		}
	}
	k %= 26;
	while (k) {
		if (s[n - 1] == 'z') s[n - 1] = 'a';
		else s[n - 1]++;
		k--;
	}

	cout << s << endl;
}


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

int main(){
    int n;
    string a[110];
    while(cin >> n && n){
        rep(i,n){
            string s;
            cin >> s;
            string t;
            rep(j,s.size()){
                if(j == 0 || string("aiueo").find(s[j-1]) != string::npos){
                    t += s[j];
                }
            }
            a[i] = t;
        }

        int i;
        for(i = 1; i < 120; ++i){
            string b[110];
            rep(j,n) b[j] = a[j].substr(0,i);
            sort(b, b+n);
            if(unique(b, b+n) == b+n) break;
        }
        if(i == 120) i = -1;
        cout << i << endl;
    }
}

Measured memory_bytes: 3244
#include<stdio.h>
#include<math.h>
int main(void)
{
	int i,n,x[100],y[100];
  	double D1=0,D2=0,Dm=0,D3=0,ab[100];
  	scanf("%d",&n);
  	for(i=0;i<n;i++){scanf("%d",&x[i]);}
  	for(i=0;i<n;i++){scanf("%d",&y[i]);}
  	for(i=0;i<n;i++)
    {
	    ab[i]=abs(x[i]-y[i]);
	    /*Dm*/
	    if(i == 0){Dm = ab[0];}
	    else if(ab[i]>Dm){Dm = ab[i];}
	    /*D1*/
	    D1 += ab[i];
	    /*D2*/
	    D2 += ab[i]*ab[i];
	    /*D3*/
      	D3 += pow(ab[i],3.0);
    }
  printf("%f\n%f\n%f\n%f\n",D1,sqrt(D2),pow(D3,1.0/3.0),Dm);
  return 0;
}

Measured memory_bytes: 696
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n-1;i++)
    {
        double temp=(a[i]+a[i+1])/2;
        a[i+1]=temp;
    }
    cout<<a[n-1];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...U>void _(const char*s,T h,U...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}//break continue pop_back
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...)
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=1e5+2,OO=1e9+7;
int a[N];
int el[N];
int32_t main(){

    int n;
    cin>>n;
    for(int i=1;i<=n;++i)cin>>a[i];
    el[0]=OO;
    for(int i=1;i<=n;++i)el[i]=-OO;
    for(int i=1;i<=n;++i){
        int l=0,r=n+1;
        while(r-l>1){
            int m=(l+r)/2;
            if(el[m]>=a[i])l=m;
            else r=m;
        }
        el[l+1]=a[i];
    }
    for(int i=n;;--i){
        if(el[i]!=-OO){
            cout<<i<<'\n';
            break;
        }
    }

    return 0;
}


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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME (1ll<<61)-1

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


struct Vertex{
	vector<int> nxt;
	vector<int> cost;
	int clr=-1;
};

int N;
vector<Vertex> ver;

void input() {
	cin>>N;
	ver.resize(N);
	for(int i=0; i<N-1; i++) {
		int u,v,w; cin>>u>>v>>w;
		u--,v--;
		ver[u].nxt.pushb(v);
		ver[u].cost.pushb(w);
		ver[v].nxt.pushb(u);
		ver[v].cost.pushb(w);
	}
}

void solve() {
	ver[0].clr=0;
	intq q;
	q.push(0);
	while(!q.empty()) {
		int idx=q.front(); q.pop();
		for(int i=0; i<ver[idx].nxt.size(); i++) {
			int v=ver[idx].nxt[i], w=ver[idx].cost[i];
			if(ver[v].clr>=0) continue;
			if(w%2) ver[v].clr = ver[idx].clr^1;
			else    ver[v].clr = ver[idx].clr;
			q.push(v);
		}
	}

	for(int i=0; i<N; i++) {
		cout<<ver[i].clr<<'\n';
	}
	cout<<flush;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 15076
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(int i=0;i<n;i++)
#define repf(i,f,n) for(int i=f;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())



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


int main() {
  ull X,Y;
  cin >> X >> Y;
  ull ans=0;

  ull num=X;

  while(num<=Y){
    ans++;
    num*=2;
  }



  cout << ans << endl;

}

















//


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;

inline int read(){
	int s=0,w=1;
	char ch = getchar();
	while(ch < '0' || ch > '9'){
		if(ch == '-')w = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		s = s*10+ch-'0';
		ch = getchar();
	}
	return w*s;
}

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

Measured memory_bytes: 256